vanilla-breeze 0.6.2 → 0.7.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 (239) hide show
  1. package/dist/cdn/components/accordion-wc.js +1 -1
  2. package/dist/cdn/components/activity-feed.js +1 -1
  3. package/dist/cdn/components/ai-chat.js +6 -6
  4. package/dist/cdn/components/ai-summary.js +2 -2
  5. package/dist/cdn/components/analytics-panel.js +2 -2
  6. package/dist/cdn/components/audio-player.js +4 -4
  7. package/dist/cdn/components/audio-visualizer.js +2 -2
  8. package/dist/cdn/components/author-index.js +2 -2
  9. package/dist/cdn/components/brand-mark.js +1 -1
  10. package/dist/cdn/components/bread-crumb.js +1 -1
  11. package/dist/cdn/components/calendar-wc.js +2 -2
  12. package/dist/cdn/components/card-list.js +1 -1
  13. package/dist/cdn/components/carousel-wc.js +1 -1
  14. package/dist/cdn/components/change-set.js +1 -1
  15. package/dist/cdn/components/chart-wc.js +13 -13
  16. package/dist/cdn/components/chat-input.js +1 -1
  17. package/dist/cdn/components/chat-window.js +1 -1
  18. package/dist/cdn/components/color-picker.js +1 -1
  19. package/dist/cdn/components/combo-box.js +1 -1
  20. package/dist/cdn/components/command-palette.js +1 -1
  21. package/dist/cdn/components/comment-box.js +35 -35
  22. package/dist/cdn/components/comment-thread.js +38 -38
  23. package/dist/cdn/components/comment-wc.js +1 -1
  24. package/dist/cdn/components/compare-surface.js +1 -1
  25. package/dist/cdn/components/consent-banner.js +1 -1
  26. package/dist/cdn/components/content-lens.js +1 -1
  27. package/dist/cdn/components/content-swap.js +1 -1
  28. package/dist/cdn/components/context-menu.js +1 -1
  29. package/dist/cdn/components/data-table.js +1 -1
  30. package/dist/cdn/components/date-picker.js +1 -1
  31. package/dist/cdn/components/day-view.js +1 -1
  32. package/dist/cdn/components/diagram-wc.js +2 -2
  33. package/dist/cdn/components/drag-surface.js +1 -1
  34. package/dist/cdn/components/drop-down.js +1 -1
  35. package/dist/cdn/components/emoji-picker.js +1 -1
  36. package/dist/cdn/components/flow-diagram.js +1 -1
  37. package/dist/cdn/components/foot-notes.js +1 -1
  38. package/dist/cdn/components/form-field.js +1 -1
  39. package/dist/cdn/components/geo-map.js +3 -3
  40. package/dist/cdn/components/glossary-index.js +1 -1
  41. package/dist/cdn/components/glossary-wc.js +1 -1
  42. package/dist/cdn/components/heading-links.js +1 -1
  43. package/dist/cdn/components/highlight-wc.js +2 -2
  44. package/dist/cdn/components/icon-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 +58 -54
  49. package/dist/cdn/components/markdown-editor.js +25 -25
  50. package/dist/cdn/components/markdown-viewer.js +27 -27
  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 +23 -23
  54. package/dist/cdn/components/page-info.js +6 -6
  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 +1 -1
  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 +1 -1
  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/reading-progress.js +1 -1
  68. package/dist/cdn/components/recently-visited.js +1 -1
  69. package/dist/cdn/components/score-card.js +2 -2
  70. package/dist/cdn/components/selection-menu.js +1 -1
  71. package/dist/cdn/components/settings-panel.js +6 -6
  72. package/dist/cdn/components/share-wc.js +2 -2
  73. package/dist/cdn/components/short-cuts.js +1 -1
  74. package/dist/cdn/components/site-index.js +1 -1
  75. package/dist/cdn/components/site-map.js +1 -1
  76. package/dist/cdn/components/site-search.js +1 -1
  77. package/dist/cdn/components/slide-accept.js +1 -1
  78. package/dist/cdn/components/social-embed.js +1 -1
  79. package/dist/cdn/components/social-links.js +2 -0
  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 +20 -20
  87. package/dist/cdn/components/time-index.js +1 -1
  88. package/dist/cdn/components/time-picker.js +1 -1
  89. package/dist/cdn/components/toast-msg.js +2 -2
  90. package/dist/cdn/components/tool-tip.js +1 -1
  91. package/dist/cdn/components/topic-map.js +4 -4
  92. package/dist/cdn/components/trust-filter.js +1 -1
  93. package/dist/cdn/components/version-switcher.js +6 -6
  94. package/dist/cdn/components/video-player.js +4 -4
  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/fonts/barlow-condensed-latin-400-italic.woff2 +0 -0
  99. package/dist/cdn/fonts/barlow-condensed-latin-700-italic.woff2 +0 -0
  100. package/dist/cdn/fonts/barlow-condensed-latin-ext-400-italic.woff2 +0 -0
  101. package/dist/cdn/fonts/barlow-condensed-latin-ext-700-italic.woff2 +0 -0
  102. package/dist/cdn/fonts/dm-sans-latin-ext-wght-italic.woff2 +0 -0
  103. package/dist/cdn/fonts/dm-sans-latin-wght-italic.woff2 +0 -0
  104. package/dist/cdn/fonts/dm-serif-display-latin-400-italic.woff2 +0 -0
  105. package/dist/cdn/fonts/dm-serif-display-latin-ext-400-italic.woff2 +0 -0
  106. package/dist/cdn/fonts/exo-2-latin-ext-wght-italic.woff2 +0 -0
  107. package/dist/cdn/fonts/exo-2-latin-wght-italic.woff2 +0 -0
  108. package/dist/cdn/fonts/inter-latin-ext-wght-italic.woff2 +0 -0
  109. package/dist/cdn/fonts/inter-latin-wght-italic.woff2 +0 -0
  110. package/dist/cdn/fonts/jetbrains-mono-latin-ext-wght-italic.woff2 +0 -0
  111. package/dist/cdn/fonts/jetbrains-mono-latin-wght-italic.woff2 +0 -0
  112. package/dist/cdn/fonts/josefin-sans-latin-ext-wght-italic.woff2 +0 -0
  113. package/dist/cdn/fonts/josefin-sans-latin-wght-italic.woff2 +0 -0
  114. package/dist/cdn/fonts/lora-latin-ext-wght-italic.woff2 +0 -0
  115. package/dist/cdn/fonts/lora-latin-wght-italic.woff2 +0 -0
  116. package/dist/cdn/fonts/merriweather-latin-ext-wght-italic.woff2 +0 -0
  117. package/dist/cdn/fonts/merriweather-latin-wght-italic.woff2 +0 -0
  118. package/dist/cdn/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
  119. package/dist/cdn/fonts/nunito-latin-wght-italic.woff2 +0 -0
  120. package/dist/cdn/packs/effects.full.js +1 -1
  121. package/dist/cdn/packs/kawaii/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
  122. package/dist/cdn/packs/kawaii/fonts/nunito-latin-wght-italic.woff2 +0 -0
  123. package/dist/cdn/packs/kawaii.full.css +1 -1
  124. package/dist/cdn/packs/kawaii.theme.css +1 -1
  125. package/dist/cdn/packs/manifest.json +4 -4
  126. package/dist/cdn/packs/prototype.full.js +1 -1
  127. package/dist/cdn/packs/ui.full.js +19 -19
  128. package/dist/cdn/themes/8bit.tokens.json +8 -37
  129. package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
  130. package/dist/cdn/themes/alpha1999.css +1 -1
  131. package/dist/cdn/themes/alpha1999.tokens.json +3 -6
  132. package/dist/cdn/themes/art-deco-dark.tokens.json +3 -27
  133. package/dist/cdn/themes/art-deco.css +1 -1
  134. package/dist/cdn/themes/art-deco.tokens.json +5 -11
  135. package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
  136. package/dist/cdn/themes/bauhaus.css +1 -1
  137. package/dist/cdn/themes/bauhaus.tokens.json +13 -7
  138. package/dist/cdn/themes/brutalist-dark.tokens.json +3 -27
  139. package/dist/cdn/themes/brutalist.tokens.json +5 -11
  140. package/dist/cdn/themes/catppuccin-frappe.css +1 -1
  141. package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
  142. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
  143. package/dist/cdn/themes/catppuccin-latte.css +1 -1
  144. package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
  145. package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
  146. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
  147. package/dist/cdn/themes/catppuccin-mocha.css +1 -1
  148. package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
  149. package/dist/cdn/themes/classic-dark.tokens.json +41 -41
  150. package/dist/cdn/themes/classic.tokens.json +25 -31
  151. package/dist/cdn/themes/claymorphism-dark.tokens.json +533 -161
  152. package/dist/cdn/themes/claymorphism.css +1 -1
  153. package/dist/cdn/themes/claymorphism.tokens.json +531 -135
  154. package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
  155. package/dist/cdn/themes/clinical.tokens.json +1 -1
  156. package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
  157. package/dist/cdn/themes/cottagecore.css +1 -1
  158. package/dist/cdn/themes/cottagecore.tokens.json +1 -1
  159. package/dist/cdn/themes/cyber.css +1 -1
  160. package/dist/cdn/themes/cyber.tokens.json +5 -11
  161. package/dist/cdn/themes/dawn-dark.tokens.json +3 -27
  162. package/dist/cdn/themes/dawn.css +1 -1
  163. package/dist/cdn/themes/dawn.tokens.json +1 -1
  164. package/dist/cdn/themes/dracula.tokens.json +1 -1
  165. package/dist/cdn/themes/dusk.tokens.json +1 -1
  166. package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
  167. package/dist/cdn/themes/editorial.tokens.json +19 -16
  168. package/dist/cdn/themes/financial-dark.tokens.json +1 -1
  169. package/dist/cdn/themes/financial.css +1 -1
  170. package/dist/cdn/themes/financial.tokens.json +1 -1
  171. package/dist/cdn/themes/genai.css +1 -1
  172. package/dist/cdn/themes/genai.tokens.json +1 -1
  173. package/dist/cdn/themes/glassmorphism-dark.tokens.json +233 -116
  174. package/dist/cdn/themes/glassmorphism.css +1 -1
  175. package/dist/cdn/themes/glassmorphism.tokens.json +233 -116
  176. package/dist/cdn/themes/government-dark.tokens.json +1 -1
  177. package/dist/cdn/themes/government.tokens.json +1 -1
  178. package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
  179. package/dist/cdn/themes/gruvbox.css +1 -1
  180. package/dist/cdn/themes/gruvbox.tokens.json +1 -1
  181. package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
  182. package/dist/cdn/themes/high-noon.tokens.json +1 -1
  183. package/dist/cdn/themes/journal-dark.tokens.json +3 -27
  184. package/dist/cdn/themes/journal.css +1 -1
  185. package/dist/cdn/themes/journal.tokens.json +21 -21
  186. package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
  187. package/dist/cdn/themes/kawaii.css +1 -1
  188. package/dist/cdn/themes/kawaii.tokens.json +1 -1
  189. package/dist/cdn/themes/magna-dark.tokens.json +1 -1
  190. package/dist/cdn/themes/magna.css +1 -1
  191. package/dist/cdn/themes/magna.tokens.json +2 -14
  192. package/dist/cdn/themes/manifest.json +25 -25
  193. package/dist/cdn/themes/midnight.tokens.json +1 -1
  194. package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
  195. package/dist/cdn/themes/minimal.tokens.json +25 -27
  196. package/dist/cdn/themes/modern-dark.tokens.json +41 -41
  197. package/dist/cdn/themes/modern.css +1 -1
  198. package/dist/cdn/themes/modern.tokens.json +21 -21
  199. package/dist/cdn/themes/nes-dark.tokens.json +3 -27
  200. package/dist/cdn/themes/nes.tokens.json +10 -39
  201. package/dist/cdn/themes/neumorphism-dark.tokens.json +266 -134
  202. package/dist/cdn/themes/neumorphism.css +1 -1
  203. package/dist/cdn/themes/neumorphism.tokens.json +266 -134
  204. package/dist/cdn/themes/nord-dark.tokens.json +3 -27
  205. package/dist/cdn/themes/nord.css +1 -1
  206. package/dist/cdn/themes/nord.tokens.json +1 -1
  207. package/dist/cdn/themes/organic-dark.tokens.json +1 -1
  208. package/dist/cdn/themes/organic.tokens.json +5 -14
  209. package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
  210. package/dist/cdn/themes/rose-pine.css +1 -1
  211. package/dist/cdn/themes/rose-pine.tokens.json +1 -1
  212. package/dist/cdn/themes/rough-dark.tokens.json +1 -1
  213. package/dist/cdn/themes/rough.tokens.json +1 -1
  214. package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
  215. package/dist/cdn/themes/solarized.tokens.json +1 -1
  216. package/dist/cdn/themes/startup-dark.tokens.json +1 -1
  217. package/dist/cdn/themes/startup.css +1 -1
  218. package/dist/cdn/themes/startup.tokens.json +1 -1
  219. package/dist/cdn/themes/super2026-dark.tokens.json +6 -30
  220. package/dist/cdn/themes/super2026.css +1 -1
  221. package/dist/cdn/themes/super2026.tokens.json +1 -1
  222. package/dist/cdn/themes/swiss-dark.tokens.json +4 -40
  223. package/dist/cdn/themes/swiss.tokens.json +34 -68
  224. package/dist/cdn/themes/terminal.tokens.json +286 -120
  225. package/dist/cdn/themes/tokyo-night-dark.tokens.json +3 -27
  226. package/dist/cdn/themes/tokyo-night.css +1 -1
  227. package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
  228. package/dist/cdn/themes/vaporwave-dark.tokens.json +3 -27
  229. package/dist/cdn/themes/vaporwave.tokens.json +1 -1
  230. package/dist/cdn/themes/win9x-dark.tokens.json +5 -29
  231. package/dist/cdn/themes/win9x.tokens.json +9 -9
  232. package/dist/cdn/vanilla-breeze-autoload.js +113 -108
  233. package/dist/cdn/vanilla-breeze-charts.js +13 -13
  234. package/dist/cdn/vanilla-breeze-core.css +1 -1
  235. package/dist/cdn/vanilla-breeze-core.js +80 -75
  236. package/dist/cdn/vanilla-breeze-extras.js +31 -31
  237. package/dist/cdn/vanilla-breeze.css +1 -1
  238. package/dist/cdn/vanilla-breeze.js +133 -133
  239. package/package.json +1 -1
@@ -1,29 +1,29 @@
1
- var Ft=window.matchMedia("(prefers-reduced-motion: reduce)");var se=new Map;function ie(r,e,t={}){let s=t.priority??10,n={impl:e,bundle:t.bundle,contract:t.contract,priority:s},l=se.get(r);if(customElements.get(r)){if(!l||l.priority>=s){l&&l.priority===s&&l.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${l.bundle}" (priority ${l.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${l.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(l&&l.priority>=s){l.priority===s&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${l.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}se.set(r,n),customElements.define(r,e)}var _=class extends HTMLElement{#r=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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,t,s,n){e.addEventListener(t,s,n),this.#r.push(()=>e.removeEventListener(t,s,n))}_reinit(){for(let e of this.#r)e();this.#r=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let s=this.#t.states;try{t?s.add(e):s.delete(e)}catch{let n=`--${e}`;t?s.add(n):s.delete(n)}}_adoptInternals(e){this.#t||(this.#t=e)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};function H(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var $=H();function pe(r){$=r}var S={exec:()=>null};function u(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(n,l)=>{let i=typeof l=="string"?l:l.source;return i=i.replace(b.caret,"$1"),t=t.replace(n,i),s},getRegex:()=>new RegExp(t,e)};return s}var Le=(()=>{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:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}#`),htmlBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}>`)},_e=/^(?:[ \t]*(?:\n|$))+/,Ce=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ie=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,L=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Me=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Z=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,de=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,fe=u(de).replace(/bull/g,Z).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(),Pe=u(de).replace(/bull/g,Z).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]+)*)/,qe=/^[^\n]+/,F=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ne=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",F).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Be=u(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Z).getRegex(),q="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",Q=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,De=u("^ {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",Q).replace("tag",q).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ge=u(j).replace("hr",L).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",q).getRegex(),Oe=u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ge).getRegex(),W={blockquote:Oe,code:Ce,def:Ne,fences:Ie,heading:Me,hr:L,html:De,lheading:fe,list:Be,newline:_e,paragraph:ge,table:S,text:qe},le=u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",L).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",q).getRegex(),Ue={...W,lheading:Pe,table:le,paragraph:u(j).replace("hr",L).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",le).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",q).getRegex()},He={...W,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Q).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:S,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(j).replace("hr",L).replace("heading",` *#{1,6} *[^
2
- ]`).replace("lheading",fe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ze=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,je=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ke=/^( {2,}|\\)\n(?!\s*$)/,Fe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,A=/[\p{P}\p{S}]/u,N=/[\s\p{P}\p{S}]/u,G=/[^\s\p{P}\p{S}]/u,Qe=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,N).getRegex(),be=/(?!~)[\p{P}\p{S}]/u,We=/(?!~)[\s\p{P}\p{S}]/u,Ge=/(?:[^\s\p{P}\p{S}]|~)/u,Ve=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Le?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),me=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Xe=u(me,"u").replace(/punct/g,A).getRegex(),Je=u(me,"u").replace(/punct/g,be).getRegex(),xe="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ke=u(xe,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,N).replace(/punct/g,A).getRegex(),Ye=u(xe,"gu").replace(/notPunctSpace/g,Ge).replace(/punctSpace/g,We).replace(/punct/g,be).getRegex(),et=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,N).replace(/punct/g,A).getRegex(),tt=u(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,A).getRegex(),rt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",nt=u(rt,"gu").replace(/notPunctSpace/g,G).replace(/punctSpace/g,N).replace(/punct/g,A).getRegex(),st=u(/\\(punct)/,"gu").replace(/punct/g,A).getRegex(),it=u(/^<(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(),lt=u(Q).replace("(?:-->|$)","-->").getRegex(),at=u("^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",lt).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),I=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ot=u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",I).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),we=u(/^!?\[(label)\]\[(ref)\]/).replace("label",I).replace("ref",F).getRegex(),ye=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",F).getRegex(),ct=u("reflink|nolink(?!\\()","g").replace("reflink",we).replace("nolink",ye).getRegex(),ae=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,V={_backpedal:S,anyPunctuation:st,autolink:it,blockSkip:Ve,br:ke,code:je,del:S,delLDelim:S,delRDelim:S,emStrongLDelim:Xe,emStrongRDelimAst:Ke,emStrongRDelimUnd:et,escape:Ze,link:ot,nolink:ye,punctuation:Qe,reflink:we,reflinkSearch:ct,tag:at,text:Fe,url:S},ht={...V,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",I).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",I).getRegex()},D={...V,emStrongRDelimAst:Ye,emStrongLDelim:Je,delLDelim:tt,delRDelim:nt,url:u(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ae).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:u(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ae).getRegex()},ut={...D,br:u(ke).replace("{2,}","*").getRegex(),text:u(D.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},C={normal:W,gfm:Ue,pedantic:He},v={normal:V,gfm:D,breaks:ut,pedantic:ht},pt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},oe=r=>pt[r];function w(r,e){if(e){if(b.escapeTest.test(r))return r.replace(b.escapeReplace,oe)}else if(b.escapeTestNoEncode.test(r))return r.replace(b.escapeReplaceNoEncode,oe);return r}function ce(r){try{r=encodeURI(r).replace(b.percentDecode,"%")}catch{return null}return r}function he(r,e){let t=r.replace(b.findPipe,(l,i,o)=>{let a=!1,h=i;for(;--h>=0&&o[h]==="\\";)a=!a;return a?"|":" |"}),s=t.split(b.splitPipe),n=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(;n<s.length;n++)s[n]=s[n].trim().replace(b.slashPipe,"|");return s}function E(r,e,t){let s=r.length;if(s===0)return"";let n=0;for(;n<s;){let l=r.charAt(s-n-1);if(l===e&&!t)n++;else if(l!==e&&t)n++;else break}return r.slice(0,s-n)}function dt(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function ft(r,e=0){let t=e,s="";for(let n of r)if(n===" "){let l=4-t%4;s+=" ".repeat(l),t+=l}else s+=n,t++;return s}function ue(r,e,t,s,n){let l=e.href,i=e.title||null,o=r[1].replace(n.other.outputLinkReplace,"$1");s.state.inLink=!0;let a={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:l,title:i,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,a}function gt(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let n=s[1];return e.split(`
3
- `).map(l=>{let i=l.match(t.other.beginningSpace);if(i===null)return l;let[o]=i;return o.length>=n.length?l.slice(n.length):l}).join(`
4
- `)}var M=class{options;rules;lexer;constructor(r){this.options=r||$}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:E(t,`
1
+ var Vt=window.matchMedia("(prefers-reduced-motion: reduce)");var se=new Map;function ie(r,e,t={}){let s=t.priority??10,n={impl:e,bundle:t.bundle,contract:t.contract,priority:s},a=se.get(r);if(customElements.get(r)){if(!a||a.priority>=s){a&&a.priority===s&&a.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${a.bundle}" (priority ${a.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${a.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(a&&a.priority>=s){a.priority===s&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${a.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}se.set(r,n),customElements.define(r,e)}var z=class extends HTMLElement{#r=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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,t,s,n){e.addEventListener(t,s,n),this.#r.push(()=>e.removeEventListener(t,s,n))}_reinit(){for(let e of this.#r)e();this.#r=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let s=this.#t.states;try{t?s.add(e):s.delete(e)}catch{let n=`--${e}`;t?s.add(n):s.delete(n)}}_adoptInternals(e){this.#t||(this.#t=e)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};function U(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var A=U();function pe(r){A=r}var S={exec:()=>null};function h(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(n,a)=>{let i=typeof a=="string"?a:a.source;return i=i.replace(b.caret,"$1"),t=t.replace(n,i),s},getRegex:()=>new RegExp(t,e)};return s}var Ce=(()=>{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:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}#`),htmlBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:r=>new RegExp(`^ {0,${Math.min(3,r-1)}}>`)},ze=/^(?:[ \t]*(?:\n|$))+/,_e=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ie=/^ {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+|$)/,Pe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Z=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,de=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,fe=h(de).replace(/bull/g,Z).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(),Me=h(de).replace(/bull/g,Z).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(),F=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Be=/^[^\n]+/,Q=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,qe=h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Q).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),De=h(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Z).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",W=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Oe=h("^ {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",W).replace("tag",B).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ge=h(F).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(),He=h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ge).getRegex(),N={blockquote:He,code:_e,def:qe,fences:Ie,heading:Pe,hr:C,html:Oe,lheading:fe,list:De,newline:ze,paragraph:ge,table:S,text:Be},ae=h("^ *([^\\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(),je={...N,lheading:Me,table:ae,paragraph:h(F).replace("hr",C).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ae).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()},Ue={...N,html:h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",W).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:S,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:h(F).replace("hr",C).replace("heading",` *#{1,6} *[^
2
+ ]`).replace("lheading",fe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ze=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Fe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ke=/^( {2,}|\\)\n(?!\s*$)/,Qe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,q=/[\s\p{P}\p{S}]/u,V=/[^\s\p{P}\p{S}]/u,We=h(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,q).getRegex(),be=/(?!~)[\p{P}\p{S}]/u,Ne=/(?!~)[\s\p{P}\p{S}]/u,Ve=/(?:[^\s\p{P}\p{S}]|~)/u,Ge=h(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ce?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),me=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Xe=h(me,"u").replace(/punct/g,T).getRegex(),Ke=h(me,"u").replace(/punct/g,be).getRegex(),xe="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Je=h(xe,"gu").replace(/notPunctSpace/g,V).replace(/punctSpace/g,q).replace(/punct/g,T).getRegex(),Ye=h(xe,"gu").replace(/notPunctSpace/g,Ve).replace(/punctSpace/g,Ne).replace(/punct/g,be).getRegex(),et=h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,V).replace(/punctSpace/g,q).replace(/punct/g,T).getRegex(),tt=h(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,T).getRegex(),rt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",nt=h(rt,"gu").replace(/notPunctSpace/g,V).replace(/punctSpace/g,q).replace(/punct/g,T).getRegex(),st=h(/\\(punct)/,"gu").replace(/punct/g,T).getRegex(),it=h(/^<(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(),at=h(W).replace("(?:-->|$)","-->").getRegex(),lt=h("^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",at).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),I=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ot=h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",I).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),we=h(/^!?\[(label)\]\[(ref)\]/).replace("label",I).replace("ref",Q).getRegex(),ye=h(/^!?\[(ref)\](?:\[\])?/).replace("ref",Q).getRegex(),ct=h("reflink|nolink(?!\\()","g").replace("reflink",we).replace("nolink",ye).getRegex(),le=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,G={_backpedal:S,anyPunctuation:st,autolink:it,blockSkip:Ge,br:ke,code:Fe,del:S,delLDelim:S,delRDelim:S,emStrongLDelim:Xe,emStrongRDelimAst:Je,emStrongRDelimUnd:et,escape:Ze,link:ot,nolink:ye,punctuation:We,reflink:we,reflinkSearch:ct,tag:lt,text:Qe,url:S},ut={...G,link:h(/^!?\[(label)\]\((.*?)\)/).replace("label",I).getRegex(),reflink:h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",I).getRegex()},O={...G,emStrongRDelimAst:Ye,emStrongLDelim:Ke,delLDelim:tt,delRDelim:nt,url:h(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",le).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:h(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",le).getRegex()},ht={...O,br:h(ke).replace("{2,}","*").getRegex(),text:h(O.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},_={normal:N,gfm:je,pedantic:Ue},R={normal:G,gfm:O,breaks:ht,pedantic:ut},pt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},oe=r=>pt[r];function w(r,e){if(e){if(b.escapeTest.test(r))return r.replace(b.escapeReplace,oe)}else if(b.escapeTestNoEncode.test(r))return r.replace(b.escapeReplaceNoEncode,oe);return r}function ce(r){try{r=encodeURI(r).replace(b.percentDecode,"%")}catch{return null}return r}function ue(r,e){let t=r.replace(b.findPipe,(a,i,o)=>{let l=!1,u=i;for(;--u>=0&&o[u]==="\\";)l=!l;return l?"|":" |"}),s=t.split(b.splitPipe),n=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(;n<s.length;n++)s[n]=s[n].trim().replace(b.slashPipe,"|");return s}function E(r,e,t){let s=r.length;if(s===0)return"";let n=0;for(;n<s;){let a=r.charAt(s-n-1);if(a===e&&!t)n++;else if(a!==e&&t)n++;else break}return r.slice(0,s-n)}function dt(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function ft(r,e=0){let t=e,s="";for(let n of r)if(n===" "){let a=4-t%4;s+=" ".repeat(a),t+=a}else s+=n,t++;return s}function he(r,e,t,s,n){let a=e.href,i=e.title||null,o=r[1].replace(n.other.outputLinkReplace,"$1");s.state.inLink=!0;let l={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:a,title:i,text:o,tokens:s.inlineTokens(o)};return s.state.inLink=!1,l}function gt(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let n=s[1];return e.split(`
3
+ `).map(a=>{let i=a.match(t.other.beginningSpace);if(i===null)return a;let[o]=i;return o.length>=n.length?a.slice(n.length):a}).join(`
4
+ `)}var P=class{options;rules;lexer;constructor(r){this.options=r||A}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:E(t,`
5
5
  `)}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=gt(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=E(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:E(e[0],`
6
6
  `)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=E(e[0],`
7
7
  `).split(`
8
- `),s="",n="",l=[];for(;t.length>0;){let i=!1,o=[],a;for(a=0;a<t.length;a++)if(this.rules.other.blockquoteStart.test(t[a]))o.push(t[a]),i=!0;else if(!i)o.push(t[a]);else break;t=t.slice(a);let h=o.join(`
9
- `),c=h.replace(this.rules.other.blockquoteSetextReplace,`
8
+ `),s="",n="",a=[];for(;t.length>0;){let i=!1,o=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))o.push(t[l]),i=!0;else if(!i)o.push(t[l]);else break;t=t.slice(l);let u=o.join(`
9
+ `),c=u.replace(this.rules.other.blockquoteSetextReplace,`
10
10
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
11
- ${h}`:h,n=n?`${n}
12
- ${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,l,!0),this.lexer.state.top=d,t.length===0)break;let p=l.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){let k=p,g=k.raw+`
11
+ ${u}`:u,n=n?`${n}
12
+ ${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,a,!0),this.lexer.state.top=d,t.length===0)break;let p=a.at(-1);if(p?.type==="code")break;if(p?.type==="blockquote"){let k=p,g=k.raw+`
13
13
  `+t.join(`
14
- `),y=this.blockquote(g);l[l.length-1]=y,s=s.substring(0,s.length-k.raw.length)+y.raw,n=n.substring(0,n.length-k.text.length)+y.text;break}else if(p?.type==="list"){let k=p,g=k.raw+`
14
+ `),y=this.blockquote(g);a[a.length-1]=y,s=s.substring(0,s.length-k.raw.length)+y.raw,n=n.substring(0,n.length-k.text.length)+y.text;break}else if(p?.type==="list"){let k=p,g=k.raw+`
15
15
  `+t.join(`
16
- `),y=this.list(g);l[l.length-1]=y,s=s.substring(0,s.length-p.raw.length)+y.raw,n=n.substring(0,n.length-k.raw.length)+y.raw,t=g.substring(l.at(-1).raw.length).split(`
17
- `);continue}}return{type:"blockquote",raw:s,tokens:l,text:n}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,n={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let l=this.rules.other.listItemRegex(t),i=!1;for(;r;){let a=!1,h="",c="";if(!(e=l.exec(r))||this.rules.block.hr.test(r))break;h=e[0],r=r.substring(h.length);let d=ft(e[2].split(`
16
+ `),y=this.list(g);a[a.length-1]=y,s=s.substring(0,s.length-p.raw.length)+y.raw,n=n.substring(0,n.length-k.raw.length)+y.raw,t=g.substring(a.at(-1).raw.length).split(`
17
+ `);continue}}return{type:"blockquote",raw:s,tokens:a,text:n}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,n={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let a=this.rules.other.listItemRegex(t),i=!1;for(;r;){let l=!1,u="",c="";if(!(e=a.exec(r))||this.rules.block.hr.test(r))break;u=e[0],r=r.substring(u.length);let d=ft(e[2].split(`
18
18
  `,1)[0],e[1].length),p=r.split(`
19
- `,1)[0],k=!d.trim(),g=0;if(this.options.pedantic?(g=2,c=d.trimStart()):k?g=e[1].length+1:(g=d.search(this.rules.other.nonSpaceChar),g=g>4?1:g,c=d.slice(g),g+=e[1].length),k&&this.rules.other.blankLine.test(p)&&(h+=p+`
20
- `,r=r.substring(p.length+1),a=!0),!a){let y=this.rules.other.nextBulletRegex(g),te=this.rules.other.hrRegex(g),re=this.rules.other.fencesBeginRegex(g),ne=this.rules.other.headingBeginRegex(g),Ee=this.rules.other.htmlBeginRegex(g),ze=this.rules.other.blockquoteBeginRegex(g);for(;r;){let B=r.split(`
21
- `,1)[0],T;if(p=B,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),T=p):T=p.replace(this.rules.other.tabCharGlobal," "),re.test(p)||ne.test(p)||Ee.test(p)||ze.test(p)||y.test(p)||te.test(p))break;if(T.search(this.rules.other.nonSpaceChar)>=g||!p.trim())c+=`
22
- `+T.slice(g);else{if(k||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||re.test(d)||ne.test(d)||te.test(d))break;c+=`
23
- `+p}k=!p.trim(),h+=B+`
24
- `,r=r.substring(B.length+1),d=T.slice(g)}}n.loose||(i?n.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(i=!0)),n.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),n.raw+=h}let o=n.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let a of n.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,n.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(!n.loose){let h=a.tokens.filter(d=>d.type==="space"),c=h.length>0&&h.some(d=>this.rules.other.anyLine.test(d.raw));n.loose=c}}if(n.loose)for(let a of n.items){a.loose=!0;for(let h of a.tokens)h.type==="text"&&(h.type="paragraph")}return n}}html(r){let e=this.rules.block.html.exec(r);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=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"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:s,title:n}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=he(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
25
- `):[],l={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===s.length){for(let i of s)this.rules.other.tableAlignRight.test(i)?l.align.push("right"):this.rules.other.tableAlignCenter.test(i)?l.align.push("center"):this.rules.other.tableAlignLeft.test(i)?l.align.push("left"):l.align.push(null);for(let i=0;i<t.length;i++)l.header.push({text:t[i],tokens:this.lexer.inline(t[i]),header:!0,align:l.align[i]});for(let i of n)l.rows.push(he(i,l.header.length).map((o,a)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:l.align[a]})));return l}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
26
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);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(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let l=E(t.slice(0,-1),"\\");if((t.length-l.length)%2===0)return}else{let l=dt(e[2],"()");if(l===-2)return;if(l>-1){let i=(e[0].indexOf("!")===0?5:4)+e[1].length+l;e[2]=e[2].substring(0,l),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let s=e[2],n="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(s);l&&(s=l[1],n=l[3])}else n=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(t)?s=s.slice(1):s=s.slice(1,-1)),ue(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[s.toLowerCase()];if(!n){let l=t[0].charAt(0);return{type:"text",raw:l,text:l}}return ue(t,n,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,l,i,o=n,a=0,h=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*r.length+n);(s=h.exec(e))!==null;){if(l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!l)continue;if(i=[...l].length,s[3]||s[4]){o+=i;continue}else if((s[5]||s[6])&&n%3&&!((n+i)%3)){a+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+a);let c=[...s[0]][0].length,d=r.slice(0,n+s.index+c+i);if(Math.min(n,i)%2){let k=d.slice(1,-1);return{type:"em",raw:d,text:k,tokens:this.lexer.inlineTokens(k)}}let p=d.slice(2,-2);return{type:"strong",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,l,i,o=n,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*r.length+n);(s=a.exec(e))!==null;){if(l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!l||(i=[...l].length,i!==n))continue;if(s[3]||s[4]){o+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o);let h=[...s[0]][0].length,c=r.slice(0,n+s.index+h+i),d=c.slice(n,-n);return{type:"del",raw:c,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},m=class O{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||$,this.options.tokenizer=this.options.tokenizer||new M,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 t={other:b,block:C.normal,inline:v.normal};this.options.pedantic?(t.block=C.pedantic,t.inline=v.pedantic):this.options.gfm&&(t.block=C.gfm,this.options.breaks?t.inline=v.breaks:t.inline=v.gfm),this.tokenizer.rules=t}static get rules(){return{block:C,inline:v}}static lex(e,t){return new O(t).lex(e)}static lexInline(e,t){return new O(t).inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
19
+ `,1)[0],k=!d.trim(),g=0;if(this.options.pedantic?(g=2,c=d.trimStart()):k?g=e[1].length+1:(g=d.search(this.rules.other.nonSpaceChar),g=g>4?1:g,c=d.slice(g),g+=e[1].length),k&&this.rules.other.blankLine.test(p)&&(u+=p+`
20
+ `,r=r.substring(p.length+1),l=!0),!l){let y=this.rules.other.nextBulletRegex(g),te=this.rules.other.hrRegex(g),re=this.rules.other.fencesBeginRegex(g),ne=this.rules.other.headingBeginRegex(g),Ee=this.rules.other.htmlBeginRegex(g),Le=this.rules.other.blockquoteBeginRegex(g);for(;r;){let D=r.split(`
21
+ `,1)[0],v;if(p=D,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),v=p):v=p.replace(this.rules.other.tabCharGlobal," "),re.test(p)||ne.test(p)||Ee.test(p)||Le.test(p)||y.test(p)||te.test(p))break;if(v.search(this.rules.other.nonSpaceChar)>=g||!p.trim())c+=`
22
+ `+v.slice(g);else{if(k||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||re.test(d)||ne.test(d)||te.test(d))break;c+=`
23
+ `+p}k=!p.trim(),u+=D+`
24
+ `,r=r.substring(D.length+1),d=v.slice(g)}}n.loose||(i?n.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(i=!0)),n.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),n.raw+=u}let o=n.items.at(-1);if(o)o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let l of n.items){if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),l.task){if(l.text=l.text.replace(this.rules.other.listReplaceTask,""),l.tokens[0]?.type==="text"||l.tokens[0]?.type==="paragraph"){l.tokens[0].raw=l.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),l.tokens[0].text=l.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 u=this.rules.other.listTaskCheckbox.exec(l.raw);if(u){let c={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};l.checked=c.checked,n.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=c.raw+l.tokens[0].raw,l.tokens[0].text=c.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(c)):l.tokens.unshift({type:"paragraph",raw:c.raw,text:c.raw,tokens:[c]}):l.tokens.unshift(c)}}if(!n.loose){let u=l.tokens.filter(d=>d.type==="space"),c=u.length>0&&u.some(d=>this.rules.other.anyLine.test(d.raw));n.loose=c}}if(n.loose)for(let l of n.items){l.loose=!0;for(let u of l.tokens)u.type==="text"&&(u.type="paragraph")}return n}}html(r){let e=this.rules.block.html.exec(r);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=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"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:s,title:n}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=ue(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
25
+ `):[],a={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===s.length){for(let i of s)this.rules.other.tableAlignRight.test(i)?a.align.push("right"):this.rules.other.tableAlignCenter.test(i)?a.align.push("center"):this.rules.other.tableAlignLeft.test(i)?a.align.push("left"):a.align.push(null);for(let i=0;i<t.length;i++)a.header.push({text:t[i],tokens:this.lexer.inline(t[i]),header:!0,align:a.align[i]});for(let i of n)a.rows.push(ue(i,a.header.length).map((o,l)=>({text:o,tokens:this.lexer.inline(o),header:!1,align:a.align[l]})));return a}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
26
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);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(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let a=E(t.slice(0,-1),"\\");if((t.length-a.length)%2===0)return}else{let a=dt(e[2],"()");if(a===-2)return;if(a>-1){let i=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,i).trim(),e[3]=""}}let s=e[2],n="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(s);a&&(s=a[1],n=a[3])}else n=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(t)?s=s.slice(1):s=s.slice(1,-1)),he(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[s.toLowerCase()];if(!n){let a=t[0].charAt(0);return{type:"text",raw:a,text:a}}return he(t,n,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,a,i,o=n,l=0,u=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*r.length+n);(s=u.exec(e))!==null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(i=[...a].length,s[3]||s[4]){o+=i;continue}else if((s[5]||s[6])&&n%3&&!((n+i)%3)){l+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+l);let c=[...s[0]][0].length,d=r.slice(0,n+s.index+c+i);if(Math.min(n,i)%2){let k=d.slice(1,-1);return{type:"em",raw:d,text:k,tokens:this.lexer.inlineTokens(k)}}let p=d.slice(2,-2);return{type:"strong",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,a,i,o=n,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*r.length+n);(s=l.exec(e))!==null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a||(i=[...a].length,i!==n))continue;if(s[3]||s[4]){o+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o);let u=[...s[0]][0].length,c=r.slice(0,n+s.index+u+i),d=c.slice(n,-n);return{type:"del",raw:c,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},m=class H{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||A,this.options.tokenizer=this.options.tokenizer||new P,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 t={other:b,block:_.normal,inline:R.normal};this.options.pedantic?(t.block=_.pedantic,t.inline=R.pedantic):this.options.gfm&&(t.block=_.gfm,this.options.breaks?t.inline=R.breaks:t.inline=R.gfm),this.tokenizer.rules=t}static get rules(){return{block:_,inline:R}}static lex(e,t){return new H(t).lex(e)}static lexInline(e,t){return new H(t).inlineTokens(e)}lex(e){e=e.replace(b.carriageReturn,`
27
27
  `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(b.tabCharGlobal," ").replace(b.spaceLine,""));e;){let n;if(this.options.extensions?.block?.some(i=>(n=i.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let i=t.at(-1);n.raw.length===1&&i!==void 0?i.raw+=`
28
28
  `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let i=t.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
29
29
  `)?"":`
@@ -31,31 +31,31 @@ ${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
31
31
  `+n.text,this.inlineQueue.at(-1).src=i.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);let i=t.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
32
32
  `)?"":`
33
33
  `)+n.raw,i.text+=`
34
- `+n.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},t.push(n));continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let l=e;if(this.options.extensions?.startBlock){let i=1/0,o=e.slice(1),a;this.options.extensions.startBlock.forEach(h=>{a=h.call({lexer:this},o),typeof a=="number"&&a>=0&&(i=Math.min(i,a))}),i<1/0&&i>=0&&(l=e.substring(0,i+1))}if(this.state.top&&(n=this.tokenizer.paragraph(l))){let i=t.at(-1);s&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
34
+ `+n.raw,this.inlineQueue.at(-1).src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},t.push(n));continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let a=e;if(this.options.extensions?.startBlock){let i=1/0,o=e.slice(1),l;this.options.extensions.startBlock.forEach(u=>{l=u.call({lexer:this},o),typeof l=="number"&&l>=0&&(i=Math.min(i,l))}),i<1/0&&i>=0&&(a=e.substring(0,i+1))}if(this.state.top&&(n=this.tokenizer.paragraph(a))){let i=t.at(-1);s&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
35
35
  `)?"":`
36
36
  `)+n.raw,i.text+=`
37
- `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(n),s=l.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let i=t.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
37
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(n),s=a.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let i=t.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
38
38
  `)?"":`
39
39
  `)+n.raw,i.text+=`
40
- `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(n);continue}if(e){let i="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e,n=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)a.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(s))!==null;)s=s.slice(0,n.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let l;for(;(n=this.tokenizer.rules.inline.blockSkip.exec(s))!==null;)l=n[2]?n[2].length:0,s=s.slice(0,n.index+l)+"["+"a".repeat(n[0].length-l-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let i=!1,o="";for(;e;){i||(o=""),i=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,s,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e,s,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let h=e;if(this.options.extensions?.startInline){let c=1/0,d=e.slice(1),p;this.options.extensions.startInline.forEach(k=>{p=k.call({lexer:this},d),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),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)),i=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.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 t}},P=class{options;parser;constructor(r){this.options=r||$}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match(b.notSpaceStart)?.[0],n=r.replace(b.endingNewline,"")+`
40
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):t.push(n);continue}if(e){let i="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e,n=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(s))!==null;)l.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(s))!==null;)s=s.slice(0,n.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let a;for(;(n=this.tokenizer.rules.inline.blockSkip.exec(s))!==null;)a=n[2]?n[2].length:0,s=s.slice(0,n.index+a)+"["+"a".repeat(n[0].length-a-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let i=!1,o="";for(;e;){i||(o=""),i=!1;let l;if(this.options.extensions?.inline?.some(c=>(l=c.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let c=t.at(-1);l.type==="text"&&c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,s,o)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e,s,o)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let u=e;if(this.options.extensions?.startInline){let c=1/0,d=e.slice(1),p;this.options.extensions.startInline.forEach(k=>{p=k.call({lexer:this},d),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),c<1/0&&c>=0&&(u=e.substring(0,c+1))}if(l=this.tokenizer.inlineText(u)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(o=l.raw.slice(-1)),i=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):t.push(l);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 t}},M=class{options;parser;constructor(r){this.options=r||A}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match(b.notSpaceStart)?.[0],n=r.replace(b.endingNewline,"")+`
41
41
  `;return s?'<pre><code class="language-'+w(s)+'">'+(t?n:w(n,!0))+`</code></pre>
42
42
  `:"<pre><code>"+(t?n:w(n,!0))+`</code></pre>
43
43
  `}blockquote({tokens:r}){return`<blockquote>
44
44
  ${this.parser.parse(r)}</blockquote>
45
45
  `}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
46
46
  `}hr(r){return`<hr>
47
- `}list(r){let e=r.ordered,t=r.start,s="";for(let i=0;i<r.items.length;i++){let o=r.items[i];s+=this.listitem(o)}let n=e?"ol":"ul",l=e&&t!==1?' start="'+t+'"':"";return"<"+n+l+`>
47
+ `}list(r){let e=r.ordered,t=r.start,s="";for(let i=0;i<r.items.length;i++){let o=r.items[i];s+=this.listitem(o)}let n=e?"ol":"ul",a=e&&t!==1?' start="'+t+'"':"";return"<"+n+a+`>
48
48
  `+s+"</"+n+`>
49
49
  `}listitem(r){return`<li>${this.parser.parse(r.tokens)}</li>
50
50
  `}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
51
- `}table(r){let e="",t="";for(let n=0;n<r.header.length;n++)t+=this.tablecell(r.header[n]);e+=this.tablerow({text:t});let s="";for(let n=0;n<r.rows.length;n++){let l=r.rows[n];t="";for(let i=0;i<l.length;i++)t+=this.tablecell(l[i]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
51
+ `}table(r){let e="",t="";for(let n=0;n<r.header.length;n++)t+=this.tablecell(r.header[n]);e+=this.tablerow({text:t});let s="";for(let n=0;n<r.rows.length;n++){let a=r.rows[n];t="";for(let i=0;i<a.length;i++)t+=this.tablecell(a[i]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
52
52
  <thead>
53
53
  `+e+`</thead>
54
54
  `+s+`</table>
55
55
  `}tablerow({text:r}){return`<tr>
56
56
  ${r}</tr>
57
57
  `}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
58
- `}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${w(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),n=ce(r);if(n===null)return s;r=n;let l='<a href="'+r+'"';return e&&(l+=' title="'+w(e)+'"'),l+=">"+s+"</a>",l}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let n=ce(r);if(n===null)return w(t);r=n;let l=`<img src="${r}" alt="${w(t)}"`;return e&&(l+=` title="${w(e)}"`),l+=">",l}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:w(r.text)}},X=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},x=class U{options;renderer;textRenderer;constructor(e){this.options=e||$,this.options.renderer=this.options.renderer||new P,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new X}static parse(e,t){return new U(t).parse(e)}static parseInline(e,t){return new U(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let i=n,o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){t+=o||"";continue}}let l=n;switch(l.type){case"space":{t+=this.renderer.space(l);break}case"hr":{t+=this.renderer.hr(l);break}case"heading":{t+=this.renderer.heading(l);break}case"code":{t+=this.renderer.code(l);break}case"table":{t+=this.renderer.table(l);break}case"blockquote":{t+=this.renderer.blockquote(l);break}case"list":{t+=this.renderer.list(l);break}case"checkbox":{t+=this.renderer.checkbox(l);break}case"html":{t+=this.renderer.html(l);break}case"def":{t+=this.renderer.def(l);break}case"paragraph":{t+=this.renderer.paragraph(l);break}case"text":{t+=this.renderer.text(l);break}default:{let i='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let n=0;n<e.length;n++){let l=e[n];if(this.options.extensions?.renderers?.[l.type]){let o=this.options.extensions.renderers[l.type].call({parser:this},l);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){s+=o||"";continue}}let i=l;switch(i.type){case"escape":{s+=t.text(i);break}case"html":{s+=t.html(i);break}case"link":{s+=t.link(i);break}case"image":{s+=t.image(i);break}case"checkbox":{s+=t.checkbox(i);break}case"strong":{s+=t.strong(i);break}case"em":{s+=t.em(i);break}case"codespan":{s+=t.codespan(i);break}case"br":{s+=t.br(i);break}case"del":{s+=t.del(i);break}case"text":{s+=t.text(i);break}default:{let o='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}},z=class{options;block;constructor(r){this.options=r||$}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?m.lex:m.lexInline}provideParser(r=this.block){return r?x.parse:x.parseInline}},J=class{defaults=H();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=x;Renderer=P;TextRenderer=X;Lexer=m;Tokenizer=M;Hooks=z;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let n=s;for(let l of n.header)t=t.concat(this.walkTokens(l.tokens,e));for(let l of n.rows)for(let i of l)t=t.concat(this.walkTokens(i.tokens,e));break}case"list":{let n=s;t=t.concat(this.walkTokens(n.items,e));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(l=>{let i=n[l].flat(1/0);t=t.concat(this.walkTokens(i,e))}):n.tokens&&(t=t.concat(this.walkTokens(n.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let l=e.renderers[n.name];l?e.renderers[n.name]=function(...i){let o=n.renderer.apply(this,i);return o===!1&&(o=l.apply(this,i)),o}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let l=e[n.level];l?l.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),s.extensions=e),t.renderer){let n=this.defaults.renderer||new P(this.defaults);for(let l in t.renderer){if(!(l in n))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;let i=l,o=t.renderer[i],a=n[i];n[i]=(...h)=>{let c=o.apply(n,h);return c===!1&&(c=a.apply(n,h)),c||""}}s.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new M(this.defaults);for(let l in t.tokenizer){if(!(l in n))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;let i=l,o=t.tokenizer[i],a=n[i];n[i]=(...h)=>{let c=o.apply(n,h);return c===!1&&(c=a.apply(n,h)),c}}s.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new z;for(let l in t.hooks){if(!(l in n))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;let i=l,o=t.hooks[i],a=n[i];z.passThroughHooks.has(l)?n[i]=h=>{if(this.defaults.async&&z.passThroughHooksRespectAsync.has(l))return(async()=>{let d=await o.call(n,h);return a.call(n,d)})();let c=o.call(n,h);return a.call(n,c)}:n[i]=(...h)=>{if(this.defaults.async)return(async()=>{let d=await o.apply(n,h);return d===!1&&(d=await a.apply(n,h)),d})();let c=o.apply(n,h);return c===!1&&(c=a.apply(n,h)),c}}s.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,l=t.walkTokens;s.walkTokens=function(i){let o=[];return o.push(l.call(this,i)),n&&(o=o.concat(n.call(this,i))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return m.lex(r,e??this.defaults)}parser(r,e){return x.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},n={...this.defaults,...s},l=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&s.async===!1)return l(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 l(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=r),n.async)return(async()=>{let i=n.hooks?await n.hooks.preprocess(e):e,o=await(n.hooks?await n.hooks.provideLexer(r):r?m.lex:m.lexInline)(i,n),a=n.hooks?await n.hooks.processAllTokens(o):o;n.walkTokens&&await Promise.all(this.walkTokens(a,n.walkTokens));let h=await(n.hooks?await n.hooks.provideParser(r):r?x.parse:x.parseInline)(a,n);return n.hooks?await n.hooks.postprocess(h):h})().catch(l);try{n.hooks&&(e=n.hooks.preprocess(e));let i=(n.hooks?n.hooks.provideLexer(r):r?m.lex:m.lexInline)(e,n);n.hooks&&(i=n.hooks.processAllTokens(i)),n.walkTokens&&this.walkTokens(i,n.walkTokens);let o=(n.hooks?n.hooks.provideParser(r):r?x.parse:x.parseInline)(i,n);return n.hooks&&(o=n.hooks.postprocess(o)),o}catch(i){return l(i)}}}onError(r,e){return t=>{if(t.message+=`
59
- Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+w(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},R=new J;function f(r,e){return R.parse(r,e)}f.options=f.setOptions=function(r){return R.setOptions(r),f.defaults=R.defaults,pe(f.defaults),f};f.getDefaults=H;f.defaults=$;f.use=function(...r){return R.use(...r),f.defaults=R.defaults,pe(f.defaults),f};f.walkTokens=function(r,e){return R.walkTokens(r,e)};f.parseInline=R.parseInline;f.Parser=x;f.parser=x.parse;f.Renderer=P;f.TextRenderer=X;f.Lexer=m;f.lexer=m.lex;f.Tokenizer=M;f.Hooks=z;f.parse=f;var Gt=f.options,Vt=f.setOptions,Xt=f.use,Jt=f.walkTokens,Kt=f.parseInline;var Yt=x.parse,er=m.lex;var kt="http://www.w3.org/1999/xhtml",K="http://www.w3.org/2000/svg",bt="http://www.w3.org/1998/Math/MathML",mt=new Set([kt,K,bt]),Y="user-content-",xt=new Set(["script","iframe","frame","frameset","object","embed","applet","portal","fencedframe","form","base","link","meta","noscript","foreignobject","style","xmp","noembed","noframes","plaintext","mglyph","malignmark","annotation-xml"]),Re=new Set(["title","desc"]),wt=new Set(["animate","set","animatemotion","animatetransform"]),yt=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),St=new Set(["src","poster","srcset"]),Rt=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),$t=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),At=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),Tt={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},vt=new Set(["social-embed","youtube-player","geo-map"]),Et=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],zt=new Set(["audio-player","video-player","image-map","brand-mark"]);function Lt(r){return String(r).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function Se(r,e=!1){let t=Lt(r);return e?/(^|,)(javascript|vbscript|livescript):/.test(t)?!0:/(^|,)data:/.test(t)?t.split(/(?=data:)/).filter(n=>n.startsWith("data:")).some(n=>!/^data:(image|audio|video|font)\//.test(n)):!1:/^(javascript|vbscript|livescript|data):/.test(t)}function $e(r){let e=String(r).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(e)}var _t=r=>String(r.localName||r.tagName||"").toLowerCase(),Ct=r=>r.startsWith(Y)?r:Y+r;function It(r,e){if(xt.has(e))return!0;let t=r.namespaceURI;return!!(t&&!mt.has(t)||e==="title"&&t!==K||Re.has(e)&&t===K&&r.children?.length||wt.has(e)&&(r.getAttribute("attributeName")||r.getAttribute("attributename")||"").toLowerCase().includes("href"))}function Mt(r,e){for(let t of[...r.attributes]){let s=t.name.toLowerCase();if(s.startsWith("on")||Rt.has(s)||!e.keepIds&&$t.has(s)){r.removeAttribute(t.name);continue}if(s==="style"){(!e.keepStyle||$e(t.value))&&r.removeAttribute(t.name);continue}if((s==="id"||s==="name")&&!e.keepIds){let n=Ct(t.value);s==="id"?e.ids.set(t.value,n):e.ids.set(`name:${t.value}`,n),r.setAttribute(t.name,n);continue}if(yt.has(s)||s.endsWith(":href")){Se(t.value,!1)&&r.removeAttribute(t.name);continue}St.has(s)&&Se(t.value,!0)&&r.removeAttribute(t.name)}}function Pt(r,e){let t=(r.getAttribute("type")||"").toLowerCase();e==="button"&&t!=="button"&&r.setAttribute("type","button"),e==="input"&&/^(submit|reset|image)$/.test(t)&&r.setAttribute("type","button")}function qt(r,e){for(let t of r)for(let s of[...t.attributes]){let n=s.name.toLowerCase(),l=s.value;if((n==="href"||n.endsWith(":href"))&&l.startsWith("#")){let i=Nt(l.slice(1));e.has(i)&&t.setAttribute(s.name,`#${e.get(i)}`)}else if(n==="usemap"&&l.startsWith("#")){let i=e.get(`name:${l.slice(1)}`);i?t.setAttribute(s.name,`#${i}`):t.removeAttribute(s.name)}else if(At.has(n)){let i=l.split(/\s+/).filter(Boolean).map(o=>e.get(o)||(o.startsWith(Y)?o:null)).filter(Boolean);i.length?t.setAttribute(s.name,i.join(" ")):t.removeAttribute(s.name)}else l.includes("url(#")&&t.setAttribute(s.name,l.replace(/url\(#([^)]+)\)/g,(i,o)=>e.has(o)?`url(#${e.get(o)})`:i))}}function Nt(r){try{return decodeURIComponent(r)}catch{return r}}function Ae(r){let e=r.childNodes;if(e)for(let t of[...e])t.nodeType===8?t.remove():(t.nodeType===1||t.nodeType===11)&&Ae(t)}function Te(r,e){Ae(r);let t=[...r.querySelectorAll("*")];e.includeRoot&&t.unshift(r);let s=new Map,n=[],l={...e,ids:s};for(let i of t){if(!Dt(i,r))continue;let o=_t(i);if(e.svgOnly&&(Re.has(o)||o==="style")){if(o==="style"&&$e(i.textContent||"")){i.remove();continue}}else if(It(i,o)){i.remove();continue}if(!e.keepIds&&!e.svgOnly&&vt.has(o)){Bt(i);continue}if(o==="template"){let h=i.content;h&&Te(h,{...e,includeRoot:!1})}Mt(i,l),e.keepIds||Pt(i,o);let a=Tt[o];if(a)for(let h of a)i.removeAttribute(h);if(o==="include-file"&&!e.allowIncludeFile&&i.removeAttribute("src"),!e.keepIds&&!e.svgOnly&&o.includes("-")&&o!=="include-file"&&!zt.has(o))for(let h of Et)i.removeAttribute(h);n.push(i)}!e.keepIds&&s.size&&qt(n,s)}function Bt(r){let e=r.parentNode;if(e){for(let t of[...r.childNodes])e.insertBefore(t,r);r.remove()}}function Dt(r,e){let t=r;for(;t;){if(t===e)return!0;t=t.parentNode??t.parent??null}return!1}function ve(r,e={}){let t=document.createElement("template");return r&&typeof r=="string"&&(t.innerHTML=r,Te(t.content,{allowIncludeFile:!!e.allowIncludeFile,keepIds:!!e.keepIds,keepStyle:!!e.keepStyle})),t.content}var Ot="Failed to load markdown",Ut=/^:::[ \t]*(note|info|tip|warning|danger)(?:[ \t]+([^\n]*?))?[ \t]*\n([\s\S]*?)\n?^:::[ \t]*(?:\n+|$)/m,Ht=r=>r.replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),Zt={name:"vbCallout",level:"block",start(r){return r.match(/^:::[ \t]*(?:note|info|tip|warning|danger)\b/m)?.index},tokenizer(r){let e=Ut.exec(r);if(!e||e.index!==0)return;let t=e[1],s=(e[2]||"").trim()||t[0].toUpperCase()+t.slice(1),n={type:"vbCallout",raw:e[0],kind:t,title:s,tokens:[]};return this.lexer.blockTokens(e[3],n.tokens),n},renderer(r){return`<aside data-callout="${r.kind}" role="note"><p data-callout-title><strong>${Ht(r.title)}</strong></p>${this.parser.parse(r.tokens)}</aside>
60
- `}},jt=new J({gfm:!0,extensions:[Zt]}),ee=class extends _{#r=null;#t=null;#e=null;#a=null;#n=null;#o=null;#s=0;static get observedAttributes(){return["src","sanitize","allow-cross-origin"]}setup(){this.#i()}teardown(){this.#t?.abort(),this.removeAttribute("data-rendered"),this.removeAttribute("data-loading")}attributeChangedCallback(e,t,s){t===s||!this.isConnected||!this.hasAttribute("data-upgraded")||this.#i()}get parser(){return this.#r}set parser(e){this.#r=typeof e=="function"?e:null}get markdown(){return this.#n??this.#o??""}set markdown(e){let t=e==null?null:String(e);this.#n!==t&&(this.#n=t,this.#i())}async render(){await this.#i()}async reload(){this.getAttribute("src")&&await this.#i()}#u(){let e=this.querySelector('script[type="text/markdown"]');if(e)return e.textContent;let t=this.querySelector("template[data-md]");if(t)return t.content.textContent;let s=this.querySelector(":scope > pre");return s?s.textContent:null}#p(e){let t;try{t=new URL(e,document.baseURI)}catch{throw new Error(`Invalid URL: ${e}`)}if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error(`Refused ${t.protocol} URL: only http(s) is allowed`);return this.#c(t.href),t.href}#c(e){if(!this.hasAttribute("allow-cross-origin")&&new URL(e).origin!==location.origin)throw new Error(`Refused cross-origin URL ${e} (add allow-cross-origin to permit)`)}async#i(){let e=++this.#s,t=this.getAttribute("src"),s;if(this.#t?.abort(),this.#t=null,this.removeAttribute("data-rendered"),this.removeAttribute("data-error"),this.removeAttribute("data-loading"),this.#a?.remove(),this.#a=null,t){let i=new AbortController;this.#t=i,this.setAttribute("data-loading",""),this.#l("markdown-viewer:fetch",{src:t});try{let o=this.#p(t),a=await fetch(o,{signal:i.signal});if(a.url&&this.#c(a.url),!a.ok)throw new Error(`HTTP ${a.status}: ${a.statusText}`);s=await a.text()}catch(o){if(o.name==="AbortError"||e!==this.#s)return;this.#h(o);return}if(e!==this.#s)return;this.removeAttribute("data-loading")}else this.#n!=null?s=this.#n:s=this.#u();if(s==null){this.#e?.replaceChildren();return}this.#o=s;let n;try{n=await(await this.#d())(s)}catch(i){if(e!==this.#s)return;this.#h(i);return}if(e!==this.#s)return;(!this.#e||this.#e.parentNode!==this)&&(this.#e=document.createElement("div"),this.#e.className="md-content",this.#e.setAttribute("part","content"),this.appendChild(this.#e)),this.hasAttribute("dir")?this.#e.removeAttribute("dir"):this.#e.setAttribute("dir","auto"),this.#f()?this.#e.replaceChildren(ve(String(n??""))):this.#e.innerHTML=String(n??""),this.#g(),this.setAttribute("data-rendered","");let l=this.getAttribute("ping");if(l&&navigator.sendBeacon?.(l,JSON.stringify({src:t||"inline"})),this.#l("markdown-viewer:rendered",{src:t,node:this.#e}),this.hasAttribute("highlight"))for(let i of this.#e.querySelectorAll('pre > code[class*="language-"]')){let o=i.className.match(/language-(\S+)/)?.[1]||"";this.#l("markdown-viewer:highlight",{node:i,language:o})}}#h(e){if(this.removeAttribute("data-loading"),this.setAttribute("data-error",""),this.#e?.replaceChildren(),!this.querySelector(":scope > pre")){let t=document.createElement("p");t.setAttribute("role","alert"),t.setAttribute("data-md-error",""),t.textContent=this.getAttribute("data-label-error")||Ot,this.append(t),this.#a=t}this.#l("markdown-viewer:error",{error:e.message})}async#d(){return this.#r?this.#r:e=>jt.parse(e)}#f(){let e=this.getAttribute("sanitize");return e==null?!0:!/^(off|false)$/i.test(e.trim())}#g(){if(!this.#e)return;let e=this.dataset.theme??this.closest("[data-theme]")?.dataset.theme;e&&(this.#e.dataset.theme=e)}#l(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};ie("markdown-viewer",ee);export{ee as MarkdownViewer};
58
+ `}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${w(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),n=ce(r);if(n===null)return s;r=n;let a='<a href="'+r+'"';return e&&(a+=' title="'+w(e)+'"'),a+=">"+s+"</a>",a}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let n=ce(r);if(n===null)return w(t);r=n;let a=`<img src="${r}" alt="${w(t)}"`;return e&&(a+=` title="${w(e)}"`),a+=">",a}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:w(r.text)}},X=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},x=class j{options;renderer;textRenderer;constructor(e){this.options=e||A,this.options.renderer=this.options.renderer||new M,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new X}static parse(e,t){return new j(t).parse(e)}static parseInline(e,t){return new j(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let i=n,o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){t+=o||"";continue}}let a=n;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let i='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let n=0;n<e.length;n++){let a=e[n];if(this.options.extensions?.renderers?.[a.type]){let o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=o||"";continue}}let i=a;switch(i.type){case"escape":{s+=t.text(i);break}case"html":{s+=t.html(i);break}case"link":{s+=t.link(i);break}case"image":{s+=t.image(i);break}case"checkbox":{s+=t.checkbox(i);break}case"strong":{s+=t.strong(i);break}case"em":{s+=t.em(i);break}case"codespan":{s+=t.codespan(i);break}case"br":{s+=t.br(i);break}case"del":{s+=t.del(i);break}case"text":{s+=t.text(i);break}default:{let o='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return s}},L=class{options;block;constructor(r){this.options=r||A}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?m.lex:m.lexInline}provideParser(r=this.block){return r?x.parse:x.parseInline}},K=class{defaults=U();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=x;Renderer=M;TextRenderer=X;Lexer=m;Tokenizer=P;Hooks=L;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let n=s;for(let a of n.header)t=t.concat(this.walkTokens(a.tokens,e));for(let a of n.rows)for(let i of a)t=t.concat(this.walkTokens(i.tokens,e));break}case"list":{let n=s;t=t.concat(this.walkTokens(n.items,e));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(a=>{let i=n[a].flat(1/0);t=t.concat(this.walkTokens(i,e))}):n.tokens&&(t=t.concat(this.walkTokens(n.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let a=e.renderers[n.name];a?e.renderers[n.name]=function(...i){let o=n.renderer.apply(this,i);return o===!1&&(o=a.apply(this,i)),o}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=e[n.level];a?a.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),s.extensions=e),t.renderer){let n=this.defaults.renderer||new M(this.defaults);for(let a in t.renderer){if(!(a in n))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let i=a,o=t.renderer[i],l=n[i];n[i]=(...u)=>{let c=o.apply(n,u);return c===!1&&(c=l.apply(n,u)),c||""}}s.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new P(this.defaults);for(let a in t.tokenizer){if(!(a in n))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let i=a,o=t.tokenizer[i],l=n[i];n[i]=(...u)=>{let c=o.apply(n,u);return c===!1&&(c=l.apply(n,u)),c}}s.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new L;for(let a in t.hooks){if(!(a in n))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let i=a,o=t.hooks[i],l=n[i];L.passThroughHooks.has(a)?n[i]=u=>{if(this.defaults.async&&L.passThroughHooksRespectAsync.has(a))return(async()=>{let d=await o.call(n,u);return l.call(n,d)})();let c=o.call(n,u);return l.call(n,c)}:n[i]=(...u)=>{if(this.defaults.async)return(async()=>{let d=await o.apply(n,u);return d===!1&&(d=await l.apply(n,u)),d})();let c=o.apply(n,u);return c===!1&&(c=l.apply(n,u)),c}}s.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,a=t.walkTokens;s.walkTokens=function(i){let o=[];return o.push(a.call(this,i)),n&&(o=o.concat(n.call(this,i))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return m.lex(r,e??this.defaults)}parser(r,e){return x.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},n={...this.defaults,...s},a=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&s.async===!1)return a(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 a(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=r),n.async)return(async()=>{let i=n.hooks?await n.hooks.preprocess(e):e,o=await(n.hooks?await n.hooks.provideLexer(r):r?m.lex:m.lexInline)(i,n),l=n.hooks?await n.hooks.processAllTokens(o):o;n.walkTokens&&await Promise.all(this.walkTokens(l,n.walkTokens));let u=await(n.hooks?await n.hooks.provideParser(r):r?x.parse:x.parseInline)(l,n);return n.hooks?await n.hooks.postprocess(u):u})().catch(a);try{n.hooks&&(e=n.hooks.preprocess(e));let i=(n.hooks?n.hooks.provideLexer(r):r?m.lex:m.lexInline)(e,n);n.hooks&&(i=n.hooks.processAllTokens(i)),n.walkTokens&&this.walkTokens(i,n.walkTokens);let o=(n.hooks?n.hooks.provideParser(r):r?x.parse:x.parseInline)(i,n);return n.hooks&&(o=n.hooks.postprocess(o)),o}catch(i){return a(i)}}}onError(r,e){return t=>{if(t.message+=`
59
+ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+w(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},$=new K;function f(r,e){return $.parse(r,e)}f.options=f.setOptions=function(r){return $.setOptions(r),f.defaults=$.defaults,pe(f.defaults),f};f.getDefaults=U;f.defaults=A;f.use=function(...r){return $.use(...r),f.defaults=$.defaults,pe(f.defaults),f};f.walkTokens=function(r,e){return $.walkTokens(r,e)};f.parseInline=$.parseInline;f.Parser=x;f.parser=x.parse;f.Renderer=M;f.TextRenderer=X;f.Lexer=m;f.lexer=m.lex;f.Tokenizer=P;f.Hooks=L;f.parse=f;var Kt=f.options,Jt=f.setOptions,Yt=f.use,er=f.walkTokens,tr=f.parseInline;var rr=x.parse,nr=m.lex;var kt="http://www.w3.org/1999/xhtml",J="http://www.w3.org/2000/svg",bt="http://www.w3.org/1998/Math/MathML",mt=new Set([kt,J,bt]),Y="user-content-",xt=new Set(["script","iframe","frame","frameset","object","embed","applet","portal","fencedframe","form","base","link","meta","noscript","foreignobject","style","xmp","noembed","noframes","plaintext","mglyph","malignmark","annotation-xml"]),$e=new Set(["title","desc"]),wt=new Set(["animate","set","animatemotion","animatetransform"]),yt=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),St=new Set(["src","poster","srcset"]),$t=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),At=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),Tt=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),vt={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},Rt=new Set(["social-embed","youtube-player","geo-map"]),Et=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],Lt=new Set(["audio-player","video-player","image-map","brand-mark"]);function Ct(r){return String(r).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function Se(r,e=!1){let t=Ct(r);return e?/(^|,)(javascript|vbscript|livescript):/.test(t)?!0:/(^|,)data:/.test(t)?t.split(/(?=data:)/).filter(n=>n.startsWith("data:")).some(n=>!/^data:(image|audio|video|font)\//.test(n)):!1:/^(javascript|vbscript|livescript|data):/.test(t)}function Ae(r){let e=String(r).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(e)}var zt=r=>String(r.localName||r.tagName||"").toLowerCase(),_t=r=>r.startsWith(Y)?r:Y+r;function It(r,e){if(xt.has(e))return!0;let t=r.namespaceURI;return!!(t&&!mt.has(t)||e==="title"&&t!==J||$e.has(e)&&t===J&&r.children?.length||wt.has(e)&&(r.getAttribute("attributeName")||r.getAttribute("attributename")||"").toLowerCase().includes("href"))}function Pt(r,e){for(let t of[...r.attributes]){let s=t.name.toLowerCase();if(s.startsWith("on")||$t.has(s)||!e.keepIds&&At.has(s)){r.removeAttribute(t.name);continue}if(s==="style"){(!e.keepStyle||Ae(t.value))&&r.removeAttribute(t.name);continue}if((s==="id"||s==="name")&&!e.keepIds){let n=_t(t.value);s==="id"?e.ids.set(t.value,n):e.ids.set(`name:${t.value}`,n),r.setAttribute(t.name,n);continue}if(yt.has(s)||s.endsWith(":href")){Se(t.value,!1)&&r.removeAttribute(t.name);continue}St.has(s)&&Se(t.value,!0)&&r.removeAttribute(t.name)}}function Mt(r,e){let t=(r.getAttribute("type")||"").toLowerCase();e==="button"&&t!=="button"&&r.setAttribute("type","button"),e==="input"&&/^(submit|reset|image)$/.test(t)&&r.setAttribute("type","button")}function Bt(r,e){for(let t of r)for(let s of[...t.attributes]){let n=s.name.toLowerCase(),a=s.value;if((n==="href"||n.endsWith(":href"))&&a.startsWith("#")){let i=qt(a.slice(1));e.has(i)&&t.setAttribute(s.name,`#${e.get(i)}`)}else if(n==="usemap"&&a.startsWith("#")){let i=e.get(`name:${a.slice(1)}`);i?t.setAttribute(s.name,`#${i}`):t.removeAttribute(s.name)}else if(Tt.has(n)){let i=a.split(/\s+/).filter(Boolean).map(o=>e.get(o)||(o.startsWith(Y)?o:null)).filter(Boolean);i.length?t.setAttribute(s.name,i.join(" ")):t.removeAttribute(s.name)}else a.includes("url(#")&&t.setAttribute(s.name,a.replace(/url\(#([^)]+)\)/g,(i,o)=>e.has(o)?`url(#${e.get(o)})`:i))}}function qt(r){try{return decodeURIComponent(r)}catch{return r}}function Te(r){let e=r.childNodes;if(e)for(let t of[...e])t.nodeType===8?t.remove():(t.nodeType===1||t.nodeType===11)&&Te(t)}function ve(r,e){Te(r);let t=[...r.querySelectorAll("*")];e.includeRoot&&t.unshift(r);let s=new Map,n=[],a={...e,ids:s};for(let i of t){if(!Ot(i,r))continue;let o=zt(i);if(e.svgOnly&&($e.has(o)||o==="style")){if(o==="style"&&Ae(i.textContent||"")){i.remove();continue}}else if(It(i,o)){i.remove();continue}if(!e.keepIds&&!e.svgOnly&&Rt.has(o)){Dt(i);continue}if(o==="template"){let u=i.content;u&&ve(u,{...e,includeRoot:!1})}Pt(i,a),e.keepIds||Mt(i,o);let l=vt[o];if(l)for(let u of l)i.removeAttribute(u);if(o==="include-file"&&!e.allowIncludeFile&&i.removeAttribute("src"),!e.keepIds&&!e.svgOnly&&o.includes("-")&&o!=="include-file"&&!Lt.has(o))for(let u of Et)i.removeAttribute(u);n.push(i)}!e.keepIds&&s.size&&Bt(n,s)}function Dt(r){let e=r.parentNode;if(e){for(let t of[...r.childNodes])e.insertBefore(t,r);r.remove()}}function Ot(r,e){let t=r;for(;t;){if(t===e)return!0;t=t.parentNode??t.parent??null}return!1}function Re(r,e={}){let t=document.createElement("template");return r&&typeof r=="string"&&(t.innerHTML=r,ve(t.content,{allowIncludeFile:!!e.allowIncludeFile,keepIds:!!e.keepIds,keepStyle:!!e.keepStyle})),t.content}var Ht="Failed to load markdown",jt=/^:::[ \t]*(note|info|tip|warning|danger)(?:[ \t]+([^\n]*?))?[ \t]*\n([\s\S]*?)\n?^:::[ \t]*(?:\n+|$)/m,Ut=r=>r.replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),Zt={name:"vbCallout",level:"block",start(r){return r.match(/^:::[ \t]*(?:note|info|tip|warning|danger)\b/m)?.index},tokenizer(r){let e=jt.exec(r);if(!e||e.index!==0)return;let t=e[1],s=(e[2]||"").trim()||t[0].toUpperCase()+t.slice(1),n={type:"vbCallout",raw:e[0],kind:t,title:s,tokens:[]};return this.lexer.blockTokens(e[3],n.tokens),n},renderer(r){return`<aside data-callout="${r.kind}" role="note"><p data-callout-title><strong>${Ut(r.title)}</strong></p>${this.parser.parse(r.tokens)}</aside>
60
+ `}},Ft=new K({gfm:!0,extensions:[Zt]}),ee=class extends z{#r=null;#t=null;#e=null;#l=null;#n=null;#o=null;#s=0;static get observedAttributes(){return["src","sanitize","allow-cross-origin"]}setup(){this.#i()}teardown(){this.#t?.abort(),this.removeAttribute("data-rendered"),this.removeAttribute("data-loading")}attributeChangedCallback(e,t,s){t===s||!this.isConnected||!this.hasAttribute("data-upgraded")||this.#i()}get parser(){return this.#r}set parser(e){this.#r=typeof e=="function"?e:null}get markdown(){return this.#n??this.#o??""}set markdown(e){let t=e==null?null:String(e);this.#n!==t&&(this.#n=t,this.#i())}async render(){await this.#i()}async reload(){this.getAttribute("src")&&await this.#i()}#h(){let e=this.querySelector('script[type="text/markdown"]');if(e)return e.textContent;let t=this.querySelector("template[data-md]");if(t)return t.content.textContent;let s=this.querySelector(":scope > pre");return s?s.textContent:null}#p(e){let t;try{t=new URL(e,document.baseURI)}catch{throw new Error(`Invalid URL: ${e}`)}if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error(`Refused ${t.protocol} URL: only http(s) is allowed`);return this.#c(t.href),t.href}#c(e){if(!this.hasAttribute("allow-cross-origin")&&new URL(e).origin!==location.origin)throw new Error(`Refused cross-origin URL ${e} (add allow-cross-origin to permit)`)}async#i(){let e=++this.#s,t=this.getAttribute("src"),s;if(this.#t?.abort(),this.#t=null,this.removeAttribute("data-rendered"),this.removeAttribute("data-error"),this.removeAttribute("data-loading"),this.#l?.remove(),this.#l=null,t){let i=new AbortController;this.#t=i,this.setAttribute("data-loading",""),this.#a("markdown-viewer:fetch",{src:t});try{let o=this.#p(t),l=await fetch(o,{signal:i.signal});if(l.url&&this.#c(l.url),!l.ok)throw new Error(`HTTP ${l.status}: ${l.statusText}`);s=await l.text()}catch(o){if(o.name==="AbortError"||e!==this.#s)return;this.#u(o);return}if(e!==this.#s)return;this.removeAttribute("data-loading")}else this.#n!=null?s=this.#n:s=this.#h();if(s==null){this.#e?.replaceChildren();return}this.#o=s;let n;try{n=await(await this.#d())(s)}catch(i){if(e!==this.#s)return;this.#u(i);return}if(e!==this.#s)return;(!this.#e||this.#e.parentNode!==this)&&(this.#e=document.createElement("div"),this.#e.className="md-content",this.#e.setAttribute("part","content"),this.appendChild(this.#e)),this.hasAttribute("dir")?this.#e.removeAttribute("dir"):this.#e.setAttribute("dir","auto"),this.#f()?this.#e.replaceChildren(Re(String(n??""))):this.#e.innerHTML=String(n??""),this.#g(),this.setAttribute("data-rendered","");let a=this.getAttribute("ping");if(a&&navigator.sendBeacon?.(a,JSON.stringify({src:t||"inline"})),this.#a("markdown-viewer:rendered",{src:t,node:this.#e}),this.hasAttribute("highlight"))for(let i of this.#e.querySelectorAll('pre > code[class*="language-"]')){let o=i.className.match(/language-(\S+)/)?.[1]||"";this.#a("markdown-viewer:highlight",{node:i,language:o})}}#u(e){if(this.removeAttribute("data-loading"),this.setAttribute("data-error",""),this.#e?.replaceChildren(),!this.querySelector(":scope > pre")){let t=document.createElement("p");t.setAttribute("role","alert"),t.setAttribute("data-md-error",""),t.textContent=this.getAttribute("data-label-error")||Ht,this.append(t),this.#l=t}this.#a("markdown-viewer:error",{error:e.message})}async#d(){return this.#r?this.#r:e=>Ft.parse(e)}#f(){let e=this.getAttribute("sanitize");return e==null?!0:!/^(off|false)$/i.test(e.trim())}#g(){if(!this.#e)return;let e=this.dataset.theme??this.closest("[data-theme]")?.dataset.theme;e&&(this.#e.dataset.theme=e)}#a(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}};ie("markdown-viewer",ee);export{ee as MarkdownViewer};
61
61
  //# sourceMappingURL=markdown-viewer.js.map
@@ -1,2 +1,2 @@
1
- var A=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function g(s,t,n={}){let e=n.priority??10,r={impl:t,bundle:n.bundle,contract:n.contract,priority:e},i=m.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 "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${n.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 "${n.bundle}" (first wins at equal priority).`);return}m.set(s,r),customElements.define(s,t)}var f=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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,n,e,r){t.addEventListener(n,e,r),this.#e.push(()=>t.removeEventListener(n,e,r))}_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,n){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{n?e.add(t):e.delete(t)}catch{let r=`--${t}`;n?e.add(r):e.delete(r)}}_adoptInternals(t){this.#t||(this.#t=t)}#n(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var b=class extends f{#e=null;#t=!1;#n=null;setup(){!this.hasAttribute("role")&&!this.querySelector("nav")&&this.setAttribute("role","navigation"),this.#r("pathname"),this.listen(window,"popstate",this.#o);let t=window.navigation;t&&typeof t.addEventListener=="function"&&this.listen(t,"currententrychange",this.#a)}get items(){return this.#e?this.#e.map(t=>({...t})):Array.from(this.#i()).map(t=>({href:t.getAttribute("href")||"",label:t.textContent?.trim()||""}))}set items(t){if(!Array.isArray(t))return;let n=t.map(e=>({...e}));this.#e&&this.#h(this.#e,n)||(this.#e=n,this.#u(n),this.#t?this.#s(this.#n):this.#r("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.#n;for(let t of this.#i())if(t.getAttribute("aria-current")==="page")return t.getAttribute("data-route")||t.getAttribute("href")||null;return null}set current(t){let n=this.current,e=t==null?null:String(t);this.#t=!0,this.#n=e,this.#s(e),n!==e&&this.dispatchEvent(new CustomEvent("nav-bar:current-changed",{detail:{current:e,previous:n,source:"property"},bubbles:!0,composed:!0}))}releaseCurrent(){this.#t&&(this.#t=!1,this.#n=null,this.#r("pathname"))}refresh(){this.#t||this.#r("pathname")}#i(){let t=this.querySelectorAll("a[data-nav-link]");return t.length>0?t:this.querySelectorAll(":scope > a")}#o=()=>{this.#t||this.#r("popstate")};#a=()=>{queueMicrotask(()=>{this.#t||!this.isConnected||this.#r("navigation")})};#r(t){let n=this.current,e=this.#c();this.#s(e),e==null&&this.#l(),n!==e&&this.dispatchEvent(new CustomEvent("nav-bar:current-changed",{detail:{current:e,previous:n,source:t},bubbles:!0,composed:!0}))}#c(){let t=p(window.location.pathname),n=window.location.origin,e=Array.from(this.#i());if(e.length===0)return null;let r=this.getAttribute("data-match")==="exact",i=null,o=null,d=-1;for(let u of e){let l=u.getAttribute("href");if(!l||l.startsWith("#"))continue;let c;try{c=new URL(l,document.baseURI)}catch{continue}if(!/^https?:$/.test(c.protocol)||c.origin!==n)continue;let a=p(c.pathname);if(a===t){i==null&&(i=u);continue}!r&&a!=="/"&&t.startsWith(a+"/")&&a.length>d&&(o=u,d=a.length)}let h=i||o;return h?h.getAttribute("data-route")||h.getAttribute("href"):null}#l(){let t=p(window.location.pathname),n=window.location.origin,e=this.getAttribute("data-match")==="exact",r=null,i=-1;for(let o of this.querySelectorAll("a[data-nav-link]")){let d=o.closest("drop-down, li");if(!(!d||!this.contains(d)))for(let h of d.querySelectorAll("a[href]:not([data-nav-link])")){let u=h.getAttribute("href");if(!u||u.startsWith("#"))continue;let l;try{l=new URL(u,document.baseURI)}catch{continue}if(!/^https?:$/.test(l.protocol)||l.origin!==n)continue;let c=p(l.pathname),a=-1;c===t?a=Number.MAX_SAFE_INTEGER:!e&&c!=="/"&&t.startsWith(c+"/")&&(a=c.length),a>i&&(r=o,i=a)}}r&&r.setAttribute("aria-current","true")}#s(t){let n=this.#i();for(let e of n){let r=e.getAttribute("data-route")||e.getAttribute("href");t!=null&&r===t?e.setAttribute("aria-current","page"):e.removeAttribute("aria-current")}}#u(t){this.querySelectorAll(":scope > a").forEach(r=>r.remove());let n=this.querySelector("a[data-nav-link]")!=null,e=document.createDocumentFragment();for(let r of t){let i=this.#d(r);n&&i.setAttribute("data-nav-link",""),e.appendChild(i)}this.appendChild(e)}#d(t){let n=document.createElement("a"),e=y(t.href);if(e!=null&&n.setAttribute("href",e),t.route&&n.setAttribute("data-route",t.route),t.external&&(n.target="_blank",n.rel="noopener noreferrer"),t.icon){let r=document.createElement("icon-wc");r.setAttribute("name",String(t.icon)),r.setAttribute("size","sm"),n.appendChild(r)}if(n.appendChild(document.createTextNode(t.label||"")),t.external){let r=document.createElement("span");r.className="sr-only",r.textContent=` ${this.getAttribute("data-label-new-tab")??"(opens in new tab)"}`,n.appendChild(r)}if(t.badge!=null){let r=document.createElement("span");r.className="badge",r.textContent=String(t.badge),n.appendChild(r)}return n}#h(t,n){if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++){let r=Object.keys(t[e]).sort(),i=Object.keys(n[e]).sort();if(r.length!==i.length)return!1;for(let o=0;o<r.length;o++)if(r[o]!==i[o]||t[e][r[o]]!==n[e][i[o]])return!1}return!0}};function p(s){let t=s.replace(/\/+$/,"");return t===""?"/":t}function y(s){if(s==null||s==="")return"#";let t=String(s),n;try{n=new URL(t,document.baseURI)}catch{return null}return/^https?:$/.test(n.protocol)?t:null}g("nav-bar",b);export{b as NavBar};
1
+ var A=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function g(s,t,r={}){let e=r.priority??10,n={impl:t,bundle:r.bundle,contract:r.contract,priority:e},i=m.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}m.set(s,n),customElements.define(s,t)}var h=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var b=class extends h{#e=null;#t=!1;#r=null;setup(){!this.hasAttribute("role")&&!this.querySelector("nav")&&this.setAttribute("role","navigation"),this.#n("pathname"),this.listen(window,"popstate",this.#o);let t=window.navigation;t&&typeof t.addEventListener=="function"&&this.listen(t,"currententrychange",this.#a)}get items(){return this.#e?this.#e.map(t=>({...t})):Array.from(this.#i()).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.#f(this.#e,r)||(this.#e=r,this.#l(r),this.#t?this.#s(this.#r):this.#n("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.#r;for(let t of this.#i())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.#r=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.#r=null,this.#n("pathname"))}refresh(){this.#t||this.#n("pathname")}#i(){let t=this.querySelectorAll("a[data-nav-link]");return t.length>0?t:this.querySelectorAll(":scope > a")}#o=()=>{this.#t||this.#n("popstate")};#a=()=>{queueMicrotask(()=>{this.#t||!this.isConnected||this.#n("navigation")})};#n(t){let r=this.current,e=this.#c();this.#s(e),e==null&&this.#u(),r!==e&&this.dispatchEvent(new CustomEvent("nav-bar:current-changed",{detail:{current:e,previous:r,source:t},bubbles:!0,composed:!0}))}#c(){let t=p(window.location.pathname),r=window.location.origin,e=Array.from(this.#i());if(e.length===0)return null;let n=this.getAttribute("data-match")==="exact",i=null,o=null,d=-1;for(let l of e){let u=l.getAttribute("href");if(!u||u.startsWith("#"))continue;let c;try{c=new URL(u,document.baseURI)}catch{continue}if(!/^https?:$/.test(c.protocol)||c.origin!==r)continue;let a=p(c.pathname);if(a===t){i==null&&(i=l);continue}!n&&a!=="/"&&t.startsWith(a+"/")&&a.length>d&&(o=l,d=a.length)}let f=i||o;return f?f.getAttribute("data-route")||f.getAttribute("href"):null}#u(){let t=p(window.location.pathname),r=window.location.origin,e=this.getAttribute("data-match")==="exact",n=null,i=-1;for(let o of this.querySelectorAll("a[data-nav-link]")){let d=o.closest("drop-down, li");if(!(!d||!this.contains(d)))for(let f of d.querySelectorAll("a[href]:not([data-nav-link])")){let l=f.getAttribute("href");if(!l||l.startsWith("#"))continue;let u;try{u=new URL(l,document.baseURI)}catch{continue}if(!/^https?:$/.test(u.protocol)||u.origin!==r)continue;let c=p(u.pathname),a=-1;c===t?a=Number.MAX_SAFE_INTEGER:!e&&c!=="/"&&t.startsWith(c+"/")&&(a=c.length),a>i&&(n=o,i=a)}}n&&n.setAttribute("aria-current","true")}#s(t){let r=this.#i();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")}}#l(t){this.querySelectorAll(":scope > a").forEach(n=>n.remove());let r=this.querySelector("a[data-nav-link]")!=null,e=document.createDocumentFragment();for(let n of t){let i=this.#d(n);r&&i.setAttribute("data-nav-link",""),e.appendChild(i)}this.appendChild(e)}#d(t){let r=document.createElement("a"),e=y(t.href);if(e!=null&&r.setAttribute("href",e),t.route&&r.setAttribute("data-route",t.route),t.external&&(r.target="_blank",r.rel="noopener noreferrer"),t.icon){let n=document.createElement("icon-wc");n.setAttribute("name",String(t.icon)),n.setAttribute("size","sm"),r.appendChild(n)}if(r.appendChild(document.createTextNode(t.label||"")),t.external){let n=document.createElement("span");n.className="sr-only",n.textContent=` ${this.getAttribute("data-label-new-tab")??"(opens in new tab)"}`,r.appendChild(n)}if(t.badge!=null){let n=document.createElement("span");n.className="badge",n.textContent=String(t.badge),r.appendChild(n)}return r}#f(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}};function p(s){let t=s.replace(/\/+$/,"");return t===""?"/":t}function y(s){if(s==null||s==="")return"#";let t=String(s),r;try{r=new URL(t,document.baseURI)}catch{return null}return/^https?:$/.test(r.protocol)?t:null}g("nav-bar",b);export{b as NavBar};
2
2
  //# sourceMappingURL=nav-bar.js.map
@@ -1,7 +1,7 @@
1
- var E=class extends HTMLElement{#t=[];#n;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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)}#i(){return this.constructor.formAssociated&&this.#n?this.#n:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var dt=window.matchMedia("(prefers-reduced-motion: reduce)");var B=new Map;function F(s,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},o=B.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}B.set(s,i),customElements.define(s,t)}function G(){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]=G()),C[S]}function N(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 H(s){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${s}:`}function I(s){try{let t=JSON.parse(s);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var v={configure(s={}){C[S]=s.backend??null},async set(s,t,e){let n={data:e,timestamp:Date.now()};await u().setRaw(N(s,t),JSON.stringify(n))},async get(s,t,e){let n=await u().getRaw(N(s,t));if(n==null)return null;let i=I(n);return!i||e?.maxAge!=null&&Date.now()-i.timestamp>e.maxAge?null:i.data},async remove(s,t){await u().removeRaw(N(s,t))},async list(s){let t=H(s),e=await u().keys(t),n=[];for(let i of e){let o=await u().getRaw(i);if(o==null)continue;let r=I(o);r&&n.push({key:i.slice(t.length),data:r.data,timestamp:r.timestamp})}return n},async clear(s){let t=H(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 v.set(s,e,n)}};if(typeof window<"u"){let s=window.VB??(window.VB={});s.store??=v}var J=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),_=new WeakMap;function Q(s,t){let e=_.get(t);e||_.set(t,e=new Map);let n=e.get(s);if(!n||!n.region.isConnected){let o=(t.ownerDocument||document).createElement("span");o.setAttribute("data-vb-announcer",s),o.setAttribute("role",s==="assertive"?"alert":"status"),o.setAttribute("aria-live",s),o.setAttribute("aria-atomic","true"),o.style.cssText=J,t.appendChild(o),n={region:o},e.set(s,n)}return n}function A(s,{politeness:t="polite",root:e}={}){let n=String(s??"").trim();if(!n||typeof document>"u")return null;let i=e||document.body;if(!i)return null;let r=Q(t==="assertive"?"assertive":"polite",i);return clearTimeout(r.write),clearTimeout(r.clear),r.region.textContent="",r.write=setTimeout(()=>{r.region.textContent=n,r.clear=setTimeout(()=>{r.region.textContent=""},7e3)},50),r.region}var R="[data-highlights]",P="highlights",Z=["yellow","green","blue","pink"];var tt=typeof CSS<"u"&&"highlights"in CSS,O=new WeakMap;function D(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 et=/^[a-z0-9_-]+$/i,q=["solid","double","dotted","dashed","wavy"],nt={annotation:"You highlighted",added:"Highlight added",removed:"Highlight removed",noteSaved:"Note saved"};function x(s,t){let e="highlightsLabel"+t[0].toUpperCase()+t.slice(1);return s.dataset[e]||nt[t]}function it(s,{textLength:t,colors:e}){if(!s||typeof s!="object")return null;let n=s,{startOffset:i,endOffset:o,color:r}=n;if(!Number.isInteger(i)||!Number.isInteger(o))return null;let l=i,c=o;return l<0||c<=l||c>t||!L(r)||!e.includes(r)||n.id!=null&&(typeof n.id!="string"||!/^[\w-]{1,64}$/.test(n.id))||n.text!=null&&typeof n.text!="string"||n.note!=null&&typeof n.note!="string"?null:{id:n.id||W(),startOffset:l,endOffset:c,text:n.text??"",color:r,note:n.note??"",created:Number.isFinite(n.created)?n.created:Date.now()}}function L(s){return typeof s=="string"&&et.test(s)}var g=null,m=new Map,w=new Map;function X(){if(m.size===0){g&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(n=>n!==g),g=null);return}g||(g=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,g]);let s=[...m.keys()],t=s.map(n=>`::highlight(hn-${n}) { background-color: var(--highlight-${n}); color: var(--highlight-${n}-ink, var(--highlight-ink, CanvasText)); text-decoration-line: underline; text-decoration-color: var(--highlight-${n}); text-underline-offset: 2px; }`),e=s.map((n,i)=>`::highlight(hn-${n}) { background-color: Mark; color: MarkText; text-decoration-line: underline; text-decoration-color: MarkText; text-decoration-style: ${q[i%q.length]}; text-decoration-thickness: 2px; }`);g.replaceSync(`${t.join(`
1
+ var w=class extends HTMLElement{#t=[];#n;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}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,s){t.addEventListener(e,n,s),this.#t.push(()=>t.removeEventListener(e,n,s))}_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 s=`--${t}`;e?n.add(s):n.delete(s)}}_adoptInternals(t){this.#n||(this.#n=t)}#i(){return this.constructor.formAssociated&&this.#n?this.#n:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var St=window.matchMedia("(prefers-reduced-motion: reduce)");var F=new Map;function I(i,t,e={}){let n=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:n},r=F.get(i);if(customElements.get(i)){if(!r||r.priority>=n){r&&r.priority===n&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=n){r.priority===n&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}F.set(i,s),customElements.define(i,t)}function nt(){let i=globalThis.localStorage;if(!i)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return i.getItem(t)},async setRaw(t,e){i.setItem(t,e)},async removeRaw(t){i.removeItem(t)},async keys(t){let e=[];for(let n=0;n<i.length;n++){let s=i.key(n);s&&s.startsWith(t)&&e.push(s)}return e}}}var x="__vbStoreBackend",S=globalThis;function p(){return S[x]||(S[x]=nt()),S[x]}function O(i,t){if(typeof i!="string"||!i)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:${i}:${t}`}function N(i){if(typeof i!="string"||!i)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${i}:`}function q(i){try{let t=JSON.parse(i);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var v={configure(i={}){S[x]=i.backend??null},async set(i,t,e){let n={data:e,timestamp:Date.now()};await p().setRaw(O(i,t),JSON.stringify(n))},async get(i,t,e){let n=await p().getRaw(O(i,t));if(n==null)return null;let s=q(n);return!s||e?.maxAge!=null&&Date.now()-s.timestamp>e.maxAge?null:s.data},async remove(i,t){await p().removeRaw(O(i,t))},async list(i){let t=N(i),e=await p().keys(t),n=[];for(let s of e){let r=await p().getRaw(s);if(r==null)continue;let o=q(r);o&&n.push({key:s.slice(t.length),data:o.data,timestamp:o.timestamp})}return n},async clear(i){let t=N(i),e=await p().keys(t);for(let n of e)await p().removeRaw(n)},async clearAll(){let i=await p().keys("vb:");for(let t of i)await p().removeRaw(t)},async setMany(i,t){for(let[e,n]of t)await v.set(i,e,n)}};if(typeof window<"u"){let i=window.VB??(window.VB={});i.store??=v}var it=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),D=new WeakMap;function st(i,t){let e=D.get(t);e||D.set(t,e=new Map);let n=e.get(i);if(!n||!n.region.isConnected){let r=(t.ownerDocument||document).createElement("span");r.setAttribute("data-vb-announcer",i),r.setAttribute("role",i==="assertive"?"alert":"status"),r.setAttribute("aria-live",i),r.setAttribute("aria-atomic","true"),r.style.cssText=it,t.appendChild(r),n={region:r},e.set(i,n)}return n}function A(i,{politeness:t="polite",root:e}={}){let n=String(i??"").trim();if(!n||typeof document>"u")return null;let s=e||document.body;if(!s)return null;let o=st(t==="assertive"?"assertive":"polite",s);return clearTimeout(o.write),clearTimeout(o.clear),o.region.textContent="",o.write=setTimeout(()=>{o.region.textContent=n,o.clear=setTimeout(()=>{o.region.textContent=""},7e3)},50),o.region}var V=i=>i.replace(/\s+/g,""),rt=i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function ot(i,t){let e=0;for(;e<i.length&&e<t.length&&i[i.length-1-e]===t[t.length-1-e];)e++;return e}function at(i,t){let e=0;for(;e<i.length&&e<t.length&&i[e]===t[e];)e++;return e}function C(i,t,e){return{prefix:i.slice(Math.max(0,t-32),t),suffix:i.slice(e,e+32)}}function j(i,t){let e=V(t.text??"");if(!e)return null;if(t.endOffset<=i.length&&V(i.slice(t.startOffset,t.endOffset))===e)return{start:t.startOffset,end:t.endOffset};let n=new RegExp(t.text.trim().split(/\s+/).map(rt).join("\\s*"),"g"),s=t.prefix??"",r=t.suffix??"",o=null,a=-1,l=1/0;for(let c of i.matchAll(n)){let d=c.index,f=d+c[0].length,u=C(i,d,f),g=ot(u.prefix,s)+at(u.suffix,r),h=Math.abs(d-t.startOffset);(g>a||g===a&&h<l)&&(o={start:d,end:f},a=g,l=h)}return o}var R="[data-highlights]",X="highlights",ct=["yellow","green","blue","pink"];var lt=typeof CSS<"u"&&"highlights"in CSS,$=new WeakMap;function U(i){let t=2166136261;for(let e=0;e<i.length;e++)t^=i.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function J(){return"hn-"+crypto.randomUUID().slice(0,8)}var dt=/^[a-z0-9_-]+$/i,G=["solid","double","dotted","dashed","wavy"],ht={annotation:"You highlighted",added:"Highlight added",removed:"Highlight removed",noteSaved:"Note saved"};function k(i,t){let e="highlightsLabel"+t[0].toUpperCase()+t.slice(1);return i.dataset[e]||ht[t]}function ut(i,{textLength:t,colors:e}){if(!i||typeof i!="object")return null;let n=i,{startOffset:s,endOffset:r,color:o}=n;if(!Number.isInteger(s)||!Number.isInteger(r))return null;let a=s,l=r;return a<0||l<=a||l>t||!M(o)||!e.includes(o)||n.id!=null&&(typeof n.id!="string"||!/^[\w-]{1,64}$/.test(n.id))||n.text!=null&&typeof n.text!="string"||n.note!=null&&typeof n.note!="string"||n.prefix!=null&&typeof n.prefix!="string"||n.suffix!=null&&typeof n.suffix!="string"?null:{id:n.id||J(),startOffset:a,endOffset:l,text:n.text??"",prefix:(n.prefix??"").slice(-32),suffix:(n.suffix??"").slice(0,32),color:o,note:n.note??"",created:Number.isFinite(n.created)?n.created:Date.now()}}function M(i){return typeof i=="string"&&dt.test(i)}var m=null,b=new Map,E=new Map;function Q(){if(b.size===0){m&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(n=>n!==m),m=null);return}m||(m=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,m]);let i=[...b.keys()],t=i.map(n=>`::highlight(hn-${n}) { background-color: var(--highlight-${n}); color: var(--highlight-${n}-ink, var(--highlight-ink, CanvasText)); text-decoration-line: underline; text-decoration-color: var(--highlight-${n}); text-underline-offset: 2px; }`),e=i.map((n,s)=>`::highlight(hn-${n}) { background-color: Mark; color: MarkText; text-decoration-line: underline; text-decoration-color: MarkText; text-decoration-style: ${G[s%G.length]}; text-decoration-thickness: 2px; }`);m.replaceSync(`${t.join(`
2
2
  `)}
3
3
  @media (forced-colors: active) {
4
4
  ${e.join(`
5
5
  `)}
6
- }`)}function st(s){for(let t of s)m.set(t,(m.get(t)??0)+1);X()}function ot(s){for(let t of s){let e=(m.get(t)??0)-1;e>0?m.set(t,e):m.delete(t)}X()}function rt(s){let t=w.get(s),e=t?[...t.values()].flat():[];e.length===0?(CSS.highlights.delete(`hn-${s}`),w.delete(s)):CSS.highlights.set(`hn-${s}`,new Highlight(...e))}function V(s,t){let e=new Set(t.keys());for(let[n,i]of w)i.has(s)&&e.add(n);for(let n of e){let i=t.get(n)??[],o=w.get(n);i.length?(o||w.set(n,o=new Map),o.set(s,i)):o?.delete(s),rt(n)}}function j(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 k(s,t,e){let n=document.createTreeWalker(s,NodeFilter.SHOW_TEXT),i=0,o=null,r=0,l=null,c=0;for(;n.nextNode();){let a=n.currentNode,h=(a.textContent??"").length;if(!o&&i+h>t&&(o=a,r=t-i),i+h>=e){l=a,c=e-i;break}i+=h}if(!o||!l)return null;try{let a=document.createRange();return a.setStart(o,Math.min(r,(o.textContent??"").length)),a.setEnd(l,Math.min(c,(l.textContent??"").length)),a}catch{return null}}var T=class{#t;#n;#i;#f;#e=[];#r=!tt;#s;#g;#a=!1;#h=[];#o=new Map;constructor(t){this.#t=t,this.#f=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(L):[...Z];this.#i=[...new Set(i)],this.#r||st(this.#i),this.#u(),this.#f||(this.#s=this.#p.bind(this),this.#g=this.#c.bind(this),t.addEventListener("pointerup",this.#s),t.addEventListener("click",this.#g)),t.setAttribute("data-highlights-init",""),this.#S().then(()=>{this.#a||this.#u()})}get colors(){return[...this.#i]}get destroyed(){return this.#a}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.#d(),this.#u(),this.#l("highlights:removed",{id:t}),A(x(this.#t,"removed")))}clearAll(){this.#e=[],this.#d(),this.#u()}exportHighlights(){return JSON.stringify({version:1,highlights:this.#e})}importHighlights(t){let e;try{e=typeof t=="string"?JSON.parse(t):t}catch{return{imported:0,rejected:0}}if(!e||!Array.isArray(e.highlights))return{imported:0,rejected:0};let n=this.#m(e.highlights);return this.#e=n,this.#d(),this.#u(),{imported:n.length,rejected:e.highlights.length-n.length}}#m(t){let e={textLength:(this.#t.textContent??"").length,colors:this.#i},n=new Set,i=[];for(let o of t){let r=it(o,e);!r||n.has(r.id)||(n.add(r.id),i.push(r))}return i}destroy(){this.#a||(this.#a=!0,this.#s&&this.#t.removeEventListener("pointerup",this.#s),this.#g&&this.#t.removeEventListener("click",this.#g),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()}):(V(this,new Map),ot(this.#i)),this.#b(),this.#o.clear(),this.#t.removeAttribute("data-highlights-init"),O.get(this.#t)===this&&O.delete(this.#t))}#p(){requestAnimationFrame(()=>{if(this.#a)return;let t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return;let e=t.getRangeAt(0);this.#t.contains(e.commonAncestorContainer)&&this.#l("highlights:selected",{text:t.toString().trim(),rect:e.getBoundingClientRect()})})}#c(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.#l("highlights:clicked",{id:i,highlight:{...o}}),this.#l("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.#l("highlights:clicked",{id:i,highlight:{...o}});return}}if(!this.#r){let i=this.#E(t.clientX,t.clientY);i&&this.#l("highlights:clicked",{id:i.id,highlight:{...i}})}}findHighlightRect(t){let e=this.#e.find(o=>o.id===t);if(!e)return null;let n=this.#w(e);if(!n)return null;let i=n.getClientRects();return i.length?i[0]:null}#w(t){return this.#o.get(t.id)??k(this.#t,t.startOffset,t.endOffset)}#y(){this.#o.clear();for(let t of this.#e){let e=k(this.#t,t.startOffset,t.endOffset);e&&this.#o.set(t.id,e)}}#E(t,e){for(let n of this.#e){let i=this.#o.get(n.id);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=j(this.#t,n.startContainer,n.startOffset),o=j(this.#t,n.endContainer,n.endOffset);if(i<0||o<0||i>=o)return;let r=e.toString().trim(),l={id:W(),startOffset:i,endOffset:o,text:r,color:t,note:"",created:Date.now()};this.#e.push(l),this.#d(),this.#u(),e.removeAllRanges(),this.#l("highlights:added",{id:l.id,text:r,color:t,note:""}),A(x(this.#t,"added"))}_changeColor(t,e){let n=this.#e.find(i=>i.id===t);n&&(n.color=e,this.#d(),this.#u())}_updateNote(t,e){let n=this.#e.find(i=>i.id===t);n&&(n.note=e,this.#d(),this.#v(),this.#l("highlights:note-changed",{id:t,note:e}),A(x(this.#t,"noteSaved")))}async#S(){let t=await v.get(P,this.#n);if(!t||!Array.isArray(t.highlights)||this.#a)return;let e=this.#m(t.highlights),n=D(this.#t.textContent);t.contentHash&&t.contentHash!==n?(this.#e=e.filter(i=>{let o=k(this.#t,i.startOffset,i.endOffset);return o?o.toString().trim()===i.text:!1}),this.#d()):this.#e=e}#d(){let t={version:1,contentHash:D(this.#t.textContent),highlights:this.#e};v.set(P,this.#n,t).catch(()=>{})}#u(){this.#r?(this.#A(),this.#y()):(this.#y(),this.#C()),this.#v()}#C(){let t=new Map;for(let e of this.#i)t.set(e,[]);for(let e of this.#e){let n=this.#o.get(e.id);n&&t.has(e.color)&&t.get(e.color).push(n)}V(this,t)}#A(){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=k(this.#t,e.startOffset,e.endOffset);if(!n)continue;let i=document.createElement("mark");i.dataset.hnId=e.id,L(e.color)&&(i.dataset.hnColor=e.color,i.style.setProperty("--_hn-color",`var(--highlight-${e.color})`),i.style.setProperty("--_hn-ink",`var(--highlight-${e.color}-ink, var(--highlight-ink))`));try{n.surroundContents(i)}catch{let o=n.extractContents();i.appendChild(o),n.insertNode(i)}}}#b(){for(let t of this.#h)t.remove();this.#h=[]}#v(){if(this.#b(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");let e=this.#t.getBoundingClientRect(),n=x(this.#t,"annotation");for(let i of this.#e){let o=this.#o.get(i.id);if(!o)continue;let r=o.getClientRects();if(r.length===0)continue;let l=r[0].top-e.top,c=document.createElement("span");if(c.className="hn-margin-annotation",c.dataset.hnId=i.id,c.setAttribute("aria-hidden","true"),c.style.insetBlockStart=`${l}px`,i.note){let a=document.createElement("span");a.className="hn-note-indicator",a.textContent="*",c.append(a,` ${n}`),c.classList.add("hn-has-note")}else c.textContent=n;this.#t.appendChild(c),this.#h.push(c)}}#l(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}};function y(s){let t=O.get(s);if(t&&!t.destroyed)return t;let e=new T(s);return O.set(s,e),e}function z(s=document){s.querySelectorAll(R).forEach(t=>{t.hasAttribute("data-highlights-init")||y(t)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>z()):z();var at=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(R)&&y(n),n.querySelectorAll(R).forEach(i=>{i.hasAttribute("data-highlights-init")||y(i)})}});at.observe(document.documentElement,{childList:!0,subtree:!0});var ct={add:"Add private note",view:"View notes",dialog:"Private note",heading:"Private note",placeholder:"Add a note\u2026",textarea:"Note for highlighted text",save:"Save",cancel:"Cancel"},K=!1,$=new Set;function U(s,t,e){if(!s.contains(t))return-1;let n=document.createRange();return n.setStart(s,0),n.setEnd(t,e),n.toString().length}var M=class extends E{#t=!1;#n=null;#i=null;#f=null;#e=null;#r=null;setup(){this.#t=!!this.closest("selection-menu");let t=this.hasAttribute("for");$.add(this),K||(K=!0,document.addEventListener("highlights:request-note",lt));let e=this.querySelector(":scope > button[data-note-action]");if(!this.#t&&!t){e?.remove();return}if(!e){e=document.createElement("button"),e.type="button",e.setAttribute("data-note-action","");let n=document.createElement("icon-wc");n.setAttribute("name","sticky-note"),n.setAttribute("size","sm"),n.setAttribute("aria-hidden","true"),e.appendChild(n),this.appendChild(e)}e.setAttribute("aria-label",this.#s(this.#t?"add":"view")),this.listen(e,"click",this.#t?()=>this.#g():()=>this.#a())}teardown(){$.delete(this),this.#c({restoreFocus:!1})}#s(t){return this.getAttribute(`data-label-${t}`)??ct[t]??t}openFor(t,e,n){this.#h(t,e,n??document.activeElement)}#g(){let t=this.closest("selection-menu");if(!t)return;let e=t.getSelection();if(!e)return;let n=e.target,i=document.activeElement;n.hasAttribute("data-highlights-init")||n.setAttribute("data-highlights","");let o=y(n),r=e.range,l=U(n,r.startContainer,r.startOffset),c=U(n,r.endContainer,r.endOffset),a=null;if(l>=0&&c>l&&(a=o.getHighlights().find(h=>h.startOffset<=l&&h.endOffset>=c)??null),!a){let h=window.getSelection();h&&(h.isCollapsed||h.rangeCount===0)&&(h.removeAllRanges(),h.addRange(r)),o._createFromSelection("yellow");let p=o.getHighlights();a=p.find(f=>f.startOffset===l&&f.endOffset===c)??p[p.length-1]??null}t.dismiss(),a&&this.#h(a,o,i)}#a(){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.find(r=>r.note)??i[0];o&&this.#h(o,n,document.activeElement)}#h(t,e,n){this.#c({restoreFocus:!1});let i=e.element;this.#i=n&&n!==document.body?n:null,this.#f=t,this.#e=e;let o=document.createElement("div");o.className="hn-note-panel",o.setAttribute("role","dialog"),o.setAttribute("aria-label",this.#s("dialog"));let r=document.createElement("header");r.className="hn-note-header";let l=document.createElement("small");l.textContent=this.#s("heading"),r.appendChild(l),o.appendChild(r);let c=document.createElement("blockquote");c.className="hn-note-quote",c.textContent=t.text.length>80?t.text.slice(0,80)+"\u2026":t.text,o.appendChild(c);let a=document.createElement("textarea");a.className="hn-note-textarea",a.placeholder=this.#s("placeholder"),a.value=t.note||"",a.rows=3,a.setAttribute("aria-label",this.#s("textarea")),o.appendChild(a);let h=document.createElement("footer");h.className="hn-note-actions";let p=()=>{e._updateNote(t.id,a.value.trim()),this.#c()},f=document.createElement("button");f.type="button",f.className="hn-action hn-action-save",f.textContent=this.#s("save"),f.addEventListener("click",p);let b=document.createElement("button");if(b.type="button",b.className="hn-action",b.textContent=this.#s("cancel"),b.addEventListener("click",()=>this.#c()),h.append(f,b),o.appendChild(h),o.addEventListener("keydown",d=>{d.key==="Escape"?(d.preventDefault(),d.stopPropagation(),this.#c()):d.key==="Enter"&&(d.metaKey||d.ctrlKey)&&d.target===a&&(d.preventDefault(),p())}),getComputedStyle(i).position==="static"&&(i.setAttribute("data-note-host",""),this.#r=i),i.appendChild(o),typeof e.findHighlightRect=="function"){let d=e.findHighlightRect(t.id);if(d){let Y=i.getBoundingClientRect();o.style.top=`${d.top-Y.top}px`}}this.#n=o,requestAnimationFrame(()=>{this.#n===o&&(a.focus(),document.addEventListener("pointerdown",this.#o))})}#o=t=>{if(!this.#n||this.#n.contains(t.target))return;this.#c({restoreFocus:!1});let e=this.#m;document.addEventListener("pointerup",()=>{setTimeout(()=>{let n=document.activeElement;(!n||n===document.body)&&e?.()})},{once:!0,capture:!0})};#m=null;#p(){let t=this.#i,e=this.#e?.element,n=this.#f?.id;return()=>{if(t?.isConnected&&(typeof t.checkVisibility!="function"||t.checkVisibility())&&(t.focus({preventScroll:!0}),document.activeElement===t)||!e?.isConnected)return;let o=(n?e.querySelector(`mark[data-hn-id="${CSS.escape(n)}"]`):null)??e;o.tabIndex<0&&!o.hasAttribute("tabindex")&&(o.setAttribute("tabindex","-1"),o.addEventListener("blur",()=>o.removeAttribute("tabindex"),{once:!0})),o.focus({preventScroll:!0})}}#c({restoreFocus:t=!0}={}){if(!this.#n)return;let e=this.#p();document.removeEventListener("pointerdown",this.#o),this.#n.remove(),this.#n=null,this.#r?.removeAttribute("data-note-host"),this.#r=null,this.#m=e,this.#i=null,this.#f=null,this.#e=null,t&&e()}};function lt(s){let{highlight:t,controller:e}=s.detail||{};if(!t||!e)return;let n=$.values().next().value;n&&n.openFor(t,e)}F("note-wc",M);
6
+ }`)}function ft(i){for(let t of i)b.set(t,(b.get(t)??0)+1);Q()}function gt(i){for(let t of i){let e=(b.get(t)??0)-1;e>0?b.set(t,e):b.delete(t)}Q()}function pt(i){let t=E.get(i),e=t?[...t.values()].flat():[];e.length===0?(CSS.highlights.delete(`hn-${i}`),E.delete(i)):CSS.highlights.set(`hn-${i}`,new Highlight(...e))}function K(i,t){let e=new Set(t.keys());for(let[n,s]of E)s.has(i)&&e.add(n);for(let n of e){let s=t.get(n)??[],r=E.get(n);s.length?(r||E.set(n,r=new Map),r.set(i,s)):r?.delete(i),pt(n)}}function H(i){return document.createTreeWalker(i,NodeFilter.SHOW_TEXT,t=>t.parentElement?.closest(".hn-margin-annotation")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT)}function T(i){let t=H(i),e="";for(;t.nextNode();)e+=t.currentNode.textContent??"";return e}function W(i,t,e){let n=H(i),s=0;for(;n.nextNode();){if(n.currentNode===t)return s+e;s+=(n.currentNode.textContent??"").length}return-1}function L(i,t,e){let n=H(i),s=0,r=null,o=0,a=null,l=0;for(;n.nextNode();){let c=n.currentNode,d=(c.textContent??"").length;if(!r&&s+d>t&&(r=c,o=t-s),s+d>=e){a=c,l=e-s;break}s+=d}if(!r||!a)return null;try{let c=document.createRange();return c.setStart(r,Math.min(o,(r.textContent??"").length)),c.setEnd(a,Math.min(l,(a.textContent??"").length)),c}catch{return null}}var _=class{#t;#n;#i;#u;#e=[];#s=[];#r=!lt;#f;#g;#o=!1;#p=[];#a=new Map;constructor(t){this.#t=t,this.#u=t.hasAttribute("data-highlights-readonly");let e=t.dataset.highlights;this.#n=e&&e!==""?e:location.pathname;let n=t.dataset.highlightsColors,s=n?n.split(",").map(r=>r.trim()).filter(M):[...ct];this.#i=[...new Set(s)],this.#r||ft(this.#i),this.#h(),this.#u||(this.#f=this.#l.bind(this),this.#g=this.#E.bind(this),t.addEventListener("pointerup",this.#f),t.addEventListener("click",this.#g)),t.setAttribute("data-highlights-init",""),this.#S().then(()=>{this.#o||(this.#h(),this.#A())})}get colors(){return[...this.#i]}get destroyed(){return this.#o}get element(){return this.#t}getHighlights(){return this.#e.map(t=>({...t}))}getUnplaced(){return this.#s.map(t=>({...t}))}removeHighlight(t){let e=this.#e.findIndex(s=>s.id===t),n=this.#s.findIndex(s=>s.id===t);e<0&&n<0||(e>=0?this.#e.splice(e,1):this.#s.splice(n,1),this.#d(),this.#h(),this.#c("highlights:removed",{id:t}),A(k(this.#t,"removed")))}clearAll(){this.#e=[],this.#s=[],this.#d(),this.#h()}exportHighlights(){return JSON.stringify({version:1,highlights:this.#e})}importHighlights(t){let e;try{e=typeof t=="string"?JSON.parse(t):t}catch{return{imported:0,rejected:0}}if(!e||!Array.isArray(e.highlights))return{imported:0,rejected:0};let n=this.#m(e.highlights);return this.#e=n,this.#s=[],this.#d(),this.#h(),{imported:n.length,rejected:e.highlights.length-n.length}}#m(t,e=T(this.#t).length){let n={textLength:e,colors:this.#i},s=new Set,r=[];for(let o of t){let a=ut(o,n);!a||s.has(a.id)||(s.add(a.id),r.push(a))}return r}destroy(){this.#o||(this.#o=!0,this.#f&&this.#t.removeEventListener("pointerup",this.#f),this.#g&&this.#t.removeEventListener("click",this.#g),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()}):(K(this,new Map),gt(this.#i)),this.#y(),this.#a.clear(),this.#t.removeAttribute("data-highlights-init"),$.get(this.#t)===this&&$.delete(this.#t))}#l(){requestAnimationFrame(()=>{if(this.#o)return;let t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return;let e=t.getRangeAt(0);this.#t.contains(e.commonAncestorContainer)&&this.#c("highlights:selected",{text:t.toString().trim(),rect:e.getBoundingClientRect()})})}#E(t){let e=t.target.closest?.(".hn-margin-annotation");if(e){let s=e.dataset.hnId,r=this.#e.find(o=>o.id===s);if(r){this.#c("highlights:clicked",{id:s,highlight:{...r}}),this.#c("highlights:request-note",{id:s,highlight:{...r},controller:this});return}}let n=t.target.closest?.("mark[data-hn-id]");if(n){let s=n.dataset.hnId,r=this.#e.find(o=>o.id===s);if(r){this.#c("highlights:clicked",{id:s,highlight:{...r}});return}}if(!this.#r){let s=this.#x(t.clientX,t.clientY);s&&this.#c("highlights:clicked",{id:s.id,highlight:{...s}})}}findHighlightRect(t){let e=this.#e.find(r=>r.id===t);if(!e)return null;let n=this.#w(e);if(!n)return null;let s=n.getClientRects();return s.length?s[0]:null}#w(t){return this.#a.get(t.id)??L(this.#t,t.startOffset,t.endOffset)}#b(){this.#a.clear();for(let t of this.#e){let e=L(this.#t,t.startOffset,t.endOffset);e&&this.#a.set(t.id,e)}}#x(t,e){for(let n of this.#e){let s=this.#a.get(n.id);if(!s)continue;let r=s.getClientRects();for(let o of r)if(t>=o.left&&t<=o.right&&e>=o.top&&e<=o.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 s=W(this.#t,n.startContainer,n.startOffset),r=W(this.#t,n.endContainer,n.endOffset);if(s<0||r<0||s>=r)return;let o=e.toString().trim(),a={id:J(),startOffset:s,endOffset:r,text:o,...C(T(this.#t),s,r),color:t,note:"",created:Date.now()};this.#e.push(a),this.#d(),this.#h(),e.removeAllRanges(),this.#c("highlights:added",{id:a.id,text:o,color:t,note:""}),A(k(this.#t,"added"))}_changeColor(t,e){let n=this.#e.find(s=>s.id===t);n&&(n.color=e,this.#d(),this.#h())}_updateNote(t,e){let n=this.#e.find(s=>s.id===t);n&&(n.note=e,this.#d(),this.#v(),this.#c("highlights:note-changed",{id:t,note:e}),A(k(this.#t,"noteSaved")))}async#S(){let t=await v.get(X,this.#n);if(!t||!Array.isArray(t.highlights)||this.#o)return;let e=Array.isArray(t.unplaced)?t.unplaced:[],n=this.#m([...t.highlights,...e],1/0),s=T(this.#t);if(e.length===0&&t.contentHash===U(s)){this.#e=n;return}this.#e=[],this.#s=[];for(let r of n){let o=j(s,r);o?this.#e.push({...r,startOffset:o.start,endOffset:o.end,...C(s,o.start,o.end)}):this.#s.push(r)}this.#d()}#A(){this.#s.length!==0&&(console.warn(`[highlights] ${this.#s.length} stored highlight(s) could not be found in the current text. They are kept in storage.`,this.#t),this.#c("highlights:unplaced",{highlights:this.getUnplaced()}))}#d(){let t={version:1,contentHash:U(T(this.#t)),highlights:this.#e,...this.#s.length?{unplaced:this.#s}:{}};v.set(X,this.#n,t).catch(()=>{})}#h(){this.#r?(this.#k(),this.#b()):(this.#b(),this.#C()),this.#v()}#C(){let t=new Map;for(let e of this.#i)t.set(e,[]);for(let e of this.#e){let n=this.#a.get(e.id);n&&t.has(e.color)&&t.get(e.color).push(n)}K(this,t)}#k(){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=L(this.#t,e.startOffset,e.endOffset);if(!n)continue;let s=document.createElement("mark");s.dataset.hnId=e.id,M(e.color)&&(s.dataset.hnColor=e.color,s.style.setProperty("--_hn-color",`var(--highlight-${e.color})`),s.style.setProperty("--_hn-ink",`var(--highlight-${e.color}-ink, var(--highlight-ink))`));try{n.surroundContents(s)}catch{let r=n.extractContents();s.appendChild(r),n.insertNode(s)}}}#y(){for(let t of this.#p)t.remove();this.#p=[]}#v(){if(this.#y(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");let e=this.#t.getBoundingClientRect(),n=k(this.#t,"annotation");for(let s of this.#e){let r=this.#a.get(s.id);if(!r)continue;let o=r.getClientRects();if(o.length===0)continue;let a=o[0].top-e.top,l=document.createElement("span");if(l.className="hn-margin-annotation",l.dataset.hnId=s.id,l.setAttribute("aria-hidden","true"),l.style.insetBlockStart=`${a}px`,s.note){let c=document.createElement("span");c.className="hn-note-indicator",c.textContent="*",l.append(c,` ${n}`),l.classList.add("hn-has-note")}else l.textContent=n;this.#t.appendChild(l),this.#p.push(l)}}#c(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}};function y(i){let t=$.get(i);if(t&&!t.destroyed)return t;let e=new _(i);return $.set(i,e),e}function Y(i=document){i.querySelectorAll(R).forEach(t=>{t.hasAttribute("data-highlights-init")||y(t)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>Y()):Y();var mt=new MutationObserver(i=>{for(let t of i)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let n=e;n.matches(R)&&y(n),n.querySelectorAll(R).forEach(s=>{s.hasAttribute("data-highlights-init")||y(s)})}});mt.observe(document.documentElement,{childList:!0,subtree:!0});var bt={add:"Add private note",view:"View notes",dialog:"Private note",heading:"Private note",placeholder:"Add a note\u2026",textarea:"Note for highlighted text",save:"Save",cancel:"Cancel"},Z=!1,P=new Set;function tt(i,t,e){if(!i.contains(t))return-1;let n=document.createRange();return n.setStart(i,0),n.setEnd(t,e),n.toString().length}var B=class extends w{#t=!1;#n=null;#i=null;#u=null;#e=null;#s=null;setup(){this.#t=!!this.closest("selection-menu");let t=this.hasAttribute("for");P.add(this),Z||(Z=!0,document.addEventListener("highlights:request-note",yt));let e=this.querySelector(":scope > button[data-note-action]");if(!this.#t&&!t){e?.remove();return}if(!e){e=document.createElement("button"),e.type="button",e.setAttribute("data-note-action","");let n=document.createElement("icon-wc");n.setAttribute("name","sticky-note"),n.setAttribute("size","sm"),n.setAttribute("aria-hidden","true"),e.appendChild(n),this.appendChild(e)}e.setAttribute("aria-label",this.#r(this.#t?"add":"view")),this.listen(e,"click",this.#t?()=>this.#f():()=>this.#g())}teardown(){P.delete(this),this.#l()}#r(t){return this.getAttribute(`data-label-${t}`)??bt[t]??t}openFor(t,e,n){this.#o(t,e,n??document.activeElement)}#f(){let t=this.closest("selection-menu");if(!t)return;let e=t.getSelection();if(!e)return;let n=e.target,s=document.activeElement;n.hasAttribute("data-highlights-init")||n.setAttribute("data-highlights","");let r=y(n),o=e.range,a=tt(n,o.startContainer,o.startOffset),l=tt(n,o.endContainer,o.endOffset),c=null;if(a>=0&&l>a&&(c=r.getHighlights().find(d=>d.startOffset<=a&&d.endOffset>=l)??null),!c){let d=window.getSelection();d&&(d.isCollapsed||d.rangeCount===0)&&(d.removeAllRanges(),d.addRange(o)),r._createFromSelection("yellow");let f=r.getHighlights();c=f.find(u=>u.startOffset===a&&u.endOffset===l)??f[f.length-1]??null}t.dismiss(),c&&this.#o(c,r,s)}#g(){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),s=n.getHighlights(),r=s.find(o=>o.note)??s[0];r&&this.#o(r,n,document.activeElement)}#o(t,e,n){this.#l({restoreFocus:!1});let s=e.element;this.#i=n&&n!==document.body?n:null,this.#u=t,this.#e=e;let r=document.createElement("div");r.className="hn-note-panel",r.setAttribute("role","dialog"),r.setAttribute("aria-label",this.#r("dialog"));let o=document.createElement("header");o.className="hn-note-header";let a=document.createElement("small");a.textContent=this.#r("heading"),o.appendChild(a),r.appendChild(o);let l=document.createElement("blockquote");l.className="hn-note-quote",l.textContent=t.text.length>80?t.text.slice(0,80)+"\u2026":t.text,r.appendChild(l);let c=document.createElement("textarea");c.className="hn-note-textarea",c.placeholder=this.#r("placeholder"),c.value=t.note||"",c.rows=3,c.setAttribute("aria-label",this.#r("textarea")),r.appendChild(c);let d=document.createElement("footer");d.className="hn-note-actions";let f=()=>{e._updateNote(t.id,c.value.trim()),this.#l()},u=document.createElement("button");u.type="button",u.className="hn-action hn-action-save",u.textContent=this.#r("save"),u.addEventListener("click",f);let g=document.createElement("button");if(g.type="button",g.className="hn-action",g.textContent=this.#r("cancel"),g.addEventListener("click",()=>this.#l()),d.append(u,g),r.appendChild(d),r.addEventListener("keydown",h=>{h.defaultPrevented||(h.key==="Escape"?(h.preventDefault(),h.stopPropagation(),this.#l()):h.key==="Enter"&&(h.metaKey||h.ctrlKey)&&h.target===c&&(h.preventDefault(),f()))}),getComputedStyle(s).position==="static"&&(s.setAttribute("data-note-host",""),this.#s=s),s.appendChild(r),typeof e.findHighlightRect=="function"){let h=e.findHighlightRect(t.id);if(h){let et=s.getBoundingClientRect();r.style.top=`${h.top-et.top}px`}}this.#n=r,requestAnimationFrame(()=>{this.#n===r&&(c.focus(),document.addEventListener("pointerdown",this.#p))})}#p=t=>{if(!this.#n||this.#n.contains(t.target))return;this.#l({restoreFocus:!1});let e=this.#a;e&&document.addEventListener("pointerup",()=>{setTimeout(()=>{let n=document.activeElement;(!n||n===document.body)&&e?.()})},{once:!0,capture:!0})};#a=null;#m(){let t=this.#i,e=this.#e?.element,n=this.#u?.id;return()=>{if(t?.isConnected&&(typeof t.checkVisibility!="function"||t.checkVisibility())&&(t.focus({preventScroll:!0}),document.activeElement===t)||!e?.isConnected)return;let r=(n?e.querySelector(`mark[data-hn-id="${CSS.escape(n)}"]`):null)??e;r.tabIndex<0&&!r.hasAttribute("tabindex")&&(r.setAttribute("tabindex","-1"),r.addEventListener("blur",()=>r.removeAttribute("tabindex"),{once:!0})),r.focus({preventScroll:!0})}}#l({restoreFocus:t=!0}={}){if(!this.#n)return;let e=this.#n.contains(document.activeElement)?this.#m():null;document.removeEventListener("pointerdown",this.#p),this.#n.remove(),this.#n=null,this.#s?.removeAttribute("data-note-host"),this.#s=null,this.#a=e,this.#i=null,this.#u=null,this.#e=null,t&&e?.()}};function yt(i){let{highlight:t,controller:e}=i.detail||{};if(!t||!e)return;let n=P.values().next().value;n&&n.openFor(t,e)}I("note-wc",B);
7
7
  //# sourceMappingURL=note-wc.js.map