vanilla-breeze 0.6.2 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/custom-elements.json +6768 -6425
  2. package/dist/cdn/components/accordion-wc.js +1 -1
  3. package/dist/cdn/components/activity-feed.js +1 -1
  4. package/dist/cdn/components/ai-chat.js +6 -6
  5. package/dist/cdn/components/ai-summary.js +2 -2
  6. package/dist/cdn/components/analytics-panel.js +2 -2
  7. package/dist/cdn/components/audio-player.js +4 -4
  8. package/dist/cdn/components/audio-visualizer.js +2 -2
  9. package/dist/cdn/components/author-index.js +2 -2
  10. package/dist/cdn/components/brand-mark.js +1 -1
  11. package/dist/cdn/components/bread-crumb.js +1 -1
  12. package/dist/cdn/components/calendar-wc.js +2 -2
  13. package/dist/cdn/components/card-list.js +1 -1
  14. package/dist/cdn/components/carousel-wc.js +1 -1
  15. package/dist/cdn/components/change-set.js +1 -1
  16. package/dist/cdn/components/chart-wc.js +13 -13
  17. package/dist/cdn/components/chat-input.js +1 -1
  18. package/dist/cdn/components/chat-window.js +1 -1
  19. package/dist/cdn/components/color-picker.js +1 -1
  20. package/dist/cdn/components/combo-box.js +1 -1
  21. package/dist/cdn/components/command-palette.js +1 -1
  22. package/dist/cdn/components/comment-box.js +35 -35
  23. package/dist/cdn/components/comment-thread.js +38 -38
  24. package/dist/cdn/components/comment-wc.js +1 -1
  25. package/dist/cdn/components/compare-surface.js +1 -1
  26. package/dist/cdn/components/consent-banner.js +1 -1
  27. package/dist/cdn/components/content-lens.js +1 -1
  28. package/dist/cdn/components/content-swap.js +1 -1
  29. package/dist/cdn/components/context-menu.js +1 -1
  30. package/dist/cdn/components/data-table.js +1 -1
  31. package/dist/cdn/components/date-picker.js +1 -1
  32. package/dist/cdn/components/day-view.js +1 -1
  33. package/dist/cdn/components/diagram-wc.js +2 -2
  34. package/dist/cdn/components/drag-surface.js +1 -1
  35. package/dist/cdn/components/drop-down.js +1 -1
  36. package/dist/cdn/components/emoji-picker.js +1 -1
  37. package/dist/cdn/components/flow-diagram.js +1 -1
  38. package/dist/cdn/components/foot-notes.js +1 -1
  39. package/dist/cdn/components/form-field.js +1 -1
  40. package/dist/cdn/components/geo-map.js +3 -3
  41. package/dist/cdn/components/glossary-index.js +1 -1
  42. package/dist/cdn/components/glossary-wc.js +1 -1
  43. package/dist/cdn/components/heading-links.js +1 -1
  44. package/dist/cdn/components/highlight-wc.js +2 -2
  45. package/dist/cdn/components/icon-wc.js +2 -2
  46. package/dist/cdn/components/image-gallery.js +1 -1
  47. package/dist/cdn/components/image-map.js +1 -1
  48. package/dist/cdn/components/include-file.js +1 -1
  49. package/dist/cdn/components/manifest.json +58 -54
  50. package/dist/cdn/components/markdown-editor.js +25 -25
  51. package/dist/cdn/components/markdown-viewer.js +27 -27
  52. package/dist/cdn/components/nav-bar.js +1 -1
  53. package/dist/cdn/components/note-wc.js +2 -2
  54. package/dist/cdn/components/notification-wc.js +23 -23
  55. package/dist/cdn/components/page-info.js +6 -6
  56. package/dist/cdn/components/page-stats.js +1 -1
  57. package/dist/cdn/components/page-toc.js +1 -1
  58. package/dist/cdn/components/page-tools.js +1 -1
  59. package/dist/cdn/components/page-tour.js +1 -1
  60. package/dist/cdn/components/pager-wc.js +1 -1
  61. package/dist/cdn/components/poll-wc.js +1 -1
  62. package/dist/cdn/components/pop-over.js +1 -1
  63. package/dist/cdn/components/popularity-index.js +1 -1
  64. package/dist/cdn/components/print-page.js +1 -1
  65. package/dist/cdn/components/progress-tracker.js +1 -1
  66. package/dist/cdn/components/qr-code.js +1 -1
  67. package/dist/cdn/components/reaction-bar.js +1 -1
  68. package/dist/cdn/components/reading-progress.js +1 -1
  69. package/dist/cdn/components/recently-visited.js +1 -1
  70. package/dist/cdn/components/score-card.js +2 -2
  71. package/dist/cdn/components/selection-menu.js +1 -1
  72. package/dist/cdn/components/settings-panel.js +6 -6
  73. package/dist/cdn/components/share-wc.js +2 -2
  74. package/dist/cdn/components/short-cuts.js +1 -1
  75. package/dist/cdn/components/site-index.js +1 -1
  76. package/dist/cdn/components/site-map.js +1 -1
  77. package/dist/cdn/components/site-search.js +1 -1
  78. package/dist/cdn/components/slide-accept.js +1 -1
  79. package/dist/cdn/components/social-embed.js +1 -1
  80. package/dist/cdn/components/social-links.js +2 -0
  81. package/dist/cdn/components/split-surface.js +1 -1
  82. package/dist/cdn/components/star-rating.js +1 -1
  83. package/dist/cdn/components/status-wc.js +1 -1
  84. package/dist/cdn/components/stepper-wc.js +1 -1
  85. package/dist/cdn/components/tab-set.js +1 -1
  86. package/dist/cdn/components/text-reader.js +2 -2
  87. package/dist/cdn/components/theme-picker.js +20 -20
  88. package/dist/cdn/components/time-index.js +1 -1
  89. package/dist/cdn/components/time-picker.js +1 -1
  90. package/dist/cdn/components/toast-msg.js +2 -2
  91. package/dist/cdn/components/tool-tip.js +1 -1
  92. package/dist/cdn/components/topic-map.js +4 -4
  93. package/dist/cdn/components/trust-filter.js +1 -1
  94. package/dist/cdn/components/version-switcher.js +6 -6
  95. package/dist/cdn/components/video-player.js +4 -4
  96. package/dist/cdn/components/watch-wc.js +2 -2
  97. package/dist/cdn/components/week-view.js +1 -1
  98. package/dist/cdn/components/youtube-player.js +1 -1
  99. package/dist/cdn/fonts/barlow-condensed-latin-400-italic.woff2 +0 -0
  100. package/dist/cdn/fonts/barlow-condensed-latin-700-italic.woff2 +0 -0
  101. package/dist/cdn/fonts/barlow-condensed-latin-ext-400-italic.woff2 +0 -0
  102. package/dist/cdn/fonts/barlow-condensed-latin-ext-700-italic.woff2 +0 -0
  103. package/dist/cdn/fonts/dm-sans-latin-ext-wght-italic.woff2 +0 -0
  104. package/dist/cdn/fonts/dm-sans-latin-wght-italic.woff2 +0 -0
  105. package/dist/cdn/fonts/dm-serif-display-latin-400-italic.woff2 +0 -0
  106. package/dist/cdn/fonts/dm-serif-display-latin-ext-400-italic.woff2 +0 -0
  107. package/dist/cdn/fonts/exo-2-latin-ext-wght-italic.woff2 +0 -0
  108. package/dist/cdn/fonts/exo-2-latin-wght-italic.woff2 +0 -0
  109. package/dist/cdn/fonts/inter-latin-ext-wght-italic.woff2 +0 -0
  110. package/dist/cdn/fonts/inter-latin-wght-italic.woff2 +0 -0
  111. package/dist/cdn/fonts/jetbrains-mono-latin-ext-wght-italic.woff2 +0 -0
  112. package/dist/cdn/fonts/jetbrains-mono-latin-wght-italic.woff2 +0 -0
  113. package/dist/cdn/fonts/josefin-sans-latin-ext-wght-italic.woff2 +0 -0
  114. package/dist/cdn/fonts/josefin-sans-latin-wght-italic.woff2 +0 -0
  115. package/dist/cdn/fonts/lora-latin-ext-wght-italic.woff2 +0 -0
  116. package/dist/cdn/fonts/lora-latin-wght-italic.woff2 +0 -0
  117. package/dist/cdn/fonts/merriweather-latin-ext-wght-italic.woff2 +0 -0
  118. package/dist/cdn/fonts/merriweather-latin-wght-italic.woff2 +0 -0
  119. package/dist/cdn/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
  120. package/dist/cdn/fonts/nunito-latin-wght-italic.woff2 +0 -0
  121. package/dist/cdn/packs/effects.full.js +1 -1
  122. package/dist/cdn/packs/kawaii/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
  123. package/dist/cdn/packs/kawaii/fonts/nunito-latin-wght-italic.woff2 +0 -0
  124. package/dist/cdn/packs/kawaii.full.css +1 -1
  125. package/dist/cdn/packs/kawaii.theme.css +1 -1
  126. package/dist/cdn/packs/manifest.json +4 -4
  127. package/dist/cdn/packs/prototype.full.js +1 -1
  128. package/dist/cdn/packs/ui.full.js +19 -19
  129. package/dist/cdn/themes/8bit.tokens.json +8 -37
  130. package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
  131. package/dist/cdn/themes/alpha1999.css +1 -1
  132. package/dist/cdn/themes/alpha1999.tokens.json +3 -6
  133. package/dist/cdn/themes/art-deco-dark.tokens.json +3 -27
  134. package/dist/cdn/themes/art-deco.css +1 -1
  135. package/dist/cdn/themes/art-deco.tokens.json +5 -11
  136. package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
  137. package/dist/cdn/themes/bauhaus.css +1 -1
  138. package/dist/cdn/themes/bauhaus.tokens.json +13 -7
  139. package/dist/cdn/themes/brutalist-dark.tokens.json +3 -27
  140. package/dist/cdn/themes/brutalist.tokens.json +5 -11
  141. package/dist/cdn/themes/catppuccin-frappe.css +1 -1
  142. package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
  143. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
  144. package/dist/cdn/themes/catppuccin-latte.css +1 -1
  145. package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
  146. package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
  147. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
  148. package/dist/cdn/themes/catppuccin-mocha.css +1 -1
  149. package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
  150. package/dist/cdn/themes/classic-dark.tokens.json +41 -41
  151. package/dist/cdn/themes/classic.tokens.json +25 -31
  152. package/dist/cdn/themes/claymorphism-dark.tokens.json +533 -161
  153. package/dist/cdn/themes/claymorphism.css +1 -1
  154. package/dist/cdn/themes/claymorphism.tokens.json +531 -135
  155. package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
  156. package/dist/cdn/themes/clinical.tokens.json +1 -1
  157. package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
  158. package/dist/cdn/themes/cottagecore.css +1 -1
  159. package/dist/cdn/themes/cottagecore.tokens.json +1 -1
  160. package/dist/cdn/themes/cyber.css +1 -1
  161. package/dist/cdn/themes/cyber.tokens.json +5 -11
  162. package/dist/cdn/themes/dawn-dark.tokens.json +3 -27
  163. package/dist/cdn/themes/dawn.css +1 -1
  164. package/dist/cdn/themes/dawn.tokens.json +1 -1
  165. package/dist/cdn/themes/dracula.tokens.json +1 -1
  166. package/dist/cdn/themes/dusk.tokens.json +1 -1
  167. package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
  168. package/dist/cdn/themes/editorial.tokens.json +19 -16
  169. package/dist/cdn/themes/financial-dark.tokens.json +1 -1
  170. package/dist/cdn/themes/financial.css +1 -1
  171. package/dist/cdn/themes/financial.tokens.json +1 -1
  172. package/dist/cdn/themes/genai.css +1 -1
  173. package/dist/cdn/themes/genai.tokens.json +1 -1
  174. package/dist/cdn/themes/glassmorphism-dark.tokens.json +233 -116
  175. package/dist/cdn/themes/glassmorphism.css +1 -1
  176. package/dist/cdn/themes/glassmorphism.tokens.json +233 -116
  177. package/dist/cdn/themes/government-dark.tokens.json +1 -1
  178. package/dist/cdn/themes/government.tokens.json +1 -1
  179. package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
  180. package/dist/cdn/themes/gruvbox.css +1 -1
  181. package/dist/cdn/themes/gruvbox.tokens.json +1 -1
  182. package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
  183. package/dist/cdn/themes/high-noon.tokens.json +1 -1
  184. package/dist/cdn/themes/journal-dark.tokens.json +3 -27
  185. package/dist/cdn/themes/journal.css +1 -1
  186. package/dist/cdn/themes/journal.tokens.json +21 -21
  187. package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
  188. package/dist/cdn/themes/kawaii.css +1 -1
  189. package/dist/cdn/themes/kawaii.tokens.json +1 -1
  190. package/dist/cdn/themes/magna-dark.tokens.json +1 -1
  191. package/dist/cdn/themes/magna.css +1 -1
  192. package/dist/cdn/themes/magna.tokens.json +2 -14
  193. package/dist/cdn/themes/manifest.json +25 -25
  194. package/dist/cdn/themes/midnight.tokens.json +1 -1
  195. package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
  196. package/dist/cdn/themes/minimal.tokens.json +25 -27
  197. package/dist/cdn/themes/modern-dark.tokens.json +41 -41
  198. package/dist/cdn/themes/modern.css +1 -1
  199. package/dist/cdn/themes/modern.tokens.json +21 -21
  200. package/dist/cdn/themes/nes-dark.tokens.json +3 -27
  201. package/dist/cdn/themes/nes.tokens.json +10 -39
  202. package/dist/cdn/themes/neumorphism-dark.tokens.json +266 -134
  203. package/dist/cdn/themes/neumorphism.css +1 -1
  204. package/dist/cdn/themes/neumorphism.tokens.json +266 -134
  205. package/dist/cdn/themes/nord-dark.tokens.json +3 -27
  206. package/dist/cdn/themes/nord.css +1 -1
  207. package/dist/cdn/themes/nord.tokens.json +1 -1
  208. package/dist/cdn/themes/organic-dark.tokens.json +1 -1
  209. package/dist/cdn/themes/organic.tokens.json +5 -14
  210. package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
  211. package/dist/cdn/themes/rose-pine.css +1 -1
  212. package/dist/cdn/themes/rose-pine.tokens.json +1 -1
  213. package/dist/cdn/themes/rough-dark.tokens.json +1 -1
  214. package/dist/cdn/themes/rough.tokens.json +1 -1
  215. package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
  216. package/dist/cdn/themes/solarized.tokens.json +1 -1
  217. package/dist/cdn/themes/startup-dark.tokens.json +1 -1
  218. package/dist/cdn/themes/startup.css +1 -1
  219. package/dist/cdn/themes/startup.tokens.json +1 -1
  220. package/dist/cdn/themes/super2026-dark.tokens.json +6 -30
  221. package/dist/cdn/themes/super2026.css +1 -1
  222. package/dist/cdn/themes/super2026.tokens.json +1 -1
  223. package/dist/cdn/themes/swiss-dark.tokens.json +4 -40
  224. package/dist/cdn/themes/swiss.tokens.json +34 -68
  225. package/dist/cdn/themes/terminal.tokens.json +286 -120
  226. package/dist/cdn/themes/tokyo-night-dark.tokens.json +3 -27
  227. package/dist/cdn/themes/tokyo-night.css +1 -1
  228. package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
  229. package/dist/cdn/themes/vaporwave-dark.tokens.json +3 -27
  230. package/dist/cdn/themes/vaporwave.tokens.json +1 -1
  231. package/dist/cdn/themes/win9x-dark.tokens.json +5 -29
  232. package/dist/cdn/themes/win9x.tokens.json +9 -9
  233. package/dist/cdn/vanilla-breeze-autoload.js +113 -108
  234. package/dist/cdn/vanilla-breeze-charts.js +13 -13
  235. package/dist/cdn/vanilla-breeze-core.css +1 -1
  236. package/dist/cdn/vanilla-breeze-core.js +80 -75
  237. package/dist/cdn/vanilla-breeze-extras.js +31 -31
  238. package/dist/cdn/vanilla-breeze.css +1 -1
  239. package/dist/cdn/vanilla-breeze.js +133 -133
  240. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
- var m=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,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}_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 i=this.#n.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_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 rt=window.matchMedia("(prefers-reduced-motion: reduce)");var T=new Map;function $(r,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=T.get(r);if(customElements.get(r)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}T.set(r,n),customElements.define(r,t)}function q(){let r=globalThis.localStorage;if(!r)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return r.getItem(t)},async setRaw(t,e){r.setItem(t,e)},async removeRaw(t){r.removeItem(t)},async keys(t){let e=[];for(let i=0;i<r.length;i++){let n=r.key(i);n&&n.startsWith(t)&&e.push(n)}return e}}}var y="__vbStoreBackend",b=globalThis;function c(){return b[y]||(b[y]=q()),b[y]}function C(r,t){if(typeof r!="string"||!r)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:${r}:${t}`}function N(r){if(typeof r!="string"||!r)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${r}:`}function M(r){try{let t=JSON.parse(r);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var g={configure(r={}){b[y]=r.backend??null},async set(r,t,e){let i={data:e,timestamp:Date.now()};await c().setRaw(C(r,t),JSON.stringify(i))},async get(r,t,e){let i=await c().getRaw(C(r,t));if(i==null)return null;let n=M(i);return!n||e?.maxAge!=null&&Date.now()-n.timestamp>e.maxAge?null:n.data},async remove(r,t){await c().removeRaw(C(r,t))},async list(r){let t=N(r),e=await c().keys(t),i=[];for(let n of e){let s=await c().getRaw(n);if(s==null)continue;let o=M(s);o&&i.push({key:n.slice(t.length),data:o.data,timestamp:o.timestamp})}return i},async clear(r){let t=N(r),e=await c().keys(t);for(let i of e)await c().removeRaw(i)},async clearAll(){let r=await c().keys("vb:");for(let t of r)await c().removeRaw(t)},async setMany(r,t){for(let[e,i]of t)await g.set(r,e,i)}};if(typeof window<"u"){let r=window.VB??(window.VB={});r.store??=g}var W=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),L=new WeakMap;function j(r,t){let e=L.get(t);e||L.set(t,e=new Map);let i=e.get(r);if(!i||!i.region.isConnected){let s=(t.ownerDocument||document).createElement("span");s.setAttribute("data-vb-announcer",r),s.setAttribute("role",r==="assertive"?"alert":"status"),s.setAttribute("aria-live",r),s.setAttribute("aria-atomic","true"),s.style.cssText=W,t.appendChild(s),i={region:s},e.set(r,i)}return i}function w(r,{politeness:t="polite",root:e}={}){let i=String(r??"").trim();if(!i||typeof document>"u")return null;let n=e||document.body;if(!n)return null;let o=j(t==="assertive"?"assertive":"polite",n);return clearTimeout(o.write),clearTimeout(o.clear),o.region.textContent="",o.write=setTimeout(()=>{o.region.textContent=i,o.clear=setTimeout(()=>{o.region.textContent=""},7e3)},50),o.region}var x="[data-highlights]",_="highlights",z=["yellow","green","blue","pink"];var U=typeof CSS<"u"&&"highlights"in CSS,E=new WeakMap;function B(r){let t=2166136261;for(let e=0;e<r.length;e++)t^=r.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function D(){return"hn-"+crypto.randomUUID().slice(0,8)}var X=/^[a-z0-9_-]+$/i,I=["solid","double","dotted","dashed","wavy"],Y={annotation:"You highlighted",added:"Highlight added",removed:"Highlight removed",noteSaved:"Note saved"};function A(r,t){let e="highlightsLabel"+t[0].toUpperCase()+t.slice(1);return r.dataset[e]||Y[t]}function G(r,{textLength:t,colors:e}){if(!r||typeof r!="object")return null;let i=r,{startOffset:n,endOffset:s,color:o}=i;if(!Number.isInteger(n)||!Number.isInteger(s))return null;let h=n,a=s;return h<0||a<=h||a>t||!k(o)||!e.includes(o)||i.id!=null&&(typeof i.id!="string"||!/^[\w-]{1,64}$/.test(i.id))||i.text!=null&&typeof i.text!="string"||i.note!=null&&typeof i.note!="string"?null:{id:i.id||D(),startOffset:h,endOffset:a,text:i.text??"",color:o,note:i.note??"",created:Number.isFinite(i.created)?i.created:Date.now()}}function k(r){return typeof r=="string"&&X.test(r)}var d=null,u=new Map,p=new Map;function V(){if(u.size===0){d&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(i=>i!==d),d=null);return}d||(d=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,d]);let r=[...u.keys()],t=r.map(i=>`::highlight(hn-${i}) { background-color: var(--highlight-${i}); color: var(--highlight-${i}-ink, var(--highlight-ink, CanvasText)); text-decoration-line: underline; text-decoration-color: var(--highlight-${i}); text-underline-offset: 2px; }`),e=r.map((i,n)=>`::highlight(hn-${i}) { background-color: Mark; color: MarkText; text-decoration-line: underline; text-decoration-color: MarkText; text-decoration-style: ${I[n%I.length]}; text-decoration-thickness: 2px; }`);d.replaceSync(`${t.join(`
1
+ var y=class extends HTMLElement{#t=[];#i;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.#i||(this.#i=this.attachInternals());let n=this.#i.states;try{e?n.add(t):n.delete(t)}catch{let i=`--${t}`;e?n.add(i):n.delete(i)}}_adoptInternals(t){this.#i||(this.#i=t)}#n(){return this.constructor.formAssociated&&this.#i?this.#i: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 At=window.matchMedia("(prefers-reduced-motion: reduce)");var B=new Map;function I(s,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},r=B.get(s);if(customElements.get(s)){if(!r||r.priority>=n){r&&r.priority===n&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> 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 <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}B.set(s,i),customElements.define(s,t)}function Q(){let s=globalThis.localStorage;if(!s)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return s.getItem(t)},async setRaw(t,e){s.setItem(t,e)},async removeRaw(t){s.removeItem(t)},async keys(t){let e=[];for(let n=0;n<s.length;n++){let i=s.key(n);i&&i.startsWith(t)&&e.push(i)}return e}}}var b="__vbStoreBackend",w=globalThis;function h(){return w[b]||(w[b]=Q()),w[b]}function k(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 F(s){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${s}:`}function D(s){try{let t=JSON.parse(s);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var p={configure(s={}){w[b]=s.backend??null},async set(s,t,e){let n={data:e,timestamp:Date.now()};await h().setRaw(k(s,t),JSON.stringify(n))},async get(s,t,e){let n=await h().getRaw(k(s,t));if(n==null)return null;let i=D(n);return!i||e?.maxAge!=null&&Date.now()-i.timestamp>e.maxAge?null:i.data},async remove(s,t){await h().removeRaw(k(s,t))},async list(s){let t=F(s),e=await h().keys(t),n=[];for(let i of e){let r=await h().getRaw(i);if(r==null)continue;let o=D(r);o&&n.push({key:i.slice(t.length),data:o.data,timestamp:o.timestamp})}return n},async clear(s){let t=F(s),e=await h().keys(t);for(let n of e)await h().removeRaw(n)},async clearAll(){let s=await h().keys("vb:");for(let t of s)await h().removeRaw(t)},async setMany(s,t){for(let[e,n]of t)await p.set(s,e,n)}};if(typeof window<"u"){let s=window.VB??(window.VB={});s.store??=p}var Z=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),q=new WeakMap;function tt(s,t){let e=q.get(t);e||q.set(t,e=new Map);let n=e.get(s);if(!n||!n.region.isConnected){let r=(t.ownerDocument||document).createElement("span");r.setAttribute("data-vb-announcer",s),r.setAttribute("role",s==="assertive"?"alert":"status"),r.setAttribute("aria-live",s),r.setAttribute("aria-atomic","true"),r.style.cssText=Z,t.appendChild(r),n={region:r},e.set(s,n)}return n}function E(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 o=tt(t==="assertive"?"assertive":"polite",i);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 N=s=>s.replace(/\s+/g,""),et=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function nt(s,t){let e=0;for(;e<s.length&&e<t.length&&s[s.length-1-e]===t[t.length-1-e];)e++;return e}function it(s,t){let e=0;for(;e<s.length&&e<t.length&&s[e]===t[e];)e++;return e}function A(s,t,e){return{prefix:s.slice(Math.max(0,t-32),t),suffix:s.slice(e,e+32)}}function V(s,t){let e=N(t.text??"");if(!e)return null;if(t.endOffset<=s.length&&N(s.slice(t.startOffset,t.endOffset))===e)return{start:t.startOffset,end:t.endOffset};let n=new RegExp(t.text.trim().split(/\s+/).map(et).join("\\s*"),"g"),i=t.prefix??"",r=t.suffix??"",o=null,a=-1,l=1/0;for(let c of s.matchAll(n)){let d=c.index,_=d+c[0].length,P=A(s,d,_),C=nt(P.prefix,i)+it(P.suffix,r),H=Math.abs(d-t.startOffset);(C>a||C===a&&H<l)&&(o={start:d,end:_},a=C,l=H)}return o}var $="[data-highlights]",z="highlights",st=["yellow","green","blue","pink"];var rt=typeof CSS<"u"&&"highlights"in CSS,x=new WeakMap;function U(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 J(){return"hn-"+crypto.randomUUID().slice(0,8)}var ot=/^[a-z0-9_-]+$/i,W=["solid","double","dotted","dashed","wavy"],at={annotation:"You highlighted",added:"Highlight added",removed:"Highlight removed",noteSaved:"Note saved"};function v(s,t){let e="highlightsLabel"+t[0].toUpperCase()+t.slice(1);return s.dataset[e]||at[t]}function lt(s,{textLength:t,colors:e}){if(!s||typeof s!="object")return null;let n=s,{startOffset:i,endOffset:r,color:o}=n;if(!Number.isInteger(i)||!Number.isInteger(r))return null;let a=i,l=r;return a<0||l<=a||l>t||!O(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 O(s){return typeof s=="string"&&ot.test(s)}var u=null,f=new Map,m=new Map;function K(){if(f.size===0){u&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(n=>n!==u),u=null);return}u||(u=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,u]);let s=[...f.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: ${W[i%W.length]}; text-decoration-thickness: 2px; }`);u.replaceSync(`${t.join(`
2
2
  `)}
3
3
  @media (forced-colors: active) {
4
4
  ${e.join(`
5
5
  `)}
6
- }`)}function J(r){for(let t of r)u.set(t,(u.get(t)??0)+1);V()}function K(r){for(let t of r){let e=(u.get(t)??0)-1;e>0?u.set(t,e):u.delete(t)}V()}function Q(r){let t=p.get(r),e=t?[...t.values()].flat():[];e.length===0?(CSS.highlights.delete(`hn-${r}`),p.delete(r)):CSS.highlights.set(`hn-${r}`,new Highlight(...e))}function H(r,t){let e=new Set(t.keys());for(let[i,n]of p)n.has(r)&&e.add(i);for(let i of e){let n=t.get(i)??[],s=p.get(i);n.length?(s||p.set(i,s=new Map),s.set(r,n)):s?.delete(r),Q(i)}}function P(r,t,e){let i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),n=0;for(;i.nextNode();){if(i.currentNode===t)return n+e;n+=(i.currentNode.textContent??"").length}return-1}function S(r,t,e){let i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),n=0,s=null,o=0,h=null,a=0;for(;i.nextNode();){let l=i.currentNode,v=(l.textContent??"").length;if(!s&&n+v>t&&(s=l,o=t-n),n+v>=e){h=l,a=e-n;break}n+=v}if(!s||!h)return null;try{let l=document.createRange();return l.setStart(s,Math.min(o,(s.textContent??"").length)),l.setEnd(h,Math.min(a,(h.textContent??"").length)),l}catch{return null}}var O=class{#t;#n;#i;#o;#e=[];#h=!U;#s;#f;#r=!1;#p=[];#a=new Map;constructor(t){this.#t=t,this.#o=t.hasAttribute("data-highlights-readonly");let e=t.dataset.highlights;this.#n=e&&e!==""?e:location.pathname;let i=t.dataset.highlightsColors,n=i?i.split(",").map(s=>s.trim()).filter(k):[...z];this.#i=[...new Set(n)],this.#h||J(this.#i),this.#u(),this.#o||(this.#s=this.#b.bind(this),this.#f=this.#g.bind(this),t.addEventListener("pointerup",this.#s),t.addEventListener("click",this.#f)),t.setAttribute("data-highlights-init",""),this.#c().then(()=>{this.#r||this.#u()})}get colors(){return[...this.#i]}get destroyed(){return this.#r}get element(){return this.#t}getHighlights(){return this.#e.map(t=>({...t}))}removeHighlight(t){let e=this.#e.findIndex(i=>i.id===t);e<0||(this.#e.splice(e,1),this.#d(),this.#u(),this.#l("highlights:removed",{id:t}),w(A(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 i=this.#m(e.highlights);return this.#e=i,this.#d(),this.#u(),{imported:i.length,rejected:e.highlights.length-i.length}}#m(t){let e={textLength:(this.#t.textContent??"").length,colors:this.#i},i=new Set,n=[];for(let s of t){let o=G(s,e);!o||i.has(o.id)||(i.add(o.id),n.push(o))}return n}destroy(){this.#r||(this.#r=!0,this.#s&&this.#t.removeEventListener("pointerup",this.#s),this.#f&&this.#t.removeEventListener("click",this.#f),this.#h?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()}):(H(this,new Map),K(this.#i)),this.#S(),this.#a.clear(),this.#t.removeAttribute("data-highlights-init"),E.get(this.#t)===this&&E.delete(this.#t))}#b(){requestAnimationFrame(()=>{if(this.#r)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()})})}#g(t){let e=t.target.closest?.(".hn-margin-annotation");if(e){let n=e.dataset.hnId,s=this.#e.find(o=>o.id===n);if(s){this.#l("highlights:clicked",{id:n,highlight:{...s}}),this.#l("highlights:request-note",{id:n,highlight:{...s},controller:this});return}}let i=t.target.closest?.("mark[data-hn-id]");if(i){let n=i.dataset.hnId,s=this.#e.find(o=>o.id===n);if(s){this.#l("highlights:clicked",{id:n,highlight:{...s}});return}}if(!this.#h){let n=this.#y(t.clientX,t.clientY);n&&this.#l("highlights:clicked",{id:n.id,highlight:{...n}})}}findHighlightRect(t){let e=this.#e.find(s=>s.id===t);if(!e)return null;let i=this.#A(e);if(!i)return null;let n=i.getClientRects();return n.length?n[0]:null}#A(t){return this.#a.get(t.id)??S(this.#t,t.startOffset,t.endOffset)}#w(){this.#a.clear();for(let t of this.#e){let e=S(this.#t,t.startOffset,t.endOffset);e&&this.#a.set(t.id,e)}}#y(t,e){for(let i of this.#e){let n=this.#a.get(i.id);if(!n)continue;let s=n.getClientRects();for(let o of s)if(t>=o.left&&t<=o.right&&e>=o.top&&e<=o.bottom)return i}return null}_createFromSelection(t){let e=window.getSelection();if(!e||e.isCollapsed)return;let i=e.getRangeAt(0);if(!this.#t.contains(i.commonAncestorContainer))return;let n=P(this.#t,i.startContainer,i.startOffset),s=P(this.#t,i.endContainer,i.endOffset);if(n<0||s<0||n>=s)return;let o=e.toString().trim(),h={id:D(),startOffset:n,endOffset:s,text:o,color:t,note:"",created:Date.now()};this.#e.push(h),this.#d(),this.#u(),e.removeAllRanges(),this.#l("highlights:added",{id:h.id,text:o,color:t,note:""}),w(A(this.#t,"added"))}_changeColor(t,e){let i=this.#e.find(n=>n.id===t);i&&(i.color=e,this.#d(),this.#u())}_updateNote(t,e){let i=this.#e.find(n=>n.id===t);i&&(i.note=e,this.#d(),this.#E(),this.#l("highlights:note-changed",{id:t,note:e}),w(A(this.#t,"noteSaved")))}async#c(){let t=await g.get(_,this.#n);if(!t||!Array.isArray(t.highlights)||this.#r)return;let e=this.#m(t.highlights),i=B(this.#t.textContent);t.contentHash&&t.contentHash!==i?(this.#e=e.filter(n=>{let s=S(this.#t,n.startOffset,n.endOffset);return s?s.toString().trim()===n.text:!1}),this.#d()):this.#e=e}#d(){let t={version:1,contentHash:B(this.#t.textContent),highlights:this.#e};g.set(_,this.#n,t).catch(()=>{})}#u(){this.#h?(this.#C(),this.#w()):(this.#w(),this.#v()),this.#E()}#v(){let t=new Map;for(let e of this.#i)t.set(e,[]);for(let e of this.#e){let i=this.#a.get(e.id);i&&t.has(e.color)&&t.get(e.color).push(i)}H(this,t)}#C(){this.#t.querySelectorAll("mark[data-hn-id]").forEach(e=>{let i=e.parentNode;for(;e.firstChild;)i.insertBefore(e.firstChild,e);i.removeChild(e)}),this.#t.normalize();let t=[...this.#e].sort((e,i)=>i.startOffset-e.startOffset);for(let e of t){let i=S(this.#t,e.startOffset,e.endOffset);if(!i)continue;let n=document.createElement("mark");n.dataset.hnId=e.id,k(e.color)&&(n.dataset.hnColor=e.color,n.style.setProperty("--_hn-color",`var(--highlight-${e.color})`),n.style.setProperty("--_hn-ink",`var(--highlight-${e.color}-ink, var(--highlight-ink))`));try{i.surroundContents(n)}catch{let s=i.extractContents();n.appendChild(s),i.insertNode(n)}}}#S(){for(let t of this.#p)t.remove();this.#p=[]}#E(){if(this.#S(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");let e=this.#t.getBoundingClientRect(),i=A(this.#t,"annotation");for(let n of this.#e){let s=this.#a.get(n.id);if(!s)continue;let o=s.getClientRects();if(o.length===0)continue;let h=o[0].top-e.top,a=document.createElement("span");if(a.className="hn-margin-annotation",a.dataset.hnId=n.id,a.setAttribute("aria-hidden","true"),a.style.insetBlockStart=`${h}px`,n.note){let l=document.createElement("span");l.className="hn-note-indicator",l.textContent="*",a.append(l,` ${i}`),a.classList.add("hn-has-note")}else a.textContent=i;this.#t.appendChild(a),this.#p.push(a)}}#l(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}};function f(r){let t=E.get(r);if(t&&!t.destroyed)return t;let e=new O(r);return E.set(r,e),e}function F(r=document){r.querySelectorAll(x).forEach(t=>{t.hasAttribute("data-highlights-init")||f(t)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>F()):F();var Z=new MutationObserver(r=>{for(let t of r)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let i=e;i.matches(x)&&f(i),i.querySelectorAll(x).forEach(n=>{n.hasAttribute("data-highlights-init")||f(n)})}});Z.observe(document.documentElement,{childList:!0,subtree:!0});var tt=["yellow","green","blue","pink"],et=/^[a-z0-9_-]+$/i,it=["annotation","added","removed"],nt=0,R=class extends m{#t=null;#n=null;#i="yellow";#o=null;#e=null;#h=!1;#s=null;setup(){this.#o=this.closest("selection-menu");let t=this.#y();t.includes(this.#i)||(this.#i=t[0]??"yellow"),this.#o?this.#f():this.#A()}teardown(){this.#t?.destroy(),this.#t=null,this.#s?.remove(),this.#s=null,this.#h?this.#e?.remove():this.#e?.removeAttribute("aria-expanded"),this.#e=null,this.#h=!1,this.#o=null}#f(){let t=this.hasAttribute("readonly");for(let s of this.#b())this.#g(s);if(t)return;let e=this.#y(),i=this.querySelector(":scope > button");if(this.#h=!i,!i){i=document.createElement("button"),i.type="button",i.setAttribute("aria-label",this.dataset.labelButton||"Highlight selection");let s=document.createElement("icon-wc");s.setAttribute("name","highlighter"),s.setAttribute("size","sm"),s.setAttribute("aria-hidden","true"),i.appendChild(s),this.appendChild(i)}this.#e=i;let n=document.createElement("div");n.className="highlight-color-dropdown",n.id=`highlight-palette-${++nt}`,n.setAttribute("role","group"),n.setAttribute("aria-label",this.dataset.labelPalette||"Highlight color"),n.hidden=!0;for(let s of e){let o=document.createElement("button");o.type="button",o.className="highlight-color-swatch",o.dataset.color=s,o.title=s,o.setAttribute("aria-label",s),o.setAttribute("aria-pressed",String(s===this.#i)),o.style.setProperty("--_swatch",`var(--highlight-${s})`),n.appendChild(o)}this.appendChild(n),this.#s=n,i.setAttribute("aria-expanded","false"),i.setAttribute("aria-controls",n.id),this.listen(i,"click",s=>{s.stopPropagation(),this.#r(n.hidden)}),this.listen(n,"click",s=>{let o=s.target.closest?.(".highlight-color-swatch");o&&(s.stopPropagation(),this.#a(o.dataset.color??this.#i),this.#r(!1),this.#m(this.#i))}),this.listen(this,"keydown",s=>{let o=s;o.key!=="Escape"||n.hidden||(o.stopPropagation(),this.#r(!1),i.focus())}),this.listen(document,"pointerdown",s=>{!n.hidden&&!this.contains(s.target)&&this.#r(!1)}),this.listen(this.#o,"selection-menu:dismiss",()=>this.#r(!1))}#r(t){!this.#s||!this.#e||(this.#s.hidden=!t,this.#e.setAttribute("aria-expanded",String(t)),t&&(this.#p(),(this.#s.querySelector('[aria-pressed="true"]')??this.#s.firstElementChild)?.focus({preventScroll:!0})))}#p(){let t=this.#s;if(!t)return;t.style.removeProperty("--_hn-shift");let{left:e,right:i}=t.getBoundingClientRect(),n=8,s=e<n?n-e:i>window.innerWidth-n?window.innerWidth-n-i:0;s&&t.style.setProperty("--_hn-shift",`${s}px`)}#a(t){this.#i=t,this.#s?.querySelectorAll(".highlight-color-swatch").forEach(e=>e.setAttribute("aria-pressed",String(e.dataset.color===t)))}#m(t){let e=this.#o,i=e?.getSelection?.();if(!i?.target)return;let n=this.#g(i.target);if(!n)return;let s=window.getSelection();s&&(s.isCollapsed||!s.rangeCount)&&i.range&&(s.removeAllRanges(),s.addRange(i.range)),n._createFromSelection(t),this.#n=i.target,e.dismiss?.()}#b(){let t=this.#o;if(!t)return[];let e=new Set,i=t.getAttribute("for"),n=i&&document.getElementById(i);return n&&e.add(n),t.id&&document.querySelectorAll(`[data-selection-menu="${CSS.escape(t.id)}"]`).forEach(s=>e.add(s)),[...e]}#g(t){t.hasAttribute("data-highlights-init")||(t.setAttribute("data-highlights",this.getAttribute("storage-key")||""),this.hasAttribute("colors")&&t.setAttribute("data-highlights-colors",this.getAttribute("colors")??""));for(let i of it){let n=this.getAttribute(`data-label-${i}`);n&&t.setAttribute(`data-highlights-label-${i}`,n)}let e=f(t);return this.hasAttribute("readonly")&&!t.hasAttribute("data-highlights-readonly")&&(t.setAttribute("data-highlights-readonly",""),e.destroy(),e=f(t)),e}#A(){let t=this.#w();t&&(this.#t=this.#g(t))}#w(){let t=this.getAttribute("for");return t?document.getElementById(t):this.firstElementChild}#y(){let t=this.getAttribute("colors"),e=t?t.split(",").map(i=>i.trim()).filter(i=>et.test(i)):[];return e.length?[...new Set(e)]:[...tt]}#c(){if(this.#t&&!this.#t.destroyed)return this.#t;let t=this.#n?.isConnected?this.#n:this.#b()[0];return t?this.#g(t):null}highlightSelection(t=this.#i){this.hasAttribute("readonly")||!this.#y().includes(t)||(this.#a(t),this.#o?this.#m(t):this.#t?._createFromSelection(t))}getHighlights(){return this.#c()?.getHighlights()??[]}removeHighlight(t){this.#c()?.removeHighlight(t)}clearAll(){this.#c()?.clearAll()}exportHighlights(){return this.#c()?.exportHighlights()??'{"version":1,"highlights":[]}'}importHighlights(t){return this.#c()?.importHighlights(t)??{imported:0,rejected:0}}};$("highlight-wc",R);
6
+ }`)}function ct(s){for(let t of s)f.set(t,(f.get(t)??0)+1);K()}function ht(s){for(let t of s){let e=(f.get(t)??0)-1;e>0?f.set(t,e):f.delete(t)}K()}function dt(s){let t=m.get(s),e=t?[...t.values()].flat():[];e.length===0?(CSS.highlights.delete(`hn-${s}`),m.delete(s)):CSS.highlights.set(`hn-${s}`,new Highlight(...e))}function X(s,t){let e=new Set(t.keys());for(let[n,i]of m)i.has(s)&&e.add(n);for(let n of e){let i=t.get(n)??[],r=m.get(n);i.length?(r||m.set(n,r=new Map),r.set(s,i)):r?.delete(s),dt(n)}}function L(s){return document.createTreeWalker(s,NodeFilter.SHOW_TEXT,t=>t.parentElement?.closest(".hn-margin-annotation")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT)}function S(s){let t=L(s),e="";for(;t.nextNode();)e+=t.currentNode.textContent??"";return e}function G(s,t,e){let n=L(s),i=0;for(;n.nextNode();){if(n.currentNode===t)return i+e;i+=(n.currentNode.textContent??"").length}return-1}function T(s,t,e){let n=L(s),i=0,r=null,o=0,a=null,l=0;for(;n.nextNode();){let c=n.currentNode,d=(c.textContent??"").length;if(!r&&i+d>t&&(r=c,o=t-i),i+d>=e){a=c,l=e-i;break}i+=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 R=class{#t;#i;#n;#o;#e=[];#s=[];#r=!rt;#g;#a;#h=!1;#p=[];#l=new Map;constructor(t){this.#t=t,this.#o=t.hasAttribute("data-highlights-readonly");let e=t.dataset.highlights;this.#i=e&&e!==""?e:location.pathname;let n=t.dataset.highlightsColors,i=n?n.split(",").map(r=>r.trim()).filter(O):[...st];this.#n=[...new Set(i)],this.#r||ct(this.#n),this.#f(),this.#o||(this.#g=this.#m.bind(this),this.#a=this.#w.bind(this),t.addEventListener("pointerup",this.#g),t.addEventListener("click",this.#a)),t.setAttribute("data-highlights-init",""),this.#S().then(()=>{this.#h||(this.#f(),this.#x())})}get colors(){return[...this.#n]}get destroyed(){return this.#h}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(i=>i.id===t),n=this.#s.findIndex(i=>i.id===t);e<0&&n<0||(e>=0?this.#e.splice(e,1):this.#s.splice(n,1),this.#u(),this.#f(),this.#c("highlights:removed",{id:t}),E(v(this.#t,"removed")))}clearAll(){this.#e=[],this.#s=[],this.#u(),this.#f()}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.#b(e.highlights);return this.#e=n,this.#s=[],this.#u(),this.#f(),{imported:n.length,rejected:e.highlights.length-n.length}}#b(t,e=S(this.#t).length){let n={textLength:e,colors:this.#n},i=new Set,r=[];for(let o of t){let a=lt(o,n);!a||i.has(a.id)||(i.add(a.id),r.push(a))}return r}destroy(){this.#h||(this.#h=!0,this.#g&&this.#t.removeEventListener("pointerup",this.#g),this.#a&&this.#t.removeEventListener("click",this.#a),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()}):(X(this,new Map),ht(this.#n)),this.#A(),this.#l.clear(),this.#t.removeAttribute("data-highlights-init"),x.get(this.#t)===this&&x.delete(this.#t))}#m(){requestAnimationFrame(()=>{if(this.#h)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()})})}#w(t){let e=t.target.closest?.(".hn-margin-annotation");if(e){let i=e.dataset.hnId,r=this.#e.find(o=>o.id===i);if(r){this.#c("highlights:clicked",{id:i,highlight:{...r}}),this.#c("highlights:request-note",{id:i,highlight:{...r},controller:this});return}}let n=t.target.closest?.("mark[data-hn-id]");if(n){let i=n.dataset.hnId,r=this.#e.find(o=>o.id===i);if(r){this.#c("highlights:clicked",{id:i,highlight:{...r}});return}}if(!this.#r){let i=this.#d(t.clientX,t.clientY);i&&this.#c("highlights:clicked",{id:i.id,highlight:{...i}})}}findHighlightRect(t){let e=this.#e.find(r=>r.id===t);if(!e)return null;let n=this.#E(e);if(!n)return null;let i=n.getClientRects();return i.length?i[0]:null}#E(t){return this.#l.get(t.id)??T(this.#t,t.startOffset,t.endOffset)}#y(){this.#l.clear();for(let t of this.#e){let e=T(this.#t,t.startOffset,t.endOffset);e&&this.#l.set(t.id,e)}}#d(t,e){for(let n of this.#e){let i=this.#l.get(n.id);if(!i)continue;let r=i.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 i=G(this.#t,n.startContainer,n.startOffset),r=G(this.#t,n.endContainer,n.endOffset);if(i<0||r<0||i>=r)return;let o=e.toString().trim(),a={id:J(),startOffset:i,endOffset:r,text:o,...A(S(this.#t),i,r),color:t,note:"",created:Date.now()};this.#e.push(a),this.#u(),this.#f(),e.removeAllRanges(),this.#c("highlights:added",{id:a.id,text:o,color:t,note:""}),E(v(this.#t,"added"))}_changeColor(t,e){let n=this.#e.find(i=>i.id===t);n&&(n.color=e,this.#u(),this.#f())}_updateNote(t,e){let n=this.#e.find(i=>i.id===t);n&&(n.note=e,this.#u(),this.#v(),this.#c("highlights:note-changed",{id:t,note:e}),E(v(this.#t,"noteSaved")))}async#S(){let t=await p.get(z,this.#i);if(!t||!Array.isArray(t.highlights)||this.#h)return;let e=Array.isArray(t.unplaced)?t.unplaced:[],n=this.#b([...t.highlights,...e],1/0),i=S(this.#t);if(e.length===0&&t.contentHash===U(i)){this.#e=n;return}this.#e=[],this.#s=[];for(let r of n){let o=V(i,r);o?this.#e.push({...r,startOffset:o.start,endOffset:o.end,...A(i,o.start,o.end)}):this.#s.push(r)}this.#u()}#x(){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()}))}#u(){let t={version:1,contentHash:U(S(this.#t)),highlights:this.#e,...this.#s.length?{unplaced:this.#s}:{}};p.set(z,this.#i,t).catch(()=>{})}#f(){this.#r?(this.#k(),this.#y()):(this.#y(),this.#C()),this.#v()}#C(){let t=new Map;for(let e of this.#n)t.set(e,[]);for(let e of this.#e){let n=this.#l.get(e.id);n&&t.has(e.color)&&t.get(e.color).push(n)}X(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=T(this.#t,e.startOffset,e.endOffset);if(!n)continue;let i=document.createElement("mark");i.dataset.hnId=e.id,O(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 r=n.extractContents();i.appendChild(r),n.insertNode(i)}}}#A(){for(let t of this.#p)t.remove();this.#p=[]}#v(){if(this.#A(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");let e=this.#t.getBoundingClientRect(),n=v(this.#t,"annotation");for(let i of this.#e){let r=this.#l.get(i.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=i.id,l.setAttribute("aria-hidden","true"),l.style.insetBlockStart=`${a}px`,i.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 g(s){let t=x.get(s);if(t&&!t.destroyed)return t;let e=new R(s);return x.set(s,e),e}function Y(s=document){s.querySelectorAll($).forEach(t=>{t.hasAttribute("data-highlights-init")||g(t)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>Y()):Y();var ut=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($)&&g(n),n.querySelectorAll($).forEach(i=>{i.hasAttribute("data-highlights-init")||g(i)})}});ut.observe(document.documentElement,{childList:!0,subtree:!0});var ft=["yellow","green","blue","pink"],gt=/^[a-z0-9_-]+$/i,pt=["annotation","added","removed"],mt=0,M=class extends y{#t=null;#i=null;#n="yellow";#o=null;#e=null;#s=!1;#r=null;setup(){this.#o=this.closest("selection-menu");let t=this.#y();t.includes(this.#n)||(this.#n=t[0]??"yellow"),this.#o?this.#g():this.#w()}teardown(){this.#t?.destroy(),this.#t=null,this.#r?.remove(),this.#r=null,this.#s?this.#e?.remove():this.#e?.removeAttribute("aria-expanded"),this.#e=null,this.#s=!1,this.#o=null}#g(){let t=this.hasAttribute("readonly");for(let r of this.#b())this.#m(r);if(t)return;let e=this.#y(),n=this.querySelector(":scope > button");if(this.#s=!n,!n){n=document.createElement("button"),n.type="button",n.setAttribute("aria-label",this.dataset.labelButton||"Highlight selection");let r=document.createElement("icon-wc");r.setAttribute("name","highlighter"),r.setAttribute("size","sm"),r.setAttribute("aria-hidden","true"),n.appendChild(r),this.appendChild(n)}this.#e=n;let i=document.createElement("div");i.className="highlight-color-dropdown",i.id=`highlight-palette-${++mt}`,i.setAttribute("role","group"),i.setAttribute("aria-label",this.dataset.labelPalette||"Highlight color"),i.hidden=!0;for(let r of e){let o=document.createElement("button");o.type="button",o.className="highlight-color-swatch",o.dataset.color=r,o.title=r,o.setAttribute("aria-label",r),o.setAttribute("aria-pressed",String(r===this.#n)),o.style.setProperty("--_swatch",`var(--highlight-${r})`),i.appendChild(o)}this.appendChild(i),this.#r=i,n.setAttribute("aria-expanded","false"),n.setAttribute("aria-controls",i.id),this.listen(n,"click",r=>{r.stopPropagation(),this.#a(i.hidden)}),this.listen(i,"click",r=>{let o=r.target.closest?.(".highlight-color-swatch");o&&(r.stopPropagation(),this.#p(o.dataset.color??this.#n),this.#a(!1),this.#l(this.#n))}),this.listen(this,"keydown",r=>{let o=r;o.key!=="Escape"||i.hidden||(o.stopPropagation(),this.#a(!1),n.focus())}),this.listen(document,"pointerdown",r=>{!i.hidden&&!this.contains(r.target)&&this.#a(!1)}),this.listen(this.#o,"selection-menu:dismiss",()=>this.#a(!1))}#a(t){!this.#r||!this.#e||(this.#r.hidden=!t,this.#e.setAttribute("aria-expanded",String(t)),t&&(this.#h(),(this.#r.querySelector('[aria-pressed="true"]')??this.#r.firstElementChild)?.focus({preventScroll:!0})))}#h(){let t=this.#r;if(!t)return;t.style.removeProperty("--_hn-shift");let{left:e,right:n}=t.getBoundingClientRect(),i=8,r=e<i?i-e:n>window.innerWidth-i?window.innerWidth-i-n:0;r&&t.style.setProperty("--_hn-shift",`${r}px`)}#p(t){this.#n=t,this.#r?.querySelectorAll(".highlight-color-swatch").forEach(e=>e.setAttribute("aria-pressed",String(e.dataset.color===t)))}#l(t){let e=this.#o,n=e?.getSelection?.();if(!n?.target)return;let i=this.#m(n.target);if(!i)return;let r=window.getSelection();r&&(r.isCollapsed||!r.rangeCount)&&n.range&&(r.removeAllRanges(),r.addRange(n.range)),i._createFromSelection(t),this.#i=n.target,e.dismiss?.()}#b(){let t=this.#o;if(!t)return[];let e=new Set,n=t.getAttribute("for"),i=n&&document.getElementById(n);return i&&e.add(i),t.id&&document.querySelectorAll(`[data-selection-menu="${CSS.escape(t.id)}"]`).forEach(r=>e.add(r)),[...e]}#m(t){t.hasAttribute("data-highlights-init")||(t.setAttribute("data-highlights",this.getAttribute("storage-key")||""),this.hasAttribute("colors")&&t.setAttribute("data-highlights-colors",this.getAttribute("colors")??""));for(let n of pt){let i=this.getAttribute(`data-label-${n}`);i&&t.setAttribute(`data-highlights-label-${n}`,i)}let e=g(t);return this.hasAttribute("readonly")&&!t.hasAttribute("data-highlights-readonly")&&(t.setAttribute("data-highlights-readonly",""),e.destroy(),e=g(t)),e}#w(){let t=this.#E();t&&(this.#t=this.#m(t))}#E(){let t=this.getAttribute("for");return t?document.getElementById(t):this.firstElementChild}#y(){let t=this.getAttribute("colors"),e=t?t.split(",").map(n=>n.trim()).filter(n=>gt.test(n)):[];return e.length?[...new Set(e)]:[...ft]}#d(){if(this.#t&&!this.#t.destroyed)return this.#t;let t=this.#i?.isConnected?this.#i:this.#b()[0];return t?this.#m(t):null}highlightSelection(t=this.#n){this.hasAttribute("readonly")||!this.#y().includes(t)||(this.#p(t),this.#o?this.#l(t):this.#t?._createFromSelection(t))}getHighlights(){return this.#d()?.getHighlights()??[]}removeHighlight(t){this.#d()?.removeHighlight(t)}clearAll(){this.#d()?.clearAll()}exportHighlights(){return this.#d()?.exportHighlights()??'{"version":1,"highlights":[]}'}importHighlights(t){return this.#d()?.importHighlights(t)??{imported:0,rejected:0}}};I("highlight-wc",M);
7
7
  //# sourceMappingURL=highlight-wc.js.map
@@ -1,4 +1,4 @@
1
- function l({basePath:t,set:n,name:e}){return`${t}/${n}/${e}.svg`}function u(t,n=document){let e=t.getAttribute("data-icon-set");if(e)return e;let r=t.closest("[data-icon-set]")?.getAttribute("data-icon-set");return r||n.documentElement.dataset.iconSet||"lucide"}function f(t=document){return t.documentElement.dataset.iconPath||"/cdn/icons"}function m(t){let n=t.getAttribute("data-icon");if(!n){t.style.removeProperty("--vb-icon");return}let e=l({basePath:f(document),set:u(t,document),name:n});t.style.setProperty("--vb-icon",`url("${e}")`)}function d(t=document){for(let n of t.querySelectorAll("[data-icon]"))m(n)}var A=!1;function C(){if(A)return;A=!0,d(),new MutationObserver(n=>{for(let e of n)if(e.type==="attributes"){let r=e.target;r.hasAttribute&&r.hasAttribute("data-icon")&&m(r),e.attributeName==="data-icon-set"&&d(r)}else for(let r of e.addedNodes){if(r.nodeType!==1)continue;let o=r;o.hasAttribute("data-icon")&&m(o),d(o)}}).observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["data-icon","data-icon-set"]})}typeof document<"u"&&C();var S=`
1
+ var A=null;function f(){return O()}function O(){if(typeof window<"u"&&window.__VB_THEME_BASE)return String(window.__VB_THEME_BASE).replace(/\/$/,"");if(A)return A;if(typeof document<"u"){let t=document.querySelectorAll('script[src*="vanilla-breeze"]');for(let n of t){let e=n.getAttribute("src");if(e){let r=e.lastIndexOf("/");if(r!==-1)return e.slice(0,r)}}}return"/cdn"}function u({basePath:t,set:n,name:e}){return`${t}/${n}/${e}.svg`}function l(t,n=document){let e=t.getAttribute("data-icon-set");if(e)return e;let r=t.closest("[data-icon-set]")?.getAttribute("data-icon-set");return r||n.documentElement.dataset.iconSet||"lucide"}function d(t=document){let n=t.documentElement.dataset.iconPath;if(n)return n;let e=`${f()}/icons`;try{return new URL(e,t.baseURI).href}catch{return e}}function m(t){let n=t.getAttribute("data-icon");if(!n){t.style.removeProperty("--vb-icon");return}let e=u({basePath:d(document),set:l(t,document),name:n});t.style.setProperty("--vb-icon",`url("${e}")`)}function h(t=document){for(let n of t.querySelectorAll("[data-icon]"))m(n)}var E=!1;function B(){if(E)return;E=!0,h(),new MutationObserver(n=>{for(let e of n)if(e.type==="attributes"){let r=e.target;r.hasAttribute&&r.hasAttribute("data-icon")&&m(r),e.attributeName==="data-icon-set"&&h(r)}else for(let r of e.addedNodes){if(r.nodeType!==1)continue;let o=r;o.hasAttribute("data-icon")&&m(o),h(o)}}).observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["data-icon","data-icon-set"]})}typeof document<"u"&&B();var T=`
2
2
  :host {
3
3
  display: inline-flex;
4
4
  align-items: center;
@@ -63,5 +63,5 @@ svg {
63
63
  :host([hidden]) {
64
64
  display: none;
65
65
  }
66
- `;var de=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;function T(t,n,e={}){let r=e.priority??10,o={impl:n,bundle:e.bundle,contract:e.contract,priority:r},s=E.get(t);if(customElements.get(t)){if(!s||s.priority>=r){s&&s.priority===r&&s.impl!==n&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}E.set(t,o),customElements.define(t,n)}var O="http://www.w3.org/1999/xhtml",h="http://www.w3.org/2000/svg",P="http://www.w3.org/1998/Math/MathML",_=new Set([O,h,P]),b="user-content-",D=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"]),M=new Set(["title","desc"]),F=new Set(["animate","set","animatemotion","animatetransform"]),B=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),U=new Set(["src","poster","srcset"]),j=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),q=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),H=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),W={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},V=new Set(["social-embed","youtube-player","geo-map"]),G=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],K=new Set(["audio-player","video-player","image-map","brand-mark"]);function X(t){return String(t).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function k(t,n=!1){let e=X(t);return n?/(^|,)(javascript|vbscript|livescript):/.test(e)?!0:/(^|,)data:/.test(e)?e.split(/(?=data:)/).filter(o=>o.startsWith("data:")).some(o=>!/^data:(image|audio|video|font)\//.test(o)):!1:/^(javascript|vbscript|livescript|data):/.test(e)}function $(t){let n=String(t).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(n)}var Y=t=>String(t.localName||t.tagName||"").toLowerCase(),J=t=>t.startsWith(b)?t:b+t;function Q(t,n){if(D.has(n))return!0;let e=t.namespaceURI;return!!(e&&!_.has(e)||n==="title"&&e!==h||M.has(n)&&e===h&&t.children?.length||F.has(n)&&(t.getAttribute("attributeName")||t.getAttribute("attributename")||"").toLowerCase().includes("href"))}function Z(t,n){for(let e of[...t.attributes]){let r=e.name.toLowerCase();if(r.startsWith("on")||j.has(r)||!n.keepIds&&q.has(r)){t.removeAttribute(e.name);continue}if(r==="style"){(!n.keepStyle||$(e.value))&&t.removeAttribute(e.name);continue}if((r==="id"||r==="name")&&!n.keepIds){let o=J(e.value);r==="id"?n.ids.set(e.value,o):n.ids.set(`name:${e.value}`,o),t.setAttribute(e.name,o);continue}if(B.has(r)||r.endsWith(":href")){k(e.value,!1)&&t.removeAttribute(e.name);continue}U.has(r)&&k(e.value,!0)&&t.removeAttribute(e.name)}}function ee(t,n){let e=(t.getAttribute("type")||"").toLowerCase();n==="button"&&e!=="button"&&t.setAttribute("type","button"),n==="input"&&/^(submit|reset|image)$/.test(e)&&t.setAttribute("type","button")}function te(t,n){for(let e of t)for(let r of[...e.attributes]){let o=r.name.toLowerCase(),s=r.value;if((o==="href"||o.endsWith(":href"))&&s.startsWith("#")){let i=ne(s.slice(1));n.has(i)&&e.setAttribute(r.name,`#${n.get(i)}`)}else if(o==="usemap"&&s.startsWith("#")){let i=n.get(`name:${s.slice(1)}`);i?e.setAttribute(r.name,`#${i}`):e.removeAttribute(r.name)}else if(H.has(o)){let i=s.split(/\s+/).filter(Boolean).map(a=>n.get(a)||(a.startsWith(b)?a:null)).filter(Boolean);i.length?e.setAttribute(r.name,i.join(" ")):e.removeAttribute(r.name)}else s.includes("url(#")&&e.setAttribute(r.name,s.replace(/url\(#([^)]+)\)/g,(i,a)=>n.has(a)?`url(#${n.get(a)})`:i))}}function ne(t){try{return decodeURIComponent(t)}catch{return t}}function N(t){let n=t.childNodes;if(n)for(let e of[...n])e.nodeType===8?e.remove():(e.nodeType===1||e.nodeType===11)&&N(e)}function L(t,n){N(t);let e=[...t.querySelectorAll("*")];n.includeRoot&&e.unshift(t);let r=new Map,o=[],s={...n,ids:r};for(let i of e){if(!oe(i,t))continue;let a=Y(i);if(n.svgOnly&&(M.has(a)||a==="style")){if(a==="style"&&$(i.textContent||"")){i.remove();continue}}else if(Q(i,a)){i.remove();continue}if(!n.keepIds&&!n.svgOnly&&V.has(a)){re(i);continue}if(a==="template"){let c=i.content;c&&L(c,{...n,includeRoot:!1})}Z(i,s),n.keepIds||ee(i,a);let w=W[a];if(w)for(let c of w)i.removeAttribute(c);if(a==="include-file"&&!n.allowIncludeFile&&i.removeAttribute("src"),!n.keepIds&&!n.svgOnly&&a.includes("-")&&a!=="include-file"&&!K.has(a))for(let c of G)i.removeAttribute(c);o.push(i)}!n.keepIds&&r.size&&te(o,r)}function re(t){let n=t.parentNode;if(n){for(let e of[...t.childNodes])n.insertBefore(e,t);t.remove()}}function oe(t,n){let e=t;for(;e;){if(e===n)return!0;e=e.parentNode??e.parent??null}return!1}function x(t){return!t||typeof t!="object"||!("attributes"in t)||L(t,{includeRoot:!0,keepIds:!0,keepStyle:!0,svgOnly:!0}),t}var y="lucide",ie=new Set([y,"custom"]),I=new Map,p=new Set,g=new Map,z=new Map;function se(t,n){let e=`${t}/${n}`,r=z.get(e);return r||(r=fetch(`${e}.json`).then(o=>o.ok?o.json():null).then(o=>Array.isArray(o)?new Set(o.map(String)):null).catch(()=>null),z.set(e,r)),r}function ae(t){if(!t.includes("<svg"))return null;let n=new DOMParser().parseFromString(t,"image/svg+xml"),e=n.documentElement;return!e||e.localName!=="svg"||n.querySelector("parsererror")?null:(x(e),e.removeAttribute("width"),e.removeAttribute("height"),document.importNode(e,!0))}function R(t){let n=I.get(t);if(n)return Promise.resolve(n);if(p.has(t))return Promise.reject(new Error(`Icon not found: ${t}`));let e=g.get(t);return e||(e=fetch(t).then(async r=>{if(!r.ok)throw p.add(t),new Error(`Icon not found: ${t}`);let o=ae(await r.text());if(!o)throw p.add(t),new Error(`Invalid SVG: ${t}`);return I.set(t,o),o}).finally(()=>g.delete(t)),g.set(t,e)),e}async function ce(t,n,e){if(n!==y){let r=ie.has(n)?null:await se(t,n);if(!r||r.has(e))try{return await R(l({basePath:t,set:n,name:e}))}catch{}}return R(l({basePath:t,set:y,name:e}))}var v=class t extends HTMLElement{static#r=new Set;static#o=null;static#f(){t.#o||(t.#o=new MutationObserver(n=>{let e=document.documentElement;for(let r of n){let o=r.target;for(let s of t.#r)(o===e||o.contains(s))&&s.#c()}}),t.#o.observe(document.documentElement,{subtree:!0,attributes:!0,attributeFilter:["data-icon-set","data-icon-path"]}))}static get observedAttributes(){return["name","set","label","base-path"]}#i=0;#s="";#e="";#a="";#t=null;constructor(){super();let n=this.attachShadow({mode:"open"});n.innerHTML=`<style>${S}</style><slot></slot>`}get name(){return this.getAttribute("name")||""}get set(){return this.getAttribute("set")||u(this)}get size(){return this.getAttribute("size")||"md"}get label(){return this.getAttribute("label")}get basePath(){return this.getAttribute("base-path")||f()}get iconPath(){return l({basePath:this.basePath,set:this.set,name:this.name})}connectedCallback(){t.#r.add(this),t.#f(),this.#c(),this.#t=()=>{let n=this.#n();n&&(n.style.stroke="none",requestAnimationFrame(()=>{n.style.stroke=""}))},window.addEventListener("vb:theme-change",this.#t),this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded"),t.#r.delete(this),this.#t&&(window.removeEventListener("vb:theme-change",this.#t),this.#t=null)}attributeChangedCallback(n,e,r){e===r||!this.isConnected||(n==="label"?this.#l():this.#c())}#n(){return this.shadowRoot?.querySelector("svg")??null}#c(){let n=this.name,e=`${this.basePath}|${this.set}|${n}`;if(e===this.#s){this.#l();return}if(e===this.#e||e===this.#a)return;let r=++this.#i;if(this.#e=e,this.#a="",!n){this.#e="",this.#u("No icon name specified",e);return}let o=this.basePath,s=this.set;ce(o,s,n).then(i=>{r===this.#i&&(this.#e="",this.#d(i.cloneNode(!0),e))},i=>{r===this.#i&&(this.#e="",this.#u(i.message,e))})}#d(n,e){let r=this.shadowRoot,o=this.#n()||r.querySelector("slot");o?o.replaceWith(n):r.append(n),this.#s=e,this.removeAttribute("data-error"),this.#l()}#l(){let n=this.#n();if(!n)return;let e=this.label;e?(n.setAttribute("role","img"),n.setAttribute("aria-label",e),n.removeAttribute("aria-hidden")):(n.removeAttribute("role"),n.removeAttribute("aria-label"),n.setAttribute("aria-hidden","true"))}#u(n,e){this.#a=e,this.setAttribute("data-error","true"),console.warn(`icon-wc: ${n}`);let r=this.#n();r&&r.replaceWith(document.createElement("slot")),this.#s=""}};T("icon-wc",v);export{v as IconWc};
66
+ `;var ve=window.matchMedia("(prefers-reduced-motion: reduce)");var $=new Map;function k(t,n,e={}){let r=e.priority??10,o={impl:n,bundle:e.bundle,contract:e.contract,priority:r},s=$.get(t);if(customElements.get(t)){if(!s||s.priority>=r){s&&s.priority===r&&s.impl!==n&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}$.set(t,o),customElements.define(t,n)}var F="http://www.w3.org/1999/xhtml",b="http://www.w3.org/2000/svg",H="http://www.w3.org/1998/Math/MathML",j=new Set([F,b,H]),p="user-content-",q=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"]),L=new Set(["title","desc"]),U=new Set(["animate","set","animatemotion","animatetransform"]),D=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),V=new Set(["src","poster","srcset"]),W=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),G=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),K=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),N={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},X=new Set(["social-embed","youtube-player","geo-map"]),Y=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],J=new Set(["audio-player","video-player","image-map","brand-mark"]);function Q(t){return String(t).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function M(t,n=!1){let e=Q(t);return n?/(^|,)(javascript|vbscript|livescript):/.test(e)?!0:/(^|,)data:/.test(e)?e.split(/(?=data:)/).filter(o=>o.startsWith("data:")).some(o=>!/^data:(image|audio|video|font)\//.test(o)):!1:/^(javascript|vbscript|livescript|data):/.test(e)}function x(t){let n=String(t).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(n)}var Z=t=>String(t.localName||t.tagName||"").toLowerCase(),ee=t=>t.startsWith(p)?t:p+t;function te(t,n){if(q.has(n))return!0;let e=t.namespaceURI;return!!(e&&!j.has(e)||n==="title"&&e!==b||L.has(n)&&e===b&&t.children?.length||U.has(n)&&(t.getAttribute("attributeName")||t.getAttribute("attributename")||"").toLowerCase().includes("href"))}function ne(t,n){for(let e of[...t.attributes]){let r=e.name.toLowerCase();if(r.startsWith("on")||W.has(r)||!n.keepIds&&G.has(r)){t.removeAttribute(e.name);continue}if(r==="style"){(!n.keepStyle||x(e.value))&&t.removeAttribute(e.name);continue}if((r==="id"||r==="name")&&!n.keepIds){let o=ee(e.value);r==="id"?n.ids.set(e.value,o):n.ids.set(`name:${e.value}`,o),t.setAttribute(e.name,o);continue}if(D.has(r)||r.endsWith(":href")){M(e.value,!1)&&t.removeAttribute(e.name);continue}V.has(r)&&M(e.value,!0)&&t.removeAttribute(e.name)}}function re(t,n){let e=(t.getAttribute("type")||"").toLowerCase();n==="button"&&e!=="button"&&t.setAttribute("type","button"),n==="input"&&/^(submit|reset|image)$/.test(e)&&t.setAttribute("type","button")}function oe(t,n){for(let e of t)for(let r of[...e.attributes]){let o=r.name.toLowerCase(),s=r.value;if((o==="href"||o.endsWith(":href"))&&s.startsWith("#")){let i=ie(s.slice(1));n.has(i)&&e.setAttribute(r.name,`#${n.get(i)}`)}else if(o==="usemap"&&s.startsWith("#")){let i=n.get(`name:${s.slice(1)}`);i?e.setAttribute(r.name,`#${i}`):e.removeAttribute(r.name)}else if(K.has(o)){let i=s.split(/\s+/).filter(Boolean).map(a=>n.get(a)||(a.startsWith(p)?a:null)).filter(Boolean);i.length?e.setAttribute(r.name,i.join(" ")):e.removeAttribute(r.name)}else s.includes("url(#")&&e.setAttribute(r.name,s.replace(/url\(#([^)]+)\)/g,(i,a)=>n.has(a)?`url(#${n.get(a)})`:i))}}function ie(t){try{return decodeURIComponent(t)}catch{return t}}function C(t){let n=t.childNodes;if(n)for(let e of[...n])e.nodeType===8?e.remove():(e.nodeType===1||e.nodeType===11)&&C(e)}function I(t,n){C(t);let e=[...t.querySelectorAll("*")];n.includeRoot&&e.unshift(t);let r=new Map,o=[],s={...n,ids:r};for(let i of e){if(!ae(i,t))continue;let a=Z(i);if(n.svgOnly&&(L.has(a)||a==="style")){if(a==="style"&&x(i.textContent||"")){i.remove();continue}}else if(te(i,a)){i.remove();continue}if(!n.keepIds&&!n.svgOnly&&X.has(a)){se(i);continue}if(a==="template"){let c=i.content;c&&I(c,{...n,includeRoot:!1})}ne(i,s),n.keepIds||re(i,a);let S=N[a];if(S)for(let c of S)i.removeAttribute(c);if(a==="include-file"&&!n.allowIncludeFile&&i.removeAttribute("src"),!n.keepIds&&!n.svgOnly&&a.includes("-")&&a!=="include-file"&&!J.has(a))for(let c of Y)i.removeAttribute(c);o.push(i)}!n.keepIds&&r.size&&oe(o,r)}function se(t){let n=t.parentNode;if(n){for(let e of[...t.childNodes])n.insertBefore(e,t);t.remove()}}function ae(t,n){let e=t;for(;e;){if(e===n)return!0;e=e.parentNode??e.parent??null}return!1}function P(t){return!t||typeof t!="object"||!("attributes"in t)||I(t,{includeRoot:!0,keepIds:!0,keepStyle:!0,svgOnly:!0}),t}var y="lucide",ce=new Set([y,"custom"]),z=new Map,g=new Set,v=new Map,R=new Map;function ue(t,n){let e=`${t}/${n}`,r=R.get(e);return r||(r=fetch(`${e}.json`).then(o=>o.ok?o.json():null).then(o=>Array.isArray(o)?new Set(o.map(String)):null).catch(()=>null),R.set(e,r)),r}function le(t){if(!t.includes("<svg"))return null;let n=new DOMParser().parseFromString(t,"image/svg+xml"),e=n.documentElement;return!e||e.localName!=="svg"||n.querySelector("parsererror")?null:(P(e),e.removeAttribute("width"),e.removeAttribute("height"),document.importNode(e,!0))}function _(t){let n=z.get(t);if(n)return Promise.resolve(n);if(g.has(t))return Promise.reject(new Error(`Icon not found: ${t}`));let e=v.get(t);return e||(e=fetch(t).then(async r=>{if(!r.ok)throw g.add(t),new Error(`Icon not found: ${t}`);let o=le(await r.text());if(!o)throw g.add(t),new Error(`Invalid SVG: ${t}`);return z.set(t,o),o}).finally(()=>v.delete(t)),v.set(t,e)),e}async function de(t,n,e){if(n!==y){let r=ce.has(n)?null:await ue(t,n);if(!r||r.has(e))try{return await _(u({basePath:t,set:n,name:e}))}catch{}}return _(u({basePath:t,set:y,name:e}))}var w=class t extends HTMLElement{static#r=new Set;static#o=null;static#d(){t.#o||(t.#o=new MutationObserver(n=>{let e=document.documentElement;for(let r of n){let o=r.target;for(let s of t.#r)(o===e||o.contains(s))&&s.#c()}}),t.#o.observe(document.documentElement,{subtree:!0,attributes:!0,attributeFilter:["data-icon-set","data-icon-path"]}))}static get observedAttributes(){return["name","set","label","base-path"]}#i=0;#s="";#e="";#a="";#t=null;constructor(){super();let n=this.attachShadow({mode:"open"});n.innerHTML=`<style>${T}</style><slot></slot>`}get name(){return this.getAttribute("name")||""}get set(){return this.getAttribute("set")||l(this)}get size(){return this.getAttribute("size")||"md"}get label(){return this.getAttribute("label")}get basePath(){return this.getAttribute("base-path")||d()}get iconPath(){return u({basePath:this.basePath,set:this.set,name:this.name})}connectedCallback(){t.#r.add(this),t.#d(),this.#c(),this.#t=()=>{let n=this.#n();n&&(n.style.stroke="none",requestAnimationFrame(()=>{n.style.stroke=""}))},window.addEventListener("vb:theme-change",this.#t),this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded"),t.#r.delete(this),this.#t&&(window.removeEventListener("vb:theme-change",this.#t),this.#t=null)}attributeChangedCallback(n,e,r){e===r||!this.isConnected||(n==="label"?this.#u():this.#c())}#n(){return this.shadowRoot?.querySelector("svg")??null}#c(){let n=this.name,e=`${this.basePath}|${this.set}|${n}`;if(e===this.#s){this.#u();return}if(e===this.#e||e===this.#a)return;let r=++this.#i;if(this.#e=e,this.#a="",!n){this.#e="",this.#l("No icon name specified",e);return}let o=this.basePath,s=this.set;de(o,s,n).then(i=>{r===this.#i&&(this.#e="",this.#f(i.cloneNode(!0),e))},i=>{r===this.#i&&(this.#e="",this.#l(i.message,e))})}#f(n,e){let r=this.shadowRoot,o=this.#n()||r.querySelector("slot");o?o.replaceWith(n):r.append(n),this.#s=e,this.removeAttribute("data-error"),this.#u()}#u(){let n=this.#n();if(!n)return;let e=this.label;e?(n.setAttribute("role","img"),n.setAttribute("aria-label",e),n.removeAttribute("aria-hidden")):(n.removeAttribute("role"),n.removeAttribute("aria-label"),n.setAttribute("aria-hidden","true"))}#l(n,e){this.#a=e,this.setAttribute("data-error","true"),console.warn(`icon-wc: ${n}`);let r=this.#n();r&&r.replaceWith(document.createElement("slot")),this.#s=""}};k("icon-wc",w);export{w as IconWc};
67
67
  //# sourceMappingURL=icon-wc.js.map
@@ -1,2 +1,2 @@
1
- var X=Object.defineProperty;var U=(e,t)=>()=>(e&&(t=e(e=0)),t);var z=(e,t)=>{for(var i in t)X(e,i,{get:t[i],enumerable:!0})};var q={};z(q,{addDialogDismiss:()=>$,addFlickListener:()=>M,addLongPress:()=>P,addPullToRefresh:()=>H,addSwipeListener:()=>N,haptic:()=>L,initGestures:()=>I,makeSwipeable:()=>T});function N(e,t={}){let i=t.threshold??50,s=t.restraint??100,r=t.timeout??300,n=t.velocity??.5,l=t.minFlickDistance??10,a,o,p;function u(c){c.isPrimary&&(a=c.clientX,o=c.clientY,p=Date.now())}function h(c){if(!c.isPrimary)return;let m=c.clientX-a,v=c.clientY-o,d=Date.now()-p;if(d>r)return;let f=Math.abs(m),y=Math.abs(v),g=Math.max(f,y),b=d>0?g/d:0,w=b>=n&&g>=l,E;if((f>=i||w&&f>y)&&y<=s?E=m<0?"left":"right":(y>=i||w&&y>f)&&f<=s&&(E=v<0?"up":"down"),E){let V=E==="left"||E==="right"?f:y;e.dispatchEvent(new CustomEvent(`swipe-${E}`,{bubbles:!0,detail:{distance:V,duration:d,velocity:b,flick:w}}))}}return e.addEventListener("pointerdown",u,{passive:!0}),e.addEventListener("pointerup",h,{passive:!0}),()=>{e.removeEventListener("pointerdown",u),e.removeEventListener("pointerup",h)}}function M(e,t={}){let i=t.minDistance??10,s=t.velocity??.6,r=t.timeout??250,n=t.restraint??80,l,a,o;function p(h){h.isPrimary&&(l=h.clientX,a=h.clientY,o=Date.now())}function u(h){if(!h.isPrimary)return;let c=h.clientX-l,m=h.clientY-a,v=Date.now()-o;if(v===0||v>r)return;let d=Math.abs(c),f=Math.abs(m),y=Math.max(d,f);if(y<i)return;let g=y/v;if(g<s)return;let b;if(d>f&&f<=n?b=c<0?"left":"right":f>d&&d<=n&&(b=m<0?"up":"down"),b){let w=b==="left"||b==="right"?d:f;e.dispatchEvent(new CustomEvent(`swipe-${b}`,{bubbles:!0,detail:{distance:w,duration:v,velocity:g,flick:!0}}))}}return e.addEventListener("pointerdown",p,{passive:!0}),e.addEventListener("pointerup",u,{passive:!0}),()=>{e.removeEventListener("pointerdown",p),e.removeEventListener("pointerup",u)}}function T(e,t={}){let i=t.threshold??100,s=t.direction??"horizontal",r=t.removeOnDismiss??!0,n=s==="horizontal",l=0,a=0,o=!1;function p(d){!d.isPrimary||e.hasAttribute("data-dismissed")||(d.preventDefault(),o=!0,l=n?d.clientX:d.clientY,a=0,e.setPointerCapture(d.pointerId),e.setAttribute("data-swiping",""))}function u(d){if(!o||!d.isPrimary)return;a=(n?d.clientX:d.clientY)-l;let y=1-Math.min(Math.abs(a)/i,1)*.5;n?e.style.transform=`translateX(${a}px)`:e.style.transform=`translateY(${a}px)`,e.style.opacity=String(y)}function h(d){!o||!d.isPrimary||(o=!1,e.releasePointerCapture(d.pointerId),e.removeAttribute("data-swiping"),Math.abs(a)>=i?m(a>0?"right":"left"):v())}function c(d){!o||!d.isPrimary||(o=!1,e.releasePointerCapture(d.pointerId),e.removeAttribute("data-swiping"),v())}function m(d){let f=d==="right"?"100%":"-100%";e.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",e.style.transform=n?`translateX(${f})`:`translateY(${f})`,e.style.opacity="0",e.setAttribute("data-dismissed",""),L.dismiss(),e.dispatchEvent(new CustomEvent("swipe-dismiss",{bubbles:!0,detail:{direction:d,distance:Math.abs(a)}})),r&&e.addEventListener("transitionend",()=>e.remove(),{once:!0})}function v(){e.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",e.style.transform="",e.style.opacity="",e.addEventListener("transitionend",()=>{e.style.transition=""},{once:!0})}return e.addEventListener("pointerdown",p),e.addEventListener("pointermove",u),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",c),()=>{e.removeEventListener("pointerdown",p),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",c)}}function H(e,t,i={}){let s=i.threshold??70,r=i.maxPull??120,n=document.createElement("div");n.setAttribute("data-pull-indicator",""),n.setAttribute("aria-hidden","true");let l=document.createElement("div");l.setAttribute("data-pull-spinner",""),n.appendChild(l),e.prepend(n);let a=0,o=!1,p=!1;function u(f){!f.isPrimary||p||e.scrollTop<=0&&(a=f.clientY,o=!0)}function h(f){if(!o||!f.isPrimary||p)return;let y=f.clientY-a;if(y<=0){n.style.transform="",n.style.opacity="";return}let g=Math.min(y,r),b=g/s;n.style.transform=`translateY(${g}px)`,n.style.opacity=String(Math.min(b,1)),b>=1?n.setAttribute("data-pull-ready",""):n.removeAttribute("data-pull-ready")}function c(f){!o||!f.isPrimary||(o=!1,n.hasAttribute("data-pull-ready")&&!p?v():d())}function m(f){!o||!f.isPrimary||(o=!1,d())}async function v(){p=!0,n.removeAttribute("data-pull-ready"),n.setAttribute("data-pull-loading",""),n.style.transform=`translateY(${s}px)`,n.style.opacity="1";try{await t()}finally{p=!1,n.removeAttribute("data-pull-loading"),d()}}function d(){n.style.transition="transform 0.3s ease, opacity 0.3s ease",n.style.transform="",n.style.opacity="",n.removeAttribute("data-pull-ready"),n.addEventListener("transitionend",()=>{n.style.transition=""},{once:!0})}return e.addEventListener("pointerdown",u,{passive:!0}),e.addEventListener("pointermove",h,{passive:!0}),e.addEventListener("pointerup",c,{passive:!0}),e.addEventListener("pointercancel",m,{passive:!0}),()=>{e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",h),e.removeEventListener("pointerup",c),e.removeEventListener("pointercancel",m),n.remove()}}function P(e,t,i={}){let s=i.duration??500,r=i.hapticFeedback??!0,n=i.blockContextMenu??!0,l=null;function a(u){u.isPrimary&&(l=setTimeout(()=>{r&&L.tap(),t(u),l=null},s))}function o(){l&&(clearTimeout(l),l=null)}function p(u){n&&u.preventDefault()}return e.addEventListener("pointerdown",a,{passive:!0}),e.addEventListener("pointermove",o,{passive:!0}),e.addEventListener("pointerup",o,{passive:!0}),e.addEventListener("pointercancel",o,{passive:!0}),e.addEventListener("contextmenu",p),()=>{o(),e.removeEventListener("pointerdown",a),e.removeEventListener("pointermove",o),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",o),e.removeEventListener("contextmenu",p)}}function $(e,t={}){let i=t.threshold??80,s=0,r=0,n=!1;function l(c){if(!c.isPrimary||!e.open)return;let m=c.target;m.closest("a, button, input, select, textarea, [contenteditable]")&&!m.closest("header")||(n=!0,s=c.clientY,r=0,e.setPointerCapture(c.pointerId),e.style.transition="none")}function a(c){if(!n||!c.isPrimary)return;if(r=c.clientY-s,r<=0){e.style.transform="",e.style.opacity="";return}let v=1-Math.min(r/i,1)*.4;e.style.transform=`translateY(${r}px)`,e.style.opacity=String(v)}function o(c){!n||!c.isPrimary||(n=!1,e.releasePointerCapture(c.pointerId),r>=i?u():h())}function p(c){!n||!c.isPrimary||(n=!1,e.releasePointerCapture(c.pointerId),h())}function u(){e.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",e.style.transform="translateY(100%)",e.style.opacity="0",L.dismiss(),e.addEventListener("transitionend",()=>{e.style.transition="",e.style.transform="",e.style.opacity="",e.close("dismiss")},{once:!0})}function h(){e.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",e.style.transform="",e.style.opacity="",e.addEventListener("transitionend",()=>{e.style.transition=""},{once:!0})}return e.addEventListener("pointerdown",l),e.addEventListener("pointermove",a),e.addEventListener("pointerup",o),e.addEventListener("pointercancel",p),()=>{e.removeEventListener("pointerdown",l),e.removeEventListener("pointermove",a),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",p)}}function I(e=document){let t=[];for(let i of e.querySelectorAll('[data-gesture="swipe"]'))t.push(N(i));for(let i of e.querySelectorAll('[data-gesture="flick"]'))t.push(M(i));for(let i of e.querySelectorAll('[data-gesture="dismiss"]'))t.push(T(i));for(let i of e.querySelectorAll('[data-gesture="long-press"]'))t.push(P(i,()=>{i.dispatchEvent(new CustomEvent("long-press",{bubbles:!0}))}));for(let i of e.querySelectorAll('dialog[data-gesture="dismiss-down"]'))t.push($(i));return()=>t.forEach(i=>i())}var L,S,F=U(()=>{L={tap:()=>navigator.vibrate?.(8),confirm:()=>navigator.vibrate?.([8,40,8]),error:()=>navigator.vibrate?.([30,60,30]),dismiss:()=>navigator.vibrate?.(15)};S=typeof document<"u"?document.documentElement:null;(!S||!S.hasAttribute("data-vb-gestures-init"))&&(S?.setAttribute("data-vb-gestures-init",""),I())});var G=window.matchMedia("(prefers-reduced-motion: reduce)");var C=new Map;function k(e,t,i={}){let s=i.priority??10,r={impl:t,bundle:i.bundle,contract:i.contract,priority:s},n=C.get(e);if(customElements.get(e)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${e}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=s){n.priority===s&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${n.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}C.set(e,r),customElements.define(e,t)}var A=class extends HTMLElement{#t=[];#i;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,i,s,r){t.addEventListener(i,s,r),this.#t.push(()=>t.removeEventListener(i,s,r))}_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,i){this.#i||(this.#i=this.attachInternals());let s=this.#i.states;try{i?s.add(t):s.delete(t)}catch{let r=`--${t}`;i?s.add(r):s.delete(r)}}_adoptInternals(t){this.#i||(this.#i=t)}#e(){return this.constructor.formAssociated&&this.#i?this.#i: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 x(e){return document.startViewTransition?document.startViewTransition(e):e()}var R=0,Y=!1,O={Dialog:"Image viewer",Close:"Close gallery",Prev:"Previous image",Next:"Next image",ShowDetails:"Show image details",HideDetails:"Hide image details",Counter:"Image {n} of {total}"};function _(e){return e==null||e===""?[]:e instanceof HTMLTemplateElement?[e.content.cloneNode(!0)]:e instanceof Node?[e.cloneNode(!0)]:[document.createTextNode(String(e))]}function B(e){return e?[...e.childNodes].map(t=>t.cloneNode(!0)):[]}var D=class extends A{static get observedAttributes(){return["captions","controls"]}#t=[];#i=0;#e=null;#n=null;#l=null;#u=null;#d=null;#c=null;#r=null;#h=null;#o="";#p=!1;setup(){return this.#o||(this.#o=`gallery-lb-${++R}`),this.#p=!!document.startViewTransition,this.#v(),this.listen(this,"click",this.#w),!0}teardown(){this.#E();for(let t of this.#t)t.thumbEl.style.viewTransitionName="";this.#t=[]}attributeChangedCallback(t,i,s){i!==s&&this.#e&&this.#E()}get images(){return this.#t.map(t=>{let i=null;if(t.captionEl)if(t.captionEl.children.length){let s=document.createDocumentFragment();s.append(...B(t.captionEl)),i=s}else i=t.captionEl.textContent;return{href:t.href,thumbSrc:t.thumbSrc,alt:t.alt,caption:i}})}set images(t){let i=Array.isArray(t)?t:[];for(let r of[...this.children])(r.tagName==="FIGURE"||r.tagName==="A")&&r.remove();let s=i.filter(r=>r?.href&&r?.thumbSrc);s.forEach((r,n)=>{let l=_(r.caption),a=l.length?document.createElement("figure"):document.createElement("a"),o=a.tagName==="FIGURE"?document.createElement("a"):a;o.href=r.href;let p=document.createElement("img");if(p.src=r.thumbSrc,p.alt=r.alt||"",p.loading="lazy",!r.alt){Y||(Y=!0,console.warn("[image-gallery] .images entries should include alt text; falling back to a generic link name."));let u=typeof r.caption=="string"?r.caption.trim():"";o.setAttribute("aria-label",u||this.#g(n+1,s.length))}if(o.appendChild(p),a.tagName==="FIGURE"){a.appendChild(o);let u=document.createElement("figcaption");u.append(...l),a.appendChild(u)}this.appendChild(a)}),this._reinit(),this.dispatchEvent(new CustomEvent("image-gallery:images-changed",{detail:{images:this.images,source:"property"},bubbles:!0}))}open(t){if(this.#t.length||this.#v(),!(t>=0&&t<this.#t.length))return;this.#e||this.#A(),this.#y(t);let i=this.#t[t],s=this.getAttribute("transition")||"morph";if(this.#e?.open){this.#b(t);return}if(this.#p&&s==="morph"&&this.#n&&this.#e){let r=`gallery-morph-${this.#o}`;i.thumbEl.style.viewTransitionName=r;let n=this.#n,l=this.#e;x(()=>{i.thumbEl.style.viewTransitionName="";let a=n.querySelector("img");a&&(a.style.viewTransitionName=r),l.isConnected&&!l.open&&l.showModal()}).finished?.then(()=>{let a=n.querySelector("img");a&&(a.style.viewTransitionName="")})}else this.#e?.showModal();this.#b(t)}close(){if(!this.#e?.open)return;let t=this.#t[this.#i],i=this.getAttribute("transition")||"morph";if(t&&this.#p&&i==="morph"&&this.#n&&this.#e){let s=`gallery-morph-${this.#o}`,r=this.#n.querySelector("img");r&&(r.style.viewTransitionName=s);let n=this.#e;x(()=>{r&&(r.style.viewTransitionName=""),t.thumbEl.style.viewTransitionName=s,n.close()}).finished?.then(()=>{t.thumbEl.style.viewTransitionName=""})}else this.#e?.close()}next(){let t=this.hasAttribute("loop");this.#i<this.#t.length-1?this.#a(this.#i+1):t&&this.#a(0)}prev(){let t=this.hasAttribute("loop");this.#i>0?this.#a(this.#i-1):t&&this.#a(this.#t.length-1)}#s(t){return this.dataset[`label${t}`]||O[t]}#g(t,i){return this.#s("Counter").replace("{n}",String(t)).replace("{total}",String(i))}#m(){return getComputedStyle(this).direction==="rtl"}#v(){this.#t=[];for(let t of this.children){let i=t.tagName==="FIGURE",s=i?t.querySelector("a[href]"):t.matches("a[href]")?t:null;if(!s)continue;let r=s.querySelector("img");r&&this.#t.push({href:s.href,thumbSrc:r.src,alt:r.alt||"",captionEl:i?t.querySelector(":scope > figcaption"):null,thumbEl:r})}}#w=t=>{let s=t.target?.closest("a[href]");if(!s||!this.contains(s)||this.#e?.contains(s))return;let r=s.querySelector("img"),n=this.#t.findIndex(l=>l.thumbEl===r);n===-1&&(this.#v(),n=this.#t.findIndex(l=>l.thumbEl===r)),n!==-1&&(t.preventDefault(),this.open(n))};#f(t,i,s){let r=document.createElement("button");r.type="button",r.className=t,r.setAttribute("aria-label",i);let n=document.createElement("icon-wc");return n.setAttribute("name",s),n.setAttribute("size","sm"),r.append(n),r}#A(){let t=document.createElement("dialog");t.id=this.#o,t.className="gallery-lightbox",t.dataset.size="full",t.setAttribute("aria-label",this.#s("Dialog")),t.dataset.controls=this.getAttribute("controls")||"edge";let i=document.createElement("header"),s=document.createElement("span");s.className="gallery-counter",s.setAttribute("aria-live","polite"),s.setAttribute("aria-atomic","true"),this.#l=s;let r=this.#f("gallery-close",this.#s("Close"),"x");this.listen(r,"click",()=>this.close()),i.append(s,r);let n=document.createElement("section");n.className="gallery-stage";let l=this.#f("gallery-prev",this.#s("Prev"),"chevron-left");this.#u=l;let a=document.createElement("figure");a.className="gallery-frame",this.#n=a;let o=this.#f("gallery-next",this.#s("Next"),"chevron-right");if(this.#d=o,n.append(l,a,o),(this.getAttribute("captions")||"auto")==="auto"){let u=document.createElement("footer");u.className="gallery-caption",u.hidden=!0;let h=this.#f("gallery-info-btn",this.#s("ShowDetails"),"info");h.setAttribute("aria-expanded","false"),this.#c=h;let c=document.createElement("div");c.className="gallery-caption-text",c.id=`${this.#o}-caption`,c.hidden=!0,h.setAttribute("aria-controls",c.id),this.#r=c,u.append(h,c),t.append(i,n,u),this.listen(h,"click",()=>{let m=!c.hidden;c.hidden=m,h.setAttribute("aria-expanded",String(!m)),h.setAttribute("aria-label",this.#s(m?"ShowDetails":"HideDetails"))})}else t.append(i,n);this.append(t),this.#e=t,this.listen(l,"click",()=>this.prev()),this.listen(o,"click",()=>this.next()),this.listen(t,"keydown",this.#L),this.listen(t,"click",u=>{u.target===t&&this.close()}),this.listen(t,"close",()=>{let u=this.#t[this.#i];u&&(u.thumbEl.style.viewTransitionName="");let h=this.#n?.querySelector("img");h&&(h.style.viewTransitionName="")}),Promise.resolve().then(()=>(F(),q)).then(({addSwipeListener:u})=>{!this.isConnected||this.#e!==t||(this.#h=u(n,{threshold:40}),this.listen(n,"swipe-left",()=>this.#m()?this.prev():this.next()),this.listen(n,"swipe-right",()=>this.#m()?this.next():this.prev()))})}#E(){this.#h&&(this.#h(),this.#h=null),this.#e&&(this.#e.open&&this.#e.close(),this.#e.remove()),this.#e=null,this.#n=null,this.#l=null,this.#u=null,this.#d=null,this.#c=null,this.#r=null}#y(t){let i=this.#t[t];if(!i||!this.#n)return;this.#i=t;let s=document.createElement("img");s.src=i.href,s.alt=i.alt;let r=this.#n;r.replaceChildren(s);let n=this.getAttribute("captions")||"auto",l=B(i.captionEl),a=!!i.captionEl?.textContent?.trim()||l.some(o=>o.nodeType===1);if(n==="overlay"&&a){let o=document.createElement("figcaption");o.append(...l),r.append(o)}else if(n==="auto"){let o=this.#r?.parentElement;this.#r&&this.#c&&o&&(a?(this.#r.replaceChildren(...l),o.hidden=!1,this.#r.hidden=!0,this.#c.setAttribute("aria-expanded","false"),this.#c.setAttribute("aria-label",this.#s("ShowDetails"))):(this.#r.replaceChildren(),o.hidden=!0))}this.#x()}#a(t){let i=this.getAttribute("transition")||"morph";this.#p&&i!=="none"?x(()=>{this.#y(t)}):this.#y(t),this.#b(t)}#x(){let t=this.hasAttribute("loop"),i=this.#i===0,s=this.#i===this.#t.length-1;this.#u&&(this.#u.disabled=!t&&i),this.#d&&(this.#d.disabled=!t&&s),this.#l&&(this.#l.textContent=this.#g(this.#i+1,this.#t.length))}#L=t=>{if(t.target instanceof Element&&t.target.closest(".gallery-caption-text, figcaption"))return;let i=this.#m();switch(t.key){case"ArrowLeft":t.preventDefault(),i?this.next():this.prev();break;case"ArrowRight":t.preventDefault(),i?this.prev():this.next();break;case"Home":t.preventDefault(),this.#a(0);break;case"End":t.preventDefault(),this.#a(this.#t.length-1);break}};#b(t){let i=s=>{if(s>=0&&s<this.#t.length){let r=new Image;r.src=this.#t[s].href}};i(t-1),i(t+1)}};k("image-gallery",D);export{D as ImageGallery};
1
+ var j=Object.defineProperty;var z=(e,t)=>()=>(e&&(t=e(e=0)),t);var X=(e,t)=>{for(var n in t)j(e,n,{get:t[n],enumerable:!0})};var Y={};X(Y,{addDialogDismiss:()=>B,addFlickListener:()=>P,addLongPress:()=>I,addPullToRefresh:()=>N,addSwipeListener:()=>M,haptic:()=>S,initGestures:()=>q,makeSwipeable:()=>F});function M(e,t={}){let n=t.threshold??50,r=t.restraint??100,s=t.timeout??300,i=t.velocity??.5,a=t.minFlickDistance??10,c,o,f;function u(l){l.isPrimary&&(c=l.clientX,o=l.clientY,f=Date.now())}function h(l){if(!l.isPrimary)return;let m=l.clientX-c,v=l.clientY-o,d=Date.now()-f;if(d>s)return;let p=Math.abs(m),b=Math.abs(v),g=Math.max(p,b),y=d>0?g/d:0,w=y>=i&&g>=a,E;if((p>=n||w&&p>b)&&b<=r?E=m<0?"left":"right":(b>=n||w&&b>p)&&p<=r&&(E=v<0?"up":"down"),E){let V=E==="left"||E==="right"?p:b;e.dispatchEvent(new CustomEvent(`swipe-${E}`,{bubbles:!0,detail:{distance:V,duration:d,velocity:y,flick:w}}))}}return e.addEventListener("pointerdown",u,{passive:!0}),e.addEventListener("pointerup",h,{passive:!0}),()=>{e.removeEventListener("pointerdown",u),e.removeEventListener("pointerup",h)}}function P(e,t={}){let n=t.minDistance??10,r=t.velocity??.6,s=t.timeout??250,i=t.restraint??80,a,c,o;function f(h){h.isPrimary&&(a=h.clientX,c=h.clientY,o=Date.now())}function u(h){if(!h.isPrimary)return;let l=h.clientX-a,m=h.clientY-c,v=Date.now()-o;if(v===0||v>s)return;let d=Math.abs(l),p=Math.abs(m),b=Math.max(d,p);if(b<n)return;let g=b/v;if(g<r)return;let y;if(d>p&&p<=i?y=l<0?"left":"right":p>d&&d<=i&&(y=m<0?"up":"down"),y){let w=y==="left"||y==="right"?d:p;e.dispatchEvent(new CustomEvent(`swipe-${y}`,{bubbles:!0,detail:{distance:w,duration:v,velocity:g,flick:!0}}))}}return e.addEventListener("pointerdown",f,{passive:!0}),e.addEventListener("pointerup",u,{passive:!0}),()=>{e.removeEventListener("pointerdown",f),e.removeEventListener("pointerup",u)}}function F(e,t={}){let n=t.threshold??100,r=t.direction??"horizontal",s=t.removeOnDismiss??!0,i=r==="horizontal",a=0,c=0,o=!1;function f(d){!d.isPrimary||e.hasAttribute("data-dismissed")||(d.preventDefault(),o=!0,a=i?d.clientX:d.clientY,c=0,e.setPointerCapture(d.pointerId),e.setAttribute("data-swiping",""))}function u(d){if(!o||!d.isPrimary)return;c=(i?d.clientX:d.clientY)-a;let b=1-Math.min(Math.abs(c)/n,1)*.5;i?e.style.transform=`translateX(${c}px)`:e.style.transform=`translateY(${c}px)`,e.style.opacity=String(b)}function h(d){!o||!d.isPrimary||(o=!1,e.releasePointerCapture(d.pointerId),e.removeAttribute("data-swiping"),Math.abs(c)>=n?m(c>0?"right":"left"):v())}function l(d){!o||!d.isPrimary||(o=!1,e.releasePointerCapture(d.pointerId),e.removeAttribute("data-swiping"),v())}function m(d){let p=d==="right"?"100%":"-100%";e.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",e.style.transform=i?`translateX(${p})`:`translateY(${p})`,e.style.opacity="0",e.setAttribute("data-dismissed",""),S.dismiss(),e.dispatchEvent(new CustomEvent("swipe-dismiss",{bubbles:!0,detail:{direction:d,distance:Math.abs(c)}})),s&&e.addEventListener("transitionend",()=>e.remove(),{once:!0})}function v(){e.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",e.style.transform="",e.style.opacity="",e.addEventListener("transitionend",()=>{e.style.transition=""},{once:!0})}return e.addEventListener("pointerdown",f),e.addEventListener("pointermove",u),e.addEventListener("pointerup",h),e.addEventListener("pointercancel",l),()=>{e.removeEventListener("pointerdown",f),e.removeEventListener("pointermove",u),e.removeEventListener("pointerup",h),e.removeEventListener("pointercancel",l)}}function N(e,t,n={}){let r=n.threshold??70,s=n.maxPull??120,i=document.createElement("div");i.setAttribute("data-pull-indicator",""),i.setAttribute("aria-hidden","true");let a=document.createElement("div");a.setAttribute("data-pull-spinner",""),i.appendChild(a),e.prepend(i);let c=0,o=!1,f=!1;function u(p){!p.isPrimary||f||e.scrollTop<=0&&(c=p.clientY,o=!0)}function h(p){if(!o||!p.isPrimary||f)return;let b=p.clientY-c;if(b<=0){i.style.transform="",i.style.opacity="";return}let g=Math.min(b,s),y=g/r;i.style.transform=`translateY(${g}px)`,i.style.opacity=String(Math.min(y,1)),y>=1?i.setAttribute("data-pull-ready",""):i.removeAttribute("data-pull-ready")}function l(p){!o||!p.isPrimary||(o=!1,i.hasAttribute("data-pull-ready")&&!f?v():d())}function m(p){!o||!p.isPrimary||(o=!1,d())}async function v(){f=!0,i.removeAttribute("data-pull-ready"),i.setAttribute("data-pull-loading",""),i.style.transform=`translateY(${r}px)`,i.style.opacity="1";try{await t()}finally{f=!1,i.removeAttribute("data-pull-loading"),d()}}function d(){i.style.transition="transform 0.3s ease, opacity 0.3s ease",i.style.transform="",i.style.opacity="",i.removeAttribute("data-pull-ready"),i.addEventListener("transitionend",()=>{i.style.transition=""},{once:!0})}return e.addEventListener("pointerdown",u,{passive:!0}),e.addEventListener("pointermove",h,{passive:!0}),e.addEventListener("pointerup",l,{passive:!0}),e.addEventListener("pointercancel",m,{passive:!0}),()=>{e.removeEventListener("pointerdown",u),e.removeEventListener("pointermove",h),e.removeEventListener("pointerup",l),e.removeEventListener("pointercancel",m),i.remove()}}function I(e,t,n={}){let r=n.duration??500,s=n.hapticFeedback??!0,i=n.blockContextMenu??!0,a=null;function c(u){u.isPrimary&&(a=setTimeout(()=>{s&&S.tap(),t(u),a=null},r))}function o(){a&&(clearTimeout(a),a=null)}function f(u){i&&u.preventDefault()}return e.addEventListener("pointerdown",c,{passive:!0}),e.addEventListener("pointermove",o,{passive:!0}),e.addEventListener("pointerup",o,{passive:!0}),e.addEventListener("pointercancel",o,{passive:!0}),e.addEventListener("contextmenu",f),()=>{o(),e.removeEventListener("pointerdown",c),e.removeEventListener("pointermove",o),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",o),e.removeEventListener("contextmenu",f)}}function B(e,t={}){let n=t.threshold??80,r=0,s=0,i=!1;function a(l){if(!l.isPrimary||!e.open)return;let m=l.target;m.closest("a, button, input, select, textarea, [contenteditable]")&&!m.closest("header")||(i=!0,r=l.clientY,s=0,e.setPointerCapture(l.pointerId),e.style.transition="none")}function c(l){if(!i||!l.isPrimary)return;if(s=l.clientY-r,s<=0){e.style.transform="",e.style.opacity="";return}let v=1-Math.min(s/n,1)*.4;e.style.transform=`translateY(${s}px)`,e.style.opacity=String(v)}function o(l){!i||!l.isPrimary||(i=!1,e.releasePointerCapture(l.pointerId),s>=n?u():h())}function f(l){!i||!l.isPrimary||(i=!1,e.releasePointerCapture(l.pointerId),h())}function u(){e.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",e.style.transform="translateY(100%)",e.style.opacity="0",S.dismiss(),e.addEventListener("transitionend",()=>{e.style.transition="",e.style.transform="",e.style.opacity="",e.close("dismiss")},{once:!0})}function h(){e.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",e.style.transform="",e.style.opacity="",e.addEventListener("transitionend",()=>{e.style.transition=""},{once:!0})}return e.addEventListener("pointerdown",a),e.addEventListener("pointermove",c),e.addEventListener("pointerup",o),e.addEventListener("pointercancel",f),()=>{e.removeEventListener("pointerdown",a),e.removeEventListener("pointermove",c),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",f)}}function q(e=document){let t=[];for(let n of e.querySelectorAll('[data-gesture="swipe"]'))t.push(M(n));for(let n of e.querySelectorAll('[data-gesture="flick"]'))t.push(P(n));for(let n of e.querySelectorAll('[data-gesture="dismiss"]'))t.push(F(n));for(let n of e.querySelectorAll('[data-gesture="long-press"]'))t.push(I(n,()=>{n.dispatchEvent(new CustomEvent("long-press",{bubbles:!0}))}));for(let n of e.querySelectorAll('dialog[data-gesture="dismiss-down"]'))t.push(B(n));return()=>t.forEach(n=>n())}var S,L,_=z(()=>{S={tap:()=>navigator.vibrate?.(8),confirm:()=>navigator.vibrate?.([8,40,8]),error:()=>navigator.vibrate?.([30,60,30]),dismiss:()=>navigator.vibrate?.(15)};L=typeof document<"u"?document.documentElement:null;(!L||!L.hasAttribute("data-vb-gestures-init"))&&(L?.setAttribute("data-vb-gestures-init",""),q())});var et=window.matchMedia("(prefers-reduced-motion: reduce)");var T=new Map;function $(e,t,n={}){let r=n.priority??10,s={impl:t,bundle:n.bundle,contract:n.contract,priority:r},i=T.get(e);if(customElements.get(e)){if(!i||i.priority>=r){i&&i.priority===r&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${e}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=r){i.priority===r&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${i.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}T.set(e,s),customElements.define(e,t)}var A=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,n,r,s){t.addEventListener(n,r,s),this.#t.push(()=>t.removeEventListener(n,r,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,n){this.#n||(this.#n=this.attachInternals());let r=this.#n.states;try{n?r.add(t):r.delete(t)}catch{let s=`--${t}`;n?r.add(s):r.delete(s)}}_adoptInternals(t){this.#n||(this.#n=t)}#e(){return this.constructor.formAssociated&&this.#n?this.#n: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 x(e){return document.startViewTransition?document.startViewTransition(e):e()}var O=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),k=new WeakMap;function U(e,t){let n=k.get(t);n||k.set(t,n=new Map);let r=n.get(e);if(!r||!r.region.isConnected){let i=(t.ownerDocument||document).createElement("span");i.setAttribute("data-vb-announcer",e),i.setAttribute("role",e==="assertive"?"alert":"status"),i.setAttribute("aria-live",e),i.setAttribute("aria-atomic","true"),i.style.cssText=O,t.appendChild(i),r={region:i},n.set(e,r)}return r}function D(e,{politeness:t="polite",root:n}={}){let r=String(e??"").trim();if(!r||typeof document>"u")return null;let s=n||document.body;if(!s)return null;let a=U(t==="assertive"?"assertive":"polite",s);return clearTimeout(a.write),clearTimeout(a.clear),a.region.textContent="",a.write=setTimeout(()=>{a.region.textContent=r,a.clear=setTimeout(()=>{a.region.textContent=""},7e3)},50),a.region}var G=0,H=!1,W={Dialog:"Image viewer",Close:"Close gallery",Prev:"Previous image",Next:"Next image",ShowDetails:"Show image details",HideDetails:"Hide image details",Counter:"Image {n} of {total}",Announce:"{alt}, {n} of {total}"};function K(e){return e==null||e===""?[]:e instanceof HTMLTemplateElement?[e.content.cloneNode(!0)]:e instanceof Node?[e.cloneNode(!0)]:[document.createTextNode(String(e))]}function R(e){return e?[...e.childNodes].map(t=>t.cloneNode(!0)):[]}var C=class extends A{static get observedAttributes(){return["captions","controls"]}#t=[];#n=0;#e=null;#i=null;#l=null;#u=null;#d=null;#c=null;#s=null;#h=null;#o="";#f=!1;setup(){return this.#o||(this.#o=`gallery-lb-${++G}`),this.#f=!!document.startViewTransition,this.#b(),this.listen(this,"click",this.#w),!0}teardown(){this.#E();for(let t of this.#t)t.thumbEl.style.viewTransitionName="";this.#t=[]}attributeChangedCallback(t,n,r){n!==r&&this.#e&&this.#E()}get images(){return this.#t.map(t=>{let n=null;if(t.captionEl)if(t.captionEl.children.length){let r=document.createDocumentFragment();r.append(...R(t.captionEl)),n=r}else n=t.captionEl.textContent;return{href:t.href,thumbSrc:t.thumbSrc,alt:t.alt,caption:n}})}set images(t){let n=Array.isArray(t)?t:[];for(let s of[...this.children])(s.tagName==="FIGURE"||s.tagName==="A")&&s.remove();let r=n.filter(s=>s?.href&&s?.thumbSrc);r.forEach((s,i)=>{let a=K(s.caption),c=a.length?document.createElement("figure"):document.createElement("a"),o=c.tagName==="FIGURE"?document.createElement("a"):c;o.href=s.href;let f=document.createElement("img");if(f.src=s.thumbSrc,f.alt=s.alt||"",f.loading="lazy",!s.alt){H||(H=!0,console.warn("[image-gallery] .images entries should include alt text; falling back to a generic link name."));let u=typeof s.caption=="string"?s.caption.trim():"";o.setAttribute("aria-label",u||this.#m(i+1,r.length))}if(o.appendChild(f),c.tagName==="FIGURE"){c.appendChild(o);let u=document.createElement("figcaption");u.append(...a),c.appendChild(u)}this.appendChild(c)}),this._reinit(),this.dispatchEvent(new CustomEvent("image-gallery:images-changed",{detail:{images:this.images,source:"property"},bubbles:!0}))}open(t){if(this.#t.length||this.#b(),!(t>=0&&t<this.#t.length))return;this.#e||this.#A(),this.#y(t);let n=this.#t[t],r=this.getAttribute("transition")||"morph";if(this.#e?.open){this.#g(t);return}if(this.#f&&r==="morph"&&this.#i&&this.#e){let s=`gallery-morph-${this.#o}`;n.thumbEl.style.viewTransitionName=s;let i=this.#i,a=this.#e;x(()=>{n.thumbEl.style.viewTransitionName="";let c=i.querySelector("img");c&&(c.style.viewTransitionName=s),a.isConnected&&!a.open&&a.showModal()}).finished?.then(()=>{let c=i.querySelector("img");c&&(c.style.viewTransitionName="")})}else this.#e?.showModal();this.#g(t)}close(){if(!this.#e?.open)return;let t=this.#t[this.#n],n=this.getAttribute("transition")||"morph";if(t&&this.#f&&n==="morph"&&this.#i&&this.#e){let r=`gallery-morph-${this.#o}`,s=this.#i.querySelector("img");s&&(s.style.viewTransitionName=r);let i=this.#e;x(()=>{s&&(s.style.viewTransitionName=""),t.thumbEl.style.viewTransitionName=r,i.close()}).finished?.then(()=>{t.thumbEl.style.viewTransitionName=""})}else this.#e?.close()}next(){let t=this.hasAttribute("loop");this.#n<this.#t.length-1?this.#a(this.#n+1):t&&this.#a(0)}prev(){let t=this.hasAttribute("loop");this.#n>0?this.#a(this.#n-1):t&&this.#a(this.#t.length-1)}#r(t){return this.dataset[`label${t}`]||W[t]}#m(t,n){return this.#r("Counter").replace("{n}",String(t)).replace("{total}",String(n))}#v(){return getComputedStyle(this).direction==="rtl"}#b(){this.#t=[];for(let t of this.children){let n=t.tagName==="FIGURE",r=n?t.querySelector("a[href]"):t.matches("a[href]")?t:null;if(!r)continue;let s=r.querySelector("img");s&&this.#t.push({href:r.href,thumbSrc:s.src,alt:s.alt||"",captionEl:n?t.querySelector(":scope > figcaption"):null,thumbEl:s})}}#w=t=>{let r=t.target?.closest("a[href]");if(!r||!this.contains(r)||this.#e?.contains(r))return;let s=r.querySelector("img"),i=this.#t.findIndex(a=>a.thumbEl===s);i===-1&&(this.#b(),i=this.#t.findIndex(a=>a.thumbEl===s)),i!==-1&&(t.preventDefault(),this.open(i))};#p(t,n,r){let s=document.createElement("button");s.type="button",s.className=t,s.setAttribute("aria-label",n);let i=document.createElement("icon-wc");return i.setAttribute("name",r),i.setAttribute("size","sm"),s.append(i),s}#A(){let t=document.createElement("dialog");t.id=this.#o,t.className="gallery-lightbox",t.dataset.size="full",t.setAttribute("aria-label",this.#r("Dialog")),t.dataset.controls=this.getAttribute("controls")||"edge";let n=document.createElement("header"),r=document.createElement("span");r.className="gallery-counter",this.#l=r;let s=this.#p("gallery-close",this.#r("Close"),"x");this.listen(s,"click",()=>this.close()),n.append(r,s);let i=document.createElement("section");i.className="gallery-stage";let a=this.#p("gallery-prev",this.#r("Prev"),"chevron-left");this.#u=a;let c=document.createElement("figure");c.className="gallery-frame",this.#i=c;let o=this.#p("gallery-next",this.#r("Next"),"chevron-right");if(this.#d=o,i.append(a,c,o),(this.getAttribute("captions")||"auto")==="auto"){let u=document.createElement("footer");u.className="gallery-caption",u.hidden=!0;let h=this.#p("gallery-info-btn",this.#r("ShowDetails"),"info");h.setAttribute("aria-expanded","false"),this.#c=h;let l=document.createElement("div");l.className="gallery-caption-text",l.id=`${this.#o}-caption`,l.hidden=!0,h.setAttribute("aria-controls",l.id),this.#s=l,u.append(h,l),t.append(n,i,u),this.listen(h,"click",()=>{let m=!l.hidden;l.hidden=m,h.setAttribute("aria-expanded",String(!m)),h.setAttribute("aria-label",this.#r(m?"ShowDetails":"HideDetails"))})}else t.append(n,i);this.append(t),this.#e=t,this.listen(a,"click",()=>this.prev()),this.listen(o,"click",()=>this.next()),this.listen(t,"keydown",this.#L),this.listen(t,"click",u=>{u.target===t&&this.close()}),this.listen(t,"close",()=>{let u=this.#t[this.#n];u&&(u.thumbEl.style.viewTransitionName="");let h=this.#i?.querySelector("img");h&&(h.style.viewTransitionName="")}),Promise.resolve().then(()=>(_(),Y)).then(({addSwipeListener:u})=>{!this.isConnected||this.#e!==t||(this.#h=u(i,{threshold:40}),this.listen(i,"swipe-left",()=>this.#v()?this.prev():this.next()),this.listen(i,"swipe-right",()=>this.#v()?this.next():this.prev()))})}#E(){this.#h&&(this.#h(),this.#h=null),this.#e&&(this.#e.open&&this.#e.close(),this.#e.remove()),this.#e=null,this.#i=null,this.#l=null,this.#u=null,this.#d=null,this.#c=null,this.#s=null}#y(t){let n=this.#t[t];if(!n||!this.#i)return;this.#n=t;let r=document.createElement("img");r.src=n.href,r.alt=n.alt;let s=this.#i;s.replaceChildren(r);let i=this.getAttribute("captions")||"auto",a=R(n.captionEl),c=!!n.captionEl?.textContent?.trim()||a.some(o=>o.nodeType===1);if(i==="overlay"&&c){let o=document.createElement("figcaption");o.append(...a),s.append(o)}else if(i==="auto"){let o=this.#s?.parentElement;this.#s&&this.#c&&o&&(c?(this.#s.replaceChildren(...a),o.hidden=!1,this.#s.hidden=!0,this.#c.setAttribute("aria-expanded","false"),this.#c.setAttribute("aria-label",this.#r("ShowDetails"))):(this.#s.replaceChildren(),o.hidden=!0))}this.#S()}#a(t){let n=this.getAttribute("transition")||"morph";this.#f&&n!=="none"?x(()=>{this.#y(t)}):this.#y(t),this.#x(),this.#g(t)}#x(){let t=this.#t[this.#n];if(!t||!this.#e)return;let n=this.#n+1,r=this.#t.length,s=(t.alt||"").trim(),i=s?this.#r("Announce").replace("{alt}",()=>s).replace("{n}",String(n)).replace("{total}",String(r)):this.#m(n,r);D(i,{root:this.#e})}#S(){let t=this.hasAttribute("loop"),n=this.#n===0,r=this.#n===this.#t.length-1;this.#u&&(this.#u.disabled=!t&&n),this.#d&&(this.#d.disabled=!t&&r),this.#l&&(this.#l.textContent=this.#m(this.#n+1,this.#t.length))}#L=t=>{if(t.target instanceof Element&&t.target.closest(".gallery-caption-text, figcaption"))return;let n=this.#v();switch(t.key){case"ArrowLeft":t.preventDefault(),n?this.next():this.prev();break;case"ArrowRight":t.preventDefault(),n?this.prev():this.next();break;case"Home":t.preventDefault(),this.#a(0);break;case"End":t.preventDefault(),this.#a(this.#t.length-1);break}};#g(t){let n=r=>{if(r>=0&&r<this.#t.length){let s=new Image;s.src=this.#t[r].href}};n(t-1),n(t+1)}};$("image-gallery",C);export{C as ImageGallery};
2
2
  //# sourceMappingURL=image-gallery.js.map
@@ -1,2 +1,2 @@
1
- var L=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;function m(s,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},n=E.get(s);if(customElements.get(s)){if(!n||n.priority>=i){n&&n.priority===i&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=i){n.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}E.set(s,r),customElements.define(s,t)}var d=class extends HTMLElement{#e=[];#r;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,e,i,r){t.addEventListener(e,i,r),this.#e.push(()=>t.removeEventListener(e,i,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,e){this.#r||(this.#r=this.attachInternals());let i=this.#r.states;try{e?i.add(t):i.delete(t)}catch{let r=`--${t}`;e?i.add(r):i.delete(r)}}_adoptInternals(t){this.#r||(this.#r=t)}#t(){return this.constructor.formAssociated&&this.#r?this.#r:null}get validity(){return this.#t()?.validity}get validationMessage(){return this.#t()?.validationMessage??""}get willValidate(){return this.#t()?.willValidate??!1}get form(){return this.#t()?.form??null}checkValidity(){return this.#t()?.checkValidity()??!0}reportValidity(){return this.#t()?.reportValidity()??!0}};var f="http://www.w3.org/2000/svg";function S(s){return s.trim().split(/[\s,]+/).map(Number)}function C(s,t){let e=S(t);switch(s){case"rect":{let[i,r,n,o]=e;return{type:"rect",x:i,y:r,width:n-i,height:o-r}}case"circle":{let[i,r,n]=e;return{type:"circle",cx:i,cy:r,r:n}}case"poly":{let i=[];for(let r=0;r<e.length;r+=2)i.push([e[r],e[r+1]]);return{type:"poly",points:i}}default:return null}}function T(s){if(!s)return null;switch(s.type){case"rect":{let t=document.createElementNS(f,"rect");return t.setAttribute("x",String(s.x)),t.setAttribute("y",String(s.y)),t.setAttribute("width",String(s.width)),t.setAttribute("height",String(s.height)),t}case"circle":{let t=document.createElementNS(f,"circle");return t.setAttribute("cx",String(s.cx)),t.setAttribute("cy",String(s.cy)),t.setAttribute("r",String(s.r)),t}case"poly":{let t=document.createElementNS(f,"polygon");return t.setAttribute("points",s.points.map(e=>e.join(",")).join(" ")),t}default:return null}}function N(s){if(!s)return{x:0,y:0,width:0,height:0};switch(s.type){case"rect":return{x:s.x,y:s.y,width:s.width,height:s.height};case"circle":return{x:s.cx-s.r,y:s.cy-s.r,width:s.r*2,height:s.r*2};case"poly":{let t=100,e=100,i=0,r=0;for(let[n,o]of s.points)n<t&&(t=n),o<e&&(e=o),n>i&&(i=n),o>r&&(r=o);return{x:t,y:e,width:i-t,height:r-e}}default:return{x:0,y:0,width:0,height:0}}}var k=0,$=300,M='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function D(s){return s==null||s===""?[]:s instanceof HTMLTemplateElement?[s.content.cloneNode(!0)]:s instanceof Node?[s.cloneNode(!0)]:[document.createTextNode(String(s))]}var g=class extends HTMLElement{get shape(){return this.getAttribute("shape")||"rect"}get coords(){return this.getAttribute("coords")||""}get label(){return this.getAttribute("label")||""}get href(){return this.getAttribute("href")}get target(){return this.getAttribute("target")||""}get tooltipMode(){return this.getAttribute("tooltip")||"hover"}get disabled(){return this.hasAttribute("disabled")}connectedCallback(){this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded")}},A=class extends d{#e=null;#r=null;#t=null;#l=[];#d=[];#i=null;#c=null;#o=null;#s=0;#h=0;#f=[];setup(){if(this.#e=this.querySelector(":scope > img"),!this.#e){let t=this.getAttribute("src"),e=this.getAttribute("alt");if(t)this.#e=document.createElement("img"),this.#e.src=t,this.#e.alt=e||"",this.prepend(this.#e);else return!1}return this.#e.classList.add("image-map-img"),this.#e.complete?this.#b():this.listen(this.#e,"load",()=>this.#b(),{once:!0}),!0}teardown(){this.#c?.disconnect(),this.#c=null,this.#n(),clearTimeout(this.#s),cancelAnimationFrame(this.#h),this.#r?.remove(),this.#t?.remove();for(let t of this.#d)t.anchor?.remove();for(let t of this.#f)t.removeAttribute("id");this.#r=null,this.#t=null,this.#d=[],this.#l=[],this.#f=[],this.#o=null}get regions(){return[...this.querySelectorAll(":scope > map-area")].map(t=>{let e;if(t.children.length){let i=document.createDocumentFragment();i.append(...[...t.childNodes].map(r=>r.cloneNode(!0))),e=i}else e=t.textContent?.trim()||void 0;return{shape:t.getAttribute("shape")||void 0,coords:t.getAttribute("coords")||void 0,label:t.getAttribute("label")||t.textContent?.trim().replace(/\s+/g," ")||void 0,href:t.getAttribute("href")||void 0,target:t.getAttribute("target")||void 0,tooltip:t.getAttribute("tooltip")||void 0,disabled:t.hasAttribute("disabled")||void 0,content:e}})}set regions(t){let e=Array.isArray(t)?t:[];for(let i of[...this.querySelectorAll(":scope > map-area")])i.remove();for(let i of e){if(!i)continue;let r=document.createElement("map-area");i.shape&&r.setAttribute("shape",i.shape),i.coords&&r.setAttribute("coords",i.coords),i.label&&r.setAttribute("label",i.label),i.href&&r.setAttribute("href",i.href),i.target&&r.setAttribute("target",i.target),i.tooltip&&r.setAttribute("tooltip",i.tooltip),i.disabled&&r.setAttribute("disabled",""),r.append(...D(i.content)),this.appendChild(r)}this._reinit(),this.dispatchEvent(new CustomEvent("image-map:regions-changed",{detail:{regions:this.regions,source:"property"},bubbles:!0}))}#b(){if(!this.isConnected||this.#r)return;let t=[...this.querySelectorAll(":scope > map-area")];if(t.length===0)return;let e=document.createElementNS(f,"svg");e.setAttribute("viewBox","0 0 100 100"),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("aria-hidden","true"),e.classList.add("image-map-overlay"),this.#r=e;let i=document.createElement("div");i.className="image-map-tooltip",i.id=`imap-tip-${++k}`,i.hidden=!0,this.#t=i;for(let r of t){let n=r,o=C(n.shape,n.coords),c=T(o);if(!c)continue;let l=N(o),h=r.getAttribute("href"),u=r.getAttribute("target")||"",p=r.getAttribute("tooltip")||"hover",y=r.hasAttribute("disabled"),b=r.textContent?.trim().replace(/\s+/g," ")||"",v=r.getAttribute("label")||b,a=h?document.createElement("a"):document.createElement("button");h?(a.href=h,u&&(a.target=u)):a.type="button",a.className="image-map-anchor",a.textContent=v;let w=p!=="none"&&(r.children.length>0||b&&b!==v);w&&(r.id||(r.id=`imap-area-${++k}`,this.#f.push(r)),p==="click"?(a.setAttribute("aria-expanded","false"),a.setAttribute("aria-controls",i.id)):a.setAttribute("aria-describedby",r.id)),a.style.left=`${l.x}%`,a.style.top=`${l.y}%`,a.style.width=`${l.width}%`,a.style.height=`${l.height}%`,y&&(c.setAttribute("data-disabled",""),a.setAttribute("tabindex","-1"),a.setAttribute("aria-disabled","true"));let x={area:r,parsed:o,svgShape:c,anchor:a,href:h,target:u,mode:p,hasContent:w,keyboardOpen:!1};y||this.#v(x),e.appendChild(c),this.#d.push(x),this.#l.push(a)}this.appendChild(e);for(let r of this.#l)this.appendChild(r);this.appendChild(i),this.listen(i,"pointerenter",()=>clearTimeout(this.#s)),this.listen(i,"pointerleave",()=>{this.#i?.mode==="hover"&&!this.#p()&&this.#g()}),this.listen(i,"focusout",r=>{let n=r.relatedTarget;n&&(i.contains(n)||n===this.#i?.anchor)||this.#n()}),this.listen(this,"keydown",this.#w),this.listen(document,"keydown",this.#x),this.listen(document,"pointerdown",this.#E),this.listen(window,"scroll",this.#A,{passive:!0,capture:!0}),this.#c=new ResizeObserver(this.#A),this.#c.observe(this.#e),this.setAttribute("role","group"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label",this.#e.alt||this.dataset.labelMap||"Image map")}#v(t){let{svgShape:e,anchor:i,area:r,mode:n}=t;this.listen(e,"pointerenter",()=>{clearTimeout(this.#s),n==="hover"&&this.#u(t),e.setAttribute("data-hover",""),this.#a("image-map:area-enter",r)}),this.listen(e,"pointerleave",()=>{n==="hover"&&this.#i===t&&!this.#p()&&this.#g(),document.activeElement!==i&&e.removeAttribute("data-hover"),this.#a("image-map:area-leave",r)}),this.listen(e,"click",()=>{let o=this.#m(t,!1);t.href&&n!=="click"&&!o.defaultPrevented&&(t.target==="_blank"?window.open(t.href,"_blank","noopener"):window.location.href=t.href)}),this.listen(e,"touchstart",o=>{n==="hover"&&(this.#o!==t?(o.preventDefault(),this.#o=t,this.#u(t)):this.#o=null)},{passive:!1}),this.listen(i,"click",o=>{let c=o.detail===0,l=this.#m(t,c);(n==="click"||l.defaultPrevented)&&o.preventDefault()}),t.href&&this.listen(i,"keydown",o=>{o.key===" "&&(o.preventDefault(),i.click())}),this.listen(i,"focus",()=>{clearTimeout(this.#s),n==="hover"&&this.#u(t),e.setAttribute("data-hover",""),this.#a("image-map:area-enter",r)}),this.listen(i,"blur",o=>{e.removeAttribute("data-hover"),this.#a("image-map:area-leave",r);let c=o.relatedTarget;this.#i===t&&!(c&&this.#t?.contains(c))&&this.#n()})}#m(t,e){if(t.mode==="click"&&t.hasContent){if(this.#i===t)this.#n();else if(this.#u(t),e){t.keyboardOpen=!0;let i=this.#t?.querySelector(M);i&&i.focus()}}return this.#a("image-map:area-activate",t.area,!0)}#p(){let t=document.activeElement;return!!(t&&this.#t?.contains(t))}#g(){clearTimeout(this.#s),this.#s=setTimeout(()=>this.#n(),$)}#u(t){let e=this.#t;!e||t.mode==="none"||!t.hasContent||(clearTimeout(this.#s),this.#i&&this.#i!==t&&this.#n(),this.#i=t,e.replaceChildren(...[...t.area.childNodes].map(i=>i.cloneNode(!0))),t.mode==="click"?(e.removeAttribute("role"),e.setAttribute("role","group"),e.setAttribute("aria-label",t.anchor.textContent||""),t.anchor.setAttribute("aria-expanded","true")):(e.setAttribute("role","tooltip"),e.removeAttribute("aria-label")),t.anchor.nextSibling!==e&&t.anchor.after(e),e.hidden=!1,e.setAttribute("data-state-visible",""),this.#y(t.svgShape))}#n({restoreFocus:t=!1}={}){clearTimeout(this.#s);let e=this.#i,i=this.#t;if(!i||!e)return;let r=this.#p();this.#i=null,e.keyboardOpen=!1,e.mode==="click"&&e.anchor.hasAttribute("aria-expanded")&&e.anchor.setAttribute("aria-expanded","false"),i.removeAttribute("data-state-visible"),i.hidden=!0,i.replaceChildren(),(t||r)&&e.anchor.focus()}#A=()=>{!this.#i||this.#h||(this.#h=requestAnimationFrame(()=>{this.#h=0,this.#i&&this.#y(this.#i.svgShape)}))};#y(t){if(!this.#t||!t)return;let e=t.getBoundingClientRect(),i=this.#t.getBoundingClientRect(),r=8,n=8,o=window.innerWidth,c=window.innerHeight,l,h,u=e.top-i.height-r;u>=n?(l=u,h=e.left+(e.width-i.width)/2):e.bottom+r+i.height<=c-n?(l=e.bottom+r,h=e.left+(e.width-i.width)/2):e.right+r+i.width<=o-n?(l=e.top+(e.height-i.height)/2,h=e.right+r):(l=e.top+(e.height-i.height)/2,h=e.left-i.width-r),h=Math.max(n,Math.min(h,o-i.width-n)),l=Math.max(n,Math.min(l,c-i.height-n)),this.#t.style.top=`${l}px`,this.#t.style.left=`${h}px`}#w=t=>{if(this.#t?.contains(t.target))return;let e=this.#l.filter(r=>!r.hasAttribute("aria-disabled")),i=e.indexOf(document.activeElement);if(i!==-1)switch(t.key){case"ArrowDown":case"ArrowRight":{t.preventDefault(),e[i<e.length-1?i+1:0]?.focus();break}case"ArrowUp":case"ArrowLeft":{t.preventDefault(),e[i>0?i-1:e.length-1]?.focus();break}}};#x=t=>{t.key==="Escape"&&(this.#o=null,this.#i&&(t.preventDefault(),this.#n()))};#E=t=>{if(!this.#i)return;let e=t.target;this.#t?.contains(e)||this.contains(e)&&e!==this&&e!==this.#e||(this.#o=null,this.#n())};#a(t,e,i=!1){let r=new CustomEvent(t,{detail:{area:e},bubbles:!0,cancelable:i});return this.dispatchEvent(r),r}};m("map-area",g);m("image-map",A);export{A as ImageMapWc,g as MapAreaWc};
1
+ var H=window.matchMedia("(prefers-reduced-motion: reduce)");var x=new Map;function v(n,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=x.get(n);if(customElements.get(n)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}x.set(n,r),customElements.define(n,t)}var g=class extends HTMLElement{#e=[];#r;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,e,i,r){t.addEventListener(e,i,r),this.#e.push(()=>t.removeEventListener(e,i,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,e){this.#r||(this.#r=this.attachInternals());let i=this.#r.states;try{e?i.add(t):i.delete(t)}catch{let r=`--${t}`;e?i.add(r):i.delete(r)}}_adoptInternals(t){this.#r||(this.#r=t)}#t(){return this.constructor.formAssociated&&this.#r?this.#r:null}get validity(){return this.#t()?.validity}get validationMessage(){return this.#t()?.validationMessage??""}get willValidate(){return this.#t()?.willValidate??!1}get form(){return this.#t()?.form??null}checkValidity(){return this.#t()?.checkValidity()??!0}reportValidity(){return this.#t()?.reportValidity()??!0}};function S(n,t,e){let i=n[t];if(!i)return-1;let r=i.x+i.width/2,s=i.y+i.height/2,o=e==="left"||e==="right",h=e==="left"||e==="up"?-1:1,a=-1,l=1/0;for(let u=0;u<n.length;u++){let d=n[u];if(u===t||!d)continue;let f=d.x+d.width/2-r,p=d.y+d.height/2-s,b=(o?f:p)*h;if(!(b>0))continue;let c=(o?p:f)*2,m=Math.hypot(b,c);m<l&&(l=m,a=u)}return a}var y="http://www.w3.org/2000/svg";function $(n){return n.trim().split(/[\s,]+/).map(Number)}function k(n,t){let e=$(t);switch(n){case"rect":{let[i,r,s,o]=e;return{type:"rect",x:i,y:r,width:s-i,height:o-r}}case"circle":{let[i,r,s]=e;return{type:"circle",cx:i,cy:r,r:s}}case"poly":{let i=[];for(let r=0;r<e.length;r+=2)i.push([e[r],e[r+1]]);return{type:"poly",points:i}}default:return null}}function T(n){if(!n)return null;switch(n.type){case"rect":{let t=document.createElementNS(y,"rect");return t.setAttribute("x",String(n.x)),t.setAttribute("y",String(n.y)),t.setAttribute("width",String(n.width)),t.setAttribute("height",String(n.height)),t}case"circle":{let t=document.createElementNS(y,"circle");return t.setAttribute("cx",String(n.cx)),t.setAttribute("cy",String(n.cy)),t.setAttribute("r",String(n.r)),t}case"poly":{let t=document.createElementNS(y,"polygon");return t.setAttribute("points",n.points.map(e=>e.join(",")).join(" ")),t}default:return null}}function M(n){if(!n)return{x:0,y:0,width:0,height:0};switch(n.type){case"rect":return{x:n.x,y:n.y,width:n.width,height:n.height};case"circle":return{x:n.cx-n.r,y:n.cy-n.r,width:n.r*2,height:n.r*2};case"poly":{let t=100,e=100,i=0,r=0;for(let[s,o]of n.points)s<t&&(t=s),o<e&&(e=o),s>i&&(i=s),o>r&&(r=o);return{x:t,y:e,width:i-t,height:r-e}}default:return{x:0,y:0,width:0,height:0}}}var C=0,L=300,_={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"up",ArrowDown:"down"},B='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function D(n){return n==null||n===""?[]:n instanceof HTMLTemplateElement?[n.content.cloneNode(!0)]:n instanceof Node?[n.cloneNode(!0)]:[document.createTextNode(String(n))]}var A=class extends HTMLElement{get shape(){return this.getAttribute("shape")||"rect"}get coords(){return this.getAttribute("coords")||""}get label(){return this.getAttribute("label")||""}get href(){return this.getAttribute("href")}get target(){return this.getAttribute("target")||""}get tooltipMode(){return this.getAttribute("tooltip")||"hover"}get disabled(){return this.hasAttribute("disabled")}connectedCallback(){this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded")}},w=class extends g{#e=null;#r=null;#t=null;#d=[];#o=[];#i=null;#l=null;#a=null;#n=0;#h=0;#f=[];setup(){if(this.#e=this.querySelector(":scope > img"),!this.#e){let t=this.getAttribute("src"),e=this.getAttribute("alt");if(t)this.#e=document.createElement("img"),this.#e.src=t,this.#e.alt=e||"",this.prepend(this.#e);else return!1}return this.#e.classList.add("image-map-img"),this.#e.complete?this.#b():this.listen(this.#e,"load",()=>this.#b(),{once:!0}),!0}teardown(){this.#l?.disconnect(),this.#l=null,this.#s(),clearTimeout(this.#n),cancelAnimationFrame(this.#h),this.#r?.remove(),this.#t?.remove();for(let t of this.#o)t.anchor?.remove();for(let t of this.#f)t.removeAttribute("id");this.#r=null,this.#t=null,this.#o=[],this.#d=[],this.#f=[],this.#a=null}get regions(){return[...this.querySelectorAll(":scope > map-area")].map(t=>{let e;if(t.children.length){let i=document.createDocumentFragment();i.append(...[...t.childNodes].map(r=>r.cloneNode(!0))),e=i}else e=t.textContent?.trim()||void 0;return{shape:t.getAttribute("shape")||void 0,coords:t.getAttribute("coords")||void 0,label:t.getAttribute("label")||t.textContent?.trim().replace(/\s+/g," ")||void 0,href:t.getAttribute("href")||void 0,target:t.getAttribute("target")||void 0,tooltip:t.getAttribute("tooltip")||void 0,disabled:t.hasAttribute("disabled")||void 0,content:e}})}set regions(t){let e=Array.isArray(t)?t:[];for(let i of[...this.querySelectorAll(":scope > map-area")])i.remove();for(let i of e){if(!i)continue;let r=document.createElement("map-area");i.shape&&r.setAttribute("shape",i.shape),i.coords&&r.setAttribute("coords",i.coords),i.label&&r.setAttribute("label",i.label),i.href&&r.setAttribute("href",i.href),i.target&&r.setAttribute("target",i.target),i.tooltip&&r.setAttribute("tooltip",i.tooltip),i.disabled&&r.setAttribute("disabled",""),r.append(...D(i.content)),this.appendChild(r)}this._reinit(),this.dispatchEvent(new CustomEvent("image-map:regions-changed",{detail:{regions:this.regions,source:"property"},bubbles:!0}))}#b(){if(!this.isConnected||this.#r)return;let t=[...this.querySelectorAll(":scope > map-area")];if(t.length===0)return;let e=document.createElementNS(y,"svg");e.setAttribute("viewBox","0 0 100 100"),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("aria-hidden","true"),e.classList.add("image-map-overlay"),this.#r=e;let i=document.createElement("div");i.className="image-map-tooltip",i.id=`imap-tip-${++C}`,i.hidden=!0,this.#t=i;for(let r of t){let s=r,o=k(s.shape,s.coords),h=T(o);if(!h)continue;let a=M(o),l=r.getAttribute("href"),u=r.getAttribute("target")||"",d=r.getAttribute("tooltip")||"hover",f=r.hasAttribute("disabled"),p=r.textContent?.trim().replace(/\s+/g," ")||"",b=r.getAttribute("label")||p,c=l?document.createElement("a"):document.createElement("button");l?(c.href=l,u&&(c.target=u)):c.type="button",c.className="image-map-anchor",c.textContent=b;let m=d!=="none"&&(r.children.length>0||p&&p!==b);m&&(r.id||(r.id=`imap-area-${++C}`,this.#f.push(r)),d==="click"?(c.setAttribute("aria-expanded","false"),c.setAttribute("aria-controls",i.id)):c.setAttribute("aria-describedby",r.id)),c.style.left=`${a.x}%`,c.style.top=`${a.y}%`,c.style.width=`${a.width}%`,c.style.height=`${a.height}%`,f&&(h.setAttribute("data-disabled",""),c.setAttribute("tabindex","-1"),c.setAttribute("aria-disabled","true"));let E={area:r,parsed:o,bbox:a,disabled:f,svgShape:h,anchor:c,href:l,target:u,mode:d,hasContent:m,keyboardOpen:!1};f||this.#A(E),e.appendChild(h),this.#o.push(E),this.#d.push(c)}this.appendChild(e);for(let r of this.#d)this.appendChild(r);this.appendChild(i),this.listen(i,"pointerenter",()=>clearTimeout(this.#n)),this.listen(i,"pointerleave",()=>{this.#i?.mode==="hover"&&!this.#p()&&this.#g()}),this.listen(i,"focusout",r=>{let s=r.relatedTarget;s&&(i.contains(s)||s===this.#i?.anchor)||this.#s()}),this.listen(this,"keydown",this.#w),this.listen(document,"keydown",this.#E),this.listen(document,"pointerdown",this.#x),this.listen(window,"scroll",this.#y,{passive:!0,capture:!0}),this.#l=new ResizeObserver(this.#y),this.#l.observe(this.#e),this.setAttribute("role","group"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label",this.#e.alt||this.dataset.labelMap||"Image map")}#A(t){let{svgShape:e,anchor:i,area:r,mode:s}=t;this.listen(e,"pointerenter",()=>{clearTimeout(this.#n),s==="hover"&&this.#u(t),e.setAttribute("data-hover",""),this.#c("image-map:area-enter",r)}),this.listen(e,"pointerleave",()=>{s==="hover"&&this.#i===t&&!this.#p()&&this.#g(),document.activeElement!==i&&e.removeAttribute("data-hover"),this.#c("image-map:area-leave",r)}),this.listen(e,"click",()=>{let o=this.#m(t,!1);t.href&&s!=="click"&&!o.defaultPrevented&&(t.target==="_blank"?window.open(t.href,"_blank","noopener"):window.location.href=t.href)}),this.listen(e,"touchstart",o=>{s==="hover"&&(this.#a!==t?(o.preventDefault(),this.#a=t,this.#u(t)):this.#a=null)},{passive:!1}),this.listen(i,"click",o=>{let h=o.detail===0,a=this.#m(t,h);(s==="click"||a.defaultPrevented)&&o.preventDefault()}),t.href&&this.listen(i,"keydown",o=>{o.key===" "&&(o.preventDefault(),i.click())}),this.listen(i,"focus",()=>{clearTimeout(this.#n),s==="hover"&&this.#u(t),e.setAttribute("data-hover",""),this.#c("image-map:area-enter",r)}),this.listen(i,"blur",o=>{e.removeAttribute("data-hover"),this.#c("image-map:area-leave",r);let h=o.relatedTarget;this.#i===t&&!(h&&this.#t?.contains(h))&&this.#s()})}#m(t,e){if(t.mode==="click"&&t.hasContent){if(this.#i===t)this.#s();else if(this.#u(t),e){t.keyboardOpen=!0;let i=this.#t?.querySelector(B);i&&i.focus()}}return this.#c("image-map:area-activate",t.area,!0)}#p(){let t=document.activeElement;return!!(t&&this.#t?.contains(t))}#g(){clearTimeout(this.#n),this.#n=setTimeout(()=>this.#s(),L)}#u(t){let e=this.#t;!e||t.mode==="none"||!t.hasContent||(clearTimeout(this.#n),this.#i&&this.#i!==t&&this.#s(),this.#i=t,e.replaceChildren(...[...t.area.childNodes].map(i=>i.cloneNode(!0))),t.mode==="click"?(e.removeAttribute("role"),e.setAttribute("role","group"),e.setAttribute("aria-label",t.anchor.textContent||""),t.anchor.setAttribute("aria-expanded","true")):(e.setAttribute("role","tooltip"),e.removeAttribute("aria-label")),t.anchor.nextSibling!==e&&t.anchor.after(e),e.hidden=!1,e.setAttribute("data-state-visible",""),this.#v(t.svgShape))}#s({restoreFocus:t=!1}={}){clearTimeout(this.#n);let e=this.#i,i=this.#t;if(!i||!e)return;let r=this.#p();this.#i=null,e.keyboardOpen=!1,e.mode==="click"&&e.anchor.hasAttribute("aria-expanded")&&e.anchor.setAttribute("aria-expanded","false"),i.removeAttribute("data-state-visible"),i.hidden=!0,i.replaceChildren(),(t||r)&&e.anchor.focus()}#y=()=>{!this.#i||this.#h||(this.#h=requestAnimationFrame(()=>{this.#h=0,this.#i&&this.#v(this.#i.svgShape)}))};#v(t){if(!this.#t||!t)return;let e=t.getBoundingClientRect(),i=this.#t.getBoundingClientRect(),r=8,s=8,o=window.innerWidth,h=window.innerHeight,a,l,u=e.top-i.height-r;u>=s?(a=u,l=e.left+(e.width-i.width)/2):e.bottom+r+i.height<=h-s?(a=e.bottom+r,l=e.left+(e.width-i.width)/2):e.right+r+i.width<=o-s?(a=e.top+(e.height-i.height)/2,l=e.right+r):(a=e.top+(e.height-i.height)/2,l=e.left-i.width-r),l=Math.max(s,Math.min(l,o-i.width-s)),a=Math.max(s,Math.min(a,h-i.height-s)),this.#t.style.top=`${a}px`,this.#t.style.left=`${l}px`}#w=t=>{if(this.#t?.contains(t.target))return;let e=_[t.key];if(!e)return;let i=this.#o.findIndex(o=>o.anchor===document.activeElement);if(i===-1)return;t.preventDefault();let r=this.#o.map(o=>o.disabled?null:o.bbox),s=S(r,i,e);s!==-1&&this.#o[s].anchor.focus()};#E=t=>{t.key==="Escape"&&(this.#a=null,this.#i&&(t.preventDefault(),this.#s()))};#x=t=>{if(!this.#i)return;let e=t.target;this.#t?.contains(e)||this.contains(e)&&e!==this&&e!==this.#e||(this.#a=null,this.#s())};#c(t,e,i=!1){let r=new CustomEvent(t,{detail:{area:e},bubbles:!0,cancelable:i});return this.dispatchEvent(r),r}};v("map-area",A);v("image-map",w);export{w as ImageMapWc,A as MapAreaWc};
2
2
  //# sourceMappingURL=image-map.js.map
@@ -1,2 +1,2 @@
1
- var et=window.matchMedia("(prefers-reduced-motion: reduce)");var y=new Map;function A(n,t,e={}){let r=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:r},o=y.get(n);if(customElements.get(n)){if(!o||o.priority>=r){o&&o.priority===r&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=r){o.priority===r&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}y.set(n,i),customElements.define(n,t)}var d=class extends HTMLElement{#t=[];#e;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,r,i){t.addEventListener(e,r,i),this.#t.push(()=>t.removeEventListener(e,r,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.#e||(this.#e=this.attachInternals());let r=this.#e.states;try{e?r.add(t):r.delete(t)}catch{let i=`--${t}`;e?r.add(i):r.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}#r(){return this.constructor.formAssociated&&this.#e?this.#e: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 x="http://www.w3.org/1999/xhtml",h="http://www.w3.org/2000/svg",C="http://www.w3.org/1998/Math/MathML",N=new Set([x,h,C]),m="user-content-",$=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"]),I=new Set(["animate","set","animatemotion","animatetransform"]),_=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),O=new Set(["src","poster","srcset"]),U=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),D=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),H=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),F={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},B=new Set(["social-embed","youtube-player","geo-map"]),q=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],z=new Set(["audio-player","video-player","image-map","brand-mark"]);function V(n){return String(n).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function v(n,t=!1){let e=V(n);return t?/(^|,)(javascript|vbscript|livescript):/.test(e)?!0:/(^|,)data:/.test(e)?e.split(/(?=data:)/).filter(i=>i.startsWith("data:")).some(i=>!/^data:(image|audio|video|font)\//.test(i)):!1:/^(javascript|vbscript|livescript|data):/.test(e)}function S(n){let t=String(n).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(t)}var W=n=>String(n.localName||n.tagName||"").toLowerCase(),j=n=>n.startsWith(m)?n:m+n;function P(n,t){if($.has(t))return!0;let e=n.namespaceURI;return!!(e&&!N.has(e)||t==="title"&&e!==h||E.has(t)&&e===h&&n.children?.length||I.has(t)&&(n.getAttribute("attributeName")||n.getAttribute("attributename")||"").toLowerCase().includes("href"))}function G(n,t){for(let e of[...n.attributes]){let r=e.name.toLowerCase();if(r.startsWith("on")||U.has(r)||!t.keepIds&&D.has(r)){n.removeAttribute(e.name);continue}if(r==="style"){(!t.keepStyle||S(e.value))&&n.removeAttribute(e.name);continue}if((r==="id"||r==="name")&&!t.keepIds){let i=j(e.value);r==="id"?t.ids.set(e.value,i):t.ids.set(`name:${e.value}`,i),n.setAttribute(e.name,i);continue}if(_.has(r)||r.endsWith(":href")){v(e.value,!1)&&n.removeAttribute(e.name);continue}O.has(r)&&v(e.value,!0)&&n.removeAttribute(e.name)}}function X(n,t){let e=(n.getAttribute("type")||"").toLowerCase();t==="button"&&e!=="button"&&n.setAttribute("type","button"),t==="input"&&/^(submit|reset|image)$/.test(e)&&n.setAttribute("type","button")}function Y(n,t){for(let e of n)for(let r of[...e.attributes]){let i=r.name.toLowerCase(),o=r.value;if((i==="href"||i.endsWith(":href"))&&o.startsWith("#")){let s=K(o.slice(1));t.has(s)&&e.setAttribute(r.name,`#${t.get(s)}`)}else if(i==="usemap"&&o.startsWith("#")){let s=t.get(`name:${o.slice(1)}`);s?e.setAttribute(r.name,`#${s}`):e.removeAttribute(r.name)}else if(H.has(i)){let s=o.split(/\s+/).filter(Boolean).map(a=>t.get(a)||(a.startsWith(m)?a:null)).filter(Boolean);s.length?e.setAttribute(r.name,s.join(" ")):e.removeAttribute(r.name)}else o.includes("url(#")&&e.setAttribute(r.name,o.replace(/url\(#([^)]+)\)/g,(s,a)=>t.has(a)?`url(#${t.get(a)})`:s))}}function K(n){try{return decodeURIComponent(n)}catch{return n}}function T(n){let t=n.childNodes;if(t)for(let e of[...t])e.nodeType===8?e.remove():(e.nodeType===1||e.nodeType===11)&&T(e)}function M(n,t){T(n);let e=[...n.querySelectorAll("*")];t.includeRoot&&e.unshift(n);let r=new Map,i=[],o={...t,ids:r};for(let s of e){if(!Q(s,n))continue;let a=W(s);if(t.svgOnly&&(E.has(a)||a==="style")){if(a==="style"&&S(s.textContent||"")){s.remove();continue}}else if(P(s,a)){s.remove();continue}if(!t.keepIds&&!t.svgOnly&&B.has(a)){J(s);continue}if(a==="template"){let l=s.content;l&&M(l,{...t,includeRoot:!1})}G(s,o),t.keepIds||X(s,a);let c=F[a];if(c)for(let l of c)s.removeAttribute(l);if(a==="include-file"&&!t.allowIncludeFile&&s.removeAttribute("src"),!t.keepIds&&!t.svgOnly&&a.includes("-")&&a!=="include-file"&&!z.has(a))for(let l of q)s.removeAttribute(l);i.push(s)}!t.keepIds&&r.size&&Y(i,r)}function J(n){let t=n.parentNode;if(t){for(let e of[...n.childNodes])t.insertBefore(e,n);n.remove()}}function Q(n,t){let e=n;for(;e;){if(e===t)return!0;e=e.parentNode??e.parent??null}return!1}function L(n,t={}){let e=document.createElement("template");return n&&typeof n=="string"&&(e.innerHTML=n,M(e.content,{allowIncludeFile:!!t.allowIncludeFile,keepIds:!!t.keepIds,keepStyle:!!t.keepStyle})),e.content}var k=10,Z=new Set(["replace","append","prepend"]),tt="Failed to load content",p=class extends d{#t;#e;#r=null;#s=!1;#c=null;#o="";#n=!1;#i=null;setup(){let t=this.getAttribute("src");return t?(this.#n=!0,this.#r===null&&(this.#r=this.innerHTML),this.#s&&this.#c===t||this.#l(t),!0):!1}teardown(){this.#n=!1,this.#t?.disconnect(),this.hasAttribute("data-loading")&&(this.#e?.abort(),this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"))}get src(){return this.getAttribute("src")||""}set src(t){let e=t==null?"":String(t);this.src!==e&&(e?this.setAttribute("src",e):this.removeAttribute("src"),this.dispatchEvent(new CustomEvent("include-file:src-changed",{detail:{src:e,source:"property"},bubbles:!0})))}static get observedAttributes(){return["src"]}attributeChangedCallback(t,e,r){if(!(t!=="src"||!r||e===r)){if(!this.#n){queueMicrotask(()=>{!this.#n&&this.isConnected&&this.getAttribute("src")&&this._reinit()});return}this.#l(r)}}#l(t){this.hasAttribute("lazy")&&!this.#f()?this.#h():this.#a(t)}#f(){let t=this.getBoundingClientRect();return t.top<window.innerHeight+200&&t.bottom>-200}#h(){this.#t?.disconnect(),this.#t=new IntersectionObserver(t=>{for(let e of t)if(e.isIntersecting){this.#t.disconnect();let r=this.getAttribute("src");r&&this.#a(r)}},{rootMargin:"200px"}),this.#t.observe(this)}#m(t){let e;try{e=new URL(t,document.baseURI)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Refused ${e.protocol} URL: only http(s) is allowed`);return this.#u(e.href),e.href}#u(t){if(!this.hasAttribute("allow-cross-origin")&&new URL(t).origin!==location.origin)throw new Error(`Refused cross-origin URL ${t} (add allow-cross-origin to permit)`)}#p(t){let e=0,r=this.parentElement?.closest("include-file");for(;r;){if(#o in r&&(e++,r.#o===t))throw new Error(`Refused include cycle: ${t} is already included by an ancestor`);r=r.parentElement?.closest("include-file")}if(e>=k)throw new Error(`Refused include: nesting deeper than ${k}`)}#d(){let t=this.getAttribute("mode")||"replace";return Z.has(t)?t:(console.warn(`<include-file>: unknown mode "${t}", using "replace"`),"replace")}async#a(t){this.#e?.abort();let e=new AbortController;this.#e=e,this.#g(),this.setAttribute("data-loading",""),this.setAttribute("aria-busy","true"),this.removeAttribute("data-loaded"),this.removeAttribute("data-error");try{let r=this.#m(t);this.#p(r),this.#o=r;let i=await fetch(r,{signal:e.signal});if(i.url&&this.#u(i.url),!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);let o=await i.text();if(e.signal.aborted)return;let s=this.hasAttribute("trusted");this.hasAttribute("allow-scripts")&&!s&&console.warn("<include-file>: allow-scripts is ignored without trusted");let a=s&&this.hasAttribute("allow-scripts"),c;if(s){let u=document.createElement("template");u.innerHTML=o,c=u.content}else c=L(o,{allowIncludeFile:!0,keepIds:!0,keepStyle:!0});let l=document.createElement("template");l.content.append(c.cloneNode(!0));let R=l.innerHTML,b=[...c.querySelectorAll("script")];a||b.forEach(u=>u.remove());let g=this.#d();g==="replace"?this.replaceChildren(c):g==="append"?this.append(c):this.prepend(c);for(let u of a?b:[]){let f=document.createElement("script");for(let w of u.attributes)f.setAttribute(w.name,w.value);f.textContent=u.textContent,u.replaceWith(f)}this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"),this.setAttribute("data-loaded",""),this.#s=!0,this.#c=t,this.dispatchEvent(new CustomEvent("include-file:loaded",{bubbles:!0,detail:{src:t,url:r,html:R}}))}catch(r){if(r.name==="AbortError"||e.signal.aborted)return;this.#b(t,r)}}#b(t,e){if(this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"),this.setAttribute("data-error",""),this.#d()==="replace"&&this.#r!==null&&!this.#s&&(this.innerHTML=this.#r),!this.textContent.trim()&&!this.children.length){let r=document.createElement("p");r.setAttribute("role","alert"),r.setAttribute("data-include-error",""),r.textContent=this.getAttribute("data-label-error")||tt,this.append(r),this.#i=r}this.dispatchEvent(new CustomEvent("include-file:error",{bubbles:!0,detail:{src:t,error:e.message}}))}#g(){this.#i?.parentNode===this&&this.#i.remove(),this.#i=null}reload(){let t=this.getAttribute("src");t&&this.#a(t)}};A("include-file",p);export{p as IncludeFile};
1
+ var it=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function y(n,t,e={}){let r=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:r},o=v.get(n);if(customElements.get(n)){if(!o||o.priority>=r){o&&o.priority===r&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=r){o.priority===r&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(n,i),customElements.define(n,t)}var d=class extends HTMLElement{#t=[];#e;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,r,i){t.addEventListener(e,r,i),this.#t.push(()=>t.removeEventListener(e,r,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.#e||(this.#e=this.attachInternals());let r=this.#e.states;try{e?r.add(t):r.delete(t)}catch{let i=`--${t}`;e?r.add(i):r.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}#r(){return this.constructor.formAssociated&&this.#e?this.#e: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 k="http://www.w3.org/1999/xhtml",h="http://www.w3.org/2000/svg",x="http://www.w3.org/1998/Math/MathML",R=new Set([k,h,x]),p="user-content-",_=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"]),I=new Set(["animate","set","animatemotion","animatetransform"]),H=new Set(["href","xlink:href","action","formaction","data","codebase","cite","background","longdesc","manifest","to","from","values","by"]),O=new Set(["src","poster","srcset"]),P=new Set(["srcdoc","form","formaction","formmethod","formtarget","formenctype","formnovalidate","action","method","ping"]),B=new Set(["popovertarget","popovertargetaction","commandfor","command","interestfor","autofocus"]),U=new Set(["for","headers","list","aria-labelledby","aria-describedby","aria-controls","aria-owns","aria-flowto","aria-details","aria-errormessage","aria-activedescendant"]),D={"include-file":["trusted","allow-scripts","allow-cross-origin"],"markdown-viewer":["src","sanitize","ping","allow-cross-origin"]},F=new Set(["social-embed","youtube-player","geo-map"]),j=["src","src-dark","data-src","url","endpoint","tile-url","data-versions"],q=new Set(["audio-player","video-player","image-map","brand-mark"]);function V(n){return String(n).replace(/[\u0000- \u007f-\u009f]/g,"").toLowerCase()}function A(n,t=!1){let e=V(n);return t?/(^|,)(javascript|vbscript|livescript):/.test(e)?!0:/(^|,)data:/.test(e)?e.split(/(?=data:)/).filter(i=>i.startsWith("data:")).some(i=>!/^data:(image|audio|video|font)\//.test(i)):!1:/^(javascript|vbscript|livescript|data):/.test(e)}function S(n){let t=String(n).replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\/g,"").replace(/\s+/g,"").toLowerCase();return/expression\(|javascript:|vbscript:|-moz-binding|behavior:|@import|position:fixed/.test(t)}var z=n=>String(n.localName||n.tagName||"").toLowerCase(),W=n=>n.startsWith(p)?n:p+n;function G(n,t){if(_.has(t))return!0;let e=n.namespaceURI;return!!(e&&!R.has(e)||t==="title"&&e!==h||E.has(t)&&e===h&&n.children?.length||I.has(t)&&(n.getAttribute("attributeName")||n.getAttribute("attributename")||"").toLowerCase().includes("href"))}function X(n,t){for(let e of[...n.attributes]){let r=e.name.toLowerCase();if(r.startsWith("on")||P.has(r)||!t.keepIds&&B.has(r)){n.removeAttribute(e.name);continue}if(r==="style"){(!t.keepStyle||S(e.value))&&n.removeAttribute(e.name);continue}if((r==="id"||r==="name")&&!t.keepIds){let i=W(e.value);r==="id"?t.ids.set(e.value,i):t.ids.set(`name:${e.value}`,i),n.setAttribute(e.name,i);continue}if(H.has(r)||r.endsWith(":href")){A(e.value,!1)&&n.removeAttribute(e.name);continue}O.has(r)&&A(e.value,!0)&&n.removeAttribute(e.name)}}function K(n,t){let e=(n.getAttribute("type")||"").toLowerCase();t==="button"&&e!=="button"&&n.setAttribute("type","button"),t==="input"&&/^(submit|reset|image)$/.test(e)&&n.setAttribute("type","button")}function N(n,t){for(let e of n)for(let r of[...e.attributes]){let i=r.name.toLowerCase(),o=r.value;if((i==="href"||i.endsWith(":href"))&&o.startsWith("#")){let s=Y(o.slice(1));t.has(s)&&e.setAttribute(r.name,`#${t.get(s)}`)}else if(i==="usemap"&&o.startsWith("#")){let s=t.get(`name:${o.slice(1)}`);s?e.setAttribute(r.name,`#${s}`):e.removeAttribute(r.name)}else if(U.has(i)){let s=o.split(/\s+/).filter(Boolean).map(a=>t.get(a)||(a.startsWith(p)?a:null)).filter(Boolean);s.length?e.setAttribute(r.name,s.join(" ")):e.removeAttribute(r.name)}else o.includes("url(#")&&e.setAttribute(r.name,o.replace(/url\(#([^)]+)\)/g,(s,a)=>t.has(a)?`url(#${t.get(a)})`:s))}}function Y(n){try{return decodeURIComponent(n)}catch{return n}}function T(n){let t=n.childNodes;if(t)for(let e of[...t])e.nodeType===8?e.remove():(e.nodeType===1||e.nodeType===11)&&T(e)}function $(n,t){T(n);let e=[...n.querySelectorAll("*")];t.includeRoot&&e.unshift(n);let r=new Map,i=[],o={...t,ids:r};for(let s of e){if(!Q(s,n))continue;let a=z(s);if(t.svgOnly&&(E.has(a)||a==="style")){if(a==="style"&&S(s.textContent||"")){s.remove();continue}}else if(G(s,a)){s.remove();continue}if(!t.keepIds&&!t.svgOnly&&F.has(a)){J(s);continue}if(a==="template"){let l=s.content;l&&$(l,{...t,includeRoot:!1})}X(s,o),t.keepIds||K(s,a);let c=D[a];if(c)for(let l of c)s.removeAttribute(l);if(a==="include-file"&&!t.allowIncludeFile&&s.removeAttribute("src"),!t.keepIds&&!t.svgOnly&&a.includes("-")&&a!=="include-file"&&!q.has(a))for(let l of j)s.removeAttribute(l);i.push(s)}!t.keepIds&&r.size&&N(i,r)}function J(n){let t=n.parentNode;if(t){for(let e of[...n.childNodes])t.insertBefore(e,n);n.remove()}}function Q(n,t){let e=n;for(;e;){if(e===t)return!0;e=e.parentNode??e.parent??null}return!1}function M(n,t={}){let e=document.createElement("template");return n&&typeof n=="string"&&(e.innerHTML=n,$(e.content,{allowIncludeFile:!!t.allowIncludeFile,keepIds:!!t.keepIds,keepStyle:!!t.keepStyle})),e.content}var L=10,Z=new Set(["replace","append","prepend"]),tt="Failed to load content",m=class extends d{#t;#e;#r=null;#s=!1;#c=null;#o="";#n=!1;#i=null;setup(){let t=this.getAttribute("src");return t?(this.#n=!0,this.#r===null&&(this.#r=this.innerHTML),this.#s&&this.#c===t||this.#l(t),!0):!1}teardown(){this.#n=!1,this.#t?.disconnect(),this.hasAttribute("data-loading")&&(this.#e?.abort(),this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"))}get src(){return this.getAttribute("src")||""}set src(t){let e=t==null?"":String(t);this.src!==e&&(e?this.setAttribute("src",e):this.removeAttribute("src"),this.dispatchEvent(new CustomEvent("include-file:src-changed",{detail:{src:e,source:"property"},bubbles:!0})))}static get observedAttributes(){return["src"]}attributeChangedCallback(t,e,r){if(!(t!=="src"||!r||e===r)){if(!this.#n){queueMicrotask(()=>{!this.#n&&this.isConnected&&this.getAttribute("src")&&this._reinit()});return}this.#l(r)}}#l(t){this.hasAttribute("lazy")&&!this.#f()?this.#h():this.#a(t)}#f(){let t=this.getBoundingClientRect();return t.top<window.innerHeight+200&&t.bottom>-200}#h(){this.#t?.disconnect(),this.#t=new IntersectionObserver(t=>{for(let e of t)if(e.isIntersecting){this.#t.disconnect();let r=this.getAttribute("src");r&&this.#a(r)}},{rootMargin:"200px"}),this.#t.observe(this)}#p(t){let e;try{e=new URL(t,document.baseURI)}catch{throw new Error(`Invalid URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Refused ${e.protocol} URL: only http(s) is allowed`);return this.#u(e.href),e.href}#u(t){if(!this.hasAttribute("allow-cross-origin")&&new URL(t).origin!==location.origin)throw new Error(`Refused cross-origin URL ${t} (add allow-cross-origin to permit)`)}#m(t){let e=0,r=this.parentElement?.closest("include-file");for(;r;){if(#o in r&&(e++,r.#o===t))throw new Error(`Refused include cycle: ${t} is already included by an ancestor`);r=r.parentElement?.closest("include-file")}if(e>=L)throw new Error(`Refused include: nesting deeper than ${L}`)}#d(){let t=this.getAttribute("mode")||"replace";return Z.has(t)?t:(console.warn(`<include-file>: unknown mode "${t}", using "replace"`),"replace")}async#a(t){this.#e?.abort();let e=new AbortController;this.#e=e,this.#g(),this.setAttribute("data-loading",""),this.setAttribute("aria-busy","true"),this.removeAttribute("data-loaded"),this.removeAttribute("data-error");try{let r=this.#p(t);this.#m(r),this.#o=r;let i=await fetch(r,{signal:e.signal});if(i.url&&this.#u(i.url),!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);let o=await i.text();if(e.signal.aborted)return;let s=this.hasAttribute("trusted");this.hasAttribute("allow-scripts")&&!s&&console.warn("<include-file>: allow-scripts is ignored without trusted");let a=s&&this.hasAttribute("allow-scripts"),c;if(s){let u=document.createElement("template");u.innerHTML=o,c=u.content}else c=M(o,{allowIncludeFile:!0,keepIds:!0,keepStyle:!0});let l=document.createElement("template");l.content.append(c.cloneNode(!0));let C=l.innerHTML,b=[...c.querySelectorAll("script")];a||b.forEach(u=>u.remove());let g=this.#d();g==="replace"?this.replaceChildren(c):g==="append"?this.append(c):this.prepend(c);for(let u of a?b:[]){let f=document.createElement("script");for(let w of u.attributes)f.setAttribute(w.name,w.value);f.textContent=u.textContent,u.replaceWith(f)}this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"),this.setAttribute("data-loaded",""),this.#s=!0,this.#c=t,this.dispatchEvent(new CustomEvent("include-file:loaded",{bubbles:!0,detail:{src:t,url:r,html:C}}))}catch(r){if(r.name==="AbortError"||e.signal.aborted)return;this.#b(t,r)}}#b(t,e){if(this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"),this.setAttribute("data-error",""),this.#d()==="replace"&&this.#r!==null&&!this.#s&&(this.innerHTML=this.#r),!this.textContent.trim()&&!this.children.length){let r=document.createElement("p");r.setAttribute("role","alert"),r.setAttribute("data-include-error",""),r.textContent=this.getAttribute("data-label-error")||tt,this.append(r),this.#i=r}this.dispatchEvent(new CustomEvent("include-file:error",{bubbles:!0,detail:{src:t,error:e.message}}))}#g(){this.#i?.parentNode===this&&this.#i.remove(),this.#i=null}reload(){let t=this.getAttribute("src");t&&this.#a(t)}};y("include-file",m);export{m as IncludeFile};
2
2
  //# sourceMappingURL=include-file.js.map