vanilla-breeze 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/custom-elements.json +13966 -11505
  2. package/dist/cdn/components/accordion-wc.js +1 -1
  3. package/dist/cdn/components/activity-feed.js +1 -1
  4. package/dist/cdn/components/ai-chat.js +9 -6
  5. package/dist/cdn/components/ai-summary.js +4 -2
  6. package/dist/cdn/components/analytics-panel.js +19 -21
  7. package/dist/cdn/components/audio-player.js +17 -7
  8. package/dist/cdn/components/audio-visualizer.js +3 -3
  9. package/dist/cdn/components/author-index.js +2 -2
  10. package/dist/cdn/components/brand-mark.js +1 -1
  11. package/dist/cdn/components/bread-crumb.js +1 -1
  12. package/dist/cdn/components/calendar-wc.js +2 -2
  13. package/dist/cdn/components/card-list.js +1 -1
  14. package/dist/cdn/components/carousel-wc.js +1 -1
  15. package/dist/cdn/components/change-set.js +1 -11
  16. package/dist/cdn/components/chart-wc.js +32 -32
  17. package/dist/cdn/components/chat-input.js +1 -1
  18. package/dist/cdn/components/chat-window.js +1 -1
  19. package/dist/cdn/components/color-picker.js +1 -1
  20. package/dist/cdn/components/combo-box.js +1 -1
  21. package/dist/cdn/components/command-palette.js +1 -1
  22. package/dist/cdn/components/comment-box.js +49 -49
  23. package/dist/cdn/components/comment-thread.js +32 -32
  24. package/dist/cdn/components/comment-wc.js +1 -1
  25. package/dist/cdn/components/compare-surface.js +1 -1
  26. package/dist/cdn/components/consent-banner.js +1 -1
  27. package/dist/cdn/components/content-lens.js +1 -1
  28. package/dist/cdn/components/content-swap.js +1 -1
  29. package/dist/cdn/components/context-menu.js +1 -1
  30. package/dist/cdn/components/data-table.js +1 -1
  31. package/dist/cdn/components/date-picker.js +1 -1
  32. package/dist/cdn/components/day-view.js +1 -1
  33. package/dist/cdn/components/diagram-wc.js +2 -2
  34. package/dist/cdn/components/drag-surface.js +1 -1
  35. package/dist/cdn/components/drop-down.js +1 -1
  36. package/dist/cdn/components/emoji-picker.js +1 -1
  37. package/dist/cdn/components/flow-diagram.js +1 -1
  38. package/dist/cdn/components/foot-notes.js +1 -1
  39. package/dist/cdn/components/form-field.js +1 -1
  40. package/dist/cdn/components/geo-map.js +4 -4
  41. package/dist/cdn/components/glossary-index.js +1 -1
  42. package/dist/cdn/components/glossary-wc.js +1 -1
  43. package/dist/cdn/components/heading-links.js +1 -1
  44. package/dist/cdn/components/highlight-wc.js +2 -2
  45. package/dist/cdn/components/image-gallery.js +1 -1
  46. package/dist/cdn/components/image-map.js +1 -1
  47. package/dist/cdn/components/include-file.js +1 -1
  48. package/dist/cdn/components/manifest.json +100 -100
  49. package/dist/cdn/components/markdown-editor.js +1 -1
  50. package/dist/cdn/components/markdown-viewer.js +11 -11
  51. package/dist/cdn/components/nav-bar.js +1 -1
  52. package/dist/cdn/components/note-wc.js +2 -2
  53. package/dist/cdn/components/notification-wc.js +4 -4
  54. package/dist/cdn/components/page-info.js +2 -2
  55. package/dist/cdn/components/page-stats.js +1 -1
  56. package/dist/cdn/components/page-toc.js +1 -1
  57. package/dist/cdn/components/page-tools.js +1 -1
  58. package/dist/cdn/components/page-tour.js +5 -5
  59. package/dist/cdn/components/pager-wc.js +1 -1
  60. package/dist/cdn/components/poll-wc.js +1 -1
  61. package/dist/cdn/components/pop-over.js +1 -1
  62. package/dist/cdn/components/popularity-index.js +4 -4
  63. package/dist/cdn/components/print-page.js +1 -1
  64. package/dist/cdn/components/progress-tracker.js +1 -1
  65. package/dist/cdn/components/qr-code.js +1 -1
  66. package/dist/cdn/components/reaction-bar.js +1 -1
  67. package/dist/cdn/components/reader-view.js +3 -3
  68. package/dist/cdn/components/reading-progress.js +1 -1
  69. package/dist/cdn/components/recently-visited.js +7 -7
  70. package/dist/cdn/components/score-card.js +2 -2
  71. package/dist/cdn/components/selection-menu.js +1 -1
  72. package/dist/cdn/components/settings-panel.js +4 -4
  73. package/dist/cdn/components/share-wc.js +2 -2
  74. package/dist/cdn/components/short-cuts.js +1 -1
  75. package/dist/cdn/components/site-index.js +6 -6
  76. package/dist/cdn/components/site-map.js +1 -1
  77. package/dist/cdn/components/site-search.js +3 -3
  78. package/dist/cdn/components/slide-accept.js +1 -1
  79. package/dist/cdn/components/social-embed.js +1 -1
  80. package/dist/cdn/components/split-surface.js +1 -1
  81. package/dist/cdn/components/star-rating.js +1 -1
  82. package/dist/cdn/components/status-wc.js +1 -1
  83. package/dist/cdn/components/stepper-wc.js +1 -1
  84. package/dist/cdn/components/tab-set.js +1 -1
  85. package/dist/cdn/components/text-reader.js +2 -2
  86. package/dist/cdn/components/theme-picker.js +44 -44
  87. package/dist/cdn/components/time-index.js +2 -2
  88. package/dist/cdn/components/time-picker.js +1 -1
  89. package/dist/cdn/components/toast-msg.js +1 -1
  90. package/dist/cdn/components/tool-tip.js +1 -1
  91. package/dist/cdn/components/topic-map.js +3 -3
  92. package/dist/cdn/components/trust-filter.js +3 -3
  93. package/dist/cdn/components/version-switcher.js +3 -13
  94. package/dist/cdn/components/video-player.js +1 -1
  95. package/dist/cdn/components/watch-wc.js +2 -2
  96. package/dist/cdn/components/week-view.js +1 -1
  97. package/dist/cdn/components/youtube-player.js +1 -1
  98. package/dist/cdn/packs/effects.full.js +1 -1
  99. package/dist/cdn/packs/kawaii.effects.css +1 -1
  100. package/dist/cdn/packs/kawaii.full.css +1 -1
  101. package/dist/cdn/packs/kawaii.full.js +4 -4
  102. package/dist/cdn/packs/manifest.json +7 -7
  103. package/dist/cdn/packs/memphis.full.css +1 -1
  104. package/dist/cdn/packs/memphis.theme.css +1 -1
  105. package/dist/cdn/packs/ui.full.js +46 -46
  106. package/dist/cdn/themes/8bit.css +1 -1
  107. package/dist/cdn/themes/8bit.tokens.json +1 -1
  108. package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
  109. package/dist/cdn/themes/alpha1999.tokens.json +1 -1
  110. package/dist/cdn/themes/art-deco-dark.tokens.json +33 -1
  111. package/dist/cdn/themes/art-deco.css +1 -1
  112. package/dist/cdn/themes/art-deco.tokens.json +23 -1
  113. package/dist/cdn/themes/bauhaus-dark.tokens.json +23 -1
  114. package/dist/cdn/themes/bauhaus.css +1 -1
  115. package/dist/cdn/themes/bauhaus.tokens.json +1 -1
  116. package/dist/cdn/themes/brutalist-dark.tokens.json +33 -1
  117. package/dist/cdn/themes/brutalist.css +1 -1
  118. package/dist/cdn/themes/brutalist.tokens.json +23 -1
  119. package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
  120. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
  121. package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
  122. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
  123. package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
  124. package/dist/cdn/themes/classic-dark.tokens.json +1 -1
  125. package/dist/cdn/themes/classic.tokens.json +1 -1
  126. package/dist/cdn/themes/claymorphism-dark.tokens.json +33 -1
  127. package/dist/cdn/themes/claymorphism.css +1 -1
  128. package/dist/cdn/themes/claymorphism.tokens.json +23 -1
  129. package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
  130. package/dist/cdn/themes/clinical.tokens.json +1 -1
  131. package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
  132. package/dist/cdn/themes/cottagecore.css +1 -1
  133. package/dist/cdn/themes/cottagecore.tokens.json +1 -1
  134. package/dist/cdn/themes/cyber.css +1 -1
  135. package/dist/cdn/themes/cyber.tokens.json +1 -1
  136. package/dist/cdn/themes/dawn-dark.tokens.json +33 -1
  137. package/dist/cdn/themes/dawn.css +1 -1
  138. package/dist/cdn/themes/dawn.tokens.json +23 -1
  139. package/dist/cdn/themes/dracula.tokens.json +1 -1
  140. package/dist/cdn/themes/dusk.css +1 -1
  141. package/dist/cdn/themes/dusk.tokens.json +1 -1
  142. package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
  143. package/dist/cdn/themes/editorial.css +1 -1
  144. package/dist/cdn/themes/editorial.tokens.json +1 -1
  145. package/dist/cdn/themes/financial-dark.tokens.json +1 -1
  146. package/dist/cdn/themes/financial.tokens.json +1 -1
  147. package/dist/cdn/themes/genai.css +1 -1
  148. package/dist/cdn/themes/genai.tokens.json +1 -1
  149. package/dist/cdn/themes/glassmorphism-dark.tokens.json +1 -1
  150. package/dist/cdn/themes/glassmorphism.tokens.json +1 -1
  151. package/dist/cdn/themes/government-dark.tokens.json +1 -1
  152. package/dist/cdn/themes/government.tokens.json +1 -1
  153. package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
  154. package/dist/cdn/themes/gruvbox.tokens.json +1 -1
  155. package/dist/cdn/themes/high-noon-dark.tokens.json +23 -1
  156. package/dist/cdn/themes/high-noon.css +1 -1
  157. package/dist/cdn/themes/high-noon.tokens.json +1 -1
  158. package/dist/cdn/themes/journal-dark.tokens.json +33 -1
  159. package/dist/cdn/themes/journal.css +1 -1
  160. package/dist/cdn/themes/journal.tokens.json +23 -1
  161. package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
  162. package/dist/cdn/themes/kawaii.css +1 -1
  163. package/dist/cdn/themes/kawaii.tokens.json +1 -1
  164. package/dist/cdn/themes/magna-dark.tokens.json +1 -1
  165. package/dist/cdn/themes/magna.tokens.json +1 -1
  166. package/dist/cdn/themes/manifest.json +26 -50
  167. package/dist/cdn/themes/midnight.tokens.json +1 -1
  168. package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
  169. package/dist/cdn/themes/minimal.tokens.json +1 -1
  170. package/dist/cdn/themes/modern-dark.tokens.json +1 -1
  171. package/dist/cdn/themes/modern.tokens.json +1 -1
  172. package/dist/cdn/themes/nes-dark.tokens.json +1 -1
  173. package/dist/cdn/themes/nes.css +1 -1
  174. package/dist/cdn/themes/nes.tokens.json +1 -1
  175. package/dist/cdn/themes/neumorphism-dark.tokens.json +1 -1
  176. package/dist/cdn/themes/neumorphism.css +1 -1
  177. package/dist/cdn/themes/neumorphism.tokens.json +1 -1
  178. package/dist/cdn/themes/nord-dark.tokens.json +33 -1
  179. package/dist/cdn/themes/nord.css +1 -1
  180. package/dist/cdn/themes/nord.tokens.json +23 -1
  181. package/dist/cdn/themes/organic-dark.tokens.json +1 -1
  182. package/dist/cdn/themes/organic.css +1 -1
  183. package/dist/cdn/themes/organic.tokens.json +1 -1
  184. package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
  185. package/dist/cdn/themes/rose-pine.tokens.json +1 -1
  186. package/dist/cdn/themes/rough-dark.tokens.json +1 -1
  187. package/dist/cdn/themes/rough.css +1 -1
  188. package/dist/cdn/themes/rough.tokens.json +1 -1
  189. package/dist/cdn/themes/solarized-dark.tokens.json +23 -1
  190. package/dist/cdn/themes/solarized.css +1 -1
  191. package/dist/cdn/themes/solarized.tokens.json +23 -1
  192. package/dist/cdn/themes/startup-dark.tokens.json +1 -1
  193. package/dist/cdn/themes/startup.tokens.json +1 -1
  194. package/dist/cdn/themes/super2026-dark.tokens.json +33 -1
  195. package/dist/cdn/themes/super2026.css +1 -1
  196. package/dist/cdn/themes/super2026.tokens.json +23 -1
  197. package/dist/cdn/themes/swiss-dark.tokens.json +1 -1
  198. package/dist/cdn/themes/swiss.css +1 -1
  199. package/dist/cdn/themes/swiss.tokens.json +1 -1
  200. package/dist/cdn/themes/terminal.css +1 -1
  201. package/dist/cdn/themes/terminal.tokens.json +1 -1
  202. package/dist/cdn/themes/tokyo-night-dark.tokens.json +33 -1
  203. package/dist/cdn/themes/tokyo-night.css +1 -1
  204. package/dist/cdn/themes/tokyo-night.tokens.json +23 -1
  205. package/dist/cdn/themes/vaporwave-dark.tokens.json +33 -1
  206. package/dist/cdn/themes/vaporwave.css +1 -1
  207. package/dist/cdn/themes/vaporwave.tokens.json +23 -1
  208. package/dist/cdn/themes/win9x-dark.tokens.json +15 -4
  209. package/dist/cdn/themes/win9x.css +1 -1
  210. package/dist/cdn/themes/win9x.tokens.json +1 -1
  211. package/dist/cdn/vanilla-breeze-autoload.js +663 -0
  212. package/dist/cdn/vanilla-breeze-charts.css +1 -1
  213. package/dist/cdn/vanilla-breeze-charts.js +32 -32
  214. package/dist/cdn/vanilla-breeze-core.css +1 -1
  215. package/dist/cdn/vanilla-breeze-core.js +78 -80
  216. package/dist/cdn/vanilla-breeze-dev.css +1 -1
  217. package/dist/cdn/vanilla-breeze-extras.js +47 -37
  218. package/dist/cdn/vanilla-breeze.css +1 -1
  219. package/dist/cdn/vanilla-breeze.js +180 -177
  220. package/package.json +12 -7
  221. package/dist/cdn/themes/amber.css +0 -2
  222. package/dist/cdn/themes/anthropic.css +0 -2
  223. package/dist/cdn/themes/anthropic.tokens.json +0 -564
  224. package/dist/cdn/themes/coral.css +0 -2
  225. package/dist/cdn/themes/emerald.css +0 -2
  226. package/dist/cdn/themes/forest.css +0 -2
  227. package/dist/cdn/themes/ibm.css +0 -2
  228. package/dist/cdn/themes/ibm.tokens.json +0 -568
  229. package/dist/cdn/themes/indigo.css +0 -2
  230. package/dist/cdn/themes/lavender.css +0 -2
  231. package/dist/cdn/themes/mcdonalds.css +0 -2
  232. package/dist/cdn/themes/mcdonalds.tokens.json +0 -533
  233. package/dist/cdn/themes/ocean.css +0 -2
  234. package/dist/cdn/themes/rose.css +0 -2
  235. package/dist/cdn/themes/slate.css +0 -2
  236. package/dist/cdn/themes/starbucks.css +0 -2
  237. package/dist/cdn/themes/starbucks.tokens.json +0 -593
  238. package/dist/cdn/themes/sunset.css +0 -2
@@ -1,3 +1,3 @@
1
- var p=class extends HTMLElement{#t=[];#n;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#t.push(()=>t.removeEventListener(e,i,n))}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)}};var U=window.matchMedia("(prefers-reduced-motion: reduce)");var x=new Map;function O(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=x.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&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>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}x.set(s,n),customElements.define(s,t)}function M(){let s=globalThis.localStorage;if(!s)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return s.getItem(t)},async setRaw(t,e){s.setItem(t,e)},async removeRaw(t){s.removeItem(t)},async keys(t){let e=[];for(let i=0;i<s.length;i++){let n=s.key(i);n&&n.startsWith(t)&&e.push(n)}return e}}}var y=null;function l(){return y||(y=M()),y}function A(s,t){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${s}:${t}`}function N(s){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${s}:`}function R(s){try{let t=JSON.parse(s);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var b={configure(s={}){y=s.backend??null},async set(s,t,e){let i={data:e,timestamp:Date.now()};await l().setRaw(A(s,t),JSON.stringify(i))},async get(s,t,e){let i=await l().getRaw(A(s,t));if(i==null)return null;let n=R(i);return!n||e?.maxAge!=null&&Date.now()-n.timestamp>e.maxAge?null:n.data},async remove(s,t){await l().removeRaw(A(s,t))},async list(s){let t=N(s),e=await l().keys(t),i=[];for(let n of e){let r=await l().getRaw(n);if(r==null)continue;let o=R(r);o&&i.push({key:n.slice(t.length),data:o.data,timestamp:o.timestamp})}return i},async clear(s){let t=N(s),e=await l().keys(t);for(let i of e)await l().removeRaw(i)},async clearAll(){let s=await l().keys("vb:");for(let t of s)await l().removeRaw(t)},async setMany(s,t){for(let[e,i]of t)await b.set(s,e,i)}};var v="[data-highlights]",H="highlights",B=["yellow","green","blue","pink"];var I=typeof CSS<"u"&&"highlights"in CSS;function $(s){let t=2166136261;for(let e=0;e<s.length;e++)t^=s.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function F(){return"hn-"+crypto.randomUUID().slice(0,8)}function P(s,t){return getComputedStyle(s).getPropertyValue(`--highlight-${t}`).trim()}var u=null,m=0;function _(s){if(u){m++;return}u=new CSSStyleSheet;let t=s.map(e=>`::highlight(hn-${e}) { background-color: var(--highlight-${e}); text-decoration-line: underline; text-decoration-color: var(--highlight-${e}); text-underline-offset: 2px; }`).join(`
2
- `);u.replaceSync(t),document.adoptedStyleSheets=[...document.adoptedStyleSheets,u],m=1}function q(){m--,m<=0&&u&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(s=>s!==u),u=null,m=0)}var c=null;function w(s){c||(c=document.createElement("div"),c.setAttribute("aria-live","polite"),c.setAttribute("aria-atomic","true"),c.className="hn-sr-only",document.body.appendChild(c)),c.textContent="",requestAnimationFrame(()=>{c.textContent=s})}function T(s,t,e){let i=document.createTreeWalker(s,NodeFilter.SHOW_TEXT),n=0;for(;i.nextNode();){if(i.currentNode===t)return n+e;n+=(i.currentNode.textContent??"").length}return-1}function g(s,t,e){let i=document.createTreeWalker(s,NodeFilter.SHOW_TEXT),n=0,r=null,o=0,a=null,h=0;for(;i.nextNode();){let d=i.currentNode,S=(d.textContent??"").length;if(!r&&n+S>t&&(r=d,o=t-n),n+S>=e){a=d,h=e-n;break}n+=S}if(!r||!a)return null;try{let d=document.createRange();return d.setStart(r,Math.min(o,(r.textContent??"").length)),d.setEnd(a,Math.min(h,(a.textContent??"").length)),d}catch{return null}}var C=class{#t;#n;#s;#i;#e=[];#a=!I;#l;#c;#d=!1;#u=[];constructor(t){this.#t=t,this.#i=t.hasAttribute("data-highlights-readonly");let e=t.dataset.highlights;this.#n=e&&e!==""?e:location.pathname;let i=t.dataset.highlightsColors;this.#s=i?i.split(",").map(n=>n.trim()).filter(Boolean):[...B],this.#a||_(this.#s),this.#h(),this.#i||(this.#l=this.#m.bind(this),this.#c=this.#p.bind(this),t.addEventListener("pointerup",this.#l),t.addEventListener("click",this.#c)),t.setAttribute("data-highlights-init",""),this.#b().then(()=>{this.#d||this.#h()})}get colors(){return[...this.#s]}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.#o(),this.#h(),this.#r("highlights:removed",{id:t}),w("Highlight removed"))}clearAll(){this.#e=[],this.#o(),this.#h()}exportHighlights(){return JSON.stringify({version:1,highlights:this.#e})}importHighlights(t){try{let e=typeof t=="string"?JSON.parse(t):t;if(!e.highlights||!Array.isArray(e.highlights))return;this.#e=e.highlights,this.#o(),this.#h()}catch{}}destroy(){if(!this.#d){if(this.#d=!0,this.#l&&this.#t.removeEventListener("pointerup",this.#l),this.#c&&this.#t.removeEventListener("click",this.#c),this.#a)this.#t.querySelectorAll("mark[data-hn-id]").forEach(t=>{let e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t),e.normalize()});else{for(let t of this.#s)CSS.highlights.delete(`hn-${t}`);q()}this.#f(),this.#t.removeAttribute("data-highlights-init")}}#m(){requestAnimationFrame(()=>{if(this.#d)return;let t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return;let e=t.getRangeAt(0);this.#t.contains(e.commonAncestorContainer)&&this.#r("highlights:selected",{text:t.toString().trim(),rect:e.getBoundingClientRect()})})}#p(t){let e=t.target.closest?.(".hn-margin-annotation");if(e){let n=e.dataset.hnId,r=this.#e.find(o=>o.id===n);if(r){this.#r("highlights:clicked",{id:n,highlight:{...r}}),this.#r("highlights:request-note",{id:n,highlight:{...r},controller:this});return}}let i=t.target.closest?.("mark[data-hn-id]");if(i){let n=i.dataset.hnId,r=this.#e.find(o=>o.id===n);if(r){this.#r("highlights:clicked",{id:n,highlight:{...r}});return}}if(!this.#a){let n=this.#y(t.clientX,t.clientY);n&&this.#r("highlights:clicked",{id:n.id,highlight:{...n}})}}findHighlightRect(t){let e=this.#e.find(r=>r.id===t);if(!e)return null;let i=g(this.#t,e.startOffset,e.endOffset);if(!i)return null;let n=i.getClientRects();return n.length?n[0]:null}#y(t,e){for(let i of this.#e){let n=g(this.#t,i.startOffset,i.endOffset);if(!n)continue;let r=n.getClientRects();for(let o of r)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=T(this.#t,i.startContainer,i.startOffset),r=T(this.#t,i.endContainer,i.endOffset);if(n<0||r<0||n>=r)return;let o=e.toString().trim(),a={id:F(),startOffset:n,endOffset:r,text:o,color:t,note:"",created:Date.now()};this.#e.push(a),this.#o(),this.#h(),e.removeAllRanges(),this.#r("highlights:added",{id:a.id,text:o,color:t,note:""}),w("Highlight added")}_changeColor(t,e){let i=this.#e.find(n=>n.id===t);i&&(i.color=e,this.#o(),this.#h())}_updateNote(t,e){let i=this.#e.find(n=>n.id===t);i&&(i.note=e,this.#o(),this.#g(),this.#r("highlights:note-changed",{id:t,note:e}),w("Note saved"))}async#b(){let t=await b.get(H,this.#n);if(!t||!Array.isArray(t.highlights))return;let e=$(this.#t.textContent);t.contentHash&&t.contentHash!==e?(this.#e=t.highlights.filter(i=>{let n=g(this.#t,i.startOffset,i.endOffset);return n?n.toString().trim()===i.text:!1}),this.#o()):this.#e=t.highlights}#o(){let t={version:1,contentHash:$(this.#t.textContent),highlights:this.#e};b.set(H,this.#n,t).catch(()=>{})}#h(){this.#a?this.#A():this.#S(),this.#g()}#S(){let t=new Map;for(let e of this.#s)t.set(e,[]);for(let e of this.#e){let i=g(this.#t,e.startOffset,e.endOffset);i&&t.has(e.color)&&t.get(e.color).push(i)}for(let[e,i]of t){let n=`hn-${e}`;i.length===0?CSS.highlights.delete(n):CSS.highlights.set(n,new Highlight(...i))}}#A(){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=g(this.#t,e.startOffset,e.endOffset);if(!i)continue;let n=P(this.#t,e.color),r=document.createElement("mark");r.dataset.hnId=e.id,r.dataset.hnColor=e.color,n&&(r.style.backgroundColor=n,r.style.textDecorationColor=n);try{i.surroundContents(r)}catch{let o=i.extractContents();r.appendChild(o),i.insertNode(r)}}}#f(){for(let t of this.#u)t.remove();this.#u=[]}#g(){if(this.#f(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");for(let e of this.#e){let i=g(this.#t,e.startOffset,e.endOffset);if(!i)continue;let n=i.getClientRects();if(n.length===0)continue;let r=n[0],o=this.#t.getBoundingClientRect(),a=r.top-o.top,h=document.createElement("span");h.className="hn-margin-annotation",h.dataset.hnId=e.id,h.setAttribute("aria-hidden","true"),h.style.top=`${a}px`,e.note?(h.innerHTML='<span class="hn-note-indicator">*</span> You highlighted',h.classList.add("hn-has-note")):h.textContent="You highlighted",this.#t.appendChild(h),this.#u.push(h)}}#r(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}},E=new WeakMap;function f(s){if(E.has(s))return E.get(s);let t=new C(s);return E.set(s,t),t}function L(s=document){s.querySelectorAll(v).forEach(t=>{t.hasAttribute("data-highlights-init")||f(t)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>L()):L();var D=new MutationObserver(s=>{for(let t of s)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let i=e;i.matches(v)&&f(i),i.querySelectorAll(v).forEach(n=>{n.hasAttribute("data-highlights-init")||f(n)})}});D.observe(document.documentElement,{childList:!0,subtree:!0});var V=["yellow","green","blue","pink"],k=class extends p{#t=null;#n="yellow";#s=!1;#i=null;setup(){this.#s=!!this.closest("selection-menu"),this.#s?this.#e():this.#c()}teardown(){this.#t?.destroy(),this.#t=null,this.#i?.remove(),this.#i=null}#e(){let t=this.#u(),e=document.createElement("button");e.type="button",e.setAttribute("aria-label","Highlight selection");let i=document.createElement("icon-wc");i.setAttribute("name","highlighter"),i.setAttribute("size","sm"),i.setAttribute("aria-hidden","true"),e.appendChild(i),e.addEventListener("click",r=>{r.stopPropagation(),this.#a()}),this.appendChild(e),this.#i=document.createElement("div"),this.#i.className="highlight-color-dropdown",this.#i.setAttribute("role","group"),this.#i.setAttribute("aria-label","Highlight color"),this.#i.hidden=!0;let n=this.#i;t.forEach(r=>{let o=document.createElement("button");o.type="button",o.className="highlight-color-swatch",o.dataset.color=r,o.setAttribute("aria-label",`${r}`),o.setAttribute("aria-pressed",r===this.#n?"true":"false"),o.style.backgroundColor=`var(--highlight-${r})`,o.addEventListener("click",a=>{a.stopPropagation(),this.#n=r,n.querySelectorAll(".highlight-color-swatch").forEach(h=>h.setAttribute("aria-pressed",h.dataset.color===r?"true":"false")),n.hidden=!0,this.#l()}),n.appendChild(o)}),this.appendChild(n)}#a(){this.#i&&(this.#i.hidden=!this.#i.hidden)}#l(){let t=this.closest("selection-menu");if(!t)return;let e=t.getSelection?.();if(!e)return;let i=e.target;if(i.hasAttribute("data-highlights-init"))this.#t||(this.#t=f(i));else{let n=this.getAttribute("storage-key")||"";i.setAttribute("data-highlights",n),this.hasAttribute("colors")&&i.setAttribute("data-highlights-colors",this.getAttribute("colors")??""),this.#t=f(i)}this.#t?._createFromSelection(this.#n),t.dismiss?.()}#c(){let t=this.#d();if(!t)return!1;let e=this.getAttribute("storage-key")||"";return t.setAttribute("data-highlights",e),this.hasAttribute("colors")&&t.setAttribute("data-highlights-colors",this.getAttribute("colors")??""),this.hasAttribute("readonly")&&t.setAttribute("data-highlights-readonly",""),this.#t=f(t),!0}#d(){let t=this.getAttribute("for");return t?document.getElementById(t):this.firstElementChild}#u(){let t=this.getAttribute("colors");return t?t.split(",").map(e=>e.trim()).filter(Boolean):[...V]}getHighlights(){return this.#t?.getHighlights()??[]}removeHighlight(t){this.#t?.removeHighlight(t)}clearAll(){this.#t?.clearAll()}exportHighlights(){return this.#t?.exportHighlights()??'{"version":1,"highlights":[]}'}importHighlights(t){this.#t?.importHighlights(t)}};O("highlight-wc",k);
1
+ var b=class extends HTMLElement{#t=[];#n;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,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)}};var Y=window.matchMedia("(prefers-reduced-motion: reduce)");var N=new Map;function R(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},o=N.get(s);if(customElements.get(s)){if(!o||o.priority>=i){o&&o.priority===i&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=i){o.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${o.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}N.set(s,n),customElements.define(s,t)}function F(){let s=globalThis.localStorage;if(!s)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return s.getItem(t)},async setRaw(t,e){s.setItem(t,e)},async removeRaw(t){s.removeItem(t)},async keys(t){let e=[];for(let i=0;i<s.length;i++){let n=s.key(i);n&&n.startsWith(t)&&e.push(n)}return e}}}var w="__vbStoreBackend",A=globalThis;function l(){return A[w]||(A[w]=F()),A[w]}function S(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 M(s){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${s}:`}function $(s){try{let t=JSON.parse(s);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var m={configure(s={}){A[w]=s.backend??null},async set(s,t,e){let i={data:e,timestamp:Date.now()};await l().setRaw(S(s,t),JSON.stringify(i))},async get(s,t,e){let i=await l().getRaw(S(s,t));if(i==null)return null;let n=$(i);return!n||e?.maxAge!=null&&Date.now()-n.timestamp>e.maxAge?null:n.data},async remove(s,t){await l().removeRaw(S(s,t))},async list(s){let t=M(s),e=await l().keys(t),i=[];for(let n of e){let o=await l().getRaw(n);if(o==null)continue;let r=$(o);r&&i.push({key:n.slice(t.length),data:r.data,timestamp:r.timestamp})}return i},async clear(s){let t=M(s),e=await l().keys(t);for(let i of e)await l().removeRaw(i)},async clearAll(){let s=await l().keys("vb:");for(let t of s)await l().removeRaw(t)},async setMany(s,t){for(let[e,i]of t)await m.set(s,e,i)}};if(typeof window<"u"){let s=window.VB??(window.VB={});s.store??=m}var k="[data-highlights]",H="highlights",q=["yellow","green","blue","pink"];var D=typeof CSS<"u"&&"highlights"in CSS;function T(s){let t=2166136261;for(let e=0;e<s.length;e++)t^=s.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function V(){return"hn-"+crypto.randomUUID().slice(0,8)}var X=/^[a-z0-9_-]+$/i;function L(s){return typeof s=="string"&&X.test(s)}var u=null,f=new Map,y=new Map;function P(){if(f.size===0){u&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(t=>t!==u),u=null);return}u||(u=new CSSStyleSheet,document.adoptedStyleSheets=[...document.adoptedStyleSheets,u]);let s=[...f.keys()].map(t=>`::highlight(hn-${t}) { background-color: var(--highlight-${t}); text-decoration-line: underline; text-decoration-color: var(--highlight-${t}); text-underline-offset: 2px; }`).join(`
2
+ `);u.replaceSync(s)}function K(s){for(let t of s)f.set(t,(f.get(t)??0)+1);P()}function U(s){for(let t of s){let e=(f.get(t)??0)-1;e>0?f.set(t,e):f.delete(t)}P()}function z(s){let t=y.get(s),e=t?[...t.values()].flat():[];e.length===0?(CSS.highlights.delete(`hn-${s}`),y.delete(s)):CSS.highlights.set(`hn-${s}`,new Highlight(...e))}function B(s,t){let e=new Set(t.keys());for(let[i,n]of y)n.has(s)&&e.add(i);for(let i of e){let n=t.get(i)??[],o=y.get(i);n.length?(o||y.set(i,o=new Map),o.set(s,n)):o?.delete(s),z(i)}}var c=null;function v(s){c||(c=document.createElement("div"),c.setAttribute("aria-live","polite"),c.setAttribute("aria-atomic","true"),c.className="hn-sr-only",document.body.appendChild(c)),c.textContent="",requestAnimationFrame(()=>{c.textContent=s})}function _(s,t,e){let i=document.createTreeWalker(s,NodeFilter.SHOW_TEXT),n=0;for(;i.nextNode();){if(i.currentNode===t)return n+e;n+=(i.currentNode.textContent??"").length}return-1}function p(s,t,e){let i=document.createTreeWalker(s,NodeFilter.SHOW_TEXT),n=0,o=null,r=0,a=null,h=0;for(;i.nextNode();){let d=i.currentNode,E=(d.textContent??"").length;if(!o&&n+E>t&&(o=d,r=t-n),n+E>=e){a=d,h=e-n;break}n+=E}if(!o||!a)return null;try{let d=document.createRange();return d.setStart(o,Math.min(r,(o.textContent??"").length)),d.setEnd(a,Math.min(h,(a.textContent??"").length)),d}catch{return null}}var O=class{#t;#n;#s;#i;#e=[];#a=!D;#l;#c;#d=!1;#u=[];constructor(t){this.#t=t,this.#i=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(o=>o.trim()).filter(L):[...q];this.#s=[...new Set(n)],this.#a||K(this.#s),this.#h(),this.#i||(this.#l=this.#p.bind(this),this.#c=this.#m.bind(this),t.addEventListener("pointerup",this.#l),t.addEventListener("click",this.#c)),t.setAttribute("data-highlights-init",""),this.#b().then(()=>{this.#d||this.#h()})}get colors(){return[...this.#s]}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.#r(),this.#h(),this.#o("highlights:removed",{id:t}),v("Highlight removed"))}clearAll(){this.#e=[],this.#r(),this.#h()}exportHighlights(){return JSON.stringify({version:1,highlights:this.#e})}importHighlights(t){try{let e=typeof t=="string"?JSON.parse(t):t;if(!e.highlights||!Array.isArray(e.highlights))return;this.#e=e.highlights,this.#r(),this.#h()}catch{}}destroy(){this.#d||(this.#d=!0,this.#l&&this.#t.removeEventListener("pointerup",this.#l),this.#c&&this.#t.removeEventListener("click",this.#c),this.#a?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()}):(B(this,new Map),U(this.#s)),this.#f(),this.#t.removeAttribute("data-highlights-init"))}#p(){requestAnimationFrame(()=>{if(this.#d)return;let t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return;let e=t.getRangeAt(0);this.#t.contains(e.commonAncestorContainer)&&this.#o("highlights:selected",{text:t.toString().trim(),rect:e.getBoundingClientRect()})})}#m(t){let e=t.target.closest?.(".hn-margin-annotation");if(e){let n=e.dataset.hnId,o=this.#e.find(r=>r.id===n);if(o){this.#o("highlights:clicked",{id:n,highlight:{...o}}),this.#o("highlights:request-note",{id:n,highlight:{...o},controller:this});return}}let i=t.target.closest?.("mark[data-hn-id]");if(i){let n=i.dataset.hnId,o=this.#e.find(r=>r.id===n);if(o){this.#o("highlights:clicked",{id:n,highlight:{...o}});return}}if(!this.#a){let n=this.#y(t.clientX,t.clientY);n&&this.#o("highlights:clicked",{id:n.id,highlight:{...n}})}}findHighlightRect(t){let e=this.#e.find(o=>o.id===t);if(!e)return null;let i=p(this.#t,e.startOffset,e.endOffset);if(!i)return null;let n=i.getClientRects();return n.length?n[0]:null}#y(t,e){for(let i of this.#e){let n=p(this.#t,i.startOffset,i.endOffset);if(!n)continue;let o=n.getClientRects();for(let r of o)if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.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=_(this.#t,i.startContainer,i.startOffset),o=_(this.#t,i.endContainer,i.endOffset);if(n<0||o<0||n>=o)return;let r=e.toString().trim(),a={id:V(),startOffset:n,endOffset:o,text:r,color:t,note:"",created:Date.now()};this.#e.push(a),this.#r(),this.#h(),e.removeAllRanges(),this.#o("highlights:added",{id:a.id,text:r,color:t,note:""}),v("Highlight added")}_changeColor(t,e){let i=this.#e.find(n=>n.id===t);i&&(i.color=e,this.#r(),this.#h())}_updateNote(t,e){let i=this.#e.find(n=>n.id===t);i&&(i.note=e,this.#r(),this.#g(),this.#o("highlights:note-changed",{id:t,note:e}),v("Note saved"))}async#b(){let t=await m.get(H,this.#n);if(!t||!Array.isArray(t.highlights))return;let e=T(this.#t.textContent);t.contentHash&&t.contentHash!==e?(this.#e=t.highlights.filter(i=>{let n=p(this.#t,i.startOffset,i.endOffset);return n?n.toString().trim()===i.text:!1}),this.#r()):this.#e=t.highlights}#r(){let t={version:1,contentHash:T(this.#t.textContent),highlights:this.#e};m.set(H,this.#n,t).catch(()=>{})}#h(){this.#a?this.#A():this.#w(),this.#g()}#w(){let t=new Map;for(let e of this.#s)t.set(e,[]);for(let e of this.#e){let i=p(this.#t,e.startOffset,e.endOffset);i&&t.has(e.color)&&t.get(e.color).push(i)}B(this,t)}#A(){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=p(this.#t,e.startOffset,e.endOffset);if(!i)continue;let n=document.createElement("mark");n.dataset.hnId=e.id,L(e.color)&&(n.dataset.hnColor=e.color,n.style.setProperty("--_hn-color",`var(--highlight-${e.color})`));try{i.surroundContents(n)}catch{let o=i.extractContents();n.appendChild(o),i.insertNode(n)}}}#f(){for(let t of this.#u)t.remove();this.#u=[]}#g(){if(this.#f(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");for(let e of this.#e){let i=p(this.#t,e.startOffset,e.endOffset);if(!i)continue;let n=i.getClientRects();if(n.length===0)continue;let o=n[0],r=this.#t.getBoundingClientRect(),a=o.top-r.top,h=document.createElement("span");h.className="hn-margin-annotation",h.dataset.hnId=e.id,h.setAttribute("aria-hidden","true"),h.style.top=`${a}px`,e.note?(h.innerHTML='<span class="hn-note-indicator">*</span> You highlighted',h.classList.add("hn-has-note")):h.textContent="You highlighted",this.#t.appendChild(h),this.#u.push(h)}}#o(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}},C=new WeakMap;function g(s){if(C.has(s))return C.get(s);let t=new O(s);return C.set(s,t),t}function I(s=document){s.querySelectorAll(k).forEach(t=>{t.hasAttribute("data-highlights-init")||g(t)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>I()):I();var W=new MutationObserver(s=>{for(let t of s)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let i=e;i.matches(k)&&g(i),i.querySelectorAll(k).forEach(n=>{n.hasAttribute("data-highlights-init")||g(n)})}});W.observe(document.documentElement,{childList:!0,subtree:!0});var G=["yellow","green","blue","pink"],x=class extends b{#t=null;#n="yellow";#s=!1;#i=null;setup(){this.#s=!!this.closest("selection-menu"),this.#s?this.#e():this.#c()}teardown(){this.#t?.destroy(),this.#t=null,this.#i?.remove(),this.#i=null}#e(){let t=this.#u(),e=document.createElement("button");e.type="button",e.setAttribute("aria-label","Highlight selection");let i=document.createElement("icon-wc");i.setAttribute("name","highlighter"),i.setAttribute("size","sm"),i.setAttribute("aria-hidden","true"),e.appendChild(i),e.addEventListener("click",o=>{o.stopPropagation(),this.#a()}),this.appendChild(e),this.#i=document.createElement("div"),this.#i.className="highlight-color-dropdown",this.#i.setAttribute("role","group"),this.#i.setAttribute("aria-label","Highlight color"),this.#i.hidden=!0;let n=this.#i;t.forEach(o=>{let r=document.createElement("button");r.type="button",r.className="highlight-color-swatch",r.dataset.color=o,r.setAttribute("aria-label",`${o}`),r.setAttribute("aria-pressed",o===this.#n?"true":"false"),r.style.backgroundColor=`var(--highlight-${o})`,r.addEventListener("click",a=>{a.stopPropagation(),this.#n=o,n.querySelectorAll(".highlight-color-swatch").forEach(h=>h.setAttribute("aria-pressed",h.dataset.color===o?"true":"false")),n.hidden=!0,this.#l()}),n.appendChild(r)}),this.appendChild(n)}#a(){this.#i&&(this.#i.hidden=!this.#i.hidden)}#l(){let t=this.closest("selection-menu");if(!t)return;let e=t.getSelection?.();if(!e)return;let i=e.target;if(i.hasAttribute("data-highlights-init"))this.#t||(this.#t=g(i));else{let n=this.getAttribute("storage-key")||"";i.setAttribute("data-highlights",n),this.hasAttribute("colors")&&i.setAttribute("data-highlights-colors",this.getAttribute("colors")??""),this.#t=g(i)}this.#t?._createFromSelection(this.#n),t.dismiss?.()}#c(){let t=this.#d();if(!t)return!1;let e=this.getAttribute("storage-key")||"";return t.setAttribute("data-highlights",e),this.hasAttribute("colors")&&t.setAttribute("data-highlights-colors",this.getAttribute("colors")??""),this.hasAttribute("readonly")&&t.setAttribute("data-highlights-readonly",""),this.#t=g(t),!0}#d(){let t=this.getAttribute("for");return t?document.getElementById(t):this.firstElementChild}#u(){let t=this.getAttribute("colors");return t?t.split(",").map(e=>e.trim()).filter(Boolean):[...G]}getHighlights(){return this.#t?.getHighlights()??[]}removeHighlight(t){this.#t?.removeHighlight(t)}clearAll(){this.#t?.clearAll()}exportHighlights(){return this.#t?.exportHighlights()??'{"version":1,"highlights":[]}'}importHighlights(t){this.#t?.importHighlights(t)}};R("highlight-wc",x);
3
3
  //# sourceMappingURL=highlight-wc.js.map
@@ -1,2 +1,2 @@
1
- var B=Object.defineProperty;var H=(t,e)=>()=>(t&&(e=t(t=0)),e);var X=(t,e)=>{for(var i in e)B(t,i,{get:e[i],enumerable:!0})};var Y={};X(Y,{addDialogDismiss:()=>C,addFlickListener:()=>N,addLongPress:()=>$,addPullToRefresh:()=>z,addSwipeListener:()=>D,haptic:()=>x,initGestures:()=>q,makeSwipeable:()=>P});function D(t,e={}){let i=e.threshold??50,s=e.restraint??100,r=e.timeout??300,n=e.velocity??.5,l=e.minFlickDistance??10,a,c,f;function h(o){o.isPrimary&&(a=o.clientX,c=o.clientY,f=Date.now())}function d(o){if(!o.isPrimary)return;let m=o.clientX-a,v=o.clientY-c,u=Date.now()-f;if(u>r)return;let p=Math.abs(m),y=Math.abs(v),g=Math.max(p,y),b=u>0?g/u:0,w=b>=n&&g>=l,E;if((p>=i||w&&p>y)&&y<=s?E=m<0?"left":"right":(y>=i||w&&y>p)&&p<=s&&(E=v<0?"up":"down"),E){let I=E==="left"||E==="right"?p:y;t.dispatchEvent(new CustomEvent(`swipe-${E}`,{bubbles:!0,detail:{distance:I,duration:u,velocity:b,flick:w}}))}}return t.addEventListener("pointerdown",h,{passive:!0}),t.addEventListener("pointerup",d,{passive:!0}),()=>{t.removeEventListener("pointerdown",h),t.removeEventListener("pointerup",d)}}function N(t,e={}){let i=e.minDistance??10,s=e.velocity??.6,r=e.timeout??250,n=e.restraint??80,l,a,c;function f(d){d.isPrimary&&(l=d.clientX,a=d.clientY,c=Date.now())}function h(d){if(!d.isPrimary)return;let o=d.clientX-l,m=d.clientY-a,v=Date.now()-c;if(v===0||v>r)return;let u=Math.abs(o),p=Math.abs(m),y=Math.max(u,p);if(y<i)return;let g=y/v;if(g<s)return;let b;if(u>p&&p<=n?b=o<0?"left":"right":p>u&&u<=n&&(b=m<0?"up":"down"),b){let w=b==="left"||b==="right"?u:p;t.dispatchEvent(new CustomEvent(`swipe-${b}`,{bubbles:!0,detail:{distance:w,duration:v,velocity:g,flick:!0}}))}}return t.addEventListener("pointerdown",f,{passive:!0}),t.addEventListener("pointerup",h,{passive:!0}),()=>{t.removeEventListener("pointerdown",f),t.removeEventListener("pointerup",h)}}function P(t,e={}){let i=e.threshold??100,s=e.direction??"horizontal",r=e.removeOnDismiss??!0,n=s==="horizontal",l=0,a=0,c=!1;function f(u){!u.isPrimary||t.hasAttribute("data-dismissed")||(u.preventDefault(),c=!0,l=n?u.clientX:u.clientY,a=0,t.setPointerCapture(u.pointerId),t.setAttribute("data-swiping",""))}function h(u){if(!c||!u.isPrimary)return;a=(n?u.clientX:u.clientY)-l;let y=1-Math.min(Math.abs(a)/i,1)*.5;n?t.style.transform=`translateX(${a}px)`:t.style.transform=`translateY(${a}px)`,t.style.opacity=String(y)}function d(u){!c||!u.isPrimary||(c=!1,t.releasePointerCapture(u.pointerId),t.removeAttribute("data-swiping"),Math.abs(a)>=i?m(a>0?"right":"left"):v())}function o(u){!c||!u.isPrimary||(c=!1,t.releasePointerCapture(u.pointerId),t.removeAttribute("data-swiping"),v())}function m(u){let p=u==="right"?"100%":"-100%";t.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",t.style.transform=n?`translateX(${p})`:`translateY(${p})`,t.style.opacity="0",t.setAttribute("data-dismissed",""),x.dismiss(),t.dispatchEvent(new CustomEvent("swipe-dismiss",{bubbles:!0,detail:{direction:u,distance:Math.abs(a)}})),r&&t.addEventListener("transitionend",()=>t.remove(),{once:!0})}function v(){t.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",t.style.transform="",t.style.opacity="",t.addEventListener("transitionend",()=>{t.style.transition=""},{once:!0})}return t.addEventListener("pointerdown",f),t.addEventListener("pointermove",h),t.addEventListener("pointerup",d),t.addEventListener("pointercancel",o),()=>{t.removeEventListener("pointerdown",f),t.removeEventListener("pointermove",h),t.removeEventListener("pointerup",d),t.removeEventListener("pointercancel",o)}}function z(t,e,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),t.prepend(n);let a=0,c=!1,f=!1;function h(p){!p.isPrimary||f||t.scrollTop<=0&&(a=p.clientY,c=!0)}function d(p){if(!c||!p.isPrimary||f)return;let y=p.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 o(p){!c||!p.isPrimary||(c=!1,n.hasAttribute("data-pull-ready")&&!f?v():u())}function m(p){!c||!p.isPrimary||(c=!1,u())}async function v(){f=!0,n.removeAttribute("data-pull-ready"),n.setAttribute("data-pull-loading",""),n.style.transform=`translateY(${s}px)`,n.style.opacity="1";try{await e()}finally{f=!1,n.removeAttribute("data-pull-loading"),u()}}function u(){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 t.addEventListener("pointerdown",h,{passive:!0}),t.addEventListener("pointermove",d,{passive:!0}),t.addEventListener("pointerup",o,{passive:!0}),t.addEventListener("pointercancel",m,{passive:!0}),()=>{t.removeEventListener("pointerdown",h),t.removeEventListener("pointermove",d),t.removeEventListener("pointerup",o),t.removeEventListener("pointercancel",m),n.remove()}}function $(t,e,i={}){let s=i.duration??500,r=i.hapticFeedback??!0,n=i.blockContextMenu??!0,l=null;function a(h){h.isPrimary&&(l=setTimeout(()=>{r&&x.tap(),e(h),l=null},s))}function c(){l&&(clearTimeout(l),l=null)}function f(h){n&&h.preventDefault()}return t.addEventListener("pointerdown",a,{passive:!0}),t.addEventListener("pointermove",c,{passive:!0}),t.addEventListener("pointerup",c,{passive:!0}),t.addEventListener("pointercancel",c,{passive:!0}),t.addEventListener("contextmenu",f),()=>{c(),t.removeEventListener("pointerdown",a),t.removeEventListener("pointermove",c),t.removeEventListener("pointerup",c),t.removeEventListener("pointercancel",c),t.removeEventListener("contextmenu",f)}}function C(t,e={}){let i=e.threshold??80,s=0,r=0,n=!1;function l(o){if(!o.isPrimary||!t.open)return;let m=o.target;m.closest("a, button, input, select, textarea, [contenteditable]")&&!m.closest("header")||(n=!0,s=o.clientY,r=0,t.setPointerCapture(o.pointerId),t.style.transition="none")}function a(o){if(!n||!o.isPrimary)return;if(r=o.clientY-s,r<=0){t.style.transform="",t.style.opacity="";return}let v=1-Math.min(r/i,1)*.4;t.style.transform=`translateY(${r}px)`,t.style.opacity=String(v)}function c(o){!n||!o.isPrimary||(n=!1,t.releasePointerCapture(o.pointerId),r>=i?h():d())}function f(o){!n||!o.isPrimary||(n=!1,t.releasePointerCapture(o.pointerId),d())}function h(){t.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",t.style.transform="translateY(100%)",t.style.opacity="0",x.dismiss(),t.addEventListener("transitionend",()=>{t.style.transition="",t.style.transform="",t.style.opacity="",t.close("dismiss")},{once:!0})}function d(){t.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",t.style.transform="",t.style.opacity="",t.addEventListener("transitionend",()=>{t.style.transition=""},{once:!0})}return t.addEventListener("pointerdown",l),t.addEventListener("pointermove",a),t.addEventListener("pointerup",c),t.addEventListener("pointercancel",f),()=>{t.removeEventListener("pointerdown",l),t.removeEventListener("pointermove",a),t.removeEventListener("pointerup",c),t.removeEventListener("pointercancel",f)}}function q(t=document){let e=[];for(let i of t.querySelectorAll('[data-gesture="swipe"]'))e.push(D(i));for(let i of t.querySelectorAll('[data-gesture="flick"]'))e.push(N(i));for(let i of t.querySelectorAll('[data-gesture="dismiss"]'))e.push(P(i));for(let i of t.querySelectorAll('[data-gesture="long-press"]'))e.push($(i,()=>{i.dispatchEvent(new CustomEvent("long-press",{bubbles:!0}))}));for(let i of t.querySelectorAll('dialog[data-gesture="dismiss-down"]'))e.push(C(i));return()=>e.forEach(i=>i())}var x,M,F=H(()=>{x={tap:()=>navigator.vibrate?.(8),confirm:()=>navigator.vibrate?.([8,40,8]),error:()=>navigator.vibrate?.([30,60,30]),dismiss:()=>navigator.vibrate?.(15)};M=typeof document<"u"?document.documentElement:null;(!M||!M.hasAttribute("data-vb-gestures-init"))&&(M?.setAttribute("data-vb-gestures-init",""),q())});var R=window.matchMedia("(prefers-reduced-motion: reduce)");var T=new Map;function k(t,e,i={}){let s=i.priority??10,r={impl:e,bundle:i.bundle,contract:i.contract,priority:s},n=T.get(t);if(customElements.get(t)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> 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 <${t}> already registered by "${n.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}T.set(t,r),customElements.define(t,e)}var L=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,i,s,r){e.addEventListener(i,s,r),this.#t.push(()=>e.removeEventListener(i,s,r))}setup(){}teardown(){}setState(e,i){this.#e||(this.#e=this.attachInternals());let s=this.#e.states;try{i?s.add(e):s.delete(e)}catch{let r=`--${e}`;i?s.add(r):s.delete(r)}}_adoptInternals(e){this.#e||(this.#e=e)}};function A(t){return document.startViewTransition?document.startViewTransition(t):t()}var U=0,S=class extends L{#t=[];#e=0;#n=null;#v=null;#i=null;#u=null;#d=null;#h=null;#a=null;#s=null;#c=null;#o="";#l=!1;setup(){return this.#o=`gallery-lb-${++U}`,this.#l=!!document.startViewTransition,this.#f(),this.#t.length===0?!1:(this.listen(this,"click",this.#y),!0)}teardown(){this.#c&&(this.#c(),this.#c=null),this.#n&&(this.#n.remove(),this.#n=null),this.#t=[]}get images(){return this.#t.map(e=>({href:e.href,thumbSrc:e.thumbSrc,alt:e.alt,caption:e.caption}))}set images(e){let i=Array.isArray(e)?e:[];for(let s of[...this.children])(s.tagName==="FIGURE"||s.tagName==="A")&&s.remove();for(let s of i){if(!s?.href||!s?.thumbSrc)continue;let r=s.caption?document.createElement("figure"):document.createElement("a"),n=r.tagName==="FIGURE"?document.createElement("a"):r;n.href=s.href;let l=document.createElement("img");if(l.src=s.thumbSrc,l.alt=s.alt||"",n.appendChild(l),r.tagName==="FIGURE"){r.appendChild(n);let a=document.createElement("figcaption");a.innerHTML=s.caption??"",r.appendChild(a)}this.appendChild(r)}this.#f(),this.dispatchEvent(new CustomEvent("image-gallery:images-changed",{detail:{images:this.images,source:"property"},bubbles:!0}))}open(e){if(e<0||e>=this.#t.length)return;this.#n||this.#b(),this.#p(e);let i=this.#t[e],s=this.getAttribute("transition")||"morph";if(this.#l&&s==="morph"&&this.#i&&this.#n){let r=`gallery-morph-${this.#o}`;i.thumbEl.style.viewTransitionName=r;let n=this.#i,l=this.#n;A(()=>{i.thumbEl.style.viewTransitionName="";let a=n.querySelector("img");a&&(a.style.viewTransitionName=r),l.showModal()}).finished?.then(()=>{let a=n.querySelector("img");a&&(a.style.viewTransitionName="")})}else this.#n?.showModal();this.#m(e)}close(){if(!this.#n?.open)return;let e=this.#t[this.#e],i=this.getAttribute("transition")||"morph";if(this.#l&&i==="morph"&&this.#i&&this.#n){let s=`gallery-morph-${this.#o}`,r=this.#i.querySelector("img");r&&(r.style.viewTransitionName=s);let n=this.#n;A(()=>{r&&(r.style.viewTransitionName=""),e.thumbEl.style.viewTransitionName=s,n.close()}).finished?.then(()=>{e.thumbEl.style.viewTransitionName=""})}else this.#n?.close()}next(){let e=this.hasAttribute("loop");this.#e<this.#t.length-1?this.#r(this.#e+1):e&&this.#r(0)}prev(){let e=this.hasAttribute("loop");this.#e>0?this.#r(this.#e-1):e&&this.#r(this.#t.length-1)}#f(){this.#t=[];for(let e of this.children){let i=e.tagName==="FIGURE",s=i?e.querySelector("a[href]"):e.matches("a[href]")?e:null;if(!s)continue;let r=s.querySelector("img");if(!r)continue;let n=i?e.querySelector("figcaption")?.innerHTML??null:null;this.#t.push({href:s.href,thumbSrc:r.src,alt:r.alt||"",caption:n,thumbEl:r})}}#y=e=>{let s=e.target?.closest("a[href]");if(!s||!this.contains(s))return;let r=s.querySelector("img"),n=this.#t.findIndex(l=>l.thumbEl===r);n!==-1&&(e.preventDefault(),this.open(n))};#b(){let e=document.createElement("dialog");e.id=this.#o,e.className="gallery-lightbox",e.dataset.size="full";let i=this.getAttribute("controls")||"edge";e.dataset.controls=i;let s=document.createElement("header"),r=document.createElement("span");r.className="gallery-counter",r.setAttribute("aria-live","polite"),r.setAttribute("aria-atomic","true"),this.#u=r;let n=document.createElement("button");n.type="button",n.className="gallery-close",n.setAttribute("commandfor",this.#o),n.setAttribute("command","close"),n.setAttribute("aria-label","Close gallery"),n.innerHTML='<icon-wc name="x" size="sm"></icon-wc>',this.listen(n,"click",()=>this.close()),s.append(r);let l=this.getAttribute("captions")||"auto";s.append(n);let a=document.createElement("section");a.className="gallery-stage",this.#v=a;let c=document.createElement("button");c.type="button",c.className="gallery-prev",c.setAttribute("aria-label","Previous image"),c.innerHTML='<icon-wc name="chevron-left" size="sm"></icon-wc>',this.#d=c;let f=document.createElement("figure");f.className="gallery-frame",this.#i=f;let h=document.createElement("button");if(h.type="button",h.className="gallery-next",h.setAttribute("aria-label","Next image"),h.innerHTML='<icon-wc name="chevron-right" size="sm"></icon-wc>',this.#h=h,a.append(c,f,h),l==="auto"){let d=document.createElement("footer");d.className="gallery-caption",d.hidden=!0;let o=document.createElement("button");o.type="button",o.className="gallery-info-btn",o.setAttribute("aria-label","Show image details"),o.setAttribute("aria-expanded","false"),o.innerHTML='<icon-wc name="info" size="sm"></icon-wc>',this.#a=o;let m=document.createElement("div");m.className="gallery-caption-text",m.hidden=!0,d.append(o,m),this.#s=m,e.append(s,a,d),this.listen(o,"click",()=>{let v=!m.hidden;m.hidden=v,o.setAttribute("aria-expanded",String(!v)),o.setAttribute("aria-label",v?"Show image details":"Hide image details")})}else e.append(s,a);this.append(e),this.#n=e,this.listen(c,"click",()=>this.prev()),this.listen(h,"click",()=>this.next()),this.listen(e,"keydown",this.#E),this.listen(e,"click",d=>{d.target===e&&this.close()}),this.listen(e,"close",()=>{let d=this.#t[this.#e];d&&(d.thumbEl.style.viewTransitionName="");let o=this.#i?.querySelector("img");o&&(o.style.viewTransitionName="")}),Promise.resolve().then(()=>(F(),Y)).then(({addSwipeListener:d})=>{this.#c=d(a,{threshold:40}),this.listen(a,"swipe-left",()=>this.next()),this.listen(a,"swipe-right",()=>this.prev())})}#p(e){let i=this.#t[e];this.#e=e;let s=document.createElement("img");if(s.src=i.href,s.alt=i.alt,!this.#i)return;let r=this.#i;r.innerHTML="",r.append(s);let n=this.getAttribute("captions")||"auto";if(n==="overlay"&&i.caption){let l=document.createElement("figcaption");l.innerHTML=i.caption,r.append(l)}else if(n==="auto"){let l=this.#s?.parentElement;this.#s&&this.#a&&l&&(i.caption?(this.#s.innerHTML=i.caption,l.hidden=!1,this.#s.hidden=!0,this.#a.setAttribute("aria-expanded","false"),this.#a.setAttribute("aria-label","Show image details")):(this.#s.innerHTML="",l.hidden=!0))}this.#g()}#r(e){let i=this.getAttribute("transition")||"morph";this.#l&&i!=="none"?A(()=>{this.#p(e)}):this.#p(e),this.#m(e)}#g(){let e=this.hasAttribute("loop"),i=this.#e===0,s=this.#e===this.#t.length-1;this.#d&&(this.#d.disabled=!e&&i),this.#h&&(this.#h.disabled=!e&&s),this.#u&&(this.#u.textContent=`${this.#e+1} of ${this.#t.length}`)}#E=e=>{switch(e.key){case"ArrowLeft":e.preventDefault(),this.prev();break;case"ArrowRight":e.preventDefault(),this.next();break;case"Home":e.preventDefault(),this.#r(0);break;case"End":e.preventDefault(),this.#r(this.#t.length-1);break}};#m(e){let i=s=>{if(s>=0&&s<this.#t.length){let r=new Image;r.src=this.#t[s].href}};i(e-1),i(e+1)}};k("image-gallery",S);export{S as ImageGallery};
1
+ var B=Object.defineProperty;var H=(t,e)=>()=>(t&&(e=t(t=0)),e);var X=(t,e)=>{for(var i in e)B(t,i,{get:e[i],enumerable:!0})};var Y={};X(Y,{addDialogDismiss:()=>C,addFlickListener:()=>N,addLongPress:()=>$,addPullToRefresh:()=>z,addSwipeListener:()=>D,haptic:()=>x,initGestures:()=>q,makeSwipeable:()=>P});function D(t,e={}){let i=e.threshold??50,s=e.restraint??100,r=e.timeout??300,n=e.velocity??.5,l=e.minFlickDistance??10,a,c,f;function h(o){o.isPrimary&&(a=o.clientX,c=o.clientY,f=Date.now())}function d(o){if(!o.isPrimary)return;let m=o.clientX-a,v=o.clientY-c,u=Date.now()-f;if(u>r)return;let p=Math.abs(m),y=Math.abs(v),g=Math.max(p,y),b=u>0?g/u:0,w=b>=n&&g>=l,E;if((p>=i||w&&p>y)&&y<=s?E=m<0?"left":"right":(y>=i||w&&y>p)&&p<=s&&(E=v<0?"up":"down"),E){let I=E==="left"||E==="right"?p:y;t.dispatchEvent(new CustomEvent(`swipe-${E}`,{bubbles:!0,detail:{distance:I,duration:u,velocity:b,flick:w}}))}}return t.addEventListener("pointerdown",h,{passive:!0}),t.addEventListener("pointerup",d,{passive:!0}),()=>{t.removeEventListener("pointerdown",h),t.removeEventListener("pointerup",d)}}function N(t,e={}){let i=e.minDistance??10,s=e.velocity??.6,r=e.timeout??250,n=e.restraint??80,l,a,c;function f(d){d.isPrimary&&(l=d.clientX,a=d.clientY,c=Date.now())}function h(d){if(!d.isPrimary)return;let o=d.clientX-l,m=d.clientY-a,v=Date.now()-c;if(v===0||v>r)return;let u=Math.abs(o),p=Math.abs(m),y=Math.max(u,p);if(y<i)return;let g=y/v;if(g<s)return;let b;if(u>p&&p<=n?b=o<0?"left":"right":p>u&&u<=n&&(b=m<0?"up":"down"),b){let w=b==="left"||b==="right"?u:p;t.dispatchEvent(new CustomEvent(`swipe-${b}`,{bubbles:!0,detail:{distance:w,duration:v,velocity:g,flick:!0}}))}}return t.addEventListener("pointerdown",f,{passive:!0}),t.addEventListener("pointerup",h,{passive:!0}),()=>{t.removeEventListener("pointerdown",f),t.removeEventListener("pointerup",h)}}function P(t,e={}){let i=e.threshold??100,s=e.direction??"horizontal",r=e.removeOnDismiss??!0,n=s==="horizontal",l=0,a=0,c=!1;function f(u){!u.isPrimary||t.hasAttribute("data-dismissed")||(u.preventDefault(),c=!0,l=n?u.clientX:u.clientY,a=0,t.setPointerCapture(u.pointerId),t.setAttribute("data-swiping",""))}function h(u){if(!c||!u.isPrimary)return;a=(n?u.clientX:u.clientY)-l;let y=1-Math.min(Math.abs(a)/i,1)*.5;n?t.style.transform=`translateX(${a}px)`:t.style.transform=`translateY(${a}px)`,t.style.opacity=String(y)}function d(u){!c||!u.isPrimary||(c=!1,t.releasePointerCapture(u.pointerId),t.removeAttribute("data-swiping"),Math.abs(a)>=i?m(a>0?"right":"left"):v())}function o(u){!c||!u.isPrimary||(c=!1,t.releasePointerCapture(u.pointerId),t.removeAttribute("data-swiping"),v())}function m(u){let p=u==="right"?"100%":"-100%";t.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",t.style.transform=n?`translateX(${p})`:`translateY(${p})`,t.style.opacity="0",t.setAttribute("data-dismissed",""),x.dismiss(),t.dispatchEvent(new CustomEvent("swipe-dismiss",{bubbles:!0,detail:{direction:u,distance:Math.abs(a)}})),r&&t.addEventListener("transitionend",()=>t.remove(),{once:!0})}function v(){t.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",t.style.transform="",t.style.opacity="",t.addEventListener("transitionend",()=>{t.style.transition=""},{once:!0})}return t.addEventListener("pointerdown",f),t.addEventListener("pointermove",h),t.addEventListener("pointerup",d),t.addEventListener("pointercancel",o),()=>{t.removeEventListener("pointerdown",f),t.removeEventListener("pointermove",h),t.removeEventListener("pointerup",d),t.removeEventListener("pointercancel",o)}}function z(t,e,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),t.prepend(n);let a=0,c=!1,f=!1;function h(p){!p.isPrimary||f||t.scrollTop<=0&&(a=p.clientY,c=!0)}function d(p){if(!c||!p.isPrimary||f)return;let y=p.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 o(p){!c||!p.isPrimary||(c=!1,n.hasAttribute("data-pull-ready")&&!f?v():u())}function m(p){!c||!p.isPrimary||(c=!1,u())}async function v(){f=!0,n.removeAttribute("data-pull-ready"),n.setAttribute("data-pull-loading",""),n.style.transform=`translateY(${s}px)`,n.style.opacity="1";try{await e()}finally{f=!1,n.removeAttribute("data-pull-loading"),u()}}function u(){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 t.addEventListener("pointerdown",h,{passive:!0}),t.addEventListener("pointermove",d,{passive:!0}),t.addEventListener("pointerup",o,{passive:!0}),t.addEventListener("pointercancel",m,{passive:!0}),()=>{t.removeEventListener("pointerdown",h),t.removeEventListener("pointermove",d),t.removeEventListener("pointerup",o),t.removeEventListener("pointercancel",m),n.remove()}}function $(t,e,i={}){let s=i.duration??500,r=i.hapticFeedback??!0,n=i.blockContextMenu??!0,l=null;function a(h){h.isPrimary&&(l=setTimeout(()=>{r&&x.tap(),e(h),l=null},s))}function c(){l&&(clearTimeout(l),l=null)}function f(h){n&&h.preventDefault()}return t.addEventListener("pointerdown",a,{passive:!0}),t.addEventListener("pointermove",c,{passive:!0}),t.addEventListener("pointerup",c,{passive:!0}),t.addEventListener("pointercancel",c,{passive:!0}),t.addEventListener("contextmenu",f),()=>{c(),t.removeEventListener("pointerdown",a),t.removeEventListener("pointermove",c),t.removeEventListener("pointerup",c),t.removeEventListener("pointercancel",c),t.removeEventListener("contextmenu",f)}}function C(t,e={}){let i=e.threshold??80,s=0,r=0,n=!1;function l(o){if(!o.isPrimary||!t.open)return;let m=o.target;m.closest("a, button, input, select, textarea, [contenteditable]")&&!m.closest("header")||(n=!0,s=o.clientY,r=0,t.setPointerCapture(o.pointerId),t.style.transition="none")}function a(o){if(!n||!o.isPrimary)return;if(r=o.clientY-s,r<=0){t.style.transform="",t.style.opacity="";return}let v=1-Math.min(r/i,1)*.4;t.style.transform=`translateY(${r}px)`,t.style.opacity=String(v)}function c(o){!n||!o.isPrimary||(n=!1,t.releasePointerCapture(o.pointerId),r>=i?h():d())}function f(o){!n||!o.isPrimary||(n=!1,t.releasePointerCapture(o.pointerId),d())}function h(){t.style.transition="transform 0.2s ease-out, opacity 0.2s ease-out",t.style.transform="translateY(100%)",t.style.opacity="0",x.dismiss(),t.addEventListener("transitionend",()=>{t.style.transition="",t.style.transform="",t.style.opacity="",t.close("dismiss")},{once:!0})}function d(){t.style.transition="transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease",t.style.transform="",t.style.opacity="",t.addEventListener("transitionend",()=>{t.style.transition=""},{once:!0})}return t.addEventListener("pointerdown",l),t.addEventListener("pointermove",a),t.addEventListener("pointerup",c),t.addEventListener("pointercancel",f),()=>{t.removeEventListener("pointerdown",l),t.removeEventListener("pointermove",a),t.removeEventListener("pointerup",c),t.removeEventListener("pointercancel",f)}}function q(t=document){let e=[];for(let i of t.querySelectorAll('[data-gesture="swipe"]'))e.push(D(i));for(let i of t.querySelectorAll('[data-gesture="flick"]'))e.push(N(i));for(let i of t.querySelectorAll('[data-gesture="dismiss"]'))e.push(P(i));for(let i of t.querySelectorAll('[data-gesture="long-press"]'))e.push($(i,()=>{i.dispatchEvent(new CustomEvent("long-press",{bubbles:!0}))}));for(let i of t.querySelectorAll('dialog[data-gesture="dismiss-down"]'))e.push(C(i));return()=>e.forEach(i=>i())}var x,M,F=H(()=>{x={tap:()=>navigator.vibrate?.(8),confirm:()=>navigator.vibrate?.([8,40,8]),error:()=>navigator.vibrate?.([30,60,30]),dismiss:()=>navigator.vibrate?.(15)};M=typeof document<"u"?document.documentElement:null;(!M||!M.hasAttribute("data-vb-gestures-init"))&&(M?.setAttribute("data-vb-gestures-init",""),q())});var R=window.matchMedia("(prefers-reduced-motion: reduce)");var T=new Map;function k(t,e,i={}){let s=i.priority??10,r={impl:e,bundle:i.bundle,contract:i.contract,priority:s},n=T.get(t);if(customElements.get(t)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> 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 <${t}> already registered by "${n.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}T.set(t,r),customElements.define(t,e)}var L=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,i,s,r){e.addEventListener(i,s,r),this.#t.push(()=>e.removeEventListener(i,s,r))}_reinit(){for(let e of this.#t)e();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,i){this.#e||(this.#e=this.attachInternals());let s=this.#e.states;try{i?s.add(e):s.delete(e)}catch{let r=`--${e}`;i?s.add(r):s.delete(r)}}_adoptInternals(e){this.#e||(this.#e=e)}};function A(t){return document.startViewTransition?document.startViewTransition(t):t()}var U=0,S=class extends L{#t=[];#e=0;#n=null;#v=null;#i=null;#u=null;#d=null;#h=null;#a=null;#s=null;#c=null;#o="";#l=!1;setup(){return this.#o=`gallery-lb-${++U}`,this.#l=!!document.startViewTransition,this.#f(),this.#t.length===0?!1:(this.listen(this,"click",this.#y),!0)}teardown(){this.#c&&(this.#c(),this.#c=null),this.#n&&(this.#n.remove(),this.#n=null),this.#t=[]}get images(){return this.#t.map(e=>({href:e.href,thumbSrc:e.thumbSrc,alt:e.alt,caption:e.caption}))}set images(e){let i=Array.isArray(e)?e:[];for(let s of[...this.children])(s.tagName==="FIGURE"||s.tagName==="A")&&s.remove();for(let s of i){if(!s?.href||!s?.thumbSrc)continue;let r=s.caption?document.createElement("figure"):document.createElement("a"),n=r.tagName==="FIGURE"?document.createElement("a"):r;n.href=s.href;let l=document.createElement("img");if(l.src=s.thumbSrc,l.alt=s.alt||"",n.appendChild(l),r.tagName==="FIGURE"){r.appendChild(n);let a=document.createElement("figcaption");a.innerHTML=s.caption??"",r.appendChild(a)}this.appendChild(r)}this.#f(),this.dispatchEvent(new CustomEvent("image-gallery:images-changed",{detail:{images:this.images,source:"property"},bubbles:!0}))}open(e){if(e<0||e>=this.#t.length)return;this.#n||this.#b(),this.#p(e);let i=this.#t[e],s=this.getAttribute("transition")||"morph";if(this.#l&&s==="morph"&&this.#i&&this.#n){let r=`gallery-morph-${this.#o}`;i.thumbEl.style.viewTransitionName=r;let n=this.#i,l=this.#n;A(()=>{i.thumbEl.style.viewTransitionName="";let a=n.querySelector("img");a&&(a.style.viewTransitionName=r),l.showModal()}).finished?.then(()=>{let a=n.querySelector("img");a&&(a.style.viewTransitionName="")})}else this.#n?.showModal();this.#m(e)}close(){if(!this.#n?.open)return;let e=this.#t[this.#e],i=this.getAttribute("transition")||"morph";if(this.#l&&i==="morph"&&this.#i&&this.#n){let s=`gallery-morph-${this.#o}`,r=this.#i.querySelector("img");r&&(r.style.viewTransitionName=s);let n=this.#n;A(()=>{r&&(r.style.viewTransitionName=""),e.thumbEl.style.viewTransitionName=s,n.close()}).finished?.then(()=>{e.thumbEl.style.viewTransitionName=""})}else this.#n?.close()}next(){let e=this.hasAttribute("loop");this.#e<this.#t.length-1?this.#r(this.#e+1):e&&this.#r(0)}prev(){let e=this.hasAttribute("loop");this.#e>0?this.#r(this.#e-1):e&&this.#r(this.#t.length-1)}#f(){this.#t=[];for(let e of this.children){let i=e.tagName==="FIGURE",s=i?e.querySelector("a[href]"):e.matches("a[href]")?e:null;if(!s)continue;let r=s.querySelector("img");if(!r)continue;let n=i?e.querySelector("figcaption")?.innerHTML??null:null;this.#t.push({href:s.href,thumbSrc:r.src,alt:r.alt||"",caption:n,thumbEl:r})}}#y=e=>{let s=e.target?.closest("a[href]");if(!s||!this.contains(s))return;let r=s.querySelector("img"),n=this.#t.findIndex(l=>l.thumbEl===r);n!==-1&&(e.preventDefault(),this.open(n))};#b(){let e=document.createElement("dialog");e.id=this.#o,e.className="gallery-lightbox",e.dataset.size="full";let i=this.getAttribute("controls")||"edge";e.dataset.controls=i;let s=document.createElement("header"),r=document.createElement("span");r.className="gallery-counter",r.setAttribute("aria-live","polite"),r.setAttribute("aria-atomic","true"),this.#u=r;let n=document.createElement("button");n.type="button",n.className="gallery-close",n.setAttribute("commandfor",this.#o),n.setAttribute("command","close"),n.setAttribute("aria-label","Close gallery"),n.innerHTML='<icon-wc name="x" size="sm"></icon-wc>',this.listen(n,"click",()=>this.close()),s.append(r);let l=this.getAttribute("captions")||"auto";s.append(n);let a=document.createElement("section");a.className="gallery-stage",this.#v=a;let c=document.createElement("button");c.type="button",c.className="gallery-prev",c.setAttribute("aria-label","Previous image"),c.innerHTML='<icon-wc name="chevron-left" size="sm"></icon-wc>',this.#d=c;let f=document.createElement("figure");f.className="gallery-frame",this.#i=f;let h=document.createElement("button");if(h.type="button",h.className="gallery-next",h.setAttribute("aria-label","Next image"),h.innerHTML='<icon-wc name="chevron-right" size="sm"></icon-wc>',this.#h=h,a.append(c,f,h),l==="auto"){let d=document.createElement("footer");d.className="gallery-caption",d.hidden=!0;let o=document.createElement("button");o.type="button",o.className="gallery-info-btn",o.setAttribute("aria-label","Show image details"),o.setAttribute("aria-expanded","false"),o.innerHTML='<icon-wc name="info" size="sm"></icon-wc>',this.#a=o;let m=document.createElement("div");m.className="gallery-caption-text",m.hidden=!0,d.append(o,m),this.#s=m,e.append(s,a,d),this.listen(o,"click",()=>{let v=!m.hidden;m.hidden=v,o.setAttribute("aria-expanded",String(!v)),o.setAttribute("aria-label",v?"Show image details":"Hide image details")})}else e.append(s,a);this.append(e),this.#n=e,this.listen(c,"click",()=>this.prev()),this.listen(h,"click",()=>this.next()),this.listen(e,"keydown",this.#E),this.listen(e,"click",d=>{d.target===e&&this.close()}),this.listen(e,"close",()=>{let d=this.#t[this.#e];d&&(d.thumbEl.style.viewTransitionName="");let o=this.#i?.querySelector("img");o&&(o.style.viewTransitionName="")}),Promise.resolve().then(()=>(F(),Y)).then(({addSwipeListener:d})=>{this.#c=d(a,{threshold:40}),this.listen(a,"swipe-left",()=>this.next()),this.listen(a,"swipe-right",()=>this.prev())})}#p(e){let i=this.#t[e];this.#e=e;let s=document.createElement("img");if(s.src=i.href,s.alt=i.alt,!this.#i)return;let r=this.#i;r.innerHTML="",r.append(s);let n=this.getAttribute("captions")||"auto";if(n==="overlay"&&i.caption){let l=document.createElement("figcaption");l.innerHTML=i.caption,r.append(l)}else if(n==="auto"){let l=this.#s?.parentElement;this.#s&&this.#a&&l&&(i.caption?(this.#s.innerHTML=i.caption,l.hidden=!1,this.#s.hidden=!0,this.#a.setAttribute("aria-expanded","false"),this.#a.setAttribute("aria-label","Show image details")):(this.#s.innerHTML="",l.hidden=!0))}this.#g()}#r(e){let i=this.getAttribute("transition")||"morph";this.#l&&i!=="none"?A(()=>{this.#p(e)}):this.#p(e),this.#m(e)}#g(){let e=this.hasAttribute("loop"),i=this.#e===0,s=this.#e===this.#t.length-1;this.#d&&(this.#d.disabled=!e&&i),this.#h&&(this.#h.disabled=!e&&s),this.#u&&(this.#u.textContent=`${this.#e+1} of ${this.#t.length}`)}#E=e=>{switch(e.key){case"ArrowLeft":e.preventDefault(),this.prev();break;case"ArrowRight":e.preventDefault(),this.next();break;case"Home":e.preventDefault(),this.#r(0);break;case"End":e.preventDefault(),this.#r(this.#t.length-1);break}};#m(e){let i=s=>{if(s>=0&&s<this.#t.length){let r=new Image;r.src=this.#t[s].href}};i(e-1),i(e+1)}};k("image-gallery",S);export{S as ImageGallery};
2
2
  //# sourceMappingURL=image-gallery.js.map
@@ -1,2 +1,2 @@
1
- var S=window.matchMedia("(prefers-reduced-motion: reduce)");var y=new Map;function b(s,e,i={}){let t=i.priority??10,r={impl:e,bundle:i.bundle,contract:i.contract,priority:t},n=y.get(s);if(customElements.get(s)){if(!n||n.priority>=t){n&&n.priority===t&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=t){n.priority===t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}y.set(s,r),customElements.define(s,e)}var f=class extends HTMLElement{#e=[];#i;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,i,t,r){e.addEventListener(i,t,r),this.#e.push(()=>e.removeEventListener(i,t,r))}setup(){}teardown(){}setState(e,i){this.#i||(this.#i=this.attachInternals());let t=this.#i.states;try{i?t.add(e):t.delete(e)}catch{let r=`--${e}`;i?t.add(r):t.delete(r)}}_adoptInternals(e){this.#i||(this.#i=e)}};var p="http://www.w3.org/2000/svg";function w(s){return s.trim().split(/[\s,]+/).map(Number)}function v(s,e){let i=w(e);switch(s){case"rect":{let[t,r,n,c]=i;return{type:"rect",x:t,y:r,width:n-t,height:c-r}}case"circle":{let[t,r,n]=i;return{type:"circle",cx:t,cy:r,r:n}}case"poly":{let t=[];for(let r=0;r<i.length;r+=2)t.push([i[r],i[r+1]]);return{type:"poly",points:t}}default:return null}}function E(s){if(!s)return null;switch(s.type){case"rect":{let e=document.createElementNS(p,"rect");return e.setAttribute("x",String(s.x)),e.setAttribute("y",String(s.y)),e.setAttribute("width",String(s.width)),e.setAttribute("height",String(s.height)),e}case"circle":{let e=document.createElementNS(p,"circle");return e.setAttribute("cx",String(s.cx)),e.setAttribute("cy",String(s.cy)),e.setAttribute("r",String(s.r)),e}case"poly":{let e=document.createElementNS(p,"polygon");return e.setAttribute("points",s.points.map(i=>i.join(",")).join(" ")),e}default:return null}}function x(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 e=100,i=100,t=0,r=0;for(let[n,c]of s.points)n<e&&(e=n),c<i&&(i=c),n>t&&(t=n),c>r&&(r=c);return{x:e,y:i,width:t-e,height:r-i}}default:return{x:0,y:0,width:0,height:0}}}var m=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")}},g=class extends f{#e=null;#i=null;#t=null;#n=[];#c=[];#r=null;#h=null;#o=null;setup(){if(this.#e=this.querySelector(":scope > img"),!this.#e){let e=this.getAttribute("src"),i=this.getAttribute("alt");if(e)this.#e=document.createElement("img"),this.#e.src=e,this.#e.alt=i||"",this.prepend(this.#e);else return!1}return this.#e.classList.add("image-map-img"),this.#e.complete?this.#u():this.#e.addEventListener("load",()=>this.#u(),{once:!0}),!0}teardown(){this.#h?.disconnect(),this.#s(),this.#i?.remove(),this.#t?.remove();for(let e of this.#c)e.anchor?.remove();this.#c=[],this.#n=[]}get regions(){return[...this.querySelectorAll(":scope > map-area")].map(e=>({shape:e.getAttribute("shape")||void 0,coords:e.getAttribute("coords")||void 0,label:e.getAttribute("label")||e.textContent?.trim()||void 0,href:e.getAttribute("href")||void 0,target:e.getAttribute("target")||void 0}))}set regions(e){let i=Array.isArray(e)?e:[];for(let t of[...this.querySelectorAll(":scope > map-area")])t.remove();for(let t of i){let r=document.createElement("map-area");t.shape&&r.setAttribute("shape",t.shape),t.coords&&r.setAttribute("coords",t.coords),t.label&&r.setAttribute("label",t.label),t.href&&r.setAttribute("href",t.href),t.target&&r.setAttribute("target",t.target),this.appendChild(r)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("image-map:regions-changed",{detail:{regions:i,source:"property"},bubbles:!0}))}#u(){let e=[...this.querySelectorAll(":scope > map-area")];if(e.length===0){this.setAttribute("data-upgraded","");return}this.#i=document.createElementNS(p,"svg"),this.#i.setAttribute("viewBox","0 0 100 100"),this.#i.setAttribute("preserveAspectRatio","none"),this.#i.setAttribute("aria-hidden","true"),this.#i.classList.add("image-map-overlay"),this.#t=document.createElement("div"),this.#t.className="image-map-tooltip",this.#t.setAttribute("role","tooltip"),this.#t.setAttribute("aria-live","polite"),this.#t.id=`imap-tip-${crypto.randomUUID().slice(0,8)}`;for(let i of e){let t=i,r=t.shape,n=t.coords,c=v(r,n),a=E(c);if(!a)continue;let h=x(c),o=t.href?document.createElement("a"):document.createElement("button");t.href&&(o.href=t.href,t.target&&(o.target=t.target)),o.className="image-map-anchor",o.setAttribute("aria-label",t.label),o.setAttribute("aria-describedby",this.#t.id),o.textContent=t.label,o.style.left=`${h.x}%`,o.style.top=`${h.y}%`,o.style.width=`${h.width}%`,o.style.height=`${h.height}%`,t.disabled&&(a.setAttribute("data-disabled",""),o.setAttribute("tabindex","-1"),o.setAttribute("aria-disabled","true"));let d=i.innerHTML,l={area:i,parsed:c,svgShape:a,anchor:o,contentHTML:d};if(!t.disabled){let u=t.tooltipMode;this.listen(a,"pointerenter",()=>{u==="hover"&&this.#a(l),a.setAttribute("data-hover",""),this.#l("image-map:area-enter",t)}),this.listen(a,"pointerleave",()=>{u==="hover"&&this.#s(),a.removeAttribute("data-hover"),this.#l("image-map:area-leave",t)}),this.listen(a,"click",()=>{u==="click"&&(this.#r===l?this.#s():this.#a(l)),this.#l("image-map:area-activate",t),t.href&&u!=="click"&&(t.target==="_blank"?window.open(t.href,"_blank","noopener"):window.location.href=t.href)}),this.listen(a,"touchstart",A=>{u==="hover"&&(this.#o!==l?(A.preventDefault(),this.#o=l,this.#a(l)):this.#o=null)},{passive:!1}),this.listen(o,"focus",()=>{this.#a(l),a.setAttribute("data-hover","")}),this.listen(o,"blur",()=>{this.#s(),a.removeAttribute("data-hover")})}this.#i.appendChild(a),this.#c.push(l),this.#n.push(o)}this.appendChild(this.#i);for(let i of this.#n)this.appendChild(i);this.appendChild(this.#t),this.listen(this,"keydown",this.#f),this.#h=new ResizeObserver(()=>{this.#r&&this.#d(this.#r.svgShape)}),this.#h.observe(this.#e),this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.#e.alt||"Image map"),this.setAttribute("data-upgraded","")}#a(e){this.#t&&(this.#r=e,this.#t.innerHTML=e.contentHTML,this.#t.setAttribute("data-visible",""),this.#d(e.svgShape))}#s(){this.#t&&(this.#r=null,this.#t.removeAttribute("data-visible"))}#d(e){if(!this.#t||!e)return;let i=e.getBoundingClientRect(),t=this.#t.getBoundingClientRect(),r=8,n=8,c=window.innerWidth,a=window.innerHeight,h,o,d=i.top-t.height-r;d>=n?(h=d,o=i.left+(i.width-t.width)/2):i.bottom+r+t.height<=a-n?(h=i.bottom+r,o=i.left+(i.width-t.width)/2):i.right+r+t.width<=c-n?(h=i.top+(i.height-t.height)/2,o=i.right+r):(h=i.top+(i.height-t.height)/2,o=i.left-t.width-r),o=Math.max(n,Math.min(o,c-t.width-n)),h=Math.max(n,Math.min(h,a-t.height-n)),this.#t.style.top=`${h}px`,this.#t.style.left=`${o}px`}#f=e=>{let i=this.#n.filter(r=>!r.hasAttribute("aria-disabled")),t=i.indexOf(document.activeElement);switch(e.key){case"ArrowDown":case"ArrowRight":{e.preventDefault();let r=t<i.length-1?t+1:0;i[r]?.focus();break}case"ArrowUp":case"ArrowLeft":{e.preventDefault();let r=t>0?t-1:i.length-1;i[r]?.focus();break}case"Escape":this.#s(),this.#o=null;break}};#l(e,i){this.dispatchEvent(new CustomEvent(e,{detail:{area:i},bubbles:!0}))}};b("map-area",m);b("image-map",g);export{g as ImageMapWc,m as MapAreaWc};
1
+ var S=window.matchMedia("(prefers-reduced-motion: reduce)");var y=new Map;function b(s,e,i={}){let t=i.priority??10,r={impl:e,bundle:i.bundle,contract:i.contract,priority:t},n=y.get(s);if(customElements.get(s)){if(!n||n.priority>=t){n&&n.priority===t&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=t){n.priority===t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${n.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}y.set(s,r),customElements.define(s,e)}var f=class extends HTMLElement{#t=[];#i;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,i,t,r){e.addEventListener(i,t,r),this.#t.push(()=>e.removeEventListener(i,t,r))}_reinit(){for(let e of this.#t)e();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,i){this.#i||(this.#i=this.attachInternals());let t=this.#i.states;try{i?t.add(e):t.delete(e)}catch{let r=`--${e}`;i?t.add(r):t.delete(r)}}_adoptInternals(e){this.#i||(this.#i=e)}};var p="http://www.w3.org/2000/svg";function w(s){return s.trim().split(/[\s,]+/).map(Number)}function v(s,e){let i=w(e);switch(s){case"rect":{let[t,r,n,h]=i;return{type:"rect",x:t,y:r,width:n-t,height:h-r}}case"circle":{let[t,r,n]=i;return{type:"circle",cx:t,cy:r,r:n}}case"poly":{let t=[];for(let r=0;r<i.length;r+=2)t.push([i[r],i[r+1]]);return{type:"poly",points:t}}default:return null}}function E(s){if(!s)return null;switch(s.type){case"rect":{let e=document.createElementNS(p,"rect");return e.setAttribute("x",String(s.x)),e.setAttribute("y",String(s.y)),e.setAttribute("width",String(s.width)),e.setAttribute("height",String(s.height)),e}case"circle":{let e=document.createElementNS(p,"circle");return e.setAttribute("cx",String(s.cx)),e.setAttribute("cy",String(s.cy)),e.setAttribute("r",String(s.r)),e}case"poly":{let e=document.createElementNS(p,"polygon");return e.setAttribute("points",s.points.map(i=>i.join(",")).join(" ")),e}default:return null}}function x(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 e=100,i=100,t=0,r=0;for(let[n,h]of s.points)n<e&&(e=n),h<i&&(i=h),n>t&&(t=n),h>r&&(r=h);return{x:e,y:i,width:t-e,height:r-i}}default:return{x:0,y:0,width:0,height:0}}}var m=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")}},g=class extends f{#t=null;#i=null;#e=null;#n=[];#h=[];#r=null;#c=null;#o=null;setup(){if(this.#t=this.querySelector(":scope > img"),!this.#t){let e=this.getAttribute("src"),i=this.getAttribute("alt");if(e)this.#t=document.createElement("img"),this.#t.src=e,this.#t.alt=i||"",this.prepend(this.#t);else return!1}return this.#t.classList.add("image-map-img"),this.#t.complete?this.#u():this.#t.addEventListener("load",()=>this.#u(),{once:!0}),!0}teardown(){this.#c?.disconnect(),this.#s(),this.#i?.remove(),this.#e?.remove();for(let e of this.#h)e.anchor?.remove();this.#h=[],this.#n=[]}get regions(){return[...this.querySelectorAll(":scope > map-area")].map(e=>({shape:e.getAttribute("shape")||void 0,coords:e.getAttribute("coords")||void 0,label:e.getAttribute("label")||e.textContent?.trim()||void 0,href:e.getAttribute("href")||void 0,target:e.getAttribute("target")||void 0}))}set regions(e){let i=Array.isArray(e)?e:[];for(let t of[...this.querySelectorAll(":scope > map-area")])t.remove();for(let t of i){let r=document.createElement("map-area");t.shape&&r.setAttribute("shape",t.shape),t.coords&&r.setAttribute("coords",t.coords),t.label&&r.setAttribute("label",t.label),t.href&&r.setAttribute("href",t.href),t.target&&r.setAttribute("target",t.target),this.appendChild(r)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("image-map:regions-changed",{detail:{regions:i,source:"property"},bubbles:!0}))}#u(){let e=[...this.querySelectorAll(":scope > map-area")];if(e.length===0){this.setAttribute("data-upgraded","");return}this.#i=document.createElementNS(p,"svg"),this.#i.setAttribute("viewBox","0 0 100 100"),this.#i.setAttribute("preserveAspectRatio","none"),this.#i.setAttribute("aria-hidden","true"),this.#i.classList.add("image-map-overlay"),this.#e=document.createElement("div"),this.#e.className="image-map-tooltip",this.#e.setAttribute("role","tooltip"),this.#e.setAttribute("aria-live","polite"),this.#e.id=`imap-tip-${crypto.randomUUID().slice(0,8)}`;for(let i of e){let t=i,r=t.shape,n=t.coords,h=v(r,n),a=E(h);if(!a)continue;let c=x(h),o=t.href?document.createElement("a"):document.createElement("button");t.href&&(o.href=t.href,t.target&&(o.target=t.target)),o.className="image-map-anchor",o.setAttribute("aria-label",t.label),o.setAttribute("aria-describedby",this.#e.id),o.textContent=t.label,o.style.left=`${c.x}%`,o.style.top=`${c.y}%`,o.style.width=`${c.width}%`,o.style.height=`${c.height}%`,t.disabled&&(a.setAttribute("data-disabled",""),o.setAttribute("tabindex","-1"),o.setAttribute("aria-disabled","true"));let d=i.innerHTML,l={area:i,parsed:h,svgShape:a,anchor:o,contentHTML:d};if(!t.disabled){let u=t.tooltipMode;this.listen(a,"pointerenter",()=>{u==="hover"&&this.#a(l),a.setAttribute("data-hover",""),this.#l("image-map:area-enter",t)}),this.listen(a,"pointerleave",()=>{u==="hover"&&this.#s(),a.removeAttribute("data-hover"),this.#l("image-map:area-leave",t)}),this.listen(a,"click",()=>{u==="click"&&(this.#r===l?this.#s():this.#a(l)),this.#l("image-map:area-activate",t),t.href&&u!=="click"&&(t.target==="_blank"?window.open(t.href,"_blank","noopener"):window.location.href=t.href)}),this.listen(a,"touchstart",A=>{u==="hover"&&(this.#o!==l?(A.preventDefault(),this.#o=l,this.#a(l)):this.#o=null)},{passive:!1}),this.listen(o,"focus",()=>{this.#a(l),a.setAttribute("data-hover","")}),this.listen(o,"blur",()=>{this.#s(),a.removeAttribute("data-hover")})}this.#i.appendChild(a),this.#h.push(l),this.#n.push(o)}this.appendChild(this.#i);for(let i of this.#n)this.appendChild(i);this.appendChild(this.#e),this.listen(this,"keydown",this.#f),this.#c=new ResizeObserver(()=>{this.#r&&this.#d(this.#r.svgShape)}),this.#c.observe(this.#t),this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.#t.alt||"Image map"),this.setAttribute("data-upgraded","")}#a(e){this.#e&&(this.#r=e,this.#e.innerHTML=e.contentHTML,this.#e.setAttribute("data-visible",""),this.#d(e.svgShape))}#s(){this.#e&&(this.#r=null,this.#e.removeAttribute("data-visible"))}#d(e){if(!this.#e||!e)return;let i=e.getBoundingClientRect(),t=this.#e.getBoundingClientRect(),r=8,n=8,h=window.innerWidth,a=window.innerHeight,c,o,d=i.top-t.height-r;d>=n?(c=d,o=i.left+(i.width-t.width)/2):i.bottom+r+t.height<=a-n?(c=i.bottom+r,o=i.left+(i.width-t.width)/2):i.right+r+t.width<=h-n?(c=i.top+(i.height-t.height)/2,o=i.right+r):(c=i.top+(i.height-t.height)/2,o=i.left-t.width-r),o=Math.max(n,Math.min(o,h-t.width-n)),c=Math.max(n,Math.min(c,a-t.height-n)),this.#e.style.top=`${c}px`,this.#e.style.left=`${o}px`}#f=e=>{let i=this.#n.filter(r=>!r.hasAttribute("aria-disabled")),t=i.indexOf(document.activeElement);switch(e.key){case"ArrowDown":case"ArrowRight":{e.preventDefault();let r=t<i.length-1?t+1:0;i[r]?.focus();break}case"ArrowUp":case"ArrowLeft":{e.preventDefault();let r=t>0?t-1:i.length-1;i[r]?.focus();break}case"Escape":this.#s(),this.#o=null;break}};#l(e,i){this.dispatchEvent(new CustomEvent(e,{detail:{area:i},bubbles:!0}))}};b("map-area",m);b("image-map",g);export{g as ImageMapWc,m as MapAreaWc};
2
2
  //# sourceMappingURL=image-map.js.map
@@ -1,2 +1,2 @@
1
- var h=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function u(n,t,e={}){let r=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:r},s=l.get(n);if(customElements.get(n)){if(!s||s.priority>=r){s&&s.priority===r&&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>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}l.set(n,i),customElements.define(n,t)}var o=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,r,i){t.addEventListener(e,r,i),this.#e.push(()=>t.removeEventListener(e,r,i))}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{e?r.add(t):r.delete(t)}catch{let i=`--${t}`;e?r.add(i):r.delete(i)}}_adoptInternals(t){this.#t||(this.#t=t)}};var a=class extends o{#e;#t;#r=null;#i=!1;setup(){if(this.#i)return;let t=this.getAttribute("src");return t?(this.#r===null&&(this.#r=this.innerHTML),this.hasAttribute("lazy")?this.#n():this.#s(t),!0):!1}teardown(){this.#e?.disconnect(),this.#t?.abort()}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){t==="src"&&r&&e!==r&&this.isConnected&&(this.hasAttribute("lazy")&&!this.#o()?this.#n():this.#s(r))}#o(){let t=this.getBoundingClientRect();return t.top<window.innerHeight+200&&t.bottom>-200}#n(){this.#e?.disconnect(),this.#e=new IntersectionObserver(t=>{for(let e of t)if(e.isIntersecting){this.#e.disconnect();let r=this.getAttribute("src");r&&this.#s(r)}},{rootMargin:"200px"}),this.#e.observe(this)}async#s(t){this.#t?.abort(),this.#t=new AbortController,this.setAttribute("data-loading",""),this.removeAttribute("data-loaded"),this.removeAttribute("data-error");try{let e=await fetch(t,{signal:this.#t.signal});if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);let r=await e.text(),i=this.getAttribute("mode")||"replace";i==="replace"?this.innerHTML=r:i==="append"?this.insertAdjacentHTML("beforeend",r):i==="prepend"&&this.insertAdjacentHTML("afterbegin",r),this.hasAttribute("allow-scripts")?this.querySelectorAll("script").forEach(s=>{let c=document.createElement("script");for(let d of s.attributes)c.setAttribute(d.name,d.value);c.textContent=s.textContent,s.replaceWith(c)}):this.querySelectorAll("script").forEach(s=>s.remove()),this.removeAttribute("data-loading"),this.setAttribute("data-loaded",""),this.#i=!0,this.dispatchEvent(new CustomEvent("include-file:loaded",{bubbles:!0,detail:{src:t,html:r}}))}catch(e){if(e.name==="AbortError")return;this.removeAttribute("data-loading"),this.setAttribute("data-error",""),(this.getAttribute("mode")||"replace")==="replace"&&this.#r!==null&&!this.#i&&(this.innerHTML=this.#r),this.dispatchEvent(new CustomEvent("include-file:error",{bubbles:!0,detail:{src:t,error:e.message}}))}}reload(){let t=this.getAttribute("src");t&&this.#s(t)}};u("include-file",a);export{a as IncludeFile};
1
+ var h=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function u(n,t,e={}){let r=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:r},s=l.get(n);if(customElements.get(n)){if(!s||s.priority>=r){s&&s.priority===r&&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>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}l.set(n,i),customElements.define(n,t)}var o=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let 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)}};var a=class extends o{#t;#e;#r=null;#i=!1;setup(){if(this.#i)return;let t=this.getAttribute("src");return t?(this.#r===null&&(this.#r=this.innerHTML),this.hasAttribute("lazy")?this.#n():this.#s(t),!0):!1}teardown(){this.#t?.disconnect(),this.#e?.abort()}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){t==="src"&&r&&e!==r&&this.isConnected&&(this.hasAttribute("lazy")&&!this.#o()?this.#n():this.#s(r))}#o(){let t=this.getBoundingClientRect();return t.top<window.innerHeight+200&&t.bottom>-200}#n(){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.#s(r)}},{rootMargin:"200px"}),this.#t.observe(this)}async#s(t){this.#e?.abort(),this.#e=new AbortController,this.setAttribute("data-loading",""),this.removeAttribute("data-loaded"),this.removeAttribute("data-error");try{let e=await fetch(t,{signal:this.#e.signal});if(!e.ok)throw new Error(`HTTP ${e.status}: ${e.statusText}`);let r=await e.text(),i=this.getAttribute("mode")||"replace";i==="replace"?this.innerHTML=r:i==="append"?this.insertAdjacentHTML("beforeend",r):i==="prepend"&&this.insertAdjacentHTML("afterbegin",r),this.hasAttribute("allow-scripts")?this.querySelectorAll("script").forEach(s=>{let c=document.createElement("script");for(let d of s.attributes)c.setAttribute(d.name,d.value);c.textContent=s.textContent,s.replaceWith(c)}):this.querySelectorAll("script").forEach(s=>s.remove()),this.removeAttribute("data-loading"),this.setAttribute("data-loaded",""),this.#i=!0,this.dispatchEvent(new CustomEvent("include-file:loaded",{bubbles:!0,detail:{src:t,html:r}}))}catch(e){if(e.name==="AbortError")return;this.removeAttribute("data-loading"),this.setAttribute("data-error",""),(this.getAttribute("mode")||"replace")==="replace"&&this.#r!==null&&!this.#i&&(this.innerHTML=this.#r),this.dispatchEvent(new CustomEvent("include-file:error",{bubbles:!0,detail:{src:t,error:e.message}}))}}reload(){let t=this.getAttribute("src");t&&this.#s(t)}};u("include-file",a);export{a as IncludeFile};
2
2
  //# sourceMappingURL=include-file.js.map