hyper-html-api 0.14.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) hide show
  1. package/conformance/MANIFEST.json +2 -2
  2. package/conformance/cases/codec-form-nested.error.json +5 -0
  3. package/conformance/cases/codec-form-nested.html +4 -0
  4. package/conformance/cases/codec-form-nested.meta +6 -0
  5. package/conformance/cases/codec-form-nested.parsed.json +5 -0
  6. package/conformance/cases/codec-form-star.error.json +5 -0
  7. package/conformance/cases/codec-form-star.html +4 -0
  8. package/conformance/cases/codec-form-star.meta +6 -0
  9. package/conformance/cases/codec-form-star.parsed.json +3 -0
  10. package/conformance/cases/codec-form-under-v1.error.json +5 -0
  11. package/conformance/cases/codec-form-under-v1.html +4 -0
  12. package/conformance/cases/codec-form-under-v1.meta +6 -0
  13. package/conformance/cases/codec-form-under-v1.parsed.json +3 -0
  14. package/conformance/cases/codec-unknown-name.error.json +5 -0
  15. package/conformance/cases/codec-unknown-name.html +4 -0
  16. package/conformance/cases/codec-unknown-name.meta +6 -0
  17. package/conformance/cases/codec-unknown-name.parsed.json +3 -0
  18. package/conformance/cases/tag-version-2-plain.expected.json +7 -0
  19. package/conformance/cases/tag-version-2-plain.html +5 -0
  20. package/conformance/cases/tag-version-2-plain.meta +6 -0
  21. package/conformance/cases/tag-version-2-plain.parsed.json +4 -0
  22. package/conformance/cases/tag-wrong-version.error.json +1 -1
  23. package/conformance/cases/tag-wrong-version.html +1 -1
  24. package/conformance/sheet/body-data-write.body.json +3 -0
  25. package/conformance/sheet/body-data-write.data.json +3 -0
  26. package/conformance/sheet/body-data-write.html +25 -0
  27. package/conformance/sheet/body-data-write.meta +5 -0
  28. package/conformance/sheet/body-patch-key-in-rules.body.json +3 -0
  29. package/conformance/sheet/body-patch-key-in-rules.data.json +13 -0
  30. package/conformance/sheet/body-patch-key-in-rules.html +18 -0
  31. package/conformance/sheet/body-patch-key-in-rules.meta +5 -0
  32. package/conformance/sheet/body-patch-not-array.body.json +3 -0
  33. package/conformance/sheet/body-patch-not-array.data.json +3 -0
  34. package/conformance/sheet/body-patch-not-array.html +25 -0
  35. package/conformance/sheet/body-patch-not-array.meta +5 -0
  36. package/conformance/sheet/body-patch-on-sheet.body.json +3 -0
  37. package/conformance/sheet/body-patch-on-sheet.data.json +14 -0
  38. package/conformance/sheet/body-patch-on-sheet.html +25 -0
  39. package/conformance/sheet/body-patch-on-sheet.meta +5 -0
  40. package/conformance/sheet/body-patch-version-1.body.json +3 -0
  41. package/conformance/sheet/body-patch-version-1.data.json +13 -0
  42. package/conformance/sheet/body-patch-version-1.html +4 -0
  43. package/conformance/sheet/body-patch-version-1.meta +5 -0
  44. package/conformance/sheet/body-patch-with-other-key.body.json +3 -0
  45. package/conformance/sheet/body-patch-with-other-key.data.json +14 -0
  46. package/conformance/sheet/body-patch-with-other-key.html +25 -0
  47. package/conformance/sheet/body-patch-with-other-key.meta +5 -0
  48. package/conformance/sheet/body-patch-without-operation-id.body.json +3 -0
  49. package/conformance/sheet/body-patch-without-operation-id.data.json +13 -0
  50. package/conformance/sheet/body-patch-without-operation-id.html +25 -0
  51. package/conformance/sheet/body-patch-without-operation-id.meta +5 -0
  52. package/conformance/sheet/params-bad-range.error.json +6 -0
  53. package/conformance/sheet/params-bad-range.html +25 -0
  54. package/conformance/sheet/params-bad-range.meta +6 -0
  55. package/conformance/sheet/params-bad-render.error.json +6 -0
  56. package/conformance/sheet/params-bad-render.html +25 -0
  57. package/conformance/sheet/params-bad-render.meta +6 -0
  58. package/conformance/sheet/params-bad-shape.error.json +6 -0
  59. package/conformance/sheet/params-bad-shape.html +25 -0
  60. package/conformance/sheet/params-bad-shape.meta +6 -0
  61. package/conformance/sheet/params-cache-buster.expected.json +128 -0
  62. package/conformance/sheet/params-cache-buster.html +25 -0
  63. package/conformance/sheet/params-cache-buster.meta +6 -0
  64. package/conformance/sheet/params-data-alone.expected.json +128 -0
  65. package/conformance/sheet/params-data-alone.html +25 -0
  66. package/conformance/sheet/params-data-alone.meta +6 -0
  67. package/conformance/sheet/params-empty.error.json +6 -0
  68. package/conformance/sheet/params-empty.html +25 -0
  69. package/conformance/sheet/params-empty.meta +6 -0
  70. package/conformance/sheet/params-index.expected.json +19 -0
  71. package/conformance/sheet/params-index.html +25 -0
  72. package/conformance/sheet/params-index.meta +6 -0
  73. package/conformance/sheet/params-none.expected.json +128 -0
  74. package/conformance/sheet/params-none.html +25 -0
  75. package/conformance/sheet/params-none.meta +6 -0
  76. package/conformance/sheet/params-range.expected.json +17 -0
  77. package/conformance/sheet/params-range.html +25 -0
  78. package/conformance/sheet/params-range.meta +6 -0
  79. package/conformance/sheet/params-render-without-range.error.json +6 -0
  80. package/conformance/sheet/params-render-without-range.html +25 -0
  81. package/conformance/sheet/params-render-without-range.meta +6 -0
  82. package/conformance/sheet/params-repeated.error.json +6 -0
  83. package/conformance/sheet/params-repeated.html +25 -0
  84. package/conformance/sheet/params-repeated.meta +6 -0
  85. package/conformance/sheet/params-unknown-sheet.error.json +6 -0
  86. package/conformance/sheet/params-unknown-sheet.html +25 -0
  87. package/conformance/sheet/params-unknown-sheet.meta +6 -0
  88. package/conformance/sheet/params-with-data.error.json +6 -0
  89. package/conformance/sheet/params-with-data.html +25 -0
  90. package/conformance/sheet/params-with-data.meta +6 -0
  91. package/conformance/sheet/sheet-contract-cells.expected.json +57 -0
  92. package/conformance/sheet/sheet-contract-cells.html +10 -0
  93. package/conformance/sheet/sheet-contract-cells.meta +6 -0
  94. package/conformance/sheet/sheet-contract-formulas.expected.json +29 -0
  95. package/conformance/sheet/sheet-contract-formulas.html +10 -0
  96. package/conformance/sheet/sheet-contract-formulas.meta +6 -0
  97. package/conformance/sheet/sheet-contract-values.expected.json +29 -0
  98. package/conformance/sheet/sheet-contract-values.html +10 -0
  99. package/conformance/sheet/sheet-contract-values.meta +6 -0
  100. package/conformance/sheet/sheet-contract-whole.expected.json +59 -0
  101. package/conformance/sheet/sheet-contract-whole.html +10 -0
  102. package/conformance/sheet/sheet-contract-whole.meta +5 -0
  103. package/conformance/sheet/sheet-hostile-01.expected.json +18 -0
  104. package/conformance/sheet/sheet-hostile-01.html +6 -0
  105. package/conformance/sheet/sheet-hostile-01.meta +5 -0
  106. package/conformance/sheet/sheet-hostile-02.expected.json +18 -0
  107. package/conformance/sheet/sheet-hostile-02.html +6 -0
  108. package/conformance/sheet/sheet-hostile-02.meta +5 -0
  109. package/conformance/sheet/sheet-hostile-03.expected.json +18 -0
  110. package/conformance/sheet/sheet-hostile-03.html +6 -0
  111. package/conformance/sheet/sheet-hostile-03.meta +5 -0
  112. package/conformance/sheet/sheet-hostile-04.expected.json +18 -0
  113. package/conformance/sheet/sheet-hostile-04.html +6 -0
  114. package/conformance/sheet/sheet-hostile-04.meta +5 -0
  115. package/conformance/sheet/sheet-hostile-05.expected.json +18 -0
  116. package/conformance/sheet/sheet-hostile-05.html +6 -0
  117. package/conformance/sheet/sheet-hostile-05.meta +5 -0
  118. package/conformance/sheet/sheet-hostile-06.expected.json +21 -0
  119. package/conformance/sheet/sheet-hostile-06.html +6 -0
  120. package/conformance/sheet/sheet-hostile-06.meta +5 -0
  121. package/conformance/sheet/sheet-hostile-07.expected.json +21 -0
  122. package/conformance/sheet/sheet-hostile-07.html +6 -0
  123. package/conformance/sheet/sheet-hostile-07.meta +5 -0
  124. package/conformance/sheet/sheet-hostile-08.expected.json +21 -0
  125. package/conformance/sheet/sheet-hostile-08.html +6 -0
  126. package/conformance/sheet/sheet-hostile-08.meta +5 -0
  127. package/conformance/sheet/sheet-hostile-09.expected.json +21 -0
  128. package/conformance/sheet/sheet-hostile-09.html +6 -0
  129. package/conformance/sheet/sheet-hostile-09.meta +5 -0
  130. package/conformance/sheet/sheet-hostile-10.expected.json +21 -0
  131. package/conformance/sheet/sheet-hostile-10.html +6 -0
  132. package/conformance/sheet/sheet-hostile-10.meta +5 -0
  133. package/conformance/sheet/sheet-hostile-11.expected.json +22 -0
  134. package/conformance/sheet/sheet-hostile-11.html +6 -0
  135. package/conformance/sheet/sheet-hostile-11.meta +5 -0
  136. package/conformance/sheet/sheet-hostile-12.expected.json +18 -0
  137. package/conformance/sheet/sheet-hostile-12.html +6 -0
  138. package/conformance/sheet/sheet-hostile-12.meta +5 -0
  139. package/conformance/sheet/sheet-hostile-13.expected.json +18 -0
  140. package/conformance/sheet/sheet-hostile-13.html +6 -0
  141. package/conformance/sheet/sheet-hostile-13.meta +5 -0
  142. package/conformance/sheet/sheet-hostile-14.expected.json +21 -0
  143. package/conformance/sheet/sheet-hostile-14.html +6 -0
  144. package/conformance/sheet/sheet-hostile-14.meta +5 -0
  145. package/conformance/sheet/sheet-hostile-15.expected.json +18 -0
  146. package/conformance/sheet/sheet-hostile-15.html +0 -0
  147. package/conformance/sheet/sheet-hostile-15.meta +5 -0
  148. package/conformance/sheet/sheet-hostile-16.expected.json +18 -0
  149. package/conformance/sheet/sheet-hostile-16.html +6 -0
  150. package/conformance/sheet/sheet-hostile-16.meta +5 -0
  151. package/conformance/sheet/sheet-hostile-17.expected.json +18 -0
  152. package/conformance/sheet/sheet-hostile-17.html +6 -0
  153. package/conformance/sheet/sheet-hostile-17.meta +5 -0
  154. package/conformance/sheet/sheet-hostile-18.expected.json +18 -0
  155. package/conformance/sheet/sheet-hostile-18.html +6 -0
  156. package/conformance/sheet/sheet-hostile-18.meta +5 -0
  157. package/conformance/sheet/sheet-hostile-19.expected.json +18 -0
  158. package/conformance/sheet/sheet-hostile-19.html +6 -0
  159. package/conformance/sheet/sheet-hostile-19.meta +5 -0
  160. package/conformance/sheet/sheet-hostile-20.expected.json +16 -0
  161. package/conformance/sheet/sheet-hostile-20.html +6 -0
  162. package/conformance/sheet/sheet-hostile-20.meta +5 -0
  163. package/conformance/sheet/sheet-hostile-21.expected.json +18 -0
  164. package/conformance/sheet/sheet-hostile-21.html +6 -0
  165. package/conformance/sheet/sheet-hostile-21.meta +5 -0
  166. package/conformance/sheet/sheet-hostile-22.expected.json +21 -0
  167. package/conformance/sheet/sheet-hostile-22.html +6 -0
  168. package/conformance/sheet/sheet-hostile-22.meta +5 -0
  169. package/conformance/sheet/sheet-hostile-23.expected.json +18 -0
  170. package/conformance/sheet/sheet-hostile-23.html +6 -0
  171. package/conformance/sheet/sheet-hostile-23.meta +5 -0
  172. package/conformance/sheet/sheet-hostile-24.expected.json +18 -0
  173. package/conformance/sheet/sheet-hostile-24.html +6 -0
  174. package/conformance/sheet/sheet-hostile-24.meta +5 -0
  175. package/conformance/sheet/sheet-hostile-25.expected.json +18 -0
  176. package/conformance/sheet/sheet-hostile-25.html +6 -0
  177. package/conformance/sheet/sheet-hostile-25.meta +5 -0
  178. package/conformance/sheet/sheet-hostile-26.expected.json +18 -0
  179. package/conformance/sheet/sheet-hostile-26.html +6 -0
  180. package/conformance/sheet/sheet-hostile-26.meta +5 -0
  181. package/conformance/sheet/sheet-hostile-27.expected.json +24 -0
  182. package/conformance/sheet/sheet-hostile-27.html +7 -0
  183. package/conformance/sheet/sheet-hostile-27.meta +5 -0
  184. package/conformance/sheet/sheet-hostile-28.expected.json +18 -0
  185. package/conformance/sheet/sheet-hostile-28.html +6 -0
  186. package/conformance/sheet/sheet-hostile-28.meta +5 -0
  187. package/conformance/sheet/sheet-hostile-29.expected.json +18 -0
  188. package/conformance/sheet/sheet-hostile-29.html +6 -0
  189. package/conformance/sheet/sheet-hostile-29.meta +5 -0
  190. package/conformance/sheet/sheet-hostile-30.expected.json +18 -0
  191. package/conformance/sheet/sheet-hostile-30.html +6 -0
  192. package/conformance/sheet/sheet-hostile-30.meta +5 -0
  193. package/conformance/sheet/sheet-hostile-31.expected.json +19 -0
  194. package/conformance/sheet/sheet-hostile-31.html +6 -0
  195. package/conformance/sheet/sheet-hostile-31.meta +5 -0
  196. package/conformance/sheet/sheet-hostile-32.expected.json +24 -0
  197. package/conformance/sheet/sheet-hostile-32.html +6 -0
  198. package/conformance/sheet/sheet-hostile-32.meta +5 -0
  199. package/conformance/sheet/sheet-hostile-33.expected.json +18 -0
  200. package/conformance/sheet/sheet-hostile-33.html +6 -0
  201. package/conformance/sheet/sheet-hostile-33.meta +5 -0
  202. package/conformance/sheet/sheet-hostile-34.expected.json +24 -0
  203. package/conformance/sheet/sheet-hostile-34.html +8 -0
  204. package/conformance/sheet/sheet-hostile-34.meta +5 -0
  205. package/conformance/sheet/sheet-hostile-35.expected.json +24 -0
  206. package/conformance/sheet/sheet-hostile-35.html +8 -0
  207. package/conformance/sheet/sheet-hostile-35.meta +5 -0
  208. package/conformance/sheet/sheet-patch-append.after.html +27 -0
  209. package/conformance/sheet/sheet-patch-append.after.json +143 -0
  210. package/conformance/sheet/sheet-patch-append.data.json +15 -0
  211. package/conformance/sheet/sheet-patch-append.html +25 -0
  212. package/conformance/sheet/sheet-patch-append.meta +5 -0
  213. package/conformance/sheet/sheet-patch-append.write.json +7 -0
  214. package/conformance/sheet/sheet-patch-bad-range.data.json +11 -0
  215. package/conformance/sheet/sheet-patch-bad-range.error.json +6 -0
  216. package/conformance/sheet/sheet-patch-bad-range.html +25 -0
  217. package/conformance/sheet/sheet-patch-bad-range.meta +5 -0
  218. package/conformance/sheet/sheet-patch-bad-value.data.json +13 -0
  219. package/conformance/sheet/sheet-patch-bad-value.error.json +6 -0
  220. package/conformance/sheet/sheet-patch-bad-value.html +25 -0
  221. package/conformance/sheet/sheet-patch-bad-value.meta +5 -0
  222. package/conformance/sheet/sheet-patch-clean-tab-beside-edited.after.html +25 -0
  223. package/conformance/sheet/sheet-patch-clean-tab-beside-edited.after.json +129 -0
  224. package/conformance/sheet/sheet-patch-clean-tab-beside-edited.data.json +11 -0
  225. package/conformance/sheet/sheet-patch-clean-tab-beside-edited.html +25 -0
  226. package/conformance/sheet/sheet-patch-clean-tab-beside-edited.meta +5 -0
  227. package/conformance/sheet/sheet-patch-clean-tab-beside-edited.write.json +7 -0
  228. package/conformance/sheet/sheet-patch-covered-cell.data.json +10 -0
  229. package/conformance/sheet/sheet-patch-covered-cell.error.json +6 -0
  230. package/conformance/sheet/sheet-patch-covered-cell.html +10 -0
  231. package/conformance/sheet/sheet-patch-covered-cell.meta +5 -0
  232. package/conformance/sheet/sheet-patch-empty.data.json +1 -0
  233. package/conformance/sheet/sheet-patch-empty.error.json +6 -0
  234. package/conformance/sheet/sheet-patch-empty.html +25 -0
  235. package/conformance/sheet/sheet-patch-empty.meta +5 -0
  236. package/conformance/sheet/sheet-patch-fallback-route.after.html +24 -0
  237. package/conformance/sheet/sheet-patch-fallback-route.after.json +86 -0
  238. package/conformance/sheet/sheet-patch-fallback-route.data.json +10 -0
  239. package/conformance/sheet/sheet-patch-fallback-route.html +24 -0
  240. package/conformance/sheet/sheet-patch-fallback-route.meta +5 -0
  241. package/conformance/sheet/sheet-patch-fallback-route.write.json +7 -0
  242. package/conformance/sheet/sheet-patch-first-tab.after.html +25 -0
  243. package/conformance/sheet/sheet-patch-first-tab.after.json +129 -0
  244. package/conformance/sheet/sheet-patch-first-tab.data.json +10 -0
  245. package/conformance/sheet/sheet-patch-first-tab.html +25 -0
  246. package/conformance/sheet/sheet-patch-first-tab.meta +5 -0
  247. package/conformance/sheet/sheet-patch-first-tab.write.json +7 -0
  248. package/conformance/sheet/sheet-patch-formula.after.html +25 -0
  249. package/conformance/sheet/sheet-patch-formula.after.json +128 -0
  250. package/conformance/sheet/sheet-patch-formula.data.json +11 -0
  251. package/conformance/sheet/sheet-patch-formula.html +25 -0
  252. package/conformance/sheet/sheet-patch-formula.meta +5 -0
  253. package/conformance/sheet/sheet-patch-formula.write.json +7 -0
  254. package/conformance/sheet/sheet-patch-no-sheet-rule.data.json +10 -0
  255. package/conformance/sheet/sheet-patch-no-sheet-rule.error.json +6 -0
  256. package/conformance/sheet/sheet-patch-no-sheet-rule.html +18 -0
  257. package/conformance/sheet/sheet-patch-no-sheet-rule.meta +5 -0
  258. package/conformance/sheet/sheet-patch-no-values.data.json +6 -0
  259. package/conformance/sheet/sheet-patch-no-values.error.json +6 -0
  260. package/conformance/sheet/sheet-patch-no-values.html +25 -0
  261. package/conformance/sheet/sheet-patch-no-values.meta +5 -0
  262. package/conformance/sheet/sheet-patch-not-canonical.data.json +11 -0
  263. package/conformance/sheet/sheet-patch-not-canonical.error.json +6 -0
  264. package/conformance/sheet/sheet-patch-not-canonical.html +25 -0
  265. package/conformance/sheet/sheet-patch-not-canonical.meta +5 -0
  266. package/conformance/sheet/sheet-patch-outside-sheet.data.json +11 -0
  267. package/conformance/sheet/sheet-patch-outside-sheet.error.json +6 -0
  268. package/conformance/sheet/sheet-patch-outside-sheet.html +25 -0
  269. package/conformance/sheet/sheet-patch-outside-sheet.meta +5 -0
  270. package/conformance/sheet/sheet-patch-range.after.html +25 -0
  271. package/conformance/sheet/sheet-patch-range.after.json +126 -0
  272. package/conformance/sheet/sheet-patch-range.data.json +11 -0
  273. package/conformance/sheet/sheet-patch-range.html +25 -0
  274. package/conformance/sheet/sheet-patch-range.meta +5 -0
  275. package/conformance/sheet/sheet-patch-range.write.json +7 -0
  276. package/conformance/sheet/sheet-patch-two-tabs.after.html +25 -0
  277. package/conformance/sheet/sheet-patch-two-tabs.after.json +130 -0
  278. package/conformance/sheet/sheet-patch-two-tabs.data.json +20 -0
  279. package/conformance/sheet/sheet-patch-two-tabs.html +25 -0
  280. package/conformance/sheet/sheet-patch-two-tabs.meta +5 -0
  281. package/conformance/sheet/sheet-patch-two-tabs.write.json +7 -0
  282. package/conformance/sheet/sheet-patch-typed.after.html +25 -0
  283. package/conformance/sheet/sheet-patch-typed.after.json +121 -0
  284. package/conformance/sheet/sheet-patch-typed.data.json +13 -0
  285. package/conformance/sheet/sheet-patch-typed.html +25 -0
  286. package/conformance/sheet/sheet-patch-typed.meta +5 -0
  287. package/conformance/sheet/sheet-patch-typed.write.json +7 -0
  288. package/conformance/sheet/sheet-patch-unknown-sheet.data.json +11 -0
  289. package/conformance/sheet/sheet-patch-unknown-sheet.error.json +6 -0
  290. package/conformance/sheet/sheet-patch-unknown-sheet.html +25 -0
  291. package/conformance/sheet/sheet-patch-unknown-sheet.meta +5 -0
  292. package/conformance/sheet/sheet-read-bad-range.error.json +6 -0
  293. package/conformance/sheet/sheet-read-bad-range.html +25 -0
  294. package/conformance/sheet/sheet-read-bad-range.meta +6 -0
  295. package/conformance/sheet/sheet-read-bad-render.error.json +6 -0
  296. package/conformance/sheet/sheet-read-bad-render.html +25 -0
  297. package/conformance/sheet/sheet-read-bad-render.meta +6 -0
  298. package/conformance/sheet/sheet-read-digest.expected.json +91 -0
  299. package/conformance/sheet/sheet-read-digest.html +25 -0
  300. package/conformance/sheet/sheet-read-digest.meta +6 -0
  301. package/conformance/sheet/sheet-read-empty.expected.json +11 -0
  302. package/conformance/sheet/sheet-read-empty.html +6 -0
  303. package/conformance/sheet/sheet-read-empty.meta +5 -0
  304. package/conformance/sheet/sheet-read-escapes.expected.json +108 -0
  305. package/conformance/sheet/sheet-read-escapes.html +22 -0
  306. package/conformance/sheet/sheet-read-escapes.meta +5 -0
  307. package/conformance/sheet/sheet-read-formulas-formatted.expected.json +298 -0
  308. package/conformance/sheet/sheet-read-formulas-formatted.html +16 -0
  309. package/conformance/sheet/sheet-read-formulas-formatted.meta +5 -0
  310. package/conformance/sheet/sheet-read-grid-in-comment.expected.json +85 -0
  311. package/conformance/sheet/sheet-read-grid-in-comment.html +24 -0
  312. package/conformance/sheet/sheet-read-grid-in-comment.meta +5 -0
  313. package/conformance/sheet/sheet-read-grid-in-script.expected.json +85 -0
  314. package/conformance/sheet/sheet-read-grid-in-script.html +24 -0
  315. package/conformance/sheet/sheet-read-grid-in-script.meta +5 -0
  316. package/conformance/sheet/sheet-read-grid-in-template.expected.json +85 -0
  317. package/conformance/sheet/sheet-read-grid-in-template.html +24 -0
  318. package/conformance/sheet/sheet-read-grid-in-template.meta +5 -0
  319. package/conformance/sheet/sheet-read-grid-in-textarea.expected.json +85 -0
  320. package/conformance/sheet/sheet-read-grid-in-textarea.html +24 -0
  321. package/conformance/sheet/sheet-read-grid-in-textarea.meta +5 -0
  322. package/conformance/sheet/sheet-read-grid-outside-read-by-rule.expected.json +94 -0
  323. package/conformance/sheet/sheet-read-grid-outside-read-by-rule.html +24 -0
  324. package/conformance/sheet/sheet-read-grid-outside-read-by-rule.meta +5 -0
  325. package/conformance/sheet/sheet-read-grid-outside-sheet.expected.json +85 -0
  326. package/conformance/sheet/sheet-read-grid-outside-sheet.html +24 -0
  327. package/conformance/sheet/sheet-read-grid-outside-sheet.meta +5 -0
  328. package/conformance/sheet/sheet-read-hand-edited.expected.json +85 -0
  329. package/conformance/sheet/sheet-read-hand-edited.html +18 -0
  330. package/conformance/sheet/sheet-read-hand-edited.meta +5 -0
  331. package/conformance/sheet/sheet-read-index.expected.json +19 -0
  332. package/conformance/sheet/sheet-read-index.html +25 -0
  333. package/conformance/sheet/sheet-read-index.meta +6 -0
  334. package/conformance/sheet/sheet-read-merged.expected.json +59 -0
  335. package/conformance/sheet/sheet-read-merged.html +10 -0
  336. package/conformance/sheet/sheet-read-merged.meta +5 -0
  337. package/conformance/sheet/sheet-read-no-tag.error.json +5 -0
  338. package/conformance/sheet/sheet-read-no-tag.html +18 -0
  339. package/conformance/sheet/sheet-read-no-tag.meta +5 -0
  340. package/conformance/sheet/sheet-read-padded-name-index.expected.json +19 -0
  341. package/conformance/sheet/sheet-read-padded-name-index.html +25 -0
  342. package/conformance/sheet/sheet-read-padded-name-index.meta +6 -0
  343. package/conformance/sheet/sheet-read-padded-name-lookup.expected.json +83 -0
  344. package/conformance/sheet/sheet-read-padded-name-lookup.html +25 -0
  345. package/conformance/sheet/sheet-read-padded-name-lookup.meta +6 -0
  346. package/conformance/sheet/sheet-read-padded-name-trimmed-lookup.error.json +6 -0
  347. package/conformance/sheet/sheet-read-padded-name-trimmed-lookup.html +25 -0
  348. package/conformance/sheet/sheet-read-padded-name-trimmed-lookup.meta +6 -0
  349. package/conformance/sheet/sheet-read-padded-name.expected.json +128 -0
  350. package/conformance/sheet/sheet-read-padded-name.html +25 -0
  351. package/conformance/sheet/sheet-read-padded-name.meta +5 -0
  352. package/conformance/sheet/sheet-read-range-cells.expected.json +55 -0
  353. package/conformance/sheet/sheet-read-range-cells.html +25 -0
  354. package/conformance/sheet/sheet-read-range-cells.meta +6 -0
  355. package/conformance/sheet/sheet-read-range-first-tab.expected.json +12 -0
  356. package/conformance/sheet/sheet-read-range-first-tab.html +25 -0
  357. package/conformance/sheet/sheet-read-range-first-tab.meta +6 -0
  358. package/conformance/sheet/sheet-read-range-formulas.expected.json +24 -0
  359. package/conformance/sheet/sheet-read-range-formulas.html +25 -0
  360. package/conformance/sheet/sheet-read-range-formulas.meta +6 -0
  361. package/conformance/sheet/sheet-read-range-values.expected.json +24 -0
  362. package/conformance/sheet/sheet-read-range-values.html +25 -0
  363. package/conformance/sheet/sheet-read-range-values.meta +6 -0
  364. package/conformance/sheet/sheet-read-sheet-by-id.expected.json +46 -0
  365. package/conformance/sheet/sheet-read-sheet-by-id.html +25 -0
  366. package/conformance/sheet/sheet-read-sheet-by-id.meta +6 -0
  367. package/conformance/sheet/sheet-read-sheet-by-name.expected.json +46 -0
  368. package/conformance/sheet/sheet-read-sheet-by-name.html +25 -0
  369. package/conformance/sheet/sheet-read-sheet-by-name.meta +6 -0
  370. package/conformance/sheet/sheet-read-styled.expected.json +48 -0
  371. package/conformance/sheet/sheet-read-styled.html +10 -0
  372. package/conformance/sheet/sheet-read-styled.meta +5 -0
  373. package/conformance/sheet/sheet-read-tiny.expected.json +85 -0
  374. package/conformance/sheet/sheet-read-tiny.html +18 -0
  375. package/conformance/sheet/sheet-read-tiny.meta +5 -0
  376. package/conformance/sheet/sheet-read-two-tabs.expected.json +128 -0
  377. package/conformance/sheet/sheet-read-two-tabs.html +25 -0
  378. package/conformance/sheet/sheet-read-two-tabs.meta +5 -0
  379. package/conformance/sheet/sheet-read-unknown-sheet.error.json +6 -0
  380. package/conformance/sheet/sheet-read-unknown-sheet.html +25 -0
  381. package/conformance/sheet/sheet-read-unknown-sheet.meta +6 -0
  382. package/conformance/sheet/sheet-read-version-1-codec.error.json +5 -0
  383. package/conformance/sheet/sheet-read-version-1-codec.html +25 -0
  384. package/conformance/sheet/sheet-read-version-1-codec.meta +5 -0
  385. package/conformance/sheet/sheet-write-whole-refused.data.json +6 -0
  386. package/conformance/sheet/sheet-write-whole-refused.error.json +7 -0
  387. package/conformance/sheet/sheet-write-whole-refused.html +25 -0
  388. package/conformance/sheet/sheet-write-whole-refused.meta +5 -0
  389. package/conformance/sheet-guard-extraction.json +616 -0
  390. package/conformance/sheet-guard.json +32362 -0
  391. package/conformance/sheet-read-shapes.json +1 -0
  392. package/dist/hyper-html-api.engine.esm.js +1 -1
  393. package/dist/hyper-html-api.engine.min.js +1 -1
  394. package/dist/hyper-html-api.min.js +7 -7
  395. package/dist/hyper-html-api.upgrade.min.js +2 -2
  396. package/package.json +5 -3
  397. package/src/codecs/sheet.js +127 -0
  398. package/src/codecs/sheet.vendor.js +887 -0
  399. package/src/dom-api.js +20 -11
  400. package/src/engine/apply.js +12 -1
  401. package/src/engine/codecs.js +80 -0
  402. package/src/engine/errors.js +20 -1
  403. package/src/engine/extract.js +11 -0
  404. package/src/engine/index.js +9 -5
  405. package/src/engine/round-trip.js +16 -10
  406. package/src/engine/rule-syntax.js +16 -0
  407. package/src/engine/rules-tag.js +3 -2
  408. package/src/engine/write-plan.js +2 -0
  409. package/src/patch-document.js +122 -0
  410. package/src/read.js +163 -0
  411. package/src/upgrade/codec-carry.js +23 -0
  412. package/src/upgrade/extract-all.js +12 -3
  413. package/src/upgrade/migrate.js +30 -3
  414. package/src/upgrade/rules-tags.js +4 -4
  415. package/src/write.js +44 -5
@@ -1,2 +1,2 @@
1
- var hyperHtmlApiUpgrade=(()=>{var ue=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var mt=Object.prototype.hasOwnProperty;var Pe=(e,t)=>{for(var n in t)ue(e,n,{get:t[n],enumerable:!0})},yt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ht(t))!mt.call(e,r)&&r!==n&&ue(e,r,{get:()=>t[r],enumerable:!(o=pt(t,r))||o.enumerable});return e};var gt=e=>yt(ue({},"__esModule",{value:!0}),e);var un={};Pe(un,{default:()=>fn,engine:()=>Re,upgrade:()=>at});var Q=["textContent","innerText","innerHTML","outerHTML","value","checked","selected","disabled","readOnly","type","tagName","nodeName","nodeType","nodeValue","childElementCount","id","className","classList","baseURI","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","dataset","currentSrc","duration","paused","title","documentURI","contentType"],ee=new Set(Q),ae=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),D=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]),ke=new Set(["checked","selected","disabled","readOnly","paused"]);function de(e,t){return t==null?ke.has(e)?!1:"":ke.has(e)?t==="false"?!1:!!t:t}var re={};Pe(re,{EmptyListInsert:()=>P,MAX_RULE_DEPTH:()=>W,MaxRuleDepthExceeded:()=>I,NoRulesTag:()=>pe,RuleTargetReadOnly:()=>V,RulesParseError:()=>v,ShapeMismatch:()=>q,UnknownRulesVersion:()=>k,WriteNotRoundTripped:()=>ne,WriteRefused:()=>te,WriteRejected:()=>he});var v=class extends Error{constructor(t,n){super(t),this.name="RulesParseError",this.cause=n}},k=class extends Error{constructor(t){super(`unknown rules version: ${t}. Library supports "1".`),this.name="UnknownRulesVersion",this.version=t}},W=20,I=class extends Error{constructor(t){super(`rule depth exceeded ${W} at path: ${t.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=t}},q=class extends Error{constructor(t){super(`shape mismatch: ${t.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=t}},P=class extends Error{constructor(t,n){super(n?`cannot add items to empty list at "${t.join(".")}" \u2014 ${n}`:`cannot add items to empty list at "${t.join(".")}" \u2014 no sibling to clone as template. Seed the list with a hidden item first.`),this.name="EmptyListInsert",this.path=t}},V=class extends Error{constructor(t){super(`cannot write to read-only DOM property "${t}"`),this.name="RuleTargetReadOnly",this.target=t}},te=class extends Error{constructor(t){super(`write refused: ${t.length} write(s) broke the content-only policy`),this.name="WriteRefused",this.refusals=t}};function At(e){return e.reduce((n,o)=>typeof o=="number"?`${n}[${o}]`:n?`${n}.${o}`:String(o),"")||"(root)"}var ne=class extends Error{constructor(t){super(`write did not round-trip at "${At(t)}"`),this.name="WriteNotRoundTripped",this.path=t}},pe=class extends Error{constructor(t){super(`no <script data-rules-name~="${t}"> rules tag in this document`),this.name="NoRulesTag",this.token=t}},he=class extends Error{constructor(t,n){super(`write rejected: ${t.length} unknown key(s), ${n.length} rule(s) with no matching element`),this.name="WriteRejected",this.unknownKeys=t,this.unmatched=n}};function S(e){let t=0,n=null,o=-1;for(let r=0;r<e.length;r++){let i=e[r];i==="\\"?r++:n?i===n&&(n=null):i==='"'||i==="'"?n=i:i==="["||i==="("?t++:i==="]"||i===")"?t>0&&t--:i==="@"&&t===0&&(o=r)}return o}var Ie="[*]";function R(e){let t=S(e),n=t===-1?e:e.slice(0,t),o=n.endsWith(Ie),r={selector:o?n.slice(0,-Ie.length):n,prop:t===-1?null:e.slice(t+1)||null};return o&&(r.all=!0),r}function me(e){let t=0,n=null,o=-1,r=!1;for(let i=0;i<e.length;i++){let s=e[i];s==="\\"?i++:n?s===n&&(n=null):s==='"'||s==="'"?n=s:s==="["||s==="("?t++:s==="]"||s===")"?t>0&&t--:t===0&&s===">"?o=i:t===0&&s===","&&(r=!0)}return r||o===-1||!wt(e,o+1)?null:e.slice(0,o).trim()||null}function wt(e,t){let n=t,o=e.replace(/\s+$/,"").length;for(;n<o&&/\s/.test(e[n]);)n++;let r=0,i=null;for(;n<o;n++){let s=e[n];if(s==="\\")n++;else if(i)s===i&&(i=null);else if(s==='"'||s==="'")i=s;else if(s==="["||s==="(")r++;else if(s==="]"||s===")")r>0&&r--;else if(r===0&&(s==="+"||s==="~"||/\s/.test(s)))return!1}return!0}var Tt=/^--[A-Za-z0-9_-]+$/;function L(e){return typeof e=="string"&&Tt.test(e)}function Le(e){let t=[],n=[],o=null,r=0;for(let i=0;i<e.length;i++){let s=e[i];if(o){s==="\\"?i++:s===o&&(o=null);continue}if(s==="/"&&e[i+1]==="*"){let c=e.indexOf("*/",i+2);i=c===-1?e.length:c+1;continue}s==='"'||s==="'"?o=s:s==="("?n.push(")"):s==="["?n.push("]"):s==="{"?n.push("}"):(s===")"||s==="]"||s==="}")&&n[n.length-1]===s?n.pop():s===";"&&n.length===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}function xt(e){let t="",n=null;for(let o=0;o<e.length;o++){let r=e[o];if(n){t+=r,r==="\\"&&o+1<e.length?t+=e[++o]:r===n&&(n=null);continue}if(r==="/"&&e[o+1]==="*"){let i=e.indexOf("*/",o+2);o=i===-1?e.length:i+1,t+=" ";continue}(r==='"'||r==="'")&&(n=r),t+=r}return t}function je(e){e=xt(e);let t=e.indexOf(":");if(t===-1)return null;let n=e.slice(0,t).trim(),o=e.slice(t+1).trim(),r=/!\s*important\s*$/i.exec(o);return r&&(o=o.slice(0,r.index).trim()),{name:n,value:o,important:!!r}}function B(e,t){if(e==null)return null;let n=null;for(let o of Le(String(e))){let r=je(o);!r||r.name!==t||(!n||r.important||!n.important)&&(n=r)}return n?n.value:null}function $e(e,t,n){let o=e==null?"":String(e),r=n==null||n==="",i=Le(o),s=i.map(je),c=s.some(p=>p&&p.name===t&&p.important),l=[],a=!1;i.forEach((p,h)=>{let T=s[h];if(!T||T.name!==t){l.push(p);return}if(r||a)return;let f=/^\s*/.exec(p)[0];l.push(`${f}${t}: ${n}${c?" !important":""}`),a=!0});let u=l.join(";");if(!r&&!a){let p=u.trimEnd();u=p===""?`${t}: ${n}`:`${p}${p.endsWith(";")?" ":"; "}${t}: ${n}`}return u.trim()===""?null:u}function ye(e,t,n,o){let r=e.attr(t,"style");if((B(r,n)??"")===o)return;let i=$e(r,n,o);i==null?e.removeAttr(t,"style"):e.attr(t,"style",i)}function C(e,t,n,o={}){if(Object.prototype.hasOwnProperty.call(o,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");return Ae(e,t,n,{depth:0,path:[]},o)}function Ae(e,t,n,o,r){if(o.depth>W)throw new I(o.path);if(typeof n=="string")return Ot(e,t,n,o,r);if(Array.isArray(n)){let[i,s]=n,c=e.find(t,i,r);return _e(r,o,c),c.map((l,a)=>Ae(e,l,s,{depth:o.depth+1,path:[...o.path,a]},r))}if(typeof n=="object"&&n!==null){let i={};for(let[s,c]of Object.entries(n))i[s]=Ae(e,t,c,{depth:o.depth+1,path:[...o.path,s]},r);return i}return null}function Ot(e,t,n,o,r){if(n.endsWith("[]")){let a=n.slice(0,-2),u=e.find(t,a,r);return _e(r,o,u),u.map(p=>e.text(p))}if(n.startsWith("@"))return ge(e,t,n.slice(1));let i=S(n);if(i!==-1){let{selector:a,all:u}=R(n),p=n.slice(i+1),h=a?e.find(t,a,r):[t];return u&&r.allMatches?h.map(T=>ge(e,T,p)):h.length===0?null:ge(e,h[0],p)}if(n===".")return e.text(t);let{selector:s,all:c}=R(n),l=e.find(t,s,r);return c&&r.allMatches?l.map(a=>e.text(a)):l.length===0?null:e.text(l[0])}function _e(e,t,n){if(typeof e.onRowsRead=="function")try{e.onRowsRead(t.path.slice(),n)}catch(o){console.warn(`[hyper-html-api] onRowsRead threw at "${t.path.join(".")||"(root)"}"`,o)}}function ge(e,t,n){if(L(n))return B(e.attr(t,"style"),n);if(ee.has(n)){let r=e.prop(t,n);return r==null?null:String(r)}let o=e.attr(t,n);return o??null}function We(e,t,n,o){let r=e.length,i=t.length,s=new Array(r).fill(-1);if(o){let d=new Set;for(let y=0;y<r;y++){let A=o[y];!(A>=0&&A<i)||d.has(A)||(s[y]=A,d.add(A))}}if(r===0||i===0)return s;let c=e.map(d=>De(d,n)),l=t.map(d=>De(d,n)),a=new Array(i).fill(!1);for(let d of s)d>=0&&(a[d]=!0);let u=new Map;l.forEach((d,y)=>{a[y]||u.set(d,u.has(d)?-1:y)});let p=new Map;c.forEach((d,y)=>{s[y]>=0||p.set(d,(p.get(d)||0)+1)}),c.forEach((d,y)=>{if(s[y]>=0||p.get(d)!==1)return;let A=u.get(d);A===void 0||A===-1||a[A]||(s[y]=A,a[A]=!0)});let h=[];for(let d=0;d<r;d++)s[d]<0&&h.push(d);let T=[];for(let d=0;d<i;d++)a[d]||T.push(d);if(h.length===0||T.length===0)return s;let f=r*i+1,m=Et(e,t,n),g=(d,y)=>m(d,y)*f+Math.abs(d-y);for(let[d,y]of bt(h,T,g))s[d]=y;return s}var Ue=e=>typeof e=="object"&&e!==null;function De(e,t){if(!Ue(t))return e==null?" null":String(e);let n=Object.keys(t);return JSON.stringify(n.map(o=>{let r=JSON.stringify(e?.[o]);return r===void 0?" undef":r}))}function Et(e,t,n){if(!Ue(n))return(c,l)=>e[c]===t[l]?0:1;let o=Object.keys(n),r=c=>o.map(l=>JSON.stringify(c?.[l])),i=e.map(r),s=t.map(r);return(c,l)=>{let a=i[c],u=s[l],p=0;for(let h=0;h<o.length;h++)a[h]!==u[h]&&p++;return p}}function bt(e,t,n){return e.length<=t.length?ve(e,t,n,!1):ve(t,e,(o,r)=>n(r,o),!0)}function ve(e,t,n,o){let r=e.length,i=t.length,s=[];for(let p=0;p<=r;p++)s.push(new Float64Array(i+1).fill(1/0));let c=[];for(let p=0;p<=r;p++)c.push(new Uint8Array(i+1));for(let p=0;p<=i;p++)s[r][p]=0;for(let p=r-1;p>=0;p--)for(let h=i-1;h>=0;h--){let T=n(e[p],t[h])+s[p+1][h+1],f=s[p][h+1];T<=f?(s[p][h]=T,c[p][h]=1):s[p][h]=f}let l=[],a=0,u=0;for(;a<r&&u<i;)c[a][u]&&(l.push(o?[t[u],e[a]]:[e[a],t[u]]),a++),u++;return l}function Te(e,t,n,o,r,i,s,c={}){let l=e.find(t,n,c);if(r.length===0){l.forEach(w=>e.remove(w)),we(c,"onRowsApplied",i.path,[]);return}let a=r.length>l.length,u=l[0]||null;if(a&&!u&&(u=Ct(e,t,n,c),!u))throw new P(i.path);let p=l.map(w=>Nt(e,w,o,c)),h=null;if(a&&u){h=e.clone(u),c.templateAttr&&e.removeAttr(h,c.templateAttr);let w=e.stripIds(h);w>0&&console.warn(`[hyper-html-api] stripped ${w} id attribute(s) from cloned template at "${i.path.join(".")||"(root)"}"`)}let T=We(r,p,o,St(e,l,r,i,c)),f=l.length>0?e.parent(l[0]):It(e,t,n,u,i,c),m=l.length>0?ze(e,f,l[0]):0,g=$t(e,l),d=new Set,y=[],A=r.map((w,b)=>{let O=T[b];if(O>=0)return d.add(O),y.push(!1),l[O];y.push(!0);let x=e.clone(h);return e.stripIds(x),x});l.forEach((w,b)=>{d.has(b)||e.remove(w)}),g?jt(e,f,m,A,y):_t(e,A,y,f,m),Rt(e,A,o,r,i,s,c),we(c,"onRowsApplied",i.path,A)}function we(e,t,n,o){if(typeof e[t]=="function")try{return e[t](n.slice(),o)}catch(r){console.warn(`[hyper-html-api] ${t} threw at "${n.join(".")||"(root)"}"`,r);return}}function St(e,t,n,o,r){let i=we(r,"identifyRows",o.path,n);if(!Array.isArray(i))return null;let s=new Array(n.length).fill(-1),c=new Set,l=new Map(t.map((a,u)=>[e.identity(a),u]));for(let a=0;a<n.length;a++){if(!i[a])continue;let u=l.get(e.identity(i[a]));u===void 0||c.has(u)||(s[a]=u,c.add(u))}return s}function Rt(e,t,n,o,r,i,s){t.forEach((c,l)=>{if(n===null){let a=o[l],u=a==null?"":String(a);e.text(c)!==u&&e.text(c,u)}else{let a=i(e,c,n,o[l],{depth:r.depth+1,path:[...r.path,l]},s);a&&a!==c&&(t[l]=a)}})}function Nt(e,t,n,o){return n===null?e.text(t):C(e,t,n,o.onRowsRead?{...o,onRowsRead:void 0}:o)}function ze(e,t,n){let o=e.children(t);for(let r=0;r<o.length;r++)if(e.sameNode(o[r],n))return r;return-1}function Ct(e,t,n,o){if(!o.templateAttr)return null;let r=/^\s*:scope\s*>\s*/.test(n),i=new RegExp(":not\\(\\["+o.templateAttr.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")+"\\]\\)","g"),s=n.replace(/^\s*:scope\s*>\s*/,"").replace(i,""),c=r?Mt(s):0,l=me(s),a=t;for(;a;){let u=e.find(a,s,{includeRulesTag:!1,templateAttr:null});for(let p of u)if(e.attr(p,o.templateAttr)!=null&&!(r&&!kt(e,t,p,c))&&!(l&&!e.matches(e.parent(p),l)))return p;a=e.parent(a)}return null}function Mt(e){let t=0,n=null,o=1;for(let r=0;r<e.length;r++){let i=e[r];if(i==="\\")r++;else if(n)i===n&&(n=null);else if(i==='"'||i==="'")n=i;else if(i==="["||i==="(")t++;else if(i==="]"||i===")")t>0&&t--;else if(t===0&&i===">")o++;else{if(t===0&&(i==="+"||i==="~"))return null;if(t===0&&/\s/.test(i)){if(!Pt(e,r))return null;for(;r+1<e.length&&/\s/.test(e[r+1]);)r++}}}return o}function Pt(e,t){let n=t;for(;n<e.length&&/\s/.test(e[n]);)n++;let o=t>0?e[t-1]:"",r=n<e.length?e[n]:"";return He(o)||He(r)}function He(e){return e===">"||e==="+"||e==="~"}function kt(e,t,n,o){if(o===null)return!0;let r=n;for(let l=0;l<o;l++)if(r=e.parent(r),!r)return!1;let i=e.prop(t,"tagName");if(!i)return!0;let s=e.prop(r,"tagName");if(!s||String(s).toLowerCase()!==String(i).toLowerCase())return!1;let c=new Set(qe(e,r));return qe(e,t).every(l=>c.has(l))}function qe(e,t){let n=e.attr(t,"class");return n?String(n).split(/\s+/).filter(Boolean):[]}function It(e,t,n,o,r,i){let s=e.parent(o);if(s&&Lt(e,t,s)&&!Be(e,s,i))return s;let c=me(n);if(!c)throw new P(r.path,`the list selector "${n}" names no container to hold the new rows \u2014 write it as "container > row" (for example "ol.comments > li") so the cloned row lands in the list`);let a=(c===":scope"?e.prop(t,"tagName")?[t]:[]:e.find(t,c,i)).filter(u=>!Be(e,u,i));if(a.length===0)throw new P(r.path,`no container matching "${c}" inside this context to hold the new rows`);if(a.length>1)throw new P(r.path,`"${c}" matches ${a.length} containers inside this context, so the new rows have no single destination`);return a[0]}function Lt(e,t,n){let o=n;for(;o;){if(e.sameNode(o,t))return!0;o=e.parent(o)}return e.parent(t)?!1:e.find(t,"*",{includeRulesTag:!0,templateAttr:null}).some(r=>e.sameNode(r,n))}var Ve=["no-data","editor-ui"];function Be(e,t,n){let o=t;for(;o;){if(n.templateAttr&&e.attr(o,n.templateAttr)!=null||Ve.some(i=>e.attr(o,i)!=null))return!0;let r=e.attr(o,"clay");if(r&&r.split(/\s+/).some(i=>Ve.includes(i)))return!0;o=e.parent(o)}return!1}function jt(e,t,n,o,r){let i=e.children(t),s=i.map(l=>e.identity(l)),c=!1;o.forEach((l,a)=>{let u=e.identity(l),p=n+a;if(s[p]===u)return;if(!r[a]){let T=s.indexOf(u);T!==-1&&(s.splice(T,1),i.splice(T,1))}let h=Math.min(p,i.length);h<i.length?e.insertBefore(i[h],l):i.length?c?e.insertAfter(i[i.length-1],l):(e.insertAt(t,l,p),c=!0):e.insertAt(t,l,0),s.splice(h,0,u),i.splice(h,0,l)})}function $t(e,t){if(t.length<=1)return!0;let n=e.parent(t[0]);if(!n)return!1;let o=new Map(e.children(n).map((i,s)=>[e.identity(i),s])),r=[];for(let i of t){let s=o.get(e.identity(i));if(s===void 0)return!1;r.push(s)}return r.sort((i,s)=>i-s),r[r.length-1]-r[0]===r.length-1}function _t(e,t,n,o,r){let i=null,s=r;for(let c=0;c<t.length;c++){if(!n[c]){i=t[c];continue}let l=i?e.parent(i):o;if(!l)continue;let a=i?ze(e,l,i)+1:s++;e.insertAt(l,t[c],a),i=t[c]}}function j(e,t,n,o,r={}){if(Object.prototype.hasOwnProperty.call(r,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");let i=[];if(xe(n,o,[],i),i.length)throw new q(i);oe(e,t,n,o,{depth:0,path:[]},r)}function oe(e,t,n,o,r,i={}){if(r.depth>W)throw new I(r.path);if(o===void 0)return t;if(typeof n=="string")return Dt(e,t,n,o,r,i);if(Array.isArray(n)){let[s,c]=n;return Te(e,t,s,c,o,r,oe,i),t}if(typeof n=="object"&&n!==null){for(let[s,c]of Object.entries(n)){let l=oe(e,t,c,o==null?o:o[s],{depth:r.depth+1,path:[...r.path,s]},i);l&&l!==t&&(t=l)}return t}return t}function Dt(e,t,n,o,r,i){if(n.endsWith("[]")){let u=n.slice(0,-2);return Te(e,t,u,null,o,r,oe,i),t}if(n.startsWith("@"))return Ke(e,t,n.slice(1),o);let s=S(n);if(s!==-1){let{selector:u,all:p}=R(n),h=n.slice(s+1),T=u?e.find(t,u,i):[t];for(let f of p?T:T.slice(0,1))Ke(e,f,h,o);return t}if(n===".")return Fe(e,t,o),t;let{selector:c,all:l}=R(n),a=e.find(t,c,i);for(let u of l?a:a.slice(0,1))Fe(e,u,o);return t}function Fe(e,t,n){let o=n==null?"":String(n);e.text(t)!==o&&e.text(t,o)}function vt(e,t,n,o){if(e.styleVar){e.styleVar(t,n,o);return}ye(e,t,n,o)}function Ke(e,t,n,o){if(L(n))return vt(e,t,n,o==null?"":String(o).trim()),t;if(D.has(n)){let r=e.prop(t,n);if(r===o||r!=null&&o!=null&&String(r)===String(o))return t;throw new V(n)}if(n==="outerHTML"){let r=o==null?"":String(o);return e.replaceWith(t,r)}if(ae.has(n)){let r=de(n,o);return e.prop(t,n)!==r&&e.prop(t,n,r),t}if(o==null)e.attr(t,n)!=null&&e.removeAttr(t,n);else{let r=String(o);e.attr(t,n)!==r&&e.attr(t,n,r)}return t}function xe(e,t,n,o){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]")){Array.isArray(t)?t.forEach((r,i)=>{typeof r=="object"&&r!==null&&o.push({path:F([...n,i]),expected:"scalar",got:z(r)})}):o.push({path:F(n),expected:"array",got:z(t)});return}t!==null&&typeof t=="object"&&o.push({path:F(n),expected:"scalar",got:z(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){o.push({path:F(n),expected:"array",got:z(t)});return}let r=e[1];t.forEach((i,s)=>xe(r,i,[...n,s],o));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){o.push({path:F(n),expected:"object",got:z(t)});return}for(let[r,i]of Object.entries(e))xe(i,t[r],[...n,r],o)}}}function z(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function F(e){return e.join(".")}function Oe(e){try{return JSON.parse(e)}catch(t){throw new v(`Invalid strict JSON: ${t.message}`,t)}}function $(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function n(r){let i=[],s=0;for(;s<r.length;){let c=r[s];if(/\s/.test(c)){s++;continue}if("{}".includes(c)){i.push({type:c,value:c}),s++;continue}if(c==="["){let p=!1,h=s+1;for(;h<r.length&&/\s/.test(r[h]);)h++;if(h<r.length&&/[a-zA-Z_]/.test(r[h])&&(p=!0),!p){i.push({type:c,value:c}),s++;continue}}if(c==="]"){i.push({type:c,value:c}),s++;continue}if(c===":"){i.push({type:t.COLON,value:c}),s++;continue}if(c===","){i.push({type:t.COMMA,value:c}),s++;continue}if(c==='"'||c==="'"){let p=c,h=s+1;for(;h<r.length&&r[h]!==p;)r[h]==="\\"&&h++,h++;i.push({type:t.STRING,value:r.substring(s+1,h),quoted:!0,sourceQuote:p}),s=h+1;continue}let l=s,a;for(;l<r.length&&!/[{},]/.test(r[l]);)if(r[l]===":"){let p=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],h=!1;for(let T of p){let f=T.substring(1);if(r.substring(l+1,l+1+f.length)===f){h=!0,l+=f.length;break}}if(!h)break}else if(r[l]==="["){for(l++;l<r.length&&r[l]!=="]";){if(r[l]==='"'||r[l]==="'"){let p=r[l];for(l++;l<r.length&&r[l]!==p;)r[l]==="\\"&&l++,l++}l++}l<r.length&&r[l]==="]"&&l++}else l++;a=r.substring(s,l);let u=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(a)?u=t.NUMBER:a==="true"||a==="false"||a==="null"?u=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(a)&&(u=t.SELECTOR),i.push({type:u,value:a,quoted:!1}),s=l}return i}function o(r){let i="";for(let s=0;s<r.length;s++){let c=r[s];if("{}".includes(c.type)||"[]".includes(c.type)){i+=c.value;continue}if(c.type===t.COLON){i+=c.value;continue}if(c.type===t.COMMA){let l=r[s+1];if(l&&(l.type==="}"||l.type==="]"))continue;i+=c.value;continue}if(c.type===t.STRING&&c.quoted){let l=c.value;c.sourceQuote==="'"&&(l=l.replace(/\\'/g,"'"),l=l.replace(/(\\*)"/g,(a,u)=>u.length%2===0?u+'\\"':a)),i+=`"${l}"`;continue}if(c.type===t.NUMBER||c.type===t.BOOLEAN){i+=c.value;continue}if(c.type===t.SELECTOR||c.type===t.IDENTIFIER){i+=`"${c.value}"`;continue}i+=`"${c.value}"`}return i}try{let r=n(e),i=o(r);return JSON.parse(i)}catch(r){throw new v("Invalid extraction rules syntax: "+r.message,r)}}var Ee="1",Je=/^[a-zA-Z0-9_-]+$/;function K(e,t,n){let o;if(n===void 0)o="script[data-rules-name]";else{if(typeof n!="string"||!Je.test(n))throw new Error(`hyper-html-api: invalid rules token ${JSON.stringify(n)} (must match ${Je})`);o=`script[data-rules-name~="${n}"]`}let r=e.find(t,o,{includeRulesTag:!0});if(r.length===0)return null;n!==void 0&&r.length>1&&console.warn(`hyper-html-api: ${r.length} rules tags match data-rules-name~="${n}"; using the first.`);let i=r[0],s=e.attr(i,"data-rules-version");if(s!==Ee)throw new k(s);return{rules:$(e.text(i)),tagNode:i}}var ie=Object.freeze({data:Object.freeze({tokens:["no-data"],bundles:["editor-ui"]}),save:Object.freeze({tokens:["no-save"],bundles:["editor-ui"]}),snapshot:Object.freeze({tokens:["no-snapshot"],bundles:["editor-ui"]}),watch:Object.freeze({tokens:["no-watch"],bundles:["editor-ui"]}),undo:Object.freeze({tokens:["no-undo"],bundles:["editor-ui"]}),history:Object.freeze({tokens:[],bundles:["editor-ui"]})}),Wt=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),Ye=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui","live"]);function J(e,t){if(!e||e.nodeType!==1)return!1;let n=e.getAttribute?.("clay");return!!(n&&n.split(/\s+/).includes(t)||e.hasAttribute?.(t))}function be(e,t){if(J(e,t))return!0;for(let[n,o]of Object.entries(Wt))if(o.includes(t)&&J(e,n))return!0;return!1}function Y(e){let t=ie[e];if(!t)throw new Error(`Unknown region capability: ${e}`);return[...t.tokens,...t.bundles].flatMap(n=>[`[clay~="${n}"]`,`[${n}]`]).join(", ")}function Ut(e,t){let n=e&&e.nodeType===1?e:e?.parentElement;for(;n&&n.nodeType===1;){let o=ie[t];if(!o)throw new Error(`Unknown region capability: ${t}`);if(o.tokens.some(r=>be(n,r))||o.bundles.some(r=>J(n,r)))return n;n=n.parentElement}return null}function Xe(e,t){return!!Ut(e,t)}var Ht=Object.freeze({refusedRuleForms:["innerHTML","outerHTML"],refusedTargets:["script","style","template","noscript","iframe","object","embed","xmp","plaintext","noembed","noframes","meta","link","base","animate","set","animatemotion","animatetransform"],refusedAttributes:["style","srcdoc","is","http-equiv","sandbox","allow","nonce","integrity","charset","htmlclaytoken","htmlclayid","data-rules-name","data-rules-version","clay","contenteditable",...Ye],refusedAttributePrefixes:["on"],urlAttributes:["href","src","srcset","action","formaction","poster","cite","data","ping","background","longdesc","usemap","xlink:href","manifest","codebase","icon"],refusedSchemes:["javascript","vbscript","data"],customPropertyValues:Object.freeze({maxLength:200,refusedCharacters:[";","{","}","<",">","\\"],refusedFunctions:["url","src","image","image-set","-webkit-image-set","cross-fade","element","expression","paint"]})});function Se(e,t,n){if(n&&typeof n=="object")return{rules:n,tagNode:null};if(typeof n=="string"){let o=t&&t.ownerDocument?t.ownerDocument:t;return K(e,o,n)}return null}var zt=/:(?:focus(?:-within|-visible)?|hover|active|visited|defined)\b/i;function Ft(e,t){if(!/^(INPUT|TEXTAREA|SELECT|OPTION)$/.test(e.tagName||""))return;let n=(e.getAttribute?.("type")||"").toLowerCase();"value"in e&&"value"in t&&e.tagName!=="OPTION"&&n!=="checkbox"&&n!=="radio"&&n!=="file"&&(t.value=e.value),e.tagName==="INPUT"&&(n==="checkbox"||n==="radio")&&(t.checked=e.checked),e.tagName==="OPTION"&&(t.selected=e.selected),"indeterminate"in e&&"indeterminate"in t&&(t.indeterminate=e.indeterminate)}function Ge(e,t,n,o){if(o)return!!e.closest?.(t);let r=e;for(;r?.nodeType===1;){if(r.matches(t))return!0;if(r===n)break;r=r.parentElement}return!1}function Ze(e,t,n,o,r,i){return(i?Xe(e,t):Ge(e,n,r,!1))||!!(o&&(i&&e!==r?e.matches(o):Ge(e,o,r,i)))}function Kt(e,t){let n=ie[t];return n.tokens.some(o=>be(e,o))||n.bundles.some(o=>J(e,o))}var Jt=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function Qe(e,t,n,o){if(e.nodeType===1&&o(e)){n.dropped.push(t);return}n.cloneToLive.set(t,e),n.liveToClone.set(e,t);let r=e,i=t;if(e.nodeType===1){if(Jt.has(e.tagName)&&n.controls.push(e,t),e.tagName==="TEMPLATE"){for(;t.firstChild;)t.removeChild(t.firstChild);r=e.content,i=t.content,n.cloneToLive.set(i,r),n.liveToClone.set(r,i)}}else if(e.nodeType!==11)return;let s=i.firstChild;for(let c=r.firstChild;c&&s;c=c.nextSibling)Qe(c,s,n,o),s=s.nextSibling}function X(e,{capability:t="data",exclude:n=null,inherit:o=!0,provenance:r=null}={}){if(!e)throw new TypeError("createContentView requires a DOM context");let i=e.nodeType===9?e:e.ownerDocument;if(!i?.implementation?.createHTMLDocument)throw new TypeError("createContentView requires an HTML DOM implementation");let s=i.implementation.createHTMLDocument(""),c=r||new WeakMap,l=new WeakMap,a=e.nodeType===9?e.documentElement:e;n&&s.documentElement.matches(n);let u=Y(t),p=o?f=>Kt(f,t)||!!(n&&f.matches(n)):f=>Ze(f,t,u,n,a,!1),h=null;if(a.nodeType!==1||!Ze(a,t,u,n,a,o)){h=s.importNode(a,!0);let f={cloneToLive:c,liveToClone:l,dropped:[],controls:[]};Qe(a,h,f,p);for(let m of f.dropped)m.remove();for(let m=0;m<f.controls.length;m+=2)Ft(f.controls[m],f.controls[m+1])}e.nodeType===9&&h&&(s.replaceChild(h,s.documentElement),l.set(e,s),c.set(s,e));let T=f=>{if(zt.test(f))throw new Error(`Filtered content queries do not support stateful selector: ${f}`)};return{root:h,document:s,capability:t,selector:Y(t),cloneToLive:c,liveToClone:l,original(f){return c.get(f)||null},cloneOf(f){return l.get(f)||null},query(f,m=h){return T(f),Array.from(m.querySelectorAll(f),g=>c.get(g)||g)},text(f=h){return(f===h?h:l.get(f))?.textContent||""},html(f=h){return(f===h?h:l.get(f))?.innerHTML??""},clone(f=h){let m=f===h?h:l.get(f);return m?s.importNode(m,!0):null}}}function tt(e){return e&&e.nodeType===1&&e.tagName==="SCRIPT"&&e.hasAttribute&&e.hasAttribute("data-rules-name")}function Yt(e){return e?(e.nodeType===9||e.nodeType===11,e):null}function et(e,t,n){!e||e.nodeType!==1||(t==="value"&&e.tagName==="INPUT"?e.value=n===null?"":n:t==="checked"&&e.tagName==="INPUT"?e.checked=n!==null:t==="selected"&&e.tagName==="OPTION"&&(e.selected=n!==null))}function nt(e,t){e&&e.tagName==="TEXTAREA"&&(e.value=t)}function rt(e){if(!e||e.nodeType!==1)return;let t=[e,...e.querySelectorAll?e.querySelectorAll("textarea, input, option"):[]];for(let n of t)if(n.tagName==="TEXTAREA")n.value=n.defaultValue;else if(n.tagName==="INPUT"){let o=n.type;o!=="file"&&o!=="checkbox"&&o!=="radio"&&(n.value=n.defaultValue),n.checked=n.defaultChecked}else n.tagName==="OPTION"&&(n.selected=n.defaultSelected)}var E={semanticExclude:!0,find(e,t,n={}){let o=Yt(e);if(!o||!o.querySelectorAll)return[];let r=Array.from(o.querySelectorAll(t));n.includeRulesTag||(r=r.filter(c=>!tt(c)));let i=[];n.skip&&i.push(n.skip);let s=n.templateAttr===null?null:n.templateAttr||"cms-template";if(s&&i.push("["+s+"]"),i.length){let c=i.join(", ");r=r.filter(l=>!l.closest||!l.closest(c))}return r},parent(e){return e?e.parentElement:null},children(e){return e?Array.from(e.children):[]},matches(e,t){return!!(e&&e.matches)&&e.matches(t)},text(e,t){if(t===void 0)return(e.textContent||"").trim();e.textContent=t,nt(e,t)},attr(e,t,n){if(n===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,n),et(e,t,n)},removeAttr(e,t){e&&e.removeAttribute&&e.removeAttribute(t),et(e,t,null)},prop(e,t,n){if(n===void 0){let o=e?e[t]:void 0;return o!==void 0?o:null}e[t]=n},clone(e){let t=e.cloneNode(!0);return rt(t),t},insertAt(e,t,n){let o=e.children[n]||null;e.insertBefore(t,o)},insertBefore(e,t){e.parentNode.insertBefore(t,e)},insertAfter(e,t){e.parentNode.insertBefore(t,e.nextSibling)},identity(e){return e||null},remove(e){e&&e.parentNode&&e.parentNode.removeChild(e)},replaceWith(e,t){if(!e||!e.parentNode)throw new Error("dom.replaceWith: node has no parent");let o=e.ownerDocument.createElement("template");o.innerHTML=t;let r=o.content.firstElementChild;if(!r)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(r,e),r},stripIds(e){let t=0;return e.id&&(e.removeAttribute("id"),t++),(e.querySelectorAll?e.querySelectorAll("[id]"):[]).forEach(o=>{o.removeAttribute("id"),t++}),t},sameNode(e,t){return e===t}};function G(e,t={}){if(t.exclude===null)return E;let n=[Y("data"),t.exclude].filter(Boolean).join(", "),o=e.nodeType===9?e:e.ownerDocument||e,r=e.nodeType===9?e.documentElement:e;if(!t._write&&!r?.matches?.(n)&&!r?.querySelector?.(n)&&!o?.querySelector?.(n))return E;let i=e.nodeType===9||!e.isConnected?e:e.ownerDocument,s=e.nodeType===9?e:e.ownerDocument,c=null,l=()=>c||(c=X(i,{capability:"data",exclude:t.exclude||null})),a=f=>{let m=l();return f===e?m.cloneOf(e):m.cloneOf(f)||f},u=f=>c?.original(f)||f,p=(f,m)=>{l().liveToClone.set(f,m),l().cloneToLive.set(m,f);let g=f.childNodes||[],d=m.childNodes||[];for(let y=0;y<Math.min(g.length,d.length);y++)p(g[y],d[y])},h=(f,m,g,d)=>{let y=Array.from(f.childNodes).filter(x=>c.cloneOf(x)),w=y[0];for(;w&&y.includes(w);)w=w.nextSibling;for(let x of y)x.remove();if(g==="innerHTML"){let x=s.createElement("template");x.innerHTML=d;for(let H of Array.from(x.content.childNodes))f.insertBefore(H,w||null)}else f.insertBefore(s.createTextNode(d),w||null),nt(f,d);let b=X(f,{capability:"data",exclude:t.exclude||null});m.replaceChildren(...Array.from(b.root?.childNodes||[]));let O=x=>{let H=b.original(x);H&&(c.liveToClone.set(H,x),c.cloneToLive.set(x,H));for(let dt of Array.from(x.childNodes||[]))O(dt)};for(let x of Array.from(m.childNodes))O(x)},T={...E,find(f,m,g={}){let d=a(f);if(!d?.querySelectorAll)return[];let y=l().query(m,d);g.includeRulesTag||(y=y.filter(b=>!tt(b)));let A=[];g.skip&&A.push(g.skip);let w=g.templateAttr===null?null:g.templateAttr||"cms-template";if(w&&A.push(`[${w}]`),A.length){let b=A.join(", ");y=y.filter(O=>!O.closest?.(b))}return y},parent(f){let m=a(f)?.parentElement;return m?u(m):null},children(f){return Array.from(a(f)?.children||[],u)},text(f,m){if(m===void 0){let y=u(f);return!y?.matches?.(n)&&!y?.querySelector?.(n)?E.text(y):(a(f)?.textContent||"").trim()}let g=u(f);if(!g?.matches?.(n)&&!g?.querySelector?.(n)&&!c){E.text(g,m);return}let d=l().cloneOf(g);d?h(g,d,"textContent",m):E.text(g,m)},attr(f,m,g){let d=u(f);if(g===void 0)return E.attr(d,m);E.attr(d,m,g);let y=c?.cloneOf(d);y&&(E.attr(y,m,g),X(d,{capability:"data",exclude:t.exclude||null}).root===null&&(y.remove(),c.liveToClone.delete(d),c.cloneToLive.delete(y)))},removeAttr(f,m){let g=u(f);E.removeAttr(g,m);let d=c?.cloneOf(g);d&&E.removeAttr(d,m)},prop(f,m,g){let d=u(f);if(g===void 0)return m==="innerHTML"||m==="outerHTML"||m==="textContent"||m==="innerText"?E.prop(a(d),m):E.prop(d,m);let y=m==="innerHTML"||m==="textContent"||m==="innerText",A=y?l().cloneOf(d):c?.cloneOf(d);A&&y?h(d,A,m,g):(E.prop(d,m,g),A&&E.prop(A,m,g))},clone(f){let m=a(f);if(m===f)return E.clone(f);let g=s.importNode(m,!0);return rt(g),g},insertAt(f,m,g){let d=u(f),A=T.children(d)[g]||(()=>{for(let O=d.children.length-1;O>=0;O--){let x=d.children[O];if(l().cloneOf(x))return x.nextElementSibling}return d.firstElementChild})(),w=u(m);d.insertBefore(w,A||null);let b=l().cloneOf(d);if(b){let O=l().cloneOf(w);O||(O=s.importNode(w,!0),p(w,O));let x=Array.from(b.children);b.insertBefore(O,x[g]||null)}},insertBefore(f,m){let g=u(f),d=u(m);g.parentNode.insertBefore(d,g);let y=l().cloneOf(g.parentNode);if(y){let A=l().cloneOf(d);A||(A=s.importNode(d,!0),p(d,A));let w=l().cloneOf(g);w?w.before(A):y.appendChild(A)}},insertAfter(f,m){let g=u(f),d=u(m);g.parentNode.insertBefore(d,g.nextSibling);let y=l().cloneOf(g.parentNode);if(y){let A=l().cloneOf(d);A||(A=s.importNode(d,!0),p(d,A));let w=l().cloneOf(g);w?w.after(A):y.appendChild(A)}},identity(f){return u(f)||null},remove(f){let m=u(f),g=l().cloneOf(m);E.remove(m),g&&E.remove(g)},replaceWith(f,m){let g=u(f),d=l().cloneOf(g),y=E.replaceWith(g,m);if(d){let A=X(y,{capability:"data",exclude:t.exclude||null});if(!A.root)d.remove();else{d.replaceWith(A.root);let w=b=>{let O=A.original(b);O&&(c.liveToClone.set(O,b),c.cloneToLive.set(b,O));for(let x of Array.from(b.childNodes||[]))w(x)};w(A.root)}}return y}};return T}var N=E;var Re={extract:(e,t,n={})=>C(G(e,n),e,t,n),apply:(e,t,n,o={})=>j(G(e,{...o,_write:!0}),e,t,n,o),findRulesIn:(e,t)=>K(N,e,t),findRules:(e,t)=>Se(N,e,t),bind:(e,t,n={})=>{let o=Se(N,e,t);if(!o){let r=typeof t=="string"?`data-rules-name~="${t}"`:"the provided rules object";throw new Error(`hyper-html-api: could not resolve rules for ${r}`)}return{...o,get:()=>C(G(e,n),e,o.rules,n),set:r=>j(G(e,{...n,_write:!0}),e,o.rules,r,n)}},parseStrict:Oe,parseRelaxed:$,ruleAttrIndex:S,splitRule:R,errors:re,DOM_PROPERTIES:Q};var Xt="hha:upgrade-check:";function M(e,t){let n=e.querySelector(`meta[name="${t}"]`),o=n?n.getAttribute("content"):null;return o&&o.trim()?o.trim():null}function ot(e){if(typeof e!="string")return null;let t=e.trim().replace(/^v/,"");return/^\d+(\.\d+)*$/.test(t)?t.split(".").map(Number):null}function Gt(e,t){let n=ot(e),o=ot(t);if(!n||!o)return!1;let r=Math.max(n.length,o.length);for(let i=0;i<r;i++){let s=n[i]||0,c=o[i]||0;if(s!==c)return s>c}return!1}function Zt(e){try{let t=globalThis.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}function Qt(e,t){try{globalThis.localStorage.setItem(e,JSON.stringify(t))}catch{}}async function it({force:e=!1,doc:t,loc:n,fetchFn:o,now:r,ttlMs:i=864e5}={}){if(t=t||(typeof document<"u"?document:null),n=n||(typeof location<"u"?location:null),o=o||(h=>fetch(h)),r=r??Date.now(),!t)return null;let s=M(t,"hyper-source");if(!s)return null;let c=M(t,"hyper-version"),l;try{l=new URL(s,n?n.href:void 0)}catch{return null}if(n&&l.origin===n.origin&&l.pathname===n.pathname)return null;let a=`${Xt}${l.href}:${c||"none"}`,u,p=e?null:Zt(a);if(p&&typeof p.checkedAt=="number"&&r-p.checkedAt<i)u=p.sourceVersion;else{try{let h=await o(l.href);if(!h.ok)throw new Error(`HTTP ${h.status}`);let T=await h.text(),f=new DOMParser().parseFromString(T,"text/html");u=M(f,"hyper-version")}catch{u=null}Qt(a,{checkedAt:r,sourceVersion:u})}return u?{available:Gt(u,c||"0.0.0"),currentVersion:c,sourceVersion:u,sourceUrl:l.href}:null}var en="script[data-rules-name]";function tn(e){return typeof e=="string"?e.trim().replace(/\s+/g," "):""}function se(e,t){let n=e.find(t,en,{includeRulesTag:!0}),o=new Set,r=[];for(let i of n){let s=tn(e.attr(i,"data-rules-name"));if(!s)continue;if(o.has(s)){console.warn(`hyper-html-api: duplicate rules tag name "${s}"; using the first.`);continue}let c=e.attr(i,"data-rules-version");if(c!==Ee)throw new k(c);o.add(s),r.push({name:s,rules:$(e.text(i))})}return r}function Ne(e,t){let n={};for(let{name:o,rules:r}of se(e,t))n[o]=C(e,t,r);return n}function st(e){let t=e||document,n=t.nodeType===9?t:t.ownerDocument||t;return{dataByName:Ne(N,t),version:M(n,"hyper-version")}}var Z=class extends Error{constructor(t,n){super(`could not fetch upgrade source: ${t}`),this.name="UpgradeSourceUnreachable",this.sourceUrl=t,this.cause=n}},ce=class extends Error{constructor(t){super(`upgrade source has no rules tags; refusing to drop all existing data: ${t}`),this.name="UpgradeSourceHasNoRules",this.sourceUrl=t}},_=class extends Error{constructor(t,n){super(t),this.name="UpgradeTransformInvalid",this.cause=n}},le=class extends Error{constructor(t){super(`found ${t} script[type="text/hyper-upgrade"] tags; only one is allowed per document.`),this.name="UpgradeMultipleTransforms",this.count=t}};var nn="text/hyper-upgrade";function ct(e,t){let n=e.find(t,`script[type="${nn}"]`);if(n.length===0)return null;if(n.length>1)throw new le(n.length);return e.text(n[0])||null}var rn=new Function("url","return import(url)");async function lt(e){let t=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(t),o;try{o=await rn(n)}catch(r){throw new _(`transform failed to load: ${r&&r.message?r.message:r}`,r)}finally{URL.revokeObjectURL(n)}if(typeof o.default!="function")throw new _("transform must `export default` a function");return o.default}function fe(e,t){let n={carriedOver:0,discarded:0,listItems:0},o=Ce(t,e,n);return Me(t,e,n),{data:o,summary:n}}function Ce(e,t,n,o=!1){if(typeof e=="string")return e.endsWith("[]")?Array.isArray(t)?(n.listItems+=t.length,n.carriedOver+=t.length,t):o?[]:void 0:t==null||typeof t=="object"?o&&!on(e)?null:void 0:(n.carriedOver++,t);if(Array.isArray(e)){let[,r]=e;return Array.isArray(t)?(n.listItems+=t.length,t.map(i=>Ce(r,i,n,!0))):o?[]:void 0}if(typeof e=="object"&&e!==null){let r={};for(let[i,s]of Object.entries(e)){let c=Ce(s,t?.[i],n,o);c!==void 0&&(r[i]=c)}return r}}function on(e){let t=S(e);return t!==-1&&D.has(e.slice(t+1))}function Me(e,t,n){if(t!=null){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){if(typeof t!="object"||Array.isArray(t))return;let o=new Set(Object.keys(e));for(let r of Object.keys(t))o.has(r)?Me(e[r],t[r],n):n.discarded+=U(t[r]);return}if(Array.isArray(e)&&Array.isArray(t)){let o=e[1];t.forEach(r=>Me(o,r,n));return}typeof e=="string"&&!e.endsWith("[]")&&typeof t=="object"&&t!==null&&(n.discarded+=U(t))}}function U(e){return e==null?0:Array.isArray(e)?e.reduce((t,n)=>t+U(n),0):typeof e=="object"?Object.values(e).reduce((t,n)=>t+U(n),0):1}function ft(e,t,n){let o=se(e,t),r={carriedOver:0,discarded:0,listItems:0},i={},s=new Set;for(let{name:c,rules:l}of o){if(s.add(c),!Object.prototype.hasOwnProperty.call(n,c)){i[c]={carriedOver:0,discarded:0,listItems:0};continue}let{data:a,summary:u}=fe(n[c],l);j(e,t,l,a,{templateAttr:"cms-template"}),i[c]=u,r.carriedOver+=u.carriedOver,r.discarded+=u.discarded,r.listItems+=u.listItems}for(let c of Object.keys(n))s.has(c)||(r.discarded+=U(n[c]));return{totals:r,byName:i,rulesTagCount:o.length}}async function ut({sourceUrl:e,dataByName:t,fromVersion:n,doc:o,loc:r,fetchFn:i}={}){if(o=o||(typeof document<"u"?document:null),r=r||(typeof location<"u"?location:null),i=i||(d=>fetch(d)),!o)throw new Error("upgrade.run requires a document context");if(e=e||M(o,"hyper-source"),!e)throw new Error("upgrade.run: no sourceUrl given and no hyper-source meta tag found");let s=new URL(e,r?r.href:void 0);n=n!==void 0?n:M(o,"hyper-version"),t=t||Ne(N,o);let c;try{c=await i(s.href)}catch(d){throw new Z(s.href,d)}if(!c.ok)throw new Z(s.href,new Error(`HTTP ${c.status}`));let l=await c.text(),a=new DOMParser().parseFromString(l,"text/html"),u=M(a,"hyper-version"),p=t,h=!1,T=ct(N,a);if(T){let y=await(await lt(T))(p,{fromVersion:n,toVersion:u});if(!y||typeof y!="object"||Array.isArray(y))throw new _("transform must return a plain object map of { rulesName: data }");p=y,h=!0}let{totals:f,byName:m,rulesTagCount:g}=ft(N,a,p);if(g===0&&Object.keys(p).length>0)throw new ce(s.href);return{html:cn(a),fromVersion:n,toVersion:u,summary:{transformApplied:h,totals:f,byName:m}}}function sn(e){for(let t of e.querySelectorAll("input")){let n=(t.getAttribute("type")||"").toLowerCase();n!=="file"&&(n==="checkbox"||n==="radio"?t.checked!==t.hasAttribute("checked")&&t.toggleAttribute("checked",t.checked):t.value!==(t.getAttribute("value")??"")&&t.setAttribute("value",t.value))}for(let t of e.querySelectorAll("textarea"))t.value!==t.textContent&&(t.textContent=t.value);for(let t of e.querySelectorAll("select")){let n=[...t.options];if(!t.multiple){let o=n.findIndex(r=>r.hasAttribute("selected"));if(t.selectedIndex===o||o===-1&&t.selectedIndex<=0)continue}for(let o of n)o.selected!==o.hasAttribute("selected")&&o.toggleAttribute("selected",o.selected)}}function cn(e){return sn(e),`<!DOCTYPE ${e.doctype&&e.doctype.name?e.doctype.name:"html"}>
2
- `+e.documentElement.outerHTML}var at={checkForUpdate:it,run:ut,extractAll:st,shapeMatch:fe};var ln={engine:Re,upgrade:at},fn=ln;return gt(un);})();
1
+ var hyperHtmlApiUpgrade=(()=>{var ge=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var kt=Object.prototype.hasOwnProperty;var qe=(e,t)=>{for(var n in t)ge(e,n,{get:t[n],enumerable:!0})},Pt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Nt(t))!kt.call(e,r)&&r!==n&&ge(e,r,{get:()=>t[r],enumerable:!(o=Ct(t,r))||o.enumerable});return e};var Mt=e=>Pt(ge({},"__esModule",{value:!0}),e);var kn={};qe(kn,{default:()=>Nn,engine:()=>ve,upgrade:()=>bt});var ne=["textContent","innerText","innerHTML","outerHTML","value","checked","selected","disabled","readOnly","type","tagName","nodeName","nodeType","nodeValue","childElementCount","id","className","classList","baseURI","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","dataset","currentSrc","duration","paused","title","documentURI","contentType"],re=new Set(ne),we=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),W=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]),Ve=new Set(["checked","selected","disabled","readOnly","paused"]);function Ae(e,t){return t==null?Ve.has(e)?!1:"":Ve.has(e)?t==="false"?!1:!!t:t}var se={};qe(se,{CodecRefused:()=>xe,EmptyListInsert:()=>I,MAX_RULE_DEPTH:()=>L,MaxRuleDepthExceeded:()=>$,NoRulesTag:()=>Te,RuleTargetReadOnly:()=>z,RulesParseError:()=>C,ShapeMismatch:()=>B,UnknownCodec:()=>F,UnknownRulesVersion:()=>j,WriteNotRoundTripped:()=>ie,WriteRefused:()=>oe,WriteRejected:()=>Oe});var C=class extends Error{constructor(t,n){super(t),this.name="RulesParseError",this.cause=n}},j=class extends Error{constructor(t){super(`unknown rules version: ${t}. Library supports "1" and "2".`),this.name="UnknownRulesVersion",this.version=t}},L=20,$=class extends Error{constructor(t){super(`rule depth exceeded ${L} at path: ${t.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=t}},B=class extends Error{constructor(t){super(`shape mismatch: ${t.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=t}},I=class extends Error{constructor(t,n){super(n?`cannot add items to empty list at "${t.join(".")}" \u2014 ${n}`:`cannot add items to empty list at "${t.join(".")}" \u2014 no sibling to clone as template. Seed the list with a hidden item first.`),this.name="EmptyListInsert",this.path=t}},z=class extends Error{constructor(t){super(`cannot write to read-only DOM property "${t}"`),this.name="RuleTargetReadOnly",this.target=t}},oe=class extends Error{constructor(t){super(`write refused: ${t.length} write(s) broke the content-only policy`),this.name="WriteRefused",this.refusals=t}};function It(e){return e.reduce((n,o)=>typeof o=="number"?`${n}[${o}]`:n?`${n}.${o}`:String(o),"")||"(root)"}var ie=class extends Error{constructor(t){super(`write did not round-trip at "${It(t)}"`),this.name="WriteNotRoundTripped",this.path=t}},Te=class extends Error{constructor(t){super(`no <script data-rules-name~="${t}"> rules tag in this document`),this.name="NoRulesTag",this.token=t}},Oe=class extends Error{constructor(t,n){super(`write rejected: ${t.length} unknown key(s), ${n.length} rule(s) with no matching element`),this.name="WriteRejected",this.unknownKeys=t,this.unmatched=n}},F=class extends Error{constructor(t){super(`unknown codec "${t}": no codec by that name is given to this call`),this.name="UnknownCodec",this.code="unknown-codec",this.codec=t}},xe=class extends Error{constructor(t,n){super(n),this.name="CodecRefused",this.code=t}};function b(e){let t=0,n=null,o=-1;for(let r=0;r<e.length;r++){let i=e[r];i==="\\"?r++:n?i===n&&(n=null):i==='"'||i==="'"?n=i:i==="["||i==="("?t++:i==="]"||i===")"?t>0&&t--:i==="@"&&t===0&&(o=r)}return o}var Be="[*]";function R(e){let t=b(e),n=t===-1?e:e.slice(0,t),o=n.endsWith(Be),r={selector:o?n.slice(0,-Be.length):n,prop:t===-1?null:e.slice(t+1)||null};return o&&(r.all=!0),r}function Ee(e){let t=0,n=null,o=-1,r=!1;for(let i=0;i<e.length;i++){let s=e[i];s==="\\"?i++:n?s===n&&(n=null):s==='"'||s==="'"?n=s:s==="["||s==="("?t++:s==="]"||s===")"?t>0&&t--:t===0&&s===">"?o=i:t===0&&s===","&&(r=!0)}return r||o===-1||!Lt(e,o+1)?null:e.slice(0,o).trim()||null}function Lt(e,t){let n=t,o=e.replace(/\s+$/,"").length;for(;n<o&&/\s/.test(e[n]);)n++;let r=0,i=null;for(;n<o;n++){let s=e[n];if(s==="\\")n++;else if(i)s===i&&(i=null);else if(s==='"'||s==="'")i=s;else if(s==="["||s==="(")r++;else if(s==="]"||s===")")r>0&&r--;else if(r===0&&(s==="+"||s==="~"||/\s/.test(s)))return!1}return!0}var jt=/^codec\(([a-z][a-z0-9-]*)\)$/;function k(e){if(typeof e!="string")return null;let t=b(e);if(t===-1)return null;let n=jt.exec(e.slice(t+1));if(!n)return null;let{selector:o,all:r}=R(e);if(r)throw new C("A @codec(name) rule cannot use [*].");return{selector:o,name:n[1]}}var $t=/^--[A-Za-z0-9_-]+$/;function _(e){return typeof e=="string"&&$t.test(e)}function ze(e){let t=[],n=[],o=null,r=0;for(let i=0;i<e.length;i++){let s=e[i];if(o){s==="\\"?i++:s===o&&(o=null);continue}if(s==="/"&&e[i+1]==="*"){let c=e.indexOf("*/",i+2);i=c===-1?e.length:c+1;continue}s==='"'||s==="'"?o=s:s==="("?n.push(")"):s==="["?n.push("]"):s==="{"?n.push("}"):(s===")"||s==="]"||s==="}")&&n[n.length-1]===s?n.pop():s===";"&&n.length===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}function _t(e){let t="",n=null;for(let o=0;o<e.length;o++){let r=e[o];if(n){t+=r,r==="\\"&&o+1<e.length?t+=e[++o]:r===n&&(n=null);continue}if(r==="/"&&e[o+1]==="*"){let i=e.indexOf("*/",o+2);o=i===-1?e.length:i+1,t+=" ";continue}(r==='"'||r==="'")&&(n=r),t+=r}return t}function Fe(e){e=_t(e);let t=e.indexOf(":");if(t===-1)return null;let n=e.slice(0,t).trim(),o=e.slice(t+1).trim(),r=/!\s*important\s*$/i.exec(o);return r&&(o=o.slice(0,r.index).trim()),{name:n,value:o,important:!!r}}function K(e,t){if(e==null)return null;let n=null;for(let o of ze(String(e))){let r=Fe(o);!r||r.name!==t||(!n||r.important||!n.important)&&(n=r)}return n?n.value:null}function Ke(e,t,n){let o=e==null?"":String(e),r=n==null||n==="",i=ze(o),s=i.map(Fe),c=s.some(d=>d&&d.name===t&&d.important),l=[],p=!1;i.forEach((d,h)=>{let A=s[h];if(!A||A.name!==t){l.push(d);return}if(r||p)return;let f=/^\s*/.exec(d)[0];l.push(`${f}${t}: ${n}${c?" !important":""}`),p=!0});let u=l.join(";");if(!r&&!p){let d=u.trimEnd();u=d===""?`${t}: ${n}`:`${d}${d.endsWith(";")?" ":"; "}${t}: ${n}`}return u.trim()===""?null:u}function Se(e,t,n,o){let r=e.attr(t,"style");if((K(r,n)??"")===o)return;let i=Ke(r,n,o);i==null?e.removeAttr(t,"style"):e.attr(t,"style",i)}var Je=/^[a-z][a-z0-9-]*$/,be=new Map;function Re(e,t){if(typeof e!="string"||!Je.test(e))throw new Error(`hyper-html-api: invalid codec name ${JSON.stringify(e)} (must match ${Je})`);if(!t||typeof t.read!="function"||typeof t.write!="function"||typeof t.same!="function")throw new Error(`hyper-html-api: codec "${e}" needs read, write and same functions`);be.set(e,t)}function Ce(e){return be.get(e)??null}function Ne(){return Object.fromEntries(be)}var Dt='The @codec(name) rule form needs a rules tag with data-rules-version="2".',vt="A @codec(name) rule must be the value of a top level key.";function ce(e,t){let n=k(e);return n?{...n,codec:t.codecs[n.name]}:null}function H(e,t={}){let n=t.version??"1",o=t.codecs??{};r(e,0);function r(i,s){if(!(s>L)){if(typeof i=="string"){let c=k(i);if(!c)return;if(n!=="2")throw new C(Dt);if(s!==1)throw new C(vt);if(!Object.prototype.hasOwnProperty.call(o,c.name))throw new F(c.name);return}if(Array.isArray(i)){r(i[1],s+1);return}if(i&&typeof i=="object")for(let c of Object.values(i))r(c,s+1)}}}function P(e,t,n,o={}){if(Object.prototype.hasOwnProperty.call(o,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");return H(n,o),Pe(e,t,n,{depth:0,path:[]},o)}function Pe(e,t,n,o,r){if(o.depth>L)throw new $(o.path);if(typeof n=="string")return Ut(e,t,n,o,r);if(Array.isArray(n)){let[i,s]=n,c=e.find(t,i,r);return Ye(r,o,c),c.map((l,p)=>Pe(e,l,s,{depth:o.depth+1,path:[...o.path,p]},r))}if(typeof n=="object"&&n!==null){let i={};for(let[s,c]of Object.entries(n))i[s]=Pe(e,t,c,{depth:o.depth+1,path:[...o.path,s]},r);return i}return null}function Ut(e,t,n,o,r){if(n.endsWith("[]")){let u=n.slice(0,-2),d=e.find(t,u,r);return Ye(r,o,d),d.map(h=>e.text(h))}let i=ce(n,r);if(i)return Wt(e,t,i,r);if(n.startsWith("@"))return ke(e,t,n.slice(1));let s=b(n);if(s!==-1){let{selector:u,all:d}=R(n),h=n.slice(s+1),A=u?e.find(t,u,r):[t];return d&&r.allMatches?A.map(f=>ke(e,f,h)):A.length===0?null:ke(e,A[0],h)}if(n===".")return e.text(t);let{selector:c,all:l}=R(n),p=e.find(t,c,r);return l&&r.allMatches?p.map(u=>e.text(u)):p.length===0?null:e.text(p[0])}function Wt(e,t,{selector:n,codec:o},r){let i=n?e.find(t,n,r):[t];return i.length===0?null:o.read(e,i[0],{query:r.query,view:r.view,region:r.region})}function Ye(e,t,n){if(typeof e.onRowsRead=="function")try{e.onRowsRead(t.path.slice(),n)}catch(o){console.warn(`[hyper-html-api] onRowsRead threw at "${t.path.join(".")||"(root)"}"`,o)}}function ke(e,t,n){if(_(n))return K(e.attr(t,"style"),n);if(re.has(n)){let r=e.prop(t,n);return r==null?null:String(r)}let o=e.attr(t,n);return o??null}function Ze(e,t,n,o){let r=e.length,i=t.length,s=new Array(r).fill(-1);if(o){let a=new Set;for(let y=0;y<r;y++){let w=o[y];!(w>=0&&w<i)||a.has(w)||(s[y]=w,a.add(w))}}if(r===0||i===0)return s;let c=e.map(a=>Xe(a,n)),l=t.map(a=>Xe(a,n)),p=new Array(i).fill(!1);for(let a of s)a>=0&&(p[a]=!0);let u=new Map;l.forEach((a,y)=>{p[y]||u.set(a,u.has(a)?-1:y)});let d=new Map;c.forEach((a,y)=>{s[y]>=0||d.set(a,(d.get(a)||0)+1)}),c.forEach((a,y)=>{if(s[y]>=0||d.get(a)!==1)return;let w=u.get(a);w===void 0||w===-1||p[w]||(s[y]=w,p[w]=!0)});let h=[];for(let a=0;a<r;a++)s[a]<0&&h.push(a);let A=[];for(let a=0;a<i;a++)p[a]||A.push(a);if(h.length===0||A.length===0)return s;let f=r*i+1,m=Ht(e,t,n),g=(a,y)=>m(a,y)*f+Math.abs(a-y);for(let[a,y]of qt(h,A,g))s[a]=y;return s}var Qe=e=>typeof e=="object"&&e!==null;function Xe(e,t){if(!Qe(t))return e==null?" null":String(e);let n=Object.keys(t);return JSON.stringify(n.map(o=>{let r=JSON.stringify(e?.[o]);return r===void 0?" undef":r}))}function Ht(e,t,n){if(!Qe(n))return(c,l)=>e[c]===t[l]?0:1;let o=Object.keys(n),r=c=>o.map(l=>JSON.stringify(c?.[l])),i=e.map(r),s=t.map(r);return(c,l)=>{let p=i[c],u=s[l],d=0;for(let h=0;h<o.length;h++)p[h]!==u[h]&&d++;return d}}function qt(e,t,n){return e.length<=t.length?Ge(e,t,n,!1):Ge(t,e,(o,r)=>n(r,o),!0)}function Ge(e,t,n,o){let r=e.length,i=t.length,s=[];for(let d=0;d<=r;d++)s.push(new Float64Array(i+1).fill(1/0));let c=[];for(let d=0;d<=r;d++)c.push(new Uint8Array(i+1));for(let d=0;d<=i;d++)s[r][d]=0;for(let d=r-1;d>=0;d--)for(let h=i-1;h>=0;h--){let A=n(e[d],t[h])+s[d+1][h+1],f=s[d][h+1];A<=f?(s[d][h]=A,c[d][h]=1):s[d][h]=f}let l=[],p=0,u=0;for(;p<r&&u<i;)c[p][u]&&(l.push(o?[t[u],e[p]]:[e[p],t[u]]),p++),u++;return l}function Ie(e,t,n,o,r,i,s,c={}){let l=e.find(t,n,c);if(r.length===0){l.forEach(T=>e.remove(T)),Me(c,"onRowsApplied",i.path,[]);return}let p=r.length>l.length,u=l[0]||null;if(p&&!u&&(u=Ft(e,t,n,c),!u))throw new I(i.path);let d=l.map(T=>zt(e,T,o,c)),h=null;if(p&&u){h=e.clone(u),c.templateAttr&&e.removeAttr(h,c.templateAttr);let T=e.stripIds(h);T>0&&console.warn(`[hyper-html-api] stripped ${T} id attribute(s) from cloned template at "${i.path.join(".")||"(root)"}"`)}let A=Ze(r,d,o,Vt(e,l,r,i,c)),f=l.length>0?e.parent(l[0]):Xt(e,t,n,u,i,c),m=l.length>0?ot(e,f,l[0]):0,g=Qt(e,l),a=new Set,y=[],w=r.map((T,S)=>{let x=A[S];if(x>=0)return a.add(x),y.push(!1),l[x];y.push(!0);let O=e.clone(h);return e.stripIds(O),O});l.forEach((T,S)=>{a.has(S)||e.remove(T)}),g?Zt(e,f,m,w,y):en(e,w,y,f,m),Bt(e,w,o,r,i,s,c),Me(c,"onRowsApplied",i.path,w)}function Me(e,t,n,o){if(typeof e[t]=="function")try{return e[t](n.slice(),o)}catch(r){console.warn(`[hyper-html-api] ${t} threw at "${n.join(".")||"(root)"}"`,r);return}}function Vt(e,t,n,o,r){let i=Me(r,"identifyRows",o.path,n);if(!Array.isArray(i))return null;let s=new Array(n.length).fill(-1),c=new Set,l=new Map(t.map((p,u)=>[e.identity(p),u]));for(let p=0;p<n.length;p++){if(!i[p])continue;let u=l.get(e.identity(i[p]));u===void 0||c.has(u)||(s[p]=u,c.add(u))}return s}function Bt(e,t,n,o,r,i,s){t.forEach((c,l)=>{if(n===null){let p=o[l],u=p==null?"":String(p);e.text(c)!==u&&e.text(c,u)}else{let p=i(e,c,n,o[l],{depth:r.depth+1,path:[...r.path,l]},s);p&&p!==c&&(t[l]=p)}})}function zt(e,t,n,o){return n===null?e.text(t):P(e,t,n,o.onRowsRead?{...o,onRowsRead:void 0}:o)}function ot(e,t,n){let o=e.children(t);for(let r=0;r<o.length;r++)if(e.sameNode(o[r],n))return r;return-1}function Ft(e,t,n,o){if(!o.templateAttr)return null;let r=/^\s*:scope\s*>\s*/.test(n),i=new RegExp(":not\\(\\["+o.templateAttr.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")+"\\]\\)","g"),s=n.replace(/^\s*:scope\s*>\s*/,"").replace(i,""),c=r?Kt(s):0,l=Ee(s),p=t;for(;p;){let u=e.find(p,s,{includeRulesTag:!1,templateAttr:null});for(let d of u)if(e.attr(d,o.templateAttr)!=null&&!(r&&!Yt(e,t,d,c))&&!(l&&!e.matches(e.parent(d),l)))return d;p=e.parent(p)}return null}function Kt(e){let t=0,n=null,o=1;for(let r=0;r<e.length;r++){let i=e[r];if(i==="\\")r++;else if(n)i===n&&(n=null);else if(i==='"'||i==="'")n=i;else if(i==="["||i==="(")t++;else if(i==="]"||i===")")t>0&&t--;else if(t===0&&i===">")o++;else{if(t===0&&(i==="+"||i==="~"))return null;if(t===0&&/\s/.test(i)){if(!Jt(e,r))return null;for(;r+1<e.length&&/\s/.test(e[r+1]);)r++}}}return o}function Jt(e,t){let n=t;for(;n<e.length&&/\s/.test(e[n]);)n++;let o=t>0?e[t-1]:"",r=n<e.length?e[n]:"";return et(o)||et(r)}function et(e){return e===">"||e==="+"||e==="~"}function Yt(e,t,n,o){if(o===null)return!0;let r=n;for(let l=0;l<o;l++)if(r=e.parent(r),!r)return!1;let i=e.prop(t,"tagName");if(!i)return!0;let s=e.prop(r,"tagName");if(!s||String(s).toLowerCase()!==String(i).toLowerCase())return!1;let c=new Set(tt(e,r));return tt(e,t).every(l=>c.has(l))}function tt(e,t){let n=e.attr(t,"class");return n?String(n).split(/\s+/).filter(Boolean):[]}function Xt(e,t,n,o,r,i){let s=e.parent(o);if(s&&Gt(e,t,s)&&!rt(e,s,i))return s;let c=Ee(n);if(!c)throw new I(r.path,`the list selector "${n}" names no container to hold the new rows \u2014 write it as "container > row" (for example "ol.comments > li") so the cloned row lands in the list`);let p=(c===":scope"?e.prop(t,"tagName")?[t]:[]:e.find(t,c,i)).filter(u=>!rt(e,u,i));if(p.length===0)throw new I(r.path,`no container matching "${c}" inside this context to hold the new rows`);if(p.length>1)throw new I(r.path,`"${c}" matches ${p.length} containers inside this context, so the new rows have no single destination`);return p[0]}function Gt(e,t,n){let o=n;for(;o;){if(e.sameNode(o,t))return!0;o=e.parent(o)}return e.parent(t)?!1:e.find(t,"*",{includeRulesTag:!0,templateAttr:null}).some(r=>e.sameNode(r,n))}var nt=["no-data","editor-ui"];function rt(e,t,n){let o=t;for(;o;){if(n.templateAttr&&e.attr(o,n.templateAttr)!=null||nt.some(i=>e.attr(o,i)!=null))return!0;let r=e.attr(o,"clay");if(r&&r.split(/\s+/).some(i=>nt.includes(i)))return!0;o=e.parent(o)}return!1}function Zt(e,t,n,o,r){let i=e.children(t),s=i.map(l=>e.identity(l)),c=!1;o.forEach((l,p)=>{let u=e.identity(l),d=n+p;if(s[d]===u)return;if(!r[p]){let A=s.indexOf(u);A!==-1&&(s.splice(A,1),i.splice(A,1))}let h=Math.min(d,i.length);h<i.length?e.insertBefore(i[h],l):i.length?c?e.insertAfter(i[i.length-1],l):(e.insertAt(t,l,d),c=!0):e.insertAt(t,l,0),s.splice(h,0,u),i.splice(h,0,l)})}function Qt(e,t){if(t.length<=1)return!0;let n=e.parent(t[0]);if(!n)return!1;let o=new Map(e.children(n).map((i,s)=>[e.identity(i),s])),r=[];for(let i of t){let s=o.get(e.identity(i));if(s===void 0)return!1;r.push(s)}return r.sort((i,s)=>i-s),r[r.length-1]-r[0]===r.length-1}function en(e,t,n,o,r){let i=null,s=r;for(let c=0;c<t.length;c++){if(!n[c]){i=t[c];continue}let l=i?e.parent(i):o;if(!l)continue;let p=i?ot(e,l,i)+1:s++;e.insertAt(l,t[c],p),i=t[c]}}function D(e,t,n,o,r={}){if(Object.prototype.hasOwnProperty.call(r,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");H(n,r);let i=[];if(Le(n,o,[],i),i.length)throw new B(i);le(e,t,n,o,{depth:0,path:[]},r)}function le(e,t,n,o,r,i={}){if(r.depth>L)throw new $(r.path);if(o===void 0)return t;if(typeof n=="string")return tn(e,t,n,o,r,i);if(Array.isArray(n)){let[s,c]=n;return Ie(e,t,s,c,o,r,le,i),t}if(typeof n=="object"&&n!==null){for(let[s,c]of Object.entries(n)){let l=le(e,t,c,o==null?o:o[s],{depth:r.depth+1,path:[...r.path,s]},i);l&&l!==t&&(t=l)}return t}return t}function tn(e,t,n,o,r,i){if(n.endsWith("[]")){let d=n.slice(0,-2);return Ie(e,t,d,null,o,r,le,i),t}let s=ce(n,i);if(s){let d=s.selector?e.find(t,s.selector,i):[t];return d.length&&s.codec.write(e,d[0],o,{query:i.query}),t}if(n.startsWith("@"))return st(e,t,n.slice(1),o);let c=b(n);if(c!==-1){let{selector:d,all:h}=R(n),A=n.slice(c+1),f=d?e.find(t,d,i):[t];for(let m of h?f:f.slice(0,1))st(e,m,A,o);return t}if(n===".")return it(e,t,o),t;let{selector:l,all:p}=R(n),u=e.find(t,l,i);for(let d of p?u:u.slice(0,1))it(e,d,o);return t}function it(e,t,n){let o=n==null?"":String(n);e.text(t)!==o&&e.text(t,o)}function nn(e,t,n,o){if(e.styleVar){e.styleVar(t,n,o);return}Se(e,t,n,o)}function st(e,t,n,o){if(_(n))return nn(e,t,n,o==null?"":String(o).trim()),t;if(W.has(n)){let r=e.prop(t,n);if(r===o||r!=null&&o!=null&&String(r)===String(o))return t;throw new z(n)}if(n==="outerHTML"){let r=o==null?"":String(o);return e.replaceWith(t,r)}if(we.has(n)){let r=Ae(n,o);return e.prop(t,n)!==r&&e.prop(t,n,r),t}if(o==null)e.attr(t,n)!=null&&e.removeAttr(t,n);else{let r=String(o);e.attr(t,n)!==r&&e.attr(t,n,r)}return t}function Le(e,t,n,o){if(t!==void 0){if(typeof e=="string"){if(k(e))return;if(e.endsWith("[]")){Array.isArray(t)?t.forEach((r,i)=>{typeof r=="object"&&r!==null&&o.push({path:Y([...n,i]),expected:"scalar",got:J(r)})}):o.push({path:Y(n),expected:"array",got:J(t)});return}t!==null&&typeof t=="object"&&o.push({path:Y(n),expected:"scalar",got:J(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){o.push({path:Y(n),expected:"array",got:J(t)});return}let r=e[1];t.forEach((i,s)=>Le(r,i,[...n,s],o));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){o.push({path:Y(n),expected:"object",got:J(t)});return}for(let[r,i]of Object.entries(e))Le(i,t[r],[...n,r],o)}}}function J(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Y(e){return e.join(".")}function je(e){try{return JSON.parse(e)}catch(t){throw new C(`Invalid strict JSON: ${t.message}`,t)}}function v(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function n(r){let i=[],s=0;for(;s<r.length;){let c=r[s];if(/\s/.test(c)){s++;continue}if("{}".includes(c)){i.push({type:c,value:c}),s++;continue}if(c==="["){let d=!1,h=s+1;for(;h<r.length&&/\s/.test(r[h]);)h++;if(h<r.length&&/[a-zA-Z_]/.test(r[h])&&(d=!0),!d){i.push({type:c,value:c}),s++;continue}}if(c==="]"){i.push({type:c,value:c}),s++;continue}if(c===":"){i.push({type:t.COLON,value:c}),s++;continue}if(c===","){i.push({type:t.COMMA,value:c}),s++;continue}if(c==='"'||c==="'"){let d=c,h=s+1;for(;h<r.length&&r[h]!==d;)r[h]==="\\"&&h++,h++;i.push({type:t.STRING,value:r.substring(s+1,h),quoted:!0,sourceQuote:d}),s=h+1;continue}let l=s,p;for(;l<r.length&&!/[{},]/.test(r[l]);)if(r[l]===":"){let d=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],h=!1;for(let A of d){let f=A.substring(1);if(r.substring(l+1,l+1+f.length)===f){h=!0,l+=f.length;break}}if(!h)break}else if(r[l]==="["){for(l++;l<r.length&&r[l]!=="]";){if(r[l]==='"'||r[l]==="'"){let d=r[l];for(l++;l<r.length&&r[l]!==d;)r[l]==="\\"&&l++,l++}l++}l<r.length&&r[l]==="]"&&l++}else l++;p=r.substring(s,l);let u=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(p)?u=t.NUMBER:p==="true"||p==="false"||p==="null"?u=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(p)&&(u=t.SELECTOR),i.push({type:u,value:p,quoted:!1}),s=l}return i}function o(r){let i="";for(let s=0;s<r.length;s++){let c=r[s];if("{}".includes(c.type)||"[]".includes(c.type)){i+=c.value;continue}if(c.type===t.COLON){i+=c.value;continue}if(c.type===t.COMMA){let l=r[s+1];if(l&&(l.type==="}"||l.type==="]"))continue;i+=c.value;continue}if(c.type===t.STRING&&c.quoted){let l=c.value;c.sourceQuote==="'"&&(l=l.replace(/\\'/g,"'"),l=l.replace(/(\\*)"/g,(p,u)=>u.length%2===0?u+'\\"':p)),i+=`"${l}"`;continue}if(c.type===t.NUMBER||c.type===t.BOOLEAN){i+=c.value;continue}if(c.type===t.SELECTOR||c.type===t.IDENTIFIER){i+=`"${c.value}"`;continue}i+=`"${c.value}"`}return i}try{let r=n(e),i=o(r);return JSON.parse(i)}catch(r){throw new C("Invalid extraction rules syntax: "+r.message,r)}}var fe=["1","2"],ct=/^[a-zA-Z0-9_-]+$/;function X(e,t,n){let o;if(n===void 0)o="script[data-rules-name]";else{if(typeof n!="string"||!ct.test(n))throw new Error(`hyper-html-api: invalid rules token ${JSON.stringify(n)} (must match ${ct})`);o=`script[data-rules-name~="${n}"]`}let r=e.find(t,o,{includeRulesTag:!0});if(r.length===0)return null;n!==void 0&&r.length>1&&console.warn(`hyper-html-api: ${r.length} rules tags match data-rules-name~="${n}"; using the first.`);let i=r[0],s=e.attr(i,"data-rules-version");if(!fe.includes(s))throw new j(s);return{rules:v(e.text(i)),tagNode:i,version:s}}var ue=Object.freeze({data:Object.freeze({tokens:["no-data"],bundles:["editor-ui"]}),save:Object.freeze({tokens:["no-save"],bundles:["editor-ui"]}),snapshot:Object.freeze({tokens:["no-snapshot"],bundles:["editor-ui"]}),watch:Object.freeze({tokens:["no-watch"],bundles:["editor-ui"]}),undo:Object.freeze({tokens:["no-undo"],bundles:["editor-ui"]}),history:Object.freeze({tokens:[],bundles:["editor-ui"]})}),rn=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),lt=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui","live"]);function G(e,t){if(!e||e.nodeType!==1)return!1;let n=e.getAttribute?.("clay");return!!(n&&n.split(/\s+/).includes(t)||e.hasAttribute?.(t))}function $e(e,t){if(G(e,t))return!0;for(let[n,o]of Object.entries(rn))if(o.includes(t)&&G(e,n))return!0;return!1}function Z(e){let t=ue[e];if(!t)throw new Error(`Unknown region capability: ${e}`);return[...t.tokens,...t.bundles].flatMap(n=>[`[clay~="${n}"]`,`[${n}]`]).join(", ")}function on(e,t){let n=e&&e.nodeType===1?e:e?.parentElement;for(;n&&n.nodeType===1;){let o=ue[t];if(!o)throw new Error(`Unknown region capability: ${t}`);if(o.tokens.some(r=>$e(n,r))||o.bundles.some(r=>G(n,r)))return n;n=n.parentElement}return null}function ft(e,t){return!!on(e,t)}var sn=Object.freeze({refusedRuleForms:["innerHTML","outerHTML"],refusedTargets:["script","style","template","noscript","iframe","object","embed","xmp","plaintext","noembed","noframes","meta","link","base","animate","set","animatemotion","animatetransform"],refusedAttributes:["style","srcdoc","is","http-equiv","sandbox","allow","nonce","integrity","charset","htmlclaytoken","htmlclayid","data-rules-name","data-rules-version","clay","contenteditable",...lt],refusedAttributePrefixes:["on"],urlAttributes:["href","src","srcset","action","formaction","poster","cite","data","ping","background","longdesc","usemap","xlink:href","manifest","codebase","icon"],refusedSchemes:["javascript","vbscript","data"],customPropertyValues:Object.freeze({maxLength:200,refusedCharacters:[";","{","}","<",">","\\"],refusedFunctions:["url","src","image","image-set","-webkit-image-set","cross-fade","element","expression","paint"]})});function _e(e,t,n){if(n&&typeof n=="object")return{rules:n,tagNode:null,version:"1"};if(typeof n=="string"){let o=t&&t.ownerDocument?t.ownerDocument:t;return X(e,o,n)}return null}var un=/:(?:focus(?:-within|-visible)?|hover|active|visited|defined)\b/i;function an(e,t){if(!/^(INPUT|TEXTAREA|SELECT|OPTION)$/.test(e.tagName||""))return;let n=(e.getAttribute?.("type")||"").toLowerCase();"value"in e&&"value"in t&&e.tagName!=="OPTION"&&n!=="checkbox"&&n!=="radio"&&n!=="file"&&(t.value=e.value),e.tagName==="INPUT"&&(n==="checkbox"||n==="radio")&&(t.checked=e.checked),e.tagName==="OPTION"&&(t.selected=e.selected),"indeterminate"in e&&"indeterminate"in t&&(t.indeterminate=e.indeterminate)}function ut(e,t,n,o){if(o)return!!e.closest?.(t);let r=e;for(;r?.nodeType===1;){if(r.matches(t))return!0;if(r===n)break;r=r.parentElement}return!1}function at(e,t,n,o,r,i){return(i?ft(e,t):ut(e,n,r,!1))||!!(o&&(i&&e!==r?e.matches(o):ut(e,o,r,i)))}function dn(e,t){let n=ue[t];return n.tokens.some(o=>$e(e,o))||n.bundles.some(o=>G(e,o))}var pn=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function dt(e,t,n,o){if(e.nodeType===1&&o(e)){n.dropped.push(t);return}n.cloneToLive.set(t,e),n.liveToClone.set(e,t);let r=e,i=t;if(e.nodeType===1){if(pn.has(e.tagName)&&n.controls.push(e,t),e.tagName==="TEMPLATE"){for(;t.firstChild;)t.removeChild(t.firstChild);r=e.content,i=t.content,n.cloneToLive.set(i,r),n.liveToClone.set(r,i)}}else if(e.nodeType!==11)return;let s=i.firstChild;for(let c=r.firstChild;c&&s;c=c.nextSibling)dt(c,s,n,o),s=s.nextSibling}function Q(e,{capability:t="data",exclude:n=null,inherit:o=!0,provenance:r=null}={}){if(!e)throw new TypeError("createContentView requires a DOM context");let i=e.nodeType===9?e:e.ownerDocument;if(!i?.implementation?.createHTMLDocument)throw new TypeError("createContentView requires an HTML DOM implementation");let s=i.implementation.createHTMLDocument(""),c=r||new WeakMap,l=new WeakMap,p=e.nodeType===9?e.documentElement:e;n&&s.documentElement.matches(n);let u=Z(t),d=o?f=>dn(f,t)||!!(n&&f.matches(n)):f=>at(f,t,u,n,p,!1),h=null;if(p.nodeType!==1||!at(p,t,u,n,p,o)){h=s.importNode(p,!0);let f={cloneToLive:c,liveToClone:l,dropped:[],controls:[]};dt(p,h,f,d);for(let m of f.dropped)m.remove();for(let m=0;m<f.controls.length;m+=2)an(f.controls[m],f.controls[m+1])}e.nodeType===9&&h&&(s.replaceChild(h,s.documentElement),l.set(e,s),c.set(s,e));let A=f=>{if(un.test(f))throw new Error(`Filtered content queries do not support stateful selector: ${f}`)};return{root:h,document:s,capability:t,selector:Z(t),cloneToLive:c,liveToClone:l,original(f){return c.get(f)||null},cloneOf(f){return l.get(f)||null},query(f,m=h){return A(f),Array.from(m.querySelectorAll(f),g=>c.get(g)||g)},text(f=h){return(f===h?h:l.get(f))?.textContent||""},html(f=h){return(f===h?h:l.get(f))?.innerHTML??""},clone(f=h){let m=f===h?h:l.get(f);return m?s.importNode(m,!0):null}}}function ht(e){return e&&e.nodeType===1&&e.tagName==="SCRIPT"&&e.hasAttribute&&e.hasAttribute("data-rules-name")}function hn(e){return e?(e.nodeType===9||e.nodeType===11,e):null}function pt(e,t,n){!e||e.nodeType!==1||(t==="value"&&e.tagName==="INPUT"?e.value=n===null?"":n:t==="checked"&&e.tagName==="INPUT"?e.checked=n!==null:t==="selected"&&e.tagName==="OPTION"&&(e.selected=n!==null))}function mt(e,t){e&&e.tagName==="TEXTAREA"&&(e.value=t)}function yt(e){if(!e||e.nodeType!==1)return;let t=[e,...e.querySelectorAll?e.querySelectorAll("textarea, input, option"):[]];for(let n of t)if(n.tagName==="TEXTAREA")n.value=n.defaultValue;else if(n.tagName==="INPUT"){let o=n.type;o!=="file"&&o!=="checkbox"&&o!=="radio"&&(n.value=n.defaultValue),n.checked=n.defaultChecked}else n.tagName==="OPTION"&&(n.selected=n.defaultSelected)}var E={semanticExclude:!0,find(e,t,n={}){let o=hn(e);if(!o||!o.querySelectorAll)return[];let r=Array.from(o.querySelectorAll(t));n.includeRulesTag||(r=r.filter(c=>!ht(c)));let i=[];n.skip&&i.push(n.skip);let s=n.templateAttr===null?null:n.templateAttr||"cms-template";if(s&&i.push("["+s+"]"),i.length){let c=i.join(", ");r=r.filter(l=>!l.closest||!l.closest(c))}return r},parent(e){return e?e.parentElement:null},children(e){return e?Array.from(e.children):[]},matches(e,t){return!!(e&&e.matches)&&e.matches(t)},text(e,t){if(t===void 0)return(e.textContent||"").trim();e.textContent=t,mt(e,t)},attr(e,t,n){if(n===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,n),pt(e,t,n)},removeAttr(e,t){e&&e.removeAttribute&&e.removeAttribute(t),pt(e,t,null)},prop(e,t,n){if(n===void 0){let o=e?e[t]:void 0;return o!==void 0?o:null}e[t]=n},clone(e){let t=e.cloneNode(!0);return yt(t),t},insertAt(e,t,n){let o=e.children[n]||null;e.insertBefore(t,o)},insertBefore(e,t){e.parentNode.insertBefore(t,e)},insertAfter(e,t){e.parentNode.insertBefore(t,e.nextSibling)},identity(e){return e||null},remove(e){e&&e.parentNode&&e.parentNode.removeChild(e)},replaceWith(e,t){if(!e||!e.parentNode)throw new Error("dom.replaceWith: node has no parent");let o=e.ownerDocument.createElement("template");o.innerHTML=t;let r=o.content.firstElementChild;if(!r)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(r,e),r},stripIds(e){let t=0;return e.id&&(e.removeAttribute("id"),t++),(e.querySelectorAll?e.querySelectorAll("[id]"):[]).forEach(o=>{o.removeAttribute("id"),t++}),t},sameNode(e,t){return e===t}};function ee(e,t={}){if(t.exclude===null)return E;let n=[Z("data"),t.exclude].filter(Boolean).join(", "),o=e.nodeType===9?e:e.ownerDocument||e,r=e.nodeType===9?e.documentElement:e;if(!t._write&&!r?.matches?.(n)&&!r?.querySelector?.(n)&&!o?.querySelector?.(n))return E;let i=e.nodeType===9||!e.isConnected?e:e.ownerDocument,s=e.nodeType===9?e:e.ownerDocument,c=null,l=()=>c||(c=Q(i,{capability:"data",exclude:t.exclude||null})),p=f=>{let m=l();return f===e?m.cloneOf(e):m.cloneOf(f)||f},u=f=>c?.original(f)||f,d=(f,m)=>{l().liveToClone.set(f,m),l().cloneToLive.set(m,f);let g=f.childNodes||[],a=m.childNodes||[];for(let y=0;y<Math.min(g.length,a.length);y++)d(g[y],a[y])},h=(f,m,g,a)=>{let y=Array.from(f.childNodes).filter(O=>c.cloneOf(O)),T=y[0];for(;T&&y.includes(T);)T=T.nextSibling;for(let O of y)O.remove();if(g==="innerHTML"){let O=s.createElement("template");O.innerHTML=a;for(let V of Array.from(O.content.childNodes))f.insertBefore(V,T||null)}else f.insertBefore(s.createTextNode(a),T||null),mt(f,a);let S=Q(f,{capability:"data",exclude:t.exclude||null});m.replaceChildren(...Array.from(S.root?.childNodes||[]));let x=O=>{let V=S.original(O);V&&(c.liveToClone.set(V,O),c.cloneToLive.set(O,V));for(let Rt of Array.from(O.childNodes||[]))x(Rt)};for(let O of Array.from(m.childNodes))x(O)},A={...E,find(f,m,g={}){let a=p(f);if(!a?.querySelectorAll)return[];let y=l().query(m,a);g.includeRulesTag||(y=y.filter(S=>!ht(S)));let w=[];g.skip&&w.push(g.skip);let T=g.templateAttr===null?null:g.templateAttr||"cms-template";if(T&&w.push(`[${T}]`),w.length){let S=w.join(", ");y=y.filter(x=>!x.closest?.(S))}return y},parent(f){let m=p(f)?.parentElement;return m?u(m):null},children(f){return Array.from(p(f)?.children||[],u)},text(f,m){if(m===void 0){let y=u(f);return!y?.matches?.(n)&&!y?.querySelector?.(n)?E.text(y):(p(f)?.textContent||"").trim()}let g=u(f);if(!g?.matches?.(n)&&!g?.querySelector?.(n)&&!c){E.text(g,m);return}let a=l().cloneOf(g);a?h(g,a,"textContent",m):E.text(g,m)},attr(f,m,g){let a=u(f);if(g===void 0)return E.attr(a,m);E.attr(a,m,g);let y=c?.cloneOf(a);y&&(E.attr(y,m,g),Q(a,{capability:"data",exclude:t.exclude||null}).root===null&&(y.remove(),c.liveToClone.delete(a),c.cloneToLive.delete(y)))},removeAttr(f,m){let g=u(f);E.removeAttr(g,m);let a=c?.cloneOf(g);a&&E.removeAttr(a,m)},prop(f,m,g){let a=u(f);if(g===void 0)return m==="innerHTML"||m==="outerHTML"||m==="textContent"||m==="innerText"?E.prop(p(a),m):E.prop(a,m);let y=m==="innerHTML"||m==="textContent"||m==="innerText",w=y?l().cloneOf(a):c?.cloneOf(a);w&&y?h(a,w,m,g):(E.prop(a,m,g),w&&E.prop(w,m,g))},clone(f){let m=p(f);if(m===f)return E.clone(f);let g=s.importNode(m,!0);return yt(g),g},insertAt(f,m,g){let a=u(f),w=A.children(a)[g]||(()=>{for(let x=a.children.length-1;x>=0;x--){let O=a.children[x];if(l().cloneOf(O))return O.nextElementSibling}return a.firstElementChild})(),T=u(m);a.insertBefore(T,w||null);let S=l().cloneOf(a);if(S){let x=l().cloneOf(T);x||(x=s.importNode(T,!0),d(T,x));let O=Array.from(S.children);S.insertBefore(x,O[g]||null)}},insertBefore(f,m){let g=u(f),a=u(m);g.parentNode.insertBefore(a,g);let y=l().cloneOf(g.parentNode);if(y){let w=l().cloneOf(a);w||(w=s.importNode(a,!0),d(a,w));let T=l().cloneOf(g);T?T.before(w):y.appendChild(w)}},insertAfter(f,m){let g=u(f),a=u(m);g.parentNode.insertBefore(a,g.nextSibling);let y=l().cloneOf(g.parentNode);if(y){let w=l().cloneOf(a);w||(w=s.importNode(a,!0),d(a,w));let T=l().cloneOf(g);T?T.after(w):y.appendChild(w)}},identity(f){return u(f)||null},remove(f){let m=u(f),g=l().cloneOf(m);E.remove(m),g&&E.remove(g)},replaceWith(f,m){let g=u(f),a=l().cloneOf(g),y=E.replaceWith(g,m);if(a){let w=Q(y,{capability:"data",exclude:t.exclude||null});if(!w.root)a.remove();else{a.replaceWith(w.root);let T=S=>{let x=w.original(S);x&&(c.liveToClone.set(x,S),c.cloneToLive.set(S,x));for(let O of Array.from(S.childNodes||[]))T(O)};T(w.root)}}return y}};return A}var N=E;var De=e=>({codecs:Ne(),...e}),ve={extract:(e,t,n={})=>P(ee(e,n),e,t,De(n)),apply:(e,t,n,o={})=>D(ee(e,{...o,_write:!0}),e,t,n,De(o)),findRulesIn:(e,t)=>X(N,e,t),findRules:(e,t)=>_e(N,e,t),bind:(e,t,n={})=>{let o=_e(N,e,t);if(!o){let i=typeof t=="string"?`data-rules-name~="${t}"`:"the provided rules object";throw new Error(`hyper-html-api: could not resolve rules for ${i}`)}let r=De({version:o.version,...n});return{...o,get:()=>P(ee(e,n),e,o.rules,r),set:i=>D(ee(e,{...n,_write:!0}),e,o.rules,i,r)}},codecs:{register:Re,get:Ce},parseStrict:je,parseRelaxed:v,ruleAttrIndex:b,splitRule:R,errors:se,DOM_PROPERTIES:ne};var mn="hha:upgrade-check:";function M(e,t){let n=e.querySelector(`meta[name="${t}"]`),o=n?n.getAttribute("content"):null;return o&&o.trim()?o.trim():null}function gt(e){if(typeof e!="string")return null;let t=e.trim().replace(/^v/,"");return/^\d+(\.\d+)*$/.test(t)?t.split(".").map(Number):null}function yn(e,t){let n=gt(e),o=gt(t);if(!n||!o)return!1;let r=Math.max(n.length,o.length);for(let i=0;i<r;i++){let s=n[i]||0,c=o[i]||0;if(s!==c)return s>c}return!1}function gn(e){try{let t=globalThis.localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}function wn(e,t){try{globalThis.localStorage.setItem(e,JSON.stringify(t))}catch{}}async function wt({force:e=!1,doc:t,loc:n,fetchFn:o,now:r,ttlMs:i=864e5}={}){if(t=t||(typeof document<"u"?document:null),n=n||(typeof location<"u"?location:null),o=o||(h=>fetch(h)),r=r??Date.now(),!t)return null;let s=M(t,"hyper-source");if(!s)return null;let c=M(t,"hyper-version"),l;try{l=new URL(s,n?n.href:void 0)}catch{return null}if(n&&l.origin===n.origin&&l.pathname===n.pathname)return null;let p=`${mn}${l.href}:${c||"none"}`,u,d=e?null:gn(p);if(d&&typeof d.checkedAt=="number"&&r-d.checkedAt<i)u=d.sourceVersion;else{try{let h=await o(l.href);if(!h.ok)throw new Error(`HTTP ${h.status}`);let A=await h.text(),f=new DOMParser().parseFromString(A,"text/html");u=M(f,"hyper-version")}catch{u=null}wn(p,{checkedAt:r,sourceVersion:u})}return u?{available:yn(u,c||"0.0.0"),currentVersion:c,sourceVersion:u,sourceUrl:l.href}:null}var An="script[data-rules-name]";function Tn(e){return typeof e=="string"?e.trim().replace(/\s+/g," "):""}function ae(e,t){let n=e.find(t,An,{includeRulesTag:!0}),o=new Set,r=[];for(let i of n){let s=Tn(e.attr(i,"data-rules-name"));if(!s)continue;if(o.has(s)){console.warn(`hyper-html-api: duplicate rules tag name "${s}"; using the first.`);continue}let c=e.attr(i,"data-rules-version");if(!fe.includes(c))throw new j(c);o.add(s),r.push({name:s,rules:v(e.text(i)),version:c})}return r}function de(e,t){if(t!=="2"||!e||typeof e!="object"||Array.isArray(e))return{rules:e,carried:[]};let n={},o=[];for(let[r,i]of Object.entries(e)){let s=k(i);s?o.push({key:r,selector:s.selector}):n[r]=i}return{rules:n,carried:o}}function pe(e,t,n){return e.find(t,n)[0]||null}function Ue(e,t){let n={};for(let{name:o,rules:r,version:i}of ae(e,t)){let{rules:s,carried:c}=de(r,i),l=P(e,t,s,{version:i});for(let{key:p,selector:u}of c){let d=pe(e,t,u);l[p]=d?e.prop(d,"innerHTML"):null}n[o]=l}return n}function At(e){let t=e||document,n=t.nodeType===9?t:t.ownerDocument||t;return{dataByName:Ue(N,t),version:M(n,"hyper-version")}}var te=class extends Error{constructor(t,n){super(`could not fetch upgrade source: ${t}`),this.name="UpgradeSourceUnreachable",this.sourceUrl=t,this.cause=n}},he=class extends Error{constructor(t){super(`upgrade source has no rules tags; refusing to drop all existing data: ${t}`),this.name="UpgradeSourceHasNoRules",this.sourceUrl=t}},U=class extends Error{constructor(t,n){super(t),this.name="UpgradeTransformInvalid",this.cause=n}},me=class extends Error{constructor(t){super(`found ${t} script[type="text/hyper-upgrade"] tags; only one is allowed per document.`),this.name="UpgradeMultipleTransforms",this.count=t}};var On="text/hyper-upgrade";function Tt(e,t){let n=e.find(t,`script[type="${On}"]`);if(n.length===0)return null;if(n.length>1)throw new me(n.length);return e.text(n[0])||null}var xn=new Function("url","return import(url)");async function Ot(e){let t=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(t),o;try{o=await xn(n)}catch(r){throw new U(`transform failed to load: ${r&&r.message?r.message:r}`,r)}finally{URL.revokeObjectURL(n)}if(typeof o.default!="function")throw new U("transform must `export default` a function");return o.default}function ye(e,t){let n={carriedOver:0,discarded:0,listItems:0},o=We(t,e,n);return He(t,e,n),{data:o,summary:n}}function We(e,t,n,o=!1){if(typeof e=="string")return e.endsWith("[]")?Array.isArray(t)?(n.listItems+=t.length,n.carriedOver+=t.length,t):o?[]:void 0:t==null||typeof t=="object"?o&&!En(e)?null:void 0:(n.carriedOver++,t);if(Array.isArray(e)){let[,r]=e;return Array.isArray(t)?(n.listItems+=t.length,t.map(i=>We(r,i,n,!0))):o?[]:void 0}if(typeof e=="object"&&e!==null){let r={};for(let[i,s]of Object.entries(e)){let c=We(s,t?.[i],n,o);c!==void 0&&(r[i]=c)}return r}}function En(e){let t=b(e);return t!==-1&&W.has(e.slice(t+1))}function He(e,t,n){if(t!=null){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){if(typeof t!="object"||Array.isArray(t))return;let o=new Set(Object.keys(e));for(let r of Object.keys(t))o.has(r)?He(e[r],t[r],n):n.discarded+=q(t[r]);return}if(Array.isArray(e)&&Array.isArray(t)){let o=e[1];t.forEach(r=>He(o,r,n));return}typeof e=="string"&&!e.endsWith("[]")&&typeof t=="object"&&t!==null&&(n.discarded+=q(t))}}function q(e){return e==null?0:Array.isArray(e)?e.reduce((t,n)=>t+q(n),0):typeof e=="object"?Object.values(e).reduce((t,n)=>t+q(n),0):1}function xt(e,t,n){let o=ae(e,t),r={carriedOver:0,discarded:0,listItems:0},i={},s=new Set;for(let{name:c,rules:l,version:p}of o){if(s.add(c),!Object.prototype.hasOwnProperty.call(n,c)){i[c]={carriedOver:0,discarded:0,listItems:0};continue}let{rules:u,carried:d}=de(l,p),h=n[c],{data:A,summary:f}=ye(Sn(h,d),u);D(e,t,u,A,{templateAttr:"cms-template"});for(let{key:m,selector:g}of d){let a=Et(h)?h[m]:void 0;if(a==null)continue;let y=pe(e,t,g);typeof a=="string"&&y?(e.prop(y,"innerHTML",a),f.carriedOver+=1):f.discarded+=1}i[c]=f,r.carriedOver+=f.carriedOver,r.discarded+=f.discarded,r.listItems+=f.listItems}for(let c of Object.keys(n))s.has(c)||(r.discarded+=q(n[c]));return{totals:r,byName:i,rulesTagCount:o.length}}function Et(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Sn(e,t){if(!t.length||!Et(e))return e;let n={...e};for(let{key:o}of t)delete n[o];return n}async function St({sourceUrl:e,dataByName:t,fromVersion:n,doc:o,loc:r,fetchFn:i}={}){if(o=o||(typeof document<"u"?document:null),r=r||(typeof location<"u"?location:null),i=i||(a=>fetch(a)),!o)throw new Error("upgrade.run requires a document context");if(e=e||M(o,"hyper-source"),!e)throw new Error("upgrade.run: no sourceUrl given and no hyper-source meta tag found");let s=new URL(e,r?r.href:void 0);n=n!==void 0?n:M(o,"hyper-version"),t=t||Ue(N,o);let c;try{c=await i(s.href)}catch(a){throw new te(s.href,a)}if(!c.ok)throw new te(s.href,new Error(`HTTP ${c.status}`));let l=await c.text(),p=new DOMParser().parseFromString(l,"text/html"),u=M(p,"hyper-version"),d=t,h=!1,A=Tt(N,p);if(A){let y=await(await Ot(A))(d,{fromVersion:n,toVersion:u});if(!y||typeof y!="object"||Array.isArray(y))throw new U("transform must return a plain object map of { rulesName: data }");d=y,h=!0}let{totals:f,byName:m,rulesTagCount:g}=xt(N,p,d);if(g===0&&Object.keys(d).length>0)throw new he(s.href);return{html:Rn(p),fromVersion:n,toVersion:u,summary:{transformApplied:h,totals:f,byName:m}}}function bn(e){for(let t of e.querySelectorAll("input")){let n=(t.getAttribute("type")||"").toLowerCase();n!=="file"&&(n==="checkbox"||n==="radio"?t.checked!==t.hasAttribute("checked")&&t.toggleAttribute("checked",t.checked):t.value!==(t.getAttribute("value")??"")&&t.setAttribute("value",t.value))}for(let t of e.querySelectorAll("textarea"))t.value!==t.textContent&&(t.textContent=t.value);for(let t of e.querySelectorAll("select")){let n=[...t.options];if(!t.multiple){let o=n.findIndex(r=>r.hasAttribute("selected"));if(t.selectedIndex===o||o===-1&&t.selectedIndex<=0)continue}for(let o of n)o.selected!==o.hasAttribute("selected")&&o.toggleAttribute("selected",o.selected)}}function Rn(e){return bn(e),`<!DOCTYPE ${e.doctype&&e.doctype.name?e.doctype.name:"html"}>
2
+ `+e.documentElement.outerHTML}var bt={checkForUpdate:wt,run:St,extractAll:At,shapeMatch:ye};var Cn={engine:ve,upgrade:bt},Nn=Cn;return Mt(kn);})();
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "apply",
10
10
  "CMS"
11
11
  ],
12
- "version": "0.14.0",
12
+ "version": "0.15.1",
13
13
  "homepage": "https://github.com/panphora/hyper-html-api",
14
14
  "bugs": {
15
15
  "url": "https://github.com/panphora/hyper-html-api/issues"
@@ -36,7 +36,9 @@
36
36
  "./upgrade": "./src/upgrade.js",
37
37
  "./page": "./src/page.js",
38
38
  "./write": "./src/write.js",
39
- "./site": "./src/site.js"
39
+ "./site": "./src/site.js",
40
+ "./codecs/sheet": "./src/codecs/sheet.js",
41
+ "./read": "./src/read.js"
40
42
  },
41
43
  "scripts": {
42
44
  "build": "npx esbuild src/hyper-html-api.js --bundle --minify --format=iife --global-name=HyperHtmlApi --outfile=dist/hyper-html-api.min.js && npm run build:engine && npm run build:engine:esm",
@@ -69,7 +71,7 @@
69
71
  "hyper-morph": "^1.7.0"
70
72
  },
71
73
  "devDependencies": {
72
- "@panphora/clayjs": "^1.13.1",
74
+ "@panphora/clayjs": "^1.24.0",
73
75
  "@web/test-runner": "^0.20.0",
74
76
  "@web/test-runner-playwright": "^0.11.0",
75
77
  "chai": "^4.3.6",
@@ -0,0 +1,127 @@
1
+ // The sheet codec as the engine sees it, for the rule "[items=sheets]@codec(sheet)".
2
+ // The rule selects the tabs container. Each tab is a <section item data-id> holding
3
+ // an <h2 bind="name"> and one <table grid> (sapjs/src/grid/codec/GRAMMAR.md).
4
+ //
5
+ // A read takes a table's canonical bytes from ctx.region(table) when a host cut
6
+ // them out of the source (the fast route, readDocument), and otherwise reads the
7
+ // table the HTML parser built (the tree route). Both give the same model.
8
+ //
9
+ // Query shapes (ctx.query):
10
+ // none -> [{ id, name, cols, rows, stale? }] every tab
11
+ // { shape: 'index' } -> [{ id, name, rows, cols, frozenRows }]
12
+ // { sheet } -> { id, name, cols, rows, stale? } one tab
13
+ // { sheet?, range, render? } -> { sheet, range, values } or { sheet, range, cols, rows }
14
+ // ctx.view === 'digest' -> [{ id, name, cols, rows }] for the data loss guard:
15
+ // cols names the column behind each row digest's mask bits
16
+ // `sheet` matches a tab's name first, then its id; a range with no sheet reads the first tab.
17
+
18
+ import { CodecRefused } from '../engine/errors.js'
19
+ import {
20
+ QueryRefused,
21
+ STYLE_PROPERTIES,
22
+ cutGrids,
23
+ gridModel,
24
+ readRange,
25
+ tabIndex,
26
+ tabDigest,
27
+ tabJson,
28
+ treeModel,
29
+ } from './sheet.vendor.js'
30
+
31
+ const TAGS = ['table', 'colgroup', 'col', 'thead', 'tbody', 'tfoot', 'tr', 'td', 'th', 'caption']
32
+
33
+ // The engine adapter as the codec's tree route wants it. Text is textContent,
34
+ // never the engine's trimmed text(), because a cell's text is never trimmed.
35
+ export function treeAdapter(adapter) {
36
+ return {
37
+ name: (node) => TAGS.find((tag) => adapter.matches(node, tag)) ?? '',
38
+ attr: (node, name) => adapter.attr(node, name) ?? null,
39
+ children: (node) => adapter.children(node),
40
+ text: (node) => String(adapter.prop(node, 'textContent') ?? ''),
41
+ }
42
+ }
43
+
44
+ const childMatching = (adapter, node, selector) => adapter.children(node).find((child) => adapter.matches(child, selector))
45
+
46
+ // Each tab under the container: { id, name, table } (table is null when the
47
+ // section has none). Shared by reads and by patchDocument.
48
+ export function tabNodes(adapter, node) {
49
+ const tree = treeAdapter(adapter)
50
+ return adapter.children(node)
51
+ .filter((child) => adapter.matches(child, 'section[item]'))
52
+ .map((section) => {
53
+ const heading = childMatching(adapter, section, 'h2[bind="name"]')
54
+ return {
55
+ id: adapter.attr(section, 'data-id') ?? '',
56
+ name: heading ? tree.text(heading) : '',
57
+ table: childMatching(adapter, section, 'table[grid]') ?? null,
58
+ }
59
+ })
60
+ }
61
+
62
+ function tabsOf(adapter, node, ctx) {
63
+ const tree = treeAdapter(adapter)
64
+ return tabNodes(adapter, node).map(({ id, name, table }) => {
65
+ const bytes = table && typeof ctx.region === 'function' ? ctx.region(table) : null
66
+ const sheet = bytes != null ? gridModel(bytes, 0) : table ? treeModel(tree, table) : { cols: [], rows: [] }
67
+ return { id, name, sheet }
68
+ })
69
+ }
70
+
71
+ // The tab a query or a patch names: by name first, then by id; no name means the first tab.
72
+ export function pickTab(tabs, wanted) {
73
+ if (wanted === undefined) {
74
+ if (tabs.length === 0) throw new QueryRefused('unknown_sheet', 'this document has no sheets')
75
+ return tabs[0]
76
+ }
77
+ const tab = tabs.find((t) => t.name === wanted) ?? tabs.find((t) => t.id === wanted)
78
+ if (!tab) throw new QueryRefused('unknown_sheet', `no sheet named ${JSON.stringify(wanted)}; ask for shape=index to list them`)
79
+ return tab
80
+ }
81
+
82
+ function read(adapter, node, ctx = {}) {
83
+ const tabs = tabsOf(adapter, node, ctx)
84
+ const query = ctx.query ?? {}
85
+ if (ctx.view === 'digest') return tabs.map(({ id, name, sheet }) => ({ id, name, ...tabDigest(sheet) }))
86
+ if (query.shape !== undefined && query.shape !== 'index') {
87
+ throw new QueryRefused('bad_shape', `unknown shape ${JSON.stringify(query.shape)}; the only shape is index`)
88
+ }
89
+ if (query.render !== undefined && query.range === undefined) {
90
+ throw new QueryRefused('bad_render', 'render needs a range, for example range=A1:C10&render=formulas')
91
+ }
92
+ if (query.shape === 'index') return tabs.map(({ id, name, sheet }) => ({ id, name, ...tabIndex(sheet) }))
93
+ if (query.range !== undefined) {
94
+ const tab = pickTab(tabs, query.sheet)
95
+ return { sheet: tab.name, range: query.range, ...readRange(tab.sheet, query.range, query.render ?? 'values') }
96
+ }
97
+ if (query.sheet !== undefined) {
98
+ const { id, name, sheet } = pickTab(tabs, query.sheet)
99
+ return { id, name, ...tabJson(sheet) }
100
+ }
101
+ return tabs.map(({ id, name, sheet }) => ({ id, name, ...tabJson(sheet) }))
102
+ }
103
+
104
+ export const WRITE_UNAVAILABLE_MESSAGE =
105
+ 'A sheet cannot be replaced as a whole value yet: send patch operations instead, for example [{ "sheet": "Budget", "range": "B3", "values": [[450]] }].'
106
+
107
+ // Whole replace is a follow-up with its own spec (whether a missing tab is
108
+ // deleted changes user data). Hosts answer this refusal with 409.
109
+ function write() {
110
+ throw new CodecRefused('sheet-write-unavailable', WRITE_UNAVAILABLE_MESSAGE)
111
+ }
112
+
113
+ function same(written, reread) {
114
+ return JSON.stringify(written) === JSON.stringify(reread)
115
+ }
116
+
117
+ export const sheet = {
118
+ name: 'sheet',
119
+ read,
120
+ write,
121
+ same,
122
+ styles: STYLE_PROPERTIES,
123
+ cut: cutGrids,
124
+ }
125
+
126
+ export { QueryRefused }
127
+ export * as grid from './sheet.vendor.js'