vanilla-breeze 0.5.0 → 0.6.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 (263) hide show
  1. package/custom-elements.json +22381 -13213
  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 +5 -5
  5. package/dist/cdn/components/ai-summary.js +2 -2
  6. package/dist/cdn/components/analytics-panel.js +2 -2
  7. package/dist/cdn/components/audio-player.js +4 -4
  8. package/dist/cdn/components/audio-visualizer.js +2 -2
  9. package/dist/cdn/components/author-index.js +2 -2
  10. package/dist/cdn/components/brand-mark.js +1 -1
  11. package/dist/cdn/components/bread-crumb.js +1 -1
  12. package/dist/cdn/components/calendar-wc.js +2 -2
  13. package/dist/cdn/components/card-list.js +1 -1
  14. package/dist/cdn/components/carousel-wc.js +1 -1
  15. package/dist/cdn/components/change-set.js +1 -1
  16. package/dist/cdn/components/chart-wc.js +6 -6
  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 +51 -50
  23. package/dist/cdn/components/comment-thread.js +50 -49
  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 +170 -54
  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 +6 -2
  45. package/dist/cdn/components/icon-wc.js +11 -10
  46. package/dist/cdn/components/image-gallery.js +1 -1
  47. package/dist/cdn/components/image-map.js +1 -1
  48. package/dist/cdn/components/include-file.js +1 -1
  49. package/dist/cdn/components/manifest.json +101 -101
  50. package/dist/cdn/components/markdown-editor.js +60 -1
  51. package/dist/cdn/components/markdown-viewer.js +50 -49
  52. package/dist/cdn/components/nav-bar.js +1 -1
  53. package/dist/cdn/components/note-wc.js +6 -2
  54. package/dist/cdn/components/notification-wc.js +33 -32
  55. package/dist/cdn/components/page-info.js +6 -72
  56. package/dist/cdn/components/page-stats.js +1 -1
  57. package/dist/cdn/components/page-toc.js +1 -1
  58. package/dist/cdn/components/page-tools.js +1 -1
  59. package/dist/cdn/components/page-tour.js +1 -38
  60. package/dist/cdn/components/pager-wc.js +1 -1
  61. package/dist/cdn/components/poll-wc.js +1 -1
  62. package/dist/cdn/components/pop-over.js +1 -1
  63. package/dist/cdn/components/popularity-index.js +1 -8
  64. package/dist/cdn/components/print-page.js +1 -1
  65. package/dist/cdn/components/progress-tracker.js +1 -1
  66. package/dist/cdn/components/qr-code.js +1 -1
  67. package/dist/cdn/components/reaction-bar.js +1 -1
  68. package/dist/cdn/components/reader-view.js +25 -25
  69. package/dist/cdn/components/reading-progress.js +1 -1
  70. package/dist/cdn/components/recently-visited.js +1 -26
  71. package/dist/cdn/components/score-card.js +21 -5
  72. package/dist/cdn/components/selection-menu.js +1 -1
  73. package/dist/cdn/components/settings-panel.js +88 -142
  74. package/dist/cdn/components/share-wc.js +2 -2
  75. package/dist/cdn/components/short-cuts.js +1 -1
  76. package/dist/cdn/components/site-index.js +1 -10
  77. package/dist/cdn/components/site-map.js +1 -1
  78. package/dist/cdn/components/site-search.js +1 -51
  79. package/dist/cdn/components/slide-accept.js +1 -1
  80. package/dist/cdn/components/social-embed.js +1 -1
  81. package/dist/cdn/components/split-surface.js +1 -1
  82. package/dist/cdn/components/star-rating.js +1 -1
  83. package/dist/cdn/components/status-wc.js +1 -1
  84. package/dist/cdn/components/stepper-wc.js +1 -1
  85. package/dist/cdn/components/tab-set.js +1 -1
  86. package/dist/cdn/components/text-reader.js +2 -2
  87. package/dist/cdn/components/theme-picker.js +86 -83
  88. package/dist/cdn/components/time-index.js +1 -11
  89. package/dist/cdn/components/time-picker.js +1 -1
  90. package/dist/cdn/components/toast-msg.js +6 -6
  91. package/dist/cdn/components/tool-tip.js +1 -1
  92. package/dist/cdn/components/topic-map.js +6 -3
  93. package/dist/cdn/components/trust-filter.js +1 -3
  94. package/dist/cdn/components/version-switcher.js +5 -5
  95. package/dist/cdn/components/video-player.js +67 -9
  96. package/dist/cdn/components/watch-wc.js +6 -2
  97. package/dist/cdn/components/week-view.js +1 -1
  98. package/dist/cdn/components/youtube-player.js +1 -1
  99. package/dist/cdn/emoji-extended.js +2 -0
  100. package/dist/cdn/fonts/atkinson-hyperlegible-OFL.txt +93 -0
  101. package/dist/cdn/fonts/atkinson-hyperlegible-latin-400-italic.woff2 +0 -0
  102. package/dist/cdn/fonts/atkinson-hyperlegible-latin-400-normal.woff2 +0 -0
  103. package/dist/cdn/fonts/atkinson-hyperlegible-latin-700-italic.woff2 +0 -0
  104. package/dist/cdn/fonts/atkinson-hyperlegible-latin-700-normal.woff2 +0 -0
  105. package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-400-italic.woff2 +0 -0
  106. package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2 +0 -0
  107. package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-700-italic.woff2 +0 -0
  108. package/dist/cdn/fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2 +0 -0
  109. package/dist/cdn/fonts/latinmodern-math-GUST-LICENSE.txt +30 -0
  110. package/dist/cdn/fonts/latinmodern-math.woff2 +0 -0
  111. package/dist/cdn/fonts/math-fonts.css +14 -0
  112. package/dist/cdn/packs/effects.full.css +1 -1
  113. package/dist/cdn/packs/effects.full.js +1 -1
  114. package/dist/cdn/packs/fonts-display.full.css +1 -1
  115. package/dist/cdn/packs/fonts-display.theme.css +1 -1
  116. package/dist/cdn/packs/icons.bundle.js +1 -1
  117. package/dist/cdn/packs/icons.full.css +1 -1
  118. package/dist/cdn/packs/icons.theme.css +1 -1
  119. package/dist/cdn/packs/journal.effects.css +1 -1
  120. package/dist/cdn/packs/journal.full.css +1 -1
  121. package/dist/cdn/packs/kawaii.effects.css +1 -1
  122. package/dist/cdn/packs/kawaii.full.css +2 -2
  123. package/dist/cdn/packs/kawaii.full.js +4 -4
  124. package/dist/cdn/packs/kawaii.theme.css +1 -1
  125. package/dist/cdn/packs/manifest.json +17 -17
  126. package/dist/cdn/packs/memphis.full.css +1 -1
  127. package/dist/cdn/packs/memphis.theme.css +1 -1
  128. package/dist/cdn/packs/ui.full.css +1 -1
  129. package/dist/cdn/packs/ui.full.js +89 -86
  130. package/dist/cdn/themes/8bit.css +1 -1
  131. package/dist/cdn/themes/8bit.tokens.json +1 -1
  132. package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
  133. package/dist/cdn/themes/alpha1999.css +1 -1
  134. package/dist/cdn/themes/alpha1999.tokens.json +1 -1
  135. package/dist/cdn/themes/art-deco-dark.tokens.json +1 -1
  136. package/dist/cdn/themes/art-deco.css +1 -1
  137. package/dist/cdn/themes/art-deco.tokens.json +1 -1
  138. package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
  139. package/dist/cdn/themes/bauhaus.css +1 -1
  140. package/dist/cdn/themes/bauhaus.tokens.json +1 -1
  141. package/dist/cdn/themes/brutalist-dark.tokens.json +1 -1
  142. package/dist/cdn/themes/brutalist.css +1 -1
  143. package/dist/cdn/themes/brutalist.tokens.json +1 -1
  144. package/dist/cdn/themes/catppuccin-frappe.css +1 -1
  145. package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
  146. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
  147. package/dist/cdn/themes/catppuccin-latte.css +1 -1
  148. package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
  149. package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
  150. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
  151. package/dist/cdn/themes/catppuccin-mocha.css +1 -1
  152. package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
  153. package/dist/cdn/themes/classic-dark.tokens.json +1 -1
  154. package/dist/cdn/themes/classic.css +1 -1
  155. package/dist/cdn/themes/classic.tokens.json +1 -1
  156. package/dist/cdn/themes/claymorphism-dark.tokens.json +1 -1
  157. package/dist/cdn/themes/claymorphism.css +1 -1
  158. package/dist/cdn/themes/claymorphism.tokens.json +2 -1
  159. package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
  160. package/dist/cdn/themes/clinical.css +1 -1
  161. package/dist/cdn/themes/clinical.tokens.json +1 -1
  162. package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
  163. package/dist/cdn/themes/cottagecore.css +1 -1
  164. package/dist/cdn/themes/cottagecore.tokens.json +1 -1
  165. package/dist/cdn/themes/cyber.css +1 -1
  166. package/dist/cdn/themes/cyber.tokens.json +1 -1
  167. package/dist/cdn/themes/dawn-dark.tokens.json +1 -1
  168. package/dist/cdn/themes/dawn.css +1 -1
  169. package/dist/cdn/themes/dawn.tokens.json +1 -1
  170. package/dist/cdn/themes/dracula.css +1 -1
  171. package/dist/cdn/themes/dracula.tokens.json +1 -1
  172. package/dist/cdn/themes/dusk.css +1 -1
  173. package/dist/cdn/themes/dusk.tokens.json +1 -1
  174. package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
  175. package/dist/cdn/themes/editorial.css +1 -1
  176. package/dist/cdn/themes/editorial.tokens.json +1 -1
  177. package/dist/cdn/themes/financial-dark.tokens.json +1 -1
  178. package/dist/cdn/themes/financial.css +1 -1
  179. package/dist/cdn/themes/financial.tokens.json +1 -1
  180. package/dist/cdn/themes/genai.css +1 -1
  181. package/dist/cdn/themes/genai.tokens.json +1 -1
  182. package/dist/cdn/themes/glassmorphism-dark.tokens.json +1 -1
  183. package/dist/cdn/themes/glassmorphism.css +1 -1
  184. package/dist/cdn/themes/glassmorphism.tokens.json +1 -1
  185. package/dist/cdn/themes/government-dark.tokens.json +1 -1
  186. package/dist/cdn/themes/government.css +1 -1
  187. package/dist/cdn/themes/government.tokens.json +1 -1
  188. package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
  189. package/dist/cdn/themes/gruvbox.css +1 -1
  190. package/dist/cdn/themes/gruvbox.tokens.json +1 -1
  191. package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
  192. package/dist/cdn/themes/high-noon.css +1 -1
  193. package/dist/cdn/themes/high-noon.tokens.json +1 -1
  194. package/dist/cdn/themes/journal-dark.tokens.json +4 -2
  195. package/dist/cdn/themes/journal.css +1 -1
  196. package/dist/cdn/themes/journal.tokens.json +4 -2
  197. package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
  198. package/dist/cdn/themes/kawaii.css +1 -1
  199. package/dist/cdn/themes/kawaii.tokens.json +1 -1
  200. package/dist/cdn/themes/magna-dark.tokens.json +1 -1
  201. package/dist/cdn/themes/magna.css +1 -1
  202. package/dist/cdn/themes/magna.tokens.json +1 -1
  203. package/dist/cdn/themes/manifest.json +44 -44
  204. package/dist/cdn/themes/midnight.css +1 -1
  205. package/dist/cdn/themes/midnight.tokens.json +1 -1
  206. package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
  207. package/dist/cdn/themes/minimal.css +1 -1
  208. package/dist/cdn/themes/minimal.tokens.json +1 -1
  209. package/dist/cdn/themes/modern-dark.tokens.json +1 -1
  210. package/dist/cdn/themes/modern.css +1 -1
  211. package/dist/cdn/themes/modern.tokens.json +1 -1
  212. package/dist/cdn/themes/nes-dark.tokens.json +7 -2
  213. package/dist/cdn/themes/nes.css +1 -1
  214. package/dist/cdn/themes/nes.tokens.json +1 -1
  215. package/dist/cdn/themes/neumorphism-dark.tokens.json +1 -1
  216. package/dist/cdn/themes/neumorphism.css +1 -1
  217. package/dist/cdn/themes/neumorphism.tokens.json +1 -1
  218. package/dist/cdn/themes/nord-dark.tokens.json +1 -1
  219. package/dist/cdn/themes/nord.css +1 -1
  220. package/dist/cdn/themes/nord.tokens.json +1 -1
  221. package/dist/cdn/themes/organic-dark.tokens.json +1 -1
  222. package/dist/cdn/themes/organic.css +1 -1
  223. package/dist/cdn/themes/organic.tokens.json +1 -1
  224. package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
  225. package/dist/cdn/themes/rose-pine.css +1 -1
  226. package/dist/cdn/themes/rose-pine.tokens.json +1 -1
  227. package/dist/cdn/themes/rough-dark.tokens.json +1 -1
  228. package/dist/cdn/themes/rough.css +1 -1
  229. package/dist/cdn/themes/rough.tokens.json +1 -1
  230. package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
  231. package/dist/cdn/themes/solarized.css +1 -1
  232. package/dist/cdn/themes/solarized.tokens.json +1 -1
  233. package/dist/cdn/themes/startup-dark.tokens.json +1 -1
  234. package/dist/cdn/themes/startup.css +1 -1
  235. package/dist/cdn/themes/startup.tokens.json +1 -1
  236. package/dist/cdn/themes/super2026-dark.tokens.json +1 -1
  237. package/dist/cdn/themes/super2026.css +1 -1
  238. package/dist/cdn/themes/super2026.tokens.json +1 -1
  239. package/dist/cdn/themes/swiss-dark.tokens.json +1 -1
  240. package/dist/cdn/themes/swiss.css +1 -1
  241. package/dist/cdn/themes/swiss.tokens.json +1 -1
  242. package/dist/cdn/themes/terminal.css +1 -1
  243. package/dist/cdn/themes/terminal.tokens.json +1 -1
  244. package/dist/cdn/themes/tokyo-night-dark.tokens.json +1 -1
  245. package/dist/cdn/themes/tokyo-night.css +1 -1
  246. package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
  247. package/dist/cdn/themes/vaporwave-dark.tokens.json +1 -1
  248. package/dist/cdn/themes/vaporwave.css +1 -1
  249. package/dist/cdn/themes/vaporwave.tokens.json +1 -1
  250. package/dist/cdn/themes/win9x-dark.tokens.json +6 -2
  251. package/dist/cdn/themes/win9x.css +1 -1
  252. package/dist/cdn/themes/win9x.tokens.json +3 -1
  253. package/dist/cdn/vanilla-breeze-autoload.js +187 -297
  254. package/dist/cdn/vanilla-breeze-charts.css +1 -1
  255. package/dist/cdn/vanilla-breeze-charts.js +6 -6
  256. package/dist/cdn/vanilla-breeze-core.css +1 -1
  257. package/dist/cdn/vanilla-breeze-core.js +166 -262
  258. package/dist/cdn/vanilla-breeze-dev.js +1 -1
  259. package/dist/cdn/vanilla-breeze-extras.js +272 -130
  260. package/dist/cdn/vanilla-breeze.css +1 -1
  261. package/dist/cdn/vanilla-breeze.js +536 -621
  262. package/dist/cdn/view-transitions.css +2 -0
  263. package/package.json +15 -7
@@ -1,2 +1,2 @@
1
- var S=window.matchMedia("(prefers-reduced-motion: reduce)");var h=new Map;function m(r,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},n=h.get(r);if(customElements.get(r)){if(!n||n.priority>=i){n&&n.priority===i&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=i){n.priority===i&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}h.set(r,s),customElements.define(r,t)}var a=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,i,s){t.addEventListener(e,i,s),this.#t.push(()=>t.removeEventListener(e,i,s))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#e||(this.#e=t)}};var l=new Map,u=new Map;function c(r){if(u.has(r))return u.get(r);let t=new Promise((e,i)=>{let s=document.createElement("script");s.src=r,s.async=!0,s.onload=()=>e(void 0),s.onerror=()=>i(new Error(`Failed to load script: ${r}`)),document.head.appendChild(s)});return u.set(r,t),t}async function d(r,t,e={}){let i=new URLSearchParams({url:t,format:"json",...e}),s=await fetch(`${r}?${i}`);if(!s.ok)throw new Error(`oEmbed error ${s.status}`);return s.json()}function f(r,t){if(r==="light")return"light";if(r==="dark")return"dark";let e=t||document.documentElement,i=getComputedStyle(e).colorScheme||"";if(/\bdark\b/.test(i)&&!/\blight\b/.test(i))return"dark";if(/\blight\b/.test(i)&&!/\bdark\b/.test(i))return"light";let s=document.documentElement.dataset.mode;return s==="dark"?"dark":s==="light"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var b="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",o=class extends a{static register(t,e){l.set(t,e)}#t=null;#e="";#r=null;#n=null;#i=null;setup(){this.#e||(this.#e=this.innerHTML),this.listen(window,"vb:theme-change",()=>{this.#i&&clearTimeout(this.#i),this.#i=setTimeout(()=>{this.#n&&this.getAttribute("state")==="loaded"&&this.#s(this.#n)},100)});let t=this.getAttribute("url");if(!t)return console.warn("social-embed: missing required url attribute"),!1;let e=this.getAttribute("provider"),i=e?l.get(e):[...l.values()].find(n=>n.canHandle?.(t));if(!i){this.setAttribute("state","unsupported");return}if(i.delegatesActivation){this.#s(i);return}this.setAttribute("state","idle");let s=this.getAttribute("activate")??"click";return s==="eager"?this.#s(i):s==="visible"?(this.#t=new IntersectionObserver(n=>{n[0].isIntersecting&&(this.#t?.disconnect(),this.#s(i))},{rootMargin:"200px"}),this.#t.observe(this)):(this.#r=n=>{n.preventDefault(),this.#s(i)},this.addEventListener("click",this.#r,{once:!0}),this.addEventListener("keydown",this.#o),this.setAttribute("tabindex","0"),this.setAttribute("role","button"),this.setAttribute("aria-label","Load embed")),!0}teardown(){this.#t?.disconnect(),this.#i&&(clearTimeout(this.#i),this.#i=null),this.#n=null,this.#r&&(this.removeEventListener("click",this.#r),this.#r=null),this.removeEventListener("keydown",this.#o)}#o=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.click())};async#s(t){this.#n=t,this.removeAttribute("tabindex"),this.removeAttribute("role"),this.removeAttribute("aria-label"),this.#r&&(this.removeEventListener("click",this.#r),this.#r=null),this.removeEventListener("keydown",this.#o);let e=this.getAttribute("url");this.setAttribute("state","loading"),this.#a("Loading embed\u2026");try{let i=f(this.getAttribute("theme")??"auto",this);await t.render(this,e,{theme:i}),this.setAttribute("state","loaded")}catch(i){console.warn("[social-embed] render failed:",i),this.innerHTML=this.#e,this.setAttribute("state","error"),this.#a("Embed failed to load.")}}#a(t){let e=this.querySelector("[data-embed-live]");e||(e=document.createElement("span"),e.setAttribute("data-embed-live",""),e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("style",b),this.prepend(e)),e.textContent=t}};m("social-embed",o);var p="https://embed.bsky.app/oembed",w={canHandle(r){return/bsky\.app\/profile\/[^/]+\/post\//.test(r)},async render(r,t){let e=await d(p,t);r.innerHTML=e.html}};o.register("bluesky",w);var g="https://www.instagram.com/embed.js",y={canHandle(r){return/instagram\.com\/(p|reel|tv)\/[^/]+/.test(r)},async render(r,t){await c(g),r.innerHTML=`<blockquote class="instagram-media" data-instgrm-permalink="${t}" data-instgrm-version="14"><a href="${t}"></a></blockquote>`;let e=window;e.instgrm?.Embeds?.process&&e.instgrm.Embeds.process()}};o.register("instagram",y);var E={canHandle(r){return/^https?:\/\/[^/]+\/@[^/]+\/\d+/.test(r)},async render(r,t){let e=new URL(t).origin,i=await d(`${e}/api/oembed`,t);r.innerHTML=i.html}};o.register("mastodon",E);var v="https://platform.x.com/widgets.js",k={canHandle(r){return/(?:x\.com|twitter\.com)\/[^/]+\/status\/\d+/.test(r)},async render(r,t,{theme:e}){await c(v),r.innerHTML=`<blockquote class="twitter-tweet" data-theme="${e}"><a href="${t}"></a></blockquote>`;let i=window;i.twttr?.widgets?.load&&i.twttr.widgets.load(r)}};o.register("x",k);function A(r){return r.match(/(?:youtube\.com\/(?:watch\?.*v=|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/)?.[1]??null}var M={delegatesActivation:!0,canHandle(r){return/(?:youtube\.com\/(?:watch|shorts\/)|youtu\.be\/)/.test(r)},async render(r,t){let e=A(t);if(!e)throw new Error("Could not parse YouTube video ID");let i=document.createElement("youtube-player");i.dataset.id=e,i.dataset.title=r.dataset.title||"YouTube video",r.innerHTML="",r.appendChild(i)}};o.register("youtube",M);
1
+ var ut=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function b(r,t,e={}){let s=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:s},n=v.get(r);if(customElements.get(r)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=s){n.priority===s&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(r,o),customElements.define(r,t)}var m=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,s,o){t.addEventListener(e,s,o),this.#t.push(()=>t.removeEventListener(e,s,o))}_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 s=this.#e.states;try{e?s.add(t):s.delete(t)}catch{let o=`--${t}`;e?s.add(o):s.delete(o)}}_adoptInternals(t){this.#e||(this.#e=t)}#r(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};var w=new Map;function D(r){let t=w.get(r);if(t)return t;let e=document.createElement("script"),s=new Promise((o,n)=>{e.src=r,e.async=!0,e.onload=()=>o(void 0),e.onerror=()=>{w.delete(r),e.remove(),n(new Error(`Failed to load script: ${r}`))},document.head.appendChild(e)});return w.set(r,s),s}async function I(r,t,e={}){let s=new URLSearchParams({url:t,format:"json",...e}),o=await fetch(`${r}?${s}`);if(!o.ok)throw new Error(`oEmbed error ${o.status}`);return o.json()}function c(r,t){let e;try{e=new URL(String(r??"").trim())}catch{return null}return e.protocol!=="https:"||e.username||e.password||e.port||t&&!t.has(e.hostname)?null:e}var S=new WeakMap,$=r=>S.get(r),z=5e3;function d(r){if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r&&typeof r=="object"?r:null}function x(r,t){let e=Number(t);!Number.isFinite(e)||e<=0||(r.height=String(Math.ceil(Math.min(e,z))))}function l({src:r,title:t,sandbox:e,allow:s="",height:o=400,measure:n,onload:i}){if(!(r instanceof URL)||r.protocol!=="https:")throw new Error("social-embed: embed frames must use an https URL");let a=document.createElement("iframe");return a.setAttribute("sandbox",e.join(" ")),a.setAttribute("referrerpolicy","strict-origin"),a.setAttribute("loading","lazy"),a.setAttribute("title",t),s&&a.setAttribute("allow",s),a.setAttribute("data-embed-frame",""),a.height=String(o),i&&a.addEventListener("load",()=>i(a)),a.src=r.href,S.set(a,{origin:r.origin,measure:n}),a}var f=Object.freeze(["allow-scripts","allow-same-origin","allow-popups","allow-popups-to-escape-sandbox"]),g=()=>String(crypto.getRandomValues(new Uint32Array(1))[0]);var V=new Set(["x.com","www.x.com","mobile.x.com","twitter.com","www.twitter.com","mobile.twitter.com"]),Z=/^\/([A-Za-z0-9_]{1,15})\/status(?:es)?\/(\d{1,25})\/?$/,k="platform.twitter.com";function L(r){let t=c(r,V),e=t&&Z.exec(t.pathname);return e?{user:e[1],id:e[2]}:null}var M={label:"X",themeable:!0,canHandle:r=>!!L(r),frameHost:()=>k,async render(r,t,{theme:e,title:s}){let o=L(t);if(!o)throw new Error("Not an X post URL");let n=new URL(`https://${k}/embed/Tweet.html`);return n.searchParams.set("id",o.id),n.searchParams.set("theme",e),n.searchParams.set("dnt","true"),l({src:n,title:s,sandbox:[...f],allow:"fullscreen",height:360,measure(i){let a=d(i)?.["twttr.embed"];return a?.method==="twttr.private.resize"?a.params?.[0]?.height:null}})}};var j=new Set(["instagram.com","www.instagram.com"]),X=/^\/(?:[A-Za-z0-9_.]{1,30}\/)?(?:p|reel|tv)\/([A-Za-z0-9_-]{5,64})\/?$/,H="www.instagram.com";function T(r){let t=c(r,j),e=t&&X.exec(t.pathname);return e?{id:e[1]}:null}var P={label:"Instagram",canHandle:r=>!!T(r),frameHost:()=>H,async render(r,t,{title:e}){let s=T(t);if(!s)throw new Error("Not an Instagram post URL");return l({src:new URL(`https://${H}/p/${s.id}/embed/`),title:e,sandbox:[...f],height:560,measure(o){let n=d(o);return n?.type==="MEASURE"?n.details?.height:null}})}};var Y=new Set(["bsky.app"]),W=/^\/profile\/([^/]{1,253})\/post\/([A-Za-z0-9._~:-]{1,512})\/?$/,N=/^did:(?:plc:[a-z2-7]{24}|web:[A-Za-z0-9.-]{1,253})$/,J=/^(?=.{1,253}$)(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\.)+[A-Za-z][A-Za-z0-9-]{0,62}$/,U="embed.bsky.app",G="https://public.api.bsky.app/xrpc/com.atproto.identity.resolveHandle";function O(r){let t=c(r,Y),e=t&&W.exec(t.pathname);if(!e)return null;let s=decodeURIComponent(e[1]);return N.test(s)?{actor:s,did:s,rkey:e[2]}:J.test(s)?{actor:s,did:null,rkey:e[2]}:null}async function K(r){let t=await fetch(`${G}?${new URLSearchParams({handle:r})}`);if(!t.ok)throw new Error(`Bluesky handle lookup failed (${t.status})`);let{did:e}=await t.json();if(typeof e!="string"||!N.test(e))throw new Error("Bluesky handle lookup returned no DID");return e}var _={label:"Bluesky",themeable:!0,canHandle:r=>!!O(r),frameHost:()=>U,async render(r,t,{theme:e,title:s}){let o=O(t);if(!o)throw new Error("Not a Bluesky post URL");let n=o.did??await K(o.actor),i=g(),a=new URL(`https://${U}/embed/${n}/app.bsky.feed.post/${o.rkey}`);return a.searchParams.set("id",i),a.searchParams.set("colorMode",e),l({src:a,title:s,sandbox:[...f],height:320,measure(p){let h=d(p);return h?.id===i?h.height:null}})}};var Q='<svg viewBox="0 0 68 48" width="68" height="48" aria-hidden="true" focusable="false"><path d="M66.52 7.74c-.78-2.93-2.49-5.41-5.42-6.19C55.79.13 34 0 34 0S12.21.13 6.9 1.55c-2.93.78-4.64 3.26-5.42 6.19C.06 13.05 0 24 0 24s.06 10.95 1.48 16.26c.78 2.93 2.49 5.41 5.42 6.19C12.21 47.87 34 48 34 48s21.79-.13 27.1-1.55c2.93-.78 4.64-3.26 5.42-6.19C67.94 34.95 68 24 68 24s-.06-10.95-1.48-16.26z" fill="var(--color-error, #f00)"/><path d="M45 24 27 14v20z" fill="#fff"/></svg>',tt={hq:"hqdefault",mq:"mqdefault",sd:"sddefault",maxres:"maxresdefault"},C="YouTube video",et="Play {title}",rt=/^\d+$/;function R(r){return String(r).replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function st(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches||document.documentElement.hasAttribute("data-motion-reduced")}var y=class extends m{#t="";#e=C;setup(){let t=this.getAttribute("video-id");return this.#e=this.getAttribute("title")||C,t?/^[A-Za-z0-9_-]{6,20}$/.test(t)?(this.#t=t,this.hasAttribute("autoplay")&&!st()?this.#c(!1):this.#a(),!0):(console.warn(`youtube-player: invalid video-id ${JSON.stringify(t)}`),!1):(console.warn("youtube-player: missing required video-id attribute"),!1)}#r(t){let e=this.getAttribute(t);return e===null||e===""?null:rt.test(e.trim())?e.trim():(console.warn(`youtube-player: ${t} must be whole seconds, got ${JSON.stringify(e)}`),null)}#i(){let t=new URLSearchParams({autoplay:"1"}),e=this.#r("start");e&&t.set("start",e);let s=this.#r("end");s&&t.set("end",s);let o=this.getAttribute("list");o&&t.set("list",o);let n=this.getAttribute("params");return n&&new URLSearchParams(n).forEach((i,a)=>t.set(a,i)),`https://www.youtube-nocookie.com/embed/${this.#t}?${t}`}#s(t){return`https://i.ytimg.com/vi/${this.#t}/${tt[t]??"hqdefault"}.jpg`}#o(){return(this.getAttribute("data-label-play")||et).replace(/\{title\}/g,this.#e)}#a(){this.setAttribute("state","ready");let t=document.createElement("img");t.alt="",t.loading="lazy",t.decoding="async";let e=this.getAttribute("poster");if(e)t.src=e;else{let o=this.getAttribute("thumbnail")??"hq";if(t.referrerPolicy="no-referrer",t.src=this.#s(o),o==="sd"||o==="maxres"){let n=()=>{t.src=this.#s("hq")};t.addEventListener("error",n,{once:!0}),t.addEventListener("load",()=>{t.naturalWidth<=120&&n()},{once:!0})}}let s=document.createElement("button");s.type="button",s.setAttribute("aria-label",this.#o()),s.innerHTML=Q,s.addEventListener("click",()=>this.#c(!0),{once:!0}),this.replaceChildren(t,s)}#c(t){this.setAttribute("state","active"),this.innerHTML=`<iframe src="${R(this.#i())}" title="${R(this.#e)}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen loading="lazy"></iframe>`,t&&this.querySelector("iframe")?.focus(),this.dispatchEvent(new CustomEvent("youtube-player:activate",{bubbles:!0,detail:{videoId:this.#t,fromUser:t}}))}};b("youtube-player",y);var ot=new Set(["youtube.com","www.youtube.com","m.youtube.com","music.youtube.com","youtube-nocookie.com","www.youtube-nocookie.com","youtu.be"]),nt=/^[A-Za-z0-9_-]{11}$/;function it(r){if(!r)return null;if(/^\d+s?$/.test(r))return parseInt(r,10);let t=/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(r);return!t||!t[0]?null:+(t[1]||0)*3600+ +(t[2]||0)*60+ +(t[3]||0)}function q(r){let t=c(r,ot);if(!t)return null;let e=null;return t.hostname==="youtu.be"?e=t.pathname.slice(1).replace(/\/$/,""):t.pathname==="/watch"?e=t.searchParams.get("v"):e=/^\/(?:shorts|embed|live)\/([^/]+)\/?$/.exec(t.pathname)?.[1]??null,!e||!nt.test(e)?null:{id:e,start:it(t.searchParams.get("t")??t.searchParams.get("start"))}}var F={label:"YouTube",noun:"video",delegatesActivation:!0,canHandle:r=>!!q(r),frameHost:()=>"www.youtube-nocookie.com",async render(r,t,{title:e}){let s=q(t);if(!s)throw new Error("Could not parse YouTube video ID");let o=document.createElement("youtube-player");o.setAttribute("video-id",s.id),o.setAttribute("title",e.replace(/["<>]/g,"")),s.start&&o.setAttribute("start",String(s.start));let n=r.getAttribute("poster");return n&&o.setAttribute("poster",n),o}};var at=/^\/@([A-Za-z0-9_]{1,30})\/(\d{1,25})\/?$/;function A(r){let t=c(r,null);if(!t||!t.hostname.includes("."))return null;let e=at.exec(t.pathname);return e?{origin:t.origin,host:t.hostname,user:e[1],id:e[2]}:null}var B={label:"Mastodon",canHandle:r=>!!A(r),frameHost:r=>A(r)?.host??"",async render(r,t,{title:e}){let s=A(t);if(!s)throw new Error("Not a Mastodon post URL");let o=Number(g());return l({src:new URL(`${s.origin}/@${s.user}/${s.id}/embed`),title:e,sandbox:["allow-scripts","allow-same-origin","allow-popups"],allow:"fullscreen",height:320,onload(n){n.contentWindow?.postMessage({type:"setHeight",id:o},s.origin)},measure(n){let i=d(n);return i?.type==="setHeight"&&i.id===o?i.height:null}})}};var u=new Map;u.set("x",M);u.set("instagram",P);u.set("bluesky",_);u.set("youtube",F);u.set("mastodon",B);var ct={load:"Load {provider} {noun}",loading:"Loading {provider} {noun}\u2026",error:"{provider} {noun} failed to load.",note:"Loads content from {host}"};function lt(r,t){if(r==="light"||r==="dark")return r;let e=getComputedStyle(t).colorScheme||"";if(/\bdark\b/.test(e)&&!/\blight\b/.test(e))return"dark";if(/\blight\b/.test(e)&&!/\bdark\b/.test(e))return"light";let s=document.documentElement.dataset.mode;return s==="dark"||s==="light"?s:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var E=class r extends m{static register(t,e){u.set(t,e);for(let s of document.querySelectorAll('social-embed[state="unsupported"]'))s instanceof r&&s._reinit()}#t=null;#e=null;#r=null;#i="";#s=null;#o=null;#a=!1;setup(){this.#e||(this.#e=[...this.childNodes].filter(i=>!(i instanceof Element&&i.matches("[data-embed-live], [data-embed-facade]"))).map(i=>i.cloneNode(!0)));let t=this.getAttribute("url");if(!t)return console.warn("social-embed: missing required url attribute"),!1;let e=this.getAttribute("state");if(this.#r&&(e==="loaded"||e==="loading"))return this.#c(),!0;let s=this.getAttribute("provider"),o=s?u.get(s):[...u.values()].find(i=>i.canHandle?.(t));if(o&&s&&o.canHandle&&!o.canHandle(t)&&(o=void 0),this.#h(),!o)return this.setAttribute("state","unsupported"),!0;if(this.#i=s||[...u].find(([,i])=>i===o)?.[0]||"",o.delegatesActivation)return this.#l(o,!1),!0;this.setAttribute("state","idle"),this.#d(o,t);let n=this.getAttribute("activate")??"click";return n==="eager"?this.#l(o,!1):n==="visible"&&(this.#t=new IntersectionObserver(i=>{i.some(a=>a.isIntersecting)&&(this.#t?.disconnect(),this.#t=null,this.#l(o,!1))},{rootMargin:"200px"}),this.#t.observe(this)),!0}teardown(){this.#t?.disconnect(),this.#t=null,this.#s&&(clearTimeout(this.#s),this.#s=null),this.#a=!1}#c(){this.#a||(this.#a=!0,this.listen(window,"message",t=>{for(let e of this.querySelectorAll("iframe[data-embed-frame]")){let s=e,o=$(s);!o?.measure||t.source!==s.contentWindow||t.origin!==o.origin||x(s,o.measure(t.data))}}),this.listen(window,"vb:theme-change",()=>{this.#r?.themeable&&(this.#s&&clearTimeout(this.#s),this.#s=setTimeout(()=>{this.#s=null,this.#r?.themeable&&this.getAttribute("state")==="loaded"&&this.#l(this.#r,!1)},100))}))}#n(t,e,s={}){let o={provider:e.label??this.#i,noun:e.noun??"post",...s};return(this.getAttribute(`data-label-${t}`)??ct[t]).replace(/\{(\w+)\}/g,(i,a)=>a in o?o[a]:i)}#d(t,e,s=!1){this.#h();let o=document.createElement("p");o.setAttribute("data-embed-facade","");let n=document.createElement("button");n.type="button",n.setAttribute("data-embed-load",""),n.textContent=this.#n("load",t),n.addEventListener("click",()=>this.#l(t,!0));let i=document.createElement("small");i.setAttribute("data-embed-note","");let a="";try{a=t.frameHost?.(e)??""}catch{}i.textContent=s?this.#n("error",t):a?this.#n("note",t,{host:a}):"",o.append(n," ",i),this.append(o),this.#o=n}#h(){for(let t of this.querySelectorAll(":scope > [data-embed-facade]"))t.remove();this.#o=null}async#l(t,e){if(this.getAttribute("state")==="loading")return;let s=this.getAttribute("state")!=="loaded";this.#r=t,this.#c(),this.#t?.disconnect(),this.#t=null;let o=this.getAttribute("url"),n=e||this.contains(document.activeElement);this.setAttribute("state","loading"),this.#o&&(this.#o.setAttribute("aria-disabled","true"),this.#o.textContent=this.#n("loading",t)),s&&!t.delegatesActivation&&this.#u(this.#n("loading",t));try{let i=this.dataset.title||`${t.label??this.#i} ${t.noun??"post"}`,a=lt(this.getAttribute("theme")??"auto",this),p=await t.render(this,o,{theme:a,title:i});if(p instanceof Node&&this.replaceChildren(...[this.querySelector(":scope > [data-embed-live]")].filter(h=>!!h),p),this.#o=null,this.setAttribute("state","loaded"),s&&!t.delegatesActivation&&this.#u(""),n){let h=this.querySelector("iframe, youtube-player button");h?h.focus():(this.setAttribute("tabindex","-1"),this.focus())}}catch(i){console.warn("[social-embed] render failed:",i),this.replaceChildren(...(this.#e??[]).map(a=>a.cloneNode(!0))),this.setAttribute("state","error"),this.#d(t,o,!0),this.#u(this.#n("error",t)),n&&this.#o?.focus()}}#u(t){let e=this.querySelector(":scope > [data-embed-live]");e||(e=document.createElement("span"),e.setAttribute("data-embed-live",""),e.setAttribute("role","status"),this.prepend(e)),e.textContent=t}};b("social-embed",E);export{u as PROVIDERS,E as SocialEmbed,l as createEmbedFrame,I as fetchOEmbed,D as loadScript};
2
2
  //# sourceMappingURL=social-embed.js.map
@@ -1,2 +1,2 @@
1
- var v=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function m(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=p.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}p.set(s,n),customElements.define(s,t)}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 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.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#e||(this.#e=t)}};function w(){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 c="__vbStoreBackend",u=globalThis;function o(){return u[c]||(u[c]=w()),u[c]}function d(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 y(s){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${s}:`}function b(s){try{let t=JSON.parse(s);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var a={configure(s={}){u[c]=s.backend??null},async set(s,t,e){let i={data:e,timestamp:Date.now()};await o().setRaw(d(s,t),JSON.stringify(i))},async get(s,t,e){let i=await o().getRaw(d(s,t));if(i==null)return null;let n=b(i);return!n||e?.maxAge!=null&&Date.now()-n.timestamp>e.maxAge?null:n.data},async remove(s,t){await o().removeRaw(d(s,t))},async list(s){let t=y(s),e=await o().keys(t),i=[];for(let n of e){let r=await o().getRaw(n);if(r==null)continue;let h=b(r);h&&i.push({key:n.slice(t.length),data:h.data,timestamp:h.timestamp})}return i},async clear(s){let t=y(s),e=await o().keys(t);for(let i of e)await o().removeRaw(i)},async clearAll(){let s=await o().keys("vb:");for(let t of s)await o().removeRaw(t)},async setMany(s,t){for(let[e,i]of t)await a.set(s,e,i)}};if(typeof window<"u"){let s=window.VB??(window.VB={});s.store??=a}var f=class extends l{#t;#e;#o;#n=50;#i=!1;#u=50;get#a(){return this.getAttribute("direction")==="vertical"}get#l(){let t=this.getAttribute("min"),e=Number(t);return t!==null&&!isNaN(e)?e:10}get#c(){let t=this.getAttribute("max"),e=Number(t);return t!==null&&!isNaN(e)?e:90}get position(){return this.#n}set position(t){this.#s(Number(t))}get collapsed(){return this.#i}set collapsed(t){t?this.#f():this.#p()}reset(){let t=this.getAttribute("position"),e=Number(t),i=t!==null&&!isNaN(e)?e:50;this.#i=!1,this.#s(i),this.#g()}setup(){let t=[...this.children].filter(e=>!e.classList.contains("split-divider"));return t.length<2?!1:(this.#e=t[0],this.#o=t[1],this.#m(),!0)}async#m(){let t=this.getAttribute("position"),e=Number(t),i=t!==null&&!isNaN(e)?e:null,n=await this.#v(),r=i??n??50;return this.#t=document.createElement("div"),this.#t.className="split-divider",this.#t.setAttribute("role","separator"),this.#t.setAttribute("aria-orientation",this.#a?"vertical":"horizontal"),this.#t.setAttribute("aria-valuenow",String(Math.round(r))),this.#t.setAttribute("aria-valuemin",String(this.#l)),this.#t.setAttribute("aria-valuemax",String(this.#c)),this.#t.setAttribute("aria-label","Resize panels"),this.#t.setAttribute("tabindex","0"),this.insertBefore(this.#t,this.#o),this.#s(r),this.listen(this.#t,"pointerdown",this.#y),this.listen(this.#t,"keydown",this.#b),this.hasAttribute("collapsible")&&this.listen(this.#t,"dblclick",this.#w),!0}teardown(){this.#t&&(this.#t.remove(),this.#t=null)}#y=t=>{t.preventDefault(),this.setState("divider-dragging",!0),this.#t.setPointerCapture(t.pointerId),this.#t.addEventListener("pointermove",this.#h),this.#t.addEventListener("pointerup",this.#d)};#h=t=>{if(!this.matches(":state(divider-dragging)"))return;let e=this.getBoundingClientRect(),i;this.#a?i=(t.clientY-e.top)/e.height*100:i=(t.clientX-e.left)/e.width*100,this.#i&&(this.#i=!1),this.#s(i)};#d=t=>{this.setState("divider-dragging",!1),this.#t.releasePointerCapture(t.pointerId),this.#t.removeEventListener("pointermove",this.#h),this.#t.removeEventListener("pointerup",this.#d),this.#r()};#b=t=>{let e=t.shiftKey?10:1,i=this.#n,n=this.#a?["ArrowUp"]:["ArrowLeft"],r=this.#a?["ArrowDown"]:["ArrowRight"];n.includes(t.key)?(t.preventDefault(),this.#s(i-e),this.#r()):r.includes(t.key)?(t.preventDefault(),this.#s(i+e),this.#r()):t.key==="Home"?(t.preventDefault(),this.#s(this.#l),this.#r()):t.key==="End"&&(t.preventDefault(),this.#s(this.#c),this.#r())};#w=()=>{this.#i?this.#p():this.#f(),this.#r()};#f(){this.#u=this.#n,this.#i=!0,this.#e.style.flexBasis="0%",this.#e.style.overflow="hidden",this.#t.setAttribute("aria-valuenow","0"),this.#n=0,this.dispatchEvent(new CustomEvent("split-surface:collapse",{detail:{collapsed:!0},bubbles:!0}))}#p(){this.#i=!1,this.#e.style.overflow="auto",this.#s(this.#u),this.dispatchEvent(new CustomEvent("split-surface:collapse",{detail:{collapsed:!1},bubbles:!0}))}#s(t){let e=this.#i?0:Math.min(this.#c,Math.max(this.#l,t));this.#n=e,this.#e.style.flexBasis=`${e}%`,this.#e.style.flexGrow="0",this.#e.style.flexShrink="0",this.#e.style.overflow="auto",this.#o.style.flexGrow="1",this.#o.style.overflow="auto",this.#t.setAttribute("aria-valuenow",String(Math.round(e))),this.dispatchEvent(new CustomEvent("split-surface:resize",{detail:{position:e},bubbles:!0}))}async#v(){let t=this.getAttribute("persist");if(!t)return null;let e=await a.get("layout",`split:${t}`);return typeof e=="number"?e:null}#r(){let t=this.getAttribute("persist");t&&a.set("layout",`split:${t}`,Math.round(this.#n)).catch(()=>{})}#g(){let t=this.getAttribute("persist");t&&a.remove("layout",`split:${t}`).catch(()=>{})}};m("split-surface",f);export{f as SplitSurface};
1
+ var k=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function y(i,t,e={}){let s=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:s},n=m.get(i);if(customElements.get(i)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=s){n.priority===s&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}m.set(i,r),customElements.define(i,t)}var c=class extends HTMLElement{#t=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,s,r){t.addEventListener(e,s,r),this.#t.push(()=>t.removeEventListener(e,s,r))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#i||(this.#i=this.attachInternals());let s=this.#i.states;try{e?s.add(t):s.delete(t)}catch{let r=`--${t}`;e?s.add(r):s.delete(r)}}_adoptInternals(t){this.#i||(this.#i=t)}#s(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#s()?.validity}get validationMessage(){return this.#s()?.validationMessage??""}get willValidate(){return this.#s()?.willValidate??!1}get form(){return this.#s()?.form??null}checkValidity(){return this.#s()?.checkValidity()??!0}reportValidity(){return this.#s()?.reportValidity()??!0}};function w(){let i=globalThis.localStorage;if(!i)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return i.getItem(t)},async setRaw(t,e){i.setItem(t,e)},async removeRaw(t){i.removeItem(t)},async keys(t){let e=[];for(let s=0;s<i.length;s++){let r=i.key(s);r&&r.startsWith(t)&&e.push(r)}return e}}}var u="__vbStoreBackend",d=globalThis;function a(){return d[u]||(d[u]=w()),d[u]}function f(i,t){if(typeof i!="string"||!i)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${i}:${t}`}function g(i){if(typeof i!="string"||!i)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${i}:`}function v(i){try{let t=JSON.parse(i);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var l={configure(i={}){d[u]=i.backend??null},async set(i,t,e){let s={data:e,timestamp:Date.now()};await a().setRaw(f(i,t),JSON.stringify(s))},async get(i,t,e){let s=await a().getRaw(f(i,t));if(s==null)return null;let r=v(s);return!r||e?.maxAge!=null&&Date.now()-r.timestamp>e.maxAge?null:r.data},async remove(i,t){await a().removeRaw(f(i,t))},async list(i){let t=g(i),e=await a().keys(t),s=[];for(let r of e){let n=await a().getRaw(r);if(n==null)continue;let o=v(n);o&&s.push({key:r.slice(t.length),data:o.data,timestamp:o.timestamp})}return s},async clear(i){let t=g(i),e=await a().keys(t);for(let s of e)await a().removeRaw(s)},async clearAll(){let i=await a().keys("vb:");for(let t of i)await a().removeRaw(t)},async setMany(i,t){for(let[e,s]of t)await l.set(i,e,s)}};if(typeof window<"u"){let i=window.VB??(window.VB={});i.store??=l}var E=0;function p(i,t){if(i===null||i.trim()==="")return t;let e=Number(i);return Number.isFinite(e)?e:t}var b=class extends c{static observedAttributes=["position","min","max","direction","collapsible","data-label-resize","data-label-collapsed"];#t=null;#i;#s;#r=50;#e=!1;#a=50;#b=!1;#n={};#m=0;get#c(){return this.getAttribute("direction")==="vertical"}get#k(){return getComputedStyle(this).direction==="rtl"}get#y(){return p(this.getAttribute("min"),10)}get#g(){return p(this.getAttribute("max"),90)}get#u(){return this.hasAttribute("collapsible")}get#d(){return p(this.getAttribute("position"),50)}get position(){return this.#t?this.#r:this.#n.position??this.#r}set position(t){let e=Number(t);if(Number.isFinite(e)){if(!this.#t){this.#n.position=e,delete this.#n.reset;return}this.#e&&this.#h(),this.#o(e,"api")}}get collapsed(){return this.#t?this.#e:this.#n.collapsed??this.#e}set collapsed(t){if(!this.#t){this.#n.collapsed=!!t;return}t?this.#E("api"):this.#f("api")}reset(){if(!this.#t){this.#n={reset:!0},this.#$();return}this.#e&&this.#h(),this.#o(this.#d,"api"),this.#$()}setup(){for(let e of this.querySelectorAll(":scope > .split-divider"))e.remove();let t=[...this.children].filter(e=>!e.classList.contains("split-divider"));return t.length<2?!1:(this.#i=t[0],this.#s=t[1],this.#C(++this.#m),!0)}async#C(t){let e=null;if(this.#b||(e=await this.#P()),t!==this.#m||!this.isConnected)return!1;let s=this.#i,r=document.createElement("div");r.className="split-divider",r.setAttribute("role","separator"),s.id||(s.id=`vb-split-panel-${++E}`),r.setAttribute("aria-controls",s.id),r.setAttribute("tabindex","0"),this.#t=r,this.#A(),this.insertBefore(r,this.#s),this.listen(r,"pointerdown",this.#B),this.listen(r,"keydown",this.#M),this.listen(r,"dblclick",this.#L);let n=this.#e?this.#a:this.#r,o=this.#e;this.#b||(n=e?.position??this.#d,o=!!e?.collapsed&&this.#u);let h=this.#n;return this.#n={},h.reset&&(n=this.#d,o=!1),h.position!==void 0&&(n=h.position,o=!1),h.collapsed!==void 0&&(o=h.collapsed),this.#b=!0,this.#h(),o?(this.#a=this.#v(n),this.#x()):this.#o(n,null),!0}teardown(){this.#m++,this.#t&&(this.#t.remove(),this.#t=null)}attributeChangedCallback(t,e,s){if(!(e===s||!this.#t)){if(t==="position"){this.#e?this.#a=this.#v(this.#d):this.#o(this.#d,"attribute");return}t==="collapsible"&&!this.#u&&this.#e&&this.#f("attribute"),this.#A(),!this.#e&&(t==="min"||t==="max")&&this.#o(this.#r,"attribute")}}#v(t){return Math.min(this.#g,Math.max(this.#y,t))}#A(){let t=this.#t;t&&(t.setAttribute("aria-orientation",this.#c?"horizontal":"vertical"),t.setAttribute("aria-valuemin",String(this.#u?0:this.#y)),t.setAttribute("aria-valuemax",String(this.#g)),t.setAttribute("aria-label",this.getAttribute("data-label-resize")||"Resize panels"),this.#w())}#w(){let t=this.#t;if(!t)return;let e=Math.round(this.#r);t.setAttribute("aria-valuenow",String(e)),t.setAttribute("aria-valuetext",this.#e?this.getAttribute("data-label-collapsed")||"Collapsed":`${e}%`)}#B=t=>{if(t.button!==0)return;t.preventDefault();let e=this.#t;this.setState("divider-dragging",!0);try{e.setPointerCapture(t.pointerId)}catch{}e.addEventListener("pointermove",this.#S),e.addEventListener("pointerup",this.#l),e.addEventListener("pointercancel",this.#l),e.addEventListener("lostpointercapture",this.#l)};#S=t=>{if(!this.matches(":state(divider-dragging)"))return;let e=this.getBoundingClientRect(),s;this.#c?s=(t.clientY-e.top)/e.height*100:s=(this.#k?e.right-t.clientX:t.clientX-e.left)/e.width*100,this.#e&&this.#h(),this.#o(s,"pointer")};#l=t=>{if(!this.#t)return;let e=this.matches(":state(divider-dragging)");this.setState("divider-dragging",!1),this.#t.hasPointerCapture(t.pointerId)&&this.#t.releasePointerCapture(t.pointerId),this.#t.removeEventListener("pointermove",this.#S),this.#t.removeEventListener("pointerup",this.#l),this.#t.removeEventListener("pointercancel",this.#l),this.#t.removeEventListener("lostpointercapture",this.#l),e&&this.#p()};#M=t=>{if(t.key==="Enter"){if(!this.#u)return;t.preventDefault(),this.#e?this.#f("keyboard"):this.#E("keyboard"),this.#p();return}let e=t.shiftKey?10:1,s=!this.#c&&this.#k,r=this.#c?"ArrowUp":s?"ArrowRight":"ArrowLeft",n=this.#c?"ArrowDown":s?"ArrowLeft":"ArrowRight",o=null;t.key===r?o=this.#r-e:t.key===n?o=this.#r+e:t.key==="Home"?o=this.#y:t.key==="End"&&(o=this.#g),o!==null&&(t.preventDefault(),this.#e&&(this.#h(),this.dispatchEvent(new CustomEvent("split-surface:collapse",{detail:{collapsed:!1,source:"keyboard"},bubbles:!0}))),this.#o(o,"keyboard"),this.#p())};#L=()=>{this.#u&&(this.#e?this.#f("pointer"):this.#E("pointer"),this.#p())};#E(t){this.#e||!this.#t||(this.#a=this.#r,this.#x(),this.dispatchEvent(new CustomEvent("split-surface:collapse",{detail:{collapsed:!0,source:t},bubbles:!0})))}#x(){let t=this.#i;this.#e=!0,this.#r=0,t.style.flexBasis="0%",t.style.flexGrow="0",t.style.flexShrink="0",t.style.overflow="hidden",t.inert=!0,this.setState("collapsed",!0),this.#w()}#h(){this.#e=!1,this.#i&&(this.#i.inert=!1),this.setState("collapsed",!1)}#f(t){!this.#e||!this.#t||(this.#h(),this.#o(this.#a,null),this.dispatchEvent(new CustomEvent("split-surface:collapse",{detail:{collapsed:!1,source:t},bubbles:!0})))}#o(t,e){if(!Number.isFinite(t)||!this.#i||!this.#s)return;let s=this.#v(t);this.#r=s,this.#i.style.flexBasis=`${s}%`,this.#i.style.flexGrow="0",this.#i.style.flexShrink="0",this.#i.style.overflow="auto",this.#s.style.flexGrow="1",this.#s.style.overflow="auto",this.#w(),e!==null&&this.dispatchEvent(new CustomEvent("split-surface:resize",{detail:{position:s,source:e},bubbles:!0}))}async#P(){let t=this.getAttribute("persist");if(!t)return null;try{let e=await l.get("layout",`split:${t}`);if(e&&typeof e=="object"&&typeof e.position=="number")return e}catch{}return null}#p(){let t=this.getAttribute("persist");if(!t)return;let e=this.#e?{position:Math.round(this.#a),collapsed:!0}:{position:Math.round(this.#r),collapsed:!1};l.set("layout",`split:${t}`,e).catch(()=>{})}#$(){let t=this.getAttribute("persist");t&&l.remove("layout",`split:${t}`).catch(()=>{})}};y("split-surface",b);export{b as SplitSurface};
2
2
  //# sourceMappingURL=split-surface.js.map
@@ -1,2 +1,2 @@
1
- var E=window.matchMedia("(prefers-reduced-motion: reduce)");var y=new Map;function g(l,e,t={}){let r=t.priority??10,a={impl:e,bundle:t.bundle,contract:t.contract,priority:r},i=y.get(l);if(customElements.get(l)){if(!i||i.priority>=r){i&&i.priority===r&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${l}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=r){i.priority===r&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${i.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}y.set(l,a),customElements.define(l,e)}var m=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,t,r,a){e.addEventListener(t,r,a),this.#t.push(()=>e.removeEventListener(t,r,a))}_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,t){this.#i||(this.#i=this.attachInternals());let r=this.#i.states;try{t?r.add(e):r.delete(e)}catch{let a=`--${e}`;t?r.add(a):r.delete(a)}}_adoptInternals(e){this.#i||(this.#i=e)}};var b=class extends m{static formAssociated=!0;#t;#i;#e;constructor(){super(),this.#t=this.attachInternals(),this._adoptInternals(this.#t)}setup(){this.#a()}#a(){if(this.querySelector("fieldset"))return;let e=Number(this.getAttribute("value")||0);this.#i=e;let t=Number(this.getAttribute("max")||5),r=this.getAttribute("label")||"Rating",a=this.hasAttribute("allow-half"),i=this.hasAttribute("readonly"),d=this.getAttribute("icon"),u=`_sr_${this.getAttribute("name")||`star-rating-${crypto.randomUUID().slice(0,8)}`}`;i?this.#c(e,t,r,d):this.#o(e,t,r,u,a,d),this.#r(e),this.#s()}#o(e,t,r,a,i,d){let o=document.createElement("fieldset");o.setAttribute("data-rating",""),i&&o.setAttribute("data-rating-half",""),o.setAttribute("data-effect","rating");let u=document.createElement("legend");if(u.textContent=r,o.appendChild(u),i)for(let s=1;s<=t;s++){let n=s-.5,c=document.createElement("label");c.setAttribute("data-half","left");let h=document.createElement("input");h.type="radio",h.name=a,h.value=String(n),h.setAttribute("aria-label",`${n} ${n===1?"star":"stars"}`),e===n&&(h.checked=!0),c.appendChild(h),c.append(this.#n(d)),o.appendChild(c);let p=document.createElement("label");p.setAttribute("data-half","right");let f=document.createElement("input");f.type="radio",f.name=a,f.value=String(s),f.setAttribute("aria-label",`${s} ${s===1?"star":"stars"}`),e===s&&(f.checked=!0),p.appendChild(f),p.append(this.#n(d)),o.appendChild(p)}else for(let s=1;s<=t;s++){let n=document.createElement("label"),c=document.createElement("input");c.type="radio",c.name=a,c.value=String(s),c.setAttribute("aria-label",`${s} ${s===1?"star":"stars"}`),e===s&&(c.checked=!0),n.appendChild(c),n.append(this.#n(d)),o.appendChild(n)}this.appendChild(o),this.#e=o,o.addEventListener("rating:change",s=>{this.#r(s.detail.value),this.#s()}),o.addEventListener("change",s=>{let n=s.target;n.type==="radio"&&n.checked&&(this.#r(Number(n.value)),this.#s())})}#c(e,t,r,a){let i=document.createElement("fieldset");i.setAttribute("data-rating",""),i.setAttribute("data-rating-readonly",""),i.setAttribute("role","img"),i.setAttribute("aria-label",`${r}: ${e} out of ${t}`);let d=document.createElement("legend");d.textContent=r,i.appendChild(d);let o=Math.floor(e),u=e-o;for(let s=1;s<=t;s++){let n=document.createElement("span");if(n.setAttribute("aria-hidden","true"),s<=o)n.classList.add("star-filled");else if(s===o+1&&u>0){n.classList.add("star-partial"),n.style.setProperty("--_star-fill",`${u*100}%`);let c=document.createElement("span");c.classList.add("star-partial-fill"),c.append(this.#n(a)),n.appendChild(c)}else n.classList.add("star-empty");n.append(this.#n(a)),i.appendChild(n)}this.appendChild(i),this.#e=i}#n(e){if(e){let t=document.createElement("icon-wc");return t.setAttribute("name",e),t}return document.createTextNode("\u2605")}#r(e){let t=Number(e);t>0?this.#t.setFormValue(String(t)):this.#t.setFormValue(null)}#s(){this.hasAttribute("required")?this.#e?.querySelector('input[type="radio"]:checked')?this.#t.setValidity({}):this.#t.setValidity({valueMissing:!0},"Please select a rating",this.#e||this):this.#t.setValidity({})}formResetCallback(){if(this.#e){if(this.#e.querySelectorAll('input[type="radio"]').forEach(e=>{e.checked=!1}),this.#i>0){let e=this.#e.querySelector(`input[value="${this.#i}"]`);e&&(e.checked=!0)}this.#r(this.#i),this.#s()}}formStateRestoreCallback(e){if(!e||!this.#e)return;let t=this.#e.querySelector(`input[value="${e}"]`);t&&(t.checked=!0,this.#r(Number(e)),this.#s())}get value(){if(!this.#e)return Number(this.getAttribute("value")||0);let e=this.#e.querySelector('input[type="radio"]:checked');return e?Number(e.value):0}set value(e){if(!this.#e)return;let t=Number(e),r=this.#e.querySelector('input[type="radio"]:checked');if((r?Number(r.value):0)!==t){if(this.#e.querySelectorAll('input[type="radio"]').forEach(i=>{i.checked=!1}),t>0){let i=this.#e.querySelector(`input[value="${t}"]`);i&&(i.checked=!0)}this.#r(t),this.#s()}}};g("star-rating",b);export{b as StarRating};
1
+ var C=window.matchMedia("(prefers-reduced-motion: reduce)");var y=new Map;function A(n,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=y.get(n);if(customElements.get(n)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> 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 <${n}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}y.set(n,s),customElements.define(n,t)}var b=class extends HTMLElement{#i=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#i)t();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#i.push(()=>t.removeEventListener(e,i,s))}_reinit(){for(let t of this.#i)t();this.#i=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#e||(this.#e=t)}#t(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#t()?.validity}get validationMessage(){return this.#t()?.validationMessage??""}get willValidate(){return this.#t()?.willValidate??!1}get form(){return this.#t()?.form??null}checkValidity(){return this.#t()?.checkValidity()??!0}reportValidity(){return this.#t()?.reportValidity()??!0}};var v="_star-rating-detached",E=new Set(["max","label","readonly","allow-half","icon","data-label-one","data-label-other","data-label-readonly","data-label-cleared"]),m={one:"{n} star",other:"{n} stars",readonly:"{label}: {value} out of {max}",required:"Please select a rating"},k=0;function d(n){let t=Number(n);return Number.isFinite(t)&&t>0?t:0}var g=class extends b{static formAssociated=!0;static get observedAttributes(){return["value","required",...E]}#i;#e=0;#t=null;#r=null;#o=0;#h=`_sr_${++k}`;constructor(){super(),this.#i=this.attachInternals(),this._adoptInternals(this.#i)}setup(){let t=this.querySelector(":scope > fieldset[data-rating]");if(!t||t!==this.#t){if(t){let i=t.querySelector("input:checked");i&&(this.#r??=d(i.value)),t.remove()}this.#f()}let e=this.#t;e&&!this.#s()&&(this.listen(e,"rating:change",()=>this.#a()),this.listen(e,"change",i=>{let s=i.target;s.type==="radio"&&s.checked&&this.#a()})),this.#a()}attributeChangedCallback(t,e,i){e!==i&&(t==="value"&&(this.#e=d(i)),this.#t&&(t==="value"?this.value=d(i):t==="required"?this.#u():this.#c(this.value)))}#s(){return this.hasAttribute("readonly")}#f(){this.#e=d(this.getAttribute("value"));let t=this.#r??this.#e;this.#r=null;let e=Math.max(1,Math.round(d(this.getAttribute("max"))||5)),i=this.getAttribute("label")||"Rating",s=this.getAttribute("icon");this.#s()?(this.#o=t,this.#b(t,e,i,s)):this.#p(t,e,i,this.hasAttribute("allow-half"),s)}#c(t){this.#t?.remove(),this.#t=null,this.#r=t,this.hasAttribute("data-upgraded")&&this._reinit()}#p(t,e,i,s,r){let o=document.createElement("fieldset");o.setAttribute("data-rating",""),s&&o.setAttribute("data-rating-half",""),o.setAttribute("data-effect","rating");let p=this.getAttribute("data-label-cleared");p&&o.setAttribute("data-label-cleared",p);let h=document.createElement("legend");h.textContent=i,o.appendChild(h);let f=(a,l)=>{let c=document.createElement("label");l&&c.setAttribute("data-half",l);let u=document.createElement("input");u.type="radio",u.name=this.#h,u.setAttribute("form",v),u.value=String(a),u.setAttribute("aria-label",this.#m(a)),t===a&&(u.checked=!0),c.appendChild(u),c.append(this.#n(r)),o.appendChild(c)};for(let a=1;a<=e;a++)s?(f(a-.5,"left"),f(a,"right")):f(a,null);this.appendChild(o),this.#t=o}#b(t,e,i,s){let r=document.createElement("fieldset");r.setAttribute("data-rating",""),r.setAttribute("data-rating-readonly",""),r.setAttribute("role","img");let o=this.getAttribute("data-label-readonly")??m.readonly;r.setAttribute("aria-label",o.replaceAll("{label}",i).replaceAll("{value}",this.#l(t)).replaceAll("{max}",this.#l(e)));let p=document.createElement("legend");p.textContent=i,r.appendChild(p);let h=Math.floor(t),f=t-h;for(let a=1;a<=e;a++){let l=document.createElement("span");if(l.setAttribute("aria-hidden","true"),a<=h)l.classList.add("star-filled");else if(a===h+1&&f>0){l.classList.add("star-partial"),l.style.setProperty("--_star-fill",`${f*100}%`);let c=document.createElement("span");c.classList.add("star-partial-fill"),c.append(this.#n(s)),l.appendChild(c)}else l.classList.add("star-empty");l.append(this.#n(s)),r.appendChild(l)}this.appendChild(r),this.#t=r}#n(t){if(t){let e=document.createElement("icon-wc");return e.setAttribute("name",t),e}return document.createTextNode("\u2605")}#d(){return this.closest("[lang]")?.lang||void 0}#l(t){try{return new Intl.NumberFormat(this.#d()).format(t)}catch{return String(t)}}#m(t){let e="other";try{e=new Intl.PluralRules(this.#d()).select(t)}catch{}return(this.getAttribute(`data-label-${e}`)??this.getAttribute("data-label-other")??(e==="one"?m.one:m.other)).replaceAll("{n}",this.#l(t))}#a(){let t=this.value;this.#i.setFormValue(t>0?String(t):null),this.#u()}#u(){let t=this.#t;if(this.hasAttribute("required")&&!this.#s()&&t&&!t.querySelector('input[type="radio"]:checked')){let e=t.querySelector('input[type="radio"]');this.#i.setValidity({valueMissing:!0},this.getAttribute("data-label-required")||m.required,e||t)}else this.#i.setValidity({})}#g(t){let e=this.#t;if(e)for(let i of e.querySelectorAll('input[type="radio"]'))i.checked=t>0&&Number(i.value)===t}formResetCallback(){this.value=this.#e}formStateRestoreCallback(t){typeof t=="string"&&(this.value=d(t))}get value(){let t=this.#t;if(!t)return this.#r??d(this.getAttribute("value"));if(this.#s())return this.#o;let e=t.querySelector('input[type="radio"]:checked');return e?Number(e.value):0}set value(t){let e=d(t);if(!this.#t){this.#r=e;return}if(this.value!==e){if(this.#s()){this.#c(e);return}this.#g(e),this.#a()}}};A("star-rating",g);export{g as StarRating};
2
2
  //# sourceMappingURL=star-rating.js.map
@@ -1,2 +1,2 @@
1
- var u=window.matchMedia("(prefers-reduced-motion: reduce)");var d=new Map;function c(r,t,e={}){let i=e.priority??10,a={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=d.get(r);if(customElements.get(r)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}d.set(r,a),customElements.define(r,t)}var n=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,i,a){t.addEventListener(e,i,a),this.#t.push(()=>t.removeEventListener(e,i,a))}_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 i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let a=`--${t}`;e?i.add(a):i.delete(a)}}_adoptInternals(t){this.#e||(this.#e=t)}};var l=new Set(["live","recording","streaming","error","online","running","away","paused","busy","offline","stopped"]),o=class extends n{static observedAttributes=["data-variant","data-live"];#t;setup(){let t=document.createElement("span");for(t.className="status-dot",t.setAttribute("aria-hidden","true"),this.#t=document.createElement("span"),this.#t.className="status-label";this.firstChild;)this.#t.appendChild(this.firstChild);this.appendChild(t),this.appendChild(this.#t),this.#e(),this.#i(),this.#r()}attributeChangedCallback(t,e,i){!this.isConnected||e===i||(t==="data-variant"?(this.#i(),this.dispatchEvent(new CustomEvent("status-wc:change",{bubbles:!0,detail:{variant:i,previousVariant:e}}))):t==="data-live"&&this.#e())}#e(){this.getAttribute("data-live")==="off"?(this.removeAttribute("role"),this.removeAttribute("aria-live")):(this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"))}#i(){let t=this.getAttribute("data-variant");t&&(l.has(t)||this.#s(t)||console.info(`[status-wc] data-variant="${t}" is not a built-in; add a CSS rule (status-wc[data-variant="${t}"] { --status-dot-color: \u2026; }) or use a built-in.`))}#s(t){let e=this.querySelector(".status-dot");if(!e)return!0;let i=getComputedStyle(e).getPropertyValue("--status-dot-color").trim();return i&&i!==""}#r(){let t=this.#t?.textContent.trim(),e=this.hasAttribute("aria-label");!t&&!e&&console.warn("[status-wc] needs slot text or aria-label for accessibility.")}get variant(){return this.getAttribute("data-variant")}set variant(t){t?this.setAttribute("data-variant",t):this.removeAttribute("data-variant")}};c("status-wc",o);export{o as StatusWc};
1
+ var c=window.matchMedia("(prefers-reduced-motion: reduce)");var l=new Map;function d(a,t,i={}){let e=i.priority??10,r={impl:t,bundle:i.bundle,contract:i.contract,priority:e},s=l.get(a);if(customElements.get(a)){if(!s||s.priority>=e){s&&s.priority===e&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=e){s.priority===e&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${s.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}l.set(a,r),customElements.define(a,t)}var n=class extends HTMLElement{#i=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#i)t();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,i,e,r){t.addEventListener(i,e,r),this.#i.push(()=>t.removeEventListener(i,e,r))}_reinit(){for(let t of this.#i)t();this.#i=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,i){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{i?e.add(t):e.delete(t)}catch{let r=`--${t}`;i?e.add(r):e.delete(r)}}_adoptInternals(t){this.#t||(this.#t=t)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var u={live:"Live",recording:"Recording",streaming:"Streaming",error:"Error",online:"Online",running:"Running",away:"Away",paused:"Paused",busy:"Busy",offline:"Offline",stopped:"Stopped"},o=class extends n{static get observedAttributes(){return["data-variant","data-live","aria-label"]}#i=null;#t=null;#e=!1;setup(){let t=this.querySelector(":scope > .status-dot"),i=this.querySelector(":scope > .status-label"),e=this.querySelector(":scope > .status-default-label");t||(t=document.createElement("span"),t.className="status-dot",t.setAttribute("aria-hidden","true")),i||(i=document.createElement("span"),i.className="status-label"),e||(e=document.createElement("span"),e.className="status-default-label");for(let r of[...this.childNodes])r===t||r===i||r===e||i.appendChild(r);this.append(t,i,e),this.#i=i,this.#t=e,this.#s(),this.#r()}attributeChangedCallback(t,i,e){i!==e&&(!this.isConnected||!this.hasAttribute("data-upgraded")||(t==="data-variant"?(this.#r(),this.dispatchEvent(new CustomEvent("status-wc:change",{bubbles:!0,detail:{variant:e,previousVariant:i}}))):t==="data-live"?this.#s():t==="aria-label"&&this.#r()))}#s(){this.getAttribute("data-live")==="off"?this.#e&&(this.removeAttribute("role"),this.removeAttribute("aria-live"),this.#e=!1):!this.hasAttribute("role")&&!this.hasAttribute("aria-live")&&(this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.#e=!0)}#r(){let t=this.#t;if(!t)return;let i=!!this.#i?.textContent?.trim(),e="";if(!i){let r=this.getAttribute("data-variant")||"";e=this.getAttribute("aria-label")||r&&this.getAttribute(`data-label-${r}`)||u[r]||r}t.textContent!==e&&(t.textContent=e)}get variant(){return this.getAttribute("data-variant")}set variant(t){t?this.setAttribute("data-variant",t):this.removeAttribute("data-variant")}};d("status-wc",o);export{o as StatusWc};
2
2
  //# sourceMappingURL=status-wc.js.map
@@ -1,2 +1,2 @@
1
- var k=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function b(r,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},n=m.get(r);if(customElements.get(r)){if(!n||n.priority>=i){n&&n.priority===i&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=i){n.priority===i&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}m.set(r,s),customElements.define(r,t)}var l=class extends HTMLElement{#n=[];#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.#n)t();this.#n=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#n.push(()=>t.removeEventListener(e,i,s))}_reinit(){for(let t of this.#n)t();this.#n=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}};var g='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="5" y1="12" x2="19" y2="12"/></svg>',v='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>';function y(r){if(!r)return[];let t=r.trim();if(t.startsWith("["))try{return JSON.parse(t).map(i=>({value:String(i.value),label:String(i.label??i.value)}))}catch{return[]}return t.split(",").map(e=>{let i=e.trim();return{value:i,label:i}})}function x(r){return r?r.split(",").map(t=>t.trim()).filter(Boolean):[]}function A(r){let t=Math.max(0,Math.round(r)),e=Math.floor(t/3600),i=Math.floor(t%3600/60),s=t%60,n=a=>String(a).padStart(2,"0");return e>0?`${e}:${n(i)}:${n(s)}`:`${i}:${n(s)}`}function w(r,t){let e=Number(r)||0,i=["B","KB","MB","GB","TB","PB"],s=0,n=Math.abs(e);for(;n>=1e3&&s<i.length-1;)n/=1e3,s+=1;let a=new Intl.NumberFormat(t,{minimumFractionDigits:s===0?0:1,maximumFractionDigits:s===0?0:2});return`${e<0?"-":""}${a.format(n)} ${i[s]}`}function S(){return document.documentElement.lang||void 0}function c(r){let t=String(r),e=t.indexOf(".");return e<0?0:t.length-e-1}var f=class extends l{static formAssociated=!0;static observedAttributes=["value","disabled","readonly"];#n;#t;#r=-1/0;#a=1/0;#b=1;#h=[];#s=[];#o;#M;#c="";#$=!1;#C=!1;#p;#i;#F;#e;#g;#y;#u;#l;#S;#x=0;#v=0;#k=!1;#N=!1;constructor(){super(),this.#n=this.attachInternals(),this._adoptInternals(this.#n)}setup(){this.#O(),this.#q(),this.#H();let t=this.getAttribute("value");this.#F=t,this.#d(t??this.#A(),"init")}attributeChangedCallback(t,e,i){!this.isConnected||!this.#e||(t==="value"?this.#d(i??this.#A(),"attr"):(t==="disabled"||t==="readonly")&&this.#B())}#O(){this.hasAttribute("data-options")?this.#t="enum":this.hasAttribute("data-values")?this.#t="token":this.hasAttribute("data-format")||this.hasAttribute("data-suffix")?this.#t="formatted":(this.#t="numeric",console.info('[stepper-wc] No mode attribute set. Plain numeric stepping is better served by `<input type="number" data-stepper>`. See /docs/concepts/numeric-inputs/'))}#q(){this.#r=this.hasAttribute("data-min")?Number(this.getAttribute("data-min")):-1/0,this.#a=this.hasAttribute("data-max")?Number(this.getAttribute("data-max")):1/0,this.#b=Number(this.getAttribute("data-step"))||1,this.#h=x(this.getAttribute("data-values")),this.#s=y(this.getAttribute("data-options")),this.#o=this.getAttribute("data-format")||(this.hasAttribute("data-suffix")?"number":null),this.#M=this.getAttribute("data-currency")||"USD",this.#c=this.getAttribute("data-suffix")||"",this.#$=this.hasAttribute("data-show-label"),this.#C=this.hasAttribute("data-accelerate"),this.#p=S(),this.#S=this.#P()}#P(){if(!this.#o)return null;let t=c(this.#b);return this.#o==="number"?new Intl.NumberFormat(this.#p,{minimumFractionDigits:t,maximumFractionDigits:t}):this.#o==="currency"?new Intl.NumberFormat(this.#p,{style:"currency",currency:this.#M}):this.#o==="percent"?new Intl.NumberFormat(this.#p,{style:"percent",minimumFractionDigits:t,maximumFractionDigits:t}):null}#A(){return this.#t==="enum"?this.#s[0]?.value??"":this.#t==="token"?this.#h[0]??"":"0"}#H(){this.replaceChildren(),this.#u=document.createElement("button"),this.#u.type="button",this.#u.className="stepper-dec",this.#u.setAttribute("aria-label","Decrease"),this.#u.setAttribute("tabindex","-1"),this.#u.innerHTML=g,this.#l=document.createElement("button"),this.#l.type="button",this.#l.className="stepper-inc",this.#l.setAttribute("aria-label","Increase"),this.#l.setAttribute("tabindex","-1"),this.#l.innerHTML=v,this.#e=document.createElement("span"),this.#e.className="stepper-value",this.#e.setAttribute("role","spinbutton"),this.#e.setAttribute("tabindex","0"),this.#g=document.createElement("span"),this.#g.className="stepper-value-display",this.#e.appendChild(this.#g),this.#y=new Set;for(let t of this.#V())this.#I(t);this.appendChild(this.#u),this.appendChild(this.#e),this.appendChild(this.#l),this.#D(this.#u,-1),this.#D(this.#l,1),this.listen(this.#e,"keydown",this.#R),this.#B()}#D(t,e){if(this.listen(t,"click",s=>{if(this.#N){this.#N=!1,s.preventDefault();return}this.#f(e,1)}),!this.#C)return;this.listen(t,"pointerdown",s=>{let n=s;n.pointerType==="mouse"&&n.button!==0||this.#E()||(this.#k=!1,this.#x=window.setTimeout(()=>{this.#k=!0,this.#v=window.setInterval(()=>this.#f(e,1),100),this.#x=window.setTimeout(()=>{window.clearInterval(this.#v),this.#v=window.setInterval(()=>this.#f(e,5),50)},1e3)},500))});let i=()=>{window.clearTimeout(this.#x),window.clearInterval(this.#v),this.#x=0,this.#v=0,this.#k&&(this.#N=!0)};this.listen(t,"pointerup",i),this.listen(t,"pointerleave",i),this.listen(t,"pointercancel",i)}#R=t=>{if(!this.#E())switch(t.key){case"ArrowUp":case"ArrowRight":t.preventDefault(),this.#f(1,1);break;case"ArrowDown":case"ArrowLeft":t.preventDefault(),this.#f(-1,1);break;case"PageUp":t.preventDefault(),this.#f(1,10);break;case"PageDown":t.preventDefault(),this.#f(-1,10);break;case"Home":t.preventDefault(),this.#T("min");break;case"End":t.preventDefault(),this.#T("max");break;default:}};#E(){return this.hasAttribute("disabled")||this.hasAttribute("readonly")}#B(){let t=this.hasAttribute("disabled");this.#u.disabled=t,this.#l.disabled=t,this.#e.setAttribute("aria-disabled",String(t)),t?this.#e.removeAttribute("tabindex"):this.#e.setAttribute("tabindex","0")}#f(t,e){if(this.#E())return;let i=this.#U(t,e);i===null||i===this.#i||this.#d(i,"step")}#T(t){if(this.#t==="enum"){let i=t==="min"?0:this.#s.length-1;this.#d(this.#s[i]?.value,"step");return}if(this.#t==="token"){let i=t==="min"?0:this.#h.length-1;this.#d(this.#h[i],"step");return}let e=t==="min"?this.#r===-1/0?this.#i:this.#r:this.#a===1/0?this.#i:this.#a;this.#d(String(e),"step")}#U(t,e){if(this.#t==="enum"){let h=this.#s.findIndex(p=>p.value===this.#i),o=h===-1?0:h,d=Math.min(this.#s.length-1,Math.max(0,o+t*e));return this.#s[d]?.value}if(this.#t==="token"){let o=this.#w(this.#i);o===-1&&(o=this.#j(this.#i));let d=Math.min(this.#h.length-1,Math.max(0,o+t*e));return this.#h[d]}let i=Number(this.#i)||0,s=c(this.#b),n=i+t*this.#b*e,a=Number(n.toFixed(s)),u=Math.min(this.#a,Math.max(this.#r,a));return String(u)}#w(t){if(t==null)return-1;let e=this.#h.indexOf(String(t));if(e!==-1)return e;let i=Number(t);if(Number.isFinite(i)){let s=this.#h.findIndex(n=>Number(n)===i);if(s!==-1)return s}return-1}#j(t){let e=Number(t);if(!Number.isFinite(e))return 0;let i=0,s=1/0;return this.#h.forEach((n,a)=>{let u=Number(n);if(!Number.isFinite(u))return;let h=Math.abs(u-e);h<s&&(s=h,i=a)}),i}#d(t,e){let i=this.#G(t),s=i!==this.#i;this.#i=i,this.getAttribute("value")!==String(i)&&this.setAttribute("value",String(i)),this.#z(),this.#K(),this.#J(),this.#W(),this.#Q(),s&&e!=="init"&&(this.dispatchEvent(new Event("input",{bubbles:!0})),this.dispatchEvent(new Event("change",{bubbles:!0})))}#G(t){if(t==null)return this.#A();if(this.#t==="enum"){let s=String(t);return this.#s.find(a=>a.value===s)?s:this.#s[0]?.value??""}if(this.#t==="token")return String(t);let e=Number(t);if(!Number.isFinite(e))return String(this.#r===-1/0?0:this.#r);let i=c(this.#b);return String(Number(Math.min(this.#a,Math.max(this.#r,e)).toFixed(i)))}#z(){let t=this.#m();this.#g.textContent=t,this.#I(t)}#m(t=this.#i){if(this.#t==="enum")return this.#s.find(i=>i.value===t)?.label??t??"";if(this.#t==="token"){let e=this.#$?String(t).replace(/^--/,""):String(t);return this.#c?`${e}${this.#c}`:e}if(this.#t==="formatted"){let e=Number(t)||0;if(this.#o==="duration")return A(e);if(this.#o==="bytes")return w(e,this.#p);if(this.#S){let i=this.#o==="percent"?e/100:e,s=this.#S.format(i);return this.#c&&this.#o==="number"?`${s}${this.#c}`:s}return this.#c?`${e}${this.#c}`:String(e)}return String(t??"")}#V(){if(this.#t==="enum")return this.#s.map(i=>this.#m(i.value));if(this.#t==="token")return this.#h.map(i=>this.#m(i));let t=new Set,e=i=>{Number.isFinite(i)&&t.add(i)};if(this.#r!==-1/0&&e(this.#r),this.#a!==1/0&&e(this.#a),e(Number(this.getAttribute("value"))||0),this.#a===1/0){let i=[10,100,1e3,1e4];for(let s of i)e(s);if(this.#o==="bytes")for(let s of[999,999e3,999e6,999e9])e(s)}return[...t].map(i=>this.#m(String(i)))}#I(t){let e=String(t??"");if(!e||this.#y.has(e))return;this.#y.add(e);let i=document.createElement("span");i.className="stepper-value-reserve",i.setAttribute("aria-hidden","true"),i.textContent=e,this.#e.appendChild(i)}recomputeWidth(){if(this.#e){this.#e.querySelectorAll(".stepper-value-reserve").forEach(t=>t.remove()),this.#y=new Set;for(let t of this.#V())this.#I(t)}}#K(){if(this.#t==="enum"){let e=this.#s.findIndex(i=>i.value===this.#i);this.#e.setAttribute("aria-valuemin","1"),this.#e.setAttribute("aria-valuemax",String(this.#s.length)),this.#e.setAttribute("aria-valuenow",String((e===-1?0:e)+1)),this.#e.setAttribute("aria-valuetext",this.#m());return}if(this.#t==="token"){let e=this.#w(this.#i);this.#e.setAttribute("aria-valuemin","1"),this.#e.setAttribute("aria-valuemax",String(this.#h.length)),this.#e.setAttribute("aria-valuenow",String((e===-1?0:e)+1)),this.#e.setAttribute("aria-valuetext",this.#m());return}let t=Number(this.#i)||0;this.#r!==-1/0?this.#e.setAttribute("aria-valuemin",String(this.#r)):this.#e.removeAttribute("aria-valuemin"),this.#a!==1/0?this.#e.setAttribute("aria-valuemax",String(this.#a)):this.#e.removeAttribute("aria-valuemax"),this.#e.setAttribute("aria-valuenow",String(t)),this.#e.setAttribute("aria-valuetext",this.#m())}#J(){let t=this.#L(),e=this.#_();this.#u.disabled=t||this.hasAttribute("disabled"),this.#l.disabled=e||this.hasAttribute("disabled")}#L(){return this.#t==="enum"?this.#i===this.#s[0]?.value:this.#t==="token"?this.#w(this.#i)===0:this.#r!==-1/0&&Number(this.#i)<=this.#r}#_(){return this.#t==="enum"?this.#i===this.#s[this.#s.length-1]?.value:this.#t==="token"?this.#w(this.#i)===this.#h.length-1:this.#a!==1/0&&Number(this.#i)>=this.#a}#W(){this.#n.setFormValue(String(this.#i??""))}#Q(){this.setState("at-min",this.#L()),this.setState("at-max",this.#_())}formResetCallback(){this.#d(this.#F??this.#A(),"reset")}formStateRestoreCallback(t){t!=null&&this.#d(t,"restore")}get displayText(){return this.#g?.textContent??""}get value(){return this.#i==null?"":String(this.#i)}set value(t){String(t)!==String(this.#i)&&this.#d(t,"api")}get form(){return this.#n.form}get name(){return this.getAttribute("name")}get type(){return this.localName}get validity(){return this.#n.validity}get validationMessage(){return this.#n.validationMessage}checkValidity(){return this.#n.checkValidity()}reportValidity(){return this.#n.reportValidity()}};b("stepper-wc",f);export{f as StepperWc};
1
+ var I=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function b(n,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=m.get(n);if(customElements.get(n)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> 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 <${n}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}m.set(n,s),customElements.define(n,t)}var l=class extends HTMLElement{#n=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#n)t();this.#n=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#n.push(()=>t.removeEventListener(e,i,s))}_reinit(){for(let t of this.#n)t();this.#n=[],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 i=this.#e.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#e||(this.#e=t)}#s(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#s()?.validity}get validationMessage(){return this.#s()?.validationMessage??""}get willValidate(){return this.#s()?.willValidate??!1}get form(){return this.#s()?.form??null}checkValidity(){return this.#s()?.checkValidity()??!0}reportValidity(){return this.#s()?.reportValidity()??!0}};var y='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="5" y1="12" x2="19" y2="12"/></svg>',v='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>';function x(n){if(!n)return[];let t=n.trim();if(t.startsWith("["))try{return JSON.parse(t).map(i=>({value:String(i.value),label:String(i.label??i.value)}))}catch{return[]}return t.split(",").map(e=>{let i=e.trim();return{value:i,label:i}})}function A(n){return n?n.split(",").map(t=>t.trim()).filter(Boolean):[]}function w(n){let t=Math.max(0,Math.round(n)),e=Math.floor(t/3600),i=Math.floor(t%3600/60),s=t%60,r=a=>String(a).padStart(2,"0");return e>0?`${e}:${r(i)}:${r(s)}`:`${i}:${r(s)}`}function S(n,t){let e=Number(n)||0,i=["B","KB","MB","GB","TB","PB"],s=0,r=Math.abs(e);for(;r>=1e3&&s<i.length-1;)r/=1e3,s+=1;let a=new Intl.NumberFormat(t,{minimumFractionDigits:s===0?0:1,maximumFractionDigits:s===0?0:2});return`${e<0?"-":""}${a.format(r)} ${i[s]}`}function k(){return document.documentElement.lang||void 0}function c(n){let t=String(n),e=t.indexOf(".");return e<0?0:t.length-e-1}var p=!1,N=0,f=class extends l{static formAssociated=!0;static observedAttributes=["value","disabled","readonly","aria-label","aria-labelledby","data-label-decrease","data-label-increase"];#n;#e;#s=-1/0;#a=1/0;#p=1;#h=[];#r=[];#o;#F;#c="";#B=!1;#T=!1;#g;#i;#V;#L=!1;#_=!1;#t;#y;#x;#u;#l;#I;#A=0;#v=0;#M=!1;#w=!1;constructor(){super(),this.#n=this.attachInternals(),this._adoptInternals(this.#n)}setup(){this.#G(),this.#z(),this.#J();let t=this.getAttribute("value");this.#L||(this.#V=t,this.#L=!0),this.#d(t??this.#k(),"init"),this.#S(),requestAnimationFrame(()=>{this.isConnected&&this.#S()}),this.listen(this.#t,"focus",()=>this.#S()),this.listen(this,"click",e=>{e.target===this&&!this.#C()&&this.#t.focus()})}teardown(){this.#E(),this.#w=!1}attributeChangedCallback(t,e,i){!this.isConnected||!this.#t||(t==="value"?this.#d(i??this.#k(),"attr"):t==="disabled"||t==="readonly"?this.#$():t==="aria-label"||t==="aria-labelledby"?this.#S():this.#q())}#S(){let t=[],e=[];try{e=[...this.#n.labels||[]]}catch{}for(let a of e)a.id||(a.id=`stepper-wc-label-${++N}`),t.push(a.id);let i=(this.getAttribute("aria-labelledby")||"").trim();i&&t.push(...i.split(/\s+/));let s=[...new Set(t)];s.length?this.#t.setAttribute("aria-labelledby",s.join(" ")):this.#t.removeAttribute("aria-labelledby");let r=this.getAttribute("aria-label");r?this.#t.setAttribute("aria-label",r):this.#t.removeAttribute("aria-label")}#q(){this.#u.setAttribute("aria-label",this.getAttribute("data-label-decrease")||"Decrease"),this.#l.setAttribute("aria-label",this.getAttribute("data-label-increase")||"Increase")}#G(){if(this.hasAttribute("data-options"))this.#e="enum";else if(this.hasAttribute("data-values"))this.#e="token";else if(this.hasAttribute("data-format")||this.hasAttribute("data-suffix"))this.#e="formatted";else{if(this.#e="numeric",p)return;p=!0,console.info('[stepper-wc] No mode attribute set. Plain numeric stepping is better served by `<input type="number" data-stepper>`. See /docs/concepts/numeric-inputs/')}}#z(){this.#s=this.hasAttribute("data-min")?Number(this.getAttribute("data-min")):-1/0,this.#a=this.hasAttribute("data-max")?Number(this.getAttribute("data-max")):1/0,this.#p=Number(this.getAttribute("data-step"))||1,this.#h=A(this.getAttribute("data-values")),this.#r=x(this.getAttribute("data-options")),this.#o=this.getAttribute("data-format")||(this.hasAttribute("data-suffix")?"number":null),this.#F=this.getAttribute("data-currency")||"USD",this.#c=this.getAttribute("data-suffix")||"",this.#B=this.hasAttribute("data-show-label"),this.#T=this.hasAttribute("data-accelerate"),this.#g=k(),this.#I=this.#K()}#K(){if(!this.#o)return null;let t=c(this.#p);return this.#o==="number"?new Intl.NumberFormat(this.#g,{minimumFractionDigits:t,maximumFractionDigits:t}):this.#o==="currency"?new Intl.NumberFormat(this.#g,{style:"currency",currency:this.#F}):this.#o==="percent"?new Intl.NumberFormat(this.#g,{style:"percent",minimumFractionDigits:t,maximumFractionDigits:t}):null}#k(){return this.#e==="enum"?this.#r[0]?.value??"":this.#e==="token"?this.#h[0]??"":"0"}#J(){this.replaceChildren(),this.#u=document.createElement("button"),this.#u.type="button",this.#u.className="stepper-dec",this.#u.setAttribute("tabindex","-1"),this.#u.innerHTML=y,this.#l=document.createElement("button"),this.#l.type="button",this.#l.className="stepper-inc",this.#l.setAttribute("tabindex","-1"),this.#l.innerHTML=v,this.#t=document.createElement("span"),this.#t.className="stepper-value",this.#t.setAttribute("role","spinbutton"),this.#t.setAttribute("tabindex","0"),this.#y=document.createElement("span"),this.#y.className="stepper-value-display",this.#t.appendChild(this.#y),this.#x=new Set;for(let t of this.#P())this.#D(t);this.appendChild(this.#u),this.appendChild(this.#t),this.appendChild(this.#l),this.#O(this.#u,-1),this.#O(this.#l,1),this.listen(this.#t,"keydown",this.#W),this.#q(),this.#$()}#O(t,e){if(this.listen(t,"click",s=>{if(this.#w){this.#w=!1,s.preventDefault();return}this.#f(e,1)}),!this.#T)return;this.listen(t,"pointerdown",s=>{let r=s;r.pointerType==="mouse"&&r.button!==0||this.#b()||(this.#M=!1,this.#A=window.setTimeout(()=>{this.#M=!0,this.#v=window.setInterval(()=>this.#f(e,1),100),this.#A=window.setTimeout(()=>{window.clearInterval(this.#v),this.#v=window.setInterval(()=>this.#f(e,5),50)},1e3)},500))});let i=()=>{this.#E(),this.#M&&(this.#w=!0)};this.listen(t,"pointerup",i),this.listen(t,"pointerleave",i),this.listen(t,"pointercancel",i)}#E(){window.clearTimeout(this.#A),window.clearInterval(this.#v),this.#A=0,this.#v=0}#W=t=>{if(this.#b())return;let e=getComputedStyle(this).direction==="rtl";switch(e&&t.key==="ArrowLeft"?"ArrowRight":e&&t.key==="ArrowRight"?"ArrowLeft":t.key){case"ArrowUp":case"ArrowRight":t.preventDefault(),this.#f(1,1);break;case"ArrowDown":case"ArrowLeft":t.preventDefault(),this.#f(-1,1);break;case"PageUp":t.preventDefault(),this.#f(1,10);break;case"PageDown":t.preventDefault(),this.#f(-1,10);break;case"Home":t.preventDefault(),this.#H("min");break;case"End":t.preventDefault(),this.#H("max");break;default:}};#C(){return this.hasAttribute("disabled")||this.#_}#b(){return this.#C()||this.hasAttribute("readonly")}#$(){let t=this.#C();this.#t.setAttribute("aria-disabled",String(t)),this.hasAttribute("readonly")?this.#t.setAttribute("aria-readonly","true"):this.#t.removeAttribute("aria-readonly"),t?(this.#t.removeAttribute("tabindex"),this.#E()):this.#t.setAttribute("tabindex","0"),this.#i!==void 0?this.#R():(this.#u.disabled=this.#b(),this.#l.disabled=this.#b())}#f(t,e){if(this.#b())return;let i=this.#Q(t,e);i===null||i===this.#i||this.#d(i,"step")}#H(t){if(this.#e==="enum"){let i=t==="min"?0:this.#r.length-1;this.#d(this.#r[i]?.value,"step");return}if(this.#e==="token"){let i=t==="min"?0:this.#h.length-1;this.#d(this.#h[i],"step");return}let e=t==="min"?this.#s===-1/0?this.#i:this.#s:this.#a===1/0?this.#i:this.#a;this.#d(String(e),"step")}#Q(t,e){if(this.#e==="enum"){let h=this.#r.findIndex(g=>g.value===this.#i),o=h===-1?0:h,d=Math.min(this.#r.length-1,Math.max(0,o+t*e));return this.#r[d]?.value}if(this.#e==="token"){let o=this.#N(this.#i);o===-1&&(o=this.#X(this.#i));let d=Math.min(this.#h.length-1,Math.max(0,o+t*e));return this.#h[d]}let i=Number(this.#i)||0,s=c(this.#p),r=i+t*this.#p*e,a=Number(r.toFixed(s)),u=Math.min(this.#a,Math.max(this.#s,a));return String(u)}#N(t){if(t==null)return-1;let e=this.#h.indexOf(String(t));if(e!==-1)return e;let i=Number(t);if(Number.isFinite(i)){let s=this.#h.findIndex(r=>Number(r)===i);if(s!==-1)return s}return-1}#X(t){let e=Number(t);if(!Number.isFinite(e))return 0;let i=0,s=1/0;return this.#h.forEach((r,a)=>{let u=Number(r);if(!Number.isFinite(u))return;let h=Math.abs(u-e);h<s&&(s=h,i=a)}),i}#d(t,e){let i=this.#Y(t),s=i!==this.#i;this.#i=i,this.getAttribute("value")!==String(i)&&this.setAttribute("value",String(i)),this.#Z(),this.#tt(),this.#R(),this.#et(),this.#it(),s&&e!=="init"&&(this.dispatchEvent(new Event("input",{bubbles:!0})),this.dispatchEvent(new Event("change",{bubbles:!0})))}#Y(t){if(t==null)return this.#k();if(this.#e==="enum"){let s=String(t);return this.#r.find(a=>a.value===s)?s:this.#r[0]?.value??""}if(this.#e==="token")return String(t);let e=Number(t);if(!Number.isFinite(e))return String(this.#s===-1/0?0:this.#s);let i=c(this.#p);return String(Number(Math.min(this.#a,Math.max(this.#s,e)).toFixed(i)))}#Z(){let t=this.#m();this.#y.textContent=t,this.#D(t)}#m(t=this.#i){if(this.#e==="enum")return this.#r.find(i=>i.value===t)?.label??t??"";if(this.#e==="token"){let e=this.#B?String(t).replace(/^--/,""):String(t);return this.#c?`${e}${this.#c}`:e}if(this.#e==="formatted"){let e=Number(t)||0;if(this.#o==="duration")return w(e);if(this.#o==="bytes")return S(e,this.#g);if(this.#I){let i=this.#o==="percent"?e/100:e,s=this.#I.format(i);return this.#c&&this.#o==="number"?`${s}${this.#c}`:s}return this.#c?`${e}${this.#c}`:String(e)}return String(t??"")}#P(){if(this.#e==="enum")return this.#r.map(i=>this.#m(i.value));if(this.#e==="token")return this.#h.map(i=>this.#m(i));let t=new Set,e=i=>{Number.isFinite(i)&&t.add(i)};if(this.#s!==-1/0&&e(this.#s),this.#a!==1/0&&e(this.#a),e(Number(this.getAttribute("value"))||0),this.#a===1/0){let i=[10,100,1e3,1e4];for(let s of i)e(s);if(this.#o==="bytes")for(let s of[999,999e3,999e6,999e9])e(s)}return[...t].map(i=>this.#m(String(i)))}#D(t){let e=String(t??"");if(!e||this.#x.has(e))return;this.#x.add(e);let i=document.createElement("span");i.className="stepper-value-reserve",i.setAttribute("aria-hidden","true"),i.textContent=e,this.#t.appendChild(i)}recomputeWidth(){if(this.#t){this.#t.querySelectorAll(".stepper-value-reserve").forEach(t=>t.remove()),this.#x=new Set;for(let t of this.#P())this.#D(t)}}#tt(){if(this.#e==="enum"){let e=this.#r.findIndex(i=>i.value===this.#i);this.#t.setAttribute("aria-valuemin","1"),this.#t.setAttribute("aria-valuemax",String(this.#r.length)),this.#t.setAttribute("aria-valuenow",String((e===-1?0:e)+1)),this.#t.setAttribute("aria-valuetext",this.#m());return}if(this.#e==="token"){let e=this.#N(this.#i);this.#t.setAttribute("aria-valuemin","1"),this.#t.setAttribute("aria-valuemax",String(this.#h.length)),this.#t.setAttribute("aria-valuenow",String((e===-1?0:e)+1)),this.#t.setAttribute("aria-valuetext",this.#m());return}let t=Number(this.#i)||0;this.#s!==-1/0?this.#t.setAttribute("aria-valuemin",String(this.#s)):this.#t.removeAttribute("aria-valuemin"),this.#a!==1/0?this.#t.setAttribute("aria-valuemax",String(this.#a)):this.#t.removeAttribute("aria-valuemax"),this.#t.setAttribute("aria-valuenow",String(t)),this.#t.setAttribute("aria-valuetext",this.#m())}#R(){let t=this.#j(),e=this.#U(),i=this.#b();this.#u.disabled=t||i,this.#l.disabled=e||i}#j(){return this.#e==="enum"?this.#i===this.#r[0]?.value:this.#e==="token"?this.#N(this.#i)===0:this.#s!==-1/0&&Number(this.#i)<=this.#s}#U(){return this.#e==="enum"?this.#i===this.#r[this.#r.length-1]?.value:this.#e==="token"?this.#N(this.#i)===this.#h.length-1:this.#a!==1/0&&Number(this.#i)>=this.#a}#et(){this.#n.setFormValue(String(this.#i??""))}#it(){this.setState("at-min",this.#j()),this.setState("at-max",this.#U())}formResetCallback(){this.#d(this.#V??this.#k(),"reset")}formDisabledCallback(t){this.#_=t,this.#t&&this.#$()}formStateRestoreCallback(t){t!=null&&this.#d(t,"restore")}get displayText(){return this.#y?.textContent??""}get value(){return this.#i==null?"":String(this.#i)}set value(t){String(t)!==String(this.#i)&&this.#d(t,"api")}get form(){return this.#n.form}get name(){return this.getAttribute("name")}get type(){return this.localName}get validity(){return this.#n.validity}get validationMessage(){return this.#n.validationMessage}checkValidity(){return this.#n.checkValidity()}reportValidity(){return this.#n.reportValidity()}};b("stepper-wc",f);export{f as StepperWc};
2
2
  //# sourceMappingURL=stepper-wc.js.map
@@ -1,2 +1,2 @@
1
- function l(r){return document.startViewTransition?document.startViewTransition(r):r()}var m=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function h(r,t,e={}){let s=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:s},n=u.get(r);if(customElements.get(r)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=s){n.priority===s&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}u.set(r,i),customElements.define(r,t)}var c=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,s,i){t.addEventListener(e,s,i),this.#t.push(()=>t.removeEventListener(e,s,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 s=this.#e.states;try{e?s.add(t):s.delete(t)}catch{let i=`--${t}`;e?s.add(i):s.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}};var f=0,d=class extends c{#t=[];#e=[];#i=!1;#s=0;setup(){return this.#t=[...this.querySelectorAll(":scope > details")],this.#e=this.#t.map(t=>t.querySelector("summary")),this.#t.length===0?!1:(this.style.setProperty("--_tab-count",String(this.#t.length)),this.#a(),this.#c(),this.#o(),!0)}teardown(){this.style.removeProperty("--_tab-count"),this.#t=[],this.#e=[],this.#i=!1}get tabs(){return this.#t.map((t,e)=>({id:t.id||void 0,label:t.querySelector("summary")?.textContent?.trim()||`Tab ${e+1}`,content:t.querySelector(":scope > :not(summary)")?.innerHTML||"",active:t.hasAttribute("open")}))}set tabs(t){let e=Array.isArray(t)?t:[];for(;this.firstChild;)this.firstChild.remove();let s=!1;for(let i of e){let n=document.createElement("details");i.id&&(n.id=i.id),i.active&&!s&&(n.setAttribute("open",""),s=!0);let a=document.createElement("summary");a.textContent=i.label||"",n.appendChild(a);let o=document.createElement("div");o.innerHTML=i.content||"",n.appendChild(o),this.appendChild(n)}!s&&this.firstElementChild&&this.firstElementChild.setAttribute("open",""),this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("tab-set:tabs-changed",{detail:{tabs:e,source:"property"},bubbles:!0}))}#o(){if(!this.hasAttribute("transition")||!document.startViewTransition)return;this.#i=!0;let t=++f,e=this.getAttribute("transition")||"fade",s=e==="slide"?"vt-tabs-slide":e==="scale"?"vt-tabs-scale":"vt-tabs";this.#t.forEach(i=>{let n=i.querySelector(":scope > :not(summary)");n&&(n.style.viewTransitionName=`tabs-${t}`,n.style.viewTransitionClass=s)}),this.#s=this.#t.findIndex(i=>i.open),this.#s===-1&&(this.#s=0)}#n(t){if(t===this.#s)return;let e=t>this.#s?"forward":"backward";document.documentElement.dataset.vtDirection=e,l(()=>{this.#t[t].open=!0}).finished?.then(()=>{delete document.documentElement.dataset.vtDirection})}#a(){this.#t.forEach((t,e)=>{let s=this.#e[e],i=t.querySelector(":scope > :not(summary)");if(!s||!i)return;let n=s.id||`tab-${crypto.randomUUID().slice(0,8)}`,a=i.id||`panel-${crypto.randomUUID().slice(0,8)}`;s.id=n,s.setAttribute("aria-controls",a),s.setAttribute("tabindex",t.open?"0":"-1"),s.setAttribute("aria-expanded",t.open?"true":"false"),i.id=a,i.setAttribute("aria-labelledby",n),this.listen(s,"click",o=>{if(t.open){o.preventDefault();return}this.#i&&(o.preventDefault(),this.#n(e))}),this.listen(s,"keydown",o=>this.#l(o,e)),this.listen(t,"toggle",()=>this.#d(e))})}#c(){!this.#t.some(e=>e.open)&&this.#t.length>0&&(this.#t[0].open=!0,this.#r())}#d(t){this.#t[t].open&&(this.#s=t),this.#r(),this.dispatchEvent(new CustomEvent("tab-set:change",{detail:{index:t},bubbles:!0}))}#r(){this.#t.forEach((t,e)=>{let s=this.#e[e];s.setAttribute("tabindex",t.open?"0":"-1"),s.setAttribute("aria-expanded",t.open?"true":"false")})}#l(t,e){let{key:s}=t,i;switch(s){case"ArrowRight":i=(e+1)%this.#t.length;break;case"ArrowLeft":i=(e-1+this.#t.length)%this.#t.length;break;case"Home":i=0;break;case"End":i=this.#t.length-1;break;default:return}t.preventDefault(),this.#i?this.#n(i):this.#t[i].open=!0,this.#e[i].focus()}};h("tab-set",d);export{d as TabSet};
1
+ function d(n){return document.startViewTransition?document.startViewTransition(n):n()}var y=window.matchMedia("(prefers-reduced-motion: reduce)");var h=new Map;function f(n,t,s={}){let e=s.priority??10,r={impl:t,bundle:s.bundle,contract:s.contract,priority:e},i=h.get(n);if(customElements.get(n)){if(!i||i.priority>=e){i&&i.priority===e&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=e){i.priority===e&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${i.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}h.set(n,r),customElements.define(n,t)}var l=class extends HTMLElement{#t=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,s,e,r){t.addEventListener(s,e,r),this.#t.push(()=>t.removeEventListener(s,e,r))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,s){this.#e||(this.#e=this.attachInternals());let e=this.#e.states;try{s?e.add(t):e.delete(t)}catch{let r=`--${t}`;s?e.add(r):e.delete(r)}}_adoptInternals(t){this.#e||(this.#e=t)}#s(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#s()?.validity}get validationMessage(){return this.#s()?.validationMessage??""}get willValidate(){return this.#s()?.willValidate??!1}get form(){return this.#s()?.form??null}checkValidity(){return this.#s()?.checkValidity()??!0}reportValidity(){return this.#s()?.reportValidity()??!0}};var p=0,m=0,u=class extends l{#t=[];#e=[];#s=!1;#i=0;#r=!1;setup(){return this.#t=[...this.querySelectorAll(":scope > details")],this.#e=this.#t.map(t=>t.querySelector(":scope > summary")),this.#t.length===0?!1:(this.style.setProperty("--_tab-count",String(this.#t.length)),!this.hasAttribute("role")&&(this.hasAttribute("aria-label")||this.hasAttribute("aria-labelledby"))&&(this.setAttribute("role","group"),this.#r=!0),this.#a(),this.#l(),this.#u(),this.#i=Math.max(0,this.#t.findIndex(t=>t.open)),this.#o(),this.#c(),!0)}teardown(){this.style.removeProperty("--_tab-count"),this.#r&&this.removeAttribute("role"),this.#r=!1,this.#t=[],this.#e=[],this.#s=!1}get tabs(){return this.#t.map((t,s)=>({id:t.id||void 0,label:t.querySelector(":scope > summary")?.textContent?.trim()||`Tab ${s+1}`,content:t.querySelector(":scope > :not(summary)")?.innerHTML||"",active:t.hasAttribute("open")}))}set tabs(t){let s=Array.isArray(t)?t:[];for(;this.firstChild;)this.firstChild.remove();let e=!1;for(let r of s){let i=document.createElement("details");r.id&&(i.id=r.id),r.active&&!e&&(i.setAttribute("open",""),e=!0);let c=document.createElement("summary");c.textContent=r.label||"",i.appendChild(c);let o=document.createElement("section");o.innerHTML=r.content||"",i.appendChild(o),this.appendChild(i)}!e&&this.firstElementChild&&this.firstElementChild.setAttribute("open",""),this._reinit(),this.dispatchEvent(new CustomEvent("tab-set:tabs-changed",{detail:{tabs:s,source:"property"},bubbles:!0}))}#a(){let t=new Set(this.#t.map(e=>e.getAttribute("name")||"")),s=t.size===1?[...t][0]:"";if(s){let r=this.getRootNode().querySelectorAll?.(`details[name="${CSS.escape(s)}"]`)??[];for(let i of r)if(!this.#t.includes(i)){s="";break}}if(!s){s=`tab-set-${++m}`;for(let e of this.#t)e.setAttribute("name",s)}}#c(){if(!this.hasAttribute("transition")||!document.startViewTransition)return;this.#s=!0;let t=++p,s=this.getAttribute("transition")||"fade",e=s==="slide"?"vt-tabs-slide":s==="scale"?"vt-tabs-scale":"vt-tabs";this.#t.forEach(r=>{let i=r.querySelector(":scope > :not(summary)");i&&(i.style.viewTransitionName=`tabs-${t}`,i.style.viewTransitionClass=e)})}#n(t){if(t===this.#i)return;let s=t>this.#i?"forward":"backward";document.documentElement.dataset.vtDirection=s,d(()=>{this.#t[t].open=!0}).finished?.then(()=>{delete document.documentElement.dataset.vtDirection})}#l(){this.#t.forEach((t,s)=>{let e=this.#e[s],r=t.querySelector(":scope > :not(summary)");if(this.listen(t,"toggle",()=>this.#d(s)),!e||!r)return;let i=e.id||`tab-${crypto.randomUUID().slice(0,8)}`,c=r.id||`panel-${crypto.randomUUID().slice(0,8)}`;e.id=i,e.setAttribute("aria-controls",c),r.id=c,r.setAttribute("aria-labelledby",i),this.listen(e,"click",o=>{if(t.open){o.preventDefault();return}this.#s&&(o.preventDefault(),this.#n(s))}),this.listen(e,"keydown",o=>this.#h(o,s))})}#u(){this.#t.some(t=>t.open)||(this.#t[0].open=!0)}#d(t){let s=this.#t[t];if(this.#o(),!s?.open)return;let e=this.#i;e!==t&&(this.#i=t,this.dispatchEvent(new CustomEvent("tab-set:change",{detail:{index:t,previousIndex:e,tab:s,panel:s.querySelector(":scope > :not(summary)")},bubbles:!0})))}#o(){this.#t.forEach((t,s)=>{let e=this.#e[s];e&&(e.setAttribute("tabindex",t.open?"0":"-1"),e.setAttribute("aria-expanded",t.open?"true":"false"))})}#h(t,s){let e=this.#t.length,r=(s+1)%e,i=(s-1+e)%e,c=getComputedStyle(this).direction==="rtl",o=this.getAttribute("data-orientation")==="vertical",a;switch(t.key){case"ArrowRight":a=c?i:r;break;case"ArrowLeft":a=c?r:i;break;case"ArrowDown":if(!o)return;a=r;break;case"ArrowUp":if(!o)return;a=i;break;case"Home":a=0;break;case"End":a=e-1;break;default:return}t.preventDefault(),this.#s?this.#n(a):this.#t[a].open=!0,this.#e[a]?.focus()}};f("tab-set",u);export{u as TabSet};
2
2
  //# sourceMappingURL=tab-set.js.map
@@ -1,7 +1,7 @@
1
- var b=window.matchMedia("(prefers-reduced-motion: reduce)");var f=new Map;function g(c,t,s={}){let e=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:e},r=f.get(c);if(customElements.get(c)){if(!r||r.priority>=e){r&&r.priority===e&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=e){r.priority===e&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}f.set(c,i),customElements.define(c,t)}var u=class extends HTMLElement{#s=[];#o;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.#s)t();this.#s=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,s,e,i){t.addEventListener(s,e,i),this.#s.push(()=>t.removeEventListener(s,e,i))}_reinit(){for(let t of this.#s)t();this.#s=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,s){this.#o||(this.#o=this.attachInternals());let e=this.#o.states;try{s?e.add(t):e.delete(t)}catch{let i=`--${t}`;s?e.add(i):e.delete(i)}}_adoptInternals(t){this.#o||(this.#o=t)}};var p=class extends u{#s=null;#o=null;#g=[];#h="";#p=0;#b=null;#E=null;#C=null;#w=null;#i=!1;#n=!1;#$=0;#e=null;#l=null;#c=null;#m=null;#y=null;#S=null;#H=null;#L=!1;#r=null;#t=null;static get observedAttributes(){return["speed","voice","for"]}attributeChangedCallback(t,s,e){if(s!==e&&(t==="for"&&(this.stop(),this.#B()),(t==="speed"||t==="voice")&&this.#i&&this.#x(),t==="speed")){let i=this.#f(parseFloat(e)||1);this.#y&&(this.#y.value=String(i)),this.#S&&(this.#S.textContent=`${i}\xD7`)}}setup(){return"speechSynthesis"in window?(this.getAttribute("variant")==="icon"?this.#O():this.#D(),this.#B(),this.#J(),this.#w=this.#q(),this.#w.then(t=>this.#tt(t)),this.listen(window,"beforeunload",this.#et),!0):(this.style.display="none",!1)}teardown(){this.stop(),this.#Q(),this.#t&&(this.#t.remove(),this.#t=null),this.#r&&(this.#r.remove(),this.#r=null)}play(){if(this.#n){this.resume();return}this.#i||this.#F(0)}pause(){!this.#i||this.#n||(speechSynthesis.pause(),this.#n=!0,this.#U(!0),this.#d("text-reader:pause"))}resume(){this.#n&&(speechSynthesis.resume(),this.#n=!1,this.#U(!1),this.#d("text-reader:resume"))}stop(){speechSynthesis.cancel(),this.#k(),this.#d("text-reader:stop")}get voices(){return this.#w||this.#q()}get speaking(){return this.#i}get paused(){return this.#n}get progress(){return this.#h.length?Math.min(this.#p/this.#h.length,1):0}#D(){let t=document.createElement("div");t.setAttribute("part","controls"),t.setAttribute("role","group"),t.setAttribute("aria-label","Article reader");let s=this.#a("play",this.getAttribute("label-play")||"Play","\u25B6");s.addEventListener("click",()=>this.play());let e=this.#a("pause",this.getAttribute("label-pause")||"Pause","\u23F8");e.hidden=!0,e.addEventListener("click",()=>this.pause());let i=this.#a("stop",this.getAttribute("label-stop")||"Stop","\u23F9");i.disabled=!0,i.addEventListener("click",()=>this.stop());let r=document.createElement("select");r.setAttribute("aria-label","Voice");let n=document.createElement("option");n.textContent="Loading voices\u2026",r.append(n),r.addEventListener("change",()=>{this.#i&&this.#x()});let h=document.createElement("label");h.setAttribute("data-speed-group","");let o=document.createElement("span");o.setAttribute("data-speed-value","");let l=this.#f(parseFloat(this.getAttribute("speed")??"1")||1);o.textContent=`${l}\xD7`;let a=document.createElement("input");a.type="range",a.min="0.5",a.max="2",a.step="0.1",a.value=String(l),a.setAttribute("aria-label","Speed"),a.addEventListener("input",()=>{let d=parseFloat(a.value);o.textContent=`${d}\xD7`,this.#i&&this.#x()}),h.append(o,a),this.#u("icon-play",s),this.#u("icon-pause",e),this.#u("icon-stop",i),t.append(s,e,i,r,h),this.prepend(t),this.#H=t,this.#e=s,this.#l=e,this.#c=i,this.#m=r,this.#y=a,this.#S=o}#a(t,s,e){let i=document.createElement("button");return i.type="button",i.setAttribute("part",`button ${t}`),i.setAttribute("aria-label",s),i.textContent=e,i}#u(t,s){let e=this.querySelector(`[slot="${t}"]`);e&&(e.removeAttribute("slot"),s.textContent="",s.append(e))}#O(){this.#L=!0;for(let e of this.querySelectorAll(':scope > [part="trigger"]'))e.remove();let t=document.createElement("button");t.type="button",t.setAttribute("part","trigger"),t.setAttribute("aria-label","Article reader"),t.setAttribute("aria-pressed","false");let s=this.querySelector('[slot="icon-trigger"]');if(s)s.removeAttribute("slot"),t.append(s);else{let e=document.createElement("icon-wc");e.setAttribute("name","volume-2"),e.setAttribute("aria-hidden","true"),t.append(e)}t.addEventListener("click",()=>this.#W()),this.append(t),this.#r=t,this.#R()}#R(){let t=document.createElement("div");t.setAttribute("data-text-reader-toolbar",""),t.setAttribute("role","group"),t.setAttribute("aria-label","Reader controls"),t.hidden=!0;let s=this.#a("play",this.getAttribute("label-play")||"Play","\u25B6");s.addEventListener("click",()=>this.play());let e=this.#a("pause",this.getAttribute("label-pause")||"Pause","\u23F8");e.hidden=!0,e.addEventListener("click",()=>this.pause());let i=this.#a("stop",this.getAttribute("label-stop")||"Stop","\u23F9");i.addEventListener("click",()=>this.stop());let r=this.#a("speed-down","Slower","\u2212");r.addEventListener("click",()=>this.#T(-.1));let n=document.createElement("span");n.setAttribute("data-speed-value","");let h=this.#f(parseFloat(this.getAttribute("speed")??"1")||1);n.textContent=`${h}\xD7`;let o=this.#a("speed-up","Faster","+");o.addEventListener("click",()=>this.#T(.1)),this.#u("icon-play",s),this.#u("icon-pause",e),this.#u("icon-stop",i),t.append(s,e,i,r,n,o),document.body.append(t),this.#e=s,this.#l=e,this.#c=i,this.#S=n,this.#t=t,this.listen(document,"pointerdown",this.#_),this.listen(document,"keydown",this.#G)}#W(){if(!this.#i){this.play();return}this.#t?.hidden&&this.#M(),this.#n?this.resume():this.pause()}#M(){if(!this.#t||!this.#r)return;let t=this.#t;t.hidden=!1,t.style.visibility="hidden",requestAnimationFrame(()=>{this.#j(),t.style.visibility=""})}#A(){this.#t&&(this.#t.hidden=!0)}#j(){let t=this.#t,s=this.#r;if(!t||!s)return;let e=s.getBoundingClientRect(),i=t.offsetWidth,r=t.offsetHeight,n=8,h=8,o=e.top-r-n;o<h&&(o=e.bottom+n);let l=e.left+e.width/2-i/2,a=window.innerWidth-i-h;l=Math.max(h,Math.min(l,a)),t.style.top=`${o}px`,t.style.left=`${l}px`}#T(t){let s=parseFloat(this.getAttribute("speed")??"1")||1,e=this.#f(s+t);this.setAttribute("speed",String(e))}#_=t=>{!this.#t||this.#t.hidden||this.#t.contains(t.target)||this.#r?.contains(t.target)||this.#A()};#G=t=>{t.key==="Escape"&&this.#t&&!this.#t.hidden&&this.#A()};#B(){let t=this.getAttribute("for");if(!t){console.warn('<text-reader>: missing "for" attribute'),this.#I();return}if(this.#s=document.getElementById(t),!this.#s){console.warn(`<text-reader>: no element found with id="${t}"`),this.#I();return}this.#X(),this.#K()}#I(){this.#e&&(this.#e.disabled=!0),this.#c&&(this.#c.disabled=!0)}#K(){this.#e&&(this.#e.disabled=!1)}#X(){let t=this.#s;if(!t)return;let s=this.getAttribute("selectors")||"p,li",e=[...t.querySelectorAll(s)],i=n=>n.closest("pre")||n.closest("code")||n.closest('[aria-hidden="true"]');this.#g=[];let r=0;for(let n of e){if(i(n))continue;let h=n.textContent.trim();h&&(this.#g.push({element:n,text:h,speechStart:r,speechEnd:r+h.length}),r+=h.length+1)}this.#h=this.#g.map(n=>n.text).join(" ")}#F(t){if(!this.#h)return;let s=t>0?this.#h.slice(t):this.#h;if(!s.trim())return;let e=s.replace(/[<>]/g," "),i=new SpeechSynthesisUtterance(e);i.rate=this.#f(parseFloat(this.#y?.value??this.getAttribute("speed")??"1")||1);let r=this.#m?.selectedOptions[0];if(r?.dataset.voiceUri){let n=speechSynthesis.getVoices().find(h=>h.voiceURI===r.dataset.voiceUri);n&&(i.voice=n)}i.onboundary=n=>{if(n.name!=="word")return;let h=t+n.charIndex;this.#p=h;let o=n.charLength;if(!o){let a=this.#h.slice(h).match(/^\S+/);o=a?a[0].length:1}this.#Y(h,o),this.#d("text-reader:word",{word:this.#h.slice(h,h+o),charIndex:h,element:this.#P(h)?.element})},i.onend=()=>{let n=Date.now()-this.#$;this.#k(),this.#d("text-reader:end",{duration:n})},i.onerror=n=>{n.error==="interrupted"||n.error==="canceled"||(console.warn("<text-reader>: SpeechSynthesisUtterance error:",n.error),this.#k(),this.#d("text-reader:error",{error:n.error}))},this.#o=i,this.#i=!0,this.#n=!1,this.#$=Date.now(),this.#p=t,this.#N(!0),speechSynthesis.cancel(),speechSynthesis.speak(i),this.#z(),this.#d("text-reader:play",{voice:i.voice?.name,speed:i.rate})}#x(){let t=this.#p;speechSynthesis.cancel(),this.#v(),requestAnimationFrame(()=>this.#F(t))}#z(){this.#v(),this.#b=setInterval(()=>{if(!speechSynthesis.speaking){this.#v();return}speechSynthesis.pause(),speechSynthesis.resume()},1e4)}#v(){this.#b&&clearInterval(this.#b),this.#b=null}#J(){if(!CSS.highlights)return;let t=new CSSStyleSheet;t.replaceSync(`
1
+ var E=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function b(l,t,e={}){let s=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:s},n=m.get(l);if(customElements.get(l)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${l}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=s){n.priority===s&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}m.set(l,i),customElements.define(l,t)}var p=class extends HTMLElement{#h=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#h)t();this.#h=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,s,i){t.addEventListener(e,s,i),this.#h.push(()=>t.removeEventListener(e,s,i))}_reinit(){for(let t of this.#h)t();this.#h=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let s=this.#t.states;try{e?s.add(t):s.delete(t)}catch{let i=`--${t}`;e?s.add(i):s.delete(i)}}_adoptInternals(t){this.#t||(this.#t=t)}#n(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var y={play:"Play",pause:"Pause",stop:"Stop",reader:"Article reader",controls:"Reader controls",voice:"Voice","loading-voices":"Loading voices\u2026",speed:"Speed",slower:"Slower",faster:"Faster"},v='[aria-hidden="true"], [hidden], script, style, template, text-reader',S=()=>typeof HTMLElement<"u"&&Object.prototype.hasOwnProperty.call(HTMLElement.prototype,"popover"),f=()=>typeof window<"u"&&"speechSynthesis"in window,u=l=>(l||"").toLowerCase().split(/[-_]/)[0],g=class extends p{#h=null;#t=null;#n=[];#c="";#g=0;#S=null;#x=null;#$=null;#C=null;#i=!1;#a=!1;#B=0;#r=null;#u=null;#p=null;#m=null;#b=null;#v=null;#L=null;#k=!1;#o=null;#e=null;#E=[];#V=[];static get observedAttributes(){return["speed","voice","for"]}attributeChangedCallback(t,e,s){if(e!==s&&(t==="for"&&e!==null&&this.hasAttribute("data-upgraded")&&(this.#i&&this.stop(),this.#P(),this.#D(this.#V)),(t==="speed"||t==="voice")&&this.#i&&this.#T(),t==="speed")){let i=this.#y(parseFloat(s)||1);this.#b&&(this.#b.value=String(i)),this.#v&&(this.#v.textContent=`${i}\xD7`)}}setup(){return f()?(this.getAttribute("variant")==="icon"?this.#J():this.#G(),this.#P(),this.#st(),this.#C=this.#_(),this.#C.then(t=>{this.#V=t,this.#D(t)}),this.listen(window,"beforeunload",this.#ot),!0):(this.style.display="none",!1)}teardown(){this.#i&&this.stop(),this.#it(),this.#L?.remove(),this.#e?.remove(),this.#o?.remove(),this.#L=null,this.#e=null,this.#o=null,this.#r=this.#u=this.#p=null,this.#m=null,this.#b=null,this.#v=null,this.#k=!1;for(let{icon:t,slot:e}of this.#E)t.setAttribute("slot",e),this.append(t);this.#E=[]}play(){if(f()){if(this.#a){this.resume();return}this.#i||(this.#H(),this.#R(0))}}pause(){!this.#i||this.#a||(speechSynthesis.pause(),this.#a=!0,this.#K(!0),this.#d("text-reader:pause"))}resume(){this.#a&&(speechSynthesis.resume(),this.#a=!1,this.#K(!1),this.#d("text-reader:resume"))}stop(){!f()||!this.#i||(this.#t=null,speechSynthesis.cancel(),this.#A(),this.#d("text-reader:stop"))}get voices(){return this.#C||this.#_()}get speaking(){return this.#i}get paused(){return this.#a}get progress(){return this.#c.length?Math.min(this.#g/this.#c.length,1):0}#G(){let t=document.createElement("div");t.setAttribute("part","controls"),t.setAttribute("role","group"),t.setAttribute("aria-label",this.#s("reader"));let e=this.#l("play",this.#s("play"),"\u25B6");e.addEventListener("click",()=>this.play());let s=this.#l("pause",this.#s("pause"),"\u23F8");s.hidden=!0,s.addEventListener("click",()=>this.pause());let i=this.#l("stop",this.#s("stop"),"\u23F9");i.disabled=!0,i.addEventListener("click",()=>this.stop());let n=document.createElement("select");n.setAttribute("aria-label",this.#s("voice"));let o=document.createElement("option");o.textContent=this.#s("loading-voices"),n.append(o),n.addEventListener("change",()=>{this.#i&&this.#T()});let h=document.createElement("label");h.setAttribute("data-speed-group","");let r=document.createElement("span");r.setAttribute("data-speed-value","");let a=this.#y(parseFloat(this.getAttribute("speed")??"1")||1);r.textContent=`${a}\xD7`;let c=document.createElement("input");c.type="range",c.min="0.5",c.max="2",c.step="0.1",c.value=String(a),c.setAttribute("aria-label",this.#s("speed")),c.addEventListener("input",()=>{let d=parseFloat(c.value);r.textContent=`${d}\xD7`,this.#i&&this.#T()}),h.append(r,c),this.#f("icon-play",e),this.#f("icon-pause",s),this.#f("icon-stop",i),t.append(e,s,i,n,h),this.prepend(t),this.#L=t,this.#r=e,this.#u=s,this.#p=i,this.#m=n,this.#b=c,this.#v=r}#l(t,e,s){let i=document.createElement("button");return i.type="button",i.setAttribute("part",`button ${t}`),i.setAttribute("aria-label",e),i.textContent=s,i}#s(t){return this.getAttribute(`data-label-${t}`)||y[t]}#f(t,e){let s=this.querySelector(`:scope > [slot="${t}"]`);s&&(s.removeAttribute("slot"),e.textContent="",e.append(s),this.#E.push({icon:s,slot:t}))}#J(){this.#k=!0;for(let s of this.querySelectorAll(':scope > [part="trigger"]'))s.remove();let t=document.createElement("button");t.type="button",t.setAttribute("part","trigger"),t.setAttribute("aria-label",this.#s("reader")),t.setAttribute("aria-pressed","false");let e=this.querySelector(':scope > [slot="icon-trigger"]');if(e)e.removeAttribute("slot"),t.append(e),this.#E.push({icon:e,slot:"icon-trigger"});else{let s=document.createElement("icon-wc");s.setAttribute("name","volume-2"),s.setAttribute("aria-hidden","true"),t.append(s)}t.addEventListener("click",()=>this.#z()),this.append(t),this.#o=t,this.#X()}#X(){let t=document.createElement("div");t.setAttribute("data-text-reader-toolbar",""),t.setAttribute("role","group"),t.setAttribute("aria-label",this.#s("controls")),t.hidden=!0,S()&&(t.popover="manual");let e=this.#l("play",this.#s("play"),"\u25B6");e.addEventListener("click",()=>this.play());let s=this.#l("pause",this.#s("pause"),"\u23F8");s.hidden=!0,s.addEventListener("click",()=>this.pause());let i=this.#l("stop",this.#s("stop"),"\u23F9");i.addEventListener("click",()=>this.stop());let n=this.#l("speed-down",this.#s("slower"),"\u2212");n.addEventListener("click",()=>this.#I(-.1));let o=document.createElement("span");o.setAttribute("data-speed-value","");let h=this.#y(parseFloat(this.getAttribute("speed")??"1")||1);o.textContent=`${h}\xD7`;let r=this.#l("speed-up",this.#s("faster"),"+");r.addEventListener("click",()=>this.#I(.1)),this.#f("icon-play",e),this.#f("icon-pause",s),this.#f("icon-stop",i),t.append(e,s,i,n,o,r),this.append(t),this.#r=e,this.#u=s,this.#p=i,this.#v=o,this.#e=t,this.listen(document,"pointerdown",this.#Y),this.listen(document,"keydown",this.#Z)}#z(){if(!this.#i){this.play();return}this.#e?.hidden&&this.#F(),this.#a?this.resume():this.pause()}#F(){if(!this.#e||!this.#o)return;let t=this.#e;t.hidden=!1,t.popover&&!t.matches(":popover-open")&&t.showPopover(),t.style.visibility="hidden",requestAnimationFrame(()=>{this.#Q(),t.style.visibility=""})}#M(){let t=this.#e;if(!t||t.hidden)return;let e=t.contains(document.activeElement);t.popover&&t.matches(":popover-open")&&t.hidePopover(),t.hidden=!0,e&&this.#o?.focus()}#Q(){let t=this.#e,e=this.#o;if(!t||!e)return;let s=e.getBoundingClientRect(),i=t.offsetWidth,n=t.offsetHeight,o=8,h=8,r=s.top-n-o;r<h&&(r=s.bottom+o);let a=s.left+s.width/2-i/2,c=window.innerWidth-i-h;a=Math.max(h,Math.min(a,c)),t.style.top=`${r}px`,t.style.left=`${a}px`}#I(t){let e=parseFloat(this.getAttribute("speed")??"1")||1,s=this.#y(e+t);this.setAttribute("speed",String(s))}#Y=t=>{!this.#e||this.#e.hidden||this.#e.contains(t.target)||this.#o?.contains(t.target)||this.#M()};#Z=t=>{if(t.key==="Escape"&&this.#e&&!this.#e.hidden){let e=this.#e.contains(document.activeElement)||this.#o===document.activeElement;this.#M(),e&&this.#o?.focus()}};#P(){let t=this.getAttribute("for");if(!t){console.warn('<text-reader>: missing "for" attribute'),this.#q();return}if(this.#h=document.getElementById(t),!this.#h){console.warn(`<text-reader>: no element found with id="${t}"`),this.#q();return}this.#H(),this.#tt()}#q(){this.#r&&(this.#r.disabled=!0),this.#p&&(this.#p.disabled=!0)}#tt(){this.#r&&(this.#r.disabled=!1)}#H(){let t=this.#h;if(!t)return;let e=this.getAttribute("selectors")||"p,li",s=[...t.querySelectorAll(e)],i=o=>o.closest("pre")||o.closest("code")||o.closest(v);this.#n=[];let n=0;for(let o of s){if(i(o))continue;let h=[],r="",a=document.createTreeWalker(o,NodeFilter.SHOW_TEXT,{acceptNode:c=>c.parentElement?.closest(v)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(;a.nextNode();){let c=a.currentNode,d=c.data;d&&(h.push({node:c,start:r.length,end:r.length+d.length}),r+=d)}r.trim()&&(this.#n.push({element:o,text:r,speechStart:n,speechEnd:n+r.length,segments:h}),n+=r.length+1)}this.#c=this.#n.map(o=>o.text).join(" ")}#N(){return this.#h?.closest("[lang]")?.getAttribute("lang")||document.documentElement.lang||""}#R(t){if(!this.#c)return;let e=t>0?this.#c.slice(t):this.#c;if(!e.trim())return;let s=e.replace(/[<>]/g," "),i=new SpeechSynthesisUtterance(s),n=this.#N();n&&(i.lang=n),i.rate=this.#y(parseFloat(this.#b?.value??this.getAttribute("speed")??"1")||1);let o=this.#m?.selectedOptions[0];if(o?.dataset.voiceUri){let h=speechSynthesis.getVoices().find(r=>r.voiceURI===o.dataset.voiceUri);h&&(i.voice=h)}else if(n){let h=u(n),r=speechSynthesis.getVoices(),a=r.find(c=>c.lang.toLowerCase()===n.toLowerCase())||r.find(c=>u(c.lang)===h&&c.default)||r.find(c=>u(c.lang)===h);a&&(i.voice=a)}i.onboundary=h=>{if(this.#t!==i||h.name!=="word")return;let r=t+h.charIndex;this.#g=r;let a=h.charLength;if(!a){let d=this.#c.slice(r).match(/^\S+/);a=d?d[0].length:1}this.#nt(r,a),this.#d("text-reader:word",{word:this.#c.slice(r,r+a),charIndex:r,element:this.#O(r)?.element})},i.onend=()=>{if(this.#t!==i)return;let h=Date.now()-this.#B;this.#A(),this.#d("text-reader:end",{duration:h})},i.onerror=h=>{if(this.#t===i){if(h.error==="interrupted"||h.error==="canceled"){this.#A(),this.#d("text-reader:stop");return}console.warn("<text-reader>: SpeechSynthesisUtterance error:",h.error),this.#A(),this.#d("text-reader:error",{error:h.error})}},this.#t=i,this.#i=!0,this.#a=!1,this.#B=Date.now(),this.#g=t,this.#W(!0),speechSynthesis.cancel(),speechSynthesis.speak(i),this.#et(),this.#d("text-reader:play",{voice:i.voice?.name,speed:i.rate})}#T(){let t=this.#g;this.#t=null,speechSynthesis.cancel(),this.#w(),requestAnimationFrame(()=>this.#R(t))}#et(){this.#w(),this.#S=setInterval(()=>{if(!speechSynthesis.speaking){this.#w();return}speechSynthesis.pause(),speechSynthesis.resume()},1e4)}#w(){this.#S&&clearInterval(this.#S),this.#S=null}#st(){if(!CSS.highlights)return;let t=new CSSStyleSheet;t.replaceSync(`
2
2
  ::highlight(text-reader-word) {
3
3
  background-color: var(--text-reader-highlight, Mark);
4
4
  color: var(--text-reader-highlight-text, MarkText);
5
5
  }
6
- `),this.#E=t,document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}#Q(){let t=this.#E;t&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(s=>s!==t),this.#E=null),this.#V()}#Y(t,s){if(!CSS.highlights||this.getAttribute("highlight")==="false")return;let e=this.#P(t);if(!e)return;let i=t-e.speechStart,r=this.#Z(e.element,i,s);if(!r)return;let n=new Highlight(r);if(CSS.highlights.set("text-reader-word",n),this.#C=n,this.getAttribute("scroll")!=="false"){let h=r.getBoundingClientRect(),o=window.innerHeight;(h.top<0||h.bottom>o)&&e.element.scrollIntoView({behavior:"smooth",block:"nearest"})}}#V(){CSS.highlights&&CSS.highlights.delete("text-reader-word"),this.#C=null}#P(t){let s=this.#g,e=0,i=s.length-1;for(;e<=i;){let r=e+i>>>1,n=s[r];if(t<n.speechStart)i=r-1;else if(t>=n.speechEnd)e=r+1;else return n}return null}#Z(t,s,e){let i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),r=0;for(;i.nextNode();){let n=i.currentNode,h=n.textContent??"";if(!h.trim())continue;let o=h.length;if(r+o>s){let l=s-r,a=document.createRange();a.setStart(n,Math.min(l,o));let d=l+e;return d<=o?a.setEnd(n,d):a.setEnd(n,o),a}r+=o}return null}async#q(){let t=speechSynthesis.getVoices();return t.length>0?t:new Promise(s=>{let e=()=>{speechSynthesis.removeEventListener("voiceschanged",e),s(speechSynthesis.getVoices())};speechSynthesis.addEventListener("voiceschanged",e),setTimeout(()=>{speechSynthesis.removeEventListener("voiceschanged",e),s(speechSynthesis.getVoices())},3e3)})}#tt(t){if(!this.#m||!t.length)return;let s=this.#m;s.innerHTML="";let e=document.documentElement.lang||"en",i=t.filter(o=>o.lang.startsWith(e)),r=t.filter(o=>!o.lang.startsWith(e)),n=[...i,...r],h=this.getAttribute("voice");for(let o of n){let l=document.createElement("option");l.textContent=`${o.name} (${o.lang})`,l.dataset.voiceUri=o.voiceURI,h&&o.voiceURI===h&&(l.selected=!0),s.append(l)}if(!h){let o=i.find(l=>l.default)||i[0];if(o){let l=[...s.options].find(a=>a.dataset.voiceUri===o.voiceURI);l&&(l.selected=!0)}}}#N(t){!this.#e||!this.#l||!this.#c||(t?(this.#e.hidden=!0,this.#l.hidden=!1,this.#c.disabled=!1):(this.#e.hidden=!1,this.#l.hidden=!0,this.#c.disabled=!0),this.#L&&(this.#r&&this.#r.setAttribute("aria-pressed",String(t)),t?this.#M():this.#A()))}#U(t){!this.#e||!this.#l||(this.#e.hidden=!t,this.#l.hidden=t)}#k(){this.#i=!1,this.#n=!1,this.#p=0,this.#o=null,this.#v(),this.#V(),this.#N(!1)}#f(t){return Math.round(Math.max(.5,Math.min(2,t))*10)/10}#d(t,s={}){this.dispatchEvent(new CustomEvent(t,{detail:s,bubbles:!0}))}#et=()=>{speechSynthesis.cancel()}};g("text-reader",p);export{p as TextReader};
6
+ `),this.#x=t,document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}#it(){let t=this.#x;t&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(e=>e!==t),this.#x=null),this.#U()}#nt(t,e){if(!CSS.highlights||this.getAttribute("highlight")==="false")return;let s=this.#O(t);if(!s)return;let i=t-s.speechStart,n=this.#rt(s,i,e);if(!n)return;let o=new Highlight(n);if(CSS.highlights.set("text-reader-word",o),this.#$=o,this.getAttribute("scroll")!=="false"){let h=n.getBoundingClientRect(),r=window.innerHeight;if(h.top<0||h.bottom>r){let a=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;s.element.scrollIntoView({behavior:a?"auto":"smooth",block:"nearest"})}}}#U(){CSS.highlights&&CSS.highlights.delete("text-reader-word"),this.#$=null}#O(t){let e=this.#n,s=0,i=e.length-1;for(;s<=i;){let n=s+i>>>1,o=e[n];if(t<o.speechStart)i=n-1;else if(t>=o.speechEnd)s=n+1;else return o}return null}#rt(t,e,s){let i=t.segments,n=e+s,o=i.find(a=>e>=a.start&&e<a.end);if(!o||!o.node.isConnected)return null;let h=i.find(a=>n>a.start&&n<=a.end)||o,r=document.createRange();return r.setStart(o.node,e-o.start),h.node.isConnected&&h.start>=o.start?r.setEnd(h.node,Math.min(n-h.start,h.node.length)):r.setEnd(o.node,o.node.length),r}async#_(){let t=speechSynthesis.getVoices();return t.length>0?t:new Promise(e=>{let s=()=>{speechSynthesis.removeEventListener("voiceschanged",s),e(speechSynthesis.getVoices())};speechSynthesis.addEventListener("voiceschanged",s),setTimeout(()=>{speechSynthesis.removeEventListener("voiceschanged",s),e(speechSynthesis.getVoices())},3e3)})}#D(t){if(!this.#m||!t.length)return;let e=this.#m;e.innerHTML="";let s=u(this.#N()||"en"),i=a=>u(a.lang)===s,n=t.filter(i),o=t.filter(a=>!i(a)),h=[...n,...o],r=this.getAttribute("voice");for(let a of h){let c=document.createElement("option");c.textContent=`${a.name} (${a.lang})`,c.dataset.voiceUri=a.voiceURI,r&&a.voiceURI===r&&(c.selected=!0),e.append(c)}if(!r){let a=n.find(c=>c.default)||n[0];if(a){let c=[...e.options].find(d=>d.dataset.voiceUri===a.voiceURI);c&&(c.selected=!0)}}}#j(t,e){let s=document.activeElement;t();for(let[i,n]of e)if(i&&n&&s===i&&!n.hidden&&!n.disabled){n.focus();return}}#W(t){if(!this.#r||!this.#u||!this.#p)return;let e=this.#r,s=this.#u,i=this.#p;this.#j(()=>{e.hidden=t,s.hidden=!t,i.disabled=!t},t?[[e,s]]:[[s,e],[i,e]]),this.#k&&(this.#o&&this.#o.setAttribute("aria-pressed",String(t)),t?this.#F():this.#M())}#K(t){if(!this.#r||!this.#u)return;let e=this.#r,s=this.#u;this.#j(()=>{e.hidden=!t,s.hidden=t},t?[[s,e]]:[[e,s]])}#A(){this.#i=!1,this.#a=!1,this.#g=0,this.#t=null,this.#w(),this.#U(),this.#W(!1)}#y(t){return Math.round(Math.max(.5,Math.min(2,t))*10)/10}#d(t,e={}){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}#ot=()=>{this.#i&&speechSynthesis.cancel()}};b("text-reader",g);export{g as TextReader};
7
7
  //# sourceMappingURL=text-reader.js.map