@panphora/clayjs 1.26.0 → 1.26.2

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.
Files changed (102) hide show
  1. package/dist/all.js +1 -1
  2. package/dist/clay-dom.js +1 -1
  3. package/dist/clay-events.js +1 -1
  4. package/dist/clay-internals.js +1 -1
  5. package/dist/clay-options.js +1 -1
  6. package/dist/clay-router.js +1 -1
  7. package/dist/clay-ui.js +1 -1
  8. package/dist/clay-utils.js +1 -1
  9. package/dist/clay.js +1 -1
  10. package/dist/clay.standalone.js +5 -4
  11. package/dist/m/{c-EQ5NBOGA.js → c-26W3BMWK.js} +1 -1
  12. package/dist/m/{c-AQVQKFKB.js → c-3JQY5MB2.js} +1 -1
  13. package/dist/m/{c-MKAUC6DB.js → c-3KG4SDZ5.js} +1 -1
  14. package/dist/m/{c-HYNM5U6B.js → c-5CJCIAFK.js} +1 -1
  15. package/dist/m/{c-O3DPFZCE.js → c-6266A3CU.js} +1 -1
  16. package/dist/m/{c-WOJ2RTV4.js → c-627JDXWT.js} +1 -1
  17. package/dist/m/{c-MMEVDN6D.js → c-7PZS45FY.js} +1 -1
  18. package/dist/m/{c-NYJ577NL.js → c-7RJCYD4F.js} +1 -1
  19. package/dist/m/{c-EHAR4RJJ.js → c-CKG4NF7J.js} +2 -2
  20. package/dist/m/{c-EXZOA6XY.js → c-E37MV4WS.js} +1 -1
  21. package/dist/m/{c-N4GEJMXW.js → c-EFXPKDJP.js} +1 -1
  22. package/dist/m/{c-ZPI7M5U5.js → c-G426P2SE.js} +1 -1
  23. package/dist/m/{c-BJ2RRQBQ.js → c-GXOUAT7E.js} +1 -1
  24. package/dist/m/{c-VU4WEWPH.js → c-H25R2UF3.js} +1 -1
  25. package/dist/m/{c-VO6RSFCO.js → c-HBSBQBD7.js} +1 -1
  26. package/dist/m/{c-CL5LSATX.js → c-I4ZVJZC7.js} +1 -1
  27. package/dist/m/{c-67TBU56I.js → c-I62KCFMW.js} +1 -1
  28. package/dist/m/{c-Y3MPVURA.js → c-IJ4VUYDN.js} +1 -1
  29. package/dist/m/{c-FC5RUFPR.js → c-IOJOJTPL.js} +1 -1
  30. package/dist/m/{c-HXGNH6GY.js → c-IPCSVZAB.js} +1 -1
  31. package/dist/m/c-JEWSJHMK.js +1 -0
  32. package/dist/m/{c-3F3AADKG.js → c-JOA4OJGK.js} +1 -1
  33. package/dist/m/{c-GFASNR55.js → c-JUSHNY3I.js} +1 -1
  34. package/dist/m/{c-7RHOMAMR.js → c-K5HRHUTK.js} +1 -1
  35. package/dist/m/{c-H3M6UDNV.js → c-KFXW6SZO.js} +1 -1
  36. package/dist/m/{c-EAV7A6BT.js → c-MB5FZ2PD.js} +1 -1
  37. package/dist/m/{c-2EPHRF47.js → c-MIQYK2VM.js} +1 -1
  38. package/dist/m/{c-ARO6CPMA.js → c-O3BSWMVD.js} +1 -1
  39. package/dist/m/{c-U35T5NAY.js → c-O54PVIAQ.js} +1 -1
  40. package/dist/m/{c-H4M2T4A6.js → c-OEEJRV2M.js} +1 -1
  41. package/dist/m/{c-KU3PX7LL.js → c-OSGTRM4C.js} +1 -1
  42. package/dist/m/{c-YZGWSCMT.js → c-QLGTY326.js} +1 -1
  43. package/dist/m/{c-WOWGGNCJ.js → c-RC37IFYT.js} +1 -1
  44. package/dist/m/{c-SMLAJASY.js → c-RHYX6KUH.js} +1 -1
  45. package/dist/m/{c-RGFPLQGV.js → c-SMCZC3V6.js} +1 -1
  46. package/dist/m/{c-P73XPAOA.js → c-T6RRRHX7.js} +1 -1
  47. package/dist/m/{c-3S5TNRZA.js → c-USO6XV23.js} +1 -1
  48. package/dist/m/{c-ZFAPQQIB.js → c-VPUSMVKE.js} +1 -1
  49. package/dist/m/{c-YYIN4NAF.js → c-VXJJ7BJL.js} +1 -1
  50. package/dist/m/{c-EEWPNUM2.js → c-W3DMFFGK.js} +1 -1
  51. package/dist/m/{c-755ZOHOM.js → c-W5HY5JHM.js} +1 -1
  52. package/dist/m/{c-C5UGNOC2.js → c-WJVW76R6.js} +1 -1
  53. package/dist/m/{c-Q2CB57UG.js → c-X3WLDGBX.js} +1 -1
  54. package/dist/m/{c-SRW5OBCF.js → c-XLVZN7DT.js} +1 -1
  55. package/dist/m/{c-3WX5FABT.js → c-YIFBOWQE.js} +1 -1
  56. package/dist/m/{c-34J5HC7N.js → c-YJS2V3MX.js} +1 -1
  57. package/dist/m/core/{admin-attrs-43JBA6JB.js → admin-attrs-H26XE2AE.js} +1 -1
  58. package/dist/m/core/{autosave-HD7Y7UNV.js → autosave-U5UIKPM3.js} +1 -1
  59. package/dist/m/core/{conflict-notice-UNDOD4BL.js → conflict-notice-HTF6CECH.js} +1 -1
  60. package/dist/m/core/{host-permission-5BYP24GC.js → host-permission-JHMPKRPO.js} +1 -1
  61. package/dist/m/core/{is-edit-mode-73OXKK5H.js → is-edit-mode-QBJUFMVF.js} +1 -1
  62. package/dist/m/core/{persist-MX3VYVBN.js → persist-TRXZPS6T.js} +1 -1
  63. package/dist/m/core/{recovery-VZF7RJZF.js → recovery-YJS7CI66.js} +1 -1
  64. package/dist/m/core/{save-JZ7R4ET2.js → save-KY3ZMPU4.js} +1 -1
  65. package/dist/m/core/{save-core-I4N6S4ED.js → save-core-LBW6DNJ6.js} +1 -1
  66. package/dist/m/core/{site-edits-C22O53GS.js → site-edits-M44KWAQN.js} +1 -1
  67. package/dist/m/core/{unsaved-warning-BP6ZY3PG.js → unsaved-warning-2X7NJNHZ.js} +1 -1
  68. package/dist/m/internals/{index-3LAVREAU.js → index-CDXUFQZK.js} +1 -1
  69. package/dist/m/{loader-DCKCZKY6.js → loader-CRCEH7TD.js} +1 -1
  70. package/dist/m/manifest-6D031725.js +1 -0
  71. package/dist/m/{manifest-edit-93AA79D7.js → manifest-edit-A75598BC.js} +1 -1
  72. package/dist/m/manifest.json +593 -593
  73. package/dist/m/plugins/{ai-edit-WDV2GLDU.js → ai-edit-T2SM7TRD.js} +1 -1
  74. package/dist/m/plugins/{demo-LMCMBILC.js → demo-57MJ3GOO.js} +1 -1
  75. package/dist/m/plugins/{derive-R4USHZ7P.js → derive-TRMYDN7J.js} +1 -1
  76. package/dist/m/plugins/{indicator-OLPZ4WFI.js → indicator-D5PZJGVS.js} +1 -1
  77. package/dist/m/plugins/{live-DF5YS5AH.js → live-J52JO243.js} +1 -1
  78. package/dist/m/plugins/{menu-ESEFQARM.js → menu-KCCEDUMJ.js} +1 -1
  79. package/dist/m/plugins/{page-GZSU77JS.js → page-F7JG3JZX.js} +2 -2
  80. package/dist/m/plugins/{page-view-7MM3FEAR.js → page-view-QPRXXAT3.js} +1 -1
  81. package/dist/m/plugins/{people-EBWE337I.js → people-FEMXINJK.js} +1 -1
  82. package/dist/m/plugins/{richclay-MXH2GFAZ.js → richclay-XL64ZGOZ.js} +2 -2
  83. package/dist/m/plugins/{sortable-BAG3MSWS.js → sortable-HE7Q4KKP.js} +1 -1
  84. package/dist/m/plugins/{source-OYHDXKTB.js → source-5RTLTD75.js} +1 -1
  85. package/dist/m/plugins/{undo-KLHAGV75.js → undo-5MFW3OD5.js} +1 -1
  86. package/dist/m/plugins/{upgrade-SZQJYEQQ.js → upgrade-ORK24FK6.js} +1 -1
  87. package/dist/m/plugins/{upload-NZET3DNQ.js → upload-YMBDWTLR.js} +1 -1
  88. package/dist/m/plugins/{visitor-drafts-ZE6PCAFP.js → visitor-drafts-DCVGLCBX.js} +2 -2
  89. package/dist/m/plugins/{visitor-drafts-owner-TLECTYWS.js → visitor-drafts-owner-QLF6IALP.js} +1 -1
  90. package/dist/m/plugins/{visitor-menu-5XY57JQA.js → visitor-menu-VNWJZ6PV.js} +1 -1
  91. package/dist/m/plugins/{wire-S5ATC4QI.js → wire-I3TDGBGZ.js} +1 -1
  92. package/dist/m/{reader-core-AHOAP5DH.js → reader-core-7JOVUCEQ.js} +2 -2
  93. package/dist/m/sync/{live-sync-RZQSDMZW.js → live-sync-2UYQQSD7.js} +1 -1
  94. package/dist/m/vendor/{sap-core.vendor-5TWOJYVM.js → sap-core.vendor-UYOHDPAV.js} +1 -1
  95. package/dist/offline-manifest.json +388 -388
  96. package/entries/sap.js +1 -1
  97. package/package.json +1 -1
  98. package/src/core/mode-receipt.js +7 -5
  99. package/src/vendor/sap-core.vendor.js +1 -1
  100. package/dist/m/c-C7SUMNMI.js +0 -1
  101. package/dist/m/manifest-7954CBE3.js +0 -1
  102. /package/dist/m/plugins/{richclay-MXH2GFAZ.js.LEGAL.txt → richclay-XL64ZGOZ.js.LEGAL.txt} +0 -0
package/dist/all.js CHANGED
@@ -70,7 +70,7 @@
70
70
  });
71
71
  }
72
72
  return { tree: tree, runtime: clay.__runtime };
73
- })({"dir":"m/","manifest":"manifest-7954CBE3.js","edit":"manifest-edit-93AA79D7.js","preload":["dom/all-APS5ZSKP.js","c-VHNSBD2M.js","manifest-7954CBE3.js"]})
73
+ })({"dir":"m/","manifest":"manifest-6D031725.js","edit":"manifest-edit-A75598BC.js","preload":["dom/all-APS5ZSKP.js","c-VHNSBD2M.js","manifest-6D031725.js"]})
74
74
 
75
75
  clay.loaded.all = __clayChunks.runtime.then(function (R) {
76
76
  if (!R.chunks) return import(__clayChunks.tree + "/src/dom/all.js");
package/dist/clay-dom.js CHANGED
@@ -70,7 +70,7 @@
70
70
  });
71
71
  }
72
72
  return { tree: tree, runtime: clay.__runtime };
73
- })({"dir":"m/","manifest":"manifest-7954CBE3.js","edit":"manifest-edit-93AA79D7.js","preload":["dom/dom-helpers-L7OSR6S4.js","c-XQXZAO7N.js","c-WRBKEJD4.js","c-VHNSBD2M.js","manifest-7954CBE3.js"]})
73
+ })({"dir":"m/","manifest":"manifest-6D031725.js","edit":"manifest-edit-A75598BC.js","preload":["dom/dom-helpers-L7OSR6S4.js","c-XQXZAO7N.js","c-WRBKEJD4.js","c-VHNSBD2M.js","manifest-6D031725.js"]})
74
74
 
75
75
  clay.loaded.dom = __clayChunks.runtime.then(function (R) {
76
76
  if (!R.chunks) return import(__clayChunks.tree + "/src/dom/dom-helpers.js");
@@ -70,7 +70,7 @@
70
70
  });
71
71
  }
72
72
  return { tree: tree, runtime: clay.__runtime };
73
- })({"dir":"m/","manifest":"manifest-7954CBE3.js","edit":"manifest-edit-93AA79D7.js","preload":["events/index-YKQIBZE5.js","c-MZCOGNZL.js","c-IJUK2GPW.js","c-MOP5KBWZ.js","c-2YYDMLNZ.js","c-HA6INT6J.js","c-WRBKEJD4.js","c-ICMAOOGK.js","c-VHNSBD2M.js","manifest-7954CBE3.js"]})
73
+ })({"dir":"m/","manifest":"manifest-6D031725.js","edit":"manifest-edit-A75598BC.js","preload":["events/index-YKQIBZE5.js","c-MZCOGNZL.js","c-IJUK2GPW.js","c-MOP5KBWZ.js","c-2YYDMLNZ.js","c-HA6INT6J.js","c-WRBKEJD4.js","c-ICMAOOGK.js","c-VHNSBD2M.js","manifest-6D031725.js"]})
74
74
 
75
75
  // The mutation-backed attrs subscribe to a hub that observes document.body, so
76
76
  // wait for DOM ready before importing (same gate as clay.js).
@@ -70,7 +70,7 @@
70
70
  });
71
71
  }
72
72
  return { tree: tree, runtime: clay.__runtime };
73
- })({"dir":"m/","manifest":"manifest-7954CBE3.js","edit":"manifest-edit-93AA79D7.js","preload":["internals/index-3LAVREAU.js","c-EHAR4RJJ.js","c-LD6UVV5R.js","c-PGSBXHUE.js","c-KU3PX7LL.js","c-EQ5NBOGA.js","c-C7SUMNMI.js","c-BPF2NSPV.js","c-HA6INT6J.js","c-WRBKEJD4.js","c-P7KNDG34.js","c-CYWLPPUS.js","c-U4TWEIKZ.js","c-IJUK2GPW.js","c-UW6MMZ4V.js","c-XQXZAO7N.js","c-S7LK4KUE.js","c-MOP5KBWZ.js","c-2YYDMLNZ.js","c-ICMAOOGK.js","c-VHNSBD2M.js","manifest-7954CBE3.js"]})
73
+ })({"dir":"m/","manifest":"manifest-6D031725.js","edit":"manifest-edit-A75598BC.js","preload":["internals/index-CDXUFQZK.js","c-CKG4NF7J.js","c-LD6UVV5R.js","c-PGSBXHUE.js","c-OSGTRM4C.js","c-26W3BMWK.js","c-JEWSJHMK.js","c-BPF2NSPV.js","c-HA6INT6J.js","c-WRBKEJD4.js","c-P7KNDG34.js","c-CYWLPPUS.js","c-U4TWEIKZ.js","c-IJUK2GPW.js","c-UW6MMZ4V.js","c-XQXZAO7N.js","c-S7LK4KUE.js","c-MOP5KBWZ.js","c-2YYDMLNZ.js","c-ICMAOOGK.js","c-VHNSBD2M.js","manifest-6D031725.js"]})
74
74
 
75
75
  // No DOM gate: nothing here touches document.body at import time, unlike clay-ui.
76
76
  clay.loaded.internals = __clayChunks.runtime.then(function (R) {
@@ -70,7 +70,7 @@
70
70
  });
71
71
  }
72
72
  return { tree: tree, runtime: clay.__runtime };
73
- })({"dir":"m/","manifest":"manifest-7954CBE3.js","edit":"manifest-edit-93AA79D7.js","preload":["options/options-LKIZ7YTG.js","c-7SWMYKAI.js","c-MZCOGNZL.js","c-IJUK2GPW.js","c-MOP5KBWZ.js","c-2YYDMLNZ.js","c-HA6INT6J.js","c-WRBKEJD4.js","c-ICMAOOGK.js","c-VHNSBD2M.js","manifest-7954CBE3.js"]})
73
+ })({"dir":"m/","manifest":"manifest-6D031725.js","edit":"manifest-edit-A75598BC.js","preload":["options/options-LKIZ7YTG.js","c-7SWMYKAI.js","c-MZCOGNZL.js","c-IJUK2GPW.js","c-MOP5KBWZ.js","c-2YYDMLNZ.js","c-HA6INT6J.js","c-WRBKEJD4.js","c-ICMAOOGK.js","c-VHNSBD2M.js","manifest-6D031725.js"]})
74
74
 
75
75
  // Subscribes to the mutation hub (observes document.body); wait for DOM ready.
76
76
  function domReady() {
@@ -70,7 +70,7 @@
70
70
  });
71
71
  }
72
72
  return { tree: tree, runtime: clay.__runtime };
73
- })({"dir":"m/","manifest":"manifest-7954CBE3.js","edit":"manifest-edit-93AA79D7.js","preload":["route/route-62CHXL5B.js","c-VHNSBD2M.js","manifest-7954CBE3.js"]})
73
+ })({"dir":"m/","manifest":"manifest-6D031725.js","edit":"manifest-edit-A75598BC.js","preload":["route/route-62CHXL5B.js","c-VHNSBD2M.js","manifest-6D031725.js"]})
74
74
 
75
75
  // Mirror the hash onto <html> now, before the module loads, so a saved
76
76
  // show-when:route-* rule is right at first paint. The module re-applies.
package/dist/clay-ui.js CHANGED
@@ -70,7 +70,7 @@
70
70
  });
71
71
  }
72
72
  return { tree: tree, runtime: clay.__runtime };
73
- })({"dir":"m/","manifest":"manifest-7954CBE3.js","edit":"manifest-edit-93AA79D7.js","preload":["ui/index-G7ZJXNMG.js","c-K2ZHQMPF.js","c-4M2T676V.js","c-OZOACVUD.js","c-J2ZW4HMR.js","c-A5LASUEZ.js","c-5RZNFTWD.js","c-NUHP2XDB.js","c-PKCCHJ5X.js","c-QHWJ5ZIJ.js","c-4JZDZFF6.js","c-46XYM55L.js","c-EIDZHQHZ.js","c-QY7F6EN6.js","c-ICMAOOGK.js","c-WRBKEJD4.js","c-UL2YUY52.js","c-VKEDWYDF.js","c-5KXDKC5G.js","c-VHNSBD2M.js","manifest-7954CBE3.js"]})
73
+ })({"dir":"m/","manifest":"manifest-6D031725.js","edit":"manifest-edit-A75598BC.js","preload":["ui/index-G7ZJXNMG.js","c-K2ZHQMPF.js","c-4M2T676V.js","c-OZOACVUD.js","c-J2ZW4HMR.js","c-A5LASUEZ.js","c-5RZNFTWD.js","c-NUHP2XDB.js","c-PKCCHJ5X.js","c-QHWJ5ZIJ.js","c-4JZDZFF6.js","c-46XYM55L.js","c-EIDZHQHZ.js","c-QY7F6EN6.js","c-ICMAOOGK.js","c-WRBKEJD4.js","c-UL2YUY52.js","c-VKEDWYDF.js","c-5KXDKC5G.js","c-VHNSBD2M.js","manifest-6D031725.js"]})
74
74
 
75
75
  // Toasts and dialogs append to document.body, so `loaded.ui` must not resolve
76
76
  // before the DOM is ready (same gate as clay-events).
@@ -70,7 +70,7 @@
70
70
  });
71
71
  }
72
72
  return { tree: tree, runtime: clay.__runtime };
73
- })({"dir":"m/","manifest":"manifest-7954CBE3.js","edit":"manifest-edit-93AA79D7.js","preload":["utils/index-4TJCVLT7.js","c-UL2YUY52.js","c-GQ6F6IDK.js","c-P7KNDG34.js","c-VHNSBD2M.js","manifest-7954CBE3.js"]})
73
+ })({"dir":"m/","manifest":"manifest-6D031725.js","edit":"manifest-edit-A75598BC.js","preload":["utils/index-4TJCVLT7.js","c-UL2YUY52.js","c-GQ6F6IDK.js","c-P7KNDG34.js","c-VHNSBD2M.js","manifest-6D031725.js"]})
74
74
 
75
75
  clay.loaded.utils = __clayChunks.runtime.then(function (R) {
76
76
  if (!R.chunks) return import(__clayChunks.tree + "/src/utils/index.js");
package/dist/clay.js CHANGED
@@ -122,7 +122,7 @@
122
122
  });
123
123
  }
124
124
  return { tree: tree, runtime: clay.__runtime };
125
- })({"dir":"m/","manifest":"manifest-7954CBE3.js","edit":"manifest-edit-93AA79D7.js","preload":["loader-DCKCZKY6.js","c-NL4I4KNG.js","c-7SWMYKAI.js","c-UGHH4MB3.js","c-MZCOGNZL.js","c-IJUK2GPW.js","c-MOP5KBWZ.js","c-2YYDMLNZ.js","c-HA6INT6J.js","c-WRBKEJD4.js","c-ICMAOOGK.js","c-VHNSBD2M.js","c-46XYM55L.js","c-FILLTJA7.js","c-VKEDWYDF.js","c-CYWLPPUS.js","manifest-7954CBE3.js","core/draft-mode-M5XNYBMY.js","c-U4TWEIKZ.js","core/is-edit-mode-73OXKK5H.js","c-C7SUMNMI.js","c-BPF2NSPV.js","c-P7KNDG34.js","lib/region-policy-KWBPROWF.js"]})
125
+ })({"dir":"m/","manifest":"manifest-6D031725.js","edit":"manifest-edit-A75598BC.js","preload":["loader-CRCEH7TD.js","c-NL4I4KNG.js","c-7SWMYKAI.js","c-UGHH4MB3.js","c-MZCOGNZL.js","c-IJUK2GPW.js","c-MOP5KBWZ.js","c-2YYDMLNZ.js","c-HA6INT6J.js","c-WRBKEJD4.js","c-ICMAOOGK.js","c-VHNSBD2M.js","c-46XYM55L.js","c-FILLTJA7.js","c-VKEDWYDF.js","c-CYWLPPUS.js","manifest-6D031725.js","core/draft-mode-M5XNYBMY.js","c-U4TWEIKZ.js","core/is-edit-mode-QBJUFMVF.js","c-JEWSJHMK.js","c-BPF2NSPV.js","c-P7KNDG34.js","lib/region-policy-KWBPROWF.js"]})
126
126
  __clayChunks.runtime.then(function (R) {
127
127
  if (!R.chunks) return import(__clayChunks.tree + "/src/loader.js");
128
128
  window.clay.__chunked = true;
@@ -1,4 +1,4 @@
1
- /* clayjs 1.26.0 standalone build: every clayjs module in one file. https://clayjs.com/offline
1
+ /* clayjs 1.26.2 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;
@@ -525,8 +525,9 @@
525
525
  }
526
526
  if (receipt3?.v !== 1 || receipt3.path !== location.pathname) return null;
527
527
  if (receipt3.mode !== "edit" && receipt3.mode !== "view") return null;
528
- if (Date.now() - receipt3.at > MAX_AGE_MS) return null;
529
- if (!receipt3.internal && navigationType() !== "reload") return null;
528
+ const nav = navigationType();
529
+ if (nav !== "back_forward" && Date.now() - receipt3.at > MAX_AGE_MS) return null;
530
+ if (!receipt3.internal && nav !== "reload" && nav !== "back_forward") return null;
530
531
  return receipt3;
531
532
  }
532
533
  function writeReceipt({ mode: mode3, canEdit: canEdit2, internal }) {
@@ -117289,7 +117290,7 @@ ${t2}` : `"use strict"; return (${t2});`;
117289
117290
  }
117290
117291
  return { status: r45, report: o3, debug: i2, greenLine: n3 };
117291
117292
  }
117292
- var Kt8 = "0.9.1";
117293
+ var Kt8 = "0.10.0";
117293
117294
  var nr4 = {};
117294
117295
  var wo3 = /^(https:\/\/(?:cdn\.jsdelivr\.net\/npm|unpkg\.com)\/@panphora\/sapjs)(?=[@/]|$)/, rr3 = (t2) => new Promise((e20) => setTimeout(e20, t2)), or4 = (t2) => t2.getAttribute("plugins")?.match(/\S+/g) || [];
117295
117296
  function ir4(t2, e20, r45) {
@@ -1 +1 @@
1
- import{b}from"./c-C7SUMNMI.js";import{c as x}from"./c-BPF2NSPV.js";var y="/_/meta",v=6e3,A=new WeakMap,S=new WeakMap,O=new WeakMap,_=0;function f(t,e=s(),n=null,o=null){return A.set(e,t),n!==null&&S.set(e,n),o!==null&&O.set(e,o),e}function g(t){return A.get(t)??"none"}function R(t){return S.get(t)}function $(t){return O.get(t)??0}function s(){return{spec:null,extensions:[],document:null}}var h=null,m=null;function d({fresh:t=!1}={}){if(b)return Promise.resolve(s());if(!t)return h||(h=T().catch(s)),h;if(!m){let e=h;m=T().catch(s).finally(()=>{m=null}),h=m.then(async n=>{if(g(n)==="ok"||!e)return n;let o=await e;return g(o)==="ok"?o:n})}return m}async function P(t){return(await d()).extensions.includes(t)}async function D(){return(await d()).extensions.includes("blockeditor-format-v1")?1:0}async function C(){let t=await d();return t.extensions.includes("blockeditor-recovery-v1")&&t.document?.blockeditorState?.href||null}async function H(){return(await d()).document?.versions===!0}var E=["codeEditor","versions","duplicate","reveal","export"];function M(t){if(typeof t!="string"||!t)return null;try{let e=new URL(t,location.href);return e.protocol==="http:"||e.protocol==="https:"?e:null}catch{return null}}async function N(){let e=(await d()).document?.actions,n={};if(!e||typeof e!="object")return n;for(let o of E){let i=M(e[o]?.href);if(i){n[o]={href:i.href};continue}let l=M(e[o]?.post);l&&l.origin===location.origin&&(n[o]={post:l.href})}return n}function W(){h=null,m=null}async function F({saveId:t,requestHash:e,signal:n}={}){if(b||typeof t!="string"||!t||typeof e!="string"||!e||!/^https?:$/.test(window.location.protocol)||n?.aborted)return null;let o=new AbortController,i=()=>o.abort(),l=setTimeout(i,v);n?.addEventListener("abort",i);try{let u=await d();if(g(u)!=="ok"||!u.extensions.includes("save-history")||o.signal.aborted)return null;let p=x(),r=p?`${y}/${p}`:y,w=await fetch(new URL(r,window.location.origin).href,{method:"GET",credentials:p?"omit":"same-origin",headers:{"Document-URL":window.location.href,"Save-ID":t,"Save-Request-Hash":e},cache:"no-store",redirect:"manual",signal:o.signal});if(!w.ok)return null;let k=await w.text();if(!k)return null;let c;try{c=JSON.parse(k)}catch{return null}if(!c||typeof c!="object"||typeof c.spec!="number"||!Array.isArray(c.extensions)||!c.extensions.includes("save-history"))return null;let a=c.document&&typeof c.document=="object"?c.document.saveOutcome:null;return!a||typeof a!="object"||a.saveId!==t||a.requestHash!==e||a.status!=="applied"&&a.status!=="unknown"?null:{saveId:t,requestHash:e,status:a.status}}catch{return null}finally{clearTimeout(l),n?.removeEventListener("abort",i)}}async function T(){let t=location.pathname,e=++_;if(!/^https?:$/.test(window.location.protocol))return f("none",s(),t,e);let n=x(),o=n?`${y}/${n}`:y,i=new AbortController,l=setTimeout(()=>i.abort(),v);try{let u=await fetch(new URL(o,window.location.origin).href,{method:"GET",credentials:n?"omit":"same-origin",headers:{"Document-URL":window.location.href},cache:"no-store",redirect:"manual",signal:i.signal});if(!u.ok)return f(u.status>=500?"failed":"none",s(),t,e);let p=await u.text();if(!p)return f("none",s(),t,e);let r;try{r=JSON.parse(p)}catch{return f("none",s(),t,e)}return!r||typeof r!="object"||typeof r.spec!="number"?f("none",s(),t,e):f("ok",{spec:r.spec,extensions:Array.isArray(r.extensions)?r.extensions:[],document:r.document&&typeof r.document=="object"?r.document:null},t,e)}catch{return f("failed",s(),t,e)}finally{clearTimeout(l)}}export{g as a,R as b,$ as c,d,P as e,D as f,C as g,H as h,N as i,W as j,F as k};
1
+ import{b}from"./c-JEWSJHMK.js";import{c as x}from"./c-BPF2NSPV.js";var y="/_/meta",v=6e3,A=new WeakMap,S=new WeakMap,O=new WeakMap,_=0;function f(t,e=s(),n=null,o=null){return A.set(e,t),n!==null&&S.set(e,n),o!==null&&O.set(e,o),e}function g(t){return A.get(t)??"none"}function R(t){return S.get(t)}function $(t){return O.get(t)??0}function s(){return{spec:null,extensions:[],document:null}}var h=null,m=null;function d({fresh:t=!1}={}){if(b)return Promise.resolve(s());if(!t)return h||(h=T().catch(s)),h;if(!m){let e=h;m=T().catch(s).finally(()=>{m=null}),h=m.then(async n=>{if(g(n)==="ok"||!e)return n;let o=await e;return g(o)==="ok"?o:n})}return m}async function P(t){return(await d()).extensions.includes(t)}async function D(){return(await d()).extensions.includes("blockeditor-format-v1")?1:0}async function C(){let t=await d();return t.extensions.includes("blockeditor-recovery-v1")&&t.document?.blockeditorState?.href||null}async function H(){return(await d()).document?.versions===!0}var E=["codeEditor","versions","duplicate","reveal","export"];function M(t){if(typeof t!="string"||!t)return null;try{let e=new URL(t,location.href);return e.protocol==="http:"||e.protocol==="https:"?e:null}catch{return null}}async function N(){let e=(await d()).document?.actions,n={};if(!e||typeof e!="object")return n;for(let o of E){let i=M(e[o]?.href);if(i){n[o]={href:i.href};continue}let l=M(e[o]?.post);l&&l.origin===location.origin&&(n[o]={post:l.href})}return n}function W(){h=null,m=null}async function F({saveId:t,requestHash:e,signal:n}={}){if(b||typeof t!="string"||!t||typeof e!="string"||!e||!/^https?:$/.test(window.location.protocol)||n?.aborted)return null;let o=new AbortController,i=()=>o.abort(),l=setTimeout(i,v);n?.addEventListener("abort",i);try{let u=await d();if(g(u)!=="ok"||!u.extensions.includes("save-history")||o.signal.aborted)return null;let p=x(),r=p?`${y}/${p}`:y,w=await fetch(new URL(r,window.location.origin).href,{method:"GET",credentials:p?"omit":"same-origin",headers:{"Document-URL":window.location.href,"Save-ID":t,"Save-Request-Hash":e},cache:"no-store",redirect:"manual",signal:o.signal});if(!w.ok)return null;let k=await w.text();if(!k)return null;let c;try{c=JSON.parse(k)}catch{return null}if(!c||typeof c!="object"||typeof c.spec!="number"||!Array.isArray(c.extensions)||!c.extensions.includes("save-history"))return null;let a=c.document&&typeof c.document=="object"?c.document.saveOutcome:null;return!a||typeof a!="object"||a.saveId!==t||a.requestHash!==e||a.status!=="applied"&&a.status!=="unknown"?null:{saveId:t,requestHash:e,status:a.status}}catch{return null}finally{clearTimeout(l),n?.removeEventListener("abort",i)}}async function T(){let t=location.pathname,e=++_;if(!/^https?:$/.test(window.location.protocol))return f("none",s(),t,e);let n=x(),o=n?`${y}/${n}`:y,i=new AbortController,l=setTimeout(()=>i.abort(),v);try{let u=await fetch(new URL(o,window.location.origin).href,{method:"GET",credentials:n?"omit":"same-origin",headers:{"Document-URL":window.location.href},cache:"no-store",redirect:"manual",signal:i.signal});if(!u.ok)return f(u.status>=500?"failed":"none",s(),t,e);let p=await u.text();if(!p)return f("none",s(),t,e);let r;try{r=JSON.parse(p)}catch{return f("none",s(),t,e)}return!r||typeof r!="object"||typeof r.spec!="number"?f("none",s(),t,e):f("ok",{spec:r.spec,extensions:Array.isArray(r.extensions)?r.extensions:[],document:r.document&&typeof r.document=="object"?r.document:null},t,e)}catch{return f("failed",s(),t,e)}finally{clearTimeout(l)}}export{g as a,R as b,$ as c,d,P as e,D as f,C as g,H as h,N as i,W as j,F as k};
@@ -1 +1 @@
1
- import{g as $}from"./c-EHAR4RJJ.js";import"./c-LD6UVV5R.js";import"./c-PGSBXHUE.js";import"./c-KU3PX7LL.js";import"./c-EQ5NBOGA.js";import"./c-IJUK2GPW.js";import"./c-C7SUMNMI.js";import{c as k}from"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import{b as u}from"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-UW6MMZ4V.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-MOP5KBWZ.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var O="Some saved data was removed",W={recent:"A change from outside this page removed something you typed","all-typed":"A change from outside this page removed everything you typed",emptied:"A change from outside this page emptied this page's data",unreadable:"A change from outside this page left its data unreadable"},B=3,V=36e5,T="data-guard-done",K=6e3,Y=1500,G=5e3,H=3e4,J=1e4,q=6e3,X=["clay:save-error","clay:save-offline","clay:save-conflict"],I="Could not reach the server. Try again.",z="That did not go through. Try again.",Q="Save your changes first, then try again.",Z="Reload the page, then try again.",n=null,d=null,m=(e,t)=>`${e} ${t}${e===1?"":"s"}`,D=e=>!!e&&typeof e.id=="string"&&e.status==="pending",E=(e,t,i,s)=>s===!0&&!e.refused.has(`${t.id}:${i}`),A=(e,t)=>E(e,t,"restore",t.restorable),f=(e,t)=>E(e,t,"revert",t.canRevert),L=(e,t)=>E(e,t,"put-back",t.canPutBack),p=e=>Array.isArray(e.typed)?e.typed:[],C=e=>!!e.reason,ee=e=>W[e.reason]??O,P=e=>e.reason==="recent"||e.reason==="all-typed",te=e=>P(e)?"info":"warning",M=()=>k()?"omit":"same-origin",N=e=>$()||e.lastExternal>0&&Date.now()-e.lastExternal<J,U=(e={})=>({"Document-URL":location.href,...e});function b(){for(let e of document.querySelectorAll("[data-htmlclay-guard]"))e.remove()}function l(e,t){import("./c-C6DXZIXD.js").then(i=>{d=i,i.default(e,t)},()=>{})}function y(e){let t=e.lossSummary||{},i=t.provenance==="external"?"A change from outside this page":"A save from this page",s=t.removedItems>0?`removed ${m(t.removedItems,"item")}`:t.destroyedAtoms>0?`erased ${m(t.destroyedAtoms,"value")}`:"changed saved data",a=Array.isArray(e.preview)?e.preview[0]:null,o=[`${i} ${s}.`];return a&&o.push(`${a.key}: ${a.yours} before, ${a.now} now.`),o}function ie(e){let t=String(e??"").split(".").filter(s=>s&&!/^\[[^\]]*\]$/.test(s));return(t[t.length-1]??"").replace(/\[[^\]]*\]/g,"").trim().replace(/[_-]+/g," ")||"value"}function ae(e){let t=p(e);if(!t.length)return"";let i=t.slice(0,B).map(a=>`${ie(a.path)}: "${a.yours}"`),s=t.length-i.length;return`${i.join("; ")}${s>0?` and ${s} more.`:"."}`}function se(e){if(e.reason==="all-typed")return"";let t=p(e)[0],i=typeof t?.at=="number"?t.at:Date.parse(t?.at);if(!Number.isFinite(i))return"";let s=Date.now()-i;if(s<0||s>=V)return"";let a=Math.max(1,Math.floor(s/6e4));return`You typed ${p(e).length===1?"it":"them"} ${m(a,"minute")} ago.`}function oe(e,t){if(!C(t)){let s=y(t);return A(e,t)?t.droppedAdditions>0&&s.push(`Restoring removes ${m(t.droppedAdditions,"item")} added or changed since.`):f(e,t)?s.push("This data no longer fits the page, but the whole change can be undone."):s.push("It cannot be restored from here."),f(e,t)&&s.push("Undo the change also removes edits made since."),s.join(" ")}let i=[];if(P(t)){i.push(ae(t)||y(t).join(" "));let s=se(t);s&&i.push(s)}else i.push(y(t).join(" "));return f(e,t)&&i.push("Undo the change also removes edits made since."),i.join(" ")}function ne(e,t){let i=[];return C(t)?(L(e,t)&&i.push({label:"Put it back",onClick:()=>r(e,t,"put-back")}),f(e,t)&&i.push({label:"Undo the change",onClick:()=>r(e,t,"revert")}),i.push({label:"Keep the change",onClick:()=>r(e,t,"dismiss")}),i):(A(e,t)&&i.push({label:"Restore",onClick:()=>r(e,t,"restore")}),f(e,t)&&i.push({label:"Undo the change",onClick:()=>r(e,t,"revert")}),i.push({label:"Keep as is",onClick:()=>r(e,t,"dismiss")}),i)}async function v(e,t){let i=ee(t),s=oe(e,t),a=[t.id,i,t.reason??"",JSON.stringify(p(t)),A(e,t),L(e,t),f(e,t),t.lastWriteAt,s].join("|");if(e.drawn===a)return!0;e.drawn=a,e.eventId=t.id;try{d??=await import("./c-C6DXZIXD.js")}catch{return e.drawn===a&&(e.drawn=null,e.eventId=null),!1}if(n!==e||e.drawn!==a)return!1;let o=e.title;return e.title=i,o&&o!==i&&d.dismissPersistent(o,{now:!0}),d.dismissPersistent(i,{now:!0}),d.toastPersistent(i,te(t),{detail:s,actions:ne(e,t)}),!0}function g(e){let t=e.title;e.drawn=null,e.eventId=null,e.title=null,t&&d?.dismissPersistent(t,{now:!0})}async function h(e){let t=++e.turn;e.lastRead=Date.now();let i=new AbortController,s=setTimeout(()=>i.abort(),K),a;try{let o=await fetch(e.url,{method:"GET",credentials:M(),headers:U(),cache:"no-store",redirect:"manual",signal:i.signal});if(!o.ok)return;a=await o.json()}catch{return}finally{clearTimeout(s)}if(!(n!==e||t!==e.turn)&&!(!a||typeof a!="object"||!("event"in a))){if(D(a.event)){if(e.resolved.has(a.event.id)||e.waiting===a.event.id)return;if(!e.waited.has(a.event.id)&&N(e)){x(e,a.event.id);return}await v(e,a.event)&&b();return}g(e),b()}}function F(e,t){e.resolved.add(t.id),e.eventId===t.id&&g(e)}function le(e,t,i){if(F(e,t),i==="dismiss"){l("Kept the page as it is.","info");return}u.session.set(T,i),e.reload()}function re(e,t,i,s,a){n===e&&(s===200&&a?.ok===!0?le(e,t,i):s===404?(F(e,t),l("This was already taken care of somewhere else. Reload to see the current page.","info")):s===409?(e.drawn=null,l("This page changed after the notice appeared. Check the notice and try again.","warning"),h(e)):s===422?(e.refused.add(`${t.id}:${i}`),e.eventId===t.id&&!e.resolved.has(t.id)&&v(e,t),l(i==="restore"||i==="put-back"?"That data no longer fits this page, so it could not be restored.":"That earlier version is no longer available.","warning")):l(s===401||s===403?Z:s===400?z:I,"error"))}async function de(){let e=window.clay;if(!e?.hasUnsavedChanges?.())return!0;if(typeof e.save?.flush!="function")return!1;try{await e.save.flush()}catch{return!1}return!e.hasUnsavedChanges()}async function r(e,t,i){if(!(e.busy||n!==e)){e.busy=!0;try{if(i!=="dismiss"&&!await de()){n===e&&l(Q,"warning");return}if(n!==e)return;let s=await fetch(e.url,{method:"POST",credentials:M(),headers:U({"Content-Type":"application/json"}),redirect:"manual",body:JSON.stringify({id:t.id,choice:i})}),a=await s.json().catch(()=>null);re(e,t,i,s.status,a)}catch{n===e&&l(I,"error")}finally{e.busy=!1}}}function fe(e,t){let{msgType:i,action:s,data:a}=t.detail||{};if(i==="data-loss"){if(s==="resolved"){if(typeof a?.id!="string")return;e.turn++,e.resolved.add(a.id),e.waiting===a.id&&j(e),e.eventId===a.id&&g(e);return}if(s==="raised"&&D(a)&&!e.resolved.has(a.id)){if(e.turn++,e.waiting===a.id)return;if(!e.waited.has(a.id)&&N(e)){x(e,a.id);return}v(e,a).then(o=>{o&&b()},()=>{})}}}var _=e=>Math.max(e.lastSave+Y,e.lastRead+G);function j(e){return e.waiting?(e.waiting=null,clearTimeout(e.waitTimer),e.waitTimer=null,!0):!1}function S(e,{now:t=!1}={}){!j(e)||n!==e||(t?h(e):R(e))}function x(e,t){e.waited.add(t),e.waiting=t,clearTimeout(e.waitTimer),e.waitTimer=setTimeout(()=>S(e,{now:!0}),q)}function R(e){e.timer||(e.timer=setTimeout(()=>{e.timer=null,n===e&&(_(e)>Date.now()?R(e):h(e))},Math.max(_(e)-Date.now(),0)))}function me({href:e,reload:t=()=>window.location.reload()}){if(n)return;let i;try{i=new URL(e,location.href)}catch{return}if(i.origin!==location.origin)return;let s=new AbortController,a={url:i.href,reload:t,listeners:s,turn:0,lastRead:0,lastSave:0,timer:null,lastExternal:0,waiting:null,waitTimer:null,waited:new Set,busy:!1,drawn:null,eventId:null,title:null,resolved:new Set,refused:new Set};n=a;let{signal:o}=s;document.addEventListener("clay:notification",c=>fe(a,c),{signal:o}),document.addEventListener("clay:sync-applied",c=>{c.detail?.source==="disk"&&(a.lastExternal=Date.now())},{signal:o}),document.addEventListener("clay:save-saved",()=>{a.lastSave=Date.now(),a.waiting?S(a):R(a)},{signal:o});for(let c of X)document.addEventListener(c,()=>S(a,{now:!0}),{signal:o});document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&Date.now()-a.lastRead>=H&&h(a)},{signal:o});let w=u.session.get(T);w&&(u.session.remove(T),l(w==="restore"||w==="put-back"?"Your saved data is back.":"The earlier version is back.","success")),h(a)}function pe(){let e=n;e&&(n=null,e.listeners.abort(),clearTimeout(e.timer),clearTimeout(e.waitTimer),g(e))}export{me as start,pe as stop};
1
+ import{g as $}from"./c-CKG4NF7J.js";import"./c-LD6UVV5R.js";import"./c-PGSBXHUE.js";import"./c-OSGTRM4C.js";import"./c-26W3BMWK.js";import"./c-IJUK2GPW.js";import"./c-JEWSJHMK.js";import{c as k}from"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import{b as u}from"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-UW6MMZ4V.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-MOP5KBWZ.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var O="Some saved data was removed",W={recent:"A change from outside this page removed something you typed","all-typed":"A change from outside this page removed everything you typed",emptied:"A change from outside this page emptied this page's data",unreadable:"A change from outside this page left its data unreadable"},B=3,V=36e5,T="data-guard-done",K=6e3,Y=1500,G=5e3,H=3e4,J=1e4,q=6e3,X=["clay:save-error","clay:save-offline","clay:save-conflict"],I="Could not reach the server. Try again.",z="That did not go through. Try again.",Q="Save your changes first, then try again.",Z="Reload the page, then try again.",n=null,d=null,m=(e,t)=>`${e} ${t}${e===1?"":"s"}`,D=e=>!!e&&typeof e.id=="string"&&e.status==="pending",E=(e,t,i,s)=>s===!0&&!e.refused.has(`${t.id}:${i}`),A=(e,t)=>E(e,t,"restore",t.restorable),f=(e,t)=>E(e,t,"revert",t.canRevert),L=(e,t)=>E(e,t,"put-back",t.canPutBack),p=e=>Array.isArray(e.typed)?e.typed:[],C=e=>!!e.reason,ee=e=>W[e.reason]??O,P=e=>e.reason==="recent"||e.reason==="all-typed",te=e=>P(e)?"info":"warning",M=()=>k()?"omit":"same-origin",N=e=>$()||e.lastExternal>0&&Date.now()-e.lastExternal<J,U=(e={})=>({"Document-URL":location.href,...e});function b(){for(let e of document.querySelectorAll("[data-htmlclay-guard]"))e.remove()}function l(e,t){import("./c-C6DXZIXD.js").then(i=>{d=i,i.default(e,t)},()=>{})}function y(e){let t=e.lossSummary||{},i=t.provenance==="external"?"A change from outside this page":"A save from this page",s=t.removedItems>0?`removed ${m(t.removedItems,"item")}`:t.destroyedAtoms>0?`erased ${m(t.destroyedAtoms,"value")}`:"changed saved data",a=Array.isArray(e.preview)?e.preview[0]:null,o=[`${i} ${s}.`];return a&&o.push(`${a.key}: ${a.yours} before, ${a.now} now.`),o}function ie(e){let t=String(e??"").split(".").filter(s=>s&&!/^\[[^\]]*\]$/.test(s));return(t[t.length-1]??"").replace(/\[[^\]]*\]/g,"").trim().replace(/[_-]+/g," ")||"value"}function ae(e){let t=p(e);if(!t.length)return"";let i=t.slice(0,B).map(a=>`${ie(a.path)}: "${a.yours}"`),s=t.length-i.length;return`${i.join("; ")}${s>0?` and ${s} more.`:"."}`}function se(e){if(e.reason==="all-typed")return"";let t=p(e)[0],i=typeof t?.at=="number"?t.at:Date.parse(t?.at);if(!Number.isFinite(i))return"";let s=Date.now()-i;if(s<0||s>=V)return"";let a=Math.max(1,Math.floor(s/6e4));return`You typed ${p(e).length===1?"it":"them"} ${m(a,"minute")} ago.`}function oe(e,t){if(!C(t)){let s=y(t);return A(e,t)?t.droppedAdditions>0&&s.push(`Restoring removes ${m(t.droppedAdditions,"item")} added or changed since.`):f(e,t)?s.push("This data no longer fits the page, but the whole change can be undone."):s.push("It cannot be restored from here."),f(e,t)&&s.push("Undo the change also removes edits made since."),s.join(" ")}let i=[];if(P(t)){i.push(ae(t)||y(t).join(" "));let s=se(t);s&&i.push(s)}else i.push(y(t).join(" "));return f(e,t)&&i.push("Undo the change also removes edits made since."),i.join(" ")}function ne(e,t){let i=[];return C(t)?(L(e,t)&&i.push({label:"Put it back",onClick:()=>r(e,t,"put-back")}),f(e,t)&&i.push({label:"Undo the change",onClick:()=>r(e,t,"revert")}),i.push({label:"Keep the change",onClick:()=>r(e,t,"dismiss")}),i):(A(e,t)&&i.push({label:"Restore",onClick:()=>r(e,t,"restore")}),f(e,t)&&i.push({label:"Undo the change",onClick:()=>r(e,t,"revert")}),i.push({label:"Keep as is",onClick:()=>r(e,t,"dismiss")}),i)}async function v(e,t){let i=ee(t),s=oe(e,t),a=[t.id,i,t.reason??"",JSON.stringify(p(t)),A(e,t),L(e,t),f(e,t),t.lastWriteAt,s].join("|");if(e.drawn===a)return!0;e.drawn=a,e.eventId=t.id;try{d??=await import("./c-C6DXZIXD.js")}catch{return e.drawn===a&&(e.drawn=null,e.eventId=null),!1}if(n!==e||e.drawn!==a)return!1;let o=e.title;return e.title=i,o&&o!==i&&d.dismissPersistent(o,{now:!0}),d.dismissPersistent(i,{now:!0}),d.toastPersistent(i,te(t),{detail:s,actions:ne(e,t)}),!0}function g(e){let t=e.title;e.drawn=null,e.eventId=null,e.title=null,t&&d?.dismissPersistent(t,{now:!0})}async function h(e){let t=++e.turn;e.lastRead=Date.now();let i=new AbortController,s=setTimeout(()=>i.abort(),K),a;try{let o=await fetch(e.url,{method:"GET",credentials:M(),headers:U(),cache:"no-store",redirect:"manual",signal:i.signal});if(!o.ok)return;a=await o.json()}catch{return}finally{clearTimeout(s)}if(!(n!==e||t!==e.turn)&&!(!a||typeof a!="object"||!("event"in a))){if(D(a.event)){if(e.resolved.has(a.event.id)||e.waiting===a.event.id)return;if(!e.waited.has(a.event.id)&&N(e)){x(e,a.event.id);return}await v(e,a.event)&&b();return}g(e),b()}}function F(e,t){e.resolved.add(t.id),e.eventId===t.id&&g(e)}function le(e,t,i){if(F(e,t),i==="dismiss"){l("Kept the page as it is.","info");return}u.session.set(T,i),e.reload()}function re(e,t,i,s,a){n===e&&(s===200&&a?.ok===!0?le(e,t,i):s===404?(F(e,t),l("This was already taken care of somewhere else. Reload to see the current page.","info")):s===409?(e.drawn=null,l("This page changed after the notice appeared. Check the notice and try again.","warning"),h(e)):s===422?(e.refused.add(`${t.id}:${i}`),e.eventId===t.id&&!e.resolved.has(t.id)&&v(e,t),l(i==="restore"||i==="put-back"?"That data no longer fits this page, so it could not be restored.":"That earlier version is no longer available.","warning")):l(s===401||s===403?Z:s===400?z:I,"error"))}async function de(){let e=window.clay;if(!e?.hasUnsavedChanges?.())return!0;if(typeof e.save?.flush!="function")return!1;try{await e.save.flush()}catch{return!1}return!e.hasUnsavedChanges()}async function r(e,t,i){if(!(e.busy||n!==e)){e.busy=!0;try{if(i!=="dismiss"&&!await de()){n===e&&l(Q,"warning");return}if(n!==e)return;let s=await fetch(e.url,{method:"POST",credentials:M(),headers:U({"Content-Type":"application/json"}),redirect:"manual",body:JSON.stringify({id:t.id,choice:i})}),a=await s.json().catch(()=>null);re(e,t,i,s.status,a)}catch{n===e&&l(I,"error")}finally{e.busy=!1}}}function fe(e,t){let{msgType:i,action:s,data:a}=t.detail||{};if(i==="data-loss"){if(s==="resolved"){if(typeof a?.id!="string")return;e.turn++,e.resolved.add(a.id),e.waiting===a.id&&j(e),e.eventId===a.id&&g(e);return}if(s==="raised"&&D(a)&&!e.resolved.has(a.id)){if(e.turn++,e.waiting===a.id)return;if(!e.waited.has(a.id)&&N(e)){x(e,a.id);return}v(e,a).then(o=>{o&&b()},()=>{})}}}var _=e=>Math.max(e.lastSave+Y,e.lastRead+G);function j(e){return e.waiting?(e.waiting=null,clearTimeout(e.waitTimer),e.waitTimer=null,!0):!1}function S(e,{now:t=!1}={}){!j(e)||n!==e||(t?h(e):R(e))}function x(e,t){e.waited.add(t),e.waiting=t,clearTimeout(e.waitTimer),e.waitTimer=setTimeout(()=>S(e,{now:!0}),q)}function R(e){e.timer||(e.timer=setTimeout(()=>{e.timer=null,n===e&&(_(e)>Date.now()?R(e):h(e))},Math.max(_(e)-Date.now(),0)))}function me({href:e,reload:t=()=>window.location.reload()}){if(n)return;let i;try{i=new URL(e,location.href)}catch{return}if(i.origin!==location.origin)return;let s=new AbortController,a={url:i.href,reload:t,listeners:s,turn:0,lastRead:0,lastSave:0,timer:null,lastExternal:0,waiting:null,waitTimer:null,waited:new Set,busy:!1,drawn:null,eventId:null,title:null,resolved:new Set,refused:new Set};n=a;let{signal:o}=s;document.addEventListener("clay:notification",c=>fe(a,c),{signal:o}),document.addEventListener("clay:sync-applied",c=>{c.detail?.source==="disk"&&(a.lastExternal=Date.now())},{signal:o}),document.addEventListener("clay:save-saved",()=>{a.lastSave=Date.now(),a.waiting?S(a):R(a)},{signal:o});for(let c of X)document.addEventListener(c,()=>S(a,{now:!0}),{signal:o});document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&Date.now()-a.lastRead>=H&&h(a)},{signal:o});let w=u.session.get(T);w&&(u.session.remove(T),l(w==="restore"||w==="put-back"?"Your saved data is back.":"The earlier version is back.","success")),h(a)}function pe(){let e=n;e&&(n=null,e.listeners.abort(),clearTimeout(e.timer),clearTimeout(e.waitTimer),g(e))}export{me as start,pe as stop};
@@ -1,4 +1,4 @@
1
- import{b as Ge}from"./c-HAWFNBYG.js";import{a as Xe,d as ce}from"./c-X6MOYATI.js";import{j as Je}from"./c-DIKR7H57.js";import{a as Ye}from"./c-AQLFEATB.js";import{a as Qe}from"./c-AQYCG7QW.js";import{b as qe}from"./c-QY7F6EN6.js";import{b as Ve,d as We}from"./c-JC4RZW4E.js";import{c as Ke}from"./c-PKCCHJ5X.js";import{a as $e}from"./c-I2SCCUEW.js";import{d as je}from"./c-EQ5NBOGA.js";import"./c-C7SUMNMI.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var At=/^[a-z][a-z0-9+.-]*:/i,Lt=["noindex","nofollow"],St=["ogTitle","ogDescription","ogImage","ogImageAlt","siteName"],m=e=>e==null?"":String(e),I=e=>m(e).trim()!=="",T=e=>e.head||e.querySelector("head"),O=(e,t,n)=>Array.from(T(e).querySelectorAll("meta")).filter(i=>m(i.getAttribute(t)).trim().toLowerCase()===n),de=(e,t)=>Array.from(T(e).querySelectorAll("link")).filter(n=>m(n.getAttribute("rel")).trim().toLowerCase().split(/\s+/).includes(t)),pe=e=>Array.from(T(e).querySelectorAll("title")),fe=e=>O(e,"name","robots"),w=e=>e.remove();function G(e,t,n){let i=e.createElement("meta");return i.setAttribute(t,n),T(e).appendChild(i),i}function Ct(e,t){let n=e.createElement("link");return n.setAttribute("rel",t),T(e).appendChild(n),n}function ue(e,t,n,i){(O(e,t,n)[0]||G(e,t,n)).setAttribute("content",i)}function C(e,t,{trim:n=!1}={}){let i=c=>O(c,e,t);return{find:i,read(c){let d=i(c)[0];return d?m(d.getAttribute("content")):""},write(c,d){let f=i(c),p=m(d);if(!I(p)){f.forEach(w);return}(f[0]||G(c,e,t)).setAttribute("content",n?p.trim():p),f.slice(1).forEach(w)}}}var et=e=>m(e.getAttribute("content")).split(",").map(t=>t.trim()).filter(Boolean);function It(e,t){let n=fe(e),i=(n[0]?et(n[0]):[]).filter(p=>!Lt.includes(p.toLowerCase())),c=[];t.index===!1&&c.push("noindex"),t.follow===!1&&c.push("nofollow");let d=c.concat(i);if(!d.length){n.forEach(w);return}(n[0]||G(e,"name","robots")).setAttribute("content",d.join(", ")),n.slice(1).forEach(w)}function Ze(e){let t=e==="noindex"?"index":"follow",n=t==="index"?"follow":"index";return{find:fe,read(i){let c=fe(i)[0];return c?!et(c).some(d=>d.toLowerCase()===e):!0},write(i,c){let d={index:!0,follow:!0};d[t]=!!c,d[n]=x[n].read(i),It(i,d)}}}var Ot={find:pe,read(e){let t=pe(e)[0];return t?m(t.textContent):""},write(e,t){let n=pe(e),i=m(t);if(!I(i)){n.forEach(w);return}let c=n[0]||e.createElement("title");n.length||T(e).appendChild(c),c.textContent=i,n.slice(1).forEach(w)}},Ut={find(e){let t=e.documentElement;return t&&t.hasAttribute("lang")?[t]:[]},read(e){let t=e.documentElement;return t&&t.hasAttribute("lang")?m(t.getAttribute("lang")):""},write(e,t){let n=e.documentElement;if(!n)return;let i=m(t);if(!I(i)){n.removeAttribute("lang");return}n.setAttribute("lang",i.trim())}},zt={find:e=>de(e,"canonical"),read(e){let t=de(e,"canonical")[0];return t?m(t.getAttribute("href")):""},write(e,t){let n=de(e,"canonical"),i=m(t);if(!I(i)){n.forEach(w);return}(n[0]||Ct(e,"canonical")).setAttribute("href",i.trim()),n.slice(1).forEach(w)}},Y="clay-seo-title-mode",Tt={find:e=>O(e,"name",Y),read(e){return O(e,"name",Y).some(n=>m(n.getAttribute("content")).trim().toLowerCase()==="custom")?"custom":"derived"},write(e,t){let n=O(e,"name",Y);if(m(t).trim().toLowerCase()!=="custom"){n.forEach(w);return}(n[0]||G(e,"name",Y)).setAttribute("content","custom"),n.slice(1).forEach(w)}},x={title:Ot,description:C("name","description"),lang:Ut,canonical:zt,index:Ze("noindex"),follow:Ze("nofollow"),ogTitle:C("property","og:title"),ogDescription:C("property","og:description"),ogImage:C("property","og:image",{trim:!0}),ogImageAlt:C("property","og:image:alt"),siteName:C("property","og:site_name"),twitterSite:C("name","twitter:site"),titleMode:Tt},tt=Object.fromEntries(Object.keys(x).map(e=>[e,{read:x[e].read,write:x[e].write}]));function ot(e){let t=e.hostname.toLowerCase();return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"}function me(e){try{return new URL(e)}catch{return null}}function ge(e){return e.protocol==="http:"||e.protocol==="https:"}function nt(e){let t=e.location&&e.location.href||e.URL||e.baseURI||"",n=me(t);return!n||!ge(n)||ot(n)?"":n.origin+n.pathname}function it(e){let t=m(e).trim();if(!t)return"";let n=me(t);return!n||!ge(n)?"Enter a full http: or https: address.":ot(n)?"A localhost address cannot be a canonical URL.":""}function Mt(e,t){let n=m(e).trim();if(!n)return"";if(At.test(n)){let i=me(n);return!i||!ge(i)?"Use an http: or https: image address.":""}if(t)try{new URL(n,t)}catch{return"Use an http: or https: image address."}return""}function rt(e,t){let n=("canonical"in t?m(t.canonical).trim():x.canonical.read(e)).trim();return n&&!it(n)?n:""}function Rt(e,t){let n=St.some(d=>d in t&&I(t[d])),i="canonical"in t&&I(t.canonical);if(!n&&!i&&!("ogImage"in t))return;if(n||i){O(e,"property","og:type").length||ue(e,"property","og:type","website");let d=rt(e,t)||nt(e);d&&ue(e,"property","og:url",d)}let c="ogImage"in t?t.ogImage:x.ogImage.read(e);ue(e,"name","twitter:card",I(c)?"summary_large_image":"summary")}function B(e){let t={},n={};for(let i of Object.keys(x)){let c=x[i];t[i]=c.read(e),n[i]=c.find(e).length>0}return{values:t,present:n}}function X(e,t){let n=t||{},i=Object.keys(x).filter(p=>p in n),c={};if(i.includes("canonical")){let p=it(n.canonical);p&&(c.canonical=p)}if(i.includes("ogImage")){let p=rt(e,n)||nt(e),b=Mt(n.ogImage,p);b&&(c.ogImage=b)}if(Object.keys(c).length)return{normalized:[],errors:c};let d=[],f=new Set;for(let p of i){let b=x[p].find;b(e).length>1&&!f.has(b)&&(f.add(b),d.push(p))}for(let p of i)x[p].write(e,n[p]);return Rt(e,n),{normalized:d,errors:{}}}var at="reopen-seo",Ht="SEO and social sharing",Pt="SEO settings",lt="SEO settings applied",mt=/^[a-z][a-z0-9+.-]*:/i,Nt="This site is hidden from search engines in your account settings, so this page stays hidden whatever you choose here.",Bt="Uploaded images are public to anyone with the link.",Dt="Paste the address of an image on the web.",_t={title:{label:"Title",kind:"text",full:!0,count:60},description:{label:"Description",kind:"textarea",full:!0,count:160},ogTitle:{label:"Preview title",note:"Open Graph",kind:"text"},ogDescription:{label:"Preview description",note:"Open Graph",kind:"textarea",short:!0},ogImage:{label:"Preview image",note:"Open Graph",kind:"text",full:!0},canonical:{label:"Canonical URL",kind:"text"},lang:{label:"Language",kind:"text"},ogImageAlt:{label:"Image alt text",kind:"text"},siteName:{label:"Site name",kind:"text"},twitterSite:{label:"Social handle",kind:"text",placeholder:"@yourname"},index:{label:"Show in search results",kind:"checkbox"},follow:{label:"Let search engines follow links",kind:"checkbox"}},Ft=["title","description","ogTitle","ogDescription","ogImage"],jt=["canonical","lang","ogImageAlt","siteName","twitterSite"],Kt=["index","follow"],st=`.clay-seo { box-sizing: border-box; width: 100%; border-bottom: 1px solid var(--bevel-line-3); background: var(--bevel-surface); box-shadow: var(--clay-sheet-shadow); font-size: 13px; line-height: 1.45; container-type: inline-size; animation: clay-seo-in .2s ease-out; position: relative; z-index: 2147482001; grid-column: 1 / -1; flex: 0 0 100%; max-height: 85vh; max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain; }
1
+ import{b as Ge}from"./c-HAWFNBYG.js";import{a as Xe,d as ce}from"./c-X6MOYATI.js";import{j as Je}from"./c-DIKR7H57.js";import{a as Ye}from"./c-AQLFEATB.js";import{a as Qe}from"./c-AQYCG7QW.js";import{b as qe}from"./c-QY7F6EN6.js";import{b as Ve,d as We}from"./c-JC4RZW4E.js";import{c as Ke}from"./c-PKCCHJ5X.js";import{a as $e}from"./c-I2SCCUEW.js";import{d as je}from"./c-26W3BMWK.js";import"./c-JEWSJHMK.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var At=/^[a-z][a-z0-9+.-]*:/i,Lt=["noindex","nofollow"],St=["ogTitle","ogDescription","ogImage","ogImageAlt","siteName"],m=e=>e==null?"":String(e),I=e=>m(e).trim()!=="",T=e=>e.head||e.querySelector("head"),O=(e,t,n)=>Array.from(T(e).querySelectorAll("meta")).filter(i=>m(i.getAttribute(t)).trim().toLowerCase()===n),de=(e,t)=>Array.from(T(e).querySelectorAll("link")).filter(n=>m(n.getAttribute("rel")).trim().toLowerCase().split(/\s+/).includes(t)),pe=e=>Array.from(T(e).querySelectorAll("title")),fe=e=>O(e,"name","robots"),w=e=>e.remove();function G(e,t,n){let i=e.createElement("meta");return i.setAttribute(t,n),T(e).appendChild(i),i}function Ct(e,t){let n=e.createElement("link");return n.setAttribute("rel",t),T(e).appendChild(n),n}function ue(e,t,n,i){(O(e,t,n)[0]||G(e,t,n)).setAttribute("content",i)}function C(e,t,{trim:n=!1}={}){let i=c=>O(c,e,t);return{find:i,read(c){let d=i(c)[0];return d?m(d.getAttribute("content")):""},write(c,d){let f=i(c),p=m(d);if(!I(p)){f.forEach(w);return}(f[0]||G(c,e,t)).setAttribute("content",n?p.trim():p),f.slice(1).forEach(w)}}}var et=e=>m(e.getAttribute("content")).split(",").map(t=>t.trim()).filter(Boolean);function It(e,t){let n=fe(e),i=(n[0]?et(n[0]):[]).filter(p=>!Lt.includes(p.toLowerCase())),c=[];t.index===!1&&c.push("noindex"),t.follow===!1&&c.push("nofollow");let d=c.concat(i);if(!d.length){n.forEach(w);return}(n[0]||G(e,"name","robots")).setAttribute("content",d.join(", ")),n.slice(1).forEach(w)}function Ze(e){let t=e==="noindex"?"index":"follow",n=t==="index"?"follow":"index";return{find:fe,read(i){let c=fe(i)[0];return c?!et(c).some(d=>d.toLowerCase()===e):!0},write(i,c){let d={index:!0,follow:!0};d[t]=!!c,d[n]=x[n].read(i),It(i,d)}}}var Ot={find:pe,read(e){let t=pe(e)[0];return t?m(t.textContent):""},write(e,t){let n=pe(e),i=m(t);if(!I(i)){n.forEach(w);return}let c=n[0]||e.createElement("title");n.length||T(e).appendChild(c),c.textContent=i,n.slice(1).forEach(w)}},Ut={find(e){let t=e.documentElement;return t&&t.hasAttribute("lang")?[t]:[]},read(e){let t=e.documentElement;return t&&t.hasAttribute("lang")?m(t.getAttribute("lang")):""},write(e,t){let n=e.documentElement;if(!n)return;let i=m(t);if(!I(i)){n.removeAttribute("lang");return}n.setAttribute("lang",i.trim())}},zt={find:e=>de(e,"canonical"),read(e){let t=de(e,"canonical")[0];return t?m(t.getAttribute("href")):""},write(e,t){let n=de(e,"canonical"),i=m(t);if(!I(i)){n.forEach(w);return}(n[0]||Ct(e,"canonical")).setAttribute("href",i.trim()),n.slice(1).forEach(w)}},Y="clay-seo-title-mode",Tt={find:e=>O(e,"name",Y),read(e){return O(e,"name",Y).some(n=>m(n.getAttribute("content")).trim().toLowerCase()==="custom")?"custom":"derived"},write(e,t){let n=O(e,"name",Y);if(m(t).trim().toLowerCase()!=="custom"){n.forEach(w);return}(n[0]||G(e,"name",Y)).setAttribute("content","custom"),n.slice(1).forEach(w)}},x={title:Ot,description:C("name","description"),lang:Ut,canonical:zt,index:Ze("noindex"),follow:Ze("nofollow"),ogTitle:C("property","og:title"),ogDescription:C("property","og:description"),ogImage:C("property","og:image",{trim:!0}),ogImageAlt:C("property","og:image:alt"),siteName:C("property","og:site_name"),twitterSite:C("name","twitter:site"),titleMode:Tt},tt=Object.fromEntries(Object.keys(x).map(e=>[e,{read:x[e].read,write:x[e].write}]));function ot(e){let t=e.hostname.toLowerCase();return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"}function me(e){try{return new URL(e)}catch{return null}}function ge(e){return e.protocol==="http:"||e.protocol==="https:"}function nt(e){let t=e.location&&e.location.href||e.URL||e.baseURI||"",n=me(t);return!n||!ge(n)||ot(n)?"":n.origin+n.pathname}function it(e){let t=m(e).trim();if(!t)return"";let n=me(t);return!n||!ge(n)?"Enter a full http: or https: address.":ot(n)?"A localhost address cannot be a canonical URL.":""}function Mt(e,t){let n=m(e).trim();if(!n)return"";if(At.test(n)){let i=me(n);return!i||!ge(i)?"Use an http: or https: image address.":""}if(t)try{new URL(n,t)}catch{return"Use an http: or https: image address."}return""}function rt(e,t){let n=("canonical"in t?m(t.canonical).trim():x.canonical.read(e)).trim();return n&&!it(n)?n:""}function Rt(e,t){let n=St.some(d=>d in t&&I(t[d])),i="canonical"in t&&I(t.canonical);if(!n&&!i&&!("ogImage"in t))return;if(n||i){O(e,"property","og:type").length||ue(e,"property","og:type","website");let d=rt(e,t)||nt(e);d&&ue(e,"property","og:url",d)}let c="ogImage"in t?t.ogImage:x.ogImage.read(e);ue(e,"name","twitter:card",I(c)?"summary_large_image":"summary")}function B(e){let t={},n={};for(let i of Object.keys(x)){let c=x[i];t[i]=c.read(e),n[i]=c.find(e).length>0}return{values:t,present:n}}function X(e,t){let n=t||{},i=Object.keys(x).filter(p=>p in n),c={};if(i.includes("canonical")){let p=it(n.canonical);p&&(c.canonical=p)}if(i.includes("ogImage")){let p=rt(e,n)||nt(e),b=Mt(n.ogImage,p);b&&(c.ogImage=b)}if(Object.keys(c).length)return{normalized:[],errors:c};let d=[],f=new Set;for(let p of i){let b=x[p].find;b(e).length>1&&!f.has(b)&&(f.add(b),d.push(p))}for(let p of i)x[p].write(e,n[p]);return Rt(e,n),{normalized:d,errors:{}}}var at="reopen-seo",Ht="SEO and social sharing",Pt="SEO settings",lt="SEO settings applied",mt=/^[a-z][a-z0-9+.-]*:/i,Nt="This site is hidden from search engines in your account settings, so this page stays hidden whatever you choose here.",Bt="Uploaded images are public to anyone with the link.",Dt="Paste the address of an image on the web.",_t={title:{label:"Title",kind:"text",full:!0,count:60},description:{label:"Description",kind:"textarea",full:!0,count:160},ogTitle:{label:"Preview title",note:"Open Graph",kind:"text"},ogDescription:{label:"Preview description",note:"Open Graph",kind:"textarea",short:!0},ogImage:{label:"Preview image",note:"Open Graph",kind:"text",full:!0},canonical:{label:"Canonical URL",kind:"text"},lang:{label:"Language",kind:"text"},ogImageAlt:{label:"Image alt text",kind:"text"},siteName:{label:"Site name",kind:"text"},twitterSite:{label:"Social handle",kind:"text",placeholder:"@yourname"},index:{label:"Show in search results",kind:"checkbox"},follow:{label:"Let search engines follow links",kind:"checkbox"}},Ft=["title","description","ogTitle","ogDescription","ogImage"],jt=["canonical","lang","ogImageAlt","siteName","twitterSite"],Kt=["index","follow"],st=`.clay-seo { box-sizing: border-box; width: 100%; border-bottom: 1px solid var(--bevel-line-3); background: var(--bevel-surface); box-shadow: var(--clay-sheet-shadow); font-size: 13px; line-height: 1.45; container-type: inline-size; animation: clay-seo-in .2s ease-out; position: relative; z-index: 2147482001; grid-column: 1 / -1; flex: 0 0 100%; max-height: 85vh; max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain; }
2
2
  @keyframes clay-seo-in { from { margin-top: -40px; opacity: 0; } to { margin-top: 0; opacity: 1; } }
3
3
  .clay-seo-inner { max-width: 1120px; margin: 0 auto; padding: 14px 20px 18px; }
4
4
  .clay-seo-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--bevel-line-2); }
@@ -1 +1 @@
1
- import{f as n}from"./c-VO6RSFCO.js";import{b as h,c as a}from"./c-WN3MXOLT.js";import{a as u}from"./c-7RHOMAMR.js";import"./c-N326R2JD.js";import{b as T,g as _}from"./c-U35T5NAY.js";import{b as p}from"./c-WOJ2RTV4.js";import{b}from"./c-RGFPLQGV.js";import"./c-QCDVDZIR.js";import"./c-VKEDWYDF.js";import{B as v,C as g,K as k,M as E,Q as w,r as f,s as m,y}from"./c-FC5RUFPR.js";import"./c-4ASQPRQL.js";import"./c-GQ6F6IDK.js";import"./c-I2SCCUEW.js";import"./c-5VYOWDTI.js";import"./c-P73XPAOA.js";import"./c-ZPI7M5U5.js";import"./c-WYFDLITL.js";import"./c-UGHH4MB3.js";import"./c-MZCOGNZL.js";import"./c-EHAR4RJJ.js";import"./c-LD6UVV5R.js";import"./c-PGSBXHUE.js";import"./c-KU3PX7LL.js";import"./c-EQ5NBOGA.js";import"./c-IJUK2GPW.js";import"./c-C7SUMNMI.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-UW6MMZ4V.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-MOP5KBWZ.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var x=250,A=2e3,c=["focusin","focusout","selectionchange","clay:sync-applied","clay:workspace-background","clay:workspace-foreground"],S=t=>n.setGeneric(t),o=class{constructor({send:e=S,now:i=()=>Date.now()}){this.send=e,this.now=i,this.others=!1,this.background=!1,this.sent=null,this.lastAt=-1/0,this.timer=null,this.poked=null,this.inflight=!1,this.retry=null,this.stopped=!1,this._onEvent=s=>{s.type==="clay:workspace-background"&&(this.background=!0),s.type==="clay:workspace-foreground"&&(this.background=!1),this.poke()}}start(){this.stopped=!1;for(let e of c)document.addEventListener(e,this._onEvent)}resume(){this.stopped&&(this.start(),this.sent=null,this.schedule())}stop(){this.stopped=!0;for(let e of c)document.removeEventListener(e,this._onEvent);clearTimeout(this.timer),clearTimeout(this.poked),clearTimeout(this.retry),this.timer=null,this.poked=null,this.retry=null}roster(e){let s=(e&&Array.isArray(e.people)?e.people:[]).some(r=>r&&r.you!==!0);s!==this.others&&(this.others=s,this.schedule())}reconnected(){this.sent=null,this.schedule()}wanted(){return!this.others||this.background?null:a(h(document.activeElement))}poke(){this.poked===null&&(this.poked=setTimeout(()=>{this.poked=null,this.schedule()},0))}schedule(){if(this.stopped||this.timer!==null||this.inflight||this.wanted()===this.sent)return;let e=Math.max(0,this.lastAt+x-this.now());this.timer=setTimeout(()=>{this.timer=null,this.flush()},e)}flush(){if(this.inflight)return;let e=this.wanted();if(e===this.sent)return;this.sent=e,this.lastAt=this.now(),this.inflight=!0;let i=s=>{if(this.inflight=!1,!this.stopped){if(s)clearTimeout(this.retry),this.retry=null;else if(this.sent===e){this.sent=void 0,this.retry===null&&(this.retry=setTimeout(()=>{this.retry=null,this.schedule()},A));return}this.schedule()}};Promise.resolve(this.send(e)).then(s=>i(!!s),()=>i(!1))}};function P(t){let e=()=>(t._presenceQuiesced=!0,t._editing?.stop(),n.setGeneric(null),n.releaseTarget(),typeof document<"u"&&document.dispatchEvent(new Event("clay:presence-quiesce")),t.lane==="live"&&t._morphInFlight?{ok:!1,code:"pending-input"}:{ok:!0}),i=()=>{t._presenceQuiesced=!1,t._editing?.resume(),typeof document<"u"&&document.dispatchEvent(new Event("clay:presence-resume"))},s=()=>{t._presenceQuiesced=!1,t.stop(),typeof document<"u"&&document.dispatchEvent(new Event("clay:presence-resume"))};return{id:"clay:sync",order:50,async prepare(r){if(await u(),r?.initial)return{quiesce:e,resume:i,dispose:s};let l=!1;return{quiesce:e,resume:i,enable(){let d=t.currentFile;t.stop(),t.start(d,{lane:"live"}),l=!0},dispose:()=>{t._presenceQuiesced=!1,l&&t.stop(),typeof document<"u"&&document.dispatchEvent(new Event("clay:presence-resume"))}}}}}export{o as EditingSender,k as baselineSettled,m as conflictResolvedBySync,_ as enableAdminInputs,p as enableAdminResources,b as enableContentEditable,T as enableOnClick,v as getLastSavedBytes,f as isSaveConflicted,w as savePageThrottled,E as schedulePaintHeal,g as setLastSavedBaselines,y as setUnsavedChanges,P as syncParticipant};
1
+ import{f as n}from"./c-HBSBQBD7.js";import{b as h,c as a}from"./c-WN3MXOLT.js";import{a as u}from"./c-K5HRHUTK.js";import"./c-N326R2JD.js";import{b as T,g as _}from"./c-O54PVIAQ.js";import{b as p}from"./c-627JDXWT.js";import{b}from"./c-SMCZC3V6.js";import"./c-QCDVDZIR.js";import"./c-VKEDWYDF.js";import{B as v,C as g,K as k,M as E,Q as w,r as f,s as m,y}from"./c-IOJOJTPL.js";import"./c-4ASQPRQL.js";import"./c-GQ6F6IDK.js";import"./c-I2SCCUEW.js";import"./c-5VYOWDTI.js";import"./c-T6RRRHX7.js";import"./c-G426P2SE.js";import"./c-WYFDLITL.js";import"./c-UGHH4MB3.js";import"./c-MZCOGNZL.js";import"./c-CKG4NF7J.js";import"./c-LD6UVV5R.js";import"./c-PGSBXHUE.js";import"./c-OSGTRM4C.js";import"./c-26W3BMWK.js";import"./c-IJUK2GPW.js";import"./c-JEWSJHMK.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-UW6MMZ4V.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-MOP5KBWZ.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var x=250,A=2e3,c=["focusin","focusout","selectionchange","clay:sync-applied","clay:workspace-background","clay:workspace-foreground"],S=t=>n.setGeneric(t),o=class{constructor({send:e=S,now:i=()=>Date.now()}){this.send=e,this.now=i,this.others=!1,this.background=!1,this.sent=null,this.lastAt=-1/0,this.timer=null,this.poked=null,this.inflight=!1,this.retry=null,this.stopped=!1,this._onEvent=s=>{s.type==="clay:workspace-background"&&(this.background=!0),s.type==="clay:workspace-foreground"&&(this.background=!1),this.poke()}}start(){this.stopped=!1;for(let e of c)document.addEventListener(e,this._onEvent)}resume(){this.stopped&&(this.start(),this.sent=null,this.schedule())}stop(){this.stopped=!0;for(let e of c)document.removeEventListener(e,this._onEvent);clearTimeout(this.timer),clearTimeout(this.poked),clearTimeout(this.retry),this.timer=null,this.poked=null,this.retry=null}roster(e){let s=(e&&Array.isArray(e.people)?e.people:[]).some(r=>r&&r.you!==!0);s!==this.others&&(this.others=s,this.schedule())}reconnected(){this.sent=null,this.schedule()}wanted(){return!this.others||this.background?null:a(h(document.activeElement))}poke(){this.poked===null&&(this.poked=setTimeout(()=>{this.poked=null,this.schedule()},0))}schedule(){if(this.stopped||this.timer!==null||this.inflight||this.wanted()===this.sent)return;let e=Math.max(0,this.lastAt+x-this.now());this.timer=setTimeout(()=>{this.timer=null,this.flush()},e)}flush(){if(this.inflight)return;let e=this.wanted();if(e===this.sent)return;this.sent=e,this.lastAt=this.now(),this.inflight=!0;let i=s=>{if(this.inflight=!1,!this.stopped){if(s)clearTimeout(this.retry),this.retry=null;else if(this.sent===e){this.sent=void 0,this.retry===null&&(this.retry=setTimeout(()=>{this.retry=null,this.schedule()},A));return}this.schedule()}};Promise.resolve(this.send(e)).then(s=>i(!!s),()=>i(!1))}};function P(t){let e=()=>(t._presenceQuiesced=!0,t._editing?.stop(),n.setGeneric(null),n.releaseTarget(),typeof document<"u"&&document.dispatchEvent(new Event("clay:presence-quiesce")),t.lane==="live"&&t._morphInFlight?{ok:!1,code:"pending-input"}:{ok:!0}),i=()=>{t._presenceQuiesced=!1,t._editing?.resume(),typeof document<"u"&&document.dispatchEvent(new Event("clay:presence-resume"))},s=()=>{t._presenceQuiesced=!1,t.stop(),typeof document<"u"&&document.dispatchEvent(new Event("clay:presence-resume"))};return{id:"clay:sync",order:50,async prepare(r){if(await u(),r?.initial)return{quiesce:e,resume:i,dispose:s};let l=!1;return{quiesce:e,resume:i,enable(){let d=t.currentFile;t.stop(),t.start(d,{lane:"live"}),l=!0},dispose:()=>{t._presenceQuiesced=!1,l&&t.stop(),typeof document<"u"&&document.dispatchEvent(new Event("clay:presence-resume"))}}}}}export{o as EditingSender,k as baselineSettled,m as conflictResolvedBySync,_ as enableAdminInputs,p as enableAdminResources,b as enableContentEditable,T as enableOnClick,v as getLastSavedBytes,f as isSaveConflicted,w as savePageThrottled,E as schedulePaintHeal,g as setLastSavedBaselines,y as setUnsavedChanges,P as syncParticipant};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f}from"./c-7RHOMAMR.js";import"./c-N326R2JD.js";import"./c-I2SCCUEW.js";import"./c-C7SUMNMI.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-HA6INT6J.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{c as beginApply,d as completeApply,f as conflicts,e as failApply,a as loadEdit,b as registerContext};
1
+ import{a,b,c,d,e,f}from"./c-K5HRHUTK.js";import"./c-N326R2JD.js";import"./c-I2SCCUEW.js";import"./c-JEWSJHMK.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-HA6INT6J.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{c as beginApply,d as completeApply,f as conflicts,e as failApply,a as loadEdit,b as registerContext};
@@ -1 +1 @@
1
- import{a as o}from"./c-VKEDWYDF.js";import{f as r}from"./c-C7SUMNMI.js";import{r as c}from"./c-UW6MMZ4V.js";var s="[editmode\\:resource]:is(style, link, script)",u='[editmode\\:resource]:is(style, link, script)[type^="inert/"]',n="inert/";function l(e){let t=e.getAttribute("type");return t&&t.startsWith(n)?!1:(e.setAttribute("type",n+(t||"")),!0)}function a(e){let t=e.getAttribute("type").slice(n.length);t==="javascript"?e.setAttribute("type","text/javascript"):t?e.setAttribute("type",t):e.removeAttribute("type")}function p(){c(e=>{e.querySelectorAll(s).forEach(l)},{required:!0})}function d(){r&&o(()=>{f()})}function f(e=document){let t=(e.ownerDocument||e)===document;e.querySelectorAll(u).forEach(i=>{a(i),t&&i.replaceWith(i.cloneNode(!0))})}function b(){document.querySelectorAll(s).forEach(e=>{l(e)&&e.replaceWith(e.cloneNode(!0))})}function R(){p(),d()}export{s as a,f as b,b as c,R as d};
1
+ import{a as o}from"./c-VKEDWYDF.js";import{f as r}from"./c-JEWSJHMK.js";import{r as c}from"./c-UW6MMZ4V.js";var s="[editmode\\:resource]:is(style, link, script)",u='[editmode\\:resource]:is(style, link, script)[type^="inert/"]',n="inert/";function l(e){let t=e.getAttribute("type");return t&&t.startsWith(n)?!1:(e.setAttribute("type",n+(t||"")),!0)}function a(e){let t=e.getAttribute("type").slice(n.length);t==="javascript"?e.setAttribute("type","text/javascript"):t?e.setAttribute("type",t):e.removeAttribute("type")}function p(){c(e=>{e.querySelectorAll(s).forEach(l)},{required:!0})}function d(){r&&o(()=>{f()})}function f(e=document){let t=(e.ownerDocument||e)===document;e.querySelectorAll(u).forEach(i=>{a(i),t&&i.replaceWith(i.cloneNode(!0))})}function b(){document.querySelectorAll(s).forEach(e=>{l(e)&&e.replaceWith(e.cloneNode(!0))})}function R(){p(),d()}export{s as a,f as b,b as c,R as d};
@@ -1 +1 @@
1
- import{b as f}from"./c-QTEUO2K6.js";import{a as s,e as u,f as v,g as y,h,k as E}from"./c-DIKR7H57.js";import{b as d,c,d as b,e as r,f as k}from"./c-CUMXGHVD.js";import"./c-QY7F6EN6.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";function R(){let e=()=>{let n=r()&&c(r());document.dispatchEvent(new CustomEvent("clay:variant-change",{detail:{active:n,shown:n}}))},t=n=>d().some(o=>c(o)===n)?(document.documentElement.setAttribute("look",n),k(n),window.clay?.save?.soon?.(),e(),{ok:!0}):{ok:!1,code:"unknown-variant"};d().length>=2&&(window.clay.variants={list:()=>d().map(n=>({name:c(n),label:b(n),active:n===r()})),get active(){return r()&&c(r())},get shown(){return r()&&c(r())},preview:t,choose:t,keep:()=>Promise.resolve({ok:!1,code:"not-editing"})},document.addEventListener("clay:drafts-restored",()=>{e()}))}var A='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" aria-hidden="true"><path d="M12 9a3 3 0 1 1 0 6 3 3 0 0 1 0-6M10 3h4l1.5 3 3.5-.5 2 4-2 2.5 2 2.5-2 4-3.5-.5-1.5 3h-4l-1.5-3-3.5.5-2-4 2-2.5-2-2.5 2-4 3.5.5Z"/></svg>',w=()=>window.clay?.blockeditor?.history??window.clay?.undo??null;function M({addItem:e,beforeOpen:t}){let n=null,o=()=>{let a=w();if(!a)return;let i=n??{canUndo:!!a.canUndo,canRedo:!!a.canRedo};e({id:"clay.undo",pair:[{id:"clay.undo.undo",label:"Undo",keys:f("\u2318Z","Ctrl+Z"),disabled:!i.canUndo,run:()=>w()?.undo()},{id:"clay.undo.redo",label:"Redo",keys:f("\u2318\u21E7Z","Ctrl+Shift+Z"),disabled:!i.canRedo,run:()=>w()?.redo()}]})};document.addEventListener("clay:undo-change",a=>{n={canUndo:!!a.detail?.canUndo,canRedo:!!a.detail?.canRedo},o()}),o(),t.push(o)}function B(e=window.location){let t=e.pathname.replace(/\/+$/,"")||"/";return`/_/copy${t==="/"?"":t}`}function C({addItem:e,removeItem:t}){let n=o=>{if(o?.kind!=="trial"||!o.dismissed){t("clay.bar.host"),t("clay.bar.show");return}let a=Array.isArray(o.actions)?o.actions.find(i=>i?.id==="host"):null;typeof a?.href=="string"&&e({id:"clay.bar.host",label:"Host and share online",href:a.href}),typeof o.show=="function"&&e({id:"clay.bar.show",label:"Show draft bar",run:()=>o.show()})};document.addEventListener("hyperclay:bar",o=>n(o.detail)),n(window.hyperclayBar)}function T(){if(document.querySelector('clay-editor-ui[data-clay-ui="menu"]'))return;let e=E({sections:[["clay.undo"],null],icon:A,label:"Settings"}),{embedded:t,skin:n,addItem:o,removeItem:a,open:i,close:g,note:U,goo:L,beforeOpen:p}=e;e.mount(t?[s,u,n??y,h]:[s,u,v,y,h]);let m;p.push(()=>{typeof globalThis.indexedDB?.open!="function"||!globalThis.IDBKeyRange||(m??=import("./c-RFGELYEU.js").then(async({attachRecoveryMenu:l})=>{let{recoveryDrafts:S}=await import("./plugins/visitor-drafts-ZE6PCAFP.js");l(e,S)}).catch(l=>{m=null,console.warn("visitor-menu: earlier drafts did not load",l)}))}),R(),M({addItem:o,beforeOpen:p}),o({id:"clay.download",label:"Download copy",run:()=>window.clay.visitorDrafts.download()}),o({id:"clay.copy",label:"Make your own copy",href:B()}),C({addItem:o,removeItem:a}),window.clay.menu={addItem:o,removeItem:a,open:i,close:g,note:U,embedded:t,button:L},document.dispatchEvent(new CustomEvent("clay:menu-ready"))}export{T as start};
1
+ import{b as f}from"./c-QTEUO2K6.js";import{a as s,e as u,f as v,g as y,h,k as E}from"./c-DIKR7H57.js";import{b as d,c,d as b,e as r,f as k}from"./c-CUMXGHVD.js";import"./c-QY7F6EN6.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";function R(){let e=()=>{let n=r()&&c(r());document.dispatchEvent(new CustomEvent("clay:variant-change",{detail:{active:n,shown:n}}))},t=n=>d().some(o=>c(o)===n)?(document.documentElement.setAttribute("look",n),k(n),window.clay?.save?.soon?.(),e(),{ok:!0}):{ok:!1,code:"unknown-variant"};d().length>=2&&(window.clay.variants={list:()=>d().map(n=>({name:c(n),label:b(n),active:n===r()})),get active(){return r()&&c(r())},get shown(){return r()&&c(r())},preview:t,choose:t,keep:()=>Promise.resolve({ok:!1,code:"not-editing"})},document.addEventListener("clay:drafts-restored",()=>{e()}))}var A='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" aria-hidden="true"><path d="M12 9a3 3 0 1 1 0 6 3 3 0 0 1 0-6M10 3h4l1.5 3 3.5-.5 2 4-2 2.5 2 2.5-2 4-3.5-.5-1.5 3h-4l-1.5-3-3.5.5-2-4 2-2.5-2-2.5 2-4 3.5.5Z"/></svg>',w=()=>window.clay?.blockeditor?.history??window.clay?.undo??null;function M({addItem:e,beforeOpen:t}){let n=null,o=()=>{let a=w();if(!a)return;let i=n??{canUndo:!!a.canUndo,canRedo:!!a.canRedo};e({id:"clay.undo",pair:[{id:"clay.undo.undo",label:"Undo",keys:f("\u2318Z","Ctrl+Z"),disabled:!i.canUndo,run:()=>w()?.undo()},{id:"clay.undo.redo",label:"Redo",keys:f("\u2318\u21E7Z","Ctrl+Shift+Z"),disabled:!i.canRedo,run:()=>w()?.redo()}]})};document.addEventListener("clay:undo-change",a=>{n={canUndo:!!a.detail?.canUndo,canRedo:!!a.detail?.canRedo},o()}),o(),t.push(o)}function B(e=window.location){let t=e.pathname.replace(/\/+$/,"")||"/";return`/_/copy${t==="/"?"":t}`}function C({addItem:e,removeItem:t}){let n=o=>{if(o?.kind!=="trial"||!o.dismissed){t("clay.bar.host"),t("clay.bar.show");return}let a=Array.isArray(o.actions)?o.actions.find(i=>i?.id==="host"):null;typeof a?.href=="string"&&e({id:"clay.bar.host",label:"Host and share online",href:a.href}),typeof o.show=="function"&&e({id:"clay.bar.show",label:"Show draft bar",run:()=>o.show()})};document.addEventListener("hyperclay:bar",o=>n(o.detail)),n(window.hyperclayBar)}function T(){if(document.querySelector('clay-editor-ui[data-clay-ui="menu"]'))return;let e=E({sections:[["clay.undo"],null],icon:A,label:"Settings"}),{embedded:t,skin:n,addItem:o,removeItem:a,open:i,close:g,note:U,goo:L,beforeOpen:p}=e;e.mount(t?[s,u,n??y,h]:[s,u,v,y,h]);let m;p.push(()=>{typeof globalThis.indexedDB?.open!="function"||!globalThis.IDBKeyRange||(m??=import("./c-RFGELYEU.js").then(async({attachRecoveryMenu:l})=>{let{recoveryDrafts:S}=await import("./plugins/visitor-drafts-DCVGLCBX.js");l(e,S)}).catch(l=>{m=null,console.warn("visitor-menu: earlier drafts did not load",l)}))}),R(),M({addItem:o,beforeOpen:p}),o({id:"clay.download",label:"Download copy",run:()=>window.clay.visitorDrafts.download()}),o({id:"clay.copy",label:"Make your own copy",href:B()}),C({addItem:o,removeItem:a}),window.clay.menu={addItem:o,removeItem:a,open:i,close:g,note:U,embedded:t,button:L},document.dispatchEvent(new CustomEvent("clay:menu-ready"))}export{T as start};
@@ -1 +1 @@
1
- import"./c-VHNSBD2M.js";var l=(e,n)=>Object.assign(new Error(`clayjs: ${e}`),{code:n}),u=(e,n)=>!e||n.seq===null||e.seq===null||n.seq>e.seq?n:e;function a({stream:e,apply:n,retire:f,yieldArticle:i=()=>!1,reclaimArticle:s=()=>!1}){let t=null,r=!1;e.adopt({onSnapshot:o=>(t=u(t,o),!0)});let d=()=>{let o=t;return t=null,o};return{get represented(){return e.represented},get held(){return t??e.represented},yieldArticle(){return r||!i()?!1:(r=!0,!0)},reclaimArticle(){return!r||!s()?!1:(r=!1,!0)},reconcile(){let o=d();return o&&!n(o)?Promise.reject(l("the switch could not apply the saved file","load-failed")):Promise.resolve()},resume(){e.adopt({onSnapshot:n});let o=d();o&&n(o)},commit(){if(!r){let o=d();if(o&&!n(o))return!1}return e.represented.bytes===null?!1:(e.stop(),f())}}}async function c({stream:e,options:n,apply:f,retire:i,yieldArticle:s=()=>!1,reclaimArticle:t=()=>!1}){if(e)return a({stream:e,apply:f,retire:i,yieldArticle:s,reclaimArticle:t});let r=await import("./sync/live-sync-RZQSDMZW.js").then(({liveSync:d})=>d.prepareHandoff(n));return{get represented(){return r.represented},get held(){return r.held},yieldArticle:s,reclaimArticle:t,reconcile:()=>r.reconcile(),resume:()=>r.resume(),commit:()=>r.commit()&&i()}}async function p(e,{signal:n,deadline:f=15e3}={}){let i=Date.now()+f;for(;e._morphInFlight;){if(n?.aborted)throw e._handoffHeld=!1,l("the switch was cancelled","aborted");if(Date.now()>=i)throw e._handoffHeld=!1,l("the apply did not settle","timeout");await new Promise(t=>setTimeout(t,1))}let s=()=>e._pendingHtml!=null||e._pendingExternal!=null;return{get represented(){return e._represented},get held(){let t=e._represented;return e._pendingHtml!=null&&(t=u(t,{bytes:e._pendingHtml,etag:e._pendingEtag??null,seq:e._pendingSeq??null})),e._pendingExternal&&(t=u(t,{bytes:e._pendingExternal.html,etag:e._pendingExternal.etag??null,seq:e._pendingExternal.seq??null})),t},async reconcile(){if(!(!e._handoff||e.isDestroyed)){for(let t=0;t<8;t++){if(e._morphInFlight){await new Promise(r=>setTimeout(r,1));continue}if(!s())return;await e._runPending()}if(s())throw l("the held frame could not be applied","load-failed")}},resume(){e._handoff&&(e._handoff=null,e._handoffHeld=!1,e._scheduleNextFrame())},commit(){return e._represented.bytes?(e._handoff=null,e._handoffHeld=!1,e.stop(),!0):!1}}}export{p as engineHandoff,c as readerHandoff};
1
+ import"./c-VHNSBD2M.js";var l=(e,n)=>Object.assign(new Error(`clayjs: ${e}`),{code:n}),u=(e,n)=>!e||n.seq===null||e.seq===null||n.seq>e.seq?n:e;function a({stream:e,apply:n,retire:f,yieldArticle:i=()=>!1,reclaimArticle:s=()=>!1}){let t=null,r=!1;e.adopt({onSnapshot:o=>(t=u(t,o),!0)});let d=()=>{let o=t;return t=null,o};return{get represented(){return e.represented},get held(){return t??e.represented},yieldArticle(){return r||!i()?!1:(r=!0,!0)},reclaimArticle(){return!r||!s()?!1:(r=!1,!0)},reconcile(){let o=d();return o&&!n(o)?Promise.reject(l("the switch could not apply the saved file","load-failed")):Promise.resolve()},resume(){e.adopt({onSnapshot:n});let o=d();o&&n(o)},commit(){if(!r){let o=d();if(o&&!n(o))return!1}return e.represented.bytes===null?!1:(e.stop(),f())}}}async function c({stream:e,options:n,apply:f,retire:i,yieldArticle:s=()=>!1,reclaimArticle:t=()=>!1}){if(e)return a({stream:e,apply:f,retire:i,yieldArticle:s,reclaimArticle:t});let r=await import("./sync/live-sync-2UYQQSD7.js").then(({liveSync:d})=>d.prepareHandoff(n));return{get represented(){return r.represented},get held(){return r.held},yieldArticle:s,reclaimArticle:t,reconcile:()=>r.reconcile(),resume:()=>r.resume(),commit:()=>r.commit()&&i()}}async function p(e,{signal:n,deadline:f=15e3}={}){let i=Date.now()+f;for(;e._morphInFlight;){if(n?.aborted)throw e._handoffHeld=!1,l("the switch was cancelled","aborted");if(Date.now()>=i)throw e._handoffHeld=!1,l("the apply did not settle","timeout");await new Promise(t=>setTimeout(t,1))}let s=()=>e._pendingHtml!=null||e._pendingExternal!=null;return{get represented(){return e._represented},get held(){let t=e._represented;return e._pendingHtml!=null&&(t=u(t,{bytes:e._pendingHtml,etag:e._pendingEtag??null,seq:e._pendingSeq??null})),e._pendingExternal&&(t=u(t,{bytes:e._pendingExternal.html,etag:e._pendingExternal.etag??null,seq:e._pendingExternal.seq??null})),t},async reconcile(){if(!(!e._handoff||e.isDestroyed)){for(let t=0;t<8;t++){if(e._morphInFlight){await new Promise(r=>setTimeout(r,1));continue}if(!s())return;await e._runPending()}if(s())throw l("the held frame could not be applied","load-failed")}},resume(){e._handoff&&(e._handoff=null,e._handoffHeld=!1,e._scheduleNextFrame())},commit(){return e._represented.bytes?(e._handoff=null,e._handoffHeld=!1,e.stop(),!0):!1}}}export{p as engineHandoff,c as readerHandoff};
@@ -1,3 +1,3 @@
1
- import{b as U}from"./c-LD6UVV5R.js";import{a as se,g as ae,h as C}from"./c-PGSBXHUE.js";import{a as oe,b as ie,c as j}from"./c-KU3PX7LL.js";import{d as A}from"./c-EQ5NBOGA.js";import{c as Z,e as Q,g as ee}from"./c-IJUK2GPW.js";import{b as k,f as D}from"./c-C7SUMNMI.js";import{c as V}from"./c-BPF2NSPV.js";import{i as q}from"./c-U4TWEIKZ.js";import{a as M,g as te,h as ne,i as re}from"./c-UW6MMZ4V.js";var F=null,ue=null,T=null;function Te(e){let t=e?.document?.maxBytes;return Number.isSafeInteger(t)&&t>0?t:null}function le(e){return F=Te(e),ue=e?.document?.maxBytesMeasures==="file"?"file":null,F}var be=/<script\b[^>]*\bmerge=(["'])blockeditor\1[^>]*>[\s\S]*?<\/script\s*>/i;function B(e,t=ue){if(t!=="file"||typeof e!="string")return e;let n=be.exec(e);if(!n)return e;let o=n.index,s=o+n[0].length,r=e.lastIndexOf(`
1
+ import{b as U}from"./c-LD6UVV5R.js";import{a as se,g as ae,h as C}from"./c-PGSBXHUE.js";import{a as oe,b as ie,c as j}from"./c-OSGTRM4C.js";import{d as A}from"./c-26W3BMWK.js";import{c as Z,e as Q,g as ee}from"./c-IJUK2GPW.js";import{b as k,f as D}from"./c-JEWSJHMK.js";import{c as V}from"./c-BPF2NSPV.js";import{i as q}from"./c-U4TWEIKZ.js";import{a as M,g as te,h as ne,i as re}from"./c-UW6MMZ4V.js";var F=null,ue=null,T=null;function Te(e){let t=e?.document?.maxBytes;return Number.isSafeInteger(t)&&t>0?t:null}function le(e){return F=Te(e),ue=e?.document?.maxBytesMeasures==="file"?"file":null,F}var be=/<script\b[^>]*\bmerge=(["'])blockeditor\1[^>]*>[\s\S]*?<\/script\s*>/i;function B(e,t=ue){if(t!=="file"||typeof e!="string")return e;let n=be.exec(e);if(!n)return e;let o=n.index,s=o+n[0].length,r=e.lastIndexOf(`
2
2
  `,o-1)+1,a=e.indexOf(`
3
- `,s),c=a===-1?e.length:a+1;return!/\S/.test(e.slice(r,o))&&!/\S/.test(e.slice(s,c))&&(o=r,s=c),e.slice(0,o)+e.slice(s)}function H(e,t){let n=new TextEncoder().encode(e).byteLength,o=Number.isSafeInteger(t)&&t>0;return{bytes:n,maxBytes:o?t:null,state:o?n>t?"over":n>=Math.ceil(t*.8)?"near":"ok":"unknown"}}function ce(){return F}function L({fresh:e=!1}={}){return e?(T=A({fresh:!0}).then(le),T):(T||(T=A().then(le)),T)}function St({fresh:e=!1}={}){return L({fresh:e}).then(t=>({maxBytes:t}))}async function xt(e){let t=await L();return H(B(e),t)}function fe(e){let t=new CustomEvent("clay:save-size",{detail:e});document.dispatchEvent(t),(e.state==="near"||e.state==="over")&&import("./c-3F3AADKG.js").then(n=>n.start(t),()=>{})}var P="/_/clayjs/",Oe=/[\u0000-\u001F\u007F]/,Ee=/^[\t\n\f\r ]|[\t\n\f\r ]$/,$e=/^https:\/\/clayjs\.com\/v(\d+)\/([\s\S]*)$/,Re=/^https:\/\/clayjs\.com\/(\d+)\.(\d+)\.(\d+)\/([\s\S]*)$/,de=/^\/_\/clayjs\/(\d+)\.(\d+)\.(\d+)\/([\s\S]*)$/,ke=/%2e|%2f|%5c/i;function Me(e){if(typeof e!="string")return null;let t=/^(\d+)\.\d+\.\d+$/.exec(e);return t?t[1]:null}function je(e){if(typeof e!="string"||e==="")return null;try{return new URL(e).origin}catch{return null}}function Le(e){let t=e.indexOf("#"),n=t<0?"":e.slice(t),o=t<0?e:e.slice(0,t),s=o.indexOf("?"),r=s<0?"":o.slice(s);return{head:s<0?o:o.slice(0,s),search:r,hash:n}}function Pe(e){if(e===""||e.includes("\\")||ke.test(e))return null;let t=e.split("/"),n=[];for(let o of t){if(o===""||o==="."||o==="..")return null;let s;try{s=decodeURIComponent(o)}catch{return null}if(s.includes("/")||s.includes("\\")||s==="."||s==="..")return null;n.push(s)}return n.join("/")}function b(e,{documentURL:t}={}){if(typeof e!="string"||e===""||Ee.test(e)||Oe.test(e))return null;let{head:n,search:o,hash:s}=Le(e),r=null,a=null,c=null,l=null,i=$e.exec(n);if(i&&(r="rolling",c=i[1],l=i[2]),r||(i=Re.exec(n),i&&(r="exact",a=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],l=i[4])),r||(i=de.exec(n),i&&(r="local",a=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],l=i[4])),!r){let f=je(t);f&&n.startsWith(`${f}/`)&&(i=de.exec(n.slice(f.length)),i&&(r="local",a=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],l=i[4]))}if(!r)return null;let u=Pe(l);return u===null?null:{kind:r,major:c,version:a,rawPath:l,path:u,search:o,hash:s}}function Ie(e,t){let n=e&&typeof e=="object"?e[t]:null;return n&&typeof n.files=="object"&&n.files?n.files:null}function _e(e){return!e||typeof e!="object"?[]:Array.isArray(e.entries)?e.entries.filter(t=>t&&typeof t=="object"):[]}function Ne(e,t,n){if(!n)return!0;let o=Ie(n,t);return!!(o&&Object.hasOwn(o,e.path))}function he(e,{descriptor:t,releases:n,documentURL:o,aliases:s}={}){let r=b(e,{documentURL:o});if(!r||r.kind!=="local")return e;let a=_e(t),c=Me(r.version);for(let l of a){if(l.local!==e||typeof l.original!="string")continue;let i=n?.[r.version]?.aliases??s;if(i&&typeof i=="object"&&!r.search&&!r.hash&&Object.hasOwn(i,l.original)&&i[l.original]===r.path)return l.original;let u=b(l.original);if(u&&!(u.kind!=="rolling"&&u.kind!=="exact")&&u.rawPath===r.rawPath&&u.search===r.search&&u.hash===r.hash&&!(u.kind==="rolling"?u.major!==c:u.version!==r.version)&&Ne(r,r.version,n))return u.kind==="exact"?l.original:`https://clayjs.com/v${u.major}/${r.rawPath}${r.search}${r.hash}`}for(let l of a){if(typeof l.original!="string")continue;let i=b(l.original);if(i&&!(i.kind!=="rolling"&&i.kind!=="exact")&&i.rawPath===r.rawPath&&!(i.kind==="rolling"?i.major!==c:i.version!==r.version))return i.kind==="rolling"?`https://clayjs.com/v${i.major}/${r.rawPath}${r.search}${r.hash}`:`https://clayjs.com/${i.version}/${r.rawPath}${r.search}${r.hash}`}return`https://clayjs.com/${r.version}/${r.rawPath}${r.search}${r.hash}`}var De=Object.freeze({"https://cdn.jsdelivr.net/npm/overtype@2.6.1/dist/overtype.min.js":"compat/overtype-2.6.1.min.js","https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js":"compat/highlight-11.9.0.min.js","https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,300;0,400;0,500;0,600;1,400;1,500&family=IBM+Plex+Sans:wght@400;500;600&display=swap":"fonts/ibm-plex.css"}),z="clay-runtime-map",Ue=new Set(["stylesheet","preload","modulepreload"]),pe=null,J=null;function Ce(e){let t;try{t=JSON.parse(e)}catch{return null}return!t||typeof t!="object"||t.schema!==1?null:t}function Fe(){if(typeof document>"u")return null;let e=document.getElementById(z);if(!e)return null;let t=e.textContent??"";return t===pe||(pe=t,J=Ce(t)),J}var Be=`script[src*="${P}"], link[href*="${P}"], #${z}`;function me(e){if(e.querySelector(Be))return!0;for(let t of e.querySelectorAll("template"))if(me(t.content))return!0;return!1}function He(e){let t=[],n=[e];for(;n.length;){let o=n.pop();for(let s of o.children??[])t.push(s),n.push(s),s.content&&n.push(s.content)}return t}function Je(e){return e.tagName==="SCRIPT"&&e.hasAttribute("src")?"src":e.tagName!=="LINK"||!e.hasAttribute("href")?null:(e.getAttribute("rel")??"").toLowerCase().split(/\s+/).some(n=>Ue.has(n))?"href":null}function ze(e){if(!e||!me(e))return;let t=[],n=!1;for(let r of He(e)){if(r.getAttribute("id")===z){r.remove();continue}let a=Je(r);a&&(t.push({element:r,name:a}),!n&&(r.getAttribute(a)??"").includes(P)&&(n=!0))}if(!n)return;let o=location.href,s=Fe();for(let{element:r,name:a}of t){let c=r.getAttribute(a),l=b(c,{documentURL:o});!l||l.kind!=="local"||r.setAttribute(a,he(c,{descriptor:s,documentURL:o,aliases:De}))}}re(ze);var x=!1,$=null,ge="/_/save",Ke=12e3,ve=6e4,We=1024*1024,we="text/plain;charset=UTF-8",I=null,R=!1,K=new Map;function Ht(e,t){t==null?K.delete(e):K.set(e,String(t))}var W=new Set;function Jt(e){return W.add(e),()=>W.delete(e)}async function zt(e,t){R=!!e;try{return await t()}finally{R=!1}}function Gt(){return x}function Kt(){return x?null:(x=!0,$={reserved:!0},$)}function Wt(e){!e||$!==e||($=null,x=!1)}function Xt(){return R}var _=[],N=[];function Yt(e){return _.push(e),()=>{let t=_.indexOf(e);t>=0&&_.splice(t,1)}}function Vt(e){return N.push(e),()=>{let t=N.indexOf(e);t>=0&&N.splice(t,1)}}function Xe(e){for(let t of _)try{t(e)}catch(n){console.error("clayjs: onSaveAttempt hook failed:",n)}}function Ye(e){for(let t of N)try{t(e)}catch(n){console.error("clayjs: onSaveOutcome hook failed:",n)}}function ye(e){return{ok:!0,msg:e.msg??"Saved",msgType:e.msgType||"success",code:e.code??null,etag:e.etag??null,...e.siteData?{siteData:e.siteData}:{}}}var O=[],Ve=8,y=null;function qt(){return y!==null}function Se(){let e=window.crypto?.randomUUID?.();if(e)return e;if(window.crypto?.getRandomValues){let n=new Uint8Array(16);return window.crypto.getRandomValues(n),Array.from(n,o=>o.toString(16).padStart(2,"0")).join("")}let t=()=>Math.random().toString(36).slice(2,12).padEnd(10,"0");return`${Date.now().toString(36)}-${t()}${t()}${t()}`}function qe(e){O.push(e),O.length>Ve&&O.shift()}function Ze(e){return typeof e=="string"&&e!==""&&O.includes(e)}function Zt(){O.length=0,y=null}function X(e){let t=e.name==="AbortError",n=!t&&e.status===412,o=!t&&!n&&e.code==="save-already-applied";return{ok:!1,msg:t?"Server not responding":e.message||"Save failed",msgType:t||o?"unknown":n?"conflict":"error",code:t?"timeout":n?"conflict":e.code??null,changedBy:n?e.changedBy??null:null,afterTimeout:n&&y!==null,conflictEtag:n?e.etag??null:null,status:Number.isInteger(e.status)?e.status:null,hadTimeout:t||e.hadTimeout===!0,reason:e.reason??null,retryAfter:e.retryAfter??null,saveOutcome:e.saveOutcome??null,etag:null}}function E(e){return{ok:!1,msg:e,msgType:"skipped",code:null,etag:null}}function Qe(e){let t=new Error(`This document is ${e.bytes} bytes; this host saves at most ${e.maxBytes}`);return t.code="save-too-large",{...X(t),sent:!1,size:e}}var w=null;function et(e){return w?null:(w={kind:e},w)}function tt(e){w===e&&(w=null)}function nt(){return w?w.kind:null}function rt(){return{ok:!1,msg:"Invalid page conversion metadata",msgType:"error",code:"invalid-header",etag:null}}var ot=3,it=/^(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} \d{2}:\d{2}:\d{2} GMT|(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), \d{2}-(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\d{2} \d{2}:\d{2}:\d{2} GMT|(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (?: \d|\d{2}) \d{2}:\d{2}:\d{2} \d{4})$/;function st(e){if(e==null)return null;let t=String(e).trim();if(!t)return null;if(/^-?\d+$/.test(t))return Math.max(0,Math.min(3600,Number(t)));if(!it.test(t))return null;let n=Date.parse(t);return Number.isNaN(n)?null:Math.max(0,Math.min(3600,Math.round((n-Date.now())/1e3)))}var at=/^[0-9a-f]{64}$/,lt=/^[A-Za-z0-9-]{1,64}$/;function ut(e){if(e==null)return{header:null};if(typeof e!="object")return{invalid:!0};let{source:t,base:n,epoch:o}=e;return typeof n!="string"||!at.test(n)?{invalid:!0}:t==="file"?o!=null?{invalid:!0}:{header:`v1; source=file; base=${n}`}:t==="room"?typeof o!="string"||!lt.test(o)?{invalid:!0}:{header:`v1; source=room; base=${n}; epoch=${o}`}:{invalid:!0}}function ct(e,t,n,o,s,r=!1,a=null,c=!0){let l=V(),i=l?`${ge}/${l}`:ge,u={method:"POST",credentials:l?"omit":"same-origin",signal:n,headers:{"Document-URL":window.location.href,"Page-URL":window.location.href,"Save-Trigger":t?"user":"auto","Save-ID":o,[se]:String(1)},body:ft(e)};for(let[f,h]of K)u.headers[f]=h;if(c)for(let f of W){let h=null;try{h=f(e)}catch(p){console.error("clayjs: a save header source failed:",p)}if(h)for(let[p,S]of Object.entries(h))u.headers[p]=String(S)}return typeof u.body!="string"&&(u.headers["Content-Type"]=we),a&&(u.headers["Blockeditor-Conversion"]=a),s&&(u.headers["If-Match"]=s),r&&e.length<ve&&new Blob([e]).size<ve&&(u.keepalive=!0),{url:dt(i),options:u}}function ft(e){if(e.length<We)return e;if(I&&I.content===e)return I.blob;let t=new Blob([e],{type:we});return I={content:e,blob:t},t}function xe(){let e=oe();return ie()&&e?e:null}function dt(e){let t=window.location.origin;return!t||t==="null"?e:new URL(e,t).href}function G(e,t){let n=JSON.stringify(t);return{ok:e>=200&&e<300,status:e,statusText:e===200?"OK":"Insufficient Storage",text:()=>Promise.resolve(n)}}function ht(e,t){let n=q();return n?Promise.resolve().then(()=>n(e,t)).then(()=>G(200,{msg:"Saved in this browser",msgType:"success"}),o=>G(507,{msg:"Couldn't save in this browser. Storage is full or turned off.",msgType:"error",code:o?.code||"draft-storage"})):Promise.resolve(G(503,{msg:"Saving in this browser is not ready yet",msgType:"error",code:"draft-not-ready"}))}function pt(e,t,n,{captureId:o=null,conversionHeader:s=null,attempts:r=[],gateToken:a=null}={}){let c=new AbortController,l=setTimeout(()=>c.abort(),Ke),i=Q(),u=ee(),f=i||u,h=R;R=!1;let{url:p,options:S}=ct(e,f,c.signal,t,n,h,s);return qe(t),k||(r.some(d=>d.saveId===t&&d.etag===(n??null))||r.push({saveId:t,etag:n??null}),Xe({captureId:o,saveId:t,html:e,etag:n??null})),(k?ht(e,a):fetch(p,S)).then(d=>d.text().then(g=>{let m={};if(g)try{m=JSON.parse(g)}catch{if(d.ok)throw new Error("Server sent a response that was not JSON")}if(!d.ok){let v=new Error(m.msg||m.error||`HTTP ${d.status}: ${d.statusText}`);throw v.code=d.status===413?"save-too-large":m.code??null,v.status=d.status,v.changedBy=m.changedBy??null,v.etag=m.etag??null,v.saveId=m.saveId??null,v.reason=typeof m.reason=="string"?m.reason:null,v.saveOutcome=m.saveOutcome??null,v.retryAfter=st(d.headers?.get?.("Retry-After")),v}return j(m.etag??null),y=null,m})).catch(d=>{throw console.error("Failed to save page:",d),d.name==="AbortError"&&(y={saveId:t,etag:n}),f&&Z(),d}).finally(()=>{clearTimeout(l)})}async function mt(){let e=y;if(!e)return{landed:null,resend:!1};let n=(await A({fresh:!0})).document,o=typeof n?.etag=="string"&&n.etag?n.etag:null;return o?n.saveId&&n.saveId===e.saveId?(j(o),y=null,{landed:{msg:"Saved",msgType:"success",etag:o},resend:!1}):(n.saveId&&(y=null),{landed:null,resend:!!e.etag,etag:e.etag}):{landed:null,resend:!1}}async function gt(e,{captureId:t=null,conversionHeader:n=null,attempts:o=[],gateToken:s=null}={}){let r=Se(),a=xe(),c=!1,l=!1,i=0,u=t??M();for(;;)try{return await pt(e,r,a,{captureId:t,conversionHeader:n,attempts:o,gateToken:s})}catch(f){if(c&&(f.hadTimeout=!0),f.name==="AbortError"){if(c)throw f;let{landed:h,resend:p,etag:S}=await mt();if(h)return h;if(!p)throw f;a=S,c=!0;continue}if(f.status===412&&!l&&Ze(f.saveId)){j(f.etag??null),y=null,r=Se(),a=xe(),l=!0;continue}if(f.code==="blockeditor-converting"&&i<ot){if(M()!==u||(i+=1,await new Promise(h=>setTimeout(h,Math.max(0,f.retryAfter??1)*1e3)),M()!==u))throw f;continue}throw f}}function Y(e,t,n,o,s=null,r=0,a=null,c=null){return e=ae(e,Math.max(C(),r)),new Promise(l=>{let i=[],u=te(s),f=()=>a!==null&&$===a,h=()=>{f()||(x=!1)},p=(g,m=!1)=>{m&&U(e,t??null,u),ne(s),Ye({captureId:t??null,result:g,attempts:i,sent:i.length>0}),typeof n=="function"&&n(g),l(g)};if(!D&&!window.clay?.testMode)return p(E("Not in edit mode"));if(x&&!f())return p(E("Save already in progress"));let S=ut(o);if(S.invalid)return p(rt());if(x=!0,window.clay?.testMode){setTimeout(()=>{h(),p(ye({msg:"Test mode: save skipped"}))},0);return}L();let d=H(B(e),ce());if(fe(d),d.state==="over")return h(),p(Qe(d));gt(e,{captureId:t,conversionHeader:S.header,attempts:i,gateToken:c}).then(ye,X).then(g=>{h(),g.code==="save-too-large"&&!g.size&&(g.size=d),g.ok&&U(e,t??null,u,g.siteData??null),p(g)})})}function vt(e,t=()=>{}){return Y(e,null,t,null)}function Qt(e,t,n=()=>{},{conversion:o,capture:s=null,blockeditorFormatFloor:r,lane:a=null,gateToken:c=null}={}){return Y(e,t,n,o,s,r,a,c)}function en({html:e,captureId:t,conversion:n}){return Y(e,t??null,void 0,n)}function tn(e,t=()=>{}){return new Promise(n=>{let o=null,s=r=>{tt(o),typeof t=="function"&&t(r),n(r)};if(!D)return s(E("Not in edit mode"));if(nt())return s(E("Another document operation is in progress"));if(x)return s(E("Save already in progress"));if(k)return s(!1);o=et("replace"),fetch(new URL(e,window.location.href).href).then(r=>{if(!r.ok)throw new Error(`Template fetch failed: HTTP ${r.status} ${r.statusText}`);return r.text()}).then(r=>vt(r)).then(s).catch(r=>{console.error("Failed to fetch template:",r),s(X(r))})})}var Ae=null;function nn(e){Ae=e}function rn(){return Ae}export{L as a,St as b,xt as c,Ht as d,Jt as e,zt as f,Gt as g,Kt as h,Wt as i,Xt as j,Yt as k,Vt as l,qt as m,Se as n,Zt as o,et as p,tt as q,nt as r,ct as s,vt as t,Qt as u,en as v,tn as w,nn as x,rn as y};
3
+ `,s),c=a===-1?e.length:a+1;return!/\S/.test(e.slice(r,o))&&!/\S/.test(e.slice(s,c))&&(o=r,s=c),e.slice(0,o)+e.slice(s)}function H(e,t){let n=new TextEncoder().encode(e).byteLength,o=Number.isSafeInteger(t)&&t>0;return{bytes:n,maxBytes:o?t:null,state:o?n>t?"over":n>=Math.ceil(t*.8)?"near":"ok":"unknown"}}function ce(){return F}function L({fresh:e=!1}={}){return e?(T=A({fresh:!0}).then(le),T):(T||(T=A().then(le)),T)}function St({fresh:e=!1}={}){return L({fresh:e}).then(t=>({maxBytes:t}))}async function xt(e){let t=await L();return H(B(e),t)}function fe(e){let t=new CustomEvent("clay:save-size",{detail:e});document.dispatchEvent(t),(e.state==="near"||e.state==="over")&&import("./c-JOA4OJGK.js").then(n=>n.start(t),()=>{})}var P="/_/clayjs/",Oe=/[\u0000-\u001F\u007F]/,Ee=/^[\t\n\f\r ]|[\t\n\f\r ]$/,$e=/^https:\/\/clayjs\.com\/v(\d+)\/([\s\S]*)$/,Re=/^https:\/\/clayjs\.com\/(\d+)\.(\d+)\.(\d+)\/([\s\S]*)$/,de=/^\/_\/clayjs\/(\d+)\.(\d+)\.(\d+)\/([\s\S]*)$/,ke=/%2e|%2f|%5c/i;function Me(e){if(typeof e!="string")return null;let t=/^(\d+)\.\d+\.\d+$/.exec(e);return t?t[1]:null}function je(e){if(typeof e!="string"||e==="")return null;try{return new URL(e).origin}catch{return null}}function Le(e){let t=e.indexOf("#"),n=t<0?"":e.slice(t),o=t<0?e:e.slice(0,t),s=o.indexOf("?"),r=s<0?"":o.slice(s);return{head:s<0?o:o.slice(0,s),search:r,hash:n}}function Pe(e){if(e===""||e.includes("\\")||ke.test(e))return null;let t=e.split("/"),n=[];for(let o of t){if(o===""||o==="."||o==="..")return null;let s;try{s=decodeURIComponent(o)}catch{return null}if(s.includes("/")||s.includes("\\")||s==="."||s==="..")return null;n.push(s)}return n.join("/")}function b(e,{documentURL:t}={}){if(typeof e!="string"||e===""||Ee.test(e)||Oe.test(e))return null;let{head:n,search:o,hash:s}=Le(e),r=null,a=null,c=null,l=null,i=$e.exec(n);if(i&&(r="rolling",c=i[1],l=i[2]),r||(i=Re.exec(n),i&&(r="exact",a=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],l=i[4])),r||(i=de.exec(n),i&&(r="local",a=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],l=i[4])),!r){let f=je(t);f&&n.startsWith(`${f}/`)&&(i=de.exec(n.slice(f.length)),i&&(r="local",a=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],l=i[4]))}if(!r)return null;let u=Pe(l);return u===null?null:{kind:r,major:c,version:a,rawPath:l,path:u,search:o,hash:s}}function Ie(e,t){let n=e&&typeof e=="object"?e[t]:null;return n&&typeof n.files=="object"&&n.files?n.files:null}function _e(e){return!e||typeof e!="object"?[]:Array.isArray(e.entries)?e.entries.filter(t=>t&&typeof t=="object"):[]}function Ne(e,t,n){if(!n)return!0;let o=Ie(n,t);return!!(o&&Object.hasOwn(o,e.path))}function he(e,{descriptor:t,releases:n,documentURL:o,aliases:s}={}){let r=b(e,{documentURL:o});if(!r||r.kind!=="local")return e;let a=_e(t),c=Me(r.version);for(let l of a){if(l.local!==e||typeof l.original!="string")continue;let i=n?.[r.version]?.aliases??s;if(i&&typeof i=="object"&&!r.search&&!r.hash&&Object.hasOwn(i,l.original)&&i[l.original]===r.path)return l.original;let u=b(l.original);if(u&&!(u.kind!=="rolling"&&u.kind!=="exact")&&u.rawPath===r.rawPath&&u.search===r.search&&u.hash===r.hash&&!(u.kind==="rolling"?u.major!==c:u.version!==r.version)&&Ne(r,r.version,n))return u.kind==="exact"?l.original:`https://clayjs.com/v${u.major}/${r.rawPath}${r.search}${r.hash}`}for(let l of a){if(typeof l.original!="string")continue;let i=b(l.original);if(i&&!(i.kind!=="rolling"&&i.kind!=="exact")&&i.rawPath===r.rawPath&&!(i.kind==="rolling"?i.major!==c:i.version!==r.version))return i.kind==="rolling"?`https://clayjs.com/v${i.major}/${r.rawPath}${r.search}${r.hash}`:`https://clayjs.com/${i.version}/${r.rawPath}${r.search}${r.hash}`}return`https://clayjs.com/${r.version}/${r.rawPath}${r.search}${r.hash}`}var De=Object.freeze({"https://cdn.jsdelivr.net/npm/overtype@2.6.1/dist/overtype.min.js":"compat/overtype-2.6.1.min.js","https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js":"compat/highlight-11.9.0.min.js","https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,300;0,400;0,500;0,600;1,400;1,500&family=IBM+Plex+Sans:wght@400;500;600&display=swap":"fonts/ibm-plex.css"}),z="clay-runtime-map",Ue=new Set(["stylesheet","preload","modulepreload"]),pe=null,J=null;function Ce(e){let t;try{t=JSON.parse(e)}catch{return null}return!t||typeof t!="object"||t.schema!==1?null:t}function Fe(){if(typeof document>"u")return null;let e=document.getElementById(z);if(!e)return null;let t=e.textContent??"";return t===pe||(pe=t,J=Ce(t)),J}var Be=`script[src*="${P}"], link[href*="${P}"], #${z}`;function me(e){if(e.querySelector(Be))return!0;for(let t of e.querySelectorAll("template"))if(me(t.content))return!0;return!1}function He(e){let t=[],n=[e];for(;n.length;){let o=n.pop();for(let s of o.children??[])t.push(s),n.push(s),s.content&&n.push(s.content)}return t}function Je(e){return e.tagName==="SCRIPT"&&e.hasAttribute("src")?"src":e.tagName!=="LINK"||!e.hasAttribute("href")?null:(e.getAttribute("rel")??"").toLowerCase().split(/\s+/).some(n=>Ue.has(n))?"href":null}function ze(e){if(!e||!me(e))return;let t=[],n=!1;for(let r of He(e)){if(r.getAttribute("id")===z){r.remove();continue}let a=Je(r);a&&(t.push({element:r,name:a}),!n&&(r.getAttribute(a)??"").includes(P)&&(n=!0))}if(!n)return;let o=location.href,s=Fe();for(let{element:r,name:a}of t){let c=r.getAttribute(a),l=b(c,{documentURL:o});!l||l.kind!=="local"||r.setAttribute(a,he(c,{descriptor:s,documentURL:o,aliases:De}))}}re(ze);var x=!1,$=null,ge="/_/save",Ke=12e3,ve=6e4,We=1024*1024,we="text/plain;charset=UTF-8",I=null,R=!1,K=new Map;function Ht(e,t){t==null?K.delete(e):K.set(e,String(t))}var W=new Set;function Jt(e){return W.add(e),()=>W.delete(e)}async function zt(e,t){R=!!e;try{return await t()}finally{R=!1}}function Gt(){return x}function Kt(){return x?null:(x=!0,$={reserved:!0},$)}function Wt(e){!e||$!==e||($=null,x=!1)}function Xt(){return R}var _=[],N=[];function Yt(e){return _.push(e),()=>{let t=_.indexOf(e);t>=0&&_.splice(t,1)}}function Vt(e){return N.push(e),()=>{let t=N.indexOf(e);t>=0&&N.splice(t,1)}}function Xe(e){for(let t of _)try{t(e)}catch(n){console.error("clayjs: onSaveAttempt hook failed:",n)}}function Ye(e){for(let t of N)try{t(e)}catch(n){console.error("clayjs: onSaveOutcome hook failed:",n)}}function ye(e){return{ok:!0,msg:e.msg??"Saved",msgType:e.msgType||"success",code:e.code??null,etag:e.etag??null,...e.siteData?{siteData:e.siteData}:{}}}var O=[],Ve=8,y=null;function qt(){return y!==null}function Se(){let e=window.crypto?.randomUUID?.();if(e)return e;if(window.crypto?.getRandomValues){let n=new Uint8Array(16);return window.crypto.getRandomValues(n),Array.from(n,o=>o.toString(16).padStart(2,"0")).join("")}let t=()=>Math.random().toString(36).slice(2,12).padEnd(10,"0");return`${Date.now().toString(36)}-${t()}${t()}${t()}`}function qe(e){O.push(e),O.length>Ve&&O.shift()}function Ze(e){return typeof e=="string"&&e!==""&&O.includes(e)}function Zt(){O.length=0,y=null}function X(e){let t=e.name==="AbortError",n=!t&&e.status===412,o=!t&&!n&&e.code==="save-already-applied";return{ok:!1,msg:t?"Server not responding":e.message||"Save failed",msgType:t||o?"unknown":n?"conflict":"error",code:t?"timeout":n?"conflict":e.code??null,changedBy:n?e.changedBy??null:null,afterTimeout:n&&y!==null,conflictEtag:n?e.etag??null:null,status:Number.isInteger(e.status)?e.status:null,hadTimeout:t||e.hadTimeout===!0,reason:e.reason??null,retryAfter:e.retryAfter??null,saveOutcome:e.saveOutcome??null,etag:null}}function E(e){return{ok:!1,msg:e,msgType:"skipped",code:null,etag:null}}function Qe(e){let t=new Error(`This document is ${e.bytes} bytes; this host saves at most ${e.maxBytes}`);return t.code="save-too-large",{...X(t),sent:!1,size:e}}var w=null;function et(e){return w?null:(w={kind:e},w)}function tt(e){w===e&&(w=null)}function nt(){return w?w.kind:null}function rt(){return{ok:!1,msg:"Invalid page conversion metadata",msgType:"error",code:"invalid-header",etag:null}}var ot=3,it=/^(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} \d{2}:\d{2}:\d{2} GMT|(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), \d{2}-(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\d{2} \d{2}:\d{2}:\d{2} GMT|(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (?: \d|\d{2}) \d{2}:\d{2}:\d{2} \d{4})$/;function st(e){if(e==null)return null;let t=String(e).trim();if(!t)return null;if(/^-?\d+$/.test(t))return Math.max(0,Math.min(3600,Number(t)));if(!it.test(t))return null;let n=Date.parse(t);return Number.isNaN(n)?null:Math.max(0,Math.min(3600,Math.round((n-Date.now())/1e3)))}var at=/^[0-9a-f]{64}$/,lt=/^[A-Za-z0-9-]{1,64}$/;function ut(e){if(e==null)return{header:null};if(typeof e!="object")return{invalid:!0};let{source:t,base:n,epoch:o}=e;return typeof n!="string"||!at.test(n)?{invalid:!0}:t==="file"?o!=null?{invalid:!0}:{header:`v1; source=file; base=${n}`}:t==="room"?typeof o!="string"||!lt.test(o)?{invalid:!0}:{header:`v1; source=room; base=${n}; epoch=${o}`}:{invalid:!0}}function ct(e,t,n,o,s,r=!1,a=null,c=!0){let l=V(),i=l?`${ge}/${l}`:ge,u={method:"POST",credentials:l?"omit":"same-origin",signal:n,headers:{"Document-URL":window.location.href,"Page-URL":window.location.href,"Save-Trigger":t?"user":"auto","Save-ID":o,[se]:String(1)},body:ft(e)};for(let[f,h]of K)u.headers[f]=h;if(c)for(let f of W){let h=null;try{h=f(e)}catch(p){console.error("clayjs: a save header source failed:",p)}if(h)for(let[p,S]of Object.entries(h))u.headers[p]=String(S)}return typeof u.body!="string"&&(u.headers["Content-Type"]=we),a&&(u.headers["Blockeditor-Conversion"]=a),s&&(u.headers["If-Match"]=s),r&&e.length<ve&&new Blob([e]).size<ve&&(u.keepalive=!0),{url:dt(i),options:u}}function ft(e){if(e.length<We)return e;if(I&&I.content===e)return I.blob;let t=new Blob([e],{type:we});return I={content:e,blob:t},t}function xe(){let e=oe();return ie()&&e?e:null}function dt(e){let t=window.location.origin;return!t||t==="null"?e:new URL(e,t).href}function G(e,t){let n=JSON.stringify(t);return{ok:e>=200&&e<300,status:e,statusText:e===200?"OK":"Insufficient Storage",text:()=>Promise.resolve(n)}}function ht(e,t){let n=q();return n?Promise.resolve().then(()=>n(e,t)).then(()=>G(200,{msg:"Saved in this browser",msgType:"success"}),o=>G(507,{msg:"Couldn't save in this browser. Storage is full or turned off.",msgType:"error",code:o?.code||"draft-storage"})):Promise.resolve(G(503,{msg:"Saving in this browser is not ready yet",msgType:"error",code:"draft-not-ready"}))}function pt(e,t,n,{captureId:o=null,conversionHeader:s=null,attempts:r=[],gateToken:a=null}={}){let c=new AbortController,l=setTimeout(()=>c.abort(),Ke),i=Q(),u=ee(),f=i||u,h=R;R=!1;let{url:p,options:S}=ct(e,f,c.signal,t,n,h,s);return qe(t),k||(r.some(d=>d.saveId===t&&d.etag===(n??null))||r.push({saveId:t,etag:n??null}),Xe({captureId:o,saveId:t,html:e,etag:n??null})),(k?ht(e,a):fetch(p,S)).then(d=>d.text().then(g=>{let m={};if(g)try{m=JSON.parse(g)}catch{if(d.ok)throw new Error("Server sent a response that was not JSON")}if(!d.ok){let v=new Error(m.msg||m.error||`HTTP ${d.status}: ${d.statusText}`);throw v.code=d.status===413?"save-too-large":m.code??null,v.status=d.status,v.changedBy=m.changedBy??null,v.etag=m.etag??null,v.saveId=m.saveId??null,v.reason=typeof m.reason=="string"?m.reason:null,v.saveOutcome=m.saveOutcome??null,v.retryAfter=st(d.headers?.get?.("Retry-After")),v}return j(m.etag??null),y=null,m})).catch(d=>{throw console.error("Failed to save page:",d),d.name==="AbortError"&&(y={saveId:t,etag:n}),f&&Z(),d}).finally(()=>{clearTimeout(l)})}async function mt(){let e=y;if(!e)return{landed:null,resend:!1};let n=(await A({fresh:!0})).document,o=typeof n?.etag=="string"&&n.etag?n.etag:null;return o?n.saveId&&n.saveId===e.saveId?(j(o),y=null,{landed:{msg:"Saved",msgType:"success",etag:o},resend:!1}):(n.saveId&&(y=null),{landed:null,resend:!!e.etag,etag:e.etag}):{landed:null,resend:!1}}async function gt(e,{captureId:t=null,conversionHeader:n=null,attempts:o=[],gateToken:s=null}={}){let r=Se(),a=xe(),c=!1,l=!1,i=0,u=t??M();for(;;)try{return await pt(e,r,a,{captureId:t,conversionHeader:n,attempts:o,gateToken:s})}catch(f){if(c&&(f.hadTimeout=!0),f.name==="AbortError"){if(c)throw f;let{landed:h,resend:p,etag:S}=await mt();if(h)return h;if(!p)throw f;a=S,c=!0;continue}if(f.status===412&&!l&&Ze(f.saveId)){j(f.etag??null),y=null,r=Se(),a=xe(),l=!0;continue}if(f.code==="blockeditor-converting"&&i<ot){if(M()!==u||(i+=1,await new Promise(h=>setTimeout(h,Math.max(0,f.retryAfter??1)*1e3)),M()!==u))throw f;continue}throw f}}function Y(e,t,n,o,s=null,r=0,a=null,c=null){return e=ae(e,Math.max(C(),r)),new Promise(l=>{let i=[],u=te(s),f=()=>a!==null&&$===a,h=()=>{f()||(x=!1)},p=(g,m=!1)=>{m&&U(e,t??null,u),ne(s),Ye({captureId:t??null,result:g,attempts:i,sent:i.length>0}),typeof n=="function"&&n(g),l(g)};if(!D&&!window.clay?.testMode)return p(E("Not in edit mode"));if(x&&!f())return p(E("Save already in progress"));let S=ut(o);if(S.invalid)return p(rt());if(x=!0,window.clay?.testMode){setTimeout(()=>{h(),p(ye({msg:"Test mode: save skipped"}))},0);return}L();let d=H(B(e),ce());if(fe(d),d.state==="over")return h(),p(Qe(d));gt(e,{captureId:t,conversionHeader:S.header,attempts:i,gateToken:c}).then(ye,X).then(g=>{h(),g.code==="save-too-large"&&!g.size&&(g.size=d),g.ok&&U(e,t??null,u,g.siteData??null),p(g)})})}function vt(e,t=()=>{}){return Y(e,null,t,null)}function Qt(e,t,n=()=>{},{conversion:o,capture:s=null,blockeditorFormatFloor:r,lane:a=null,gateToken:c=null}={}){return Y(e,t,n,o,s,r,a,c)}function en({html:e,captureId:t,conversion:n}){return Y(e,t??null,void 0,n)}function tn(e,t=()=>{}){return new Promise(n=>{let o=null,s=r=>{tt(o),typeof t=="function"&&t(r),n(r)};if(!D)return s(E("Not in edit mode"));if(nt())return s(E("Another document operation is in progress"));if(x)return s(E("Save already in progress"));if(k)return s(!1);o=et("replace"),fetch(new URL(e,window.location.href).href).then(r=>{if(!r.ok)throw new Error(`Template fetch failed: HTTP ${r.status} ${r.statusText}`);return r.text()}).then(r=>vt(r)).then(s).catch(r=>{console.error("Failed to fetch template:",r),s(X(r))})})}var Ae=null;function nn(e){Ae=e}function rn(){return Ae}export{L as a,St as b,xt as c,Ht as d,Jt as e,zt as f,Gt as g,Kt as h,Wt as i,Xt as j,Yt as k,Vt as l,qt as m,Se as n,Zt as o,et as p,tt as q,nt as r,ct as s,vt as t,Qt as u,en as v,tn as w,nn as x,rn as y};
@@ -1,4 +1,4 @@
1
- import{d as De,h as Je,i as et}from"./c-TRS6TM6O.js";import{a as Ue,b as We}from"./c-Y3J5LDKB.js";import{a as He,b as Ke}from"./c-PZ4XEPUP.js";import"./c-SFKI6OLM.js";import"./c-Q3XOWZEV.js";import"./c-RHMPKZZ7.js";import{d as Ze}from"./c-QHWJ5ZIJ.js";import{a as Se,b as je,c as V,d as Qe,h as pe,i as Le,j as u}from"./c-J2ZW4HMR.js";import{a as te,e as ce,f as de}from"./c-A5LASUEZ.js";import"./c-4JZDZFF6.js";import{b as W,c as ee,e as l,f as qe}from"./c-5RZNFTWD.js";import{b as Ge}from"./c-PKCCHJ5X.js";import"./c-46XYM55L.js";import{a as se,b as T,c as Ve}from"./c-NUHP2XDB.js";import{a as Xe,r as q}from"./c-FC5RUFPR.js";import"./c-4ASQPRQL.js";import"./c-GQ6F6IDK.js";import"./c-I2SCCUEW.js";import"./c-5VYOWDTI.js";import{f as Re}from"./c-P73XPAOA.js";import"./c-ZPI7M5U5.js";import"./c-WYFDLITL.js";import"./c-UGHH4MB3.js";import"./c-MZCOGNZL.js";import"./c-EHAR4RJJ.js";import"./c-LD6UVV5R.js";import"./c-PGSBXHUE.js";import"./c-KU3PX7LL.js";import"./c-EQ5NBOGA.js";import"./c-IJUK2GPW.js";import{f as Ye}from"./c-C7SUMNMI.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-UW6MMZ4V.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-MOP5KBWZ.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var I="light-dark(#D08A1E, #E3A33F)",ht=5e3,gt=4e3,mt=500,wt={"another-tab":"in another tab","another-person":"by someone else","an-agent":"by an agent"},yt='<svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><path d="M2.5 9.5h7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="square"/></svg>',H=(e,t)=>`${e} ${t}${e===1?"":"s"}`,xt="This spot changed again. Review the latest edit or download your copy.",vt="A data value can't be put back from here. Download your copy to keep yours.",w="hidden",Y=!1,L=[],ne=new Set,B=new Set,m=null,Me=0,O=null,b=null,fe=null,h=null,R=!1,K=!1,Ce=!1,Q=new Map,he=0,ue=!1,ie=!1,k=null,X=null,D=null,Be=0,z=!1,ge=0,me=null,re=null,$=[],v=[],ae=!1,we=null,ye=null,c=null,a=null,P=null,G=new Map,M=()=>window.clay?.conflicts||null,ot=()=>$.reduce((e,t)=>e+t.conflicts.length,0)+v.length,_e=()=>{let e=window.clay?.undo;return e&&typeof e.kept=="function"?e:null},xe=()=>M()?.list().filter(e=>!e.claimedBy&&e.kind!=="apply-incomplete")??[],Ie=()=>M()?.list().filter(e=>!e.claimedBy&&e.kind==="apply-incomplete")??[];function Oe(){return O?"upgraded":m?"refused":xe().length?"replaced":Ie().length?"failed":$.length||v.length?"recovered":null}function g(e,t,n){let o=Ve(e,t,n);return t[0]==="all:initial"&&T(o,"color-scheme","inherit"),o.setAttribute("clay",Se),o}function _(e,t){return G.set(t,e),e}function j(e,t){return te(a)&&(de(e,a,t),se(e,ce(a,t,{}))),e}function le(){if(!c)return;let e=window.visualViewport,t=e?Math.max(0,window.innerHeight-e.height-e.offsetTop):0;T(c,"bottom",`calc(${16+t}px + env(safe-area-inset-bottom,0px))`),re&&T(re,"max-height",`${Math.max(160,(e?.height||window.innerHeight)-32)}px`)}function bt(){c=g("div",["all:initial","position:fixed","left:50%","transform:translateX(-50%)","z-index:2147483001","display:none","flex-direction:column","align-items:center","max-width:calc(100vw - 24px)",`font:14px/1.5 ${W}`,`color:${l.ink}`,"text-align:left"]),c.setAttribute("data-clay-conflict",""),document.body.appendChild(c),window.visualViewport?.addEventListener("resize",le),window.visualViewport?.addEventListener("scroll",le)}function d(){if(ue)return;ue=!0;let e=()=>{ue=!1,y()};typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}function y(){a=Ze(),ie&&(ie=!1,m&&!q()&&(m=null));let e=Oe();if(e?w==="hidden"&&(w="bar"):(w="hidden",Y=!1,ne.clear(),B.clear(),L=[],x(),me=null,z=!1),!c){if(w==="hidden"&&!k||!document.body)return;bt()}!c.isConnected&&document.body&&document.body.appendChild(c);let t=document.activeElement,n=null;for(let[s,r]of G)r===t&&(n=s);let o=P?P.scrollTop:0;G=new Map,P=null,re=null,c.replaceChildren(),k?c.append(Tt(k)):w==="bar"?c.append(At(e)):w==="panel"&&c.append(Ct(e)),T(c,"display",k||w!=="hidden"?"flex":"none"),P&&(P.scrollTop=o);let i=D||n;i&&G.has(i)&&G.get(i).focus({preventScroll:!0}),k||(D=null),le(),te(a)?(de(c,a,["conflict.root"]),se(c,ce(a,["conflict.root"],{})),T(c,"color-scheme",a.scheme==="light dark"?"light":a.scheme)):(c.removeAttribute("data-clay-part"),Ge(c))}function it(){return j(g("span",["all:initial","display:inline-block","flex:none","width:8px","height:8px","border-radius:50%",`background:${I}`]),["conflict.dot"])}function rt(){return wt[m?.changedBy]||null}function kt(e,t){if(e==="upgraded")return O;if(e==="refused"){let n=rt();return!n&&m.afterTimeout?"This page changed elsewhere, possibly by your own save that timed out. Your edits here are safe.":`This page changed ${n||"elsewhere"}. Your edits here are safe.`}return e==="failed"?"A sync update did not finish. Your edits here are safe.":e==="recovered"?`${H(t,"change")} replaced before this page loaded ${t===1?"is":"are"} still here.`:`Another edit replaced ${H(t,"change")}.`}function $t(e,t){return e==="upgraded"?O:e==="refused"?`This page changed ${rt()||"elsewhere"}`:e==="failed"?"A sync update did not finish":e==="recovered"?`${H(t,"change")} kept from before this page loaded`:`Another edit replaced ${H(t,"change")}`}function Tt(e){let t=pe("div",["display:block",`background:${l["teal-soft"]}`,"padding:10px 14px","width:max-content","max-width:calc(100vw - 24px)"],{theme:a,parts:["conflict.panel"]});return te(a)&&se(t,[`background:${l["teal-soft"]}`]),t.setAttribute("role","status"),t.textContent=e,t}function At(e){let t=e==="failed"?Ie().length:e==="recovered"?ot():xe().length,n=pe("div",["display:flex","flex-wrap:wrap","align-items:center","gap:10px 12px","padding:8px 8px 8px 14px","width:max-content","max-width:calc(100vw - 24px)"],{theme:a,parts:["conflict.panel"]}),o=kt(e,t);return o!==me&&(n.setAttribute("role",e==="refused"?"alert":"status"),me=o),n.append(it(),u("span",[],o,{theme:a,parts:["conflict.text"]})),e==="upgraded"?(n.append(_(V("Reload",{variant:"primary",onClick:()=>window.location.reload(),theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),"reload")),n):(n.append(_(V("Review",{onClick:Ot,theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),"review")),n)}function A(e,t,{variant:n="default",onClick:o,push:i=!1}={}){let r=window.innerWidth<480?["flex:1 1 100%",...n==="primary"?["order:-1"]:[]]:i?["margin-left:auto"]:[];return _(V(e,{variant:n,onClick:o,extra:r,theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),t)}function E(e){return u("div",["display:block","padding:0 16px 12px",`color:${l["ink-2"]}`,"font-size:13.5px"],e,{theme:a,parts:["conflict.text"]})}function Ct(e){let t=e==="replaced"?xe():e==="failed"?Ie():[],n=e==="refused"?xe():t,o=e==="recovered"?ot():t.length;if(ne.size)for(let p of t)ne.has(p.id)||B.add(p.id);for(let p of[...B])t.some(F=>F.id===p)||B.delete(p);let i=$t(e,o),s=Math.max(160,(window.visualViewport?.height||window.innerHeight)-32),r=pe("div",["display:flex","flex-direction:column","width:520px","max-width:calc(100vw - 24px)",`max-height:${s}px`],{theme:a,parts:["conflict.panel"]});re=r,r.setAttribute("role","dialog"),r.setAttribute("aria-label",i);let f=j(g("div",["all:initial","display:flex","align-items:center","gap:8px","padding:12px 12px 8px 16px",`font:14px/1.5 ${W}`,`color:${l.ink}`]),["conflict.header"]),C=_(u("b",["font-weight:600","font-size:14.5px","outline:none"],i,{theme:a,parts:["conflict.title"]}),"title");C.setAttribute("tabindex","-1"),f.append(it(),C),e==="replaced"&&B.size&&f.append(u("span",[`font:600 10.5px/1 ${ee}`,"letter-spacing:.12em","text-transform:uppercase","padding:3px 6px",`color:color-mix(in srgb, ${l.brass} 80%, ${l.ink})`,`background:${l["brass-soft"]}`],`${B.size} new`));let J=g("span",["all:initial","display:inline-flex","margin-left:auto"]),Fe=_(Qe(yt,{label:"Minimize",onClick:at,theme:a,parts:["close","conflict.close"]}),"minimize");if(Fe.title="Minimize to the bar. Nothing is accepted until you choose.",J.append(Fe),f.append(J),r.append(f),e==="recovered")return Bt(r),r;if(e==="refused"){if(r.append(E("Your edits here are safe and not saved yet; nothing will be overwritten until you choose. Their version is not on this page, so there is no list of edits to compare. Keep yours, which saves over theirs, or accept theirs, which reloads the page and drops your unsaved edits.")),n.length&&r.append(E(`${H(n.length,"earlier replaced edit")} ${n.length===1?"is":"are"} also held in this tab. Download my copy includes them.`)),R&&r.append(E("That did not save either. Your edits here are still here.")),z&&r.append(E("Something changed on the page after your first press, so nothing was dropped. Press Accept theirs again if you still want their version.")),b){let p=j(g("div",["all:initial","display:block","margin:0 16px 12px","padding:8px 10px",`background:color-mix(in srgb, ${I} 14%, transparent)`,`color:${l.ink}`,`font:13px/1.5 ${W}`]),["conflict.warning"]);p.append(g("b",["all:initial","font:inherit","font-weight:700","color:inherit"],"This drops your unsaved edits."),document.createTextNode(" Download your copy first if you might want them. Press again to confirm.")),r.append(p)}}else e==="upgraded"?r.append(E("Its layout and code changed with it, so this page stops here. Reload to see the new version.")):e==="failed"?r.append(E("Part of an update from elsewhere could not be applied, so this page may be missing some of it. Your edits here are safe. Download a copy of the page as you had it, or accept to keep the page as it is.")):r.append(E("The page is showing the other edit. This stays until you choose. You can also save a copy of the page as you had it."));let N=j(g("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","padding:0 16px 14px"]),["conflict.actions"]);if(e==="upgraded")return N.append(A("Reload","reload",{variant:"primary",onClick:()=>window.location.reload(),push:!0})),r.append(N),L=[],r;let ft=A(Ce?"Try again":K?"Downloaded":"Download my copy","download",{onClick:Yt});if(N.append(ft),e==="refused"){let p=A(h==="overwrite"?"Saving\u2026":R?"Try again":"Keep mine","keep",{onClick:Vt});p.setDisabled(h==="overwrite"),N.append(p,A(b?"Yes, drop my edits":"Accept theirs","accept",{variant:"primary",onClick:qt,push:!0}))}else{if(e==="replaced"){let p=M().hasPendingApply(),F=A(p?"Finishing the incoming edit\u2026":h==="revert"?"Putting back\u2026":"Revert to mine","revert",{onClick:Ft});F.setDisabled(p||h==="revert"),N.append(F)}N.append(A("Accept theirs","accept",{variant:"primary",onClick:Nt,push:!0}))}if(r.append(N),e==="replaced")if(Y)r.append(Et(t));else{let p=g("div",["all:initial","display:flex","align-items:center","gap:8px",`border-top:1px solid ${l.line}`,"padding:8px 10px 8px 16px",`color:${l.muted}`,`font:13px/1.5 ${W}`]),F=g("span",["all:initial","display:inline-flex","margin-left:auto"]);F.append(_(V("See the edits",{small:!0,onClick:lt,theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),"list")),p.append(g("span",["all:initial","font:inherit","color:inherit"],H(t.length,"edit")),F),r.append(p)}L=n.map(p=>p.id);for(let p of t)ne.add(p.id);return r}function Et(e){let t=Le(["flex:1 1 auto","margin:0 16px 12px","min-height:0","overflow:auto",`background:${l.sunk}`,`border:1px solid ${l["line-2"]}`],{theme:a,parts:["conflict.well","conflict.list"]}),n=g("div",["all:initial","position:sticky","top:0","z-index:1","display:flex","align-items:center","gap:8px","padding:8px 12px",`background:${l.sunk}`,`border-bottom:1px solid ${l["line-2"]}`,`color:${l.muted}`,`font:600 10.5px/1 ${ee}`,"letter-spacing:.12em","text-transform:uppercase"]),o=g("span",["all:initial","display:inline-flex","margin-left:auto"]);return o.append(_(V("Hide",{small:!0,variant:"quiet",onClick:lt,theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),"list")),n.append(g("span",["all:initial","font:inherit","color:inherit","letter-spacing:inherit","text-transform:inherit"],"Replaced edits"),o),t.append(n),e.forEach((i,s)=>t.append(Pt(i,s))),P=t,t}function Ne(e){let t=e.context?.label||e.name||(e.context?.kind==="entry"?"Entry":"Edit");return e.context?.field?`${t} \xB7 ${e.context.field}`:t}var St={"content-changed":"the page changed there","structure-changed":"the structure changed there","target-detached":"that part of the page is gone","duplicate-id":"another part of the page now has the same id",protected:"that region keeps its own history",unsupported:"this kind of step cannot be put back"},Lt=e=>St[e]||"the page changed there";function Rt(e,t){let n=Array.isArray(e)?e:[];for(let o of n){if(!o||o.kind!=="text"&&o.kind!=="value")continue;let i=t==="redo"?o.after:o.before;if(typeof i=="string"&&i)return{text:i,id:o.target?.id??null}}for(let o of n){if(!o||o.kind!=="add"&&o.kind!=="remove")continue;let i=Array.isArray(o.nodes)?o.nodes.find(s=>typeof s?.html=="string"&&s.html):null;if(i)return{text:He(i.html).replace(/\s+/g," ").trim(),id:o.parent?.id??null}}for(let o of n){if(!o)continue;let i=t==="redo"?o.after:o.before;if(typeof i=="string"&&i)return{text:i,id:o.target?.id??null}}return{text:"",id:null}}function Dt(e){if(e==null||typeof document>"u")return"";let t=window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/["\\]/g,"\\$&"),n=null;try{n=document.querySelector(`[data-id="${t}"]`)}catch{return""}if(!n)return"";let o=n.matches?.("input, textarea, select")?n.value:null;return(typeof o=="string"?o:n.textContent??"").replace(/\s+/g," ").trim()}function zt(e){let t=e?.payload&&typeof e.payload=="object"?e.payload:{},n=String(e?.key??""),o={id:e?.id,revision:e?.revision,record:e,kind:e?.kind??"conflict"};if(n.startsWith("app:"))return{...o,name:typeof t.label=="string"&&t.label?t.label:n.slice(4),sentence:"",yours:typeof t.text=="string"?t.text:"",now:""};let i=t.direction==="redo"?"redo":"undo",f=((Array.isArray(t.context)?t.context:[]).find(J=>typeof J?.label=="string"&&J.label)??null)?.label||typeof t.label=="string"&&t.label||"Edit",C=Rt(t.steps,i);return{...o,name:f,sentence:`The ${i} of "${f}" was not applied because ${Lt(t.code)}.`,yours:C.text,now:C.id==null?"":Dt(C.id)}}function Mt(e){let t=_e();if(!e.record||typeof t?.reviewActionsFor!="function")return[];try{return(t.reviewActionsFor(e.record)||[]).filter(n=>n&&typeof n.run=="function"&&n.label)}catch{return[]}}var tt=e=>({before:"",hit:e,after:"",cutBefore:!1,cutAfter:!1});function nt(e){let t=u("div",["display:block","padding:8px 12px 10px"],void 0,{theme:a,parts:["conflict.row"],role:null}),n=u("div",["display:flex","align-items:center","gap:8px","font-size:12.5px","font-weight:600",`color:${l["ink-2"]}`,"margin-bottom:4px"],void 0,{theme:a,parts:["conflict.location"],role:null});if(n.append(u("span",[],Ne(e))),t.append(n),e.sentence&&t.append(u("div",["display:block","font-size:13px",`color:${l["ink-2"]}`],e.sentence)),e.yours){let i=u("div",["display:grid","grid-template-columns:44px 1fr","gap:3px 10px","align-items:start",`font:12.5px/1.5 ${ee}`,...e.sentence?["margin-top:4px"]:[]]);i.append(...ve("Yours",tt(e.yours),{mine:!0})),e.now&&i.append(...ve("Now",tt(e.now),{mine:!1})),t.append(i)}let o=g("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","margin-top:8px"]);return Mt(e).forEach((i,s)=>{let r=A(i.label,`run:${e.id}:${s}`,{onClick:()=>Wt(e,i,r)});o.append(r)}),o.append(A(we===e.id?"Copied":"Copy",`copy:${e.id}`,{onClick:()=>Kt(e)})),o.append(A("Dismiss",`dismiss:${e.id}`,{onClick:()=>st(e)})),t.append(o),t}function Bt(e){e.append(E($.length?"These copies were replaced before this page loaded. The page never puts them back on its own. Copy or download the ones you want; dismiss one when you no longer need it.":"These copies were kept because an undo could not be put back or the page set them aside. The page never puts them back on its own. Copy or download the ones you want; dismiss one when you no longer need it.")),ae&&e.append(E("That action did not run. The copy is still here."));let t=Le(["flex:1 1 auto","margin:0 16px 12px","min-height:0","overflow:auto",`background:${l.sunk}`,`border:1px solid ${l["line-2"]}`],{theme:a,parts:["conflict.well","conflict.list"]});for(let o of $)for(let i of o.conflicts)t.append(nt(i));for(let o of v)t.append(nt(o));P=t,e.append(t);let n=j(g("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","padding:0 16px 14px"]),["conflict.actions"]);($.some(o=>o.root)||v.length)&&n.append(A(K?"Downloaded":"Download my copy","download",{onClick:Ut})),e.append(n),L=[]}function ve(e,t,{mine:n}){let o=[u("span",[`color:${l.faint}`,`font-family:${W}`],e,{theme:a,parts:["conflict.valueLabel"],role:null})],i=u("span",["display:-webkit-box","-webkit-line-clamp:2","-webkit-box-orient:vertical","overflow:hidden","overflow-wrap:anywhere",...n?[`color:${l.ink}`]:[`color:${l.muted}`]],void 0,{theme:a,parts:[n?"conflict.mine":"conflict.theirs","conflict.value"],role:null}),s=(t.cutBefore?"\u2026":"")+t.before+t.hit+t.after+(t.cutAfter?"\u2026":"");i.title=s,t.before&&i.append(u("span",[`color:${l.faint}`],(t.cutBefore?"\u2026":"")+t.before,{theme:a,parts:["conflict.before"],role:null}));let r=u("span",n?[`background:color-mix(in srgb, ${I} 18%, transparent)`,"padding:0 4px"]:t.before||t.after?["text-decoration:underline",`text-decoration-color:color-mix(in srgb, ${I} 70%, transparent)`,"text-underline-offset:3px"]:[],t.hit||"(empty)",{theme:a,parts:["conflict.value"],role:null});return i.append(r),t.after&&i.append(u("span",[`color:${l.faint}`],t.after+(t.cutAfter?"\u2026":""),{theme:a,parts:["conflict.after"],role:null})),o.push(i),o}function Pt(e,t){let n=Ke(e),o=u("div",["display:block","padding:8px 12px 10px",...t?[`border-top:1px solid ${l.line}`]:[]],void 0,{theme:a,parts:["conflict.row"],role:null}),i=u("div",["display:flex","align-items:center","gap:4px","font-size:12.5px","font-weight:600",`color:${l["ink-2"]}`,"margin-bottom:4px"],void 0,{theme:a,parts:["conflict.location"],role:null});if(i.append(u("span",[],n.name)),n.target&&n.target.isConnected&&i.append(_(_t(n),`eye:${e.id}`)),o.append(i),n.sentence&&o.append(u("div",["display:block","font-size:13px",`color:${l["ink-2"]}`],n.sentence)),Q.has(e.id)&&o.append(u("div",["display:block","font-size:13px","margin-top:4px",`color:${I}`],Q.get(e.id))),n.yours){let s=u("div",["display:grid","grid-template-columns:44px 1fr","gap:3px 10px","align-items:start",`font:12.5px/1.5 ${ee}`,...n.sentence?["margin-top:4px"]:[]]);s.append(...ve("Yours",n.yours,{mine:!0})),n.now&&s.append(...ve("Now",n.now,{mine:!1})),o.append(s)}return o}function _t(e){let t=["all:initial","color-scheme:inherit","box-sizing:border-box","cursor:pointer","display:inline-grid","place-items:center","width:22px","height:20px",`color:${l.ink}`],n=g("button",t);n.type="button",n.innerHTML=qe.conflictEye,je(n.firstElementChild,16),n.setAttribute("aria-label",`Show ${e.name} on page`),n.title="Show on page";let o=["button","conflict.button"];de(n,a,o);let i=s=>{n.style.cssText="";let r=te(a)?[...t,...ce(a,o,{}),...s]:[...t,...s];for(let f of r){let C=f.indexOf(":");n.style.setProperty(f.slice(0,C),f.slice(C+1),"important")}};return n.addEventListener("pointerenter",()=>i([`background:color-mix(in srgb, ${I} 16%, transparent)`])),n.addEventListener("pointerleave",()=>i([])),n.addEventListener("focus",()=>i([`outline:2px solid ${l.brass}`,"outline-offset:1px"])),n.addEventListener("blur",()=>i([])),n.addEventListener("click",()=>It(e.target)),n}var S=null,be=null,ke=null;function $e(){clearTimeout(be),window.removeEventListener("scroll",oe,!0),window.removeEventListener("resize",oe),S?.remove(),S=null,ke=null}function oe(){if(!S||!ke)return;let e=ke.getBoundingClientRect();T(S,"left",`${e.left}px`),T(S,"top",`${e.top}px`),T(S,"width",`${e.width}px`),T(S,"height",`${e.height}px`)}function It(e){if($e(),!e||!e.isConnected)return;let n=!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"instant":"smooth",o=c?.getBoundingClientRect().top??0,i=c&&o>0?Math.max(0,window.innerHeight-o):0;if(!i)e.scrollIntoView?.({block:"center",behavior:n});else{e.scrollIntoView?.({block:"center",behavior:"instant"});let s=e.getBoundingClientRect(),r=window.innerHeight-i,f=s.height>r-24?s.top-12:s.top+s.height/2-r/2;window.scrollBy?.({top:f,behavior:n})}ke=e,S=j(g("div",["all:initial","color-scheme:inherit","position:fixed","pointer-events:none","z-index:2147483001",`outline:2px solid ${I}`,"outline-offset:3px",`background:color-mix(in srgb, ${I} 14%, transparent)`]),["conflict.previewRing"]),document.body.appendChild(S),oe(),window.addEventListener("scroll",oe,!0),window.addEventListener("resize",oe),be=setTimeout($e,2500)}function Ot(){O||(w="panel",D="title",y())}function at(){$e(),w="bar",x(),D="review",y()}function lt(){Y=!Y,Y&&B.clear(),y()}function Nt(){let e=M(),t=L.filter(n=>{let o=e?.get(n);return o&&!o.claimedBy});e&&t.length&&e.acknowledge(t,{reason:"accepted"}),w=Oe()?"bar":"hidden",D="review",d()}async function Ft(){let e=M();if(h||!e||e.hasPendingApply())return;let t=L.filter(r=>{let f=e.get(r);return f&&!f.claimedBy});if(!t.length)return;h="revert",y();let n=!0,o=r=>{n=!!c?.contains(r.target)};document.addEventListener("focus",o,!0);let i;try{let{revertConflicts:r}=await import("./c-3S5TNRZA.js");i=await r(t)}catch(r){console.error("[clay] Revert to mine did not finish",r),i={revertedIds:[],blockedIds:t,saveResult:null}}finally{document.removeEventListener("focus",o,!0)}h=null;for(let r of i.blockedIds)Q.set(r,M()?.get(r)?.kind==="json"?vt:xt);w=Oe()?"bar":"hidden",D=n?"review":null;let s=i.saveResult&&(i.saveResult.ok||i.saveResult.msg==="Save already in progress");i.revertedIds.length&&s?Ee(`Put back ${H(i.revertedIds.length,"change")}. Saving.`):y()}var Z=null;async function Yt(){let e=M(),t=m?e?.list()??[]:L.map(o=>e?.get(o)).filter(Boolean),n=await We(t,{refused:!!m});Ce=!n,K=n,clearTimeout(Z),n&&(Z=setTimeout(()=>{K=!1,d()},1200)),y()}async function U(){let e=null;if(De())try{e=await Je()}catch{e=null}let t=_e(),n=null;if(t)try{n=await t.kept()}catch{n=null}let o=!1;if(e?.ok?($=e.records,o=!0):!De()&&$.length&&($=[],o=!0),n?.ok){let i=(Array.isArray(n.records)?n.records:[]).filter(r=>r&&r.supported!==!1).map(zt);i.length===v.length&&i.every((r,f)=>r.id===v[f].id&&r.revision===v[f].revision)||(o=!0),v=i}else n&&v.length&&(v=[],o=!0);o&&d()}async function Ht(e){try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement("textarea");t.value=e,t.setAttribute("clay",Se),t.style.setProperty("position","fixed","important"),t.style.setProperty("opacity","0","important"),document.body?.append(t),t.select();let n=!1;try{n=document.execCommand?.("copy")===!0}catch{}return t.remove(),n}async function Kt(e){let t=e.record?e.yours:`${Ne(e)}
1
+ import{d as De,h as Je,i as et}from"./c-TRS6TM6O.js";import{a as Ue,b as We}from"./c-Y3J5LDKB.js";import{a as He,b as Ke}from"./c-PZ4XEPUP.js";import"./c-SFKI6OLM.js";import"./c-Q3XOWZEV.js";import"./c-RHMPKZZ7.js";import{d as Ze}from"./c-QHWJ5ZIJ.js";import{a as Se,b as je,c as V,d as Qe,h as pe,i as Le,j as u}from"./c-J2ZW4HMR.js";import{a as te,e as ce,f as de}from"./c-A5LASUEZ.js";import"./c-4JZDZFF6.js";import{b as W,c as ee,e as l,f as qe}from"./c-5RZNFTWD.js";import{b as Ge}from"./c-PKCCHJ5X.js";import"./c-46XYM55L.js";import{a as se,b as T,c as Ve}from"./c-NUHP2XDB.js";import{a as Xe,r as q}from"./c-IOJOJTPL.js";import"./c-4ASQPRQL.js";import"./c-GQ6F6IDK.js";import"./c-I2SCCUEW.js";import"./c-5VYOWDTI.js";import{f as Re}from"./c-T6RRRHX7.js";import"./c-G426P2SE.js";import"./c-WYFDLITL.js";import"./c-UGHH4MB3.js";import"./c-MZCOGNZL.js";import"./c-CKG4NF7J.js";import"./c-LD6UVV5R.js";import"./c-PGSBXHUE.js";import"./c-OSGTRM4C.js";import"./c-26W3BMWK.js";import"./c-IJUK2GPW.js";import{f as Ye}from"./c-JEWSJHMK.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-UW6MMZ4V.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-MOP5KBWZ.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var I="light-dark(#D08A1E, #E3A33F)",ht=5e3,gt=4e3,mt=500,wt={"another-tab":"in another tab","another-person":"by someone else","an-agent":"by an agent"},yt='<svg viewBox="0 0 12 12" width="12" height="12" aria-hidden="true"><path d="M2.5 9.5h7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="square"/></svg>',H=(e,t)=>`${e} ${t}${e===1?"":"s"}`,xt="This spot changed again. Review the latest edit or download your copy.",vt="A data value can't be put back from here. Download your copy to keep yours.",w="hidden",Y=!1,L=[],ne=new Set,B=new Set,m=null,Me=0,O=null,b=null,fe=null,h=null,R=!1,K=!1,Ce=!1,Q=new Map,he=0,ue=!1,ie=!1,k=null,X=null,D=null,Be=0,z=!1,ge=0,me=null,re=null,$=[],v=[],ae=!1,we=null,ye=null,c=null,a=null,P=null,G=new Map,M=()=>window.clay?.conflicts||null,ot=()=>$.reduce((e,t)=>e+t.conflicts.length,0)+v.length,_e=()=>{let e=window.clay?.undo;return e&&typeof e.kept=="function"?e:null},xe=()=>M()?.list().filter(e=>!e.claimedBy&&e.kind!=="apply-incomplete")??[],Ie=()=>M()?.list().filter(e=>!e.claimedBy&&e.kind==="apply-incomplete")??[];function Oe(){return O?"upgraded":m?"refused":xe().length?"replaced":Ie().length?"failed":$.length||v.length?"recovered":null}function g(e,t,n){let o=Ve(e,t,n);return t[0]==="all:initial"&&T(o,"color-scheme","inherit"),o.setAttribute("clay",Se),o}function _(e,t){return G.set(t,e),e}function j(e,t){return te(a)&&(de(e,a,t),se(e,ce(a,t,{}))),e}function le(){if(!c)return;let e=window.visualViewport,t=e?Math.max(0,window.innerHeight-e.height-e.offsetTop):0;T(c,"bottom",`calc(${16+t}px + env(safe-area-inset-bottom,0px))`),re&&T(re,"max-height",`${Math.max(160,(e?.height||window.innerHeight)-32)}px`)}function bt(){c=g("div",["all:initial","position:fixed","left:50%","transform:translateX(-50%)","z-index:2147483001","display:none","flex-direction:column","align-items:center","max-width:calc(100vw - 24px)",`font:14px/1.5 ${W}`,`color:${l.ink}`,"text-align:left"]),c.setAttribute("data-clay-conflict",""),document.body.appendChild(c),window.visualViewport?.addEventListener("resize",le),window.visualViewport?.addEventListener("scroll",le)}function d(){if(ue)return;ue=!0;let e=()=>{ue=!1,y()};typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}function y(){a=Ze(),ie&&(ie=!1,m&&!q()&&(m=null));let e=Oe();if(e?w==="hidden"&&(w="bar"):(w="hidden",Y=!1,ne.clear(),B.clear(),L=[],x(),me=null,z=!1),!c){if(w==="hidden"&&!k||!document.body)return;bt()}!c.isConnected&&document.body&&document.body.appendChild(c);let t=document.activeElement,n=null;for(let[s,r]of G)r===t&&(n=s);let o=P?P.scrollTop:0;G=new Map,P=null,re=null,c.replaceChildren(),k?c.append(Tt(k)):w==="bar"?c.append(At(e)):w==="panel"&&c.append(Ct(e)),T(c,"display",k||w!=="hidden"?"flex":"none"),P&&(P.scrollTop=o);let i=D||n;i&&G.has(i)&&G.get(i).focus({preventScroll:!0}),k||(D=null),le(),te(a)?(de(c,a,["conflict.root"]),se(c,ce(a,["conflict.root"],{})),T(c,"color-scheme",a.scheme==="light dark"?"light":a.scheme)):(c.removeAttribute("data-clay-part"),Ge(c))}function it(){return j(g("span",["all:initial","display:inline-block","flex:none","width:8px","height:8px","border-radius:50%",`background:${I}`]),["conflict.dot"])}function rt(){return wt[m?.changedBy]||null}function kt(e,t){if(e==="upgraded")return O;if(e==="refused"){let n=rt();return!n&&m.afterTimeout?"This page changed elsewhere, possibly by your own save that timed out. Your edits here are safe.":`This page changed ${n||"elsewhere"}. Your edits here are safe.`}return e==="failed"?"A sync update did not finish. Your edits here are safe.":e==="recovered"?`${H(t,"change")} replaced before this page loaded ${t===1?"is":"are"} still here.`:`Another edit replaced ${H(t,"change")}.`}function $t(e,t){return e==="upgraded"?O:e==="refused"?`This page changed ${rt()||"elsewhere"}`:e==="failed"?"A sync update did not finish":e==="recovered"?`${H(t,"change")} kept from before this page loaded`:`Another edit replaced ${H(t,"change")}`}function Tt(e){let t=pe("div",["display:block",`background:${l["teal-soft"]}`,"padding:10px 14px","width:max-content","max-width:calc(100vw - 24px)"],{theme:a,parts:["conflict.panel"]});return te(a)&&se(t,[`background:${l["teal-soft"]}`]),t.setAttribute("role","status"),t.textContent=e,t}function At(e){let t=e==="failed"?Ie().length:e==="recovered"?ot():xe().length,n=pe("div",["display:flex","flex-wrap:wrap","align-items:center","gap:10px 12px","padding:8px 8px 8px 14px","width:max-content","max-width:calc(100vw - 24px)"],{theme:a,parts:["conflict.panel"]}),o=kt(e,t);return o!==me&&(n.setAttribute("role",e==="refused"?"alert":"status"),me=o),n.append(it(),u("span",[],o,{theme:a,parts:["conflict.text"]})),e==="upgraded"?(n.append(_(V("Reload",{variant:"primary",onClick:()=>window.location.reload(),theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),"reload")),n):(n.append(_(V("Review",{onClick:Ot,theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),"review")),n)}function A(e,t,{variant:n="default",onClick:o,push:i=!1}={}){let r=window.innerWidth<480?["flex:1 1 100%",...n==="primary"?["order:-1"]:[]]:i?["margin-left:auto"]:[];return _(V(e,{variant:n,onClick:o,extra:r,theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),t)}function E(e){return u("div",["display:block","padding:0 16px 12px",`color:${l["ink-2"]}`,"font-size:13.5px"],e,{theme:a,parts:["conflict.text"]})}function Ct(e){let t=e==="replaced"?xe():e==="failed"?Ie():[],n=e==="refused"?xe():t,o=e==="recovered"?ot():t.length;if(ne.size)for(let p of t)ne.has(p.id)||B.add(p.id);for(let p of[...B])t.some(F=>F.id===p)||B.delete(p);let i=$t(e,o),s=Math.max(160,(window.visualViewport?.height||window.innerHeight)-32),r=pe("div",["display:flex","flex-direction:column","width:520px","max-width:calc(100vw - 24px)",`max-height:${s}px`],{theme:a,parts:["conflict.panel"]});re=r,r.setAttribute("role","dialog"),r.setAttribute("aria-label",i);let f=j(g("div",["all:initial","display:flex","align-items:center","gap:8px","padding:12px 12px 8px 16px",`font:14px/1.5 ${W}`,`color:${l.ink}`]),["conflict.header"]),C=_(u("b",["font-weight:600","font-size:14.5px","outline:none"],i,{theme:a,parts:["conflict.title"]}),"title");C.setAttribute("tabindex","-1"),f.append(it(),C),e==="replaced"&&B.size&&f.append(u("span",[`font:600 10.5px/1 ${ee}`,"letter-spacing:.12em","text-transform:uppercase","padding:3px 6px",`color:color-mix(in srgb, ${l.brass} 80%, ${l.ink})`,`background:${l["brass-soft"]}`],`${B.size} new`));let J=g("span",["all:initial","display:inline-flex","margin-left:auto"]),Fe=_(Qe(yt,{label:"Minimize",onClick:at,theme:a,parts:["close","conflict.close"]}),"minimize");if(Fe.title="Minimize to the bar. Nothing is accepted until you choose.",J.append(Fe),f.append(J),r.append(f),e==="recovered")return Bt(r),r;if(e==="refused"){if(r.append(E("Your edits here are safe and not saved yet; nothing will be overwritten until you choose. Their version is not on this page, so there is no list of edits to compare. Keep yours, which saves over theirs, or accept theirs, which reloads the page and drops your unsaved edits.")),n.length&&r.append(E(`${H(n.length,"earlier replaced edit")} ${n.length===1?"is":"are"} also held in this tab. Download my copy includes them.`)),R&&r.append(E("That did not save either. Your edits here are still here.")),z&&r.append(E("Something changed on the page after your first press, so nothing was dropped. Press Accept theirs again if you still want their version.")),b){let p=j(g("div",["all:initial","display:block","margin:0 16px 12px","padding:8px 10px",`background:color-mix(in srgb, ${I} 14%, transparent)`,`color:${l.ink}`,`font:13px/1.5 ${W}`]),["conflict.warning"]);p.append(g("b",["all:initial","font:inherit","font-weight:700","color:inherit"],"This drops your unsaved edits."),document.createTextNode(" Download your copy first if you might want them. Press again to confirm.")),r.append(p)}}else e==="upgraded"?r.append(E("Its layout and code changed with it, so this page stops here. Reload to see the new version.")):e==="failed"?r.append(E("Part of an update from elsewhere could not be applied, so this page may be missing some of it. Your edits here are safe. Download a copy of the page as you had it, or accept to keep the page as it is.")):r.append(E("The page is showing the other edit. This stays until you choose. You can also save a copy of the page as you had it."));let N=j(g("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","padding:0 16px 14px"]),["conflict.actions"]);if(e==="upgraded")return N.append(A("Reload","reload",{variant:"primary",onClick:()=>window.location.reload(),push:!0})),r.append(N),L=[],r;let ft=A(Ce?"Try again":K?"Downloaded":"Download my copy","download",{onClick:Yt});if(N.append(ft),e==="refused"){let p=A(h==="overwrite"?"Saving\u2026":R?"Try again":"Keep mine","keep",{onClick:Vt});p.setDisabled(h==="overwrite"),N.append(p,A(b?"Yes, drop my edits":"Accept theirs","accept",{variant:"primary",onClick:qt,push:!0}))}else{if(e==="replaced"){let p=M().hasPendingApply(),F=A(p?"Finishing the incoming edit\u2026":h==="revert"?"Putting back\u2026":"Revert to mine","revert",{onClick:Ft});F.setDisabled(p||h==="revert"),N.append(F)}N.append(A("Accept theirs","accept",{variant:"primary",onClick:Nt,push:!0}))}if(r.append(N),e==="replaced")if(Y)r.append(Et(t));else{let p=g("div",["all:initial","display:flex","align-items:center","gap:8px",`border-top:1px solid ${l.line}`,"padding:8px 10px 8px 16px",`color:${l.muted}`,`font:13px/1.5 ${W}`]),F=g("span",["all:initial","display:inline-flex","margin-left:auto"]);F.append(_(V("See the edits",{small:!0,onClick:lt,theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),"list")),p.append(g("span",["all:initial","font:inherit","color:inherit"],H(t.length,"edit")),F),r.append(p)}L=n.map(p=>p.id);for(let p of t)ne.add(p.id);return r}function Et(e){let t=Le(["flex:1 1 auto","margin:0 16px 12px","min-height:0","overflow:auto",`background:${l.sunk}`,`border:1px solid ${l["line-2"]}`],{theme:a,parts:["conflict.well","conflict.list"]}),n=g("div",["all:initial","position:sticky","top:0","z-index:1","display:flex","align-items:center","gap:8px","padding:8px 12px",`background:${l.sunk}`,`border-bottom:1px solid ${l["line-2"]}`,`color:${l.muted}`,`font:600 10.5px/1 ${ee}`,"letter-spacing:.12em","text-transform:uppercase"]),o=g("span",["all:initial","display:inline-flex","margin-left:auto"]);return o.append(_(V("Hide",{small:!0,variant:"quiet",onClick:lt,theme:a,parts:["conflict.button"],labelParts:["conflict.buttonLabel"]}),"list")),n.append(g("span",["all:initial","font:inherit","color:inherit","letter-spacing:inherit","text-transform:inherit"],"Replaced edits"),o),t.append(n),e.forEach((i,s)=>t.append(Pt(i,s))),P=t,t}function Ne(e){let t=e.context?.label||e.name||(e.context?.kind==="entry"?"Entry":"Edit");return e.context?.field?`${t} \xB7 ${e.context.field}`:t}var St={"content-changed":"the page changed there","structure-changed":"the structure changed there","target-detached":"that part of the page is gone","duplicate-id":"another part of the page now has the same id",protected:"that region keeps its own history",unsupported:"this kind of step cannot be put back"},Lt=e=>St[e]||"the page changed there";function Rt(e,t){let n=Array.isArray(e)?e:[];for(let o of n){if(!o||o.kind!=="text"&&o.kind!=="value")continue;let i=t==="redo"?o.after:o.before;if(typeof i=="string"&&i)return{text:i,id:o.target?.id??null}}for(let o of n){if(!o||o.kind!=="add"&&o.kind!=="remove")continue;let i=Array.isArray(o.nodes)?o.nodes.find(s=>typeof s?.html=="string"&&s.html):null;if(i)return{text:He(i.html).replace(/\s+/g," ").trim(),id:o.parent?.id??null}}for(let o of n){if(!o)continue;let i=t==="redo"?o.after:o.before;if(typeof i=="string"&&i)return{text:i,id:o.target?.id??null}}return{text:"",id:null}}function Dt(e){if(e==null||typeof document>"u")return"";let t=window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/["\\]/g,"\\$&"),n=null;try{n=document.querySelector(`[data-id="${t}"]`)}catch{return""}if(!n)return"";let o=n.matches?.("input, textarea, select")?n.value:null;return(typeof o=="string"?o:n.textContent??"").replace(/\s+/g," ").trim()}function zt(e){let t=e?.payload&&typeof e.payload=="object"?e.payload:{},n=String(e?.key??""),o={id:e?.id,revision:e?.revision,record:e,kind:e?.kind??"conflict"};if(n.startsWith("app:"))return{...o,name:typeof t.label=="string"&&t.label?t.label:n.slice(4),sentence:"",yours:typeof t.text=="string"?t.text:"",now:""};let i=t.direction==="redo"?"redo":"undo",f=((Array.isArray(t.context)?t.context:[]).find(J=>typeof J?.label=="string"&&J.label)??null)?.label||typeof t.label=="string"&&t.label||"Edit",C=Rt(t.steps,i);return{...o,name:f,sentence:`The ${i} of "${f}" was not applied because ${Lt(t.code)}.`,yours:C.text,now:C.id==null?"":Dt(C.id)}}function Mt(e){let t=_e();if(!e.record||typeof t?.reviewActionsFor!="function")return[];try{return(t.reviewActionsFor(e.record)||[]).filter(n=>n&&typeof n.run=="function"&&n.label)}catch{return[]}}var tt=e=>({before:"",hit:e,after:"",cutBefore:!1,cutAfter:!1});function nt(e){let t=u("div",["display:block","padding:8px 12px 10px"],void 0,{theme:a,parts:["conflict.row"],role:null}),n=u("div",["display:flex","align-items:center","gap:8px","font-size:12.5px","font-weight:600",`color:${l["ink-2"]}`,"margin-bottom:4px"],void 0,{theme:a,parts:["conflict.location"],role:null});if(n.append(u("span",[],Ne(e))),t.append(n),e.sentence&&t.append(u("div",["display:block","font-size:13px",`color:${l["ink-2"]}`],e.sentence)),e.yours){let i=u("div",["display:grid","grid-template-columns:44px 1fr","gap:3px 10px","align-items:start",`font:12.5px/1.5 ${ee}`,...e.sentence?["margin-top:4px"]:[]]);i.append(...ve("Yours",tt(e.yours),{mine:!0})),e.now&&i.append(...ve("Now",tt(e.now),{mine:!1})),t.append(i)}let o=g("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","margin-top:8px"]);return Mt(e).forEach((i,s)=>{let r=A(i.label,`run:${e.id}:${s}`,{onClick:()=>Wt(e,i,r)});o.append(r)}),o.append(A(we===e.id?"Copied":"Copy",`copy:${e.id}`,{onClick:()=>Kt(e)})),o.append(A("Dismiss",`dismiss:${e.id}`,{onClick:()=>st(e)})),t.append(o),t}function Bt(e){e.append(E($.length?"These copies were replaced before this page loaded. The page never puts them back on its own. Copy or download the ones you want; dismiss one when you no longer need it.":"These copies were kept because an undo could not be put back or the page set them aside. The page never puts them back on its own. Copy or download the ones you want; dismiss one when you no longer need it.")),ae&&e.append(E("That action did not run. The copy is still here."));let t=Le(["flex:1 1 auto","margin:0 16px 12px","min-height:0","overflow:auto",`background:${l.sunk}`,`border:1px solid ${l["line-2"]}`],{theme:a,parts:["conflict.well","conflict.list"]});for(let o of $)for(let i of o.conflicts)t.append(nt(i));for(let o of v)t.append(nt(o));P=t,e.append(t);let n=j(g("div",["all:initial","display:flex","flex-wrap:wrap","gap:8px","padding:0 16px 14px"]),["conflict.actions"]);($.some(o=>o.root)||v.length)&&n.append(A(K?"Downloaded":"Download my copy","download",{onClick:Ut})),e.append(n),L=[]}function ve(e,t,{mine:n}){let o=[u("span",[`color:${l.faint}`,`font-family:${W}`],e,{theme:a,parts:["conflict.valueLabel"],role:null})],i=u("span",["display:-webkit-box","-webkit-line-clamp:2","-webkit-box-orient:vertical","overflow:hidden","overflow-wrap:anywhere",...n?[`color:${l.ink}`]:[`color:${l.muted}`]],void 0,{theme:a,parts:[n?"conflict.mine":"conflict.theirs","conflict.value"],role:null}),s=(t.cutBefore?"\u2026":"")+t.before+t.hit+t.after+(t.cutAfter?"\u2026":"");i.title=s,t.before&&i.append(u("span",[`color:${l.faint}`],(t.cutBefore?"\u2026":"")+t.before,{theme:a,parts:["conflict.before"],role:null}));let r=u("span",n?[`background:color-mix(in srgb, ${I} 18%, transparent)`,"padding:0 4px"]:t.before||t.after?["text-decoration:underline",`text-decoration-color:color-mix(in srgb, ${I} 70%, transparent)`,"text-underline-offset:3px"]:[],t.hit||"(empty)",{theme:a,parts:["conflict.value"],role:null});return i.append(r),t.after&&i.append(u("span",[`color:${l.faint}`],t.after+(t.cutAfter?"\u2026":""),{theme:a,parts:["conflict.after"],role:null})),o.push(i),o}function Pt(e,t){let n=Ke(e),o=u("div",["display:block","padding:8px 12px 10px",...t?[`border-top:1px solid ${l.line}`]:[]],void 0,{theme:a,parts:["conflict.row"],role:null}),i=u("div",["display:flex","align-items:center","gap:4px","font-size:12.5px","font-weight:600",`color:${l["ink-2"]}`,"margin-bottom:4px"],void 0,{theme:a,parts:["conflict.location"],role:null});if(i.append(u("span",[],n.name)),n.target&&n.target.isConnected&&i.append(_(_t(n),`eye:${e.id}`)),o.append(i),n.sentence&&o.append(u("div",["display:block","font-size:13px",`color:${l["ink-2"]}`],n.sentence)),Q.has(e.id)&&o.append(u("div",["display:block","font-size:13px","margin-top:4px",`color:${I}`],Q.get(e.id))),n.yours){let s=u("div",["display:grid","grid-template-columns:44px 1fr","gap:3px 10px","align-items:start",`font:12.5px/1.5 ${ee}`,...n.sentence?["margin-top:4px"]:[]]);s.append(...ve("Yours",n.yours,{mine:!0})),n.now&&s.append(...ve("Now",n.now,{mine:!1})),o.append(s)}return o}function _t(e){let t=["all:initial","color-scheme:inherit","box-sizing:border-box","cursor:pointer","display:inline-grid","place-items:center","width:22px","height:20px",`color:${l.ink}`],n=g("button",t);n.type="button",n.innerHTML=qe.conflictEye,je(n.firstElementChild,16),n.setAttribute("aria-label",`Show ${e.name} on page`),n.title="Show on page";let o=["button","conflict.button"];de(n,a,o);let i=s=>{n.style.cssText="";let r=te(a)?[...t,...ce(a,o,{}),...s]:[...t,...s];for(let f of r){let C=f.indexOf(":");n.style.setProperty(f.slice(0,C),f.slice(C+1),"important")}};return n.addEventListener("pointerenter",()=>i([`background:color-mix(in srgb, ${I} 16%, transparent)`])),n.addEventListener("pointerleave",()=>i([])),n.addEventListener("focus",()=>i([`outline:2px solid ${l.brass}`,"outline-offset:1px"])),n.addEventListener("blur",()=>i([])),n.addEventListener("click",()=>It(e.target)),n}var S=null,be=null,ke=null;function $e(){clearTimeout(be),window.removeEventListener("scroll",oe,!0),window.removeEventListener("resize",oe),S?.remove(),S=null,ke=null}function oe(){if(!S||!ke)return;let e=ke.getBoundingClientRect();T(S,"left",`${e.left}px`),T(S,"top",`${e.top}px`),T(S,"width",`${e.width}px`),T(S,"height",`${e.height}px`)}function It(e){if($e(),!e||!e.isConnected)return;let n=!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"instant":"smooth",o=c?.getBoundingClientRect().top??0,i=c&&o>0?Math.max(0,window.innerHeight-o):0;if(!i)e.scrollIntoView?.({block:"center",behavior:n});else{e.scrollIntoView?.({block:"center",behavior:"instant"});let s=e.getBoundingClientRect(),r=window.innerHeight-i,f=s.height>r-24?s.top-12:s.top+s.height/2-r/2;window.scrollBy?.({top:f,behavior:n})}ke=e,S=j(g("div",["all:initial","color-scheme:inherit","position:fixed","pointer-events:none","z-index:2147483001",`outline:2px solid ${I}`,"outline-offset:3px",`background:color-mix(in srgb, ${I} 14%, transparent)`]),["conflict.previewRing"]),document.body.appendChild(S),oe(),window.addEventListener("scroll",oe,!0),window.addEventListener("resize",oe),be=setTimeout($e,2500)}function Ot(){O||(w="panel",D="title",y())}function at(){$e(),w="bar",x(),D="review",y()}function lt(){Y=!Y,Y&&B.clear(),y()}function Nt(){let e=M(),t=L.filter(n=>{let o=e?.get(n);return o&&!o.claimedBy});e&&t.length&&e.acknowledge(t,{reason:"accepted"}),w=Oe()?"bar":"hidden",D="review",d()}async function Ft(){let e=M();if(h||!e||e.hasPendingApply())return;let t=L.filter(r=>{let f=e.get(r);return f&&!f.claimedBy});if(!t.length)return;h="revert",y();let n=!0,o=r=>{n=!!c?.contains(r.target)};document.addEventListener("focus",o,!0);let i;try{let{revertConflicts:r}=await import("./c-USO6XV23.js");i=await r(t)}catch(r){console.error("[clay] Revert to mine did not finish",r),i={revertedIds:[],blockedIds:t,saveResult:null}}finally{document.removeEventListener("focus",o,!0)}h=null;for(let r of i.blockedIds)Q.set(r,M()?.get(r)?.kind==="json"?vt:xt);w=Oe()?"bar":"hidden",D=n?"review":null;let s=i.saveResult&&(i.saveResult.ok||i.saveResult.msg==="Save already in progress");i.revertedIds.length&&s?Ee(`Put back ${H(i.revertedIds.length,"change")}. Saving.`):y()}var Z=null;async function Yt(){let e=M(),t=m?e?.list()??[]:L.map(o=>e?.get(o)).filter(Boolean),n=await We(t,{refused:!!m});Ce=!n,K=n,clearTimeout(Z),n&&(Z=setTimeout(()=>{K=!1,d()},1200)),y()}async function U(){let e=null;if(De())try{e=await Je()}catch{e=null}let t=_e(),n=null;if(t)try{n=await t.kept()}catch{n=null}let o=!1;if(e?.ok?($=e.records,o=!0):!De()&&$.length&&($=[],o=!0),n?.ok){let i=(Array.isArray(n.records)?n.records:[]).filter(r=>r&&r.supported!==!1).map(zt);i.length===v.length&&i.every((r,f)=>r.id===v[f].id&&r.revision===v[f].revision)||(o=!0),v=i}else n&&v.length&&(v=[],o=!0);o&&d()}async function Ht(e){try{return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement("textarea");t.value=e,t.setAttribute("clay",Se),t.style.setProperty("position","fixed","important"),t.style.setProperty("opacity","0","important"),document.body?.append(t),t.select();let n=!1;try{n=document.execCommand?.("copy")===!0}catch{}return t.remove(),n}async function Kt(e){let t=e.record?e.yours:`${Ne(e)}
2
2
 
3
3
  Yours:
4
4
  ${e.yours}
@@ -1,4 +1,4 @@
1
- import{a as u,b as m,c as b,d as k}from"./c-Y6F2FORL.js";import{b as y}from"./c-QY7F6EN6.js";import{d as v}from"./c-PKCCHJ5X.js";import{b as g}from"./c-C7SUMNMI.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var A=.8,c={draft:"You're seeing a private draft, like a visitor.",draftAction:"Edit the original",edit:"You're editing the original. Visitors get these changes.",editAction:"Back to my draft",close:"Hide this note"},L=`.clay-owner {
1
+ import{a as u,b as m,c as b,d as k}from"./c-Y6F2FORL.js";import{b as y}from"./c-QY7F6EN6.js";import{d as v}from"./c-PKCCHJ5X.js";import{b as g}from"./c-JEWSJHMK.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-U4TWEIKZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var A=.8,c={draft:"You're seeing a private draft, like a visitor.",draftAction:"Edit the original",edit:"You're editing the original. Visitors get these changes.",editAction:"Back to my draft",close:"Hide this note"},L=`.clay-owner {
2
2
  --hcp-surface: light-dark(#FFFCF6, #11131E);
3
3
  --hcp-ground: var(--bevel-surface, var(--hcp-surface));
4
4
  --hcp-ink: light-dark(#2B241B, #ECEAF2);