@panphora/clayjs 1.22.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) 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 +1228 -715
  11. package/dist/m/attrs/{save-freeze-MTFVVYV5.js → save-freeze-JZHKRQLR.js} +1 -1
  12. package/dist/m/{c-TV7JHSRL.js → c-24PMUJIV.js} +1 -1
  13. package/dist/m/{c-NBNRLZXO.js → c-2AYVYEI4.js} +1 -1
  14. package/dist/m/{c-VIW5X35H.js → c-2L6O5PDS.js} +1 -1
  15. package/dist/m/{c-FNIGX4FI.js → c-2RYOGUQM.js} +1 -1
  16. package/dist/m/{c-LDUNOR57.js → c-2Z22FCFK.js} +13 -25
  17. package/dist/m/{c-DKFSOJCV.js → c-2ZVOEU4M.js} +1 -1
  18. package/dist/m/{c-BJPZCWAV.js → c-37NAONZA.js} +1 -1
  19. package/dist/m/{c-CSNE5EIF.js → c-4PO3YGDC.js} +1 -1
  20. package/dist/m/{c-UWT4CXQ4.js → c-5OJ7YF2N.js} +1 -1
  21. package/dist/m/{c-CAWNFER6.js → c-5TIZ2I64.js} +1 -1
  22. package/dist/m/{c-ZO6VL2SC.js → c-5WMXEKFH.js} +1 -1
  23. package/dist/m/{c-4TWARTLS.js → c-6RDOKLN7.js} +1 -1
  24. package/dist/m/{c-6RC66MYY.js → c-6TYGD5AB.js} +1 -1
  25. package/dist/m/c-A4IP6MBC.js +1 -0
  26. package/dist/m/{c-ZAHTFCXQ.js → c-ALDVFPWL.js} +1 -1
  27. package/dist/m/{c-LV5MABYD.js → c-AYVGD6A6.js} +1 -1
  28. package/dist/m/{c-N33TPVTL.js → c-B6O7AJYG.js} +1 -1
  29. package/dist/m/{c-P3WATEDR.js → c-BCGWJYXW.js} +1 -1
  30. package/dist/m/{c-4OGEVKR3.js → c-BGKAT2FL.js} +1 -1
  31. package/dist/m/{c-N7Y52HJH.js → c-BXYSDKAN.js} +1 -1
  32. package/dist/m/c-CRPIDGXC.js +78 -0
  33. package/dist/m/c-CUMXGHVD.js +1 -0
  34. package/dist/m/{c-Q5KAQJAG.js → c-DTMZ3ZHI.js} +1 -1
  35. package/dist/m/{c-GY4ODHO2.js → c-ELYIIYRS.js} +1 -1
  36. package/dist/m/{c-67LGZ52V.js → c-FCSZ3DC5.js} +1 -1
  37. package/dist/m/{c-NLWEZYKJ.js → c-FQGHR32O.js} +1 -1
  38. package/dist/m/{c-PCEMXY2K.js → c-G4PWUDD5.js} +1 -1
  39. package/dist/m/{c-6KBKYLPO.js → c-G6COVIZB.js} +1 -1
  40. package/dist/m/c-GBTVCJXC.js +1 -0
  41. package/dist/m/c-GC2HICFJ.js +1 -0
  42. package/dist/m/{c-TMT5TL65.js → c-HCNWJE4A.js} +2 -2
  43. package/dist/m/{c-DZBZ57EE.js → c-JCOQVZYS.js} +1 -1
  44. package/dist/m/{c-FAXQU7MQ.js → c-JGHEACGK.js} +1 -1
  45. package/dist/m/{c-PWBJVHA4.js → c-JGLX6TBK.js} +1 -1
  46. package/dist/m/c-JNRKHYWO.js +1 -0
  47. package/dist/m/{c-6UEFPHHE.js → c-KDXIJEEF.js} +1 -1
  48. package/dist/m/{c-FMCPQ4VT.js → c-L4KMT7FO.js} +2 -2
  49. package/dist/m/{c-OI2BYWVV.js → c-LCYPMULG.js} +1 -1
  50. package/dist/m/{c-4RFZROCF.js → c-LIGQYZ7M.js} +4 -4
  51. package/dist/m/{c-QHVCUTJV.js → c-LKIWEPAV.js} +1 -1
  52. package/dist/m/{c-EDSPKYMA.js → c-LUXAB2XI.js} +1 -1
  53. package/dist/m/{c-DEAFCHDO.js → c-LWIDDWAR.js} +2 -2
  54. package/dist/m/c-MPSKIU2I.js +1 -0
  55. package/dist/m/{c-6PBXRWDX.js → c-NK33MMYF.js} +1 -1
  56. package/dist/m/{c-F5AER2ID.js → c-NQLWOHLH.js} +1 -1
  57. package/dist/m/{c-L7K5EXU2.js → c-NTHUTABN.js} +1 -1
  58. package/dist/m/{c-4PHDUV3H.js → c-NW54NHKE.js} +1 -1
  59. package/dist/m/{c-3AXJDL2P.js → c-OG6GFSUX.js} +1 -1
  60. package/dist/m/{c-MTQHWQC3.js → c-OKEGUICD.js} +1 -1
  61. package/dist/m/c-OPONJ2UK.js +128 -0
  62. package/dist/m/{c-LF6HNVPU.js → c-OWQWOGYI.js} +1 -1
  63. package/dist/m/{c-FDAXZ2PM.js → c-P6Q2ZTFQ.js} +1 -1
  64. package/dist/m/c-PKCCHJ5X.js +1 -0
  65. package/dist/m/c-PWJSJEJU.js +1 -0
  66. package/dist/m/{c-Z7RJANGO.js → c-PXLTUYZC.js} +1 -1
  67. package/dist/m/c-QEN6HZCA.js +1 -0
  68. package/dist/m/{c-26KVJS6J.js → c-QGAPG7OM.js} +1 -1
  69. package/dist/m/{c-HWR6GMGK.js → c-QIR5CAKM.js} +1 -1
  70. package/dist/m/{c-QJFYVCJO.js → c-QM5LXRDT.js} +1 -1
  71. package/dist/m/{c-MRURHLKV.js → c-QUGCKMWF.js} +1 -1
  72. package/dist/m/{c-KE33W4RE.js → c-QYYUVLVG.js} +1 -1
  73. package/dist/m/c-RO73MKKR.js +1 -0
  74. package/dist/m/c-SBCBXKOZ.js +26 -0
  75. package/dist/m/{c-XDVAZDUE.js → c-SGRIYOAJ.js} +1 -1
  76. package/dist/m/c-SKF5HL4I.js +4 -0
  77. package/dist/m/{c-IWTTOC2V.js → c-SRPC3VBE.js} +1 -1
  78. package/dist/m/{c-XZJ5IK6Q.js → c-T5NK2TVY.js} +1 -1
  79. package/dist/m/{c-VFES2BP5.js → c-TANBH7FI.js} +1 -1
  80. package/dist/m/{c-H6DXQEH2.js → c-THGQQDYY.js} +1 -1
  81. package/dist/m/{c-BV6FQQXM.js → c-TSBVMWAH.js} +1 -1
  82. package/dist/m/{c-QTC6VGA4.js → c-UD5JZTDL.js} +1 -1
  83. package/dist/m/{c-ZYEJLZEY.js → c-UDGEFWNU.js} +1 -1
  84. package/dist/m/{c-ZSCBEB7I.js → c-UHUNXWKN.js} +1 -1
  85. package/dist/m/{c-FWFJUU3T.js → c-VIRFF5HG.js} +1 -1
  86. package/dist/m/{c-GPTKI7AQ.js → c-VYJ7O4RI.js} +1 -1
  87. package/dist/m/{c-TUGVINJR.js → c-W5E5P2TZ.js} +1 -1
  88. package/dist/m/{c-WWE67K5Y.js → c-W7IPVCAA.js} +1 -1
  89. package/dist/m/{c-HAVGDXAL.js → c-WJ5DRBHT.js} +1 -1
  90. package/dist/m/{c-V2J5C5MT.js → c-WQZTI5P2.js} +1 -1
  91. package/dist/m/c-X5WC4PX5.js +1 -0
  92. package/dist/m/{c-ZKELCT4T.js → c-XCFQEWW6.js} +2 -2
  93. package/dist/m/c-XLQ3BDMM.js +1 -0
  94. package/dist/m/{c-FLBUYV3P.js → c-XX75FFNL.js} +1 -1
  95. package/dist/m/{c-JHJR5BQX.js → c-YK2L436K.js} +1 -1
  96. package/dist/m/{c-MEWUGR4D.js → c-YYMZWQLR.js} +1 -1
  97. package/dist/m/core/{admin-attrs-ZG7R5V3E.js → admin-attrs-U7IJNYBG.js} +1 -1
  98. package/dist/m/core/{autosave-GI3WNJYN.js → autosave-F5YQCKVL.js} +1 -1
  99. package/dist/m/core/{conflict-notice-CEI3XY6A.js → conflict-notice-42H4ASLA.js} +1 -1
  100. package/dist/m/core/{persist-3OPWJKZS.js → persist-CJXIL7D4.js} +1 -1
  101. package/dist/m/core/{save-OJ5NSLS7.js → save-ESPSQPLV.js} +1 -1
  102. package/dist/m/core/{save-core-DX3RFVO3.js → save-core-6SQHOR6W.js} +1 -1
  103. package/dist/m/core/snapshot-FJP5IJL3.js +1 -0
  104. package/dist/m/core/{unsaved-warning-HGYH7O4H.js → unsaved-warning-HNQVTA2D.js} +1 -1
  105. package/dist/m/internals/{index-V4WC44FU.js → index-NRPNDTSA.js} +1 -1
  106. package/dist/m/loader-FBDE2UAB.js +1 -0
  107. package/dist/m/manifest-1D2F5CA5.js +1 -0
  108. package/dist/m/manifest-edit-F7CC5CFD.js +1 -0
  109. package/dist/m/manifest.json +1090 -1020
  110. package/dist/m/page/{editor-BQEPCJLG.js → editor-OSKOW6RS.js} +2 -2
  111. package/dist/m/plugins/{ai-edit-45A2J6LC.js → ai-edit-VV4QTINH.js} +1 -1
  112. package/dist/m/plugins/{cms-IFTKWF4S.js → cms-H7DTMUQX.js} +1 -1
  113. package/dist/m/plugins/{indicator-IPZJ35K6.js → indicator-WVPGMOZ7.js} +1 -1
  114. package/dist/m/plugins/{live-GPQXSXSM.js → live-DCUBKXY4.js} +1 -1
  115. package/dist/m/plugins/menu-Q4MFFQ6E.js +1 -0
  116. package/dist/m/plugins/{page-BAVLWCP6.js → page-OAWUJQEL.js} +2 -2
  117. package/dist/m/plugins/{page-view-P3UGJFDZ.js → page-view-DZ26ZDDQ.js} +1 -1
  118. package/dist/m/plugins/{people-Z4RGVQAV.js → people-5XRNRP5U.js} +1 -1
  119. package/dist/m/plugins/{quickcrop-E34PUYA3.js → quickcrop-WWF5I422.js} +2 -2
  120. package/dist/m/plugins/{richclay-S4NVJYIK.js → richclay-PGOOJ4OK.js} +2 -2
  121. package/dist/m/plugins/{sortable-WJZZBM7R.js → sortable-266HY6TR.js} +1 -1
  122. package/dist/m/plugins/{source-KVN6YNTY.js → source-6BKMK4PO.js} +1 -1
  123. package/dist/m/plugins/{upgrade-KTSICB22.js → upgrade-BNZVFHMZ.js} +1 -1
  124. package/dist/m/plugins/visitor-drafts-2AUYKAIJ.js +20 -0
  125. package/dist/m/plugins/{visitor-drafts-owner-MZP45XSG.js → visitor-drafts-owner-Z5B2OQBR.js} +1 -1
  126. package/dist/m/plugins/visitor-menu-4LQMKLPP.js +1 -0
  127. package/dist/m/plugins/{wire-SYVIBNSE.js → wire-W2EV36KZ.js} +1 -1
  128. package/dist/m/{reader-core-RUIFH32Y.js → reader-core-POFQCKRV.js} +2 -2
  129. package/dist/m/sync/{live-sync-RGQMMWK2.js → live-sync-XGUPHI3I.js} +1 -1
  130. package/dist/m/ui/{index-EZGLEM5P.js → index-VGYAKAKI.js} +1 -1
  131. package/dist/offline-manifest.json +636 -570
  132. package/docs/guide.md +36 -25
  133. package/package.json +1 -1
  134. package/src/core/save-replace.js +5 -2
  135. package/src/core/serialize-steps.js +10 -2
  136. package/src/core/snapshot.js +37 -1
  137. package/src/core/upgrade-run.js +16 -2
  138. package/src/loader-logic.js +6 -2
  139. package/src/plugins/menu/dom-items.js +45 -0
  140. package/src/plugins/menu/looks.js +32 -0
  141. package/src/plugins/menu/shell-style.js +143 -0
  142. package/src/plugins/menu/shell.js +398 -0
  143. package/src/plugins/menu/style.js +15 -116
  144. package/src/plugins/menu/variants.js +56 -10
  145. package/src/plugins/menu/visitor.js +78 -0
  146. package/src/plugins/menu.js +21 -313
  147. package/src/plugins/visitor-drafts/inert.js +1 -0
  148. package/src/plugins/visitor-drafts/intro-style.js +6 -0
  149. package/src/plugins/visitor-drafts/intro.js +77 -25
  150. package/src/plugins/visitor-drafts/owner-chip.js +18 -23
  151. package/src/plugins/visitor-drafts/prompt.js +2 -2
  152. package/src/plugins/visitor-drafts/store.js +58 -5
  153. package/src/plugins/visitor-drafts.js +1 -0
  154. package/src/plugins/visitor-menu.js +13 -0
  155. package/src/sync/live-sync.js +2 -1
  156. package/src/sync/page-relay.js +2 -2
  157. package/src/ui/page-colour.js +17 -9
  158. package/dist/m/c-5AQYL27I.js +0 -1
  159. package/dist/m/c-DP4X4JID.js +0 -1
  160. package/dist/m/c-ECY5AZMH.js +0 -1
  161. package/dist/m/c-EGTIAL6P.js +0 -1
  162. package/dist/m/c-HDWZEJHM.js +0 -183
  163. package/dist/m/c-ILGQ3UXQ.js +0 -1
  164. package/dist/m/c-JFST6QE7.js +0 -1
  165. package/dist/m/c-JH5FF4NL.js +0 -20
  166. package/dist/m/c-KV7R47FR.js +0 -1
  167. package/dist/m/c-MHI3GYKF.js +0 -1
  168. package/dist/m/c-NNNR7OXA.js +0 -3
  169. package/dist/m/c-VSPAFOKU.js +0 -1
  170. package/dist/m/core/snapshot-O7II2AGG.js +0 -1
  171. package/dist/m/loader-V6VI46HU.js +0 -1
  172. package/dist/m/manifest-83C18DED.js +0 -1
  173. package/dist/m/manifest-edit-B28C1985.js +0 -1
  174. package/dist/m/plugins/menu-UN3KRCOF.js +0 -1
  175. package/dist/m/plugins/visitor-drafts-2AWNT23K.js +0 -20
  176. /package/dist/m/plugins/{quickcrop-E34PUYA3.js.LEGAL.txt → quickcrop-WWF5I422.js.LEGAL.txt} +0 -0
  177. /package/dist/m/plugins/{richclay-S4NVJYIK.js.LEGAL.txt → richclay-PGOOJ4OK.js.LEGAL.txt} +0 -0
@@ -1 +1 @@
1
- import{a as r}from"./c-VKEDWYDF.js";import{f as o}from"./c-3O7OBDCM.js";import{q as c}from"./c-EGTIAL6P.js";var l="[editmode\\:resource]:is(style, link, script)",u='[editmode\\:resource]:is(style, link, script)[type^="inert/"]',i="inert/";function s(e){let t=e.getAttribute("type");return t&&t.startsWith(i)?!1:(e.setAttribute("type",i+(t||"")),!0)}function m(e){let t=e.getAttribute("type").slice(i.length);t?e.setAttribute("type",t):e.removeAttribute("type")}function d(){c(e=>{e.querySelectorAll(l).forEach(s)})}function f(){o&&r(()=>{a()})}function a(e=document){let t=(e.ownerDocument||e)===document;e.querySelectorAll(u).forEach(n=>{m(n),t&&n.replaceWith(n.cloneNode(!0))})}function R(){document.querySelectorAll(l).forEach(e=>{s(e)&&e.replaceWith(e.cloneNode(!0))})}function b(){d(),f()}export{l as a,a as b,R as c,b as d};
1
+ import{a as r}from"./c-VKEDWYDF.js";import{f as o}from"./c-3O7OBDCM.js";import{r as c}from"./c-PWJSJEJU.js";var l="[editmode\\:resource]:is(style, link, script)",u='[editmode\\:resource]:is(style, link, script)[type^="inert/"]',i="inert/";function s(e){let t=e.getAttribute("type");return t&&t.startsWith(i)?!1:(e.setAttribute("type",i+(t||"")),!0)}function m(e){let t=e.getAttribute("type").slice(i.length);t?e.setAttribute("type",t):e.removeAttribute("type")}function d(){c(e=>{e.querySelectorAll(l).forEach(s)})}function f(){o&&r(()=>{a()})}function a(e=document){let t=(e.ownerDocument||e)===document;e.querySelectorAll(u).forEach(n=>{m(n),t&&n.replaceWith(n.cloneNode(!0))})}function R(){document.querySelectorAll(l).forEach(e=>{s(e)&&e.replaceWith(e.cloneNode(!0))})}function b(){d(),f()}export{l as a,a as b,R as c,b as d};
@@ -1,4 +1,4 @@
1
- import{e as X,f as G,h as J,i as Q,j as P,k as U}from"./c-QIKT6SKM.js";import{a as C,f as L}from"./c-RQRMPZXD.js";import"./c-WN3MXOLT.js";import"./c-L5VFATT6.js";import{a as O,b as N,k as z,l as K,m as j,n as V,v as T}from"./c-WMRJKQ2V.js";import{o as w}from"./c-TMT5TL65.js";import{b as k,d as H}from"./c-QIXT3Q7C.js";import{b as W}from"./c-RS77ODLY.js";import"./c-7SWMYKAI.js";import"./c-UGHH4MB3.js";import"./c-LA2BW7UY.js";import{d as q}from"./c-XGH4GS2T.js";import"./c-IJUK2GPW.js";import"./c-3O7OBDCM.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var ie=128,D=r=>r.depth?r.node(1).attrs.id:null,Z=r=>!!r.depth&&r.node(1).type.name==="table",ce=(r,t,n,e,o)=>O(K(z(r.flow,J(t,n.holes,e,n.visible),o)));function te({pd:r,w:t,doc:n},e){if(!r||!t||!n||!e)return null;if(e instanceof k.TextSelection){let o=e.$anchor,s=e.$head;if(Z(o)||Z(s)){let c=P(n,o.pos),u=P(n,s.pos);return!c||!u||c.table!==u.table||c.row!==u.row||c.col!==u.col?null:{kind:"cell",block:c.table,row:c.row,col:c.col}}let a=Math.min(e.from,e.to),l=c=>{let u=D(c);return u===null?null:{block:u,rel:ce(r,n,t,c.pos,e.empty||c.pos===a?0:-1)}},i=l(o),d=l(s);return i&&d?{kind:"text",anchor:i,head:d}:null}if(e instanceof w||e instanceof k.NodeSelection){let o=[];if(e instanceof w){let{lo:s,hi:a}=e.span();n.forEach((l,i,d)=>{d>=s&&d<=a&&o.push(l.attrs.id)})}else{let s=n.nodeAt(e.from);s&&o.push(s.attrs.id)}if(!o.length)return null;if(o.length>ie){let s=D(e.$from);return s?{kind:"blocks",ids:[s]}:null}return{kind:"blocks",ids:o}}return null}var ue=(r,t)=>{if(!t||typeof t!="object"||typeof t.block!="string"||!t.block||typeof t.rel!="string"||!t.rel)return null;let n;try{n=j(N(t.rel))}catch{return null}let e;try{e=V(n,r.ydoc)}catch{return null}return!e||e.type!==r.flow?null:e.index},fe=(r,t)=>{let n=0;for(let e=r.flow._start;e;e=e.right){let o=n+e.length;if(t<o)return!e.deleted;n=o}return!1},pe=(r,t)=>{for(let n=r.flow._start;n;n=n.right)if(!n.deleted&&n.content instanceof T&&n.content.embed?.b===t)return!0;return!1},de=(r,t)=>{let n=0,e=null,o=0;for(let s=r.flow._start;s;s=s.right)if(s.content instanceof T&&s.content.embed?.b!==void 0&&(e=s.content.embed.b,o=n+s.length),n+=s.length,n>t&&e!==null)return{id:e,offset:t-o};return e===null?null:{id:e,offset:t-o}},me=(r,t,n)=>{let e=null;return r.forEach((o,s)=>{e===null&&o.attrs.id===t&&o.isTextblock&&(e=s+1+Math.min(Math.max(n,0),o.content.size))}),e},ee=({pd:r,w:t,doc:n},e)=>{let o=ue(r,e);if(o===null)return null;let s=Q(n,t.holes,t.tokens,o,t.visible);if(D(n.resolve(s))===e.block)return s;let a=de(r,o);if(a&&a.id===e.block){let l=me(n,e.block,a.offset);if(l!==null)return l}return pe(r,e.block)||!fe(r,o)||t.holes.some(l=>o>=G(t.holes,l.at)&&o<X(t.holes,l.at))?null:n.resolve(s).parent.inlineContent?s:null};function ne({pd:r,w:t,doc:n},e){if(!r||!t||!n||!e||typeof e!="object")return null;if(e.kind==="text"){let o=ee({pd:r,w:t,doc:n},e.anchor),s=ee({pd:r,w:t,doc:n},e.head);return o===null||s===null?null:{kind:"text",from:Math.min(o,s),to:Math.max(o,s)}}if(e.kind==="cell"){let o=U(n,{table:e.block,row:e.row,col:e.col,offset:0});return o?{kind:"cell",from:o.from,to:o.to,block:o.block,row:o.row,col:o.col}:null}if(e.kind==="blocks"){let o=[],s=[];for(let a of Array.isArray(e.ids)?e.ids:[])n.forEach((l,i)=>{l.attrs.id!==a||o.includes(a)||(o.push(a),s.push({from:i,to:i+l.nodeSize}))});return s.length?{kind:"blocks",ids:o,ranges:s}:null}return null}var{Plugin:ge,PluginKey:he}=k,{Decoration:b,DecorationSet:x}=H,y=new he("page-awareness"),oe="page-awareness-style",be=`
1
+ import{e as X,f as G,h as J,i as Q,j as P,k as U}from"./c-QIKT6SKM.js";import{a as C,f as L}from"./c-RQRMPZXD.js";import"./c-WN3MXOLT.js";import"./c-L5VFATT6.js";import{a as O,b as N,k as z,l as K,m as j,n as V,v as T}from"./c-WMRJKQ2V.js";import{o as w}from"./c-HCNWJE4A.js";import{b as k,d as H}from"./c-QIXT3Q7C.js";import{b as W}from"./c-RS77ODLY.js";import"./c-7SWMYKAI.js";import"./c-UGHH4MB3.js";import"./c-LA2BW7UY.js";import{d as q}from"./c-XGH4GS2T.js";import"./c-IJUK2GPW.js";import"./c-3O7OBDCM.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var ie=128,D=r=>r.depth?r.node(1).attrs.id:null,Z=r=>!!r.depth&&r.node(1).type.name==="table",ce=(r,t,n,e,o)=>O(K(z(r.flow,J(t,n.holes,e,n.visible),o)));function te({pd:r,w:t,doc:n},e){if(!r||!t||!n||!e)return null;if(e instanceof k.TextSelection){let o=e.$anchor,s=e.$head;if(Z(o)||Z(s)){let c=P(n,o.pos),u=P(n,s.pos);return!c||!u||c.table!==u.table||c.row!==u.row||c.col!==u.col?null:{kind:"cell",block:c.table,row:c.row,col:c.col}}let a=Math.min(e.from,e.to),l=c=>{let u=D(c);return u===null?null:{block:u,rel:ce(r,n,t,c.pos,e.empty||c.pos===a?0:-1)}},i=l(o),d=l(s);return i&&d?{kind:"text",anchor:i,head:d}:null}if(e instanceof w||e instanceof k.NodeSelection){let o=[];if(e instanceof w){let{lo:s,hi:a}=e.span();n.forEach((l,i,d)=>{d>=s&&d<=a&&o.push(l.attrs.id)})}else{let s=n.nodeAt(e.from);s&&o.push(s.attrs.id)}if(!o.length)return null;if(o.length>ie){let s=D(e.$from);return s?{kind:"blocks",ids:[s]}:null}return{kind:"blocks",ids:o}}return null}var ue=(r,t)=>{if(!t||typeof t!="object"||typeof t.block!="string"||!t.block||typeof t.rel!="string"||!t.rel)return null;let n;try{n=j(N(t.rel))}catch{return null}let e;try{e=V(n,r.ydoc)}catch{return null}return!e||e.type!==r.flow?null:e.index},fe=(r,t)=>{let n=0;for(let e=r.flow._start;e;e=e.right){let o=n+e.length;if(t<o)return!e.deleted;n=o}return!1},pe=(r,t)=>{for(let n=r.flow._start;n;n=n.right)if(!n.deleted&&n.content instanceof T&&n.content.embed?.b===t)return!0;return!1},de=(r,t)=>{let n=0,e=null,o=0;for(let s=r.flow._start;s;s=s.right)if(s.content instanceof T&&s.content.embed?.b!==void 0&&(e=s.content.embed.b,o=n+s.length),n+=s.length,n>t&&e!==null)return{id:e,offset:t-o};return e===null?null:{id:e,offset:t-o}},me=(r,t,n)=>{let e=null;return r.forEach((o,s)=>{e===null&&o.attrs.id===t&&o.isTextblock&&(e=s+1+Math.min(Math.max(n,0),o.content.size))}),e},ee=({pd:r,w:t,doc:n},e)=>{let o=ue(r,e);if(o===null)return null;let s=Q(n,t.holes,t.tokens,o,t.visible);if(D(n.resolve(s))===e.block)return s;let a=de(r,o);if(a&&a.id===e.block){let l=me(n,e.block,a.offset);if(l!==null)return l}return pe(r,e.block)||!fe(r,o)||t.holes.some(l=>o>=G(t.holes,l.at)&&o<X(t.holes,l.at))?null:n.resolve(s).parent.inlineContent?s:null};function ne({pd:r,w:t,doc:n},e){if(!r||!t||!n||!e||typeof e!="object")return null;if(e.kind==="text"){let o=ee({pd:r,w:t,doc:n},e.anchor),s=ee({pd:r,w:t,doc:n},e.head);return o===null||s===null?null:{kind:"text",from:Math.min(o,s),to:Math.max(o,s)}}if(e.kind==="cell"){let o=U(n,{table:e.block,row:e.row,col:e.col,offset:0});return o?{kind:"cell",from:o.from,to:o.to,block:o.block,row:o.row,col:o.col}:null}if(e.kind==="blocks"){let o=[],s=[];for(let a of Array.isArray(e.ids)?e.ids:[])n.forEach((l,i)=>{l.attrs.id!==a||o.includes(a)||(o.push(a),s.push({from:i,to:i+l.nodeSize}))});return s.length?{kind:"blocks",ids:o,ranges:s}:null}return null}var{Plugin:ge,PluginKey:he}=k,{Decoration:b,DecorationSet:x}=H,y=new he("page-awareness"),oe="page-awareness-style",be=`
2
2
  .page-remote-selection { background-color: color-mix(in srgb, var(--page-remote-color, currentColor) 22%, transparent); }
3
3
  .page-remote-caret { position: relative; display: inline-block; width: 0; height: 1.1em; vertical-align: text-bottom; }
4
4
  .page-remote-caret::before { content: ""; position: absolute; inset-inline-start: -1px; top: 0; bottom: 0; width: 2px; background: var(--page-remote-color, currentColor); }
@@ -1,4 +1,4 @@
1
- import{a as L,c as f,d as c,e as C,g as D,h as B,i as l,j as S,k as $,l as b,m as P}from"./c-4TWARTLS.js";import{c as R}from"./c-W4JCVLAB.js";import{B as m,d as N}from"./c-TMT5TL65.js";import{d as y,j as M,m as A}from"./c-QIXT3Q7C.js";import"./c-VHNSBD2M.js";var d=new WeakMap;var{Decoration:U,DecorationSet:F}=y,re=A.nodes,H=new Set(["timeout","network","error","bad-response"]),I=`
1
+ import{a as L,c as f,d as c,e as C,g as D,h as B,i as l,j as S,k as $,l as b,m as P}from"./c-6RDOKLN7.js";import{c as R}from"./c-W4JCVLAB.js";import{B as m,d as N}from"./c-HCNWJE4A.js";import{d as y,j as M,m as A}from"./c-QIXT3Q7C.js";import"./c-VHNSBD2M.js";var d=new WeakMap;var{Decoration:U,DecorationSet:F}=y,re=A.nodes,H=new Set(["timeout","network","error","bad-response"]),I=`
2
2
  .page-editor .page-image { margin-inline: 0; }
3
3
  .page-image-frame { position: relative; margin: 0 auto; max-width: 100%; }
4
4
  .page-image-frame img { display: block; width: 100%; height: auto; border-radius: var(--page-image-radius, 6px); }
@@ -1 +1 @@
1
- import{a as d,b as c,c as o,d as n}from"./c-TWCXBWS3.js";import{a as u}from"./c-VKEDWYDF.js";import{f as a}from"./c-3O7OBDCM.js";import{b as l,q as b}from"./c-EGTIAL6P.js";var r="[editmode\\:contenteditable]";function m(){b(e=>{e.querySelectorAll(r).forEach(t=>{n(t),o(t,l(t)??t)})})}function s(){a&&u(()=>{p()})}function p(e=document){e.querySelectorAll(r).forEach(t=>{d(t);let i=t.getAttribute("inert-contenteditable")??t.getAttribute("contenteditable")??c(t,"inert-contenteditable")??"true",f=i.toLowerCase();t.setAttribute("contenteditable",["","true","false","plaintext-only"].includes(f)?i:"true"),t.removeAttribute("inert-contenteditable")})}function y(){document.querySelectorAll(r).forEach(e=>{n(e),o(e)})}function S(){m(),s()}export{r as a,p as b,y as c,S as d};
1
+ import{a as d,b as c,c as o,d as n}from"./c-TWCXBWS3.js";import{a as u}from"./c-VKEDWYDF.js";import{f as a}from"./c-3O7OBDCM.js";import{b as l,r as b}from"./c-PWJSJEJU.js";var r="[editmode\\:contenteditable]";function m(){b(e=>{e.querySelectorAll(r).forEach(t=>{n(t),o(t,l(t)??t)})})}function s(){a&&u(()=>{p()})}function p(e=document){e.querySelectorAll(r).forEach(t=>{d(t);let i=t.getAttribute("inert-contenteditable")??t.getAttribute("contenteditable")??c(t,"inert-contenteditable")??"true",f=i.toLowerCase();t.setAttribute("contenteditable",["","true","false","plaintext-only"].includes(f)?i:"true"),t.removeAttribute("inert-contenteditable")})}function y(){document.querySelectorAll(r).forEach(e=>{n(e),o(e)})}function S(){m(),s()}export{r as a,p as b,y as c,S as d};
@@ -1 +1 @@
1
- import{c as M,g as _,h as A,w as q}from"./c-4RFZROCF.js";import{B as G}from"./c-TMT5TL65.js";import{D as O,G as $,I as y,J as B,M as R,Z as j,_ as U,b as z,m as p,na as F}from"./c-QIXT3Q7C.js";import{a as x}from"./c-OI2BYWVV.js";import{a as K}from"./c-I2SCCUEW.js";var{TextSelection:J}=z,S=new WeakMap,D=new Set;function g(n,t){let e=null;return n.forEach(s=>{s.type===p.nodes.table&&s.attrs.id===t&&(e=s)}),e}function N(n){return n?F({[n.attrs.id]:R(n)})[0]:null}function Q(n,t,e){let s=y(n.attrs.cols);if(!s.length)return null;let i=M(n),a=s.filter(r=>r!==s[0]&&i[r]==="number");return a.length?{id:B(),pos:t,parent:e,source:n.attrs.id,kind:"bar",x:s[0],series:a,title:"",highlight:null}:null}function wt(n,t){let e=n.state.doc,s=e.nodeAt(t);if(s?.type!==p.nodes.table)return!1;let i=t+s.nodeSize,a=e.maybeChild(e.resolve(i).index(0)),r=Q(s,$(s.attrs.pos,a?.attrs.pos??null),s.attrs.parent);return r?(D.add(r.id),n.dispatch(n.state.tr.insert(i,p.nodes.chart.create(r))),!0):(x("This table has no number column to chart yet."),!0)}function W(n,t,e,s){let i=n.state.tr;if(s&&i.delete(s.from,s.to),!g(i.doc,e.attrs.id)||t>=i.doc.childCount)return!1;let a=0;for(let m=0;m<t;m++)a+=i.doc.child(m).nodeSize;let r=i.doc.child(t),c=r.isTextblock&&r.content.size===0,h=i.doc.maybeChild(t+1),f=c?r.attrs.pos:$(r.attrs.pos,h?.attrs.pos??null),d=Q(e,f,r.attrs.parent??null);if(!d)return s&&n.dispatch(n.state.tr.delete(s.from,s.to)),x("This table has no number column to chart yet."),!0;let w=p.nodes.chart.create(d);return i=c?i.replaceWith(a,a+r.nodeSize,w):i.insert(a+r.nodeSize,w),D.add(d.id),n.dispatch(i.scrollIntoView()),!0}var X=n=>y(n.attrs.cols).map(t=>n.attrs.cols[t].name||"Untitled").join(", ");function kt(n,t,e=null){let s=_(n.state.doc);if(!s.length)return e&&n.dispatch(n.state.tr.delete(e.from,e.to)),x("Add a table first: a chart plots the numbers in a table on this page."),!0;if(s.length===1)return W(n,t,s[0],e);let i=n.state.doc,a=n.nodeDOM(i.resolve(n.state.selection.head).before(1))??n.dom;return q(n,a,s.map(r=>({label:A(i,r.attrs.id)??"",description:`${r.childCount} ${r.childCount===1?"row":"rows"} \xB7 ${X(r)}`,icon:"\u25A6",run:()=>W(n,t,r,e)})))}var V=n=>`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n}</svg>`,Z=V('<rect x="2.5" y="3" width="11" height="10" rx="1.5"/><path d="M2.5 6.5h11M6 6.5V13"/>'),tt=V('<g transform="scale(0.6667)" stroke-width="2.25"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></g>'),et=V('<path d="M2.75 4.5h10.5M6.25 4.5V2.75h3.5V4.5M4.25 4.5l.6 8.75h6.3l.6-8.75"/>'),st=[["bar","Bar"],["line","Line"],["pie","Pie"]],it="Untitled chart";function nt(n,t){let e=null;return n.forEach((s,i)=>{e===null&&s.type===p.nodes.table&&s.attrs.id===t&&(e=i)}),e}function E(n){let t=[];return n.forEach(e=>{e.type===p.nodes.table&&y(e.attrs.cols).length>1&&t.push(e)}),t.map(e=>({id:e.attrs.id,name:A(n,e.attrs.id),rows:e.childCount}))}function at(n){let t=y(n.attrs.cols);if(!t.length)return null;let e=M(n),s=t.find(a=>e[a]!=="number")??t[0],i=t.filter(a=>a!==s&&e[a]==="number");return{x:s,series:i.length?i:t.filter(a=>a!==s).slice(0,1)}}function l(n,t,e,s=null){let i=n.createElement(t);return e&&(i.className=e),s!==null&&(i.textContent=s),i}function C(n,t,e,s=!1){let i=l(n,"option","",e);return i.value=t,i.selected=s,i}function T(n,t,e){let s=l(n,"select","page-chart-select");return s.dataset.field=t,s.setAttribute("aria-label",e),s}var Y=class{constructor(t,e,s){this.node=t,this.view=e,this.getPos=s,this.source=void 0,this.tables=null,this.frame=null,this.unsaved=null,this.titleInput=null;let i=e.dom.ownerDocument;this.doc=i,this.dom=i.createElement("figure"),this.dom.className="page-chart",this.dom.dataset.id=t.attrs.id??"",this.dom.dataset.type="chart",this.head=l(i,"div","page-chart-head"),this.head.contentEditable="false",this.title=l(i,"span","page-chart-title"),this.chip=l(i,"button","page-chart-source"),this.chip.type="button",this.chip.contentEditable="false",this.chip.setAttribute("aria-label","Go to source table"),this.chip.innerHTML=Z,this.chipName=l(i,"span","page-chart-source-name"),this.chip.append(this.chipName),this.chip.addEventListener("click",()=>this.goToSource()),this.edit=l(i,"button","page-chart-edit"),this.edit.type="button",this.edit.contentEditable="false",this.edit.setAttribute("aria-haspopup","dialog"),this.edit.setAttribute("aria-expanded","false"),this.edit.innerHTML=tt,this.edit.append("Edit chart"),this.edit.addEventListener("click",()=>this.panel.isConnected?this.closePanel(!0):this.openPanel()),this.head.append(this.title,this.chip,this.edit),this.plot=l(i,"div","page-chart-plot"),this.broken=l(i,"div","page-chart-broken"),this.broken.hidden=!0,this.broken.contentEditable="false",this.brokenKey=null,this.brokenSelect=null,this.broken.addEventListener("click",a=>this.brokenClick(a)),this.panel=l(i,"div","page-chart-panel"),this.panel.tabIndex=-1,this.panel.contentEditable="false",this.panel.setAttribute("role","dialog"),this.panel.setAttribute("aria-label","Chart settings"),this.panel.addEventListener("click",a=>this.panelClick(a)),this.panel.addEventListener("change",a=>this.panelChange(a)),this.panel.addEventListener("mousedown",a=>{a.target.closest?.("button")&&a.preventDefault()}),this.outside=a=>{!this.panel.isConnected||this.dom.contains(a.target)||(this.commitTitle(),this.closePanel())},this.escape=a=>{!this.panel.isConnected||a.key!=="Escape"||(a.preventDefault(),a.stopPropagation(),this.closePanel(!0))},i.addEventListener("mousedown",this.outside,!0),i.addEventListener("keydown",this.escape,!0),this.dom.append(this.head,this.plot,this.broken),S.has(e)||S.set(e,new Set),S.get(e).add(this),this.refresh(),D.delete(t.attrs.id)&&this.openSoon()}refresh(){this.renderHead(),this.panel.isConnected&&this.panelKey()!==this.renderedKey&&this.redrawPanel();let t=this.view.state.doc,e=g(t,this.node.attrs.source),s=E(t).map(i=>`${i.id}:${i.name}:${i.rows}`).join("|");e===this.source&&s===this.tables||(this.source=e,this.tables=s,this.schedule())}schedule(){if(this.frame!==null)return;let t=this.dom.ownerDocument.defaultView,e=t.requestAnimationFrame?.bind(t)??(s=>t.setTimeout(s,0));this.frame=e(()=>{this.frame=null,this.draw()})}draw(){let t=this.node.attrs,e=j({id:t.id,type:t.kind,x:t.x,series:t.series,title:t.title,highlight:t.highlight},N(this.source));this.plot.innerHTML=U(e,{width:640,height:320,narrow:this.dom.getBoundingClientRect().width<480}),this.renderBroken(e)}renderBroken(t){let e=t.state==="missing"&&t.reason==="table";if(this.plot.hidden=e,this.broken.hidden=!e,!e){this.brokenKey!==null&&(this.broken.textContent="",this.brokenKey=null,this.brokenSelect=null);return}let s=E(this.view.state.doc),i=s.map(h=>`${h.id}:${h.name}:${h.rows}`).join("|");if(this.brokenKey===i)return;this.brokenKey=i,this.brokenSelect=null;let a=this.doc;this.broken.textContent="",this.broken.append(l(a,"div","page-chart-broken-head","This chart's table was deleted"),l(a,"p","page-chart-broken-text","Pick another table in this document, or delete the chart. Undo brings the table back."));let r=l(a,"div","page-chart-broken-actions");if(s.length){let h=T(a,"rescue","Source table");for(let d of s)h.append(C(a,d.id,`${d.name} (${d.rows} ${d.rows===1?"row":"rows"})`));this.brokenSelect=h;let f=l(a,"button","page-chart-use","Use this table");f.type="button",f.dataset.action="use",r.append(h,f)}let c=l(a,"button","page-chart-delete","Delete chart");c.type="button",c.dataset.action="delete",r.append(c),this.broken.append(r)}brokenClick(t){let e=t.target.closest?.("button[data-action]");e&&(e.dataset.action==="delete"?this.removeChart():e.dataset.action==="use"&&this.switchSource(this.brokenSelect?.value??""))}openSoon(){let t=this.dom.ownerDocument.defaultView;(t.requestAnimationFrame?.bind(t)??(s=>t.setTimeout(s,0)))(()=>{!this.view.isDestroyed&&this.dom.isConnected&&this.openPanel()})}renderHead(){let t=this.node.attrs,e=A(this.view.state.doc,t.source),s=!g(this.view.state.doc,t.source);this.title.textContent=t.title||it,this.title.classList.toggle("is-empty",!t.title),this.chipName.textContent=s?"No table":e??"",this.chip.disabled=s}setAttrs(t){let e=this.getPos();if(e==null)return;let s=this.view.state.doc.nodeAt(e);s?.type===p.nodes.chart&&this.view.dispatch(this.view.state.tr.setNodeMarkup(e,null,{...s.attrs,...t}))}row(t,...e){let s=l(this.doc,"div","page-chart-row");return t&&s.append(l(this.doc,"span","page-chart-label",t)),s.append(...e),s}panelKey(){let t=this.view.state.doc,e=E(t).map(s=>`${s.id}:${s.name}:${s.rows}`).join("|");return JSON.stringify([this.node.attrs,e,N(g(t,this.node.attrs.source))])}redrawPanel(){let t=this.doc.activeElement,e=t&&this.panel.contains(t)?t.dataset??{}:null,s=this.titleInput,i=s&&s.value!==this.renderedTitle?{value:s.value,start:s.selectionStart,end:s.selectionEnd}:null;if(this.renderPanel(),i&&this.titleInput&&(this.titleInput.value=i.value),!e)return;let a=[...this.panel.querySelectorAll("button, input, select")].find(r=>["field","kind","col","action"].every(c=>r.dataset[c]===e[c]));if(!a)return this.panel.focus();a.focus(),i&&a===this.titleInput&&a.setSelectionRange?.(i.start,i.end)}renderPanel(){let t=this.doc;this.renderedKey=this.panelKey(),this.renderedTitle=this.node.attrs.title??"";let e=this.node.attrs,s=N(this.source),i=s?.cols??[],a=s?.rows??[],r=e.kind==="pie";this.unsaved?.dispose(),this.unsaved=null,this.titleInput=null,this.panel.textContent="";let c=l(t,"div","page-chart-types");for(let[o,P]of st){let b=l(t,"button","page-chart-type",P);b.type="button",b.dataset.kind=o,b.setAttribute("aria-pressed",String(e.kind===o)),c.append(b)}this.panel.append(this.row("Chart type",c));let h=T(t,"source","Source table");for(let o of E(this.view.state.doc))h.append(C(t,o.id,`${o.name} (${o.rows} ${o.rows===1?"row":"rows"})`,o.id===e.source));this.panel.append(this.row("Source table",h));let f=T(t,"labels","Labels column");for(let o of i)f.append(C(t,o.id,o.name||o.id,o.id===e.x));this.panel.append(this.row("Labels column",f));let d=l(t,"div","page-chart-values");i.filter(o=>o.id!==e.x).forEach((o,P)=>{let b=l(t,"label","page-chart-value"),v=l(t,"input");v.type="checkbox",v.dataset.field="series",v.dataset.col=o.id,v.checked=e.series.includes(o.id);let I=l(t,"span","page-chart-swatch");I.style.background=`var(--chart-${P%6+1})`,I.setAttribute("aria-hidden","true"),b.append(v,I,l(t,"span","page-chart-value-name",o.name||o.id)),d.append(b)});let w=this.row(r?"Value column":"Value columns",d);r&&w.append(l(t,"span","page-chart-hint","Pie charts plot the first value column across rows.")),this.panel.append(w);let m=T(t,"highlight","Highlight row");m.append(C(t,"","None",!e.highlight));for(let o of a)m.append(C(t,o.id,O(o.cells?.[e.x])||o.id,o.id===e.highlight));this.panel.append(this.row("Highlight row",m));let u=l(t,"input","page-chart-title-input");u.type="text",u.dataset.field="title",u.setAttribute("aria-label","Chart title"),u.value=e.title??"",u.addEventListener("keydown",o=>{o.isComposing||o.keyCode===229||o.key==="Enter"&&(o.preventDefault(),o.stopPropagation(),this.commitTitle())}),u.addEventListener("change",()=>this.commitTitle()),u.addEventListener("blur",()=>this.commitTitle()),this.titleInput=u,this.panel.append(this.row("Chart title",u));let H=l(t,"div","page-chart-foot"),k=l(t,"button","page-chart-remove");k.type="button",k.dataset.action="remove",k.innerHTML=et,k.append("Remove");let L=l(t,"button","page-chart-done","Done");L.type="button",L.dataset.action="done",H.append(k,L),this.panel.append(H),this.unsaved=K({id:"chart-title",isPending:()=>u.isConnected&&u.value!==(this.node.attrs.title??"")})}openPanel(){this.panel.isConnected||(this.renderPanel(),this.dom.append(this.panel),this.edit.setAttribute("aria-expanded","true"),this.panel.focus())}closePanel(t=!1){this.panel.isConnected&&(this.unsaved?.dispose(),this.unsaved=null,this.titleInput=null,this.panel.remove(),this.edit.setAttribute("aria-expanded","false"),t&&this.edit.focus())}panelClick(t){let e=t.target.closest?.("button");e&&(e.dataset.action==="done"?(this.commitTitle(),this.closePanel(!0)):e.dataset.action==="remove"?this.removeChart():e.dataset.kind&&this.setAttrs({kind:e.dataset.kind}))}panelChange(t){let e=t.target;if(e?.dataset){if(e.dataset.field==="source")this.switchSource(e.value);else if(e.dataset.field==="labels")this.setAttrs({x:e.value,series:this.node.attrs.series.filter(s=>s!==e.value)});else if(e.dataset.field==="highlight")this.setAttrs({highlight:e.value||null});else if(e.dataset.field==="series"){let s=this.node.attrs.series.filter(i=>i!==e.dataset.col);this.setAttrs({series:e.checked?[...s,e.dataset.col]:s})}}}switchSource(t){let e=g(this.view.state.doc,t),s=e?at(e):null;s&&this.setAttrs({source:t,x:s.x,series:s.series})}commitTitle(){let t=this.titleInput;!t||t.value===(this.node.attrs.title??"")||this.setAttrs({title:t.value})}goToSource(){let t=this.view.state.doc,e=nt(t,this.node.attrs.source),s=e===null?null:t.nodeAt(e);if(!s?.childCount||!s.child(0).childCount)return;let i=e+3;this.view.dispatch(this.view.state.tr.setSelection(J.create(t,i)).scrollIntoView()),this.view.focus?.()}removeChart(){let t=this.getPos();if(t==null)return;let e=this.view.state.doc.nodeAt(t);if(e?.type!==p.nodes.chart)return;this.closePanel();let s=this.view.state.tr.delete(t,t+e.nodeSize);s.setSelection(J.near(s.doc.resolve(Math.min(t,s.doc.content.size)),-1)),this.view.dispatch(G(s).scrollIntoView())}update(t){if(t.type!==p.nodes.chart)return!1;let e=!t.sameMarkup(this.node);return this.node=t,this.dom.dataset.id=t.attrs.id??"",e&&(this.source=g(this.view.state.doc,t.attrs.source),this.renderHead(),this.schedule()),!0}stopEvent(t){return!!t.target.closest?.(".page-chart-head, .page-chart-panel")}destroy(){if(this.unsaved?.dispose(),this.unsaved=null,this.doc.removeEventListener("mousedown",this.outside,!0),this.doc.removeEventListener("keydown",this.escape,!0),S.get(this.view)?.delete(this),this.frame!==null){let t=this.dom.ownerDocument.defaultView;t.cancelAnimationFrame?t.cancelAnimationFrame(this.frame):t.clearTimeout(this.frame)}}};function vt(n){for(let t of S.get(n)??[])t.refresh()}export{wt as a,X as b,kt as c,Y as d,vt as e};
1
+ import{c as M,g as _,h as A,w as q}from"./c-LIGQYZ7M.js";import{B as G}from"./c-HCNWJE4A.js";import{D as O,G as $,I as y,J as B,M as R,Z as j,_ as U,b as z,m as p,na as F}from"./c-QIXT3Q7C.js";import{a as x}from"./c-LCYPMULG.js";import{a as K}from"./c-I2SCCUEW.js";var{TextSelection:J}=z,S=new WeakMap,D=new Set;function g(n,t){let e=null;return n.forEach(s=>{s.type===p.nodes.table&&s.attrs.id===t&&(e=s)}),e}function N(n){return n?F({[n.attrs.id]:R(n)})[0]:null}function Q(n,t,e){let s=y(n.attrs.cols);if(!s.length)return null;let i=M(n),a=s.filter(r=>r!==s[0]&&i[r]==="number");return a.length?{id:B(),pos:t,parent:e,source:n.attrs.id,kind:"bar",x:s[0],series:a,title:"",highlight:null}:null}function wt(n,t){let e=n.state.doc,s=e.nodeAt(t);if(s?.type!==p.nodes.table)return!1;let i=t+s.nodeSize,a=e.maybeChild(e.resolve(i).index(0)),r=Q(s,$(s.attrs.pos,a?.attrs.pos??null),s.attrs.parent);return r?(D.add(r.id),n.dispatch(n.state.tr.insert(i,p.nodes.chart.create(r))),!0):(x("This table has no number column to chart yet."),!0)}function W(n,t,e,s){let i=n.state.tr;if(s&&i.delete(s.from,s.to),!g(i.doc,e.attrs.id)||t>=i.doc.childCount)return!1;let a=0;for(let m=0;m<t;m++)a+=i.doc.child(m).nodeSize;let r=i.doc.child(t),c=r.isTextblock&&r.content.size===0,h=i.doc.maybeChild(t+1),f=c?r.attrs.pos:$(r.attrs.pos,h?.attrs.pos??null),d=Q(e,f,r.attrs.parent??null);if(!d)return s&&n.dispatch(n.state.tr.delete(s.from,s.to)),x("This table has no number column to chart yet."),!0;let w=p.nodes.chart.create(d);return i=c?i.replaceWith(a,a+r.nodeSize,w):i.insert(a+r.nodeSize,w),D.add(d.id),n.dispatch(i.scrollIntoView()),!0}var X=n=>y(n.attrs.cols).map(t=>n.attrs.cols[t].name||"Untitled").join(", ");function kt(n,t,e=null){let s=_(n.state.doc);if(!s.length)return e&&n.dispatch(n.state.tr.delete(e.from,e.to)),x("Add a table first: a chart plots the numbers in a table on this page."),!0;if(s.length===1)return W(n,t,s[0],e);let i=n.state.doc,a=n.nodeDOM(i.resolve(n.state.selection.head).before(1))??n.dom;return q(n,a,s.map(r=>({label:A(i,r.attrs.id)??"",description:`${r.childCount} ${r.childCount===1?"row":"rows"} \xB7 ${X(r)}`,icon:"\u25A6",run:()=>W(n,t,r,e)})))}var V=n=>`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${n}</svg>`,Z=V('<rect x="2.5" y="3" width="11" height="10" rx="1.5"/><path d="M2.5 6.5h11M6 6.5V13"/>'),tt=V('<g transform="scale(0.6667)" stroke-width="2.25"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></g>'),et=V('<path d="M2.75 4.5h10.5M6.25 4.5V2.75h3.5V4.5M4.25 4.5l.6 8.75h6.3l.6-8.75"/>'),st=[["bar","Bar"],["line","Line"],["pie","Pie"]],it="Untitled chart";function nt(n,t){let e=null;return n.forEach((s,i)=>{e===null&&s.type===p.nodes.table&&s.attrs.id===t&&(e=i)}),e}function E(n){let t=[];return n.forEach(e=>{e.type===p.nodes.table&&y(e.attrs.cols).length>1&&t.push(e)}),t.map(e=>({id:e.attrs.id,name:A(n,e.attrs.id),rows:e.childCount}))}function at(n){let t=y(n.attrs.cols);if(!t.length)return null;let e=M(n),s=t.find(a=>e[a]!=="number")??t[0],i=t.filter(a=>a!==s&&e[a]==="number");return{x:s,series:i.length?i:t.filter(a=>a!==s).slice(0,1)}}function l(n,t,e,s=null){let i=n.createElement(t);return e&&(i.className=e),s!==null&&(i.textContent=s),i}function C(n,t,e,s=!1){let i=l(n,"option","",e);return i.value=t,i.selected=s,i}function T(n,t,e){let s=l(n,"select","page-chart-select");return s.dataset.field=t,s.setAttribute("aria-label",e),s}var Y=class{constructor(t,e,s){this.node=t,this.view=e,this.getPos=s,this.source=void 0,this.tables=null,this.frame=null,this.unsaved=null,this.titleInput=null;let i=e.dom.ownerDocument;this.doc=i,this.dom=i.createElement("figure"),this.dom.className="page-chart",this.dom.dataset.id=t.attrs.id??"",this.dom.dataset.type="chart",this.head=l(i,"div","page-chart-head"),this.head.contentEditable="false",this.title=l(i,"span","page-chart-title"),this.chip=l(i,"button","page-chart-source"),this.chip.type="button",this.chip.contentEditable="false",this.chip.setAttribute("aria-label","Go to source table"),this.chip.innerHTML=Z,this.chipName=l(i,"span","page-chart-source-name"),this.chip.append(this.chipName),this.chip.addEventListener("click",()=>this.goToSource()),this.edit=l(i,"button","page-chart-edit"),this.edit.type="button",this.edit.contentEditable="false",this.edit.setAttribute("aria-haspopup","dialog"),this.edit.setAttribute("aria-expanded","false"),this.edit.innerHTML=tt,this.edit.append("Edit chart"),this.edit.addEventListener("click",()=>this.panel.isConnected?this.closePanel(!0):this.openPanel()),this.head.append(this.title,this.chip,this.edit),this.plot=l(i,"div","page-chart-plot"),this.broken=l(i,"div","page-chart-broken"),this.broken.hidden=!0,this.broken.contentEditable="false",this.brokenKey=null,this.brokenSelect=null,this.broken.addEventListener("click",a=>this.brokenClick(a)),this.panel=l(i,"div","page-chart-panel"),this.panel.tabIndex=-1,this.panel.contentEditable="false",this.panel.setAttribute("role","dialog"),this.panel.setAttribute("aria-label","Chart settings"),this.panel.addEventListener("click",a=>this.panelClick(a)),this.panel.addEventListener("change",a=>this.panelChange(a)),this.panel.addEventListener("mousedown",a=>{a.target.closest?.("button")&&a.preventDefault()}),this.outside=a=>{!this.panel.isConnected||this.dom.contains(a.target)||(this.commitTitle(),this.closePanel())},this.escape=a=>{!this.panel.isConnected||a.key!=="Escape"||(a.preventDefault(),a.stopPropagation(),this.closePanel(!0))},i.addEventListener("mousedown",this.outside,!0),i.addEventListener("keydown",this.escape,!0),this.dom.append(this.head,this.plot,this.broken),S.has(e)||S.set(e,new Set),S.get(e).add(this),this.refresh(),D.delete(t.attrs.id)&&this.openSoon()}refresh(){this.renderHead(),this.panel.isConnected&&this.panelKey()!==this.renderedKey&&this.redrawPanel();let t=this.view.state.doc,e=g(t,this.node.attrs.source),s=E(t).map(i=>`${i.id}:${i.name}:${i.rows}`).join("|");e===this.source&&s===this.tables||(this.source=e,this.tables=s,this.schedule())}schedule(){if(this.frame!==null)return;let t=this.dom.ownerDocument.defaultView,e=t.requestAnimationFrame?.bind(t)??(s=>t.setTimeout(s,0));this.frame=e(()=>{this.frame=null,this.draw()})}draw(){let t=this.node.attrs,e=j({id:t.id,type:t.kind,x:t.x,series:t.series,title:t.title,highlight:t.highlight},N(this.source));this.plot.innerHTML=U(e,{width:640,height:320,narrow:this.dom.getBoundingClientRect().width<480}),this.renderBroken(e)}renderBroken(t){let e=t.state==="missing"&&t.reason==="table";if(this.plot.hidden=e,this.broken.hidden=!e,!e){this.brokenKey!==null&&(this.broken.textContent="",this.brokenKey=null,this.brokenSelect=null);return}let s=E(this.view.state.doc),i=s.map(h=>`${h.id}:${h.name}:${h.rows}`).join("|");if(this.brokenKey===i)return;this.brokenKey=i,this.brokenSelect=null;let a=this.doc;this.broken.textContent="",this.broken.append(l(a,"div","page-chart-broken-head","This chart's table was deleted"),l(a,"p","page-chart-broken-text","Pick another table in this document, or delete the chart. Undo brings the table back."));let r=l(a,"div","page-chart-broken-actions");if(s.length){let h=T(a,"rescue","Source table");for(let d of s)h.append(C(a,d.id,`${d.name} (${d.rows} ${d.rows===1?"row":"rows"})`));this.brokenSelect=h;let f=l(a,"button","page-chart-use","Use this table");f.type="button",f.dataset.action="use",r.append(h,f)}let c=l(a,"button","page-chart-delete","Delete chart");c.type="button",c.dataset.action="delete",r.append(c),this.broken.append(r)}brokenClick(t){let e=t.target.closest?.("button[data-action]");e&&(e.dataset.action==="delete"?this.removeChart():e.dataset.action==="use"&&this.switchSource(this.brokenSelect?.value??""))}openSoon(){let t=this.dom.ownerDocument.defaultView;(t.requestAnimationFrame?.bind(t)??(s=>t.setTimeout(s,0)))(()=>{!this.view.isDestroyed&&this.dom.isConnected&&this.openPanel()})}renderHead(){let t=this.node.attrs,e=A(this.view.state.doc,t.source),s=!g(this.view.state.doc,t.source);this.title.textContent=t.title||it,this.title.classList.toggle("is-empty",!t.title),this.chipName.textContent=s?"No table":e??"",this.chip.disabled=s}setAttrs(t){let e=this.getPos();if(e==null)return;let s=this.view.state.doc.nodeAt(e);s?.type===p.nodes.chart&&this.view.dispatch(this.view.state.tr.setNodeMarkup(e,null,{...s.attrs,...t}))}row(t,...e){let s=l(this.doc,"div","page-chart-row");return t&&s.append(l(this.doc,"span","page-chart-label",t)),s.append(...e),s}panelKey(){let t=this.view.state.doc,e=E(t).map(s=>`${s.id}:${s.name}:${s.rows}`).join("|");return JSON.stringify([this.node.attrs,e,N(g(t,this.node.attrs.source))])}redrawPanel(){let t=this.doc.activeElement,e=t&&this.panel.contains(t)?t.dataset??{}:null,s=this.titleInput,i=s&&s.value!==this.renderedTitle?{value:s.value,start:s.selectionStart,end:s.selectionEnd}:null;if(this.renderPanel(),i&&this.titleInput&&(this.titleInput.value=i.value),!e)return;let a=[...this.panel.querySelectorAll("button, input, select")].find(r=>["field","kind","col","action"].every(c=>r.dataset[c]===e[c]));if(!a)return this.panel.focus();a.focus(),i&&a===this.titleInput&&a.setSelectionRange?.(i.start,i.end)}renderPanel(){let t=this.doc;this.renderedKey=this.panelKey(),this.renderedTitle=this.node.attrs.title??"";let e=this.node.attrs,s=N(this.source),i=s?.cols??[],a=s?.rows??[],r=e.kind==="pie";this.unsaved?.dispose(),this.unsaved=null,this.titleInput=null,this.panel.textContent="";let c=l(t,"div","page-chart-types");for(let[o,P]of st){let b=l(t,"button","page-chart-type",P);b.type="button",b.dataset.kind=o,b.setAttribute("aria-pressed",String(e.kind===o)),c.append(b)}this.panel.append(this.row("Chart type",c));let h=T(t,"source","Source table");for(let o of E(this.view.state.doc))h.append(C(t,o.id,`${o.name} (${o.rows} ${o.rows===1?"row":"rows"})`,o.id===e.source));this.panel.append(this.row("Source table",h));let f=T(t,"labels","Labels column");for(let o of i)f.append(C(t,o.id,o.name||o.id,o.id===e.x));this.panel.append(this.row("Labels column",f));let d=l(t,"div","page-chart-values");i.filter(o=>o.id!==e.x).forEach((o,P)=>{let b=l(t,"label","page-chart-value"),v=l(t,"input");v.type="checkbox",v.dataset.field="series",v.dataset.col=o.id,v.checked=e.series.includes(o.id);let I=l(t,"span","page-chart-swatch");I.style.background=`var(--chart-${P%6+1})`,I.setAttribute("aria-hidden","true"),b.append(v,I,l(t,"span","page-chart-value-name",o.name||o.id)),d.append(b)});let w=this.row(r?"Value column":"Value columns",d);r&&w.append(l(t,"span","page-chart-hint","Pie charts plot the first value column across rows.")),this.panel.append(w);let m=T(t,"highlight","Highlight row");m.append(C(t,"","None",!e.highlight));for(let o of a)m.append(C(t,o.id,O(o.cells?.[e.x])||o.id,o.id===e.highlight));this.panel.append(this.row("Highlight row",m));let u=l(t,"input","page-chart-title-input");u.type="text",u.dataset.field="title",u.setAttribute("aria-label","Chart title"),u.value=e.title??"",u.addEventListener("keydown",o=>{o.isComposing||o.keyCode===229||o.key==="Enter"&&(o.preventDefault(),o.stopPropagation(),this.commitTitle())}),u.addEventListener("change",()=>this.commitTitle()),u.addEventListener("blur",()=>this.commitTitle()),this.titleInput=u,this.panel.append(this.row("Chart title",u));let H=l(t,"div","page-chart-foot"),k=l(t,"button","page-chart-remove");k.type="button",k.dataset.action="remove",k.innerHTML=et,k.append("Remove");let L=l(t,"button","page-chart-done","Done");L.type="button",L.dataset.action="done",H.append(k,L),this.panel.append(H),this.unsaved=K({id:"chart-title",isPending:()=>u.isConnected&&u.value!==(this.node.attrs.title??"")})}openPanel(){this.panel.isConnected||(this.renderPanel(),this.dom.append(this.panel),this.edit.setAttribute("aria-expanded","true"),this.panel.focus())}closePanel(t=!1){this.panel.isConnected&&(this.unsaved?.dispose(),this.unsaved=null,this.titleInput=null,this.panel.remove(),this.edit.setAttribute("aria-expanded","false"),t&&this.edit.focus())}panelClick(t){let e=t.target.closest?.("button");e&&(e.dataset.action==="done"?(this.commitTitle(),this.closePanel(!0)):e.dataset.action==="remove"?this.removeChart():e.dataset.kind&&this.setAttrs({kind:e.dataset.kind}))}panelChange(t){let e=t.target;if(e?.dataset){if(e.dataset.field==="source")this.switchSource(e.value);else if(e.dataset.field==="labels")this.setAttrs({x:e.value,series:this.node.attrs.series.filter(s=>s!==e.value)});else if(e.dataset.field==="highlight")this.setAttrs({highlight:e.value||null});else if(e.dataset.field==="series"){let s=this.node.attrs.series.filter(i=>i!==e.dataset.col);this.setAttrs({series:e.checked?[...s,e.dataset.col]:s})}}}switchSource(t){let e=g(this.view.state.doc,t),s=e?at(e):null;s&&this.setAttrs({source:t,x:s.x,series:s.series})}commitTitle(){let t=this.titleInput;!t||t.value===(this.node.attrs.title??"")||this.setAttrs({title:t.value})}goToSource(){let t=this.view.state.doc,e=nt(t,this.node.attrs.source),s=e===null?null:t.nodeAt(e);if(!s?.childCount||!s.child(0).childCount)return;let i=e+3;this.view.dispatch(this.view.state.tr.setSelection(J.create(t,i)).scrollIntoView()),this.view.focus?.()}removeChart(){let t=this.getPos();if(t==null)return;let e=this.view.state.doc.nodeAt(t);if(e?.type!==p.nodes.chart)return;this.closePanel();let s=this.view.state.tr.delete(t,t+e.nodeSize);s.setSelection(J.near(s.doc.resolve(Math.min(t,s.doc.content.size)),-1)),this.view.dispatch(G(s).scrollIntoView())}update(t){if(t.type!==p.nodes.chart)return!1;let e=!t.sameMarkup(this.node);return this.node=t,this.dom.dataset.id=t.attrs.id??"",e&&(this.source=g(this.view.state.doc,t.attrs.source),this.renderHead(),this.schedule()),!0}stopEvent(t){return!!t.target.closest?.(".page-chart-head, .page-chart-panel")}destroy(){if(this.unsaved?.dispose(),this.unsaved=null,this.doc.removeEventListener("mousedown",this.outside,!0),this.doc.removeEventListener("keydown",this.escape,!0),S.get(this.view)?.delete(this),this.frame!==null){let t=this.dom.ownerDocument.defaultView;t.cancelAnimationFrame?t.cancelAnimationFrame(this.frame):t.clearTimeout(this.frame)}}};function vt(n){for(let t of S.get(n)??[])t.refresh()}export{wt as a,X as b,kt as c,Y as d,vt as e};
@@ -1,4 +1,4 @@
1
- import{b as We}from"./c-HAWFNBYG.js";import{a as Ye,f as $e}from"./c-HDWZEJHM.js";import{a as qe}from"./c-AQLFEATB.js";import{a as Ge}from"./c-AQYCG7QW.js";import{b as je}from"./c-QY7F6EN6.js";import{c as _e}from"./c-MHI3GYKF.js";import{b as Ke,c as Ve}from"./c-OI2BYWVV.js";import{a as Fe}from"./c-I2SCCUEW.js";import{d as Ne}from"./c-XGH4GS2T.js";import"./c-3O7OBDCM.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var xt=/^[a-z][a-z0-9+.-]*:/i,wt=["noindex","nofollow"],kt=["ogTitle","ogDescription","ogImage","ogImageAlt","siteName"],m=e=>e==null?"":String(e),O=e=>m(e).trim()!=="",T=e=>e.head||e.querySelector("head"),I=(e,t,o)=>Array.from(T(e).querySelectorAll("meta")).filter(i=>m(i.getAttribute(t)).trim().toLowerCase()===o),se=(e,t)=>Array.from(T(e).querySelectorAll("link")).filter(o=>m(o.getAttribute("rel")).trim().toLowerCase().split(/\s+/).includes(t)),ce=e=>Array.from(T(e).querySelectorAll("title")),pe=e=>I(e,"name","robots"),w=e=>e.remove();function $(e,t,o){let i=e.createElement("meta");return i.setAttribute(t,o),T(e).appendChild(i),i}function Et(e,t){let o=e.createElement("link");return o.setAttribute("rel",t),T(e).appendChild(o),o}function de(e,t,o,i){(I(e,t,o)[0]||$(e,t,o)).setAttribute("content",i)}function C(e,t,{trim:o=!1}={}){let i=c=>I(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(!O(p)){f.forEach(w);return}(f[0]||$(c,e,t)).setAttribute("content",o?p.trim():p),f.slice(1).forEach(w)}}}var Je=e=>m(e.getAttribute("content")).split(",").map(t=>t.trim()).filter(Boolean);function At(e,t){let o=pe(e),i=(o[0]?Je(o[0]):[]).filter(p=>!wt.includes(p.toLowerCase())),c=[];t.index===!1&&c.push("noindex"),t.follow===!1&&c.push("nofollow");let d=c.concat(i);if(!d.length){o.forEach(w);return}(o[0]||$(e,"name","robots")).setAttribute("content",d.join(", ")),o.slice(1).forEach(w)}function Xe(e){let t=e==="noindex"?"index":"follow",o=t==="index"?"follow":"index";return{find:pe,read(i){let c=pe(i)[0];return c?!Je(c).some(d=>d.toLowerCase()===e):!0},write(i,c){let d={index:!0,follow:!0};d[t]=!!c,d[o]=x[o].read(i),At(i,d)}}}var Lt={find:ce,read(e){let t=ce(e)[0];return t?m(t.textContent):""},write(e,t){let o=ce(e),i=m(t);if(!O(i)){o.forEach(w);return}let c=o[0]||e.createElement("title");o.length||T(e).appendChild(c),c.textContent=i,o.slice(1).forEach(w)}},St={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 o=e.documentElement;if(!o)return;let i=m(t);if(!O(i)){o.removeAttribute("lang");return}o.setAttribute("lang",i.trim())}},Ct={find:e=>se(e,"canonical"),read(e){let t=se(e,"canonical")[0];return t?m(t.getAttribute("href")):""},write(e,t){let o=se(e,"canonical"),i=m(t);if(!O(i)){o.forEach(w);return}(o[0]||Et(e,"canonical")).setAttribute("href",i.trim()),o.slice(1).forEach(w)}},Y="clay-seo-title-mode",Ot={find:e=>I(e,"name",Y),read(e){return I(e,"name",Y).some(o=>m(o.getAttribute("content")).trim().toLowerCase()==="custom")?"custom":"derived"},write(e,t){let o=I(e,"name",Y);if(m(t).trim().toLowerCase()!=="custom"){o.forEach(w);return}(o[0]||$(e,"name",Y)).setAttribute("content","custom"),o.slice(1).forEach(w)}},x={title:Lt,description:C("name","description"),lang:St,canonical:Ct,index:Xe("noindex"),follow:Xe("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:Ot},Qe=Object.fromEntries(Object.keys(x).map(e=>[e,{read:x[e].read,write:x[e].write}]));function Ze(e){let t=e.hostname.toLowerCase();return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"}function ue(e){try{return new URL(e)}catch{return null}}function fe(e){return e.protocol==="http:"||e.protocol==="https:"}function et(e){let t=e.location&&e.location.href||e.URL||e.baseURI||"",o=ue(t);return!o||!fe(o)||Ze(o)?"":o.origin+o.pathname}function tt(e){let t=m(e).trim();if(!t)return"";let o=ue(t);return!o||!fe(o)?"Enter a full http: or https: address.":Ze(o)?"A localhost address cannot be a canonical URL.":""}function It(e,t){let o=m(e).trim();if(!o)return"";if(xt.test(o)){let i=ue(o);return!i||!fe(i)?"Use an http: or https: image address.":""}if(t)try{new URL(o,t)}catch{return"Use an http: or https: image address."}return""}function ot(e,t){let o=("canonical"in t?m(t.canonical).trim():x.canonical.read(e)).trim();return o&&!tt(o)?o:""}function Ut(e,t){let o=kt.some(d=>d in t&&O(t[d])),i="canonical"in t&&O(t.canonical);if(!o&&!i&&!("ogImage"in t))return;if(o||i){I(e,"property","og:type").length||de(e,"property","og:type","website");let d=ot(e,t)||et(e);d&&de(e,"property","og:url",d)}let c="ogImage"in t?t.ogImage:x.ogImage.read(e);de(e,"name","twitter:card",O(c)?"summary_large_image":"summary")}function H(e){let t={},o={};for(let i of Object.keys(x)){let c=x[i];t[i]=c.read(e),o[i]=c.find(e).length>0}return{values:t,present:o}}function G(e,t){let o=t||{},i=Object.keys(x).filter(p=>p in o),c={};if(i.includes("canonical")){let p=tt(o.canonical);p&&(c.canonical=p)}if(i.includes("ogImage")){let p=ot(e,o)||et(e),h=It(o.ogImage,p);h&&(c.ogImage=h)}if(Object.keys(c).length)return{normalized:[],errors:c};let d=[],f=new Set;for(let p of i){let h=x[p].find;h(e).length>1&&!f.has(h)&&(f.add(h),d.push(p))}for(let p of i)x[p].write(e,o[p]);return Ut(e,o),{normalized:d,errors:{}}}var nt="reopen-seo",zt="SEO and social sharing",Tt="SEO settings",it="SEO settings applied",dt=/^[a-z][a-z0-9+.-]*:/i,Mt="This site is hidden from search engines in your account settings, so this page stays hidden whatever you choose here.",Rt="Uploaded images are public to anyone with the link.",Pt="Paste the address of an image on the web.",Bt={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"}},Dt=["title","description","ogTitle","ogDescription","ogImage"],Ht=["canonical","lang","ogImageAlt","siteName","twitterSite"],Nt=["index","follow"],_t=`.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 We}from"./c-HAWFNBYG.js";import{a as Ye,d as $e}from"./c-CRPIDGXC.js";import"./c-OPONJ2UK.js";import{a as qe}from"./c-AQLFEATB.js";import{a as Ge}from"./c-AQYCG7QW.js";import{b as je}from"./c-QY7F6EN6.js";import{c as _e}from"./c-PKCCHJ5X.js";import{b as Ke,c as Ve}from"./c-LCYPMULG.js";import{a as Fe}from"./c-I2SCCUEW.js";import{d as Ne}from"./c-XGH4GS2T.js";import"./c-3O7OBDCM.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var xt=/^[a-z][a-z0-9+.-]*:/i,wt=["noindex","nofollow"],kt=["ogTitle","ogDescription","ogImage","ogImageAlt","siteName"],m=e=>e==null?"":String(e),O=e=>m(e).trim()!=="",T=e=>e.head||e.querySelector("head"),I=(e,t,o)=>Array.from(T(e).querySelectorAll("meta")).filter(i=>m(i.getAttribute(t)).trim().toLowerCase()===o),se=(e,t)=>Array.from(T(e).querySelectorAll("link")).filter(o=>m(o.getAttribute("rel")).trim().toLowerCase().split(/\s+/).includes(t)),ce=e=>Array.from(T(e).querySelectorAll("title")),pe=e=>I(e,"name","robots"),w=e=>e.remove();function $(e,t,o){let i=e.createElement("meta");return i.setAttribute(t,o),T(e).appendChild(i),i}function Et(e,t){let o=e.createElement("link");return o.setAttribute("rel",t),T(e).appendChild(o),o}function de(e,t,o,i){(I(e,t,o)[0]||$(e,t,o)).setAttribute("content",i)}function C(e,t,{trim:o=!1}={}){let i=c=>I(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(!O(p)){f.forEach(w);return}(f[0]||$(c,e,t)).setAttribute("content",o?p.trim():p),f.slice(1).forEach(w)}}}var Je=e=>m(e.getAttribute("content")).split(",").map(t=>t.trim()).filter(Boolean);function At(e,t){let o=pe(e),i=(o[0]?Je(o[0]):[]).filter(p=>!wt.includes(p.toLowerCase())),c=[];t.index===!1&&c.push("noindex"),t.follow===!1&&c.push("nofollow");let d=c.concat(i);if(!d.length){o.forEach(w);return}(o[0]||$(e,"name","robots")).setAttribute("content",d.join(", ")),o.slice(1).forEach(w)}function Xe(e){let t=e==="noindex"?"index":"follow",o=t==="index"?"follow":"index";return{find:pe,read(i){let c=pe(i)[0];return c?!Je(c).some(d=>d.toLowerCase()===e):!0},write(i,c){let d={index:!0,follow:!0};d[t]=!!c,d[o]=x[o].read(i),At(i,d)}}}var Lt={find:ce,read(e){let t=ce(e)[0];return t?m(t.textContent):""},write(e,t){let o=ce(e),i=m(t);if(!O(i)){o.forEach(w);return}let c=o[0]||e.createElement("title");o.length||T(e).appendChild(c),c.textContent=i,o.slice(1).forEach(w)}},St={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 o=e.documentElement;if(!o)return;let i=m(t);if(!O(i)){o.removeAttribute("lang");return}o.setAttribute("lang",i.trim())}},Ct={find:e=>se(e,"canonical"),read(e){let t=se(e,"canonical")[0];return t?m(t.getAttribute("href")):""},write(e,t){let o=se(e,"canonical"),i=m(t);if(!O(i)){o.forEach(w);return}(o[0]||Et(e,"canonical")).setAttribute("href",i.trim()),o.slice(1).forEach(w)}},Y="clay-seo-title-mode",Ot={find:e=>I(e,"name",Y),read(e){return I(e,"name",Y).some(o=>m(o.getAttribute("content")).trim().toLowerCase()==="custom")?"custom":"derived"},write(e,t){let o=I(e,"name",Y);if(m(t).trim().toLowerCase()!=="custom"){o.forEach(w);return}(o[0]||$(e,"name",Y)).setAttribute("content","custom"),o.slice(1).forEach(w)}},x={title:Lt,description:C("name","description"),lang:St,canonical:Ct,index:Xe("noindex"),follow:Xe("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:Ot},Qe=Object.fromEntries(Object.keys(x).map(e=>[e,{read:x[e].read,write:x[e].write}]));function Ze(e){let t=e.hostname.toLowerCase();return t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"}function ue(e){try{return new URL(e)}catch{return null}}function fe(e){return e.protocol==="http:"||e.protocol==="https:"}function et(e){let t=e.location&&e.location.href||e.URL||e.baseURI||"",o=ue(t);return!o||!fe(o)||Ze(o)?"":o.origin+o.pathname}function tt(e){let t=m(e).trim();if(!t)return"";let o=ue(t);return!o||!fe(o)?"Enter a full http: or https: address.":Ze(o)?"A localhost address cannot be a canonical URL.":""}function It(e,t){let o=m(e).trim();if(!o)return"";if(xt.test(o)){let i=ue(o);return!i||!fe(i)?"Use an http: or https: image address.":""}if(t)try{new URL(o,t)}catch{return"Use an http: or https: image address."}return""}function ot(e,t){let o=("canonical"in t?m(t.canonical).trim():x.canonical.read(e)).trim();return o&&!tt(o)?o:""}function Ut(e,t){let o=kt.some(d=>d in t&&O(t[d])),i="canonical"in t&&O(t.canonical);if(!o&&!i&&!("ogImage"in t))return;if(o||i){I(e,"property","og:type").length||de(e,"property","og:type","website");let d=ot(e,t)||et(e);d&&de(e,"property","og:url",d)}let c="ogImage"in t?t.ogImage:x.ogImage.read(e);de(e,"name","twitter:card",O(c)?"summary_large_image":"summary")}function H(e){let t={},o={};for(let i of Object.keys(x)){let c=x[i];t[i]=c.read(e),o[i]=c.find(e).length>0}return{values:t,present:o}}function G(e,t){let o=t||{},i=Object.keys(x).filter(p=>p in o),c={};if(i.includes("canonical")){let p=tt(o.canonical);p&&(c.canonical=p)}if(i.includes("ogImage")){let p=ot(e,o)||et(e),h=It(o.ogImage,p);h&&(c.ogImage=h)}if(Object.keys(c).length)return{normalized:[],errors:c};let d=[],f=new Set;for(let p of i){let h=x[p].find;h(e).length>1&&!f.has(h)&&(f.add(h),d.push(p))}for(let p of i)x[p].write(e,o[p]);return Ut(e,o),{normalized:d,errors:{}}}var nt="reopen-seo",zt="SEO and social sharing",Tt="SEO settings",it="SEO settings applied",dt=/^[a-z][a-z0-9+.-]*:/i,Mt="This site is hidden from search engines in your account settings, so this page stays hidden whatever you choose here.",Rt="Uploaded images are public to anyone with the link.",Pt="Paste the address of an image on the web.",Bt={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"}},Dt=["title","description","ogTitle","ogDescription","ogImage"],Ht=["canonical","lang","ogImageAlt","siteName","twitterSite"],Nt=["index","follow"],_t=`.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{a as w}from"./c-UGNV5MFB.js";import{b as m,c as v}from"./c-ZSCBEB7I.js";import"./c-VKEDWYDF.js";import{m as f,o as y}from"./c-3O7OBDCM.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-EGTIAL6P.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var L="script[editmode\\:resource]";function d(e=document){let t=[...e.querySelectorAll(L)];return{reversible:t.length===0,scripts:t}}function R(e=document){return{enable(){m(e)},quiesce(){},resume(){},dispose(){v()}}}function g(e=document){return{id:"clay:resources",order:100,prepare(){let{reversible:t}=d(e);if(!t)throw Object.assign(new Error("clay.modeLifecycle: an editmode:resource script cannot be re-run"),{code:"unsupported-plugin"});return R(e)}}}var b=!1,S=()=>{let e=new Set;for(let t of f()){if(typeof t?.then=="function")continue;let n=t?.id;if(typeof n!="string"||typeof t?.prepare!="function"||e.has(n))return!1;e.add(n)}return!0},j=e=>[...e?.edit?.core??[],...e?.edit?.plugins??[],...e?.edit?.late??[],...e?.view?.plugins??[],...e?.view?.late??[]];function A(e){return[...new Set(j(e))].filter(t=>w(t)===null)}function T(e){return S()&&A(e).length===0&&d().reversible}function _(){b||(b=!0,y(g()))}var l=()=>Object.assign(new Error("clay.modeLifecycle: the import was cancelled"),{name:"AbortError",code:"aborted"}),O=15e3,E=(e,t)=>Object.assign(new Error(`clayjs: ${e}`),{code:t}),q=(e,t)=>new Promise((n,s)=>{if(t?.aborted)return s(l());let o=()=>s(l());t?.addEventListener?.("abort",o),Promise.resolve(e).then(i=>{t?.removeEventListener?.("abort",o),n(i)},i=>{t?.removeEventListener?.("abort",o),s(i)})}),h=e=>!e?.represented||e.represented.bytes===null,P=e=>e&&(e.liveSync??e.default??e)||null;async function k(e,t={}){let n=t.signal,s={signal:n,deadline:O},o=e?.loaded?.["plugins/page-view.js"];if(o?.ready){await q(o.acquired,n);let a=await o.prepareHandoff(s);if(h(a))throw E("the reader has no file to hand over","not-acquired");return a}let i=P(e?.loaded?.["sync/live-sync.js"]);if(i&&!i.isDestroyed&&i.lane==="saved"){let a=await i.prepareHandoff(s);if(h(a))throw E("the reader has no file to hand over","not-acquired");return a}return null}function I(e,t=null){let n=e?.loaded?.["plugins/page-view.js"],s=Array.isArray(e?.view?.plugins)?e.view.plugins.includes("sync/live-sync.js"):!!e?.loaded?.["sync/live-sync.js"];if(n&&((n.restart??n.start)({sync:s,represented:t}),!s))return;let o=P(e?.loaded?.["sync/live-sync.js"]);if(o)return o.start(o.currentFile,{lane:"saved",represented:t})}async function V(e,t,{signal:n}={}){let s=e.inflight||=new Map,o=[],i=()=>{if(n?.aborted)throw l()},a=e.loadEditHints?.();if(a)try{await a}catch{}let u=r=>{if(!s.has(r)){let c=Promise.resolve().then(()=>e.modules[r]()).catch(x=>{throw s.delete(r),x});s.set(r,c)}return s.get(r)};for(let r of t.core??[]){if(e.loaded[r])continue;i();let c=await u(r);e.loaded[r]=c,c.install?.()}e.attachEditCore(e.loaded);for(let r of t.plugins??[]){if(e.loaded[r])continue;i();let c=await u(r);e.loaded[r]=c,e.attach(r,c),o.push(r)}let p=(t.late??[]).filter(r=>!e.loaded[r]);if(p.length){i();try{await e.late}catch{}for(let r of p){if(e.loaded[r])continue;i();let c=await u(r);e.loaded[r]=c,e.attach(r,c),o.push(r)}}return o}export{V as importPlan,T as liveAllowed,_ as openResources,k as prepareReader,I as startReader,A as unsupportedPaths};
1
+ import{a as w}from"./c-UGNV5MFB.js";import{b as m,c as v}from"./c-UHUNXWKN.js";import"./c-VKEDWYDF.js";import{m as f,o as y}from"./c-3O7OBDCM.js";import"./c-BPF2NSPV.js";import"./c-P7KNDG34.js";import"./c-CYWLPPUS.js";import"./c-N7JPUPGC.js";import"./c-PWJSJEJU.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var L="script[editmode\\:resource]";function d(e=document){let t=[...e.querySelectorAll(L)];return{reversible:t.length===0,scripts:t}}function R(e=document){return{enable(){m(e)},quiesce(){},resume(){},dispose(){v()}}}function g(e=document){return{id:"clay:resources",order:100,prepare(){let{reversible:t}=d(e);if(!t)throw Object.assign(new Error("clay.modeLifecycle: an editmode:resource script cannot be re-run"),{code:"unsupported-plugin"});return R(e)}}}var b=!1,S=()=>{let e=new Set;for(let t of f()){if(typeof t?.then=="function")continue;let n=t?.id;if(typeof n!="string"||typeof t?.prepare!="function"||e.has(n))return!1;e.add(n)}return!0},j=e=>[...e?.edit?.core??[],...e?.edit?.plugins??[],...e?.edit?.late??[],...e?.view?.plugins??[],...e?.view?.late??[]];function A(e){return[...new Set(j(e))].filter(t=>w(t)===null)}function T(e){return S()&&A(e).length===0&&d().reversible}function _(){b||(b=!0,y(g()))}var l=()=>Object.assign(new Error("clay.modeLifecycle: the import was cancelled"),{name:"AbortError",code:"aborted"}),O=15e3,E=(e,t)=>Object.assign(new Error(`clayjs: ${e}`),{code:t}),q=(e,t)=>new Promise((n,s)=>{if(t?.aborted)return s(l());let o=()=>s(l());t?.addEventListener?.("abort",o),Promise.resolve(e).then(i=>{t?.removeEventListener?.("abort",o),n(i)},i=>{t?.removeEventListener?.("abort",o),s(i)})}),h=e=>!e?.represented||e.represented.bytes===null,P=e=>e&&(e.liveSync??e.default??e)||null;async function k(e,t={}){let n=t.signal,s={signal:n,deadline:O},o=e?.loaded?.["plugins/page-view.js"];if(o?.ready){await q(o.acquired,n);let a=await o.prepareHandoff(s);if(h(a))throw E("the reader has no file to hand over","not-acquired");return a}let i=P(e?.loaded?.["sync/live-sync.js"]);if(i&&!i.isDestroyed&&i.lane==="saved"){let a=await i.prepareHandoff(s);if(h(a))throw E("the reader has no file to hand over","not-acquired");return a}return null}function I(e,t=null){let n=e?.loaded?.["plugins/page-view.js"],s=Array.isArray(e?.view?.plugins)?e.view.plugins.includes("sync/live-sync.js"):!!e?.loaded?.["sync/live-sync.js"];if(n&&((n.restart??n.start)({sync:s,represented:t}),!s))return;let o=P(e?.loaded?.["sync/live-sync.js"]);if(o)return o.start(o.currentFile,{lane:"saved",represented:t})}async function V(e,t,{signal:n}={}){let s=e.inflight||=new Map,o=[],i=()=>{if(n?.aborted)throw l()},a=e.loadEditHints?.();if(a)try{await a}catch{}let u=r=>{if(!s.has(r)){let c=Promise.resolve().then(()=>e.modules[r]()).catch(x=>{throw s.delete(r),x});s.set(r,c)}return s.get(r)};for(let r of t.core??[]){if(e.loaded[r])continue;i();let c=await u(r);e.loaded[r]=c,c.install?.()}e.attachEditCore(e.loaded);for(let r of t.plugins??[]){if(e.loaded[r])continue;i();let c=await u(r);e.loaded[r]=c,e.attach(r,c),o.push(r)}let p=(t.late??[]).filter(r=>!e.loaded[r]);if(p.length){i();try{await e.late}catch{}for(let r of p){if(e.loaded[r])continue;i();let c=await u(r);e.loaded[r]=c,e.attach(r,c),o.push(r)}}return o}export{V as importPlan,T as liveAllowed,_ as openResources,k as prepareReader,I as startReader,A as unsupportedPaths};
@@ -0,0 +1 @@
1
+ import{a,b}from"./c-6TYGD5AB.js";import"./c-QHWJ5ZIJ.js";import"./c-G6COVIZB.js";import"./c-IHUWUKIU.js";import"./c-4JZDZFF6.js";import"./c-EUGJVHDD.js";import"./c-PKCCHJ5X.js";import"./c-46XYM55L.js";import"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";export{a as SURFACE_THEME,b as default};
@@ -1,3 +1,3 @@
1
- import{b as U}from"./c-ATKAOH23.js";import{a as oe,g as ie,h as C}from"./c-EK63G3CG.js";import{a as ne,b as re,c as M}from"./c-NQJRVJ56.js";import{d as w}from"./c-XGH4GS2T.js";import{c as V,e as q,g as Z}from"./c-IJUK2GPW.js";import{b as R,f as N}from"./c-3O7OBDCM.js";import{c as X}from"./c-BPF2NSPV.js";import{g as Y}from"./c-N7JPUPGC.js";import{a as k,g as Q,h as ee,i as te}from"./c-EGTIAL6P.js";var D=null,ae=null,A=null;function we(e){let t=e?.document?.maxBytes;return Number.isSafeInteger(t)&&t>0?t:null}function se(e){return D=we(e),ae=e?.document?.maxBytesMeasures==="file"?"file":null,D}var Ae=/<script\b[^>]*\bmerge=(["'])page\1[^>]*>[\s\S]*?<\/script\s*>/i;function F(e,t=ae){if(t!=="file"||typeof e!="string")return e;let n=Ae.exec(e);if(!n)return e;let o=n.index,s=o+n[0].length,r=e.lastIndexOf(`
1
+ import{b as U}from"./c-ATKAOH23.js";import{a as oe,g as ie,h as C}from"./c-EK63G3CG.js";import{a as ne,b as re,c as M}from"./c-NQJRVJ56.js";import{d as w}from"./c-XGH4GS2T.js";import{c as V,e as q,g as Z}from"./c-IJUK2GPW.js";import{b as R,f as N}from"./c-3O7OBDCM.js";import{c as X}from"./c-BPF2NSPV.js";import{g as Y}from"./c-N7JPUPGC.js";import{a as k,g as Q,h as ee,i as te}from"./c-PWJSJEJU.js";var D=null,ae=null,A=null;function we(e){let t=e?.document?.maxBytes;return Number.isSafeInteger(t)&&t>0?t:null}function se(e){return D=we(e),ae=e?.document?.maxBytesMeasures==="file"?"file":null,D}var Ae=/<script\b[^>]*\bmerge=(["'])page\1[^>]*>[\s\S]*?<\/script\s*>/i;function F(e,t=ae){if(t!=="file"||typeof e!="string")return e;let n=Ae.exec(e);if(!n)return e;let o=n.index,s=o+n[0].length,r=e.lastIndexOf(`
2
2
  `,o-1)+1,l=e.indexOf(`
3
- `,s),c=l===-1?e.length:l+1;return!/\S/.test(e.slice(r,o))&&!/\S/.test(e.slice(s,c))&&(o=r,s=c),e.slice(0,o)+e.slice(s)}function B(e,t){let n=new TextEncoder().encode(e).byteLength,o=Number.isSafeInteger(t)&&t>0;return{bytes:n,maxBytes:o?t:null,state:o?n>t?"over":n>=Math.ceil(t*.8)?"near":"ok":"unknown"}}function le(){return D}function P({fresh:e=!1}={}){return e?(A=w({fresh:!0}).then(se),A):(A||(A=w().then(se)),A)}function vt({fresh:e=!1}={}){return P({fresh:e}).then(t=>({maxBytes:t}))}async function yt(e){let t=await P();return B(F(e),t)}function ue(e){let t=new CustomEvent("clay:save-size",{detail:e});document.dispatchEvent(t),(e.state==="near"||e.state==="over")&&import("./c-6UEFPHHE.js").then(n=>n.start(t),()=>{})}var L="/_/clayjs/",Te=/[\u0000-\u001F\u007F]/,be=/^[\t\n\f\r ]|[\t\n\f\r ]$/,Oe=/^https:\/\/clayjs\.com\/v(\d+)\/([\s\S]*)$/,Ee=/^https:\/\/clayjs\.com\/(\d+)\.(\d+)\.(\d+)\/([\s\S]*)$/,ce=/^\/_\/clayjs\/(\d+)\.(\d+)\.(\d+)\/([\s\S]*)$/,$e=/%2e|%2f|%5c/i;function Re(e){if(typeof e!="string")return null;let t=/^(\d+)\.\d+\.\d+$/.exec(e);return t?t[1]:null}function ke(e){if(typeof e!="string"||e==="")return null;try{return new URL(e).origin}catch{return null}}function Me(e){let t=e.indexOf("#"),n=t<0?"":e.slice(t),o=t<0?e:e.slice(0,t),s=o.indexOf("?"),r=s<0?"":o.slice(s);return{head:s<0?o:o.slice(0,s),search:r,hash:n}}function Pe(e){if(e===""||e.includes("\\")||$e.test(e))return null;let t=e.split("/"),n=[];for(let o of t){if(o===""||o==="."||o==="..")return null;let s;try{s=decodeURIComponent(o)}catch{return null}if(s.includes("/")||s.includes("\\")||s==="."||s==="..")return null;n.push(s)}return n.join("/")}function T(e,{documentURL:t}={}){if(typeof e!="string"||e===""||be.test(e)||Te.test(e))return null;let{head:n,search:o,hash:s}=Me(e),r=null,l=null,c=null,u=null,i=Oe.exec(n);if(i&&(r="rolling",c=i[1],u=i[2]),r||(i=Ee.exec(n),i&&(r="exact",l=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],u=i[4])),r||(i=ce.exec(n),i&&(r="local",l=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],u=i[4])),!r){let d=ke(t);d&&n.startsWith(`${d}/`)&&(i=ce.exec(n.slice(d.length)),i&&(r="local",l=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],u=i[4]))}if(!r)return null;let a=Pe(u);return a===null?null:{kind:r,major:c,version:l,rawPath:u,path:a,search:o,hash:s}}function Le(e,t){let n=e&&typeof e=="object"?e[t]:null;return n&&typeof n.files=="object"&&n.files?n.files:null}function je(e){return!e||typeof e!="object"?[]:Array.isArray(e.entries)?e.entries.filter(t=>t&&typeof t=="object"):[]}function Ie(e,t,n){if(!n)return!0;let o=Le(n,t);return!!(o&&Object.hasOwn(o,e.path))}function fe(e,{descriptor:t,releases:n,documentURL:o,aliases:s}={}){let r=T(e,{documentURL:o});if(!r||r.kind!=="local")return e;let l=je(t),c=Re(r.version);for(let u of l){if(u.local!==e||typeof u.original!="string")continue;let i=n?.[r.version]?.aliases??s;if(i&&typeof i=="object"&&!r.search&&!r.hash&&Object.hasOwn(i,u.original)&&i[u.original]===r.path)return u.original;let a=T(u.original);if(a&&!(a.kind!=="rolling"&&a.kind!=="exact")&&a.rawPath===r.rawPath&&a.search===r.search&&a.hash===r.hash&&!(a.kind==="rolling"?a.major!==c:a.version!==r.version)&&Ie(r,r.version,n))return a.kind==="exact"?u.original:`https://clayjs.com/v${a.major}/${r.rawPath}${r.search}${r.hash}`}for(let u of l){if(typeof u.original!="string")continue;let i=T(u.original);if(i&&!(i.kind!=="rolling"&&i.kind!=="exact")&&i.rawPath===r.rawPath&&!(i.kind==="rolling"?i.major!==c:i.version!==r.version))return i.kind==="rolling"?`https://clayjs.com/v${i.major}/${r.rawPath}${r.search}${r.hash}`:`https://clayjs.com/${i.version}/${r.rawPath}${r.search}${r.hash}`}return`https://clayjs.com/${r.version}/${r.rawPath}${r.search}${r.hash}`}var _e=Object.freeze({"https://cdn.jsdelivr.net/npm/overtype@2.6.1/dist/overtype.min.js":"compat/overtype-2.6.1.min.js","https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js":"compat/highlight-11.9.0.min.js","https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,300;0,400;0,500;0,600;1,400;1,500&family=IBM+Plex+Sans:wght@400;500;600&display=swap":"fonts/ibm-plex.css"}),J="clay-runtime-map",Ne=new Set(["stylesheet","preload","modulepreload"]),de=null,H=null;function Ue(e){let t;try{t=JSON.parse(e)}catch{return null}return!t||typeof t!="object"||t.schema!==1?null:t}function Ce(){if(typeof document>"u")return null;let e=document.getElementById(J);if(!e)return null;let t=e.textContent??"";return t===de||(de=t,H=Ue(t)),H}var De=`script[src*="${L}"], link[href*="${L}"], #${J}`;function he(e){if(e.querySelector(De))return!0;for(let t of e.querySelectorAll("template"))if(he(t.content))return!0;return!1}function Fe(e){let t=[],n=[e];for(;n.length;){let o=n.pop();for(let s of o.children??[])t.push(s),n.push(s),s.content&&n.push(s.content)}return t}function Be(e){return e.tagName==="SCRIPT"&&e.hasAttribute("src")?"src":e.tagName!=="LINK"||!e.hasAttribute("href")?null:(e.getAttribute("rel")??"").toLowerCase().split(/\s+/).some(n=>Ne.has(n))?"href":null}function He(e){if(!e||!he(e))return;let t=[],n=!1;for(let r of Fe(e)){if(r.getAttribute("id")===J){r.remove();continue}let l=Be(r);l&&(t.push({element:r,name:l}),!n&&(r.getAttribute(l)??"").includes(L)&&(n=!0))}if(!n)return;let o=location.href,s=Ce();for(let{element:r,name:l}of t){let c=r.getAttribute(l),u=T(c,{documentURL:o});!u||u.kind!=="local"||r.setAttribute(l,fe(c,{descriptor:s,documentURL:o,aliases:_e}))}}te(He);var y=!1,E=null,pe="/_/save",ze=12e3,me=6e4,Ge=1024*1024,Se="text/plain;charset=UTF-8",j=null,$=!1,G=new Map;function Ft(e,t){t==null?G.delete(e):G.set(e,String(t))}async function Bt(e,t){$=!!e;try{return await t()}finally{$=!1}}function Ht(){return y}function Jt(){return y?null:(y=!0,E={reserved:!0},E)}function zt(e){!e||E!==e||(E=null,y=!1)}function Gt(){return $}var I=[],_=[];function Kt(e){return I.push(e),()=>{let t=I.indexOf(e);t>=0&&I.splice(t,1)}}function Wt(e){return _.push(e),()=>{let t=_.indexOf(e);t>=0&&_.splice(t,1)}}function Ke(e){for(let t of I)try{t(e)}catch(n){console.error("clayjs: onSaveAttempt hook failed:",n)}}function We(e){for(let t of _)try{t(e)}catch(n){console.error("clayjs: onSaveOutcome hook failed:",n)}}function ge(e){return{ok:!0,msg:e.msg??"Saved",msgType:e.msgType||"success",code:e.code??null,etag:e.etag??null}}var b=[],Xe=8,v=null;function Xt(){return v!==null}function ve(){let e=window.crypto?.randomUUID?.();if(e)return e;if(window.crypto?.getRandomValues){let n=new Uint8Array(16);return window.crypto.getRandomValues(n),Array.from(n,o=>o.toString(16).padStart(2,"0")).join("")}let t=()=>Math.random().toString(36).slice(2,12).padEnd(10,"0");return`${Date.now().toString(36)}-${t()}${t()}${t()}`}function Ye(e){b.push(e),b.length>Xe&&b.shift()}function Ve(e){return typeof e=="string"&&e!==""&&b.includes(e)}function Yt(){b.length=0,v=null}function K(e){let t=e.name==="AbortError",n=!t&&e.status===412,o=!t&&!n&&e.code==="save-already-applied";return{ok:!1,msg:t?"Server not responding":e.message||"Save failed",msgType:t||o?"unknown":n?"conflict":"error",code:t?"timeout":n?"conflict":e.code??null,changedBy:n?e.changedBy??null:null,afterTimeout:n&&v!==null,conflictEtag:n?e.etag??null:null,status:Number.isInteger(e.status)?e.status:null,hadTimeout:t||e.hadTimeout===!0,reason:e.reason??null,retryAfter:e.retryAfter??null,saveOutcome:e.saveOutcome??null,etag:null}}function O(e){return{ok:!1,msg:e,msgType:"skipped",code:null,etag:null}}function qe(e){let t=new Error(`This document is ${e.bytes} bytes; this host saves at most ${e.maxBytes}`);return t.code="save-too-large",{...K(t),sent:!1,size:e}}var S=null;function Ze(e){return S?null:(S={kind:e},S)}function Qe(e){S===e&&(S=null)}function et(){return S?S.kind:null}function tt(){return{ok:!1,msg:"Invalid page conversion metadata",msgType:"error",code:"invalid-header",etag:null}}var nt=3,rt=/^(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} \d{2}:\d{2}:\d{2} GMT|(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), \d{2}-(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\d{2} \d{2}:\d{2}:\d{2} GMT|(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (?: \d|\d{2}) \d{2}:\d{2}:\d{2} \d{4})$/;function ot(e){if(e==null)return null;let t=String(e).trim();if(!t)return null;if(/^-?\d+$/.test(t))return Math.max(0,Math.min(3600,Number(t)));if(!rt.test(t))return null;let n=Date.parse(t);return Number.isNaN(n)?null:Math.max(0,Math.min(3600,Math.round((n-Date.now())/1e3)))}var it=/^[0-9a-f]{64}$/,st=/^[A-Za-z0-9-]{1,64}$/;function at(e){if(e==null)return{header:null};if(typeof e!="object")return{invalid:!0};let{source:t,base:n,epoch:o}=e;return typeof n!="string"||!it.test(n)?{invalid:!0}:t==="file"?o!=null?{invalid:!0}:{header:`v1; source=file; base=${n}`}:t==="room"?typeof o!="string"||!st.test(o)?{invalid:!0}:{header:`v1; source=room; base=${n}; epoch=${o}`}:{invalid:!0}}function lt(e,t,n,o,s,r=!1,l=null){let c=X(),u=c?`${pe}/${c}`:pe,i={method:"POST",credentials:c?"omit":"same-origin",signal:n,headers:{"Document-URL":window.location.href,"Page-URL":window.location.href,"Save-Trigger":t?"user":"auto","Save-ID":o,[oe]:String(1)},body:ut(e)};for(let[a,d]of G)i.headers[a]=d;return typeof i.body!="string"&&(i.headers["Content-Type"]=Se),l&&(i.headers["Page-Conversion"]=l),s&&(i.headers["If-Match"]=s),r&&e.length<me&&new Blob([e]).size<me&&(i.keepalive=!0),{url:ct(u),options:i}}function ut(e){if(e.length<Ge)return e;if(j&&j.content===e)return j.blob;let t=new Blob([e],{type:Se});return j={content:e,blob:t},t}function ye(){let e=ne();return re()&&e?e:null}function ct(e){let t=window.location.origin;return!t||t==="null"?e:new URL(e,t).href}function z(e,t){let n=JSON.stringify(t);return{ok:e>=200&&e<300,status:e,statusText:e===200?"OK":"Insufficient Storage",text:()=>Promise.resolve(n)}}function ft(e){let t=Y();return t?Promise.resolve().then(()=>{try{return t(e),z(200,{msg:"Saved in this browser",msgType:"success"})}catch(n){return z(507,{msg:"Couldn't save in this browser. Storage is full or turned off.",msgType:"error",code:n.code||"draft-storage"})}}):Promise.resolve(z(503,{msg:"Saving in this browser is not ready yet",msgType:"error",code:"draft-not-ready"}))}function dt(e,t,n,{captureId:o=null,conversionHeader:s=null,attempts:r=[]}={}){let l=new AbortController,c=setTimeout(()=>l.abort(),ze),u=q(),i=Z(),a=u||i,d=$;$=!1;let{url:m,options:x}=lt(e,a,l.signal,t,n,d,s);return Ye(t),R||(r.some(f=>f.saveId===t&&f.etag===(n??null))||r.push({saveId:t,etag:n??null}),Ke({captureId:o,saveId:t,html:e,etag:n??null})),(R?ft(e):fetch(m,x)).then(f=>f.text().then(p=>{let h={};if(p)try{h=JSON.parse(p)}catch{if(f.ok)throw new Error("Server sent a response that was not JSON")}if(!f.ok){let g=new Error(h.msg||h.error||`HTTP ${f.status}: ${f.statusText}`);throw g.code=f.status===413?"save-too-large":h.code??null,g.status=f.status,g.changedBy=h.changedBy??null,g.etag=h.etag??null,g.saveId=h.saveId??null,g.reason=typeof h.reason=="string"?h.reason:null,g.saveOutcome=h.saveOutcome??null,g.retryAfter=ot(f.headers?.get?.("Retry-After")),g}return M(h.etag??null),v=null,h})).catch(f=>{throw console.error("Failed to save page:",f),f.name==="AbortError"&&(v={saveId:t,etag:n}),a&&V(),f}).finally(()=>{clearTimeout(c)})}async function ht(){let e=v;if(!e)return{landed:null,resend:!1};let n=(await w({fresh:!0})).document,o=typeof n?.etag=="string"&&n.etag?n.etag:null;return o?n.saveId&&n.saveId===e.saveId?(M(o),v=null,{landed:{msg:"Saved",msgType:"success",etag:o},resend:!1}):(n.saveId&&(v=null),{landed:null,resend:!!e.etag,etag:e.etag}):{landed:null,resend:!1}}async function pt(e,{captureId:t=null,conversionHeader:n=null,attempts:o=[]}={}){let s=ve(),r=ye(),l=!1,c=!1,u=0,i=t??k();for(;;)try{return await dt(e,s,r,{captureId:t,conversionHeader:n,attempts:o})}catch(a){if(l&&(a.hadTimeout=!0),a.name==="AbortError"){if(l)throw a;let{landed:d,resend:m,etag:x}=await ht();if(d)return d;if(!m)throw a;r=x,l=!0;continue}if(a.status===412&&!c&&Ve(a.saveId)){M(a.etag??null),v=null,s=ve(),r=ye(),c=!0;continue}if(a.code==="page-converting"&&u<nt){if(k()!==i||(u+=1,await new Promise(d=>setTimeout(d,Math.max(0,a.retryAfter??1)*1e3)),k()!==i))throw a;continue}throw a}}function W(e,t,n,o,s=null,r=0,l=null){return e=ie(e,Math.max(C(),r)),new Promise(c=>{let u=[],i=Q(s),a=()=>l!==null&&E===l,d=()=>{a()||(y=!1)},m=(p,h=!1)=>{h&&U(e,t??null,i),ee(s),We({captureId:t??null,result:p,attempts:u,sent:u.length>0}),typeof n=="function"&&n(p),c(p)};if(!N&&!window.clay?.testMode)return m(O("Not in edit mode"));if(y&&!a())return m(O("Save already in progress"));let x=at(o);if(x.invalid)return m(tt());if(y=!0,window.clay?.testMode){setTimeout(()=>{d(),m(ge({msg:"Test mode: save skipped"}))},0);return}P();let f=B(F(e),le());if(ue(f),f.state==="over")return d(),m(qe(f));pt(e,{captureId:t,conversionHeader:x.header,attempts:u}).then(ge,K).then(p=>{d(),p.code==="save-too-large"&&!p.size&&(p.size=f),p.ok&&U(e,t??null,i),m(p)})})}function mt(e,t=()=>{}){return W(e,null,t,null)}function Vt(e,t,n=()=>{},{conversion:o,capture:s=null,pageFormatFloor:r,lane:l=null}={}){return W(e,t,n,o,s,r,l)}function qt({html:e,captureId:t,conversion:n}){return W(e,t??null,void 0,n)}function Zt(e,t=()=>{}){return new Promise(n=>{let o=null,s=r=>{Qe(o),typeof t=="function"&&t(r),n(r)};if(!N)return s(O("Not in edit mode"));if(et())return s(O("Another document operation is in progress"));if(y)return s(O("Save already in progress"));if(R)return s(!1);o=Ze("replace"),fetch(new URL(e,window.location.href).href).then(r=>{if(!r.ok)throw new Error(`Template fetch failed: HTTP ${r.status} ${r.statusText}`);return r.text()}).then(r=>mt(r)).then(s).catch(r=>{console.error("Failed to fetch template:",r),s(K(r))})})}var xe=null;function Qt(e){xe=e}function en(){return xe}export{P as a,vt as b,yt as c,Ft as d,Bt as e,Ht as f,Jt as g,zt as h,Gt as i,Kt as j,Wt as k,Xt as l,ve as m,Yt as n,Ze as o,Qe as p,et as q,lt as r,mt as s,Vt as t,qt as u,Zt as v,Qt as w,en as x};
3
+ `,s),c=l===-1?e.length:l+1;return!/\S/.test(e.slice(r,o))&&!/\S/.test(e.slice(s,c))&&(o=r,s=c),e.slice(0,o)+e.slice(s)}function B(e,t){let n=new TextEncoder().encode(e).byteLength,o=Number.isSafeInteger(t)&&t>0;return{bytes:n,maxBytes:o?t:null,state:o?n>t?"over":n>=Math.ceil(t*.8)?"near":"ok":"unknown"}}function le(){return D}function P({fresh:e=!1}={}){return e?(A=w({fresh:!0}).then(se),A):(A||(A=w().then(se)),A)}function vt({fresh:e=!1}={}){return P({fresh:e}).then(t=>({maxBytes:t}))}async function yt(e){let t=await P();return B(F(e),t)}function ue(e){let t=new CustomEvent("clay:save-size",{detail:e});document.dispatchEvent(t),(e.state==="near"||e.state==="over")&&import("./c-KDXIJEEF.js").then(n=>n.start(t),()=>{})}var L="/_/clayjs/",Te=/[\u0000-\u001F\u007F]/,be=/^[\t\n\f\r ]|[\t\n\f\r ]$/,Oe=/^https:\/\/clayjs\.com\/v(\d+)\/([\s\S]*)$/,Ee=/^https:\/\/clayjs\.com\/(\d+)\.(\d+)\.(\d+)\/([\s\S]*)$/,ce=/^\/_\/clayjs\/(\d+)\.(\d+)\.(\d+)\/([\s\S]*)$/,$e=/%2e|%2f|%5c/i;function Re(e){if(typeof e!="string")return null;let t=/^(\d+)\.\d+\.\d+$/.exec(e);return t?t[1]:null}function ke(e){if(typeof e!="string"||e==="")return null;try{return new URL(e).origin}catch{return null}}function Me(e){let t=e.indexOf("#"),n=t<0?"":e.slice(t),o=t<0?e:e.slice(0,t),s=o.indexOf("?"),r=s<0?"":o.slice(s);return{head:s<0?o:o.slice(0,s),search:r,hash:n}}function Pe(e){if(e===""||e.includes("\\")||$e.test(e))return null;let t=e.split("/"),n=[];for(let o of t){if(o===""||o==="."||o==="..")return null;let s;try{s=decodeURIComponent(o)}catch{return null}if(s.includes("/")||s.includes("\\")||s==="."||s==="..")return null;n.push(s)}return n.join("/")}function T(e,{documentURL:t}={}){if(typeof e!="string"||e===""||be.test(e)||Te.test(e))return null;let{head:n,search:o,hash:s}=Me(e),r=null,l=null,c=null,u=null,i=Oe.exec(n);if(i&&(r="rolling",c=i[1],u=i[2]),r||(i=Ee.exec(n),i&&(r="exact",l=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],u=i[4])),r||(i=ce.exec(n),i&&(r="local",l=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],u=i[4])),!r){let d=ke(t);d&&n.startsWith(`${d}/`)&&(i=ce.exec(n.slice(d.length)),i&&(r="local",l=`${i[1]}.${i[2]}.${i[3]}`,c=i[1],u=i[4]))}if(!r)return null;let a=Pe(u);return a===null?null:{kind:r,major:c,version:l,rawPath:u,path:a,search:o,hash:s}}function Le(e,t){let n=e&&typeof e=="object"?e[t]:null;return n&&typeof n.files=="object"&&n.files?n.files:null}function je(e){return!e||typeof e!="object"?[]:Array.isArray(e.entries)?e.entries.filter(t=>t&&typeof t=="object"):[]}function Ie(e,t,n){if(!n)return!0;let o=Le(n,t);return!!(o&&Object.hasOwn(o,e.path))}function fe(e,{descriptor:t,releases:n,documentURL:o,aliases:s}={}){let r=T(e,{documentURL:o});if(!r||r.kind!=="local")return e;let l=je(t),c=Re(r.version);for(let u of l){if(u.local!==e||typeof u.original!="string")continue;let i=n?.[r.version]?.aliases??s;if(i&&typeof i=="object"&&!r.search&&!r.hash&&Object.hasOwn(i,u.original)&&i[u.original]===r.path)return u.original;let a=T(u.original);if(a&&!(a.kind!=="rolling"&&a.kind!=="exact")&&a.rawPath===r.rawPath&&a.search===r.search&&a.hash===r.hash&&!(a.kind==="rolling"?a.major!==c:a.version!==r.version)&&Ie(r,r.version,n))return a.kind==="exact"?u.original:`https://clayjs.com/v${a.major}/${r.rawPath}${r.search}${r.hash}`}for(let u of l){if(typeof u.original!="string")continue;let i=T(u.original);if(i&&!(i.kind!=="rolling"&&i.kind!=="exact")&&i.rawPath===r.rawPath&&!(i.kind==="rolling"?i.major!==c:i.version!==r.version))return i.kind==="rolling"?`https://clayjs.com/v${i.major}/${r.rawPath}${r.search}${r.hash}`:`https://clayjs.com/${i.version}/${r.rawPath}${r.search}${r.hash}`}return`https://clayjs.com/${r.version}/${r.rawPath}${r.search}${r.hash}`}var _e=Object.freeze({"https://cdn.jsdelivr.net/npm/overtype@2.6.1/dist/overtype.min.js":"compat/overtype-2.6.1.min.js","https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js":"compat/highlight-11.9.0.min.js","https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,300;0,400;0,500;0,600;1,400;1,500&family=IBM+Plex+Sans:wght@400;500;600&display=swap":"fonts/ibm-plex.css"}),J="clay-runtime-map",Ne=new Set(["stylesheet","preload","modulepreload"]),de=null,H=null;function Ue(e){let t;try{t=JSON.parse(e)}catch{return null}return!t||typeof t!="object"||t.schema!==1?null:t}function Ce(){if(typeof document>"u")return null;let e=document.getElementById(J);if(!e)return null;let t=e.textContent??"";return t===de||(de=t,H=Ue(t)),H}var De=`script[src*="${L}"], link[href*="${L}"], #${J}`;function he(e){if(e.querySelector(De))return!0;for(let t of e.querySelectorAll("template"))if(he(t.content))return!0;return!1}function Fe(e){let t=[],n=[e];for(;n.length;){let o=n.pop();for(let s of o.children??[])t.push(s),n.push(s),s.content&&n.push(s.content)}return t}function Be(e){return e.tagName==="SCRIPT"&&e.hasAttribute("src")?"src":e.tagName!=="LINK"||!e.hasAttribute("href")?null:(e.getAttribute("rel")??"").toLowerCase().split(/\s+/).some(n=>Ne.has(n))?"href":null}function He(e){if(!e||!he(e))return;let t=[],n=!1;for(let r of Fe(e)){if(r.getAttribute("id")===J){r.remove();continue}let l=Be(r);l&&(t.push({element:r,name:l}),!n&&(r.getAttribute(l)??"").includes(L)&&(n=!0))}if(!n)return;let o=location.href,s=Ce();for(let{element:r,name:l}of t){let c=r.getAttribute(l),u=T(c,{documentURL:o});!u||u.kind!=="local"||r.setAttribute(l,fe(c,{descriptor:s,documentURL:o,aliases:_e}))}}te(He);var y=!1,E=null,pe="/_/save",ze=12e3,me=6e4,Ge=1024*1024,Se="text/plain;charset=UTF-8",j=null,$=!1,G=new Map;function Ft(e,t){t==null?G.delete(e):G.set(e,String(t))}async function Bt(e,t){$=!!e;try{return await t()}finally{$=!1}}function Ht(){return y}function Jt(){return y?null:(y=!0,E={reserved:!0},E)}function zt(e){!e||E!==e||(E=null,y=!1)}function Gt(){return $}var I=[],_=[];function Kt(e){return I.push(e),()=>{let t=I.indexOf(e);t>=0&&I.splice(t,1)}}function Wt(e){return _.push(e),()=>{let t=_.indexOf(e);t>=0&&_.splice(t,1)}}function Ke(e){for(let t of I)try{t(e)}catch(n){console.error("clayjs: onSaveAttempt hook failed:",n)}}function We(e){for(let t of _)try{t(e)}catch(n){console.error("clayjs: onSaveOutcome hook failed:",n)}}function ge(e){return{ok:!0,msg:e.msg??"Saved",msgType:e.msgType||"success",code:e.code??null,etag:e.etag??null}}var b=[],Xe=8,v=null;function Xt(){return v!==null}function ve(){let e=window.crypto?.randomUUID?.();if(e)return e;if(window.crypto?.getRandomValues){let n=new Uint8Array(16);return window.crypto.getRandomValues(n),Array.from(n,o=>o.toString(16).padStart(2,"0")).join("")}let t=()=>Math.random().toString(36).slice(2,12).padEnd(10,"0");return`${Date.now().toString(36)}-${t()}${t()}${t()}`}function Ye(e){b.push(e),b.length>Xe&&b.shift()}function Ve(e){return typeof e=="string"&&e!==""&&b.includes(e)}function Yt(){b.length=0,v=null}function K(e){let t=e.name==="AbortError",n=!t&&e.status===412,o=!t&&!n&&e.code==="save-already-applied";return{ok:!1,msg:t?"Server not responding":e.message||"Save failed",msgType:t||o?"unknown":n?"conflict":"error",code:t?"timeout":n?"conflict":e.code??null,changedBy:n?e.changedBy??null:null,afterTimeout:n&&v!==null,conflictEtag:n?e.etag??null:null,status:Number.isInteger(e.status)?e.status:null,hadTimeout:t||e.hadTimeout===!0,reason:e.reason??null,retryAfter:e.retryAfter??null,saveOutcome:e.saveOutcome??null,etag:null}}function O(e){return{ok:!1,msg:e,msgType:"skipped",code:null,etag:null}}function qe(e){let t=new Error(`This document is ${e.bytes} bytes; this host saves at most ${e.maxBytes}`);return t.code="save-too-large",{...K(t),sent:!1,size:e}}var S=null;function Ze(e){return S?null:(S={kind:e},S)}function Qe(e){S===e&&(S=null)}function et(){return S?S.kind:null}function tt(){return{ok:!1,msg:"Invalid page conversion metadata",msgType:"error",code:"invalid-header",etag:null}}var nt=3,rt=/^(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} \d{2}:\d{2}:\d{2} GMT|(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), \d{2}-(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-\d{2} \d{2}:\d{2}:\d{2} GMT|(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (?: \d|\d{2}) \d{2}:\d{2}:\d{2} \d{4})$/;function ot(e){if(e==null)return null;let t=String(e).trim();if(!t)return null;if(/^-?\d+$/.test(t))return Math.max(0,Math.min(3600,Number(t)));if(!rt.test(t))return null;let n=Date.parse(t);return Number.isNaN(n)?null:Math.max(0,Math.min(3600,Math.round((n-Date.now())/1e3)))}var it=/^[0-9a-f]{64}$/,st=/^[A-Za-z0-9-]{1,64}$/;function at(e){if(e==null)return{header:null};if(typeof e!="object")return{invalid:!0};let{source:t,base:n,epoch:o}=e;return typeof n!="string"||!it.test(n)?{invalid:!0}:t==="file"?o!=null?{invalid:!0}:{header:`v1; source=file; base=${n}`}:t==="room"?typeof o!="string"||!st.test(o)?{invalid:!0}:{header:`v1; source=room; base=${n}; epoch=${o}`}:{invalid:!0}}function lt(e,t,n,o,s,r=!1,l=null){let c=X(),u=c?`${pe}/${c}`:pe,i={method:"POST",credentials:c?"omit":"same-origin",signal:n,headers:{"Document-URL":window.location.href,"Page-URL":window.location.href,"Save-Trigger":t?"user":"auto","Save-ID":o,[oe]:String(1)},body:ut(e)};for(let[a,d]of G)i.headers[a]=d;return typeof i.body!="string"&&(i.headers["Content-Type"]=Se),l&&(i.headers["Page-Conversion"]=l),s&&(i.headers["If-Match"]=s),r&&e.length<me&&new Blob([e]).size<me&&(i.keepalive=!0),{url:ct(u),options:i}}function ut(e){if(e.length<Ge)return e;if(j&&j.content===e)return j.blob;let t=new Blob([e],{type:Se});return j={content:e,blob:t},t}function ye(){let e=ne();return re()&&e?e:null}function ct(e){let t=window.location.origin;return!t||t==="null"?e:new URL(e,t).href}function z(e,t){let n=JSON.stringify(t);return{ok:e>=200&&e<300,status:e,statusText:e===200?"OK":"Insufficient Storage",text:()=>Promise.resolve(n)}}function ft(e){let t=Y();return t?Promise.resolve().then(()=>{try{return t(e),z(200,{msg:"Saved in this browser",msgType:"success"})}catch(n){return z(507,{msg:"Couldn't save in this browser. Storage is full or turned off.",msgType:"error",code:n.code||"draft-storage"})}}):Promise.resolve(z(503,{msg:"Saving in this browser is not ready yet",msgType:"error",code:"draft-not-ready"}))}function dt(e,t,n,{captureId:o=null,conversionHeader:s=null,attempts:r=[]}={}){let l=new AbortController,c=setTimeout(()=>l.abort(),ze),u=q(),i=Z(),a=u||i,d=$;$=!1;let{url:m,options:x}=lt(e,a,l.signal,t,n,d,s);return Ye(t),R||(r.some(f=>f.saveId===t&&f.etag===(n??null))||r.push({saveId:t,etag:n??null}),Ke({captureId:o,saveId:t,html:e,etag:n??null})),(R?ft(e):fetch(m,x)).then(f=>f.text().then(p=>{let h={};if(p)try{h=JSON.parse(p)}catch{if(f.ok)throw new Error("Server sent a response that was not JSON")}if(!f.ok){let g=new Error(h.msg||h.error||`HTTP ${f.status}: ${f.statusText}`);throw g.code=f.status===413?"save-too-large":h.code??null,g.status=f.status,g.changedBy=h.changedBy??null,g.etag=h.etag??null,g.saveId=h.saveId??null,g.reason=typeof h.reason=="string"?h.reason:null,g.saveOutcome=h.saveOutcome??null,g.retryAfter=ot(f.headers?.get?.("Retry-After")),g}return M(h.etag??null),v=null,h})).catch(f=>{throw console.error("Failed to save page:",f),f.name==="AbortError"&&(v={saveId:t,etag:n}),a&&V(),f}).finally(()=>{clearTimeout(c)})}async function ht(){let e=v;if(!e)return{landed:null,resend:!1};let n=(await w({fresh:!0})).document,o=typeof n?.etag=="string"&&n.etag?n.etag:null;return o?n.saveId&&n.saveId===e.saveId?(M(o),v=null,{landed:{msg:"Saved",msgType:"success",etag:o},resend:!1}):(n.saveId&&(v=null),{landed:null,resend:!!e.etag,etag:e.etag}):{landed:null,resend:!1}}async function pt(e,{captureId:t=null,conversionHeader:n=null,attempts:o=[]}={}){let s=ve(),r=ye(),l=!1,c=!1,u=0,i=t??k();for(;;)try{return await dt(e,s,r,{captureId:t,conversionHeader:n,attempts:o})}catch(a){if(l&&(a.hadTimeout=!0),a.name==="AbortError"){if(l)throw a;let{landed:d,resend:m,etag:x}=await ht();if(d)return d;if(!m)throw a;r=x,l=!0;continue}if(a.status===412&&!c&&Ve(a.saveId)){M(a.etag??null),v=null,s=ve(),r=ye(),c=!0;continue}if(a.code==="page-converting"&&u<nt){if(k()!==i||(u+=1,await new Promise(d=>setTimeout(d,Math.max(0,a.retryAfter??1)*1e3)),k()!==i))throw a;continue}throw a}}function W(e,t,n,o,s=null,r=0,l=null){return e=ie(e,Math.max(C(),r)),new Promise(c=>{let u=[],i=Q(s),a=()=>l!==null&&E===l,d=()=>{a()||(y=!1)},m=(p,h=!1)=>{h&&U(e,t??null,i),ee(s),We({captureId:t??null,result:p,attempts:u,sent:u.length>0}),typeof n=="function"&&n(p),c(p)};if(!N&&!window.clay?.testMode)return m(O("Not in edit mode"));if(y&&!a())return m(O("Save already in progress"));let x=at(o);if(x.invalid)return m(tt());if(y=!0,window.clay?.testMode){setTimeout(()=>{d(),m(ge({msg:"Test mode: save skipped"}))},0);return}P();let f=B(F(e),le());if(ue(f),f.state==="over")return d(),m(qe(f));pt(e,{captureId:t,conversionHeader:x.header,attempts:u}).then(ge,K).then(p=>{d(),p.code==="save-too-large"&&!p.size&&(p.size=f),p.ok&&U(e,t??null,i),m(p)})})}function mt(e,t=()=>{}){return W(e,null,t,null)}function Vt(e,t,n=()=>{},{conversion:o,capture:s=null,pageFormatFloor:r,lane:l=null}={}){return W(e,t,n,o,s,r,l)}function qt({html:e,captureId:t,conversion:n}){return W(e,t??null,void 0,n)}function Zt(e,t=()=>{}){return new Promise(n=>{let o=null,s=r=>{Qe(o),typeof t=="function"&&t(r),n(r)};if(!N)return s(O("Not in edit mode"));if(et())return s(O("Another document operation is in progress"));if(y)return s(O("Save already in progress"));if(R)return s(!1);o=Ze("replace"),fetch(new URL(e,window.location.href).href).then(r=>{if(!r.ok)throw new Error(`Template fetch failed: HTTP ${r.status} ${r.statusText}`);return r.text()}).then(r=>mt(r)).then(s).catch(r=>{console.error("Failed to fetch template:",r),s(K(r))})})}var xe=null;function Qt(e){xe=e}function en(){return xe}export{P as a,vt as b,yt as c,Ft as d,Bt as e,Ht as f,Jt as g,zt as h,Gt as i,Kt as j,Wt as k,Xt as l,ve as m,Yt as n,Ze as o,Qe as p,et as q,lt as r,mt as s,Vt as t,qt as u,Zt as v,Qt as w,en as x};
@@ -0,0 +1 @@
1
+ import{a as Ke,b as de,d as ue,e as fe,f as tt}from"./c-NK33MMYF.js";import{a as Qe,b as Ze,c as ce,d as et}from"./c-LZJPNR2W.js";import{a as R,b as J}from"./c-FILLTJA7.js";import{b as Xe}from"./c-5VYOWDTI.js";import{b as oe,c as ae,d as x,f as he,g as Je,h as Ve}from"./c-GSRLXYWL.js";import{a as q}from"./c-LA2BW7UY.js";import{a as Oe}from"./c-ATKAOH23.js";import{a as je,f as ze,g as We,h as Ye}from"./c-EK63G3CG.js";import{a as se,b as Ue,c as M,d as re,e as le,h as $e}from"./c-NQJRVJ56.js";import{e as Ge}from"./c-XGH4GS2T.js";import{d as Pe}from"./c-IJUK2GPW.js";import{f as $,j as te}from"./c-3O7OBDCM.js";import{a as Te}from"./c-BPF2NSPV.js";import{E as Y,F as Be,H as T,I as Ne,b as D,j as ie,o as W,t as P,z as Me}from"./c-PWJSJEJU.js";import{a as Re,b as He,c as qe,e as j,g as z,h as ne}from"./c-VG5XIN4T.js";import{m as De,n as Ie}from"./c-HA6INT6J.js";import{a as Le,b as Ae,l as Ce,m as Fe}from"./c-ICMAOOGK.js";function nt(s){let e=new WeakMap,t=0,i=r=>e.get(r)||null,n=r=>{let l=e.get(r);return l||(l=`${s}:${++t}`,e.set(r,l)),l};return{idOf:i,ensure:n,adopt:(r,l)=>{r&&typeof l=="string"&&l&&e.set(r,l)},exportMap:(r,l)=>{let o={},a=[],h=[],c=(d,_)=>{let g=l(d);g&&(o[_]=n(g));let E=d.children;a.push(E.length),h.push(d.tagName.toLowerCase());for(let f=0;f<E.length;f++)c(E[f],_===""?String(f):`${_}.${f}`)};return c(r,""),o["~"]=a.join(","),o["^"]=h.join(","),o}}}function it(s,e){let t=new WeakMap;if(!s||!e||typeof e!="object"||Array.isArray(e))return t;let i=e["~"],n=typeof i=="string"?i.split(",").map(Number):null,r=n&&typeof e["^"]=="string"?e["^"].split(","):null,l=d=>Number.isInteger(d)&&d>=0,o=0,a=!1,h=d=>{let _=d;for(;_>0;){let g=n[o++];if(o>n.length||!l(g))return!1;_+=g-1}return!0},c=(d,_)=>{if(a)return;if(n){let f=o++,u=n[f];if(f>=n.length||!l(u)){a=!0;return}let S=!r||r[f]===d.tagName.toLowerCase();if(!S||u!==d.children.length){let w=S&&e[_];typeof w=="string"&&w&&t.set(d,w),h(u)||(a=!0);return}}let g=e[_];typeof g=="string"&&g&&t.set(d,g);let E=d.children;for(let f=0;f<E.length;f++)c(E[f],_===""?String(f):`${_}.${f}`)};return c(s,""),t}function mt(s){return e=>{for(let t of s){let i=t(e);if(typeof i=="string"&&i!=="")return i}return null}}var Mt=mt([s=>s.getAttribute("data-id"),s=>s.getAttribute("id")]);var vt=/^page(\.[0-9]+)?$/,st=s=>[...s.querySelectorAll('script[merge][clay~="live"]')].filter(e=>vt.test(e.getAttribute("merge")));function rt(s,e,t){if(!s.html.includes("data-page"))return s;let i=u=>W(new DOMParser().parseFromString(u,"text/html")),n=i(s.html),r=n.querySelector("article[data-page]");if(!r)return s;let l=i(e),o=l.querySelector("article[data-page]");if(!o)return null;let a=it(n.documentElement,s.identityMap),h=(u,S)=>{let w=n.importNode(S,!0),b=a.get(u);return b&&a.set(w,b),u.replaceWith(w),w},c=h(r,o),d=new Map(st(n).map(u=>[u.getAttribute("merge"),u]));for(let u of st(l)){let S=u.getAttribute("merge"),w=d.get(S);w?h(w,u):c.before(n.importNode(u,!0)),d.delete(S)}for(let u of d.values())u.remove();let _=n.querySelector("head > title"),g=l.querySelector("head > title");_&&g?h(_,g):g?n.head.append(n.importNode(g,!0)):_?.remove();let E=n.documentElement,f=t.exportMap(E,u=>{let S=a.get(u);return S?(t.adopt(u,S),u):null});return{...s,html:T(E),identityMap:f}}var St={"merge-tokens":"tokens","merge-max":"max"};function lt(s,e){if(!e.startsWith("data-")||e==="data-id"||!s?.closest)return null;for(let[t,i]of Object.entries(St)){let n=s.closest(`[${t}]`);if(n&&n.getAttribute(t).split(/\s+/).includes(e))return i}return null}var m=null,ot=null,B=new Map;function V(){return ot??=Promise.all([import("./c-5TIZ2I64.js"),import("./c-EJTGYSLN.js")]).then(([s,e])=>{m={...s,beginLineageCapture:e.beginLineageCapture};for(let t of[...B.keys()])B.set(t,s.registerContext(t));return m}),ot}var at=()=>m,I={get size(){return m?m.conflicts.size:0},list(){return m?m.conflicts.list():[]},get(s){return m?m.conflicts.get(s):null},acknowledge(s,e={}){if(m)return m.conflicts.acknowledge(s,e);if(!Array.isArray(s))throw new TypeError("clay.conflicts.acknowledge needs an array of ids");return{removedIds:[],remainingIds:[]}},claim(s,e={}){if(m)return m.conflicts.claim(s,e);if(!e.owner)throw new TypeError("clay.conflicts.claim needs an owner");return{release(){}}},registerContext(s){if(m)return m.conflicts.registerContext(s);if(typeof s!="function")throw new TypeError("clay.conflicts.registerContext needs a resolver function");return B.set(s,null),()=>{let e=B.get(s);B.delete(s),e&&e()}},contextFor(s,e){return m?m.conflicts.contextFor(s,e):null},recoveryOf(s){return m?m.conflicts.recoveryOf(s):null},hasPendingApply(){return m?m.conflicts.hasPendingApply():!1}};var y=null,pe=null;function H(){return pe??=new Promise(s=>setTimeout(s,0)).then(()=>import("./c-QYYUVLVG.js")).then(s=>y=s).catch(s=>{throw pe=null,s}),pe}var me=null,_e=null;function wt(){return _e??=import("./c-FTWGYI5E.js").then(s=>me=s.presence).catch(s=>{throw _e=null,s}),_e}var dt=te().phase==="entering";$&&!dt&&H().catch(()=>{});$&&V().catch(()=>{});var L=null,ge=null,Q=[];function ut(s){L.presence.update(s),L.editingMarker.update(s)}function kt(){return ge??=Promise.all([import("./c-G4PWUDD5.js"),import("./c-FQGHR32O.js")]).then(([s,e])=>{L={presence:s.presence,editingMarker:e.editingMarker};let t=Q;Q=[];for(let i of t)ut(i);return L}).catch(s=>{throw ge=null,s}),ge}function xt(s){if(L){ut(s);return}Q.push(s),kt().catch(()=>{})}var ht=Object.freeze({bytes:null,etag:null,seq:null}),bt=()=>({msg:"Not in edit mode",msgType:"skipped",code:null,etag:null}),ft=["[editor-ui]",'[clay~="editor-ui"]',"[save-ignore]","[snapshot-remove]","[no-snapshot]","[no-save]","[save-remove]","[freeze] *","[save-freeze] *",'[clay~="no-save"]','[clay~="no-snapshot"]','[clay~="freeze"] *',Ce,Le].join(","),pt='[clay~="freeze"], [freeze], [save-freeze]';function X(s){for(let e of s.querySelectorAll(pt))e.replaceChildren();return z()&&qe(s),s}function ct(s){if(s==null)return s;let e=typeof s=="string"?new DOMParser().parseFromString(s,"text/html"):s;return ie(e),W(e),X(e),e}var Dt=[Fe,'[clay~="no-watch"]',"[no-watch]","[mutations-ignore]"].join(","),It=(s,e,t)=>De(s,e,t)||Ae.test(e.toLowerCase()),_t=s=>s.getAttribute("data-id")||s.getAttribute("id")||null;function Tt(s){let e=new Map,t=n=>{if(n.matches(ft))return;let r=_t(n);r&&e.set(r,(e.get(r)||0)+1);let l=n.localName==="template"&&n.content?n.content.children:n.children;for(let o of l)t(o)},i=s.nodeType===9?[s.documentElement]:s.nodeType===11?s.children:[s];for(let n of i)n&&n.nodeType===1&&t(n);return e}var Lt=s=>e=>{let t=_t(e);if(!t)return null;let i=e.getRootNode(),n=s.get(i);return n||s.set(i,n=Tt(i)),n.get(t)===1?t:null},ye=s=>!!s&&typeof s=="object"&&!Array.isArray(s);function At(s){return typeof s!="string"||s===""?null:new DOMParser().parseFromString(s,"text/html").documentElement?.getAttribute("documentetag")||null}function Ct(s,e){e!=="live"||!s||!y||(y.enableContentEditable(s),y.enableOnClick(s),y.enableAdminInputs(s),y.enableAdminResources(s))}function Ft(){let{forComparison:s,forDirty:e}=Me({flushUndo:!1});return[s,e]}var Rt=1024*1024;function Ht(s,e,t,i,n){let r={sender:t,identityMap:i,...n?{etag:n}:{}};return e.length<Rt?JSON.stringify({[s.snapshotKey]:e,...r}):new Blob([`{${JSON.stringify(s.snapshotKey)}:`,JSON.stringify(e),`,${JSON.stringify(r).slice(1)}`],{type:"application/json"})}var ve=class{constructor(){this.sse=null,this.currentFile=null,this.lastHtml=null,this._diskBase=null,this._diskBaseTicket=0,this._agreeSeq=0,this._saveTicket=0,this._peerBaseTicket=0,this._acceptedSaveTicket=0,this._morphTicket=0,this.clientId=this.generateClientId(),this.resumeId=null,this._savedSnapshot?.abort?.abort(),this._savedSnapshot=null,this._sendInFlight=!1,this._queuedSend=null,this._profile=null,this._profilePromise=null,this._sharedData=!1,this._sharedSync=!1,this._liveData=!1,this._editing=null,this._presenceLease=null,this._presenceQuiesced=!1,this._ready=null,this._startGen=0,this.isPaused=!1,this.isDestroyed=!1,this.debug=!1,this._lane=$?"live":"saved",this._laneChosen=!1,this._snapshotHandler=null,this.lastSeenSeq=0,this._pendingHtml=null,this._pendingSeq=null,this._pendingIdentityMap=null,this._pendingEtag=null,this._pendingBy=null,this._morphInFlight=!1,this._rafHandle=null,this._represented=ht,this._handoff=null,this._handoffHeld=!1,this._pendingExternal=null,this._lastExternalSeq=0,this._saveEpoch=0,this._saveSavedHandler=null,this._saveConflictHandler=null,this._settledHandler=null,this._lastIdentityMap=null,this._applyGen=0,this._holdRetryPeer=null,this._holdRetryExt=null,this._servedFetchId=0,this._startupRetry=null,this._engineRetry=null,this._heldLive=!1,this._heldExt=!1,this.identity=nt(this.clientId),this.onConnect=null,this.onDisconnect=null,this.onUpdate=null,this.onError=null,this.onNotification=null}get unresolvedConflicts(){return I.list().filter(e=>e.kind!=="apply-incomplete")}_log(e,t=null){if(!this.debug)return;let i=`[LiveSync ${new Date().toISOString()}]`;t!==null?console.log(i,e,t):console.log(i,e)}generateClientId(){return Math.random().toString(36).slice(2,11)+Date.now().toString(36)}generateResumeId(){try{let e=new Uint8Array(16);return(globalThis.crypto||window.crypto).getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}catch{return Math.random().toString(36).slice(2)+Date.now().toString(36)}}_seedBases(){if(x())return;let e=P({flushUndo:!1});this._setPeerBase(T(e),this.identity.exportMap(e,D),this._ticket()),this._setDiskBase(Y({emitForSync:!1}).forSave,this._ticket())}get lane(){return this._lane}set lane(e){this._lane=e,this._laneChosen=!0}start(e=null,{lane:t,represented:i}={}){if(this.isDestroyed=!1,(this.sse||this._snapshotHandler)&&this.cleanup(),this.currentFile=e||this.detectCurrentFile(),!this.currentFile){console.warn("[LiveSync] No file detected");return}let n=te().mode==="edit"?"live":"saved",r=this.lane==="live";this._lane=t||(this._laneChosen?this._lane:n),this.lastHtml=null,this._lastIdentityMap=null,this._peerBaseTicket=this._ticket(),this._diskBase=null,this._diskBaseTicket=this._ticket(),this._saveTicket=0,this._savedSnapshot?.abort?.abort(),this._savedSnapshot=null,this._applyGen++,this.lastSeenSeq=0,this._lastExternalSeq=0,this._represented=i?Object.freeze({bytes:i.bytes??null,etag:i.etag??null,seq:i.seq??null}):ht,this._acquireEmptySaved=r&&this.lane==="saved"&&this._represented.bytes===null,this._pendingExternal=null,this.resumeId=this.generateResumeId(),this.lane==="live"&&this._seedBases(),this.lane==="live"&&V().catch(()=>{}),console.log(`[LiveSync] Starting for: ${this.currentFile} (lane=${this.lane})`);let l=++this._startGen;if(this.lane==="live"&&!(y&&y.baselineSettled())){let o=this._applyGen,a=this._morphTicket,h=this._saveEpoch,c=this.lastHtml,d=this._diskBaseTicket,_=this._diskBase!==null;this._settledHandler=()=>{if(this._settledHandler=null,!(this.isDestroyed||this._startGen!==l)&&!Pe()&&!x()&&this._saveTicket===0&&this._morphTicket===a){if(c!==null&&this._applyGen===o&&this._saveEpoch===h&&this.lastHtml===c){let g=P({flushUndo:!1});this._setPeerBase(T(g),this.identity.exportMap(g,D),this._ticket())}_&&this._diskBaseTicket===d&&this._setDiskBase(Y({emitForSync:!1}).forSave,this._ticket())}},document.addEventListener("clay:baseline-settled",this._settledHandler,{once:!0})}this._ready=Promise.all([this.lane==="live"?H():null,this._resolveProfile()]).then(()=>{this.isDestroyed||this._startGen!==l||this.connect()}),this.lane==="live"&&(this.listenForSnapshots(),wt().then(o=>this._startPresence(o,l),()=>{}),this._saveSavedHandler=o=>{this._saveEpoch++;let a=this._saveTicket||this._ticket();this._saveTicket=0,a>this._acceptedSaveTicket&&(this._acceptedSaveTicket=a);let h=y?y.getLastSavedBytes():null;h!=null&&this._setDiskBase(h,a),this._relayCommit(o?.detail?.captureId,h)},document.addEventListener("clay:save-saved",this._saveSavedHandler),this._saveConflictHandler=o=>{let a=o.detail&&o.detail.etag;a&&queueMicrotask(()=>{this.isDestroyed||a===se()&&(y?.conflictResolvedBySync(a),this._saveAfterMerge(x(),!1))})},document.addEventListener("clay:save-conflict",this._saveConflictHandler))}cleanup(){if(this.sse&&(this.sse.close(),this.sse=null),ce(),Q=[],L&&(L.presence.clear(),L.editingMarker.clear()),this._editing&&(this._editing.stop(),this._editing=null),this._presenceLease){let e=this._presenceLease;this._presenceLease=null,typeof e.stop=="function"?e.stop():e.detach()}this._lastRoster=null,this._snapshotHandler&&(document.removeEventListener("clay:snapshot-ready",this._snapshotHandler),this._snapshotHandler=null),this._saveSavedHandler&&(document.removeEventListener("clay:save-saved",this._saveSavedHandler),this._saveSavedHandler=null),this._saveConflictHandler&&(document.removeEventListener("clay:save-conflict",this._saveConflictHandler),this._saveConflictHandler=null),this._settledHandler&&(document.removeEventListener("clay:baseline-settled",this._settledHandler),this._settledHandler=null),this._queuedSend=null,this._rafHandle!=null&&(this._cancelFrame(this._rafHandle),this._rafHandle=null),this._pendingHtml=null,this._pendingSeq=null,this._pendingIdentityMap=null,this._pendingBy=null,this._pendingExternal=null,this._handoff=null,this._handoffHeld=!1,clearTimeout(this._holdRetryPeer),clearTimeout(this._holdRetryExt),this._holdRetryPeer=null,this._holdRetryExt=null,clearTimeout(this._startupRetry),this._startupRetry=null,clearTimeout(this._engineRetry),this._engineRetry=null,this._servedFetchId++}detectCurrentFile(){let e=window.location.pathname;if(e==="/")return"index.html";e=e.replace(/^\//,"");let t=e.match(/^(.*?\.html(?:clay)?)/);return t?t[1]:e}_resolveProfile(){return this._profilePromise||(this._profilePromise=tt().then(e=>(this._sharedData=e.sharedData,this._sharedSync=e.sharedSync,this._liveData=e.liveData,this._profile=e.profile,this._log(`Wire profile: ${e.profile.name}`),e.profile))),this._profilePromise}_setHeld(e,t,i){let n=e==="live"?"_heldLive":"_heldExt";this[n]!==t&&(this[n]=t,!t&&!this._heldLive&&!this._heldExt&&$e({fresh:!0,clearIfMissing:!1}),document.dispatchEvent(new CustomEvent(t?"clay:sync-held":"clay:sync-resumed",{detail:{lane:e,el:i||null}})))}_applyEtagFrame(e){return typeof e.etag!="string"||typeof e.html=="string"?!1:(this._log("Dropping a stamp that arrived with no document: nothing proves this tab holds those bytes"),!0)}connect(){if(this.isDestroyed)return;let t=(this._profile||fe.legacy).streamPath(window.location.href,this.lane,this.resumeId,this.clientId);this.sse=new Ke(new URL(t,window.location.origin).href,{shared:this._sharedSync,sharedData:this._sharedData,documentURL:window.location.href,lane:this.lane,clientId:this.clientId,keepAliveWhenHidden:this._liveData&&this.lane==="live",startupCheck:!!Te}),this._acquireEmptySaved&&(this._acquireEmptySaved=!1,this._fetchServedDocument(void 0,{repair:!0})),this.sse.onopen=()=>{console.log("[LiveSync] Connected"),this._editing&&this._editing.reconnected(),me&&me.reconnect(),this.onConnect&&this.onConnect()},this.sse.addEventListener("open",()=>Ze({clientId:this.clientId,lane:this.lane})),this.sse.addEventListener("error",()=>ce());for(let i of Qe)this.sse.addEventListener(i,n=>{let r;try{r=JSON.parse(n.data)}catch{return}et(i,r)});this.sse.addEventListener("cursor",i=>{let n;try{n=JSON.parse(i.data)}catch{return}if(!n||n.resync!==!0&&n.startup!==!0)return;let r=n.resync===!0,l=n.startup===!0&&!r;console.log(r?"[LiveSync] Server could not replay everything; refetching the document":"[LiveSync] Checking the served document against the version this tab was served"),this._fetchServedDocument(typeof n.seq=="number"?n.seq:void 0,{repair:r,startup:l})}),this.sse.addEventListener("presence",i=>{let n;try{n=JSON.parse(i.data)}catch{return}xt(n),this._lastRoster=n,this._editing&&this._editing.roster(n)}),this.sse.onmessage=i=>{let n=JSON.parse(i.data),{seq:r}=n;if(typeof r=="number"&&r<=this.lastSeenSeq){this._log(`Dropping stale message: seq=${r}, lastSeen=${this.lastSeenSeq}`);return}if(typeof r=="number"&&(this.lastSeenSeq=r),n.type==="notification"){if(this._maybeAcceptExternalChange(n))return;this.handleNotification(n);return}if(n.error){console.error("[LiveSync] Server error:",n.error),this.onError&&this.onError(new Error(n.error));return}if(this._applyEtagFrame(n))return;let{html:l,sender:o,identityMap:a}=n;if(o===this.clientId){this._log("Ignoring own message (sender matches clientId)");return}if(typeof l!="string"){console.error("[LiveSync] Received invalid html, ignoring");return}let h=typeof n.etag=="string"&&n.etag?n.etag:null;if(this.lane==="live"&&!h&&Ue()){this._log(`Dropping an unstamped live frame on a stamping host (seq=${r})`);return}if(this.lane==="saved"&&l===this._represented.bytes){this._represented=Object.freeze({bytes:l,etag:h||null,seq:r??null}),M(h);return}if(h&&l===this.lastHtml){this._log(`Taking the stamp from a peer save of content already applied (seq=${r})`),M(h),y&&y.isSaveConflicted()&&(y.conflictResolvedBySync(h),this._saveAfterMerge(x(),!1));return}this._log(`Received update from: ${o} (my clientId: ${this.clientId}, seq=${r})`),this.applyUpdate(l,r,a,h,n.by),this.onUpdate&&this.onUpdate({html:l,sender:o,seq:r,identityMap:a,etag:h})},this.sse.onerror=()=>{this.sse.readyState===EventSource.CONNECTING?console.log("[LiveSync] Reconnecting..."):this.sse.readyState===EventSource.CLOSED&&(console.log("[LiveSync] Connection closed"),this.onError&&this.onError(new Error("Connection closed"))),this.onDisconnect&&this.onDisconnect()}}listenForSnapshots(){this._snapshotHandler=e=>{if(!e.detail||e.detail.forSave!==!0)return;this._saveTicket=this._ticket();let{documentElement:t}=e.detail;if(!t)return;this._log("snapshot-ready received, preparing to send");let i=this.identity.exportMap(t,D);this._savedSnapshot?.abort?.abort();let n={html:null,steps:null,copy:null,abort:null,identityMap:i,ticket:this._saveTicket,captureId:e.detail.captureId??null};if(e.detail.sliced){n.copy=Ne(t),n.abort=new AbortController;let{signal:r}=n.abort;Promise.all([import("./c-YYMZWQLR.js"),import("./c-ZWBI4HYK.js")]).then(([{serializeForSyncSteps:l},{runSliced:o}])=>{if(r.aborted||typeof n.html=="string")return;let a=(function*(){let h=yield*l(n.copy);n.html=h,n.steps=null})();return n.steps=a,o(a,{signal:r})}).catch(()=>{})}else n.html=T(t);this._savedSnapshot=n},document.addEventListener("clay:snapshot-ready",this._snapshotHandler)}_enqueueSend(e,t,i=null){if(!this._profile){this._queuedSend={html:e,identityMap:t,etag:i},this._resolveProfile().then(()=>this._flushQueuedSend());return}if(this._sendInFlight){this._queuedSend={html:e,identityMap:t,etag:i};return}this._postUpdate(e,t,i)}_flushQueuedSend(){if(this.isDestroyed||this._sendInFlight)return;let e=this._queuedSend;e&&(this._queuedSend=null,this._postUpdate(e.html,e.identityMap,e.etag))}_relayCommit(e=null,t=null){if(this.isDestroyed)return;let i=se(),n=this._savedSnapshot;if(n&&(n.captureId??null)!==(e??null)){this._log("Skipping send - snapshot belongs to a different capture");return}let r=n;if(this._savedSnapshot=null,r?.copy&&typeof r.html!="string")if(r.abort?.abort(),r.steps)for(let c=r.steps.next();!c.done;c=r.steps.next());else r.html=T(r.copy);if(!r||typeof r.html!="string")return;let l=r;if(typeof t=="string"){try{l=rt(r,t,this.identity)}catch(c){this._log(`Skipping send - page relay failed: ${c&&c.message}`);return}if(!l){this._log("Skipping send - accepted capture has no page article");return}}let o=qt(e)??t,a=typeof o=="string"?ze(o):0;l={...l,html:Pt(We(l.html,Math.max(Ye(),a)),o)};let h=!i&&l.html===this.lastHtml;if(this._setPeerBase(l.html,l.identityMap,l.ticket),h){this._log("Skipping send - HTML unchanged");return}this._enqueueSend(l.html,l.identityMap,i||null)}_postUpdate(e,t,i=null,n=0){this._log(`Sending update (HTML length: ${e.length})`),this._sendInFlight=!0;let r=!1,l=this._profile||fe.legacy;fetch(new URL(l.relayPath,window.location.origin).href,{method:"POST",headers:{"Content-Type":"application/json",[l.documentHeader]:window.location.href,[je]:String(1)},body:Ht(l,e,this.clientId,t,i)}).then(o=>{o.ok||(console.warn("[LiveSync] Save returned status:",o.status),r=o.status>=500||o.status===408||o.status===429)}).catch(o=>{console.error("[LiveSync] Save failed:",o),this.onError&&this.onError(o),r=!0}).finally(()=>{this._sendInFlight=!1;let o=this._queuedSend;if(this._queuedSend=null,o){this._postUpdate(o.html,o.identityMap,o.etag);return}!r||!i||n>=3||this.isDestroyed||(this._sendInFlight=!0,setTimeout(()=>{if(this._sendInFlight=!1,this.isDestroyed)return;let a=this._queuedSend;this._queuedSend=null,a?this._postUpdate(a.html,a.identityMap,a.etag):this._postUpdate(e,t,i,n+1)},500*2**n))})}_startPresence(e,t){return this.isDestroyed||this._startGen!==t||this._presenceLease?null:e.connect({send:i=>this._postPresence(i)}).then(i=>this.isDestroyed||this._startGen!==t?(typeof i?.stop=="function"?i.stop():i?.detach(),null):(this._presenceLease=i||null,Ge("presence-editing")),()=>!1).then(i=>{if(!(!i||this.isDestroyed||this._startGen!==t||this._editing))return H().then(n=>{this.isDestroyed||this._startGen!==t||this._editing||(this._editing=new n.EditingSender({}),this._presenceQuiesced?this._editing.stop():(this._editing.start(),this._editing.roster(this._lastRoster)))})})}_postPresence(e){let t=new URL("/_/presence",window.location.origin);return t.searchParams.set("client-id",this.clientId),fetch(t.href,{method:"POST",headers:{"Content-Type":"application/json","Document-URL":window.location.href},body:JSON.stringify(e)}).then(i=>i.ok,()=>!1)}_maybeAcceptExternalChange(e){if(this.lane!=="live")return!1;let t=e.data;return t&&t.kind==="external-change"?(typeof t.html=="string"?this._enqueueExternal(t.html,e.seq,t.etag,t.by):this._fetchExternalChange(e.seq),!0):typeof e.msg=="string"&&e.msg.endsWith("changed on disk outside this tab")?(this._fetchExternalChange(e.seq),!0):!1}_enqueueExternal(e,t,i,n){if(typeof t=="number"){if(t<=this._lastExternalSeq){this._log(`Dropping replayed external change: seq=${t}`);return}this._lastExternalSeq=t}this._pendingExternal={html:e,seq:t,saveEpoch:this._saveEpoch,etag:typeof i=="string"&&i?i:null,by:n??null},this._scheduleNextFrame()}_fetchExternalChange(e){if(typeof e=="number"){if(e<=this._lastExternalSeq)return;this._lastExternalSeq=e}this._fetchServedDocument(e)}_fetchServedDocument(e,{attempt:t=0,repair:i=!1,startup:n=!1}={}){if(n&&(this._morphInFlight||this._pendingHtml!=null||this._pendingExternal!=null)){this._retryStartup(t);return}let r=this._saveEpoch,l=this._startGen,o=this.lastSeenSeq,a=this._applyGen,h=++this._servedFetchId;i&&typeof e!="number"&&(e=this._lastExternalSeq),fetch(new URL(window.location.href),{cache:"no-store"}).then(c=>c.ok?c.text():null).then(c=>{if(this.isDestroyed||c==null||this._startGen!==l)return;let d=At(c),_=n||i&&!!d;if(_){if(h!==this._servedFetchId){i&&this._retryStartup(t+1,{repair:i,startup:n},typeof e=="number"?Math.max(e,this._lastExternalSeq):e);return}if(r!==this._saveEpoch||o!==this.lastSeenSeq||a!==this._applyGen||this._morphInFlight||this._pendingHtml!=null||this._pendingExternal!=null){this._retryStartup(t+1,{repair:i,startup:n},e);return}if(d){if(d===re()){(i||n)&&this.lane==="saved"&&(this._represented=Object.freeze({bytes:c,etag:d,seq:e??null}));return}}else if(!i)return}else if(typeof e=="number"&&e<this._lastExternalSeq){i&&t<3&&this._fetchServedDocument(this._lastExternalSeq,{attempt:t+1,repair:i,startup:n});return}else if(this._saveEpoch>r){t<3&&(console.log("[LiveSync] Refetching external change: own save landed mid-fetch"),this._fetchServedDocument(e,{attempt:t+1,repair:i,startup:n}));return}this._pendingExternal={html:c,seq:e,saveEpoch:r,etag:d,by:null,fetchOptions:{repair:i,startup:n,attempt:t,versionCheck:_},startGen:l,seenSeq:o,applyGen:a,fetchId:h},this._scheduleNextFrame()}).catch(c=>{this._log("External-change fetch failed",c),typeof e=="number"&&this._lastExternalSeq===e&&(this._lastExternalSeq=e-1)})}_retryStartup(e=0,t={startup:!0},i){this.isDestroyed||e>3||(clearTimeout(this._startupRetry),this._startupRetry=setTimeout(()=>{if(this._startupRetry=null,!this.isDestroyed){if(this._morphInFlight||this._pendingHtml!=null||this._pendingExternal!=null){this._retryStartup(e,t,i);return}this._fetchServedDocument(i,{...t,attempt:e})}},16))}applyUpdate(e,t,i,n,r){this.isDestroyed||(this._pendingHtml=e,this._pendingSeq=t,this._pendingIdentityMap=i,this._pendingEtag=n??null,this._pendingBy=r??null,this._scheduleNextFrame())}prepareHandoff(e={}){return this._handoff?Promise.resolve(this._handoff):this.isDestroyed?Promise.reject(new Error("LiveSync: stopped")):(this._handoffHeld=!0,this._rafHandle!=null&&(this._cancelFrame(this._rafHandle),this._rafHandle=null),import("./c-NW54NHKE.js").then(({engineHandoff:t})=>t(this,e)).then(t=>this._handoff=t))}_scheduleNextFrame(){this.isDestroyed||this._handoffHeld||this._rafHandle==null&&(this._morphInFlight||(this._rafHandle=this._requestFrame(()=>this._runPending())))}async _runPending(){if(this._rafHandle=null,this.isDestroyed)return;if(!R()){this._morphInFlight=!0;try{await J()}catch(r){this._log("Merge engine failed to load",r),this._engineRetry=setTimeout(()=>this._scheduleNextFrame(),2e3);return}finally{this._morphInFlight=!1}if(this.isDestroyed)return}let e=this._pendingExternal,t=e?.fetchOptions||null,i=!!(t?.startup||t?.versionCheck),n=!1;if(e!=null&&(i&&this._pendingHtml!=null?n=!1:this._pendingHtml==null?n=!0:n=!(typeof e.seq=="number"&&typeof this._pendingSeq=="number"&&this._pendingSeq<e.seq)),n)if(this._pendingExternal=null,typeof e.seq=="number"&&e.seq<this._lastExternalSeq)i&&t?.repair?this._retryStartup((t.attempt||0)+1,t,this._lastExternalSeq):this._log("Dropping superseded external change at drain");else if(i&&e.startGen!==this._startGen)this._log("Dropping superseded startup check at drain");else if(i&&e.fetchId!==this._servedFetchId)t?.repair?this._retryStartup((t.attempt||0)+1,t,this._lastExternalSeq):this._log("Dropping superseded startup check at drain");else if(i&&(e.saveEpoch!==this._saveEpoch||e.seenSeq!==this.lastSeenSeq||e.applyGen!==this._applyGen))this._retryStartup((t.attempt||0)+1,t,e.seq);else if(i&&e.etag!=null&&e.etag===re())this._log("Startup check found the same version: nothing to apply");else if(!i&&e.saveEpoch!==this._saveEpoch)console.log("[LiveSync] Refetching external change: own save landed after queue"),this._fetchServedDocument(e.seq,t||{});else{this._morphInFlight=!0;try{await this._doApplyExternal(e.html,e.seq,e.etag,e.by,t)}catch(r){console.error("[LiveSync] applyExternal failed:",r)}finally{this._morphInFlight=!1}}else{let r=this._pendingHtml,l=this._pendingSeq,o=this._pendingIdentityMap,a=this._pendingEtag,h=this._pendingBy;if(this._pendingHtml=null,this._pendingSeq=null,this._pendingIdentityMap=null,this._pendingEtag=null,this._pendingBy=null,r==null)return;this._morphInFlight=!0;try{await this._doApplyUpdate(r,l,o,a,h)}catch(c){console.error("[LiveSync] applyUpdate failed:",c)}finally{this._morphInFlight=!1}}!this.isDestroyed&&(this._pendingHtml!=null||this._pendingExternal!=null)&&this._scheduleNextFrame()}_ticket(){return++this._agreeSeq}_setDiskBase(e,t){t<=this._diskBaseTicket||(this._diskBase=e,this._diskBaseTicket=t)}_setPeerBase(e,t,i){return i<this._peerBaseTicket?!1:(this._peerBaseTicket=i,this.lastHtml=e,this._lastIdentityMap=t&&typeof t=="object"&&!Array.isArray(t)?t:null,!0)}_requestFrame(e){return typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(e):setTimeout(e,16)}_cancelFrame(e){if(typeof window<"u"&&typeof window.cancelAnimationFrame=="function"){window.cancelAnimationFrame(e);return}clearTimeout(e)}async _mergeIncoming(e,t,{base:i,baseIdentityMap:n=null,captureLocal:r,synthetic:l,source:o="peer",seq:a=null,etag:h=null,extra:c={}}){R()||await J();let{beginApply:d,completeApply:_,failApply:g,beginLineageCapture:E}=at()||await V(),f,u=p=>{f=E(I.list());try{let v=R().HyperMorph.mergeDocument({...p,lineage:f.lineage});return f.returned(),v}catch(v){throw f.invalidate(I.list()),f.finish(I.list()),v}},S=this.identity,w=Ie,b=Lt(new WeakMap),N=p=>ye(p)?{first:b,map:p,then:b}:b,O=l?p=>b(p)||S.idOf(D(p)||p)||null:b,A=e,Ee=new Map;if(ye(t)){A=new DOMParser().parseFromString(e,"text/html"),ie(A);let p=R().HyperMorph.importMap(A.documentElement,t);for(let v of A.querySelectorAll("[data-id], [id]")){let k=b(v),be=k&&p.get(v);be&&Ee.set(k,be)}}A=ct(A);let Z={live:document,remote:A,ignore:p=>p.matches(ft),opaque:p=>p.matches(pt)||z()&&He(p),remoteWins:p=>p.matches(Dt),ignoreAttribute:(p,v,k)=>It(p,v,k)||z()&&Re(k||p,v),attributeMerge:lt,protectFocusedValue:!0,restoreFocus:document.activeElement?.localName!=="clay-editor-ui",keepLiveOnly:o==="peer",scripts:{mergeTags:R().mergeTagRecognizers},hooks:{beforeAttributeUpdated:w},...c},we=this.lane==="live"&&x(),ke=he(),G,ee=null,F=null;if(i==null)G=u({...Z,base:null,local:{root:X(r()),toLive:D},identity:{local:O,remote:N(t)}});else if(we){let p=r(),v=p.cloneNode(!0);ee=X(p),F=d({source:o,seq:a,etag:h,root:ee,recoveryRoot:v,domain:o==="disk"?"save":"sync"});try{G=u({...Z,base:ct(i),local:{root:ee,toLive:D},identity:{base:N(n),local:O,remote:N(t)}})}catch(k){throw g(F,k),k}}else{let p=X(r()),v=p.ownerDocument;v.documentElement!==p&&v.replaceChild(p,v.documentElement),G=u({...Z,base:v,local:{root:p,toLive:D},fastPath:!0,identity:{base:O,local:O,remote:N(t)}})}let U=this._ticket();this._morphTicket=U;let C;try{C=await G}catch(p){f.invalidate(I.list());try{F&&g(F,p,{ticket:U})}finally{f.finish(I.list())}throw p}let gt=he().gen!==ke.gen,xe;try{f.prepareComplete(C,I.list()),xe=F?_(F,C.conflicts,{ticket:U}):[]}finally{f.finish(I.list())}this.lane==="live"&&C.localDiverged?Je():we&&!C.localDiverged&&Ve(ke);let yt=new Set(ye(t)?Object.values(t):[]);for(let[p,v]of C.identities){let k=yt.has(v)?v:Ee.get(v);k&&S.adopt(p,k)}return{report:C,ticket:U,typedDuringWait:gt,conflictIds:xe}}_saveAfterMerge(e,t){(e||t)&&Xe()&&(y?y.savePageThrottled():bt())}async _doApplyUpdate(e,t,i,n,r=null){if(de(e)){await ue();return}this.lane==="live"&&!y&&await H(),this._log("applyUpdate - pausing mutations and morphing"),this.isPaused=!0;let l=window.scrollX,o=window.scrollY;q.pause(),oe();let a=!1,h=!1,c=!1;try{if(this.lane==="live"&&x()&&this.lastHtml===null){console.log("[LiveSync] Holding incoming update: unsaved local edits and no baseline to merge against"),this._setHeld("live",!0,null);let f=this._saveEpoch,u=this.lastSeenSeq;clearTimeout(this._holdRetryPeer),this._holdRetryPeer=setTimeout(()=>{this._holdRetryPeer=null,!(this.isDestroyed||this._pendingHtml!=null)&&this._saveEpoch===f&&this.lastSeenSeq===u&&(this._pendingHtml=e,this._pendingSeq=t,this._pendingIdentityMap=i,this._pendingBy=r,this._scheduleNextFrame())},3e3);return}this._setHeld("live",!1);let{report:d,ticket:_,typedDuringWait:g,conflictIds:E}=await this._mergeIncoming(e,i,{base:this.lastHtml,baseIdentityMap:this._lastIdentityMap,captureLocal:()=>P({flushUndo:!1}),synthetic:!0,source:"peer",seq:t,etag:n});if(a=d.localDiverged,h=g,ne(),window.scrollTo(l,o),this._setPeerBase(e,i,_),this._applyGen++,this._acceptedSaveTicket>_||(typeof n=="string"&&n?(M(n),c=!0):le()),this.lane==="live"&&!a&&!x()){let{forSave:f,forComparison:u,forDirty:S}=Y({emitForSync:!1,flushUndo:!1});y.setLastSavedBaselines(u,S),this._setDiskBase(f,this._ticket())}this.lane==="saved"&&(this._represented=Object.freeze({bytes:e,etag:n||null,seq:t??null})),document.dispatchEvent(new CustomEvent("clay:sync-applied",{detail:{seq:t,source:this.lane==="saved"?"disk":"peer",lane:this.lane,by:r||null,html:e,report:d,unresolved:this.unresolvedConflicts,conflictIds:E}}))}finally{this._log("applyUpdate - morph complete, resuming mutations"),q.resume(),ae(),await new Promise(d=>setTimeout(d,0)),this.isPaused=!1}c&&y?.conflictResolvedBySync(n),this._saveAfterMerge(a,h)}async _doApplyExternal(e,t,i=null,n=null,r=null){if(de(e)){await ue();return}this.lane==="live"&&!y&&await H();let l=this._diskBase;this._log(`applyExternal - external disk change (seq=${t})`),this.isPaused=!0;let o=window.scrollX,a=window.scrollY;q.pause(),oe();let h=!1,c=!1,d=!1;try{if(this.lane==="live"&&x()&&this._diskBase===null){if(console.log("[LiveSync] Holding external change: unsaved local edits and no baseline to merge against"),this._setHeld("external",!0,null),r?.startup||r?.versionCheck){clearTimeout(this._holdRetryExt),this._holdRetryExt=setTimeout(()=>{if(this._holdRetryExt=null,this.isDestroyed)return;let S=typeof t=="number"?Math.max(t,this._lastExternalSeq):t;this._retryStartup(0,r,S)},3e3);return}let u=this._saveEpoch;clearTimeout(this._holdRetryExt),this._holdRetryExt=setTimeout(()=>{this._holdRetryExt=null,!(this.isDestroyed||this._pendingExternal!=null)&&(this._pendingExternal={html:e,seq:t,saveEpoch:u,etag:i,by:n},this._scheduleNextFrame())},3e3);return}this._setHeld("external",!1);let{report:_,ticket:g,typedDuringWait:E,conflictIds:f}=await this._mergeIncoming(e,null,{base:this._diskBase,captureLocal:()=>Be().saveClone,synthetic:!1,source:"disk",seq:t,etag:i,extra:{beforeApply:u=>Ct(u.documentElement,this.lane)}});if(h=_.localDiverged,c=E,ne(),this._setDiskBase(e,g),window.scrollTo(o,a),this._acceptedSaveTicket>g||(typeof i=="string"&&i?(M(i),d=!0):le()),this.lane==="live"&&!h&&!x()){y.setLastSavedBaselines(...Ft()),y.setUnsavedChanges(!1);let u=P({flushUndo:!1});this._setPeerBase(T(u),this.identity.exportMap(u,D),g),this._applyGen++}this.lane==="saved"&&(this._represented=Object.freeze({bytes:e,etag:i||null,seq:t??null})),document.dispatchEvent(new CustomEvent("clay:sync-applied",{detail:{seq:t,source:"disk",etag:typeof i=="string"&&i?i:null,by:n||null,html:e,report:_,conflictIds:f,unresolved:this.unresolvedConflicts}}))}finally{this._log("applyExternal - morph complete, resuming mutations"),q.resume(),ae(),await new Promise(_=>setTimeout(_,0)),this.isPaused=!1}d&&y?.conflictResolvedBySync(i),this._saveAfterMerge(h,c),l!=null&&j(l)===j(e)&&y&&y.schedulePaintHeal(()=>this._diskBase==null?null:j(this._diskBase))}handleNotification({msgType:e,msg:t,action:i,persistent:n,data:r}){this._log(`Notification received: ${e} - ${t}`),e==="data-loss"||(n&&window.toastPersistent?window.toastPersistent(t,e):window.toast?window.toast(t,e):console.log(`[LiveSync] Notification: ${t}`)),document.dispatchEvent(new CustomEvent("clay:notification",{detail:{msgType:e,msg:t,action:i,persistent:n,data:r}})),this.onNotification&&this.onNotification({msgType:e,msg:t,action:i,persistent:n,data:r})}stop(){this.cleanup(),this.isDestroyed=!0,console.log("[LiveSync] Stopped")}editParticipant(){return H().then(e=>e.syncParticipant(this))}},K=null;Oe((s,e)=>{K=typeof s=="string"?{html:s,captureId:e?.captureId??null}:null});var qt=s=>K&&(K.captureId??null)===(s??null)?K.html:null;function Pt(s,e){if(typeof e!="string"||e===s)return s;let t=i=>new DOMParser().parseFromString(i,"text/html").documentElement;return t(s).isEqualNode(t(e))?e:s}var Se=new ve;typeof window<"u"&&!dt&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>Se.start()):Se.start());var gn=(s,e,t)=>J().then(({morph:i})=>i(s,e,t));var yn=Se;export{I as a,ft as b,Dt as c,ve as d,Se as e,gn as f,yn as g};
@@ -1,2 +1,2 @@
1
- import{a as E,b as S,c as P}from"./c-KBS3UV6B.js";import{i as A,j as q}from"./c-4RFZROCF.js";import"./c-EXKHPOVC.js";import"./c-L5VFATT6.js";import"./c-4TWARTLS.js";import"./c-Q5KAQJAG.js";import"./c-W4JCVLAB.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import{B as T}from"./c-TMT5TL65.js";import{b as k,m as x}from"./c-QIXT3Q7C.js";import"./c-OI2BYWVV.js";import"./c-57XDY6HC.js";import"./c-VHNSBD2M.js";var R=/^[A-Za-z0-9_-]{8,64}$/,D="@",F=100;function _({view:o=null}={}){if(!o)return{run:()=>({ok:!1,code:"not-editing"}),dispose(){}};let f=o.dom.ownerDocument,y=()=>globalThis.clay?.people??null,l=null;function d(t){let e=o.state;if(!e.selection.empty)return null;let r=e.selection.head;if(r<=t.from||r-t.from>F+1||r>e.doc.content.size)return null;let n=e.doc.resolve(t.from);return!n.parent.isTextblock||n.parent.type.spec.code||r>n.end()||r<n.start()||n.parentOffset&&!/\s/.test(e.doc.textBetween(t.from-1,t.from,"",`
1
+ import{a as E,b as S,c as P}from"./c-KBS3UV6B.js";import{i as A,j as q}from"./c-LIGQYZ7M.js";import"./c-EXKHPOVC.js";import"./c-L5VFATT6.js";import"./c-6RDOKLN7.js";import"./c-DTMZ3ZHI.js";import"./c-W4JCVLAB.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import{B as T}from"./c-HCNWJE4A.js";import{b as k,m as x}from"./c-QIXT3Q7C.js";import"./c-LCYPMULG.js";import"./c-57XDY6HC.js";import"./c-VHNSBD2M.js";var R=/^[A-Za-z0-9_-]{8,64}$/,D="@",F=100;function _({view:o=null}={}){if(!o)return{run:()=>({ok:!1,code:"not-editing"}),dispose(){}};let f=o.dom.ownerDocument,y=()=>globalThis.clay?.people??null,l=null;function d(t){let e=o.state;if(!e.selection.empty)return null;let r=e.selection.head;if(r<=t.from||r-t.from>F+1||r>e.doc.content.size)return null;let n=e.doc.resolve(t.from);return!n.parent.isTextblock||n.parent.type.spec.code||r>n.end()||r<n.start()||n.parentOffset&&!/\s/.test(e.doc.textBetween(t.from-1,t.from,"",`
2
2
  `))||e.doc.textBetween(t.from,t.from+1)!==D?null:{head:r,query:e.doc.textBetween(t.from+1,r)}}function $(t){try{let e=o.dom.parentElement?.getBoundingClientRect?.()??{left:0,top:0},r=o.coordsAtPos(t.from);return{x:Math.max(8,r.left-e.left),y:r.bottom+6-e.top}}catch{return null}}function h(t){let e=t.picker.activeId();e?o.dom.setAttribute("aria-activedescendant",e):o.dom.getAttribute("aria-activedescendant")?.startsWith(t.picker.el.id)&&o.dom.removeAttribute("aria-activedescendant")}function m(t){t.picker.show(S(E(t.saved,t.allowed),t.query),$(t)),h(t)}function i(){let t=l;if(t){l=null;for(let[e,r,n,s]of t.listen)e.removeEventListener(r,n,s);o.dom.getAttribute("aria-activedescendant")?.startsWith(`${t.picker.el.id}-`)&&o.dom.removeAttribute("aria-activedescendant"),t.picker.destroy()}}function p(){let t=l;if(!t||o.composing)return;let e=d(t);if(!e)return i();t.query=e.query,m(t)}async function g(t){let e=l;if(!e)return{ok:!1,code:"not-editing"};let r=e.picker.personAt(t),n=d(e);if(!(r&&n&&n.query===e.query&&R.test(String(r.id??""))&&String(r.name??"").trim()))return i(),{ok:!1,code:r?"stale-target":"no-person"};let c=String(r.name).trim();return i(),A(o,()=>{let u=d(e);if(!u||u.query!==e.query)return{ok:!1,code:"stale-target"};let a=o.state.tr.insertText(c,e.from,u.head);return a.addMark(e.from,e.from+c.length,x.marks.mention.create({id:r.id})),a.insertText(" ",e.from+c.length),a.setSelection(k.TextSelection.create(a.doc,e.from+c.length+1)),o.dispatch(T(a)),o.focus(),{ok:!0,id:r.id,label:c}})}function B(t){let e=l;if(!e||q(t,o))return;let r=()=>{t.preventDefault(),t.stopPropagation()};t.key==="ArrowDown"||t.key==="ArrowUp"?(r(),e.picker.move(t.key==="ArrowDown"?1:-1),h(e)):t.key==="Enter"?(r(),g(e.picker.index())):(t.key==="Escape"||t.key==="Tab")&&(r(),i())}function I(t){let e=y()?.available;e&&Promise.resolve().then(()=>e()).then(r=>{l===t&&(t.allowed=Array.isArray(r)?r:null,m(t))}).catch(()=>{})}function M(t){i();let e=P({document:f,onPick:c=>g(c)}),r={from:t,picker:e,query:"",allowed:null,saved:[],listen:[]};try{r.saved=y()?.list?.()??[]}catch{r.saved=[]}l=r;let n=(c,u,a,b)=>{c.addEventListener(u,a,b),r.listen.push([c,u,a,b])};n(f,"keydown",c=>B(c),!0),n(o.dom,"input",()=>p()),n(o.dom,"keyup",()=>p()),n(o.dom,"compositionend",()=>p()),n(f,"mousedown",c=>{r.picker.el.contains(c.target)||i()},!0),(o.dom.parentElement??f.body).appendChild(e.el);let s=d(r);return s?(r.query=s.query,m(r),I(r),{ok:!0,picker:!0}):(i(),{ok:!1,code:"stale-target"})}return{async run(t={}){let e=Number.isInteger(t?.from)?t.from:null;if(e===null){let r=o.state,n=r.selection.$from;if(!r.selection.empty||!n.parent.isTextblock||n.parent.type.spec.code)return{ok:!1,code:"stale-target"};e=r.selection.from;let s=o.state.tr.insertText(D);s.setSelection(k.TextSelection.create(s.doc,e+1)),o.dispatch(s)}return M(e)},dispose(){i()}}}export{_ as createFeature};
@@ -1 +1 @@
1
- import{e as c,f as s}from"./c-TWCXBWS3.js";import{k as g,q as u}from"./c-EGTIAL6P.js";import{i as l}from"./c-ICMAOOGK.js";var p={debug:!1};function t(...n){p.debug&&console.log("[save-freeze]",...n)}var f=new WeakMap;function m(n,o){f=new WeakMap;let e=n.querySelectorAll(l);t("freezing clone:",e.length);for(let r of e){let a=o.original(r);if(!a)continue;let i=c(a);i!==void 0&&(f.set(r,i),r.innerHTML!==i&&(t("restoring original"),r.innerHTML=i))}}function d(n){for(let o of n.querySelectorAll(l)){let e=f.get(o);e!==void 0&&o.innerHTML!==e&&(t("re-restoring original after prepare-phase change"),o.innerHTML=e)}}function E(){t("init"),s(),g(m),u(d)}E();var h=p;export{h as a};
1
+ import{e as c,f as s}from"./c-TWCXBWS3.js";import{k as g,r as u}from"./c-PWJSJEJU.js";import{i as l}from"./c-ICMAOOGK.js";var p={debug:!1};function t(...n){p.debug&&console.log("[save-freeze]",...n)}var f=new WeakMap;function m(n,o){f=new WeakMap;let e=n.querySelectorAll(l);t("freezing clone:",e.length);for(let r of e){let a=o.original(r);if(!a)continue;let i=c(a);i!==void 0&&(f.set(r,i),r.innerHTML!==i&&(t("restoring original"),r.innerHTML=i))}}function d(n){for(let o of n.querySelectorAll(l)){let e=f.get(o);e!==void 0&&o.innerHTML!==e&&(t("re-restoring original after prepare-phase change"),o.innerHTML=e)}}function E(){t("init"),s(),g(m),u(d)}E();var h=p;export{h as a};
@@ -1 +1 @@
1
- import{a,b,c,d}from"./c-VSPAFOKU.js";import"./c-EGTIAL6P.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{b as serializeCloneSteps,c as serializeForCompareSteps,d as serializeForSyncSteps,a as serializeTreeSteps};
1
+ import{a,b,c,d}from"./c-RO73MKKR.js";import"./c-PWJSJEJU.js";import"./c-XQXZAO7N.js";import"./c-S7LK4KUE.js";import"./c-VG5XIN4T.js";import"./c-2YYDMLNZ.js";import"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{b as serializeCloneSteps,c as serializeForCompareSteps,d as serializeForSyncSteps,a as serializeTreeSteps};
@@ -1 +1 @@
1
- import{a as b,b as C,c as O,d as L,e as R,f as A,g as S,h as T,i as I}from"../c-N7Y52HJH.js";import{a as l,b as u,c,d as f}from"../c-ZSCBEB7I.js";import{a as d,b as E,c as m,d as p}from"../c-TUGVINJR.js";import"../c-TWCXBWS3.js";import"../c-VKEDWYDF.js";import{a}from"../c-LA2BW7UY.js";import"../c-IJUK2GPW.js";import{f as s}from"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-EGTIAL6P.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var N=[d,R,A,b,l].join(", "),x=[E,S,C,u],o=null,n=null,i=!1,D=t=>{let e=t.parentNode||t;for(let q of x)q(e)};function r(){i=!0,!n&&(n=a.onAddElement({selectorFilter:N,require:"observed",pausable:!1,debounce:0},t=>{i&&t.forEach(({element:e})=>D(e))}))}function k(){i=!1,n&&(n(),n=null)}function h(){return o||(p(),I(),L(),f(),o={selector:N},s&&r(),o)}h();function w(t=document){return{enable(){for(let e of x)e(t);r()},quiesce(){i=!1},resume(){i=!0},dispose(){k(),m(),T(),O(),c()}}}function y(){return{id:"clay:controls",order:110,prepare(t={}){let e=w();return t.initial!==!0?e:{enable:()=>r(),quiesce:()=>e.quiesce(),resume:()=>e.resume(),dispose:()=>e.dispose()}}}}var F=h;export{w as controlsLease,F as default,h as init,h as install,y as modeParticipant};
1
+ import{a as b,b as C,c as O,d as L,e as R,f as A,g as S,h as T,i as I}from"../c-BXYSDKAN.js";import{a as l,b as u,c,d as f}from"../c-UHUNXWKN.js";import{a as d,b as E,c as m,d as p}from"../c-W5E5P2TZ.js";import"../c-TWCXBWS3.js";import"../c-VKEDWYDF.js";import{a}from"../c-LA2BW7UY.js";import"../c-IJUK2GPW.js";import{f as s}from"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-PWJSJEJU.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var N=[d,R,A,b,l].join(", "),x=[E,S,C,u],o=null,n=null,i=!1,D=t=>{let e=t.parentNode||t;for(let q of x)q(e)};function r(){i=!0,!n&&(n=a.onAddElement({selectorFilter:N,require:"observed",pausable:!1,debounce:0},t=>{i&&t.forEach(({element:e})=>D(e))}))}function k(){i=!1,n&&(n(),n=null)}function h(){return o||(p(),I(),L(),f(),o={selector:N},s&&r(),o)}h();function w(t=document){return{enable(){for(let e of x)e(t);r()},quiesce(){i=!1},resume(){i=!0},dispose(){k(),m(),T(),O(),c()}}}function y(){return{id:"clay:controls",order:110,prepare(t={}){let e=w();return t.initial!==!0?e:{enable:()=>r(),quiesce:()=>e.quiesce(),resume:()=>e.resume(),dispose:()=>e.dispose()}}}}var F=h;export{w as controlsLease,F as default,h as init,h as install,y as modeParticipant};
@@ -1 +1 @@
1
- import{Q as e,g as i}from"../c-DKFSOJCV.js";import"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import{a as p}from"../c-5VYOWDTI.js";import"../c-GSRLXYWL.js";import"../c-X5LNHET5.js";import{a as f,b as m}from"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import{a as d}from"../c-LA2BW7UY.js";import"../c-ZKELCT4T.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import{c}from"../c-IJUK2GPW.js";import{f as a}from"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-EGTIAL6P.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import{s as n,v as o}from"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";function y(){d.onAnyChange({debounce:0,omitChangeDetails:!0,require:"autosave"},()=>{i()&&e.noteActivity()})}function A(){document.addEventListener("input",t=>{t.target.closest(f)&&(t.isTrusted&&!o(n(t.target),"dirty")&&c(),i()&&e.noteActivity())},!0)}function g(){let t=v=>{if(!e.pending())return;let r=v.target;if(!r||typeof r.closest!="function")return;let s=r.closest("input, textarea, select, [contenteditable]");s&&(o(n(s),"dirty")||i()&&e.noteActivity())};document.addEventListener("input",t,!0),document.addEventListener("compositionupdate",t,!0)}var l=!1;function u(){l||document.documentElement.matches(m)&&a&&(l=!0,p(!0),y(),A(),g())}u();var C=u;function L(){return{id:"clay:autosave",order:20,prepare(t={}){return t.initial===!0?{enable(){},quiesce(){},resume(){},dispose(){}}:{enable:u,quiesce(){},resume(){},dispose(){}}}}}export{C as default,u as init,L as modeParticipant};
1
+ import{Q as e,g as i}from"../c-2ZVOEU4M.js";import"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import{a as p}from"../c-5VYOWDTI.js";import"../c-GSRLXYWL.js";import"../c-X5LNHET5.js";import{a as f,b as m}from"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import{a as d}from"../c-LA2BW7UY.js";import"../c-XCFQEWW6.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import{c}from"../c-IJUK2GPW.js";import{f as a}from"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-PWJSJEJU.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import{s as n,v as o}from"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";function y(){d.onAnyChange({debounce:0,omitChangeDetails:!0,require:"autosave"},()=>{i()&&e.noteActivity()})}function A(){document.addEventListener("input",t=>{t.target.closest(f)&&(t.isTrusted&&!o(n(t.target),"dirty")&&c(),i()&&e.noteActivity())},!0)}function g(){let t=v=>{if(!e.pending())return;let r=v.target;if(!r||typeof r.closest!="function")return;let s=r.closest("input, textarea, select, [contenteditable]");s&&(o(n(s),"dirty")||i()&&e.noteActivity())};document.addEventListener("input",t,!0),document.addEventListener("compositionupdate",t,!0)}var l=!1;function u(){l||document.documentElement.matches(m)&&a&&(l=!0,p(!0),y(),A(),g())}u();var C=u;function L(){return{id:"clay:autosave",order:20,prepare(t={}){return t.initial===!0?{enable(){},quiesce(){},resume(){},dispose(){}}:{enable:u,quiesce(){},resume(){},dispose(){}}}}}export{C as default,u as init,L as modeParticipant};
@@ -1 +1 @@
1
- import{a as s}from"../c-VKEDWYDF.js";import{q as u}from"../c-DKFSOJCV.js";import"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import"../c-5VYOWDTI.js";import"../c-GSRLXYWL.js";import"../c-X5LNHET5.js";import"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import"../c-LA2BW7UY.js";import"../c-ZKELCT4T.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import{f as d}from"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import{b as a}from"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-EGTIAL6P.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var c=()=>window.clay?.conflicts||null,o=!1,i=null,r=null;function e(n){o||(o=!0,m(),import("../c-XZJ5IK6Q.js").then(t=>{i=t,t.start(n)},t=>{console.error("clayjs: the conflict notice could not be downloaded; it will try again on the next conflict",t),o=!1,l()}))}function l(){r||=new AbortController;let{signal:n}=r;document.addEventListener("clay:sync-conflicts-changed",p,{signal:n}),document.addEventListener("clay:save-conflict",g,{signal:n}),document.addEventListener("clay:document-upgraded",h,{signal:n}),document.addEventListener("clay:undo-kept",y,{signal:n})}function m(){r?.abort(),r=null}function p(n){c()?.size&&e(n)}function g(n){e(n)}function h(n){e(n)}function y(n){n?.detail?.ok===!0&&e(n)}var v="conflicts",E="undo",f=n=>a.local.get(n)?.count>0;function w(){f(E)&&e(null),f(v)&&import("../c-OIDRZKAF.js").then(n=>{!o&&n.pendingConflicts()>0&&e(null)},()=>{})}function b(){let n=(c()?.list?.()??[]).filter(t=>!t.claimedBy).map(t=>t.id);return n.length?n:u()?["save"]:[]}function x(){return{id:"clay:conflict-notice",order:960,prepare(n={}){return{enable(){n.initial!==!0&&!i&&!o&&l()},quiesce(){let t=b();if(t.length)throw Object.assign(new Error("clay.conflict-notice: a conflict here is still unresolved"),{code:"conflict",pending:t})},resume(){},dispose(){m(),o=!1,i?.stop?.(),i=null}}}}}s(()=>{d&&(c()?.size?e(null):(l(),w()))});export{x as conflictNoticeParticipant,x as modeParticipant};
1
+ import{a as s}from"../c-VKEDWYDF.js";import{q as u}from"../c-2ZVOEU4M.js";import"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import"../c-5VYOWDTI.js";import"../c-GSRLXYWL.js";import"../c-X5LNHET5.js";import"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import"../c-LA2BW7UY.js";import"../c-XCFQEWW6.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import{f as d}from"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import{b as a}from"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-PWJSJEJU.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var c=()=>window.clay?.conflicts||null,o=!1,i=null,r=null;function e(n){o||(o=!0,m(),import("../c-T5NK2TVY.js").then(t=>{i=t,t.start(n)},t=>{console.error("clayjs: the conflict notice could not be downloaded; it will try again on the next conflict",t),o=!1,l()}))}function l(){r||=new AbortController;let{signal:n}=r;document.addEventListener("clay:sync-conflicts-changed",p,{signal:n}),document.addEventListener("clay:save-conflict",g,{signal:n}),document.addEventListener("clay:document-upgraded",h,{signal:n}),document.addEventListener("clay:undo-kept",y,{signal:n})}function m(){r?.abort(),r=null}function p(n){c()?.size&&e(n)}function g(n){e(n)}function h(n){e(n)}function y(n){n?.detail?.ok===!0&&e(n)}var v="conflicts",E="undo",f=n=>a.local.get(n)?.count>0;function w(){f(E)&&e(null),f(v)&&import("../c-OIDRZKAF.js").then(n=>{!o&&n.pendingConflicts()>0&&e(null)},()=>{})}function b(){let n=(c()?.list?.()??[]).filter(t=>!t.claimedBy).map(t=>t.id);return n.length?n:u()?["save"]:[]}function x(){return{id:"clay:conflict-notice",order:960,prepare(n={}){return{enable(){n.initial!==!0&&!i&&!o&&l()},quiesce(){let t=b();if(t.length)throw Object.assign(new Error("clay.conflict-notice: a conflict here is still unresolved"),{code:"conflict",pending:t})},resume(){},dispose(){m(),o=!1,i?.stop?.(),i=null}}}}}s(()=>{d&&(c()?.size?e(null):(l(),w()))});export{x as conflictNoticeParticipant,x as modeParticipant};
@@ -1,3 +1,3 @@
1
- import{a as h}from"../c-WYFDLITL.js";import{f as m}from"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import{k as b}from"../c-EGTIAL6P.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";function v(t){return(t.getAttribute("type")||"text").toLowerCase()}function d(t){let n=t.tagName;if(n==="INPUT"){let i=v(t);i==="checkbox"||i==="radio"?t.checked?t.setAttribute("checked",""):t.removeAttribute("checked"):t.setAttribute("value",t.value);return}if(n==="TEXTAREA"){t.setAttribute("data-value",t.value);return}if(n==="SELECT"){let i=t.options;for(let o=0;o<i.length;o++)i[o].selected?i[o].setAttribute("selected",""):i[o].removeAttribute("selected")}}function y(t,n=t){let i=t.tagName;if(i==="INPUT"){let o=v(t);o==="checkbox"||o==="radio"?n.checked?t.hasAttribute("checked")||t.setAttribute("checked",""):t.removeAttribute("checked"):n.value!==(t.getAttribute("value")??"")&&t.setAttribute("value",n.value);return}if(i==="TEXTAREA"){let o=n.value.startsWith(`
1
+ import{a as h}from"../c-WYFDLITL.js";import{f as m}from"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import{k as b}from"../c-PWJSJEJU.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";function v(t){return(t.getAttribute("type")||"text").toLowerCase()}function d(t){let n=t.tagName;if(n==="INPUT"){let i=v(t);i==="checkbox"||i==="radio"?t.checked?t.setAttribute("checked",""):t.removeAttribute("checked"):t.setAttribute("value",t.value);return}if(n==="TEXTAREA"){t.setAttribute("data-value",t.value);return}if(n==="SELECT"){let i=t.options;for(let o=0;o<i.length;o++)i[o].selected?i[o].setAttribute("selected",""):i[o].removeAttribute("selected")}}function y(t,n=t){let i=t.tagName;if(i==="INPUT"){let o=v(t);o==="checkbox"||o==="radio"?n.checked?t.hasAttribute("checked")||t.setAttribute("checked",""):t.removeAttribute("checked"):n.value!==(t.getAttribute("value")??"")&&t.setAttribute("value",n.value);return}if(i==="TEXTAREA"){let o=n.value.startsWith(`
2
2
  `)?`
3
3
  `+n.value:n.value;t.textContent!==o&&(t.textContent=o),t.removeAttribute("data-value");return}if(i==="SELECT"){let o=t.options,u=n.options;for(let s=0;s<o.length;s++)u[s]&&u[s].selected?o[s].hasAttribute("selected")||o[s].setAttribute("selected",""):o[s].removeAttribute("selected")}}function E(t=h){let n=`input${t}:not([type="password"]):not([type="hidden"]):not([type="file"])`,i=`textarea${t}`,o=`select${t}`,u=a=>{if(!m)return;let e=a.target;(e.matches(n)&&e.type!=="checkbox"&&e.type!=="radio"||e.matches(i))&&d(e)};document.addEventListener("input",u,!0);let s=a=>{if(!m)return;let e=a.target;if((e.matches(n)&&(e.type==="checkbox"||e.type==="radio")||e.matches(o))&&(d(e),e.type==="radio"&&e.name)){let c=e.form?[...e.form.elements]:[...document.getElementsByName(e.name)];for(let r of c)r!==e&&r.type==="radio"&&r.name===e.name&&r.form===e.form&&r.matches(n)&&d(r)}};document.addEventListener("change",s,!0);let x=[{target:document,type:"input",handler:u,options:!0},{target:document,type:"change",handler:s,options:!0}];return b((a,e)=>{let c=r=>{a.querySelectorAll(r).forEach(f=>{let A=e.original(f);A&&y(f,A)})};c(n),c(i);for(let r of a.querySelectorAll(o))if(e.original(r))for(let l of r.options){let f=e.original(l);f&&f.selected?l.hasAttribute("selected")||l.setAttribute("selected",""):l.removeAttribute("selected")}}),{stop(){for(let{target:a,type:e,handler:c,options:r}of x.splice(0))a.removeEventListener(e,c,r)}}}var p=null;function T(){return p||(p=E(h),p)}T();export{E as default,T as init,T as install};
@@ -1 +1 @@
1
- import{A as C,B as D,C as E,D as F,E as G,F as H,G as I,H as J,I as K,J as L,K as M,L as N,M as O,N as P,O as Q,P as R,Q as S,R as T,S as U,T as V,U as W,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p,o as q,p as r,q as s,r as t,s as u,t as v,u as w,v as x,w as y,x as z,y as A,z as B}from"../c-DKFSOJCV.js";import{a as e}from"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import"../c-5VYOWDTI.js";import"../c-GSRLXYWL.js";import"../c-X5LNHET5.js";import"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import"../c-LA2BW7UY.js";import{b as c,c as d}from"../c-ZKELCT4T.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import{J as b,q as a}from"../c-EGTIAL6P.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{e as SLICED_SAVE_MIN_BYTES,l as acceptedReceipt,a as addDocumentTransform,m as adoptEntryBaseline,h as autosaveIsSuspended,S as autosaveScheduler,L as baselineSettled,x as closeSavePermit,t as conflictResolvedBySync,M as currentPaintSignature,W as default,H as flushSave,C as getLastSavedBytes,A as getLastSavedContents,B as getLastSavedDirty,b as getPageContents,y as getUnsavedChanges,o as holdAllSaves,V as init,U as initHyperclaySaveButton,T as initSaveKeyboardShortcut,d as inspectSaveSize,s as isSaveConflicted,n as modeParticipant,w as openSavePermit,p as releaseAllSaves,Q as releaseBootSettle,J as replacePageWith,g as resumeAutosave,u as saveGeneration,r as saveHoldReason,c as saveLimits,I as saveOverwritingConflict,F as savePage,G as savePageForce,K as savePageSoon,R as savePageThrottled,k as saveSession,i as savesAdmitted,q as savesHeld,N as schedulePaintHeal,j as sessionParked,D as setLastSavedBaselines,E as setLastSavedContents,v as setSaveGeneration,z as setUnsavedChanges,P as styleAdoptionPending,O as styleAdoptionsSettled,f as suspendAutosave};
1
+ import{A as C,B as D,C as E,D as F,E as G,F as H,G as I,H as J,I as K,J as L,K as M,L as N,M as O,N as P,O as Q,P as R,Q as S,R as T,S as U,T as V,U as W,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p,o as q,p as r,q as s,r as t,s as u,t as v,u as w,v as x,w as y,x as z,y as A,z as B}from"../c-2ZVOEU4M.js";import{a as e}from"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import"../c-5VYOWDTI.js";import"../c-GSRLXYWL.js";import"../c-X5LNHET5.js";import"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import"../c-LA2BW7UY.js";import{b as c,c as d}from"../c-XCFQEWW6.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import{K as b,r as a}from"../c-PWJSJEJU.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{e as SLICED_SAVE_MIN_BYTES,l as acceptedReceipt,a as addDocumentTransform,m as adoptEntryBaseline,h as autosaveIsSuspended,S as autosaveScheduler,L as baselineSettled,x as closeSavePermit,t as conflictResolvedBySync,M as currentPaintSignature,W as default,H as flushSave,C as getLastSavedBytes,A as getLastSavedContents,B as getLastSavedDirty,b as getPageContents,y as getUnsavedChanges,o as holdAllSaves,V as init,U as initHyperclaySaveButton,T as initSaveKeyboardShortcut,d as inspectSaveSize,s as isSaveConflicted,n as modeParticipant,w as openSavePermit,p as releaseAllSaves,Q as releaseBootSettle,J as replacePageWith,g as resumeAutosave,u as saveGeneration,r as saveHoldReason,c as saveLimits,I as saveOverwritingConflict,F as savePage,G as savePageForce,K as savePageSoon,R as savePageThrottled,k as saveSession,i as savesAdmitted,q as savesHeld,N as schedulePaintHeal,j as sessionParked,D as setLastSavedBaselines,E as setLastSavedContents,v as setSaveGeneration,z as setUnsavedChanges,P as styleAdoptionPending,O as styleAdoptionsSettled,f as suspendAutosave};
@@ -1 +1 @@
1
- import{d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q,o as r,p as s,q as t,r as u,s as v,t as w,u as x,v as y,w as z,x as A}from"../c-ZKELCT4T.js";import{a as d}from"../c-ATKAOH23.js";import{b as e,h as f}from"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import{J as c,k as a,q as b}from"../c-EGTIAL6P.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{e as PAGE_FORMAT_META,b as addDocumentTransform,u as buildSaveRequest,r as claimDocumentOperation,A as exitSave,c as getPageContents,i as isSaveInProgress,l as keepaliveHeld,f as knownPageFormatFloor,p as mintSaveId,d as onSaveAccepted,m as onSaveAttempt,n as onSaveOutcome,a as onSnapshot,t as operationKind,s as releaseDocumentOperation,k as releaseSaveLane,y as replacePageWith,j as reserveSaveLane,q as resetSaveAttempts,w as saveCapturedHtml,x as saveConversion,o as saveFateIsUnknown,v as saveHtml,z as setExitSave,g as setSaveHeader,h as withKeepalive};
1
+ import{d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q,o as r,p as s,q as t,r as u,s as v,t as w,u as x,v as y,w as z,x as A}from"../c-XCFQEWW6.js";import{a as d}from"../c-ATKAOH23.js";import{b as e,h as f}from"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import{K as c,k as a,r as b}from"../c-PWJSJEJU.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{e as PAGE_FORMAT_META,b as addDocumentTransform,u as buildSaveRequest,r as claimDocumentOperation,A as exitSave,c as getPageContents,i as isSaveInProgress,l as keepaliveHeld,f as knownPageFormatFloor,p as mintSaveId,d as onSaveAccepted,m as onSaveAttempt,n as onSaveOutcome,a as onSnapshot,t as operationKind,s as releaseDocumentOperation,k as releaseSaveLane,y as replacePageWith,j as reserveSaveLane,q as resetSaveAttempts,w as saveCapturedHtml,x as saveConversion,o as saveFateIsUnknown,v as saveHtml,z as setExitSave,g as setSaveHeader,h as withKeepalive};
@@ -0,0 +1 @@
1
+ import{A,B,C,D,E,F,G,H,I,J,K,L,M,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../c-PWJSJEJU.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{r as addDocumentTransform,d as attachCaptureArtifact,j as canonicalizeReceived,g as captureArtifact,J as captureBodyForSync,x as captureForComparison,z as captureForComparisonAndDirty,y as captureForDirtyCheck,F as captureForMerge,G as captureForSave,E as captureForSaveAndComparison,f as capturePageState,M as captureRecoveryPage,u as captureSaveClone,t as captureSnapshot,s as clonePreventingOnclone,C as completeSaveCapture,I as copyCaptureClone,c as currentCaptureContext,a as currentCaptureId,K as getPageContents,n as noscriptBlocks,o as noscriptsAsText,k as onSnapshot,b as originalSnapshotNode,v as prepareForCompare,A as prepareSaveCapture,B as readCapturePageState,h as releaseCaptureArtifact,D as releaseSaveCapture,q as runSaveRenderer,m as serializeClone,w as serializeForCompare,H as serializeForSync,L as serializeRecoveryClone,e as setCapturePageState,i as setCloneCanonicalizer,l as setSaveRenderer,p as swapNoscriptMarkers};
@@ -1 +1 @@
1
- import{a,b,c}from"../c-DKFSOJCV.js";import"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import"../c-5VYOWDTI.js";import"../c-GSRLXYWL.js";import"../c-X5LNHET5.js";import"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import"../c-LA2BW7UY.js";import"../c-ZKELCT4T.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-EGTIAL6P.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{c as bytesUnsaved,b as hasUnsavedChanges,a as reloadAfterDiscard};
1
+ import{a,b,c}from"../c-2ZVOEU4M.js";import"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import"../c-5VYOWDTI.js";import"../c-GSRLXYWL.js";import"../c-X5LNHET5.js";import"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import"../c-LA2BW7UY.js";import"../c-XCFQEWW6.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-PWJSJEJU.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";export{c as bytesUnsaved,b as hasUnsavedChanges,a as reloadAfterDiscard};
@@ -1 +1 @@
1
- import{f as t,s as n,v as i}from"../c-ZKELCT4T.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import{F as o,q as a,s as e}from"../c-EGTIAL6P.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import{w as r}from"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var s=window.clay=window.clay||{};s.internals={captureSnapshot:e,captureForSave:o,addDocumentTransform:a,region:r,save:{saveHtml:n,replacePageWith:i,isSaveInProgress:t}};var l=s.internals;export{l as default};
1
+ import{f as t,s as n,v as i}from"../c-XCFQEWW6.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import{G as o,r as a,t as e}from"../c-PWJSJEJU.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import{w as r}from"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var s=window.clay=window.clay||{};s.internals={captureSnapshot:e,captureForSave:o,addDocumentTransform:a,region:r,save:{saveHtml:n,replacePageWith:i,isSaveInProgress:t}};var l=s.internals;export{l as default};