vanilla-breeze 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/custom-elements.json +13966 -11505
  2. package/dist/cdn/components/accordion-wc.js +1 -1
  3. package/dist/cdn/components/activity-feed.js +1 -1
  4. package/dist/cdn/components/ai-chat.js +9 -6
  5. package/dist/cdn/components/ai-summary.js +4 -2
  6. package/dist/cdn/components/analytics-panel.js +19 -21
  7. package/dist/cdn/components/audio-player.js +17 -7
  8. package/dist/cdn/components/audio-visualizer.js +3 -3
  9. package/dist/cdn/components/author-index.js +2 -2
  10. package/dist/cdn/components/brand-mark.js +1 -1
  11. package/dist/cdn/components/bread-crumb.js +1 -1
  12. package/dist/cdn/components/calendar-wc.js +2 -2
  13. package/dist/cdn/components/card-list.js +1 -1
  14. package/dist/cdn/components/carousel-wc.js +1 -1
  15. package/dist/cdn/components/change-set.js +1 -11
  16. package/dist/cdn/components/chart-wc.js +32 -32
  17. package/dist/cdn/components/chat-input.js +1 -1
  18. package/dist/cdn/components/chat-window.js +1 -1
  19. package/dist/cdn/components/color-picker.js +1 -1
  20. package/dist/cdn/components/combo-box.js +1 -1
  21. package/dist/cdn/components/command-palette.js +1 -1
  22. package/dist/cdn/components/comment-box.js +49 -49
  23. package/dist/cdn/components/comment-thread.js +32 -32
  24. package/dist/cdn/components/comment-wc.js +1 -1
  25. package/dist/cdn/components/compare-surface.js +1 -1
  26. package/dist/cdn/components/consent-banner.js +1 -1
  27. package/dist/cdn/components/content-lens.js +1 -1
  28. package/dist/cdn/components/content-swap.js +1 -1
  29. package/dist/cdn/components/context-menu.js +1 -1
  30. package/dist/cdn/components/data-table.js +1 -1
  31. package/dist/cdn/components/date-picker.js +1 -1
  32. package/dist/cdn/components/day-view.js +1 -1
  33. package/dist/cdn/components/diagram-wc.js +2 -2
  34. package/dist/cdn/components/drag-surface.js +1 -1
  35. package/dist/cdn/components/drop-down.js +1 -1
  36. package/dist/cdn/components/emoji-picker.js +1 -1
  37. package/dist/cdn/components/flow-diagram.js +1 -1
  38. package/dist/cdn/components/foot-notes.js +1 -1
  39. package/dist/cdn/components/form-field.js +1 -1
  40. package/dist/cdn/components/geo-map.js +4 -4
  41. package/dist/cdn/components/glossary-index.js +1 -1
  42. package/dist/cdn/components/glossary-wc.js +1 -1
  43. package/dist/cdn/components/heading-links.js +1 -1
  44. package/dist/cdn/components/highlight-wc.js +2 -2
  45. package/dist/cdn/components/image-gallery.js +1 -1
  46. package/dist/cdn/components/image-map.js +1 -1
  47. package/dist/cdn/components/include-file.js +1 -1
  48. package/dist/cdn/components/manifest.json +100 -100
  49. package/dist/cdn/components/markdown-editor.js +1 -1
  50. package/dist/cdn/components/markdown-viewer.js +11 -11
  51. package/dist/cdn/components/nav-bar.js +1 -1
  52. package/dist/cdn/components/note-wc.js +2 -2
  53. package/dist/cdn/components/notification-wc.js +4 -4
  54. package/dist/cdn/components/page-info.js +2 -2
  55. package/dist/cdn/components/page-stats.js +1 -1
  56. package/dist/cdn/components/page-toc.js +1 -1
  57. package/dist/cdn/components/page-tools.js +1 -1
  58. package/dist/cdn/components/page-tour.js +5 -5
  59. package/dist/cdn/components/pager-wc.js +1 -1
  60. package/dist/cdn/components/poll-wc.js +1 -1
  61. package/dist/cdn/components/pop-over.js +1 -1
  62. package/dist/cdn/components/popularity-index.js +4 -4
  63. package/dist/cdn/components/print-page.js +1 -1
  64. package/dist/cdn/components/progress-tracker.js +1 -1
  65. package/dist/cdn/components/qr-code.js +1 -1
  66. package/dist/cdn/components/reaction-bar.js +1 -1
  67. package/dist/cdn/components/reader-view.js +3 -3
  68. package/dist/cdn/components/reading-progress.js +1 -1
  69. package/dist/cdn/components/recently-visited.js +7 -7
  70. package/dist/cdn/components/score-card.js +2 -2
  71. package/dist/cdn/components/selection-menu.js +1 -1
  72. package/dist/cdn/components/settings-panel.js +4 -4
  73. package/dist/cdn/components/share-wc.js +2 -2
  74. package/dist/cdn/components/short-cuts.js +1 -1
  75. package/dist/cdn/components/site-index.js +6 -6
  76. package/dist/cdn/components/site-map.js +1 -1
  77. package/dist/cdn/components/site-search.js +3 -3
  78. package/dist/cdn/components/slide-accept.js +1 -1
  79. package/dist/cdn/components/social-embed.js +1 -1
  80. package/dist/cdn/components/split-surface.js +1 -1
  81. package/dist/cdn/components/star-rating.js +1 -1
  82. package/dist/cdn/components/status-wc.js +1 -1
  83. package/dist/cdn/components/stepper-wc.js +1 -1
  84. package/dist/cdn/components/tab-set.js +1 -1
  85. package/dist/cdn/components/text-reader.js +2 -2
  86. package/dist/cdn/components/theme-picker.js +44 -44
  87. package/dist/cdn/components/time-index.js +2 -2
  88. package/dist/cdn/components/time-picker.js +1 -1
  89. package/dist/cdn/components/toast-msg.js +1 -1
  90. package/dist/cdn/components/tool-tip.js +1 -1
  91. package/dist/cdn/components/topic-map.js +3 -3
  92. package/dist/cdn/components/trust-filter.js +3 -3
  93. package/dist/cdn/components/version-switcher.js +3 -13
  94. package/dist/cdn/components/video-player.js +1 -1
  95. package/dist/cdn/components/watch-wc.js +2 -2
  96. package/dist/cdn/components/week-view.js +1 -1
  97. package/dist/cdn/components/youtube-player.js +1 -1
  98. package/dist/cdn/packs/effects.full.js +1 -1
  99. package/dist/cdn/packs/kawaii.effects.css +1 -1
  100. package/dist/cdn/packs/kawaii.full.css +1 -1
  101. package/dist/cdn/packs/kawaii.full.js +4 -4
  102. package/dist/cdn/packs/manifest.json +7 -7
  103. package/dist/cdn/packs/memphis.full.css +1 -1
  104. package/dist/cdn/packs/memphis.theme.css +1 -1
  105. package/dist/cdn/packs/ui.full.js +46 -46
  106. package/dist/cdn/themes/8bit.css +1 -1
  107. package/dist/cdn/themes/8bit.tokens.json +1 -1
  108. package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
  109. package/dist/cdn/themes/alpha1999.tokens.json +1 -1
  110. package/dist/cdn/themes/art-deco-dark.tokens.json +33 -1
  111. package/dist/cdn/themes/art-deco.css +1 -1
  112. package/dist/cdn/themes/art-deco.tokens.json +23 -1
  113. package/dist/cdn/themes/bauhaus-dark.tokens.json +23 -1
  114. package/dist/cdn/themes/bauhaus.css +1 -1
  115. package/dist/cdn/themes/bauhaus.tokens.json +1 -1
  116. package/dist/cdn/themes/brutalist-dark.tokens.json +33 -1
  117. package/dist/cdn/themes/brutalist.css +1 -1
  118. package/dist/cdn/themes/brutalist.tokens.json +23 -1
  119. package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
  120. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
  121. package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
  122. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
  123. package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
  124. package/dist/cdn/themes/classic-dark.tokens.json +1 -1
  125. package/dist/cdn/themes/classic.tokens.json +1 -1
  126. package/dist/cdn/themes/claymorphism-dark.tokens.json +33 -1
  127. package/dist/cdn/themes/claymorphism.css +1 -1
  128. package/dist/cdn/themes/claymorphism.tokens.json +23 -1
  129. package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
  130. package/dist/cdn/themes/clinical.tokens.json +1 -1
  131. package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
  132. package/dist/cdn/themes/cottagecore.css +1 -1
  133. package/dist/cdn/themes/cottagecore.tokens.json +1 -1
  134. package/dist/cdn/themes/cyber.css +1 -1
  135. package/dist/cdn/themes/cyber.tokens.json +1 -1
  136. package/dist/cdn/themes/dawn-dark.tokens.json +33 -1
  137. package/dist/cdn/themes/dawn.css +1 -1
  138. package/dist/cdn/themes/dawn.tokens.json +23 -1
  139. package/dist/cdn/themes/dracula.tokens.json +1 -1
  140. package/dist/cdn/themes/dusk.css +1 -1
  141. package/dist/cdn/themes/dusk.tokens.json +1 -1
  142. package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
  143. package/dist/cdn/themes/editorial.css +1 -1
  144. package/dist/cdn/themes/editorial.tokens.json +1 -1
  145. package/dist/cdn/themes/financial-dark.tokens.json +1 -1
  146. package/dist/cdn/themes/financial.tokens.json +1 -1
  147. package/dist/cdn/themes/genai.css +1 -1
  148. package/dist/cdn/themes/genai.tokens.json +1 -1
  149. package/dist/cdn/themes/glassmorphism-dark.tokens.json +1 -1
  150. package/dist/cdn/themes/glassmorphism.tokens.json +1 -1
  151. package/dist/cdn/themes/government-dark.tokens.json +1 -1
  152. package/dist/cdn/themes/government.tokens.json +1 -1
  153. package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
  154. package/dist/cdn/themes/gruvbox.tokens.json +1 -1
  155. package/dist/cdn/themes/high-noon-dark.tokens.json +23 -1
  156. package/dist/cdn/themes/high-noon.css +1 -1
  157. package/dist/cdn/themes/high-noon.tokens.json +1 -1
  158. package/dist/cdn/themes/journal-dark.tokens.json +33 -1
  159. package/dist/cdn/themes/journal.css +1 -1
  160. package/dist/cdn/themes/journal.tokens.json +23 -1
  161. package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
  162. package/dist/cdn/themes/kawaii.css +1 -1
  163. package/dist/cdn/themes/kawaii.tokens.json +1 -1
  164. package/dist/cdn/themes/magna-dark.tokens.json +1 -1
  165. package/dist/cdn/themes/magna.tokens.json +1 -1
  166. package/dist/cdn/themes/manifest.json +26 -50
  167. package/dist/cdn/themes/midnight.tokens.json +1 -1
  168. package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
  169. package/dist/cdn/themes/minimal.tokens.json +1 -1
  170. package/dist/cdn/themes/modern-dark.tokens.json +1 -1
  171. package/dist/cdn/themes/modern.tokens.json +1 -1
  172. package/dist/cdn/themes/nes-dark.tokens.json +1 -1
  173. package/dist/cdn/themes/nes.css +1 -1
  174. package/dist/cdn/themes/nes.tokens.json +1 -1
  175. package/dist/cdn/themes/neumorphism-dark.tokens.json +1 -1
  176. package/dist/cdn/themes/neumorphism.css +1 -1
  177. package/dist/cdn/themes/neumorphism.tokens.json +1 -1
  178. package/dist/cdn/themes/nord-dark.tokens.json +33 -1
  179. package/dist/cdn/themes/nord.css +1 -1
  180. package/dist/cdn/themes/nord.tokens.json +23 -1
  181. package/dist/cdn/themes/organic-dark.tokens.json +1 -1
  182. package/dist/cdn/themes/organic.css +1 -1
  183. package/dist/cdn/themes/organic.tokens.json +1 -1
  184. package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
  185. package/dist/cdn/themes/rose-pine.tokens.json +1 -1
  186. package/dist/cdn/themes/rough-dark.tokens.json +1 -1
  187. package/dist/cdn/themes/rough.css +1 -1
  188. package/dist/cdn/themes/rough.tokens.json +1 -1
  189. package/dist/cdn/themes/solarized-dark.tokens.json +23 -1
  190. package/dist/cdn/themes/solarized.css +1 -1
  191. package/dist/cdn/themes/solarized.tokens.json +23 -1
  192. package/dist/cdn/themes/startup-dark.tokens.json +1 -1
  193. package/dist/cdn/themes/startup.tokens.json +1 -1
  194. package/dist/cdn/themes/super2026-dark.tokens.json +33 -1
  195. package/dist/cdn/themes/super2026.css +1 -1
  196. package/dist/cdn/themes/super2026.tokens.json +23 -1
  197. package/dist/cdn/themes/swiss-dark.tokens.json +1 -1
  198. package/dist/cdn/themes/swiss.css +1 -1
  199. package/dist/cdn/themes/swiss.tokens.json +1 -1
  200. package/dist/cdn/themes/terminal.css +1 -1
  201. package/dist/cdn/themes/terminal.tokens.json +1 -1
  202. package/dist/cdn/themes/tokyo-night-dark.tokens.json +33 -1
  203. package/dist/cdn/themes/tokyo-night.css +1 -1
  204. package/dist/cdn/themes/tokyo-night.tokens.json +23 -1
  205. package/dist/cdn/themes/vaporwave-dark.tokens.json +33 -1
  206. package/dist/cdn/themes/vaporwave.css +1 -1
  207. package/dist/cdn/themes/vaporwave.tokens.json +23 -1
  208. package/dist/cdn/themes/win9x-dark.tokens.json +15 -4
  209. package/dist/cdn/themes/win9x.css +1 -1
  210. package/dist/cdn/themes/win9x.tokens.json +1 -1
  211. package/dist/cdn/vanilla-breeze-autoload.js +663 -0
  212. package/dist/cdn/vanilla-breeze-charts.css +1 -1
  213. package/dist/cdn/vanilla-breeze-charts.js +32 -32
  214. package/dist/cdn/vanilla-breeze-core.css +1 -1
  215. package/dist/cdn/vanilla-breeze-core.js +78 -80
  216. package/dist/cdn/vanilla-breeze-dev.css +1 -1
  217. package/dist/cdn/vanilla-breeze-extras.js +47 -37
  218. package/dist/cdn/vanilla-breeze.css +1 -1
  219. package/dist/cdn/vanilla-breeze.js +180 -177
  220. package/package.json +12 -7
  221. package/dist/cdn/themes/amber.css +0 -2
  222. package/dist/cdn/themes/anthropic.css +0 -2
  223. package/dist/cdn/themes/anthropic.tokens.json +0 -564
  224. package/dist/cdn/themes/coral.css +0 -2
  225. package/dist/cdn/themes/emerald.css +0 -2
  226. package/dist/cdn/themes/forest.css +0 -2
  227. package/dist/cdn/themes/ibm.css +0 -2
  228. package/dist/cdn/themes/ibm.tokens.json +0 -568
  229. package/dist/cdn/themes/indigo.css +0 -2
  230. package/dist/cdn/themes/lavender.css +0 -2
  231. package/dist/cdn/themes/mcdonalds.css +0 -2
  232. package/dist/cdn/themes/mcdonalds.tokens.json +0 -533
  233. package/dist/cdn/themes/ocean.css +0 -2
  234. package/dist/cdn/themes/rose.css +0 -2
  235. package/dist/cdn/themes/slate.css +0 -2
  236. package/dist/cdn/themes/starbucks.css +0 -2
  237. package/dist/cdn/themes/starbucks.tokens.json +0 -593
  238. package/dist/cdn/themes/sunset.css +0 -2
@@ -1,8 +1,8 @@
1
- var ot=window.matchMedia("(prefers-reduced-motion: reduce)");var te=new Map;function re(n,e,r={}){let s=r.priority??10,t={impl:e,bundle:r.bundle,contract:r.contract,priority:s},i=te.get(n);if(customElements.get(n)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}te.set(n,t),customElements.define(n,e)}var C=class extends HTMLElement{#r=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#r)e();this.#r=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,r,s,t){e.addEventListener(r,s,t),this.#r.push(()=>e.removeEventListener(r,s,t))}setup(){}teardown(){}setState(e,r){this.#e||(this.#e=this.attachInternals());let s=this.#e.states;try{r?s.add(e):s.delete(e)}catch{let t=`--${e}`;r?s.add(t):s.delete(t)}}_adoptInternals(e){this.#e||(this.#e=e)}};function Q(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var R=Q();function ce(n){R=n}var $={exec:()=>null};function p(n,e=""){let r=typeof n=="string"?n:n.source,s={replace:(t,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(b.caret,"$1"),r=r.replace(t,l),s},getRegex:()=>new RegExp(r,e)};return s}var ye=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),b={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},$e=/^(?:[ \t]*(?:\n|$))+/,Se=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Re=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,P=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Te=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,H=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,he=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,pe=p(he).replace(/bull/g,H).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ae=p(he).replace(/bull/g,H).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),j=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ze=/^[^\n]+/,F=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ve=p(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",F).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ee=p(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,H).getRegex(),B="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",G=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Pe=p("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",G).replace("tag",B).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ue=p(j).replace("hr",P).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex(),Ce=p(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ue).getRegex(),X={blockquote:Ce,code:Se,def:ve,fences:Re,heading:Te,hr:P,html:Pe,lheading:pe,list:Ee,newline:$e,paragraph:ue,table:$,text:ze},ne=p("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",P).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex(),_e={...X,lheading:Ae,table:ne,paragraph:p(j).replace("hr",P).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ne).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex()},Le={...X,html:p(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",G).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:$,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:p(j).replace("hr",P).replace("heading",` *#{1,6} *[^
2
- ]`).replace("lheading",pe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ie=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,qe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,de=/^( {2,}|\\)\n(?!\s*$)/,Be=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,M=/[\s\p{P}\p{S}]/u,W=/[^\s\p{P}\p{S}]/u,Me=p(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,M).getRegex(),ge=/(?!~)[\p{P}\p{S}]/u,De=/(?!~)[\s\p{P}\p{S}]/u,Ze=/(?:[^\s\p{P}\p{S}]|~)/u,Ne=p(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ye?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ke=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Oe=p(ke,"u").replace(/punct/g,T).getRegex(),Qe=p(ke,"u").replace(/punct/g,ge).getRegex(),fe="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",He=p(fe,"gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,M).replace(/punct/g,T).getRegex(),je=p(fe,"gu").replace(/notPunctSpace/g,Ze).replace(/punctSpace/g,De).replace(/punct/g,ge).getRegex(),Fe=p("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,M).replace(/punct/g,T).getRegex(),Ge=p(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),Xe="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",We=p(Xe,"gu").replace(/notPunctSpace/g,W).replace(/punctSpace/g,M).replace(/punct/g,T).getRegex(),Ue=p(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),Je=p(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ke=p(G).replace("(?:-->|$)","-->").getRegex(),Ve=p("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Ke).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),L=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ye=p(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",L).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),be=p(/^!?\[(label)\]\[(ref)\]/).replace("label",L).replace("ref",F).getRegex(),xe=p(/^!?\[(ref)\](?:\[\])?/).replace("ref",F).getRegex(),et=p("reflink|nolink(?!\\()","g").replace("reflink",be).replace("nolink",xe).getRegex(),se=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,U={_backpedal:$,anyPunctuation:Ue,autolink:Je,blockSkip:Ne,br:de,code:qe,del:$,delLDelim:$,delRDelim:$,emStrongLDelim:Oe,emStrongRDelimAst:He,emStrongRDelimUnd:Fe,escape:Ie,link:Ye,nolink:xe,punctuation:Me,reflink:be,reflinkSearch:et,tag:Ve,text:Be,url:$},tt={...U,link:p(/^!?\[(label)\]\((.*?)\)/).replace("label",L).getRegex(),reflink:p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",L).getRegex()},Z={...U,emStrongRDelimAst:je,emStrongLDelim:Qe,delLDelim:Ge,delRDelim:We,url:p(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",se).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:p(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",se).getRegex()},rt={...Z,br:p(de).replace("{2,}","*").getRegex(),text:p(Z.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_={normal:X,gfm:_e,pedantic:Le},z={normal:U,gfm:Z,breaks:rt,pedantic:tt},nt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ie=n=>nt[n];function w(n,e){if(e){if(b.escapeTest.test(n))return n.replace(b.escapeReplace,ie)}else if(b.escapeTestNoEncode.test(n))return n.replace(b.escapeReplaceNoEncode,ie);return n}function le(n){try{n=encodeURI(n).replace(b.percentDecode,"%")}catch{return null}return n}function ae(n,e){let r=n.replace(b.findPipe,(i,l,o)=>{let a=!1,h=l;for(;--h>=0&&o[h]==="\\";)a=!a;return a?"|":" |"}),s=r.split(b.splitPipe),t=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;t<s.length;t++)s[t]=s[t].trim().replace(b.slashPipe,"|");return s}function v(n,e,r){let s=n.length;if(s===0)return"";let t=0;for(;t<s;){let i=n.charAt(s-t-1);if(i===e&&!r)t++;else if(i!==e&&r)t++;else break}return n.slice(0,s-t)}function st(n,e){if(n.indexOf(e[1])===-1)return-1;let r=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])r++;else if(n[s]===e[1]&&(r--,r<0))return s;return r>0?-2:-1}function it(n,e=0){let r=e,s="";for(let t of n)if(t===" "){let i=4-r%4;s+=" ".repeat(i),r+=i}else s+=t,r++;return s}function oe(n,e,r,s,t){let i=e.href,l=e.title||null,o=n[1].replace(t.other.outputLinkReplace,"$1");s.state.inLink=!0;let a={type:n[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:l,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,a}function lt(n,e,r){let s=n.match(r.other.indentCodeCompensation);if(s===null)return e;let t=s[1];return e.split(`
1
+ var ct=window.matchMedia("(prefers-reduced-motion: reduce)");var te=new Map;function re(n,e,r={}){let s=r.priority??10,t={impl:e,bundle:r.bundle,contract:r.contract,priority:s},i=te.get(n);if(customElements.get(n)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}te.set(n,t),customElements.define(n,e)}var L=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,r,s,t){e.addEventListener(r,s,t),this.#e.push(()=>e.removeEventListener(r,s,t))}_reinit(){for(let e of this.#e)e();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,r){this.#t||(this.#t=this.attachInternals());let s=this.#t.states;try{r?s.add(e):s.delete(e)}catch{let t=`--${e}`;r?s.add(t):s.delete(t)}}_adoptInternals(e){this.#t||(this.#t=e)}};function O(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var R=O();function ce(n){R=n}var $={exec:()=>null};function p(n,e=""){let r=typeof n=="string"?n:n.source,s={replace:(t,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(b.caret,"$1"),r=r.replace(t,l),s},getRegex:()=>new RegExp(r,e)};return s}var $e=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),b={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},Se=/^(?:[ \t]*(?:\n|$))+/,Re=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Te=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,C=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ae=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Q=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,he=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,pe=p(he).replace(/bull/g,Q).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ze=p(he).replace(/bull/g,Q).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),j=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ve=/^[^\n]+/,F=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ee=p(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",F).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ce=p(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Q).getRegex(),B="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",G=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Le=p("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",G).replace("tag",B).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ue=p(j).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex(),Pe=p(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ue).getRegex(),W={blockquote:Pe,code:Re,def:Ee,fences:Te,heading:Ae,hr:C,html:Le,lheading:pe,list:Ce,newline:Se,paragraph:ue,table:$,text:ve},ne=p("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex(),_e={...W,lheading:ze,table:ne,paragraph:p(j).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ne).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",B).getRegex()},qe={...W,html:p(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",G).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:$,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:p(j).replace("hr",C).replace("heading",` *#{1,6} *[^
2
+ ]`).replace("lheading",pe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ie=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Be=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,de=/^( {2,}|\\)\n(?!\s*$)/,Me=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,M=/[\s\p{P}\p{S}]/u,X=/[^\s\p{P}\p{S}]/u,De=p(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,M).getRegex(),ge=/(?!~)[\p{P}\p{S}]/u,Ze=/(?!~)[\s\p{P}\p{S}]/u,Ne=/(?:[^\s\p{P}\p{S}]|~)/u,He=p(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",$e?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ke=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Oe=p(ke,"u").replace(/punct/g,T).getRegex(),Qe=p(ke,"u").replace(/punct/g,ge).getRegex(),fe="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",je=p(fe,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,M).replace(/punct/g,T).getRegex(),Fe=p(fe,"gu").replace(/notPunctSpace/g,Ne).replace(/punctSpace/g,Ze).replace(/punct/g,ge).getRegex(),Ge=p("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,M).replace(/punct/g,T).getRegex(),We=p(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),Xe="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Ue=p(Xe,"gu").replace(/notPunctSpace/g,X).replace(/punctSpace/g,M).replace(/punct/g,T).getRegex(),Je=p(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),Ke=p(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ve=p(G).replace("(?:-->|$)","-->").getRegex(),Ye=p("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Ve).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,et=p(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",_).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),be=p(/^!?\[(label)\]\[(ref)\]/).replace("label",_).replace("ref",F).getRegex(),xe=p(/^!?\[(ref)\](?:\[\])?/).replace("ref",F).getRegex(),tt=p("reflink|nolink(?!\\()","g").replace("reflink",be).replace("nolink",xe).getRegex(),se=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,U={_backpedal:$,anyPunctuation:Je,autolink:Ke,blockSkip:He,br:de,code:Be,del:$,delLDelim:$,delRDelim:$,emStrongLDelim:Oe,emStrongRDelimAst:je,emStrongRDelimUnd:Ge,escape:Ie,link:et,nolink:xe,punctuation:De,reflink:be,reflinkSearch:tt,tag:Ye,text:Me,url:$},rt={...U,link:p(/^!?\[(label)\]\((.*?)\)/).replace("label",_).getRegex(),reflink:p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_).getRegex()},Z={...U,emStrongRDelimAst:Fe,emStrongLDelim:Qe,delLDelim:We,delRDelim:Ue,url:p(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",se).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:p(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",se).getRegex()},nt={...Z,br:p(de).replace("{2,}","*").getRegex(),text:p(Z.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},P={normal:W,gfm:_e,pedantic:qe},z={normal:U,gfm:Z,breaks:nt,pedantic:rt},st={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ie=n=>st[n];function w(n,e){if(e){if(b.escapeTest.test(n))return n.replace(b.escapeReplace,ie)}else if(b.escapeTestNoEncode.test(n))return n.replace(b.escapeReplaceNoEncode,ie);return n}function le(n){try{n=encodeURI(n).replace(b.percentDecode,"%")}catch{return null}return n}function ae(n,e){let r=n.replace(b.findPipe,(i,l,o)=>{let a=!1,h=l;for(;--h>=0&&o[h]==="\\";)a=!a;return a?"|":" |"}),s=r.split(b.splitPipe),t=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;t<s.length;t++)s[t]=s[t].trim().replace(b.slashPipe,"|");return s}function v(n,e,r){let s=n.length;if(s===0)return"";let t=0;for(;t<s;){let i=n.charAt(s-t-1);if(i===e&&!r)t++;else if(i!==e&&r)t++;else break}return n.slice(0,s-t)}function it(n,e){if(n.indexOf(e[1])===-1)return-1;let r=0;for(let s=0;s<n.length;s++)if(n[s]==="\\")s++;else if(n[s]===e[0])r++;else if(n[s]===e[1]&&(r--,r<0))return s;return r>0?-2:-1}function lt(n,e=0){let r=e,s="";for(let t of n)if(t===" "){let i=4-r%4;s+=" ".repeat(i),r+=i}else s+=t,r++;return s}function oe(n,e,r,s,t){let i=e.href,l=e.title||null,o=n[1].replace(t.other.outputLinkReplace,"$1");s.state.inLink=!0;let a={type:n[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:l,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,a}function at(n,e,r){let s=n.match(r.other.indentCodeCompensation);if(s===null)return e;let t=s[1];return e.split(`
3
3
  `).map(i=>{let l=i.match(r.other.beginningSpace);if(l===null)return i;let[o]=l;return o.length>=t.length?i.slice(t.length):i}).join(`
4
- `)}var I=class{options;rules;lexer;constructor(n){this.options=n||R}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:v(r,`
5
- `)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let r=e[0],s=lt(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let s=v(r,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(r=s.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:v(e[0],`
4
+ `)}var q=class{options;rules;lexer;constructor(n){this.options=n||R}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:v(r,`
5
+ `)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let r=e[0],s=at(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let s=v(r,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(r=s.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:v(e[0],`
6
6
  `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let r=v(e[0],`
7
7
  `).split(`
8
8
  `),s="",t="",i=[];for(;r.length>0;){let l=!1,o=[],a;for(a=0;a<r.length;a++)if(this.rules.other.blockquoteStart.test(r[a]))o.push(r[a]),l=!0;else if(!l)o.push(r[a]);else break;r=r.slice(a);let h=o.join(`
@@ -14,16 +14,16 @@ ${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
14
14
  `),y=this.blockquote(k);i[i.length-1]=y,s=s.substring(0,s.length-f.raw.length)+y.raw,t=t.substring(0,t.length-f.text.length)+y.text;break}else if(u?.type==="list"){let f=u,k=f.raw+`
15
15
  `+r.join(`
16
16
  `),y=this.list(k);i[i.length-1]=y,s=s.substring(0,s.length-u.raw.length)+y.raw,t=t.substring(0,t.length-f.raw.length)+y.raw,r=k.substring(i.at(-1).raw.length).split(`
17
- `);continue}}return{type:"blockquote",raw:s,tokens:i,text:t}}}list(n){let e=this.rules.block.list.exec(n);if(e){let r=e[1].trim(),s=r.length>1,t={type:"list",raw:"",ordered:s,start:s?+r.slice(0,-1):"",loose:!1,items:[]};r=s?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=s?r:"[*+-]");let i=this.rules.other.listItemRegex(r),l=!1;for(;n;){let a=!1,h="",c="";if(!(e=i.exec(n))||this.rules.block.hr.test(n))break;h=e[0],n=n.substring(h.length);let d=it(e[2].split(`
17
+ `);continue}}return{type:"blockquote",raw:s,tokens:i,text:t}}}list(n){let e=this.rules.block.list.exec(n);if(e){let r=e[1].trim(),s=r.length>1,t={type:"list",raw:"",ordered:s,start:s?+r.slice(0,-1):"",loose:!1,items:[]};r=s?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=s?r:"[*+-]");let i=this.rules.other.listItemRegex(r),l=!1;for(;n;){let a=!1,h="",c="";if(!(e=i.exec(n))||this.rules.block.hr.test(n))break;h=e[0],n=n.substring(h.length);let d=lt(e[2].split(`
18
18
  `,1)[0],e[1].length),u=n.split(`
19
19
  `,1)[0],f=!d.trim(),k=0;if(this.options.pedantic?(k=2,c=d.trimStart()):f?k=e[1].length+1:(k=d.search(this.rules.other.nonSpaceChar),k=k>4?1:k,c=d.slice(k),k+=e[1].length),f&&this.rules.other.blankLine.test(u)&&(h+=u+`
20
- `,n=n.substring(u.length+1),a=!0),!a){let y=this.rules.other.nextBulletRegex(k),V=this.rules.other.hrRegex(k),Y=this.rules.other.fencesBeginRegex(k),ee=this.rules.other.headingBeginRegex(k),me=this.rules.other.htmlBeginRegex(k),we=this.rules.other.blockquoteBeginRegex(k);for(;n;){let D=n.split(`
21
- `,1)[0],A;if(u=D,this.options.pedantic?(u=u.replace(this.rules.other.listReplaceNesting," "),A=u):A=u.replace(this.rules.other.tabCharGlobal," "),Y.test(u)||ee.test(u)||me.test(u)||we.test(u)||y.test(u)||V.test(u))break;if(A.search(this.rules.other.nonSpaceChar)>=k||!u.trim())c+=`
20
+ `,n=n.substring(u.length+1),a=!0),!a){let y=this.rules.other.nextBulletRegex(k),V=this.rules.other.hrRegex(k),Y=this.rules.other.fencesBeginRegex(k),ee=this.rules.other.headingBeginRegex(k),we=this.rules.other.htmlBeginRegex(k),ye=this.rules.other.blockquoteBeginRegex(k);for(;n;){let D=n.split(`
21
+ `,1)[0],A;if(u=D,this.options.pedantic?(u=u.replace(this.rules.other.listReplaceNesting," "),A=u):A=u.replace(this.rules.other.tabCharGlobal," "),Y.test(u)||ee.test(u)||we.test(u)||ye.test(u)||y.test(u)||V.test(u))break;if(A.search(this.rules.other.nonSpaceChar)>=k||!u.trim())c+=`
22
22
  `+A.slice(k);else{if(f||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Y.test(d)||ee.test(d)||V.test(d))break;c+=`
23
23
  `+u}f=!u.trim(),h+=D+`
24
24
  `,n=n.substring(D.length+1),d=A.slice(k)}}t.loose||(l?t.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(l=!0)),t.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),t.raw+=h}let o=t.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;t.raw=t.raw.trimEnd();for(let a of t.items){if(this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]),a.task){if(a.text=a.text.replace(this.rules.other.listReplaceTask,""),a.tokens[0]?.type==="text"||a.tokens[0]?.type==="paragraph"){a.tokens[0].raw=a.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),a.tokens[0].text=a.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let c=this.lexer.inlineQueue.length-1;c>=0;c--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[c].src)){this.lexer.inlineQueue[c].src=this.lexer.inlineQueue[c].src.replace(this.rules.other.listReplaceTask,"");break}}let h=this.rules.other.listTaskCheckbox.exec(a.raw);if(h){let c={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};a.checked=c.checked,t.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=c.raw+a.tokens[0].raw,a.tokens[0].text=c.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(c)):a.tokens.unshift({type:"paragraph",raw:c.raw,text:c.raw,tokens:[c]}):a.tokens.unshift(c)}}if(!t.loose){let h=a.tokens.filter(d=>d.type==="space"),c=h.length>0&&h.some(d=>this.rules.other.anyLine.test(d.raw));t.loose=c}}if(t.loose)for(let a of t.items){a.loose=!0;for(let h of a.tokens)h.type==="text"&&(h.type="paragraph")}return t}}html(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",t=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:s,title:t}}}table(n){let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=ae(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),t=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
25
25
  `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===s.length){for(let l of s)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<r.length;l++)i.header.push({text:r[l],tokens:this.lexer.inline(r[l]),header:!0,align:i.align[l]});for(let l of t)i.rows.push(ae(l,i.header.length).map((o,a)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:i.align[a]})));return i}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let r=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let r=e[1].charAt(e[1].length-1)===`
26
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let i=v(r.slice(0,-1),"\\");if((r.length-i.length)%2===0)return}else{let i=st(e[2],"()");if(i===-2)return;if(i>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let s=e[2],t="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],t=i[3])}else t=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?s=s.slice(1):s=s.slice(1,-1)),oe(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:t&&t.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let r;if((r=this.rules.inline.reflink.exec(n))||(r=this.rules.inline.nolink.exec(n))){let s=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),t=e[s.toLowerCase()];if(!t){let i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return oe(r,t,r[0],this.lexer,this.rules)}}emStrong(n,e,r=""){let s=this.rules.inline.emStrongLDelim.exec(n);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!r||this.rules.inline.punctuation.exec(r))){let t=[...s[0]].length-1,i,l,o=t,a=0,h=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*n.length+t);(s=h.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(l=[...i].length,s[3]||s[4]){o+=l;continue}else if((s[5]||s[6])&&t%3&&!((t+l)%3)){a+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o+a);let c=[...s[0]][0].length,d=n.slice(0,t+s.index+c+l);if(Math.min(t,l)%2){let f=d.slice(1,-1);return{type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}let u=d.slice(2,-2);return{type:"strong",raw:d,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(r),t=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&t&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,r=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!r||this.rules.inline.punctuation.exec(r))){let t=[...s[0]].length-1,i,l,o=t,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*n.length+t);(s=a.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(l=[...i].length,l!==t))continue;if(s[3]||s[4]){o+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o);let h=[...s[0]][0].length,c=n.slice(0,t+s.index+h+l),d=c.slice(t,-t);return{type:"del",raw:c,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let r,s;return e[2]==="@"?(r=e[1],s="mailto:"+r):(r=e[1],s=r),{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let t;do t=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(t!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},x=class N{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||R,this.options.tokenizer=this.options.tokenizer||new I,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:b,block:_.normal,inline:z.normal};this.options.pedantic?(r.block=_.pedantic,r.inline=z.pedantic):this.options.gfm&&(r.block=_.gfm,this.options.breaks?r.inline=z.breaks:r.inline=z.gfm),this.tokenizer.rules=r}static get rules(){return{block:_,inline:z}}static lex(e,r){return new N(r).lex(e)}static lexInline(e,r){return new N(r).inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
26
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let i=v(r.slice(0,-1),"\\");if((r.length-i.length)%2===0)return}else{let i=it(e[2],"()");if(i===-2)return;if(i>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let s=e[2],t="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],t=i[3])}else t=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?s=s.slice(1):s=s.slice(1,-1)),oe(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:t&&t.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let r;if((r=this.rules.inline.reflink.exec(n))||(r=this.rules.inline.nolink.exec(n))){let s=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),t=e[s.toLowerCase()];if(!t){let i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return oe(r,t,r[0],this.lexer,this.rules)}}emStrong(n,e,r=""){let s=this.rules.inline.emStrongLDelim.exec(n);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!r||this.rules.inline.punctuation.exec(r))){let t=[...s[0]].length-1,i,l,o=t,a=0,h=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*n.length+t);(s=h.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(l=[...i].length,s[3]||s[4]){o+=l;continue}else if((s[5]||s[6])&&t%3&&!((t+l)%3)){a+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o+a);let c=[...s[0]][0].length,d=n.slice(0,t+s.index+c+l);if(Math.min(t,l)%2){let f=d.slice(1,-1);return{type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}let u=d.slice(2,-2);return{type:"strong",raw:d,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(r),t=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&t&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,r=""){let s=this.rules.inline.delLDelim.exec(n);if(s&&(!s[1]||!r||this.rules.inline.punctuation.exec(r))){let t=[...s[0]].length-1,i,l,o=t,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*n.length+t);(s=a.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(l=[...i].length,l!==t))continue;if(s[3]||s[4]){o+=l;continue}if(o-=l,o>0)continue;l=Math.min(l,l+o);let h=[...s[0]][0].length,c=n.slice(0,t+s.index+h+l),d=c.slice(t,-t);return{type:"del",raw:c,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let r,s;return e[2]==="@"?(r=e[1],s="mailto:"+r):(r=e[1],s=r),{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(n){let e;if(e=this.rules.inline.url.exec(n)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let t;do t=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(t!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},x=class N{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||R,this.options.tokenizer=this.options.tokenizer||new q,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:b,block:P.normal,inline:z.normal};this.options.pedantic?(r.block=P.pedantic,r.inline=z.pedantic):this.options.gfm&&(r.block=P.gfm,this.options.breaks?r.inline=z.breaks:r.inline=z.gfm),this.tokenizer.rules=r}static get rules(){return{block:P,inline:z}}static lex(e,r){return new N(r).lex(e)}static lexInline(e,r){return new N(r).inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
27
27
  `),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let s=this.inlineQueue[r];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],s=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(b.tabCharGlobal," ").replace(b.spaceLine,""));e;){let t;if(this.options.extensions?.block?.some(l=>(t=l.call({lexer:this},e,r))?(e=e.substring(t.raw.length),r.push(t),!0):!1))continue;if(t=this.tokenizer.space(e)){e=e.substring(t.raw.length);let l=r.at(-1);t.raw.length===1&&l!==void 0?l.raw+=`
28
28
  `:r.push(t);continue}if(t=this.tokenizer.code(e)){e=e.substring(t.raw.length);let l=r.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
29
29
  `)?"":`
@@ -37,7 +37,7 @@ ${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
37
37
  `+t.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):r.push(t),s=i.length!==e.length,e=e.substring(t.raw.length);continue}if(t=this.tokenizer.text(e)){e=e.substring(t.raw.length);let l=r.at(-1);l?.type==="text"?(l.raw+=(l.raw.endsWith(`
38
38
  `)?"":`
39
39
  `)+t.raw,l.text+=`
40
- `+t.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):r.push(t);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){this.tokenizer.lexer=this;let s=e,t=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(t=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)a.includes(t[0].slice(t[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,t.index)+"["+"a".repeat(t[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(t=this.tokenizer.rules.inline.anyPunctuation.exec(s))!==null;)s=s.slice(0,t.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(t=this.tokenizer.rules.inline.blockSkip.exec(s))!==null;)i=t[2]?t[2].length:0,s=s.slice(0,t.index+i)+"["+"a".repeat(t[0].length-i-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let l=!1,o="";for(;e;){l||(o=""),l=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=r.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):r.push(a);continue}if(a=this.tokenizer.emStrong(e,s,o)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.del(e,s,o)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),r.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),r.push(a);continue}let h=e;if(this.options.extensions?.startInline){let c=1/0,d=e.slice(1),u;this.options.extensions.startInline.forEach(f=>{u=f.call({lexer:this},d),typeof u=="number"&&u>=0&&(c=Math.min(c,u))}),c<1/0&&c>=0&&(h=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(h)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),l=!0;let c=r.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):r.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return r}},q=class{options;parser;constructor(n){this.options=n||R}space(n){return""}code({text:n,lang:e,escaped:r}){let s=(e||"").match(b.notSpaceStart)?.[0],t=n.replace(b.endingNewline,"")+`
40
+ `+t.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):r.push(t);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){this.tokenizer.lexer=this;let s=e,t=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(t=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)a.includes(t[0].slice(t[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,t.index)+"["+"a".repeat(t[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(t=this.tokenizer.rules.inline.anyPunctuation.exec(s))!==null;)s=s.slice(0,t.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(t=this.tokenizer.rules.inline.blockSkip.exec(s))!==null;)i=t[2]?t[2].length:0,s=s.slice(0,t.index+i)+"["+"a".repeat(t[0].length-i-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let l=!1,o="";for(;e;){l||(o=""),l=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=r.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):r.push(a);continue}if(a=this.tokenizer.emStrong(e,s,o)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.del(e,s,o)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),r.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),r.push(a);continue}let h=e;if(this.options.extensions?.startInline){let c=1/0,d=e.slice(1),u;this.options.extensions.startInline.forEach(f=>{u=f.call({lexer:this},d),typeof u=="number"&&u>=0&&(c=Math.min(c,u))}),c<1/0&&c>=0&&(h=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(h)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),l=!0;let c=r.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):r.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return r}},I=class{options;parser;constructor(n){this.options=n||R}space(n){return""}code({text:n,lang:e,escaped:r}){let s=(e||"").match(b.notSpaceStart)?.[0],t=n.replace(b.endingNewline,"")+`
41
41
  `;return s?'<pre><code class="language-'+w(s)+'">'+(r?t:w(t,!0))+`</code></pre>
42
42
  `:"<pre><code>"+(r?t:w(t,!0))+`</code></pre>
43
43
  `}blockquote({tokens:n}){return`<blockquote>
@@ -55,6 +55,6 @@ ${this.parser.parse(n)}</blockquote>
55
55
  `}tablerow({text:n}){return`<tr>
56
56
  ${n}</tr>
57
57
  `}tablecell(n){let e=this.parser.parseInline(n.tokens),r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+e+`</${r}>
58
- `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${w(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:r}){let s=this.parser.parseInline(r),t=le(n);if(t===null)return s;n=t;let i='<a href="'+n+'"';return e&&(i+=' title="'+w(e)+'"'),i+=">"+s+"</a>",i}image({href:n,title:e,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));let t=le(n);if(t===null)return w(r);n=t;let i=`<img src="${n}" alt="${w(r)}"`;return e&&(i+=` title="${w(e)}"`),i+=">",i}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:w(n.text)}},J=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},m=class O{options;renderer;textRenderer;constructor(e){this.options=e||R,this.options.renderer=this.options.renderer||new q,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new J}static parse(e,r){return new O(r).parse(e)}static parseInline(e,r){return new O(r).parseInline(e)}parse(e){this.renderer.parser=this;let r="";for(let s=0;s<e.length;s++){let t=e[s];if(this.options.extensions?.renderers?.[t.type]){let l=t,o=this.options.extensions.renderers[l.type].call({parser:this},l);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){r+=o||"";continue}}let i=t;switch(i.type){case"space":{r+=this.renderer.space(i);break}case"hr":{r+=this.renderer.hr(i);break}case"heading":{r+=this.renderer.heading(i);break}case"code":{r+=this.renderer.code(i);break}case"table":{r+=this.renderer.table(i);break}case"blockquote":{r+=this.renderer.blockquote(i);break}case"list":{r+=this.renderer.list(i);break}case"checkbox":{r+=this.renderer.checkbox(i);break}case"html":{r+=this.renderer.html(i);break}case"def":{r+=this.renderer.def(i);break}case"paragraph":{r+=this.renderer.paragraph(i);break}case"text":{r+=this.renderer.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}parseInline(e,r=this.renderer){this.renderer.parser=this;let s="";for(let t=0;t<e.length;t++){let i=e[t];if(this.options.extensions?.renderers?.[i.type]){let o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){s+=o||"";continue}}let l=i;switch(l.type){case"escape":{s+=r.text(l);break}case"html":{s+=r.html(l);break}case"link":{s+=r.link(l);break}case"image":{s+=r.image(l);break}case"checkbox":{s+=r.checkbox(l);break}case"strong":{s+=r.strong(l);break}case"em":{s+=r.em(l);break}case"codespan":{s+=r.codespan(l);break}case"br":{s+=r.br(l);break}case"del":{s+=r.del(l);break}case"text":{s+=r.text(l);break}default:{let o='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}},E=class{options;block;constructor(n){this.options=n||R}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?x.lex:x.lexInline}provideParser(n=this.block){return n?m.parse:m.parseInline}},at=class{defaults=Q();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=m;Renderer=q;TextRenderer=J;Lexer=x;Tokenizer=I;Hooks=E;constructor(...n){this.use(...n)}walkTokens(n,e){let r=[];for(let s of n)switch(r=r.concat(e.call(this,s)),s.type){case"table":{let t=s;for(let i of t.header)r=r.concat(this.walkTokens(i.tokens,e));for(let i of t.rows)for(let l of i)r=r.concat(this.walkTokens(l.tokens,e));break}case"list":{let t=s;r=r.concat(this.walkTokens(t.items,e));break}default:{let t=s;this.defaults.extensions?.childTokens?.[t.type]?this.defaults.extensions.childTokens[t.type].forEach(i=>{let l=t[i].flat(1/0);r=r.concat(this.walkTokens(l,e))}):t.tokens&&(r=r.concat(this.walkTokens(t.tokens,e)))}}return r}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(t=>{if(!t.name)throw new Error("extension name required");if("renderer"in t){let i=e.renderers[t.name];i?e.renderers[t.name]=function(...l){let o=t.renderer.apply(this,l);return o===!1&&(o=i.apply(this,l)),o}:e.renderers[t.name]=t.renderer}if("tokenizer"in t){if(!t.level||t.level!=="block"&&t.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[t.level];i?i.unshift(t.tokenizer):e[t.level]=[t.tokenizer],t.start&&(t.level==="block"?e.startBlock?e.startBlock.push(t.start):e.startBlock=[t.start]:t.level==="inline"&&(e.startInline?e.startInline.push(t.start):e.startInline=[t.start]))}"childTokens"in t&&t.childTokens&&(e.childTokens[t.name]=t.childTokens)}),s.extensions=e),r.renderer){let t=this.defaults.renderer||new q(this.defaults);for(let i in r.renderer){if(!(i in t))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,o=r.renderer[l],a=t[l];t[l]=(...h)=>{let c=o.apply(t,h);return c===!1&&(c=a.apply(t,h)),c||""}}s.renderer=t}if(r.tokenizer){let t=this.defaults.tokenizer||new I(this.defaults);for(let i in r.tokenizer){if(!(i in t))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,o=r.tokenizer[l],a=t[l];t[l]=(...h)=>{let c=o.apply(t,h);return c===!1&&(c=a.apply(t,h)),c}}s.tokenizer=t}if(r.hooks){let t=this.defaults.hooks||new E;for(let i in r.hooks){if(!(i in t))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,o=r.hooks[l],a=t[l];E.passThroughHooks.has(i)?t[l]=h=>{if(this.defaults.async&&E.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await o.call(t,h);return a.call(t,d)})();let c=o.call(t,h);return a.call(t,c)}:t[l]=(...h)=>{if(this.defaults.async)return(async()=>{let d=await o.apply(t,h);return d===!1&&(d=await a.apply(t,h)),d})();let c=o.apply(t,h);return c===!1&&(c=a.apply(t,h)),c}}s.hooks=t}if(r.walkTokens){let t=this.defaults.walkTokens,i=r.walkTokens;s.walkTokens=function(l){let o=[];return o.push(i.call(this,l)),t&&(o=o.concat(t.call(this,l))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return x.lex(n,e??this.defaults)}parser(n,e){return m.parse(n,e??this.defaults)}parseMarkdown(n){return(e,r)=>{let s={...r},t={...this.defaults,...s},i=this.onError(!!t.silent,!!t.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(t.hooks&&(t.hooks.options=t,t.hooks.block=n),t.async)return(async()=>{let l=t.hooks?await t.hooks.preprocess(e):e,o=await(t.hooks?await t.hooks.provideLexer(n):n?x.lex:x.lexInline)(l,t),a=t.hooks?await t.hooks.processAllTokens(o):o;t.walkTokens&&await Promise.all(this.walkTokens(a,t.walkTokens));let h=await(t.hooks?await t.hooks.provideParser(n):n?m.parse:m.parseInline)(a,t);return t.hooks?await t.hooks.postprocess(h):h})().catch(i);try{t.hooks&&(e=t.hooks.preprocess(e));let l=(t.hooks?t.hooks.provideLexer(n):n?x.lex:x.lexInline)(e,t);t.hooks&&(l=t.hooks.processAllTokens(l)),t.walkTokens&&this.walkTokens(l,t.walkTokens);let o=(t.hooks?t.hooks.provideParser(n):n?m.parse:m.parseInline)(l,t);return t.hooks&&(o=t.hooks.postprocess(o)),o}catch(l){return i(l)}}}onError(n,e){return r=>{if(r.message+=`
59
- Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+w(r.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(r);throw r}}},S=new at;function g(n,e){return S.parse(n,e)}g.options=g.setOptions=function(n){return S.setOptions(n),g.defaults=S.defaults,ce(g.defaults),g};g.getDefaults=Q;g.defaults=R;g.use=function(...n){return S.use(...n),g.defaults=S.defaults,ce(g.defaults),g};g.walkTokens=function(n,e){return S.walkTokens(n,e)};g.parseInline=S.parseInline;g.Parser=m;g.parser=m.parse;g.Renderer=q;g.TextRenderer=J;g.Lexer=x;g.lexer=x.lex;g.Tokenizer=I;g.Hooks=E;g.parse=g;var pt=g.options,ut=g.setOptions,dt=g.use,gt=g.walkTokens,kt=g.parseInline;var ft=m.parse,bt=x.lex;var K=class extends C{#r=null;#e=null;#t=null;#n=null;#l=null;static get observedAttributes(){return["src"]}setup(){this.#s()}teardown(){this.#e?.abort(),this.removeAttribute("data-rendered"),this.removeAttribute("data-loading")}attributeChangedCallback(e,r,s){e==="src"&&s&&r!==s&&this.isConnected&&this.#s()}get parser(){return this.#r}set parser(e){this.#r=typeof e=="function"?e:null}get markdown(){return this.#n??this.#l??""}set markdown(e){let r=e==null?null:String(e);this.#n!==r&&(this.#n=r,this.#s())}async render(){await this.#s()}async reload(){this.getAttribute("src")&&await this.#s()}#a(){if(this.getAttribute("src"))return null;let e=this.querySelector('script[type="text/markdown"]');if(e)return e.textContent;let r=this.querySelector("template[data-md]");if(r)return r.content.textContent;let s=this.querySelector(":scope > pre");return s?s.textContent:null}async#s(){let e=this.getAttribute("src"),r;if(this.removeAttribute("data-rendered"),this.removeAttribute("data-error"),e){this.#e?.abort(),this.#e=new AbortController,this.setAttribute("data-loading",""),this.#i("markdown-viewer:fetch",{src:e});try{let i=await fetch(e,{signal:this.#e.signal});if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);r=await i.text()}catch(i){if(i.name==="AbortError")return;this.removeAttribute("data-loading"),this.setAttribute("data-error",""),this.#i("markdown-viewer:error",{error:i.message});return}this.removeAttribute("data-loading")}else this.#n!=null?r=this.#n:r=this.#a();if(r==null)return;this.#l=r;let s;try{s=await(await this.#o())(r)}catch(i){this.setAttribute("data-error",""),this.#i("markdown-viewer:error",{error:i.message});return}this.#t||(this.#t=document.createElement("div"),this.#t.className="md-content",this.#t.setAttribute("part","content"),this.appendChild(this.#t)),this.#t.innerHTML=s,this.#c(),this.setAttribute("data-rendered","");let t=this.getAttribute("ping");if(t&&navigator.sendBeacon?.(t,JSON.stringify({src:e||"inline"})),this.#i("markdown-viewer:rendered",{src:e,node:this.#t}),this.hasAttribute("highlight"))for(let i of this.#t.querySelectorAll('pre > code[class*="language-"]')){let l=i.className.match(/language-(\S+)/)?.[1]||"";this.#i("markdown-viewer:highlight",{node:i,language:l})}}async#o(){return this.#r?this.#r:e=>g.parse(e,{gfm:!0})}#c(){if(!this.#t)return;let e=this.dataset.theme??this.closest("[data-theme]")?.dataset.theme;e&&(this.#t.dataset.theme=e)}#i(e,r){this.dispatchEvent(new CustomEvent(e,{detail:r,bubbles:!0,composed:!0}))}};re("markdown-viewer",K);export{K as MarkdownViewer};
58
+ `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${w(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:r}){let s=this.parser.parseInline(r),t=le(n);if(t===null)return s;n=t;let i='<a href="'+n+'"';return e&&(i+=' title="'+w(e)+'"'),i+=">"+s+"</a>",i}image({href:n,title:e,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));let t=le(n);if(t===null)return w(r);n=t;let i=`<img src="${n}" alt="${w(r)}"`;return e&&(i+=` title="${w(e)}"`),i+=">",i}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:w(n.text)}},J=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},m=class H{options;renderer;textRenderer;constructor(e){this.options=e||R,this.options.renderer=this.options.renderer||new I,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new J}static parse(e,r){return new H(r).parse(e)}static parseInline(e,r){return new H(r).parseInline(e)}parse(e){this.renderer.parser=this;let r="";for(let s=0;s<e.length;s++){let t=e[s];if(this.options.extensions?.renderers?.[t.type]){let l=t,o=this.options.extensions.renderers[l.type].call({parser:this},l);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){r+=o||"";continue}}let i=t;switch(i.type){case"space":{r+=this.renderer.space(i);break}case"hr":{r+=this.renderer.hr(i);break}case"heading":{r+=this.renderer.heading(i);break}case"code":{r+=this.renderer.code(i);break}case"table":{r+=this.renderer.table(i);break}case"blockquote":{r+=this.renderer.blockquote(i);break}case"list":{r+=this.renderer.list(i);break}case"checkbox":{r+=this.renderer.checkbox(i);break}case"html":{r+=this.renderer.html(i);break}case"def":{r+=this.renderer.def(i);break}case"paragraph":{r+=this.renderer.paragraph(i);break}case"text":{r+=this.renderer.text(i);break}default:{let l='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}parseInline(e,r=this.renderer){this.renderer.parser=this;let s="";for(let t=0;t<e.length;t++){let i=e[t];if(this.options.extensions?.renderers?.[i.type]){let o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){s+=o||"";continue}}let l=i;switch(l.type){case"escape":{s+=r.text(l);break}case"html":{s+=r.html(l);break}case"link":{s+=r.link(l);break}case"image":{s+=r.image(l);break}case"checkbox":{s+=r.checkbox(l);break}case"strong":{s+=r.strong(l);break}case"em":{s+=r.em(l);break}case"codespan":{s+=r.codespan(l);break}case"br":{s+=r.br(l);break}case"del":{s+=r.del(l);break}case"text":{s+=r.text(l);break}default:{let o='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}},E=class{options;block;constructor(n){this.options=n||R}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?x.lex:x.lexInline}provideParser(n=this.block){return n?m.parse:m.parseInline}},ot=class{defaults=O();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=m;Renderer=I;TextRenderer=J;Lexer=x;Tokenizer=q;Hooks=E;constructor(...n){this.use(...n)}walkTokens(n,e){let r=[];for(let s of n)switch(r=r.concat(e.call(this,s)),s.type){case"table":{let t=s;for(let i of t.header)r=r.concat(this.walkTokens(i.tokens,e));for(let i of t.rows)for(let l of i)r=r.concat(this.walkTokens(l.tokens,e));break}case"list":{let t=s;r=r.concat(this.walkTokens(t.items,e));break}default:{let t=s;this.defaults.extensions?.childTokens?.[t.type]?this.defaults.extensions.childTokens[t.type].forEach(i=>{let l=t[i].flat(1/0);r=r.concat(this.walkTokens(l,e))}):t.tokens&&(r=r.concat(this.walkTokens(t.tokens,e)))}}return r}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(t=>{if(!t.name)throw new Error("extension name required");if("renderer"in t){let i=e.renderers[t.name];i?e.renderers[t.name]=function(...l){let o=t.renderer.apply(this,l);return o===!1&&(o=i.apply(this,l)),o}:e.renderers[t.name]=t.renderer}if("tokenizer"in t){if(!t.level||t.level!=="block"&&t.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[t.level];i?i.unshift(t.tokenizer):e[t.level]=[t.tokenizer],t.start&&(t.level==="block"?e.startBlock?e.startBlock.push(t.start):e.startBlock=[t.start]:t.level==="inline"&&(e.startInline?e.startInline.push(t.start):e.startInline=[t.start]))}"childTokens"in t&&t.childTokens&&(e.childTokens[t.name]=t.childTokens)}),s.extensions=e),r.renderer){let t=this.defaults.renderer||new I(this.defaults);for(let i in r.renderer){if(!(i in t))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let l=i,o=r.renderer[l],a=t[l];t[l]=(...h)=>{let c=o.apply(t,h);return c===!1&&(c=a.apply(t,h)),c||""}}s.renderer=t}if(r.tokenizer){let t=this.defaults.tokenizer||new q(this.defaults);for(let i in r.tokenizer){if(!(i in t))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let l=i,o=r.tokenizer[l],a=t[l];t[l]=(...h)=>{let c=o.apply(t,h);return c===!1&&(c=a.apply(t,h)),c}}s.tokenizer=t}if(r.hooks){let t=this.defaults.hooks||new E;for(let i in r.hooks){if(!(i in t))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let l=i,o=r.hooks[l],a=t[l];E.passThroughHooks.has(i)?t[l]=h=>{if(this.defaults.async&&E.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await o.call(t,h);return a.call(t,d)})();let c=o.call(t,h);return a.call(t,c)}:t[l]=(...h)=>{if(this.defaults.async)return(async()=>{let d=await o.apply(t,h);return d===!1&&(d=await a.apply(t,h)),d})();let c=o.apply(t,h);return c===!1&&(c=a.apply(t,h)),c}}s.hooks=t}if(r.walkTokens){let t=this.defaults.walkTokens,i=r.walkTokens;s.walkTokens=function(l){let o=[];return o.push(i.call(this,l)),t&&(o=o.concat(t.call(this,l))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return x.lex(n,e??this.defaults)}parser(n,e){return m.parse(n,e??this.defaults)}parseMarkdown(n){return(e,r)=>{let s={...r},t={...this.defaults,...s},i=this.onError(!!t.silent,!!t.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(t.hooks&&(t.hooks.options=t,t.hooks.block=n),t.async)return(async()=>{let l=t.hooks?await t.hooks.preprocess(e):e,o=await(t.hooks?await t.hooks.provideLexer(n):n?x.lex:x.lexInline)(l,t),a=t.hooks?await t.hooks.processAllTokens(o):o;t.walkTokens&&await Promise.all(this.walkTokens(a,t.walkTokens));let h=await(t.hooks?await t.hooks.provideParser(n):n?m.parse:m.parseInline)(a,t);return t.hooks?await t.hooks.postprocess(h):h})().catch(i);try{t.hooks&&(e=t.hooks.preprocess(e));let l=(t.hooks?t.hooks.provideLexer(n):n?x.lex:x.lexInline)(e,t);t.hooks&&(l=t.hooks.processAllTokens(l)),t.walkTokens&&this.walkTokens(l,t.walkTokens);let o=(t.hooks?t.hooks.provideParser(n):n?m.parse:m.parseInline)(l,t);return t.hooks&&(o=t.hooks.postprocess(o)),o}catch(l){return i(l)}}}onError(n,e){return r=>{if(r.message+=`
59
+ Please report this to https://github.com/markedjs/marked.`,n){let s="<p>An error occurred:</p><pre>"+w(r.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(r);throw r}}},S=new ot;function g(n,e){return S.parse(n,e)}g.options=g.setOptions=function(n){return S.setOptions(n),g.defaults=S.defaults,ce(g.defaults),g};g.getDefaults=O;g.defaults=R;g.use=function(...n){return S.use(...n),g.defaults=S.defaults,ce(g.defaults),g};g.walkTokens=function(n,e){return S.walkTokens(n,e)};g.parseInline=S.parseInline;g.Parser=m;g.parser=m.parse;g.Renderer=I;g.TextRenderer=J;g.Lexer=x;g.lexer=x.lex;g.Tokenizer=q;g.Hooks=E;g.parse=g;var ut=g.options,dt=g.setOptions,gt=g.use,kt=g.walkTokens,ft=g.parseInline;var bt=m.parse,xt=x.lex;function me(n){if(!n||typeof n!="string")return"";let e=document.createElement("template");return e.innerHTML=n,e.content.querySelectorAll("script, iframe, object, embed, form, base, link, meta, noscript").forEach(t=>t.remove()),e.content.querySelectorAll("*").forEach(t=>{for(let i of[...t.attributes]){if(i.name.startsWith("on")){t.removeAttribute(i.name);continue}if(["href","src","action","formaction","xlink:href"].includes(i.name)){let l=i.value.trim().toLowerCase();(l.startsWith("javascript:")||l.startsWith("data:text/html"))&&t.removeAttribute(i.name);continue}(i.name==="srcdoc"||i.name==="data"&&t.tagName==="OBJECT")&&t.removeAttribute(i.name)}}),e.innerHTML}var K=class extends L{#e=null;#t=null;#r=null;#n=null;#l=null;static get observedAttributes(){return["src"]}setup(){this.#s()}teardown(){this.#t?.abort(),this.removeAttribute("data-rendered"),this.removeAttribute("data-loading")}attributeChangedCallback(e,r,s){e==="src"&&s&&r!==s&&this.isConnected&&this.#s()}get parser(){return this.#e}set parser(e){this.#e=typeof e=="function"?e:null}get markdown(){return this.#n??this.#l??""}set markdown(e){let r=e==null?null:String(e);this.#n!==r&&(this.#n=r,this.#s())}async render(){await this.#s()}async reload(){this.getAttribute("src")&&await this.#s()}#a(){if(this.getAttribute("src"))return null;let e=this.querySelector('script[type="text/markdown"]');if(e)return e.textContent;let r=this.querySelector("template[data-md]");if(r)return r.content.textContent;let s=this.querySelector(":scope > pre");return s?s.textContent:null}async#s(){let e=this.getAttribute("src"),r;if(this.removeAttribute("data-rendered"),this.removeAttribute("data-error"),e){this.#t?.abort(),this.#t=new AbortController,this.setAttribute("data-loading",""),this.#i("markdown-viewer:fetch",{src:e});try{let i=await fetch(e,{signal:this.#t.signal});if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);r=await i.text()}catch(i){if(i.name==="AbortError")return;this.removeAttribute("data-loading"),this.setAttribute("data-error",""),this.#i("markdown-viewer:error",{error:i.message});return}this.removeAttribute("data-loading")}else this.#n!=null?r=this.#n:r=this.#a();if(r==null)return;this.#l=r;let s;try{s=await(await this.#o())(r)}catch(i){this.setAttribute("data-error",""),this.#i("markdown-viewer:error",{error:i.message});return}this.#r||(this.#r=document.createElement("div"),this.#r.className="md-content",this.#r.setAttribute("part","content"),this.appendChild(this.#r)),this.#r.innerHTML=this.#c()?me(String(s??"")):s,this.#h(),this.setAttribute("data-rendered","");let t=this.getAttribute("ping");if(t&&navigator.sendBeacon?.(t,JSON.stringify({src:e||"inline"})),this.#i("markdown-viewer:rendered",{src:e,node:this.#r}),this.hasAttribute("highlight"))for(let i of this.#r.querySelectorAll('pre > code[class*="language-"]')){let l=i.className.match(/language-(\S+)/)?.[1]||"";this.#i("markdown-viewer:highlight",{node:i,language:l})}}async#o(){return this.#e?this.#e:e=>g.parse(e,{gfm:!0})}#c(){let e=this.getAttribute("sanitize");return e==null?!0:!/^(off|false)$/i.test(e.trim())}#h(){if(!this.#r)return;let e=this.dataset.theme??this.closest("[data-theme]")?.dataset.theme;e&&(this.#r.dataset.theme=e)}#i(e,r){this.dispatchEvent(new CustomEvent(e,{detail:r,bubbles:!0,composed:!0}))}};re("markdown-viewer",K);export{K as MarkdownViewer};
60
60
  //# sourceMappingURL=markdown-viewer.js.map
@@ -1,2 +1,2 @@
1
- var m=window.matchMedia("(prefers-reduced-motion: reduce)");var f=new Map;function p(i,t,r={}){let e=r.priority??10,n={impl:t,bundle:r.bundle,contract:r.contract,priority:e},s=f.get(i);if(customElements.get(i)){if(!s||s.priority>=e){s&&s.priority===e&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=e){s.priority===e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}f.set(i,n),customElements.define(i,t)}var l=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,r,e,n){t.addEventListener(r,e,n),this.#e.push(()=>t.removeEventListener(r,e,n))}setup(){}teardown(){}setState(t,r){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{r?e.add(t):e.delete(t)}catch{let n=`--${t}`;r?e.add(n):e.delete(n)}}_adoptInternals(t){this.#t||(this.#t=t)}};var h=class extends l{#e=null;#t=!1;#s=null;setup(){this.hasAttribute("role")||this.setAttribute("role","navigation"),this.#n("pathname"),this.listen(window,"popstate",this.#o)}get items(){return this.#e?this.#e.map(t=>({...t})):Array.from(this.#r()).map(t=>({href:t.getAttribute("href")||"",label:t.textContent?.trim()||""}))}set items(t){if(!Array.isArray(t))return;let r=t.map(e=>({...e}));this.#e&&this.#u(this.#e,r)||(this.#e=r,this.#c(r),this.#n(this.#t?"property":"pathname"),this.dispatchEvent(new CustomEvent("nav-bar:items-changed",{detail:{items:this.items,source:"property"},bubbles:!0,composed:!0})))}get current(){if(this.#t)return this.#s;for(let t of this.#r())if(t.getAttribute("aria-current")==="page")return t.getAttribute("data-route")||t.getAttribute("href")||null;return null}set current(t){let r=this.current,e=t==null?null:String(t);this.#t=!0,this.#s=e,this.#i(e),r!==e&&this.dispatchEvent(new CustomEvent("nav-bar:current-changed",{detail:{current:e,previous:r,source:"property"},bubbles:!0,composed:!0}))}releaseCurrent(){this.#t&&(this.#t=!1,this.#s=null,this.#n("pathname"))}refresh(){this.#t||this.#n("pathname")}#r(){let t=this.querySelectorAll("a[data-nav-link]");return t.length>0?t:this.querySelectorAll(":scope > a")}#o=()=>{this.#t||this.#n("popstate")};#n(t){let r=this.current,e=this.#a();this.#i(e),r!==e&&this.dispatchEvent(new CustomEvent("nav-bar:current-changed",{detail:{current:e,previous:r,source:t},bubbles:!0,composed:!0}))}#a(){let t=window.location.pathname,r=Array.from(this.#r());if(r.length===0)return null;let e=this.getAttribute("data-match")==="exact",n=null,s=null,o=-1;for(let d of r){let c=d.getAttribute("href");if(!c||/^[a-z]+:/i.test(c)||c.startsWith("//"))continue;let a=c.split("?")[0].split("#")[0];if(a===t&&n==null){n=d;continue}!e&&a!=="/"&&(t===a||t.startsWith(a.replace(/\/$/,"")+"/"))&&a.length>o&&(s=d,o=a.length)}let u=n||s;return u?u.getAttribute("data-route")||u.getAttribute("href"):null}#i(t){let r=this.#r();for(let e of r){let n=e.getAttribute("data-route")||e.getAttribute("href");t!=null&&n===t?e.setAttribute("aria-current","page"):e.removeAttribute("aria-current")}}#c(t){this.#r().forEach(n=>n.remove());let e=document.createDocumentFragment();for(let n of t)e.appendChild(this.#l(n));this.appendChild(e)}#l(t){let r=document.createElement("a");if(r.href=t.href||"#",t.route&&r.setAttribute("data-route",t.route),t.external&&(r.target="_blank",r.rel="noopener noreferrer"),t.icon){let e=document.createElement("icon-wc");e.setAttribute("name",String(t.icon)),e.setAttribute("size","sm"),r.appendChild(e)}if(r.appendChild(document.createTextNode(t.label||"")),t.external){let e=document.createElement("span");e.className="sr-only",e.textContent=" (opens in new tab)",r.appendChild(e)}if(t.badge!=null){let e=document.createElement("span");e.className="badge",e.textContent=String(t.badge),r.appendChild(e)}return r}#u(t,r){if(t.length!==r.length)return!1;for(let e=0;e<t.length;e++){let n=Object.keys(t[e]).sort(),s=Object.keys(r[e]).sort();if(n.length!==s.length)return!1;for(let o=0;o<n.length;o++)if(n[o]!==s[o]||t[e][n[o]]!==r[e][s[o]])return!1}return!0}};p("nav-bar",h);export{h as NavBar};
1
+ var m=window.matchMedia("(prefers-reduced-motion: reduce)");var f=new Map;function p(s,t,r={}){let e=r.priority??10,n={impl:t,bundle:r.bundle,contract:r.contract,priority:e},i=f.get(s);if(customElements.get(s)){if(!i||i.priority>=e){i&&i.priority===e&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=e){i.priority===e&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${i.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}f.set(s,n),customElements.define(s,t)}var l=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,r,e,n){t.addEventListener(r,e,n),this.#e.push(()=>t.removeEventListener(r,e,n))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,r){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{r?e.add(t):e.delete(t)}catch{let n=`--${t}`;r?e.add(n):e.delete(n)}}_adoptInternals(t){this.#t||(this.#t=t)}};var h=class extends l{#e=null;#t=!1;#i=null;setup(){this.hasAttribute("role")||this.setAttribute("role","navigation"),this.#n("pathname"),this.listen(window,"popstate",this.#o)}get items(){return this.#e?this.#e.map(t=>({...t})):Array.from(this.#r()).map(t=>({href:t.getAttribute("href")||"",label:t.textContent?.trim()||""}))}set items(t){if(!Array.isArray(t))return;let r=t.map(e=>({...e}));this.#e&&this.#u(this.#e,r)||(this.#e=r,this.#c(r),this.#n(this.#t?"property":"pathname"),this.dispatchEvent(new CustomEvent("nav-bar:items-changed",{detail:{items:this.items,source:"property"},bubbles:!0,composed:!0})))}get current(){if(this.#t)return this.#i;for(let t of this.#r())if(t.getAttribute("aria-current")==="page")return t.getAttribute("data-route")||t.getAttribute("href")||null;return null}set current(t){let r=this.current,e=t==null?null:String(t);this.#t=!0,this.#i=e,this.#s(e),r!==e&&this.dispatchEvent(new CustomEvent("nav-bar:current-changed",{detail:{current:e,previous:r,source:"property"},bubbles:!0,composed:!0}))}releaseCurrent(){this.#t&&(this.#t=!1,this.#i=null,this.#n("pathname"))}refresh(){this.#t||this.#n("pathname")}#r(){let t=this.querySelectorAll("a[data-nav-link]");return t.length>0?t:this.querySelectorAll(":scope > a")}#o=()=>{this.#t||this.#n("popstate")};#n(t){let r=this.current,e=this.#a();this.#s(e),r!==e&&this.dispatchEvent(new CustomEvent("nav-bar:current-changed",{detail:{current:e,previous:r,source:t},bubbles:!0,composed:!0}))}#a(){let t=window.location.pathname,r=Array.from(this.#r());if(r.length===0)return null;let e=this.getAttribute("data-match")==="exact",n=null,i=null,o=-1;for(let d of r){let c=d.getAttribute("href");if(!c||/^[a-z]+:/i.test(c)||c.startsWith("//"))continue;let a=c.split("?")[0].split("#")[0];if(a===t&&n==null){n=d;continue}!e&&a!=="/"&&(t===a||t.startsWith(a.replace(/\/$/,"")+"/"))&&a.length>o&&(i=d,o=a.length)}let u=n||i;return u?u.getAttribute("data-route")||u.getAttribute("href"):null}#s(t){let r=this.#r();for(let e of r){let n=e.getAttribute("data-route")||e.getAttribute("href");t!=null&&n===t?e.setAttribute("aria-current","page"):e.removeAttribute("aria-current")}}#c(t){this.#r().forEach(n=>n.remove());let e=document.createDocumentFragment();for(let n of t)e.appendChild(this.#l(n));this.appendChild(e)}#l(t){let r=document.createElement("a");if(r.href=t.href||"#",t.route&&r.setAttribute("data-route",t.route),t.external&&(r.target="_blank",r.rel="noopener noreferrer"),t.icon){let e=document.createElement("icon-wc");e.setAttribute("name",String(t.icon)),e.setAttribute("size","sm"),r.appendChild(e)}if(r.appendChild(document.createTextNode(t.label||"")),t.external){let e=document.createElement("span");e.className="sr-only",e.textContent=" (opens in new tab)",r.appendChild(e)}if(t.badge!=null){let e=document.createElement("span");e.className="badge",e.textContent=String(t.badge),r.appendChild(e)}return r}#u(t,r){if(t.length!==r.length)return!1;for(let e=0;e<t.length;e++){let n=Object.keys(t[e]).sort(),i=Object.keys(r[e]).sort();if(n.length!==i.length)return!1;for(let o=0;o<n.length;o++)if(n[o]!==i[o]||t[e][n[o]]!==r[e][i[o]])return!1}return!0}};p("nav-bar",h);export{h as NavBar};
2
2
  //# sourceMappingURL=nav-bar.js.map
@@ -1,3 +1,3 @@
1
- var E=class extends HTMLElement{#t=[];#n;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,i){t.addEventListener(e,n,i),this.#t.push(()=>t.removeEventListener(e,n,i))}setup(){}teardown(){}setState(t,e){this.#n||(this.#n=this.attachInternals());let n=this.#n.states;try{e?n.add(t):n.delete(t)}catch{let i=`--${t}`;e?n.add(i):n.delete(i)}}_adoptInternals(t){this.#n||(this.#n=t)}};var K=window.matchMedia("(prefers-reduced-motion: reduce)");var R=new Map;function L(s,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},o=R.get(s);if(customElements.get(s)){if(!o||o.priority>=n){o&&o.priority===n&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=n){o.priority===n&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${o.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}R.set(s,i),customElements.define(s,t)}function P(){let s=globalThis.localStorage;if(!s)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return s.getItem(t)},async setRaw(t,e){s.setItem(t,e)},async removeRaw(t){s.removeItem(t)},async keys(t){let e=[];for(let n=0;n<s.length;n++){let i=s.key(n);i&&i.startsWith(t)&&e.push(i)}return e}}}var v=null;function u(){return v||(v=P()),v}function w(s,t){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${s}:${t}`}function T(s){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${s}:`}function $(s){try{let t=JSON.parse(s);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var S={configure(s={}){v=s.backend??null},async set(s,t,e){let n={data:e,timestamp:Date.now()};await u().setRaw(w(s,t),JSON.stringify(n))},async get(s,t,e){let n=await u().getRaw(w(s,t));if(n==null)return null;let i=$(n);return!i||e?.maxAge!=null&&Date.now()-i.timestamp>e.maxAge?null:i.data},async remove(s,t){await u().removeRaw(w(s,t))},async list(s){let t=T(s),e=await u().keys(t),n=[];for(let i of e){let o=await u().getRaw(i);if(o==null)continue;let r=$(o);r&&n.push({key:i.slice(t.length),data:r.data,timestamp:r.timestamp})}return n},async clear(s){let t=T(s),e=await u().keys(t);for(let n of e)await u().removeRaw(n)},async clearAll(){let s=await u().keys("vb:");for(let t of s)await u().removeRaw(t)},async setMany(s,t){for(let[e,n]of t)await S.set(s,e,n)}};var x="[data-highlights]",H="highlights",_=["yellow","green","blue","pink"];var D=typeof CSS<"u"&&"highlights"in CSS;function M(s){let t=2166136261;for(let e=0;e<s.length;e++)t^=s.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function V(){return"hn-"+crypto.randomUUID().slice(0,8)}function X(s,t){return getComputedStyle(s).getPropertyValue(`--highlight-${t}`).trim()}var g=null,b=0;function U(s){if(g){b++;return}g=new CSSStyleSheet;let t=s.map(e=>`::highlight(hn-${e}) { background-color: var(--highlight-${e}); text-decoration-line: underline; text-decoration-color: var(--highlight-${e}); text-underline-offset: 2px; }`).join(`
2
- `);g.replaceSync(t),document.adoptedStyleSheets=[...document.adoptedStyleSheets,g],b=1}function W(){b--,b<=0&&g&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(s=>s!==g),g=null,b=0)}var f=null;function C(s){f||(f=document.createElement("div"),f.setAttribute("aria-live","polite"),f.setAttribute("aria-atomic","true"),f.className="hn-sr-only",document.body.appendChild(f)),f.textContent="",requestAnimationFrame(()=>{f.textContent=s})}function B(s,t,e){let n=document.createTreeWalker(s,NodeFilter.SHOW_TEXT),i=0;for(;n.nextNode();){if(n.currentNode===t)return i+e;i+=(n.currentNode.textContent??"").length}return-1}function m(s,t,e){let n=document.createTreeWalker(s,NodeFilter.SHOW_TEXT),i=0,o=null,r=0,c=null,a=0;for(;n.nextNode();){let l=n.currentNode,h=(l.textContent??"").length;if(!o&&i+h>t&&(o=l,r=t-i),i+h>=e){c=l,a=e-i;break}i+=h}if(!o||!c)return null;try{let l=document.createRange();return l.setStart(o,Math.min(r,(o.textContent??"").length)),l.setEnd(c,Math.min(a,(c.textContent??"").length)),l}catch{return null}}var k=class{#t;#n;#o;#l;#e=[];#r=!D;#i;#h;#d=!1;#u=[];constructor(t){this.#t=t,this.#l=t.hasAttribute("data-highlights-readonly");let e=t.dataset.highlights;this.#n=e&&e!==""?e:location.pathname;let n=t.dataset.highlightsColors;this.#o=n?n.split(",").map(i=>i.trim()).filter(Boolean):[..._],this.#r||U(this.#o),this.#c(),this.#l||(this.#i=this.#m.bind(this),this.#h=this.#p.bind(this),t.addEventListener("pointerup",this.#i),t.addEventListener("click",this.#h)),t.setAttribute("data-highlights-init",""),this.#b().then(()=>{this.#d||this.#c()})}get colors(){return[...this.#o]}get element(){return this.#t}getHighlights(){return this.#e.map(t=>({...t}))}removeHighlight(t){let e=this.#e.findIndex(n=>n.id===t);e<0||(this.#e.splice(e,1),this.#a(),this.#c(),this.#s("highlights:removed",{id:t}),C("Highlight removed"))}clearAll(){this.#e=[],this.#a(),this.#c()}exportHighlights(){return JSON.stringify({version:1,highlights:this.#e})}importHighlights(t){try{let e=typeof t=="string"?JSON.parse(t):t;if(!e.highlights||!Array.isArray(e.highlights))return;this.#e=e.highlights,this.#a(),this.#c()}catch{}}destroy(){if(!this.#d){if(this.#d=!0,this.#i&&this.#t.removeEventListener("pointerup",this.#i),this.#h&&this.#t.removeEventListener("click",this.#h),this.#r)this.#t.querySelectorAll("mark[data-hn-id]").forEach(t=>{let e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t),e.normalize()});else{for(let t of this.#o)CSS.highlights.delete(`hn-${t}`);W()}this.#f(),this.#t.removeAttribute("data-highlights-init")}}#m(){requestAnimationFrame(()=>{if(this.#d)return;let t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return;let e=t.getRangeAt(0);this.#t.contains(e.commonAncestorContainer)&&this.#s("highlights:selected",{text:t.toString().trim(),rect:e.getBoundingClientRect()})})}#p(t){let e=t.target.closest?.(".hn-margin-annotation");if(e){let i=e.dataset.hnId,o=this.#e.find(r=>r.id===i);if(o){this.#s("highlights:clicked",{id:i,highlight:{...o}}),this.#s("highlights:request-note",{id:i,highlight:{...o},controller:this});return}}let n=t.target.closest?.("mark[data-hn-id]");if(n){let i=n.dataset.hnId,o=this.#e.find(r=>r.id===i);if(o){this.#s("highlights:clicked",{id:i,highlight:{...o}});return}}if(!this.#r){let i=this.#y(t.clientX,t.clientY);i&&this.#s("highlights:clicked",{id:i.id,highlight:{...i}})}}findHighlightRect(t){let e=this.#e.find(o=>o.id===t);if(!e)return null;let n=m(this.#t,e.startOffset,e.endOffset);if(!n)return null;let i=n.getClientRects();return i.length?i[0]:null}#y(t,e){for(let n of this.#e){let i=m(this.#t,n.startOffset,n.endOffset);if(!i)continue;let o=i.getClientRects();for(let r of o)if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom)return n}return null}_createFromSelection(t){let e=window.getSelection();if(!e||e.isCollapsed)return;let n=e.getRangeAt(0);if(!this.#t.contains(n.commonAncestorContainer))return;let i=B(this.#t,n.startContainer,n.startOffset),o=B(this.#t,n.endContainer,n.endOffset);if(i<0||o<0||i>=o)return;let r=e.toString().trim(),c={id:V(),startOffset:i,endOffset:o,text:r,color:t,note:"",created:Date.now()};this.#e.push(c),this.#a(),this.#c(),e.removeAllRanges(),this.#s("highlights:added",{id:c.id,text:r,color:t,note:""}),C("Highlight added")}_changeColor(t,e){let n=this.#e.find(i=>i.id===t);n&&(n.color=e,this.#a(),this.#c())}_updateNote(t,e){let n=this.#e.find(i=>i.id===t);n&&(n.note=e,this.#a(),this.#g(),this.#s("highlights:note-changed",{id:t,note:e}),C("Note saved"))}async#b(){let t=await S.get(H,this.#n);if(!t||!Array.isArray(t.highlights))return;let e=M(this.#t.textContent);t.contentHash&&t.contentHash!==e?(this.#e=t.highlights.filter(n=>{let i=m(this.#t,n.startOffset,n.endOffset);return i?i.toString().trim()===n.text:!1}),this.#a()):this.#e=t.highlights}#a(){let t={version:1,contentHash:M(this.#t.textContent),highlights:this.#e};S.set(H,this.#n,t).catch(()=>{})}#c(){this.#r?this.#v():this.#E(),this.#g()}#E(){let t=new Map;for(let e of this.#o)t.set(e,[]);for(let e of this.#e){let n=m(this.#t,e.startOffset,e.endOffset);n&&t.has(e.color)&&t.get(e.color).push(n)}for(let[e,n]of t){let i=`hn-${e}`;n.length===0?CSS.highlights.delete(i):CSS.highlights.set(i,new Highlight(...n))}}#v(){this.#t.querySelectorAll("mark[data-hn-id]").forEach(e=>{let n=e.parentNode;for(;e.firstChild;)n.insertBefore(e.firstChild,e);n.removeChild(e)}),this.#t.normalize();let t=[...this.#e].sort((e,n)=>n.startOffset-e.startOffset);for(let e of t){let n=m(this.#t,e.startOffset,e.endOffset);if(!n)continue;let i=X(this.#t,e.color),o=document.createElement("mark");o.dataset.hnId=e.id,o.dataset.hnColor=e.color,i&&(o.style.backgroundColor=i,o.style.textDecorationColor=i);try{n.surroundContents(o)}catch{let r=n.extractContents();o.appendChild(r),n.insertNode(o)}}}#f(){for(let t of this.#u)t.remove();this.#u=[]}#g(){if(this.#f(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");for(let e of this.#e){let n=m(this.#t,e.startOffset,e.endOffset);if(!n)continue;let i=n.getClientRects();if(i.length===0)continue;let o=i[0],r=this.#t.getBoundingClientRect(),c=o.top-r.top,a=document.createElement("span");a.className="hn-margin-annotation",a.dataset.hnId=e.id,a.setAttribute("aria-hidden","true"),a.style.top=`${c}px`,e.note?(a.innerHTML='<span class="hn-note-indicator">*</span> You highlighted',a.classList.add("hn-has-note")):a.textContent="You highlighted",this.#t.appendChild(a),this.#u.push(a)}}#s(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}},A=new WeakMap;function p(s){if(A.has(s))return A.get(s);let t=new k(s);return A.set(s,t),t}function I(s=document){s.querySelectorAll(x).forEach(t=>{t.hasAttribute("data-highlights-init")||p(t)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>I()):I();var j=new MutationObserver(s=>{for(let t of s)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let n=e;n.matches(x)&&p(n),n.querySelectorAll(x).forEach(i=>{i.hasAttribute("data-highlights-init")||p(i)})}});j.observe(document.documentElement,{childList:!0,subtree:!0});var F=!1,N=new Set,O=class extends E{#t=!1;#n=null;setup(){this.#t=!!this.closest("selection-menu");let t=document.createElement("button");t.type="button",t.setAttribute("aria-label",this.#t?"Add private note":"View notes");let e=document.createElement("icon-wc");e.setAttribute("name","sticky-note"),e.setAttribute("size","sm"),e.setAttribute("aria-hidden","true"),t.appendChild(e),this.#t?t.addEventListener("click",()=>this.#o()):t.addEventListener("click",()=>this.#l()),this.appendChild(t),N.add(this),F||(F=!0,document.addEventListener("highlights:request-note",G))}teardown(){N.delete(this),this.#i()}openFor(t,e){this.#e(t,e)}#o(){let t=this.closest("selection-menu");if(!t)return;let e=t.getSelection();if(!e)return;let n=e.target;n.hasAttribute("data-highlights-init")||n.setAttribute("data-highlights","");let i=p(n),o=i.getHighlights(),r=null;for(let c of o)if(e.text&&c.text&&e.text.includes(c.text.slice(0,20))){r=c;break}if(!r){i._createFromSelection("yellow");let c=i.getHighlights();r=c[c.length-1]}r&&this.#e(r,i),t.dismiss()}#l(){let t=this.getAttribute("for"),e=t?document.getElementById(t):null;if(!e)return;e.hasAttribute("data-highlights-init")||e.setAttribute("data-highlights","");let n=p(e),i=n.getHighlights(),o=i.filter(r=>r.note);o.length>0?this.#e(o[0],n):i.length>0&&this.#e(i[0],n)}#e(t,e){this.#i();let n=e.element,i=document.createElement("div");i.className="hn-note-panel",i.setAttribute("role","dialog"),i.setAttribute("aria-label","Private note");let o=document.createElement("header");o.className="hn-note-header";let r=document.createElement("small");r.textContent="PRIVATE NOTE",o.appendChild(r),i.appendChild(o);let c=document.createElement("blockquote");c.className="hn-note-quote",c.textContent=t.text.length>80?t.text.slice(0,80)+"\u2026":t.text,i.appendChild(c);let a=document.createElement("textarea");a.className="hn-note-textarea",a.placeholder="Add a note\u2026",a.value=t.note||"",a.rows=3,a.setAttribute("aria-label","Note for highlighted text"),i.appendChild(a);let l=document.createElement("footer");l.className="hn-note-actions";let h=document.createElement("button");h.type="button",h.className="hn-action hn-action-save",h.textContent="Save",h.addEventListener("click",()=>{e._updateNote(t.id,a.value.trim()),this.#i()});let y=document.createElement("button");if(y.type="button",y.className="hn-action",y.textContent="Cancel",y.addEventListener("click",()=>this.#i()),l.append(h,y),i.appendChild(l),a.addEventListener("keydown",d=>{d.key==="Escape"&&(d.preventDefault(),this.#i()),d.key==="Enter"&&(d.metaKey||d.ctrlKey)&&(d.preventDefault(),e._updateNote(t.id,a.value.trim()),this.#i())}),getComputedStyle(n).position==="static"&&(n.style.position="relative"),n.appendChild(i),typeof e.findHighlightRect=="function"){let d=e.findHighlightRect(t.id);if(d){let q=n.getBoundingClientRect();i.style.top=`${d.top-q.top}px`}}this.#n=i,requestAnimationFrame(()=>{a.focus(),document.addEventListener("pointerdown",this.#r)})}#r=t=>{this.#n&&!this.#n.contains(t.target)&&this.#i()};#i(){this.#n&&(document.removeEventListener("pointerdown",this.#r),this.#n.remove(),this.#n=null)}};function G(s){let{highlight:t,controller:e}=s.detail||{};if(!t||!e)return;let n=N.values().next().value;n&&n.openFor(t,e)}L("note-wc",O);
1
+ var v=class extends HTMLElement{#t=[];#n;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,i){t.addEventListener(e,n,i),this.#t.push(()=>t.removeEventListener(e,n,i))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#n||(this.#n=this.attachInternals());let n=this.#n.states;try{e?n.add(t):n.delete(t)}catch{let i=`--${t}`;e?n.add(i):n.delete(i)}}_adoptInternals(t){this.#n||(this.#n=t)}};var et=window.matchMedia("(prefers-reduced-motion: reduce)");var M=new Map;function T(s,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},o=M.get(s);if(customElements.get(s)){if(!o||o.priority>=n){o&&o.priority===n&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=n){o.priority===n&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${o.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}M.set(s,i),customElements.define(s,t)}function K(){let s=globalThis.localStorage;if(!s)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return s.getItem(t)},async setRaw(t,e){s.setItem(t,e)},async removeRaw(t){s.removeItem(t)},async keys(t){let e=[];for(let n=0;n<s.length;n++){let i=s.key(n);i&&i.startsWith(t)&&e.push(i)}return e}}}var S="__vbStoreBackend",C=globalThis;function u(){return C[S]||(C[S]=K()),C[S]}function A(s,t){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${s}:${t}`}function $(s){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${s}:`}function B(s){try{let t=JSON.parse(s);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var b={configure(s={}){C[S]=s.backend??null},async set(s,t,e){let n={data:e,timestamp:Date.now()};await u().setRaw(A(s,t),JSON.stringify(n))},async get(s,t,e){let n=await u().getRaw(A(s,t));if(n==null)return null;let i=B(n);return!i||e?.maxAge!=null&&Date.now()-i.timestamp>e.maxAge?null:i.data},async remove(s,t){await u().removeRaw(A(s,t))},async list(s){let t=$(s),e=await u().keys(t),n=[];for(let i of e){let o=await u().getRaw(i);if(o==null)continue;let r=B(o);r&&n.push({key:i.slice(t.length),data:r.data,timestamp:r.timestamp})}return n},async clear(s){let t=$(s),e=await u().keys(t);for(let n of e)await u().removeRaw(n)},async clearAll(){let s=await u().keys("vb:");for(let t of s)await u().removeRaw(t)},async setMany(s,t){for(let[e,n]of t)await b.set(s,e,n)}};if(typeof window<"u"){let s=window.VB??(window.VB={});s.store??=b}var N="[data-highlights]",H="highlights",z=["yellow","green","blue","pink"];var U=typeof CSS<"u"&&"highlights"in CSS;function _(s){let t=2166136261;for(let e=0;e<s.length;e++)t^=s.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function W(){return"hn-"+crypto.randomUUID().slice(0,8)}var G=/^[a-z0-9_-]+$/i;function I(s){return typeof s=="string"&&G.test(s)}var g=null,p=new Map,E=new Map;function D(){if(p.size===0){g&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(t=>t!==g),g=null);return}g||(g=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,g]);let s=[...p.keys()].map(t=>`::highlight(hn-${t}) { background-color: var(--highlight-${t}); text-decoration-line: underline; text-decoration-color: var(--highlight-${t}); text-underline-offset: 2px; }`).join(`
2
+ `);g.replaceSync(s)}function J(s){for(let t of s)p.set(t,(p.get(t)??0)+1);D()}function Y(s){for(let t of s){let e=(p.get(t)??0)-1;e>0?p.set(t,e):p.delete(t)}D()}function j(s){let t=E.get(s),e=t?[...t.values()].flat():[];e.length===0?(CSS.highlights.delete(`hn-${s}`),E.delete(s)):CSS.highlights.set(`hn-${s}`,new Highlight(...e))}function P(s,t){let e=new Set(t.keys());for(let[n,i]of E)i.has(s)&&e.add(n);for(let n of e){let i=t.get(n)??[],o=E.get(n);i.length?(o||E.set(n,o=new Map),o.set(s,i)):o?.delete(s),j(n)}}var f=null;function k(s){f||(f=document.createElement("div"),f.setAttribute("aria-live","polite"),f.setAttribute("aria-atomic","true"),f.className="hn-sr-only",document.body.appendChild(f)),f.textContent="",requestAnimationFrame(()=>{f.textContent=s})}function F(s,t,e){let n=document.createTreeWalker(s,NodeFilter.SHOW_TEXT),i=0;for(;n.nextNode();){if(n.currentNode===t)return i+e;i+=(n.currentNode.textContent??"").length}return-1}function m(s,t,e){let n=document.createTreeWalker(s,NodeFilter.SHOW_TEXT),i=0,o=null,r=0,c=null,a=0;for(;n.nextNode();){let l=n.currentNode,h=(l.textContent??"").length;if(!o&&i+h>t&&(o=l,r=t-i),i+h>=e){c=l,a=e-i;break}i+=h}if(!o||!c)return null;try{let l=document.createRange();return l.setStart(o,Math.min(r,(o.textContent??"").length)),l.setEnd(c,Math.min(a,(c.textContent??"").length)),l}catch{return null}}var O=class{#t;#n;#o;#l;#e=[];#r=!U;#i;#h;#d=!1;#u=[];constructor(t){this.#t=t,this.#l=t.hasAttribute("data-highlights-readonly");let e=t.dataset.highlights;this.#n=e&&e!==""?e:location.pathname;let n=t.dataset.highlightsColors,i=n?n.split(",").map(o=>o.trim()).filter(I):[...z];this.#o=[...new Set(i)],this.#r||J(this.#o),this.#c(),this.#l||(this.#i=this.#p.bind(this),this.#h=this.#m.bind(this),t.addEventListener("pointerup",this.#i),t.addEventListener("click",this.#h)),t.setAttribute("data-highlights-init",""),this.#w().then(()=>{this.#d||this.#c()})}get colors(){return[...this.#o]}get element(){return this.#t}getHighlights(){return this.#e.map(t=>({...t}))}removeHighlight(t){let e=this.#e.findIndex(n=>n.id===t);e<0||(this.#e.splice(e,1),this.#a(),this.#c(),this.#s("highlights:removed",{id:t}),k("Highlight removed"))}clearAll(){this.#e=[],this.#a(),this.#c()}exportHighlights(){return JSON.stringify({version:1,highlights:this.#e})}importHighlights(t){try{let e=typeof t=="string"?JSON.parse(t):t;if(!e.highlights||!Array.isArray(e.highlights))return;this.#e=e.highlights,this.#a(),this.#c()}catch{}}destroy(){this.#d||(this.#d=!0,this.#i&&this.#t.removeEventListener("pointerup",this.#i),this.#h&&this.#t.removeEventListener("click",this.#h),this.#r?this.#t.querySelectorAll("mark[data-hn-id]").forEach(t=>{let e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t),e.normalize()}):(P(this,new Map),Y(this.#o)),this.#f(),this.#t.removeAttribute("data-highlights-init"))}#p(){requestAnimationFrame(()=>{if(this.#d)return;let t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return;let e=t.getRangeAt(0);this.#t.contains(e.commonAncestorContainer)&&this.#s("highlights:selected",{text:t.toString().trim(),rect:e.getBoundingClientRect()})})}#m(t){let e=t.target.closest?.(".hn-margin-annotation");if(e){let i=e.dataset.hnId,o=this.#e.find(r=>r.id===i);if(o){this.#s("highlights:clicked",{id:i,highlight:{...o}}),this.#s("highlights:request-note",{id:i,highlight:{...o},controller:this});return}}let n=t.target.closest?.("mark[data-hn-id]");if(n){let i=n.dataset.hnId,o=this.#e.find(r=>r.id===i);if(o){this.#s("highlights:clicked",{id:i,highlight:{...o}});return}}if(!this.#r){let i=this.#y(t.clientX,t.clientY);i&&this.#s("highlights:clicked",{id:i.id,highlight:{...i}})}}findHighlightRect(t){let e=this.#e.find(o=>o.id===t);if(!e)return null;let n=m(this.#t,e.startOffset,e.endOffset);if(!n)return null;let i=n.getClientRects();return i.length?i[0]:null}#y(t,e){for(let n of this.#e){let i=m(this.#t,n.startOffset,n.endOffset);if(!i)continue;let o=i.getClientRects();for(let r of o)if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom)return n}return null}_createFromSelection(t){let e=window.getSelection();if(!e||e.isCollapsed)return;let n=e.getRangeAt(0);if(!this.#t.contains(n.commonAncestorContainer))return;let i=F(this.#t,n.startContainer,n.startOffset),o=F(this.#t,n.endContainer,n.endOffset);if(i<0||o<0||i>=o)return;let r=e.toString().trim(),c={id:W(),startOffset:i,endOffset:o,text:r,color:t,note:"",created:Date.now()};this.#e.push(c),this.#a(),this.#c(),e.removeAllRanges(),this.#s("highlights:added",{id:c.id,text:r,color:t,note:""}),k("Highlight added")}_changeColor(t,e){let n=this.#e.find(i=>i.id===t);n&&(n.color=e,this.#a(),this.#c())}_updateNote(t,e){let n=this.#e.find(i=>i.id===t);n&&(n.note=e,this.#a(),this.#g(),this.#s("highlights:note-changed",{id:t,note:e}),k("Note saved"))}async#w(){let t=await b.get(H,this.#n);if(!t||!Array.isArray(t.highlights))return;let e=_(this.#t.textContent);t.contentHash&&t.contentHash!==e?(this.#e=t.highlights.filter(n=>{let i=m(this.#t,n.startOffset,n.endOffset);return i?i.toString().trim()===n.text:!1}),this.#a()):this.#e=t.highlights}#a(){let t={version:1,contentHash:_(this.#t.textContent),highlights:this.#e};b.set(H,this.#n,t).catch(()=>{})}#c(){this.#r?this.#E():this.#b(),this.#g()}#b(){let t=new Map;for(let e of this.#o)t.set(e,[]);for(let e of this.#e){let n=m(this.#t,e.startOffset,e.endOffset);n&&t.has(e.color)&&t.get(e.color).push(n)}P(this,t)}#E(){this.#t.querySelectorAll("mark[data-hn-id]").forEach(e=>{let n=e.parentNode;for(;e.firstChild;)n.insertBefore(e.firstChild,e);n.removeChild(e)}),this.#t.normalize();let t=[...this.#e].sort((e,n)=>n.startOffset-e.startOffset);for(let e of t){let n=m(this.#t,e.startOffset,e.endOffset);if(!n)continue;let i=document.createElement("mark");i.dataset.hnId=e.id,I(e.color)&&(i.dataset.hnColor=e.color,i.style.setProperty("--_hn-color",`var(--highlight-${e.color})`));try{n.surroundContents(i)}catch{let o=n.extractContents();i.appendChild(o),n.insertNode(i)}}}#f(){for(let t of this.#u)t.remove();this.#u=[]}#g(){if(this.#f(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");for(let e of this.#e){let n=m(this.#t,e.startOffset,e.endOffset);if(!n)continue;let i=n.getClientRects();if(i.length===0)continue;let o=i[0],r=this.#t.getBoundingClientRect(),c=o.top-r.top,a=document.createElement("span");a.className="hn-margin-annotation",a.dataset.hnId=e.id,a.setAttribute("aria-hidden","true"),a.style.top=`${c}px`,e.note?(a.innerHTML='<span class="hn-note-indicator">*</span> You highlighted',a.classList.add("hn-has-note")):a.textContent="You highlighted",this.#t.appendChild(a),this.#u.push(a)}}#s(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}},x=new WeakMap;function y(s){if(x.has(s))return x.get(s);let t=new O(s);return x.set(s,t),t}function q(s=document){s.querySelectorAll(N).forEach(t=>{t.hasAttribute("data-highlights-init")||y(t)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>q()):q();var Q=new MutationObserver(s=>{for(let t of s)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let n=e;n.matches(N)&&y(n),n.querySelectorAll(N).forEach(i=>{i.hasAttribute("data-highlights-init")||y(i)})}});Q.observe(document.documentElement,{childList:!0,subtree:!0});var V=!1,R=new Set,L=class extends v{#t=!1;#n=null;setup(){this.#t=!!this.closest("selection-menu");let t=document.createElement("button");t.type="button",t.setAttribute("aria-label",this.#t?"Add private note":"View notes");let e=document.createElement("icon-wc");e.setAttribute("name","sticky-note"),e.setAttribute("size","sm"),e.setAttribute("aria-hidden","true"),t.appendChild(e),this.#t?t.addEventListener("click",()=>this.#o()):t.addEventListener("click",()=>this.#l()),this.appendChild(t),R.add(this),V||(V=!0,document.addEventListener("highlights:request-note",Z))}teardown(){R.delete(this),this.#i()}openFor(t,e){this.#e(t,e)}#o(){let t=this.closest("selection-menu");if(!t)return;let e=t.getSelection();if(!e)return;let n=e.target;n.hasAttribute("data-highlights-init")||n.setAttribute("data-highlights","");let i=y(n),o=i.getHighlights(),r=null;for(let c of o)if(e.text&&c.text&&e.text.includes(c.text.slice(0,20))){r=c;break}if(!r){i._createFromSelection("yellow");let c=i.getHighlights();r=c[c.length-1]}r&&this.#e(r,i),t.dismiss()}#l(){let t=this.getAttribute("for"),e=t?document.getElementById(t):null;if(!e)return;e.hasAttribute("data-highlights-init")||e.setAttribute("data-highlights","");let n=y(e),i=n.getHighlights(),o=i.filter(r=>r.note);o.length>0?this.#e(o[0],n):i.length>0&&this.#e(i[0],n)}#e(t,e){this.#i();let n=e.element,i=document.createElement("div");i.className="hn-note-panel",i.setAttribute("role","dialog"),i.setAttribute("aria-label","Private note");let o=document.createElement("header");o.className="hn-note-header";let r=document.createElement("small");r.textContent="PRIVATE NOTE",o.appendChild(r),i.appendChild(o);let c=document.createElement("blockquote");c.className="hn-note-quote",c.textContent=t.text.length>80?t.text.slice(0,80)+"\u2026":t.text,i.appendChild(c);let a=document.createElement("textarea");a.className="hn-note-textarea",a.placeholder="Add a note\u2026",a.value=t.note||"",a.rows=3,a.setAttribute("aria-label","Note for highlighted text"),i.appendChild(a);let l=document.createElement("footer");l.className="hn-note-actions";let h=document.createElement("button");h.type="button",h.className="hn-action hn-action-save",h.textContent="Save",h.addEventListener("click",()=>{e._updateNote(t.id,a.value.trim()),this.#i()});let w=document.createElement("button");if(w.type="button",w.className="hn-action",w.textContent="Cancel",w.addEventListener("click",()=>this.#i()),l.append(h,w),i.appendChild(l),a.addEventListener("keydown",d=>{d.key==="Escape"&&(d.preventDefault(),this.#i()),d.key==="Enter"&&(d.metaKey||d.ctrlKey)&&(d.preventDefault(),e._updateNote(t.id,a.value.trim()),this.#i())}),getComputedStyle(n).position==="static"&&(n.style.position="relative"),n.appendChild(i),typeof e.findHighlightRect=="function"){let d=e.findHighlightRect(t.id);if(d){let X=n.getBoundingClientRect();i.style.top=`${d.top-X.top}px`}}this.#n=i,requestAnimationFrame(()=>{a.focus(),document.addEventListener("pointerdown",this.#r)})}#r=t=>{this.#n&&!this.#n.contains(t.target)&&this.#i()};#i(){this.#n&&(document.removeEventListener("pointerdown",this.#r),this.#n.remove(),this.#n=null)}};function Z(s){let{highlight:t,controller:e}=s.detail||{};if(!t||!e)return;let n=R.values().next().value;n&&n.openFor(t,e)}T("note-wc",L);
3
3
  //# sourceMappingURL=note-wc.js.map
@@ -1,4 +1,4 @@
1
- var B=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;function k(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},a=E.get(s);if(customElements.get(s)){if(!a||a.priority>=i){a&&a.priority===i&&a.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${a.bundle}" (priority ${a.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${a.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(a&&a.priority>=i){a.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${a.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}E.set(s,n),customElements.define(s,t)}var y=class extends HTMLElement{#i=[];#s;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#i)t();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#i.push(()=>t.removeEventListener(e,i,n))}setup(){}teardown(){}setState(t,e){this.#s||(this.#s=this.attachInternals());let i=this.#s.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#s||(this.#s=t)}};function q(){let s=globalThis.localStorage;if(!s)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return s.getItem(t)},async setRaw(t,e){s.setItem(t,e)},async removeRaw(t){s.removeItem(t)},async keys(t){let e=[];for(let i=0;i<s.length;i++){let n=s.key(i);n&&n.startsWith(t)&&e.push(n)}return e}}}var m=null;function u(){return m||(m=q()),m}function g(s,t){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${s}:${t}`}function A(s){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${s}:`}function $(s){try{let t=JSON.parse(s);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var h={configure(s={}){m=s.backend??null},async set(s,t,e){let i={data:e,timestamp:Date.now()};await u().setRaw(g(s,t),JSON.stringify(i))},async get(s,t,e){let i=await u().getRaw(g(s,t));if(i==null)return null;let n=$(i);return!n||e?.maxAge!=null&&Date.now()-n.timestamp>e.maxAge?null:n.data},async remove(s,t){await u().removeRaw(g(s,t))},async list(s){let t=A(s),e=await u().keys(t),i=[];for(let n of e){let a=await u().getRaw(n);if(a==null)continue;let r=$(a);r&&i.push({key:n.slice(t.length),data:r.data,timestamp:r.timestamp})}return i},async clear(s){let t=A(s),e=await u().keys(t);for(let i of e)await u().removeRaw(i)},async clearAll(){let s=await u().keys("vb:");for(let t of s)await u().removeRaw(t)},async setMany(s,t){for(let[e,i]of t)await h.set(s,e,i)}};var d={baseUrl:"/go",headers:{},services:{}},b=class extends Error{constructor(t,e,i,n){super(`VBService(${i}): ${t} ${n}`),this.name="VBServiceError",this.status=t,this.body=e,this.role=i,this.path=n}};function T(s,t){if(!t)return s;let e=s??new URLSearchParams;for(let[i,n]of Object.entries(t))n!=null&&e.set(i,String(n));return e}async function x(s){if((s.headers.get("content-type")??"").includes("application/json"))try{return await s.json()}catch{return null}try{return await s.text()}catch{return null}}var w=class s{static configure(t={}){d={baseUrl:t.baseUrl??d.baseUrl,headers:{...d.headers,...t.headers??{}},services:{...d.services,...t.services??{}}}}static resolve(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");return d.services[t]?C(d.services[t]):d.baseUrl?`${C(d.baseUrl)}/${t}`:`/go/${t}`}static _reset(){d={baseUrl:"/go",headers:{},services:{}}}constructor(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");this.role=t}async get(t,e){return this.#i("GET",t,{params:e})}async post(t,e){return this.#i("POST",t,{body:e})}async patch(t,e){return this.#i("PATCH",t,{body:e})}async delete(t){return this.#i("DELETE",t,{})}async#i(t,e,i){let n=s.resolve(this.role),a=e?e.startsWith("/")?e:`/${e}`:"",r=new URL(`${n}${a}`,globalThis.location?.origin??"http://localhost"),l=T(r.searchParams,i.params);l&&(r.search=l.toString());let o={method:t,headers:{...d.headers}};i.body!==void 0&&(o.body=JSON.stringify(i.body),o.headers["content-type"]="application/json");let p=r.toString(),f=await fetch(p,o),S=await x(f);if(!f.ok)throw new b(f.status,S,this.role,`${a||"/"}`);return S}};function C(s){return s.endsWith("/")?s.slice(0,-1):s}var N={update:"package",alert:"alert-triangle",watch:"eye",system:"settings",message:"mail",stewardship:"shield"};function c(s){return String(s??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}var v=class extends y{#i="panel";#s=null;#e=null;#t=null;#o=null;#n=new Set;#r=[];#c=!1;#u=null;#g=new Set;#b="all";#a=[];setup(){return this.#i=this.getAttribute("mode")==="banner"?"banner":"panel",this.#i==="banner"?this.#v():this.#E(),!0}teardown(){this.#u!=null&&(clearInterval(this.#u),this.#u=null)}get notifications(){return[...this.#r]}set notifications(t){this.#i==="panel"&&(this.#r=Array.isArray(t)?t:[],typeof this.#l=="function"&&this.#l(),typeof this.#d=="function"&&this.#d(),this.dispatchEvent(new CustomEvent("notification-wc:notifications-changed",{detail:{notifications:this.#r,source:"property"},bubbles:!0})))}async#v(){let t=this.getAttribute("persist");if(t||console.warn("[notification-wc] banner mode requires a persist attribute"),this.dataset.mode="banner",this.dataset.variant=this.getAttribute("variant")||"info",this.dataset.position=this.getAttribute("position")||"top",t){let i=Number(this.getAttribute("expires")??""),n=Number.isFinite(i)&&i>0?i*864e5:void 0,a=await h.get("notifications",t,n?{maxAge:n}:void 0);if(a&&a.dismissed){this.hidden=!0;return}}let e=this.querySelector('[value="dismiss"], [data-dismiss]');e&&(this.#s=e,this.listen(e,"click",this.#S))}#S=async t=>{t.preventDefault();let e=this.getAttribute("persist");e&&await h.set("notifications",e,{dismissed:!0}),this.dispatchEvent(new CustomEvent("notification-wc:dismiss",{bubbles:!0,composed:!0,detail:{id:e}})),this.hidden=!0};async#E(){if(this.dataset.mode="panel",await this.#k(),this.#A(),this.#$(),await this.#h(),this.#d(),this.listen(document,"click",this.#B),this.listen(document,"keydown",this.#M),this.listen(document,"page-watch:add",()=>this.#h()),this.listen(document,"page-watch:remove",()=>this.#h()),this.getAttribute("src")){await this.#w();let t=Number(this.getAttribute("poll"));Number.isFinite(t)&&t>0&&(this.#u=setInterval(()=>this.#w(),t))}}async#k(){let t=this.getAttribute("storage-key")||"notifications",e=await h.get(t,"read-ids");Array.isArray(e)&&(this.#n=new Set(e.filter(i=>typeof i=="string")))}async#y(){let t=this.getAttribute("storage-key")||"notifications";await h.set(t,"read-ids",Array.from(this.#n))}#A(){if(this.#e=this.querySelector(":scope > [data-trigger]"),this.#e){let t=this.#e.querySelector(".notification-badge");t||(t=document.createElement("span"),t.className="notification-badge",t.hidden=!0,this.#e.appendChild(t))}else{let t=document.createElement("button");t.type="button",t.setAttribute("data-trigger",""),t.className="notification-trigger",t.setAttribute("aria-label","Notifications"),t.innerHTML='<icon-wc name="bell" size="sm"></icon-wc><span class="notification-badge" hidden>0</span>',this.#e=t,this.prepend(t)}this.#o=this.#e.querySelector(".notification-badge"),this.#e.setAttribute("aria-haspopup","dialog"),this.#e.setAttribute("aria-expanded","false"),this.listen(this.#e,"click",this.#N)}#$(){this.#t=document.createElement("div"),this.#t.className="notification-panel",this.#t.setAttribute("role","dialog"),this.#t.setAttribute("aria-label","Notifications"),this.#t.hidden=!0;let t=`notification-panel-${crypto.randomUUID().slice(0,8)}`;this.#t.id=t,this.#e?.setAttribute("aria-controls",t),this.#t.innerHTML=`
1
+ var R=window.matchMedia("(prefers-reduced-motion: reduce)");var $=new Map;function C(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},a=$.get(s);if(customElements.get(s)){if(!a||a.priority>=i){a&&a.priority===i&&a.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${a.bundle}" (priority ${a.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${a.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(a&&a.priority>=i){a.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${a.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}$.set(s,n),customElements.define(s,t)}var w=class extends HTMLElement{#i=[];#s;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#i)t();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#i.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#i)t();this.#i=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#s||(this.#s=this.attachInternals());let i=this.#s.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#s||(this.#s=t)}};function N(){let s=globalThis.localStorage;if(!s)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return s.getItem(t)},async setRaw(t,e){s.setItem(t,e)},async removeRaw(t){s.removeItem(t)},async keys(t){let e=[];for(let i=0;i<s.length;i++){let n=s.key(i);n&&n.startsWith(t)&&e.push(n)}return e}}}var g="__vbStoreBackend",v=globalThis;function d(){return v[g]||(v[g]=N()),v[g]}function E(s,t){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${s}:${t}`}function T(s){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${s}:`}function q(s){try{let t=JSON.parse(s);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var u={configure(s={}){v[g]=s.backend??null},async set(s,t,e){let i={data:e,timestamp:Date.now()};await d().setRaw(E(s,t),JSON.stringify(i))},async get(s,t,e){let i=await d().getRaw(E(s,t));if(i==null)return null;let n=q(i);return!n||e?.maxAge!=null&&Date.now()-n.timestamp>e.maxAge?null:n.data},async remove(s,t){await d().removeRaw(E(s,t))},async list(s){let t=T(s),e=await d().keys(t),i=[];for(let n of e){let a=await d().getRaw(n);if(a==null)continue;let r=q(a);r&&i.push({key:n.slice(t.length),data:r.data,timestamp:r.timestamp})}return i},async clear(s){let t=T(s),e=await d().keys(t);for(let i of e)await d().removeRaw(i)},async clearAll(){let s=await d().keys("vb:");for(let t of s)await d().removeRaw(t)},async setMany(s,t){for(let[e,i]of t)await u.set(s,e,i)}};if(typeof window<"u"){let s=window.VB??(window.VB={});s.store??=u}var b="__vbServiceConfig",y=globalThis,B=()=>({baseUrl:"/go",headers:{},services:{}});y[b]||(y[b]=B());var S=()=>y[b],f=class extends Error{constructor(t,e,i,n){super(`VBService(${i}): ${t} ${n}`),this.name="VBServiceError",this.status=t,this.body=e,this.role=i,this.path=n}};function M(s,t){if(!t)return s;let e=s??new URLSearchParams;for(let[i,n]of Object.entries(t))n!=null&&e.set(i,String(n));return e}async function I(s){if((s.headers.get("content-type")??"").includes("application/json"))try{return await s.json()}catch{return null}try{return await s.text()}catch{return null}}var m=class s{static configure(t={}){let e=S();y[b]={baseUrl:t.baseUrl??e.baseUrl,headers:{...e.headers,...t.headers??{}},services:{...e.services,...t.services??{}}}}static resolve(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");let e=S();return e.services[t]?x(e.services[t]):e.baseUrl?`${x(e.baseUrl)}/${t}`:`/go/${t}`}static _reset(){y[b]=B()}constructor(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");this.role=t}async get(t,e){return this.#i("GET",t,{params:e})}async post(t,e){return this.#i("POST",t,{body:e})}async patch(t,e){return this.#i("PATCH",t,{body:e})}async delete(t){return this.#i("DELETE",t,{})}async#i(t,e,i){let n=s.resolve(this.role),a=e?e.startsWith("/")?e:`/${e}`:"",r=new URL(`${n}${a}`,globalThis.location?.origin??"http://localhost"),l=M(r.searchParams,i.params);l&&(r.search=l.toString());let o={method:t,headers:{...S().headers}};i.body!==void 0&&(o.body=JSON.stringify(i.body),o.headers["content-type"]="application/json");let p=r.toString(),h=await fetch(p,o),k=await I(h);if(!h.ok)throw new f(h.status,k,this.role,`${a||"/"}`);return k}};function x(s){return s.endsWith("/")?s.slice(0,-1):s}if(typeof window<"u"){let s=window.VB??(window.VB={});s.service??=m,s.ServiceError??=f}var L={update:"package",alert:"alert-triangle",watch:"eye",system:"settings",message:"mail",stewardship:"shield"};function c(s){return String(s??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}var A=class extends w{#i="panel";#s=null;#e=null;#t=null;#o=null;#n=new Set;#r=[];#c=!1;#u=null;#g=new Set;#b="all";#a=[];setup(){return this.#i=this.getAttribute("mode")==="banner"?"banner":"panel",this.#i==="banner"?this.#v():this.#S(),!0}teardown(){this.#u!=null&&(clearInterval(this.#u),this.#u=null)}get notifications(){return[...this.#r]}set notifications(t){this.#i==="panel"&&(this.#r=Array.isArray(t)?t:[],typeof this.#l=="function"&&this.#l(),typeof this.#d=="function"&&this.#d(),this.dispatchEvent(new CustomEvent("notification-wc:notifications-changed",{detail:{notifications:this.#r,source:"property"},bubbles:!0})))}async#v(){let t=this.getAttribute("persist");if(t||console.warn("[notification-wc] banner mode requires a persist attribute"),this.dataset.mode="banner",this.dataset.variant=this.getAttribute("variant")||"info",this.dataset.position=this.getAttribute("position")||"top",t){let i=Number(this.getAttribute("expires")??""),n=Number.isFinite(i)&&i>0?i*864e5:void 0,a=await u.get("notifications",t,n?{maxAge:n}:void 0);if(a&&a.dismissed){this.hidden=!0;return}}let e=this.querySelector('[value="dismiss"], [data-dismiss]');e&&(this.#s=e,this.listen(e,"click",this.#E))}#E=async t=>{t.preventDefault();let e=this.getAttribute("persist");e&&await u.set("notifications",e,{dismissed:!0}),this.dispatchEvent(new CustomEvent("notification-wc:dismiss",{bubbles:!0,composed:!0,detail:{id:e}})),this.hidden=!0};async#S(){if(this.dataset.mode="panel",await this.#A(),this.#k(),this.#$(),await this.#h(),this.#d(),this.listen(document,"click",this.#N),this.listen(document,"keydown",this.#M),this.listen(document,"page-watch:add",()=>this.#h()),this.listen(document,"page-watch:remove",()=>this.#h()),this.getAttribute("src")){await this.#w();let t=Number(this.getAttribute("poll"));Number.isFinite(t)&&t>0&&(this.#u=setInterval(()=>this.#w(),t))}}async#A(){let t=this.getAttribute("storage-key")||"notifications",e=await u.get(t,"read-ids");Array.isArray(e)&&(this.#n=new Set(e.filter(i=>typeof i=="string")))}async#y(){let t=this.getAttribute("storage-key")||"notifications";await u.set(t,"read-ids",Array.from(this.#n))}#k(){if(this.#e=this.querySelector(":scope > [data-trigger]"),this.#e){let t=this.#e.querySelector(".notification-badge");t||(t=document.createElement("span"),t.className="notification-badge",t.hidden=!0,this.#e.appendChild(t))}else{let t=document.createElement("button");t.type="button",t.setAttribute("data-trigger",""),t.className="notification-trigger",t.setAttribute("aria-label","Notifications"),t.innerHTML='<icon-wc name="bell" size="sm"></icon-wc><span class="notification-badge" hidden>0</span>',this.#e=t,this.prepend(t)}this.#o=this.#e.querySelector(".notification-badge"),this.#e.setAttribute("aria-haspopup","dialog"),this.#e.setAttribute("aria-expanded","false"),this.listen(this.#e,"click",this.#B)}#$(){this.#t=document.createElement("div"),this.#t.className="notification-panel",this.#t.setAttribute("role","dialog"),this.#t.setAttribute("aria-label","Notifications"),this.#t.hidden=!0;let t=`notification-panel-${crypto.randomUUID().slice(0,8)}`;this.#t.id=t,this.#e?.setAttribute("aria-controls",t),this.#t.innerHTML=`
2
2
  <header class="notification-header">
3
3
  <strong>Notifications</strong>
4
4
  <button type="button" class="notification-mark-all">Mark all read</button>
@@ -12,7 +12,7 @@ var B=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;functi
12
12
  <footer class="notification-footer" hidden>
13
13
  <em>No notifications</em>
14
14
  </footer>
15
- `,this.appendChild(this.#t);let e=this.#t.querySelector(".notification-mark-all");e&&this.listen(e,"click",this.#I);for(let i of this.#t.querySelectorAll('[role="tab"]'))this.listen(i,"click",this.#T);this.#l()}#f(){let t=Array.from(this.querySelectorAll(":scope > article")),e=new Map;for(let i of t){let n=i.getAttribute("data-id")||i.id||`static-${e.size}`,a=i.getAttribute("data-type")||"update",r=i.getAttribute("data-date")||"",l=i.querySelector("h1, h2, h3, h4, h5, h6")?.textContent?.trim()||n,p=i.querySelector("p")?.textContent?.trim()||"",f=i.querySelector("a");e.set(n,{id:n,type:a,date:r,title:l,body:p,url:f?.getAttribute("href")||null,source:"static"})}for(let i of this.#r)if(!(!i||typeof i.id!="string")){if(i.dismissed){e.delete(i.id);continue}e.set(i.id,{...e.get(i.id),...i,source:"dynamic"})}return Array.from(e.values()).sort((i,n)=>{let a=i.date?Date.parse(i.date):0;return(n.date?Date.parse(n.date):0)-a})}#l(){if(!this.#t)return;let t=this.#t.querySelector(".notification-list"),e=this.#t.querySelector(".notification-footer");if(!t)return;let i=this.#f();t.innerHTML=i.map(n=>this.#C(n)).join(""),e&&(e.hidden=i.length>0);for(let n of t.querySelectorAll("[data-notification-id]"))this.listen(n,"click",this.#L);this.#d()}#C(t){let e=N[t.type]||"bell",i=this.#n.has(t.id),n=t.date?new Date(t.date).toLocaleString():"",a=`
15
+ `,this.appendChild(this.#t);let e=this.#t.querySelector(".notification-mark-all");e&&this.listen(e,"click",this.#L);for(let i of this.#t.querySelectorAll('[role="tab"]'))this.listen(i,"click",this.#q);this.#l()}#f(){let t=Array.from(this.querySelectorAll(":scope > article")),e=new Map;for(let i of t){let n=i.getAttribute("data-id")||i.id||`static-${e.size}`,a=i.getAttribute("data-type")||"update",r=i.getAttribute("data-date")||"",l=i.querySelector("h1, h2, h3, h4, h5, h6")?.textContent?.trim()||n,p=i.querySelector("p")?.textContent?.trim()||"",h=i.querySelector("a");e.set(n,{id:n,type:a,date:r,title:l,body:p,url:h?.getAttribute("href")||null,source:"static"})}for(let i of this.#r)if(!(!i||typeof i.id!="string")){if(i.dismissed){e.delete(i.id);continue}e.set(i.id,{...e.get(i.id),...i,source:"dynamic"})}return Array.from(e.values()).sort((i,n)=>{let a=i.date?Date.parse(i.date):0;return(n.date?Date.parse(n.date):0)-a})}#l(){if(!this.#t)return;let t=this.#t.querySelector(".notification-list"),e=this.#t.querySelector(".notification-footer");if(!t)return;let i=this.#f();t.innerHTML=i.map(n=>this.#C(n)).join(""),e&&(e.hidden=i.length>0);for(let n of t.querySelectorAll("[data-notification-id]"))this.listen(n,"click",this.#I);this.#d()}#C(t){let e=L[t.type]||"bell",i=this.#n.has(t.id),n=t.date?new Date(t.date).toLocaleString():"",a=`
16
16
  <icon-wc class="notification-type-icon" name="${c(e)}" size="sm"></icon-wc>
17
17
  <div class="notification-body">
18
18
  <h4>${c(t.title)}</h4>
@@ -21,7 +21,7 @@ var B=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;functi
21
21
  </div>
22
22
  `,r=t.url?"a":"button",l=t.url?`href="${c(t.url)}"`:'type="button"';return`<li role="listitem" data-notification-id="${c(t.id)}" data-type="${c(t.type||"update")}"${i?" data-read":""}>
23
23
  <${r} class="notification-row" ${l}>${a}</${r}>
24
- </li>`}#d(){if(!this.#o)return;let e=this.#f().filter(i=>!this.#n.has(i.id)).length;e>0?(this.#o.textContent=String(e),this.#o.hidden=!1,this.#e?.querySelector("icon-wc")?.setAttribute("name","bell-dot")):(this.#o.hidden=!0,this.#e?.querySelector("icon-wc")?.setAttribute("name","bell"))}async#h(){try{this.#a=await h.list("watches")}catch{this.#a=[]}this.#m()}#m(){if(!this.#t)return;let t=this.#t.querySelector(".notification-watch-list"),e=this.#t.querySelector(".notification-tab-count");if(t){if(t.innerHTML=this.#a.map(i=>this.#q(i)).join("")||`<li class="notification-empty"><em>You aren't watching any pages yet. Use the &ldquo;Watch&rdquo; button on a page to start.</em></li>`,e){let i=this.#a.length;i>0?(e.textContent=String(i),e.hidden=!1):e.hidden=!0}for(let i of t.querySelectorAll("[data-watch-unwatch]"))this.listen(i,"click",this.#x)}}#q(t){let e=t.data||{},i=e.url||t.key,n=e.title||i,a=e.lastChecked?new Date(e.lastChecked).toLocaleString():"\u2014",r=!!e.lastChanged;return`<li class="notification-watch-item"${r?" data-changed":""}>
24
+ </li>`}#d(){if(!this.#o)return;let e=this.#f().filter(i=>!this.#n.has(i.id)).length;e>0?(this.#o.textContent=String(e),this.#o.hidden=!1,this.#e?.querySelector("icon-wc")?.setAttribute("name","bell-dot")):(this.#o.hidden=!0,this.#e?.querySelector("icon-wc")?.setAttribute("name","bell"))}async#h(){try{this.#a=await u.list("watches")}catch{this.#a=[]}this.#m()}#m(){if(!this.#t)return;let t=this.#t.querySelector(".notification-watch-list"),e=this.#t.querySelector(".notification-tab-count");if(t){if(t.innerHTML=this.#a.map(i=>this.#T(i)).join("")||`<li class="notification-empty"><em>You aren't watching any pages yet. Use the &ldquo;Watch&rdquo; button on a page to start.</em></li>`,e){let i=this.#a.length;i>0?(e.textContent=String(i),e.hidden=!1):e.hidden=!0}for(let i of t.querySelectorAll("[data-watch-unwatch]"))this.listen(i,"click",this.#x)}}#T(t){let e=t.data||{},i=e.url||t.key,n=e.title||i,a=e.lastChecked?new Date(e.lastChecked).toLocaleString():"\u2014",r=!!e.lastChanged;return`<li class="notification-watch-item"${r?" data-changed":""}>
25
25
  <a class="notification-watch-row" href="${c(i)}">
26
26
  <icon-wc class="notification-type-icon" name="eye" size="sm"></icon-wc>
27
27
  <div class="notification-body">
@@ -33,5 +33,5 @@ var B=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;functi
33
33
  <button type="button" class="notification-unwatch" data-watch-unwatch data-watch-key="${c(t.key)}" aria-label="Unwatch ${c(n)}">
34
34
  <icon-wc name="x" size="xs"></icon-wc>
35
35
  </button>
36
- </li>`}#T=t=>{let e=t.currentTarget.dataset.tab;if(!e||e===this.#b||(this.#b=e,!this.#t))return;for(let n of this.#t.querySelectorAll('[role="tab"]')){let a=n.dataset.tab===e;n.setAttribute("aria-selected",a?"true":"false")}for(let n of this.#t.querySelectorAll("[data-tab-panel]"))n.hidden=n.dataset.tabPanel!==e;let i=this.#t.querySelector(".notification-footer");i&&(i.hidden=!0)};#x=async t=>{t.preventDefault(),t.stopPropagation();let i=t.currentTarget.getAttribute("data-watch-key");if(!i)return;let n=this.#a.find(a=>a.key===i);await h.remove("watches",i),this.#a=this.#a.filter(a=>a.key!==i),this.#m(),this.dispatchEvent(new CustomEvent("page-watch:remove",{bubbles:!0,composed:!0,detail:{url:n?.data?.url||i,subscriptionId:n?.data?.subscriptionId||null}}))};#N=t=>{t.stopPropagation(),this.#c?this.#p():this.#R()};#B=t=>{this.#c&&!this.contains(t.target)&&this.#p()};#M=t=>{t.key==="Escape"&&this.#c&&(t.preventDefault(),this.#p(),this.#e?.focus())};#L=async t=>{let e=t.currentTarget.closest("[data-notification-id]");if(!e)return;let i=e.getAttribute("data-notification-id");i&&(this.#n.has(i)||(this.#n.add(i),e.setAttribute("data-read",""),await this.#y(),this.#d(),this.dispatchEvent(new CustomEvent("notification-wc:read",{bubbles:!0,composed:!0,detail:{id:i}}))))};#I=async()=>{let t=this.#f();for(let e of t)this.#n.add(e.id);await this.#y(),this.#l();for(let e of t)this.dispatchEvent(new CustomEvent("notification-wc:read",{bubbles:!0,composed:!0,detail:{id:e.id}}))};#R(){this.#t&&(this.#c=!0,this.#t.hidden=!1,this.#e?.setAttribute("aria-expanded","true"),this.#h(),this.dispatchEvent(new CustomEvent("notification-wc:open",{bubbles:!0,composed:!0})))}#p(){this.#t&&(this.#c=!1,this.#t.hidden=!0,this.#e?.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("notification-wc:close",{bubbles:!0,composed:!0})))}async#w(){let t=this.getAttribute("src");if(!t)return;let e,i=0;try{if(t.startsWith("http")||t.startsWith("/")){let o=await fetch(t,{headers:{accept:"application/json"}});if(i=o.status,!o.ok)throw new Error(`${o.status}`);e=await o.json()}else e=await new w(t).get("/")}catch(o){let p=o instanceof b?o.status:i;if(p===404||p===503)return;let f=o instanceof b?`${o.status}`:String(o);console.warn("[notification-wc] failed to fetch",t,f);return}let n=Array.isArray(e)?e:Array.isArray(e?.notifications)?e.notifications:[],a=this.#g,r=a.size===0,l=this.hasAttribute("toast-new")?document.querySelector("toast-msg"):null;for(let o of n)o?.id&&(a.has(o.id)||(this.dispatchEvent(new CustomEvent("notification-wc:new",{bubbles:!0,composed:!0,detail:{notification:o}})),!r&&l&&typeof l.show=="function"&&l.show({message:o.title||o.body||"New notification",variant:o.type==="alert"||o.type==="stewardship"?"warning":"info",duration:5e3})),a.add(o.id));this.#r=n,this.#l()}};k("notification-wc",v);export{v as NotificationWc};
36
+ </li>`}#q=t=>{let e=t.currentTarget.dataset.tab;if(!e||e===this.#b||(this.#b=e,!this.#t))return;for(let n of this.#t.querySelectorAll('[role="tab"]')){let a=n.dataset.tab===e;n.setAttribute("aria-selected",a?"true":"false")}for(let n of this.#t.querySelectorAll("[data-tab-panel]"))n.hidden=n.dataset.tabPanel!==e;let i=this.#t.querySelector(".notification-footer");i&&(i.hidden=!0)};#x=async t=>{t.preventDefault(),t.stopPropagation();let i=t.currentTarget.getAttribute("data-watch-key");if(!i)return;let n=this.#a.find(a=>a.key===i);await u.remove("watches",i),this.#a=this.#a.filter(a=>a.key!==i),this.#m(),this.dispatchEvent(new CustomEvent("page-watch:remove",{bubbles:!0,composed:!0,detail:{url:n?.data?.url||i,subscriptionId:n?.data?.subscriptionId||null}}))};#B=t=>{t.stopPropagation(),this.#c?this.#p():this.#R()};#N=t=>{this.#c&&!this.contains(t.target)&&this.#p()};#M=t=>{t.key==="Escape"&&this.#c&&(t.preventDefault(),this.#p(),this.#e?.focus())};#I=async t=>{let e=t.currentTarget.closest("[data-notification-id]");if(!e)return;let i=e.getAttribute("data-notification-id");i&&(this.#n.has(i)||(this.#n.add(i),e.setAttribute("data-read",""),await this.#y(),this.#d(),this.dispatchEvent(new CustomEvent("notification-wc:read",{bubbles:!0,composed:!0,detail:{id:i}}))))};#L=async()=>{let t=this.#f();for(let e of t)this.#n.add(e.id);await this.#y(),this.#l();for(let e of t)this.dispatchEvent(new CustomEvent("notification-wc:read",{bubbles:!0,composed:!0,detail:{id:e.id}}))};#R(){this.#t&&(this.#c=!0,this.#t.hidden=!1,this.#e?.setAttribute("aria-expanded","true"),this.#h(),this.dispatchEvent(new CustomEvent("notification-wc:open",{bubbles:!0,composed:!0})))}#p(){this.#t&&(this.#c=!1,this.#t.hidden=!0,this.#e?.setAttribute("aria-expanded","false"),this.dispatchEvent(new CustomEvent("notification-wc:close",{bubbles:!0,composed:!0})))}async#w(){let t=this.getAttribute("src");if(!t)return;let e,i=0;try{if(t.startsWith("http")||t.startsWith("/")){let o=await fetch(t,{headers:{accept:"application/json"}});if(i=o.status,!o.ok)throw new Error(`${o.status}`);e=await o.json()}else e=await new m(t).get("/")}catch(o){let p=o instanceof f?o.status:i;if(p===404||p===503)return;let h=o instanceof f?`${o.status}`:String(o);console.warn("[notification-wc] failed to fetch",t,h);return}let n=Array.isArray(e)?e:Array.isArray(e?.notifications)?e.notifications:[],a=this.#g,r=a.size===0,l=this.hasAttribute("toast-new")?document.querySelector("toast-msg"):null;for(let o of n)o?.id&&(a.has(o.id)||(this.dispatchEvent(new CustomEvent("notification-wc:new",{bubbles:!0,composed:!0,detail:{notification:o}})),!r&&l&&typeof l.show=="function"&&l.show({message:o.title||o.body||"New notification",variant:o.type==="alert"||o.type==="stewardship"?"warning":"info",duration:5e3})),a.add(o.id));this.#r=n,this.#l()}};C("notification-wc",A);export{A as NotificationWc};
37
37
  //# sourceMappingURL=notification-wc.js.map
@@ -1,4 +1,4 @@
1
- var J=window.matchMedia("(prefers-reduced-motion: reduce)");var M=new Map;function N(t,e,n={}){let i=n.priority??10,o={impl:e,bundle:n.bundle,contract:n.contract,priority:i},r=M.get(t);if(customElements.get(t)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${r.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}M.set(t,o),customElements.define(t,e)}var y=class extends HTMLElement{#n=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#n)e();this.#n=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,i,o){e.addEventListener(n,i,o),this.#n.push(()=>e.removeEventListener(n,i,o))}setup(){}teardown(){}setState(e,n){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{n?i.add(e):i.delete(e)}catch{let o=`--${e}`;n?i.add(o):i.delete(o)}}_adoptInternals(e){this.#e||(this.#e=e)}};var B="https://vanilla-breeze.com/specs/canonical-document-v1",F=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT","NAV","ASIDE","HEADER","FOOTER","FIGCAPTION","PAGE-INFO","CHANGE-SET","PAGE-TOC","PAGE-TOOLS","PAGE-STATS","CONTENT-LENS","BUTTON","DIALOG","MENU","FORM","DEL"]),U=new Set(["ARTICLE","SECTION","ASIDE","NAV","HEADER","FOOTER","DIV","MAIN","HGROUP","H1","H2","H3","H4","H5","H6","P","BLOCKQUOTE","PRE","HR","OL","UL","LI","DL","DT","DD","TABLE","THEAD","TBODY","TFOOT","TR","TD","TH","CAPTION","FIGURE","DETAILS","SUMMARY","ADDRESS","FORM","FIELDSET","LEGEND"]),_=new Set(["PRE","TEXTAREA"]);function V(t){return!t||t.nodeType!==1?!1:!!(F.has(t.tagName)||t.hasAttribute("hidden")||t.getAttribute("aria-hidden")==="true"||t.getAttribute("data-signable")==="false")}function D(t,e,n){if(V(t))return;let i=U.has(t.tagName),o=n||_.has(t.tagName);for(let r of t.childNodes)if(r.nodeType===3){let s=r.nodeValue||"";if(!s)continue;if(o)x(e,s.normalize("NFC"));else{let a=s.normalize("NFC").replace(/\s+/g," ");if(a===""||a===" "&&(e.text===""||e.text.endsWith(" ")||e.text.endsWith(`
1
+ var J=window.matchMedia("(prefers-reduced-motion: reduce)");var M=new Map;function N(t,e,n={}){let i=n.priority??10,o={impl:e,bundle:n.bundle,contract:n.contract,priority:i},r=M.get(t);if(customElements.get(t)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${r.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}M.set(t,o),customElements.define(t,e)}var y=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,i,o){e.addEventListener(n,i,o),this.#e.push(()=>e.removeEventListener(n,i,o))}_reinit(){for(let e of this.#e)e();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,n){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{n?i.add(e):i.delete(e)}catch{let o=`--${e}`;n?i.add(o):i.delete(o)}}_adoptInternals(e){this.#t||(this.#t=e)}};var B="https://vanilla-breeze.com/specs/canonical-document-v1",F=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT","NAV","ASIDE","HEADER","FOOTER","FIGCAPTION","PAGE-INFO","CHANGE-SET","PAGE-TOC","PAGE-TOOLS","PAGE-STATS","CONTENT-LENS","BUTTON","DIALOG","MENU","FORM","DEL"]),U=new Set(["ARTICLE","SECTION","ASIDE","NAV","HEADER","FOOTER","DIV","MAIN","HGROUP","H1","H2","H3","H4","H5","H6","P","BLOCKQUOTE","PRE","HR","OL","UL","LI","DL","DT","DD","TABLE","THEAD","TBODY","TFOOT","TR","TD","TH","CAPTION","FIGURE","DETAILS","SUMMARY","ADDRESS","FORM","FIELDSET","LEGEND"]),_=new Set(["PRE","TEXTAREA"]);function V(t){return!t||t.nodeType!==1?!1:!!(F.has(t.tagName)||t.hasAttribute("hidden")||t.getAttribute("aria-hidden")==="true"||t.getAttribute("data-signable")==="false")}function D(t,e,n){if(V(t))return;let i=U.has(t.tagName),o=n||_.has(t.tagName);for(let r of t.childNodes)if(r.nodeType===3){let s=r.nodeValue||"";if(!s)continue;if(o)x(e,s.normalize("NFC"));else{let a=s.normalize("NFC").replace(/\s+/g," ");if(a===""||a===" "&&(e.text===""||e.text.endsWith(" ")||e.text.endsWith(`
2
2
  `)))continue;x(e,a)}}else if(r.nodeType===1){if(r.tagName==="BR"){w(e,`
3
3
  `);continue}D(r,e,o)}i&&w(e,`
4
4
 
@@ -12,7 +12,7 @@ var J=window.matchMedia("(prefers-reduced-motion: reduce)");var M=new Map;functi
12
12
  `;return}e===`
13
13
  `&&t.text.endsWith(`
14
14
 
15
- `)||(t.text+=e)}}function G(t){let e=[...t.querySelectorAll("[data-signable]")],n=e.filter(o=>!e.some(r=>r!==o&&r.contains(o))),i={text:""};for(let o of n)D(o,i,!1);return i.text.replace(/^\s+/,"").replace(/\s+$/,"")}function f(t,e){return t.querySelector(`meta[name="${E(e)}"]`)?.getAttribute("content")||""}function $(t,e){return t.querySelector(`meta[property="${E(e)}"]`)?.getAttribute("content")||""}function z(t,e){return t.querySelector(`meta[itemprop="${E(e)}"]`)?.getAttribute("content")||""}function R(t,e){return t.querySelector(`link[rel="${E(e)}"]`)?.getAttribute("href")||""}function E(t){return String(t).replace(/[^a-zA-Z0-9:_\-/]/g,"")}function j(t){if(!t)return"";try{let e=new URL(t);e.search="",e.hash="";let n=`${e.protocol}//${e.hostname.toLowerCase()}`;return e.port&&(n+=`:${e.port}`),n+=e.pathname,n}catch{return t}}function O(t){if(!t)return"";let e=String(t).match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:""}function K(t){return $(t,"og:title")||t.title||""}function W(t){let e=f(t,"keywords");return e?e.split(",").map(n=>n.trim()).filter(Boolean):[]}function X(t){let e=new Set;for(let n of t.querySelectorAll('meta[name="concept"]')){let i=(n.getAttribute("content")||"").trim();i&&e.add(i)}return[...e].sort()}function Y(t){return R(t,"license")||f(t,"license")}function H(t,e={}){let n=e.url??t?.location?.href??"",i=O($(t,"article:published_time")),o=O(f(t,"last-modified")||$(t,"article:modified_time"));return{"@context":B,"@version":1,url:j(n),title:K(t),author:f(t,"author"),authorUrl:$(t,"article:author")||R(t,"author"),published:i,modified:o,version:z(t,"version"),keywords:W(t),concepts:X(t),provenance:f(t,"vb:provenance"),review:f(t,"vb:review"),status:f(t,"vb:status"),license:Y(t),content:G(t)}}function q(t){return JSON.stringify(t)}var C=class t extends y{setup(){this.hasAttribute("auto")&&this.#l(),this.#n(),this.#r(),this.#i(),this.#o()}#n(){for(let e of this.querySelectorAll("time[data-relative]")){let n=e.getAttribute("datetime");if(!n)continue;let i=t.#e(new Date(n));i&&(e.textContent=i)}}static#e(e){let i=Date.now()-e.getTime();if(i<0)return null;let o=Math.floor(i/1e3),r=Math.floor(o/60),s=Math.floor(r/60),a=Math.floor(s/24);return a>365?`${Math.floor(a/365)} year${Math.floor(a/365)!==1?"s":""} ago`:a>30?`${Math.floor(a/30)} month${Math.floor(a/30)!==1?"s":""} ago`:a>0?`${a} day${a!==1?"s":""} ago`:s>0?`${s} hour${s!==1?"s":""} ago`:r>0?`${r} minute${r!==1?"s":""} ago`:"just now"}#r(){let e=this.querySelector("[data-reading-time]");if(!e)return;let n=document.querySelectorAll("[data-signable]");if(!n.length)return;let i=0;for(let r of n){let s=r.textContent?.trim()||"";i+=s.split(/\s+/).filter(Boolean).length}let o=Math.max(1,Math.ceil(i/200));e.textContent=`~${o} min`}#i(){let e=!!document.querySelector('meta[name="vb:provenance"], meta[name="author"]'),n=e?"declared":"undeclared",i=this.querySelector(".page-info-badge");i&&i.setAttribute("data-trust",n),this.dispatchEvent(new CustomEvent("page-info:verified",{detail:{status:n,tier:e?1:0},bubbles:!0}))}async#o(){let n=document.querySelector('meta[name="vb:signature"]')?.content;if(!n)return;let i=document.querySelector('meta[name="vb:signature-algorithm"]')?.content;if(i&&i!=="ECDSA-P256-SHA256"){this.#t("failed",{reason:`unsupported-algorithm:${i}`});return}let o=document.querySelector('link[rel="author-key"]')?.getAttribute("href");if(!o){this.#t("failed",{reason:"missing-author-key"});return}let r;try{let c=new URL(o,document.baseURI),u=await fetch(c,{credentials:"omit"});if(!u.ok)throw new Error(`status ${u.status}`);let l=await u.json(),h={kty:l.kty,crv:l.crv,x:l.x,y:l.y,use:l.use||"sig",key_ops:["verify"]};r=await crypto.subtle.importKey("jwk",h,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])}catch(c){this.#t("key-unavailable",{reason:c.message});return}let s;try{let c=document.querySelector('link[rel="canonical"]')?.href||document.location.href;s=q(H(document,{url:c}))}catch(c){this.#t("failed",{reason:`canonicalize:${c.message}`});return}let a;try{let c=new TextEncoder().encode(s),u=Uint8Array.from(atob(n),l=>l.charCodeAt(0));a=await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},r,u,c)}catch(c){this.#t("failed",{reason:`verify:${c.message}`});return}this.#t(a?"verified":"failed",{reason:a?"ok":"mismatch"})}#t(e,n={}){let o={undeclared:0,declared:1,"domain-anchored":2,verified:3,failed:-1,"key-unavailable":-2}[e]??0,r=this.querySelector(".page-info-badge");if(r){r.setAttribute("data-trust",e);let s=r.getAttribute("aria-label")||"";e==="verified"&&!s.includes("verified")?r.setAttribute("aria-label",`${s} \u2014 verified`.trim()):e==="failed"?r.setAttribute("aria-label",`${s} \u2014 verification failed`.trim()):e==="key-unavailable"&&r.setAttribute("aria-label",`${s} \u2014 author key unavailable`.trim())}this.dispatchEvent(new CustomEvent("page-info:verified",{detail:{status:e,tier:o,...n},bubbles:!0}))}static#a={human:"Human written","ai-assisted":"Human-written, AI-assisted","ai-generated":"AI-generated",translated:"Translated",synthesized:"Synthesized from sources",migrated:"Migrated content"};static#s={unreviewed:"Unreviewed","fact-checked":"Fact-checked","editor-reviewed":"Editor-reviewed"};static#c={draft:"Draft",published:"Published",archived:"Archived"};static#d(e){if(!e)return"";let n=String(e).trim().split(/\s+/).filter(Boolean);return n.length?n.map(o=>t.#a[o]||o).join(" \xB7 "):""}#l(){let e=d=>document.querySelector(`meta[name="${d}"]`)?.content,n=d=>document.querySelector(`meta[property="${d}"]`)?.content,i=d=>document.querySelector(`meta[itemprop="${d}"]`)?.content,o=d=>document.querySelector(`link[rel="${d}"]`)?.href,r=e("author"),s=n("article:author")||o("author"),a=e("last-modified")||n("article:modified_time"),c=n("article:published_time"),u=e("keywords"),l=e("license"),h=o("license"),p=i("version"),g=e("vb:provenance"),v=e("vb:review"),m=e("vb:status"),S=e("vb:ai-tools"),L=e("vb:version-url"),A=Array.from(document.querySelectorAll('meta[name="concept"]')).map(d=>d.getAttribute("content")?.trim()).filter(Boolean),b=t.#d(g),k=t.#s[v]||v||"",T=t.#c[m]||m||"",I=g||S||v||l,P=a||c||p;this.innerHTML=`
15
+ `)||(t.text+=e)}}function G(t){let e=[...t.querySelectorAll("[data-signable]")],n=e.filter(o=>!e.some(r=>r!==o&&r.contains(o))),i={text:""};for(let o of n)D(o,i,!1);return i.text.replace(/^\s+/,"").replace(/\s+$/,"")}function f(t,e){return t.querySelector(`meta[name="${E(e)}"]`)?.getAttribute("content")||""}function $(t,e){return t.querySelector(`meta[property="${E(e)}"]`)?.getAttribute("content")||""}function z(t,e){return t.querySelector(`meta[itemprop="${E(e)}"]`)?.getAttribute("content")||""}function R(t,e){return t.querySelector(`link[rel="${E(e)}"]`)?.getAttribute("href")||""}function E(t){return String(t).replace(/[^a-zA-Z0-9:_\-/]/g,"")}function j(t){if(!t)return"";try{let e=new URL(t);e.search="",e.hash="";let n=`${e.protocol}//${e.hostname.toLowerCase()}`;return e.port&&(n+=`:${e.port}`),n+=e.pathname,n}catch{return t}}function O(t){if(!t)return"";let e=String(t).match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:""}function K(t){return $(t,"og:title")||t.title||""}function W(t){let e=f(t,"keywords");return e?e.split(",").map(n=>n.trim()).filter(Boolean):[]}function X(t){let e=new Set;for(let n of t.querySelectorAll('meta[name="concept"]')){let i=(n.getAttribute("content")||"").trim();i&&e.add(i)}return[...e].sort()}function Y(t){return R(t,"license")||f(t,"license")}function H(t,e={}){let n=e.url??t?.location?.href??"",i=O($(t,"article:published_time")),o=O(f(t,"last-modified")||$(t,"article:modified_time"));return{"@context":B,"@version":1,url:j(n),title:K(t),author:f(t,"author"),authorUrl:$(t,"article:author")||R(t,"author"),published:i,modified:o,version:z(t,"version"),keywords:W(t),concepts:X(t),provenance:f(t,"vb:provenance"),review:f(t,"vb:review"),status:f(t,"vb:status"),license:Y(t),content:G(t)}}function q(t){return JSON.stringify(t)}var C=class t extends y{setup(){this.hasAttribute("auto")&&this.#l(),this.#e(),this.#r(),this.#i(),this.#o()}#e(){for(let e of this.querySelectorAll("time[data-relative]")){let n=e.getAttribute("datetime");if(!n)continue;let i=t.#t(new Date(n));i&&(e.textContent=i)}}static#t(e){let i=Date.now()-e.getTime();if(i<0)return null;let o=Math.floor(i/1e3),r=Math.floor(o/60),s=Math.floor(r/60),a=Math.floor(s/24);return a>365?`${Math.floor(a/365)} year${Math.floor(a/365)!==1?"s":""} ago`:a>30?`${Math.floor(a/30)} month${Math.floor(a/30)!==1?"s":""} ago`:a>0?`${a} day${a!==1?"s":""} ago`:s>0?`${s} hour${s!==1?"s":""} ago`:r>0?`${r} minute${r!==1?"s":""} ago`:"just now"}#r(){let e=this.querySelector("[data-reading-time]");if(!e)return;let n=document.querySelectorAll("[data-signable]");if(!n.length)return;let i=0;for(let r of n){let s=r.textContent?.trim()||"";i+=s.split(/\s+/).filter(Boolean).length}let o=Math.max(1,Math.ceil(i/200));e.textContent=`~${o} min`}#i(){let e=!!document.querySelector('meta[name="vb:provenance"], meta[name="author"]'),n=e?"declared":"undeclared",i=this.querySelector(".page-info-badge");i&&i.setAttribute("data-trust",n),this.dispatchEvent(new CustomEvent("page-info:verified",{detail:{status:n,tier:e?1:0},bubbles:!0}))}async#o(){let n=document.querySelector('meta[name="vb:signature"]')?.content;if(!n)return;let i=document.querySelector('meta[name="vb:signature-algorithm"]')?.content;if(i&&i!=="ECDSA-P256-SHA256"){this.#n("failed",{reason:`unsupported-algorithm:${i}`});return}let o=document.querySelector('link[rel="author-key"]')?.getAttribute("href");if(!o){this.#n("failed",{reason:"missing-author-key"});return}let r;try{let c=new URL(o,document.baseURI),u=await fetch(c,{credentials:"omit"});if(!u.ok)throw new Error(`status ${u.status}`);let l=await u.json(),h={kty:l.kty,crv:l.crv,x:l.x,y:l.y,use:l.use||"sig",key_ops:["verify"]};r=await crypto.subtle.importKey("jwk",h,{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])}catch(c){this.#n("key-unavailable",{reason:c.message});return}let s;try{let c=document.querySelector('link[rel="canonical"]')?.href||document.location.href;s=q(H(document,{url:c}))}catch(c){this.#n("failed",{reason:`canonicalize:${c.message}`});return}let a;try{let c=new TextEncoder().encode(s),u=Uint8Array.from(atob(n),l=>l.charCodeAt(0));a=await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},r,u,c)}catch(c){this.#n("failed",{reason:`verify:${c.message}`});return}this.#n(a?"verified":"failed",{reason:a?"ok":"mismatch"})}#n(e,n={}){let o={undeclared:0,declared:1,"domain-anchored":2,verified:3,failed:-1,"key-unavailable":-2}[e]??0,r=this.querySelector(".page-info-badge");if(r){r.setAttribute("data-trust",e);let s=r.getAttribute("aria-label")||"";e==="verified"&&!s.includes("verified")?r.setAttribute("aria-label",`${s} \u2014 verified`.trim()):e==="failed"?r.setAttribute("aria-label",`${s} \u2014 verification failed`.trim()):e==="key-unavailable"&&r.setAttribute("aria-label",`${s} \u2014 author key unavailable`.trim())}this.dispatchEvent(new CustomEvent("page-info:verified",{detail:{status:e,tier:o,...n},bubbles:!0}))}static#a={human:"Human written","ai-assisted":"Human-written, AI-assisted","ai-generated":"AI-generated",translated:"Translated",synthesized:"Synthesized from sources",migrated:"Migrated content"};static#s={unreviewed:"Unreviewed","fact-checked":"Fact-checked","editor-reviewed":"Editor-reviewed"};static#c={draft:"Draft",published:"Published",archived:"Archived"};static#d(e){if(!e)return"";let n=String(e).trim().split(/\s+/).filter(Boolean);return n.length?n.map(o=>t.#a[o]||o).join(" \xB7 "):""}#l(){let e=d=>document.querySelector(`meta[name="${d}"]`)?.content,n=d=>document.querySelector(`meta[property="${d}"]`)?.content,i=d=>document.querySelector(`meta[itemprop="${d}"]`)?.content,o=d=>document.querySelector(`link[rel="${d}"]`)?.href,r=e("author"),s=n("article:author")||o("author"),a=e("last-modified")||n("article:modified_time"),c=n("article:published_time"),u=e("keywords"),l=e("license"),h=o("license"),p=i("version"),g=e("vb:provenance"),v=e("vb:review"),m=e("vb:status"),S=e("vb:ai-tools"),L=e("vb:version-url"),A=Array.from(document.querySelectorAll('meta[name="concept"]')).map(d=>d.getAttribute("content")?.trim()).filter(Boolean),b=t.#d(g),k=t.#s[v]||v||"",T=t.#c[m]||m||"",I=g||S||v||l,P=a||c||p;this.innerHTML=`
16
16
  <details>
17
17
  <summary>
18
18
  ${r?`
@@ -1,2 +1,2 @@
1
- var b=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function h(i,e,n={}){let t=n.priority??10,r={impl:e,bundle:n.bundle,contract:n.contract,priority:t},o=m.get(i);if(customElements.get(i)){if(!o||o.priority>=t){o&&o.priority===t&&o.impl!==e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=t){o.priority===t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${o.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}m.set(i,r),customElements.define(i,e)}var c=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,t,r){e.addEventListener(n,t,r),this.#e.push(()=>e.removeEventListener(n,t,r))}setup(){}teardown(){}setState(e,n){this.#t||(this.#t=this.attachInternals());let t=this.#t.states;try{n?t.add(e):t.delete(e)}catch{let r=`--${e}`;n?t.add(r):t.delete(r)}}_adoptInternals(e){this.#t||(this.#t=e)}};var l=class i extends c{setup(){if(this.querySelector("dl"))return;let e=this.dataset.for;if(!e)return;let n=document.getElementById(e);if(!n)return;let t=parseInt(this.dataset.wpm||"",10)||238,r=(this.dataset.show||"reading-time").split(",").map(d=>d.trim()),u=(n.textContent?.trim()||"").split(/\s+/).filter(Boolean).length,f=Math.max(1,Math.ceil(u/t)),a=document.createElement("dl");if(a.className="page-stats-list",r.includes("reading-time")&&a.appendChild(this.#e("Reading time",`<time datetime="PT${f}M">${f} min read</time>`)),r.includes("word-count")&&a.appendChild(this.#e("Word count",`${u.toLocaleString()} words`)),r.includes("last-modified")){let d=this.#t();if(d){let p=d.toISOString().split("T")[0],y=i.#n(d);a.appendChild(this.#e("Last updated",`<time datetime="${p}" data-relative>${y}</time>`))}}this.appendChild(a)}#e(e,n){let t=document.createElement("dl-item"),r=document.createElement("dt");r.className="visually-hidden",r.textContent=e;let o=document.createElement("dd");return o.innerHTML=n,t.appendChild(r),t.appendChild(o),t}#t(){let e=document.querySelector('meta[name="last-modified"]');if(e?.content){let t=new Date(e.content);if(!isNaN(t.getTime()))return t}let n=new Date(document.lastModified);return isNaN(n.getTime())?null:n}static#n(e){let n=Date.now()-e.getTime();if(n<0)return e.toLocaleDateString();let t=Math.floor(n/1e3),r=Math.floor(t/60),o=Math.floor(r/60),s=Math.floor(o/24);return s>365?`${Math.floor(s/365)} year${Math.floor(s/365)!==1?"s":""} ago`:s>30?`${Math.floor(s/30)} month${Math.floor(s/30)!==1?"s":""} ago`:s>0?`${s} day${s!==1?"s":""} ago`:o>0?`${o} hour${o!==1?"s":""} ago`:r>0?`${r} minute${r!==1?"s":""} ago`:"just now"}};h("page-stats",l);export{l as PageStats};
1
+ var y=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function h(r,e,n={}){let t=n.priority??10,i={impl:e,bundle:n.bundle,contract:n.contract,priority:t},o=m.get(r);if(customElements.get(r)){if(!o||o.priority>=t){o&&o.priority===t&&o.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=t){o.priority===t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${o.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}m.set(r,i),customElements.define(r,e)}var c=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,t,i){e.addEventListener(n,t,i),this.#e.push(()=>e.removeEventListener(n,t,i))}_reinit(){for(let e of this.#e)e();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,n){this.#t||(this.#t=this.attachInternals());let t=this.#t.states;try{n?t.add(e):t.delete(e)}catch{let i=`--${e}`;n?t.add(i):t.delete(i)}}_adoptInternals(e){this.#t||(this.#t=e)}};var l=class r extends c{setup(){if(this.querySelector("dl"))return;let e=this.dataset.for;if(!e)return;let n=document.getElementById(e);if(!n)return;let t=parseInt(this.dataset.wpm||"",10)||238,i=(this.dataset.show||"reading-time").split(",").map(d=>d.trim()),u=(n.textContent?.trim()||"").split(/\s+/).filter(Boolean).length,f=Math.max(1,Math.ceil(u/t)),a=document.createElement("dl");if(a.className="page-stats-list",i.includes("reading-time")&&a.appendChild(this.#e("Reading time",`<time datetime="PT${f}M">${f} min read</time>`)),i.includes("word-count")&&a.appendChild(this.#e("Word count",`${u.toLocaleString()} words`)),i.includes("last-modified")){let d=this.#t();if(d){let p=d.toISOString().split("T")[0],b=r.#n(d);a.appendChild(this.#e("Last updated",`<time datetime="${p}" data-relative>${b}</time>`))}}this.appendChild(a)}#e(e,n){let t=document.createElement("dl-item"),i=document.createElement("dt");i.className="visually-hidden",i.textContent=e;let o=document.createElement("dd");return o.innerHTML=n,t.appendChild(i),t.appendChild(o),t}#t(){let e=document.querySelector('meta[name="last-modified"]');if(e?.content){let t=new Date(e.content);if(!isNaN(t.getTime()))return t}let n=new Date(document.lastModified);return isNaN(n.getTime())?null:n}static#n(e){let n=Date.now()-e.getTime();if(n<0)return e.toLocaleDateString();let t=Math.floor(n/1e3),i=Math.floor(t/60),o=Math.floor(i/60),s=Math.floor(o/24);return s>365?`${Math.floor(s/365)} year${Math.floor(s/365)!==1?"s":""} ago`:s>30?`${Math.floor(s/30)} month${Math.floor(s/30)!==1?"s":""} ago`:s>0?`${s} day${s!==1?"s":""} ago`:o>0?`${o} hour${o!==1?"s":""} ago`:i>0?`${i} minute${i!==1?"s":""} ago`:"just now"}};h("page-stats",l);export{l as PageStats};
2
2
  //# sourceMappingURL=page-stats.js.map