vanilla-breeze 0.4.1 → 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 (282) hide show
  1. package/custom-elements.json +23012 -11383
  2. package/dist/cdn/components/accordion-wc.js +1 -1
  3. package/dist/cdn/components/activity-feed.js +1 -1
  4. package/dist/cdn/components/ai-chat.js +9 -6
  5. package/dist/cdn/components/ai-summary.js +4 -2
  6. package/dist/cdn/components/analytics-panel.js +19 -21
  7. package/dist/cdn/components/audio-player.js +17 -7
  8. package/dist/cdn/components/audio-visualizer.js +3 -3
  9. package/dist/cdn/components/author-index.js +2 -2
  10. package/dist/cdn/components/brand-mark.js +1 -1
  11. package/dist/cdn/components/bread-crumb.js +1 -1
  12. package/dist/cdn/components/calendar-wc.js +2 -2
  13. package/dist/cdn/components/card-list.js +1 -1
  14. package/dist/cdn/components/carousel-wc.js +1 -1
  15. package/dist/cdn/components/change-set.js +1 -11
  16. package/dist/cdn/components/chart-wc.js +32 -32
  17. package/dist/cdn/components/chat-input.js +1 -1
  18. package/dist/cdn/components/chat-window.js +1 -1
  19. package/dist/cdn/components/color-picker.js +1 -1
  20. package/dist/cdn/components/combo-box.js +1 -1
  21. package/dist/cdn/components/command-palette.js +1 -1
  22. package/dist/cdn/components/comment-box.js +50 -49
  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 +84 -81
  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 -15
  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 +6 -6
  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 +88 -85
  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 +33 -1
  136. package/dist/cdn/themes/art-deco.css +1 -1
  137. package/dist/cdn/themes/art-deco.tokens.json +23 -1
  138. package/dist/cdn/themes/bauhaus-dark.tokens.json +23 -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 +33 -1
  142. package/dist/cdn/themes/brutalist.css +1 -1
  143. package/dist/cdn/themes/brutalist.tokens.json +23 -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 +33 -1
  157. package/dist/cdn/themes/claymorphism.css +1 -1
  158. package/dist/cdn/themes/claymorphism.tokens.json +24 -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 +33 -1
  168. package/dist/cdn/themes/dawn.css +1 -1
  169. package/dist/cdn/themes/dawn.tokens.json +23 -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 +23 -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 +36 -2
  195. package/dist/cdn/themes/journal.css +1 -1
  196. package/dist/cdn/themes/journal.tokens.json +26 -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 -68
  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 +33 -1
  219. package/dist/cdn/themes/nord.css +1 -1
  220. package/dist/cdn/themes/nord.tokens.json +23 -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 +23 -1
  231. package/dist/cdn/themes/solarized.css +1 -1
  232. package/dist/cdn/themes/solarized.tokens.json +23 -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 +33 -1
  237. package/dist/cdn/themes/super2026.css +1 -1
  238. package/dist/cdn/themes/super2026.tokens.json +23 -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 +33 -1
  245. package/dist/cdn/themes/tokyo-night.css +1 -1
  246. package/dist/cdn/themes/tokyo-night.tokens.json +23 -1
  247. package/dist/cdn/themes/vaporwave-dark.tokens.json +33 -1
  248. package/dist/cdn/themes/vaporwave.css +1 -1
  249. package/dist/cdn/themes/vaporwave.tokens.json +23 -1
  250. package/dist/cdn/themes/win9x-dark.tokens.json +20 -5
  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 +553 -0
  254. package/dist/cdn/vanilla-breeze-charts.css +1 -1
  255. package/dist/cdn/vanilla-breeze-charts.js +32 -32
  256. package/dist/cdn/vanilla-breeze-core.css +1 -1
  257. package/dist/cdn/vanilla-breeze-core.js +183 -281
  258. package/dist/cdn/vanilla-breeze-dev.css +1 -1
  259. package/dist/cdn/vanilla-breeze-dev.js +1 -1
  260. package/dist/cdn/vanilla-breeze-extras.js +286 -134
  261. package/dist/cdn/vanilla-breeze.css +1 -1
  262. package/dist/cdn/vanilla-breeze.js +574 -656
  263. package/dist/cdn/view-transitions.css +2 -0
  264. package/package.json +17 -9
  265. package/dist/cdn/themes/amber.css +0 -2
  266. package/dist/cdn/themes/anthropic.css +0 -2
  267. package/dist/cdn/themes/anthropic.tokens.json +0 -564
  268. package/dist/cdn/themes/coral.css +0 -2
  269. package/dist/cdn/themes/emerald.css +0 -2
  270. package/dist/cdn/themes/forest.css +0 -2
  271. package/dist/cdn/themes/ibm.css +0 -2
  272. package/dist/cdn/themes/ibm.tokens.json +0 -568
  273. package/dist/cdn/themes/indigo.css +0 -2
  274. package/dist/cdn/themes/lavender.css +0 -2
  275. package/dist/cdn/themes/mcdonalds.css +0 -2
  276. package/dist/cdn/themes/mcdonalds.tokens.json +0 -533
  277. package/dist/cdn/themes/ocean.css +0 -2
  278. package/dist/cdn/themes/rose.css +0 -2
  279. package/dist/cdn/themes/slate.css +0 -2
  280. package/dist/cdn/themes/starbucks.css +0 -2
  281. package/dist/cdn/themes/starbucks.tokens.json +0 -593
  282. package/dist/cdn/themes/sunset.css +0 -2
@@ -1,2 +1,2 @@
1
- var w=window.matchMedia("(prefers-reduced-motion: reduce)");var p=new Map;function m(t,e,r={}){let n=r.priority??10,s={impl:e,bundle:r.bundle,contract:r.contract,priority:n},i=p.get(t);if(customElements.get(t)){if(!i||i.priority>=n){i&&i.priority===n&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=n){i.priority===n&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${i.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}p.set(t,s),customElements.define(t,e)}var l=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,r,n,s){e.addEventListener(r,n,s),this.#e.push(()=>e.removeEventListener(r,n,s))}setup(){}teardown(){}setState(e,r){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{r?n.add(e):n.delete(e)}catch{let s=`--${e}`;r?n.add(s):n.delete(s)}}_adoptInternals(e){this.#t||(this.#t=e)}};function b(){let t=globalThis.localStorage;if(!t)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(e){return t.getItem(e)},async setRaw(e,r){t.setItem(e,r)},async removeRaw(e){t.removeItem(e)},async keys(e){let r=[];for(let n=0;n<t.length;n++){let s=t.key(n);s&&s.startsWith(e)&&r.push(s)}return r}}}var u=null;function a(){return u||(u=b()),u}function f(t,e){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof e!="string"||!e)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${t}:${e}`}function y(t){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${t}:`}function g(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"&&typeof e.timestamp=="number")return e}catch{}return null}var c={configure(t={}){u=t.backend??null},async set(t,e,r){let n={data:r,timestamp:Date.now()};await a().setRaw(f(t,e),JSON.stringify(n))},async get(t,e,r){let n=await a().getRaw(f(t,e));if(n==null)return null;let s=g(n);return!s||r?.maxAge!=null&&Date.now()-s.timestamp>r.maxAge?null:s.data},async remove(t,e){await a().removeRaw(f(t,e))},async list(t){let e=y(t),r=await a().keys(e),n=[];for(let s of r){let i=await a().getRaw(s);if(i==null)continue;let o=g(i);o&&n.push({key:s.slice(e.length),data:o.data,timestamp:o.timestamp})}return n},async clear(t){let e=y(t),r=await a().keys(e);for(let n of r)await a().removeRaw(n)},async clearAll(){let t=await a().keys("vb:");for(let e of t)await a().removeRaw(e)},async setMany(t,e){for(let[r,n]of e)await c.set(t,r,n)}};var h=class extends l{#e=null;static get observedAttributes(){return["position"]}get#t(){return this.getAttribute("persist")||"banner"}get#o(){let e=this.getAttribute("expires");return e==="0"||e==="never"?0:e?parseInt(e,10):365}get#a(){let e=this.#o;return e>0?e*864e5:void 0}setup(){return this.#e=this.querySelector("dialog"),this.#e?(this.getAttribute("trigger")&&this.listen(document,"click",this.#u),this.#c(),!0):!1}async#c(){if(await this.#i()){this.getAttribute("trigger")?this.hidden=!0:this.remove();return}this.#n()}#n(){(this.getAttribute("position")||"bottom")==="center"?(this.#e.showModal(),this.#e.addEventListener("cancel",this.#r)):this.#e.show(),this.addEventListener("click",this.#s)}#l(){this.#e.removeEventListener("cancel",this.#r),this.removeEventListener("click",this.#s),this.#e.close(),this.getAttribute("trigger")?this.hidden=!0:this.remove()}#r=e=>{e.preventDefault()};#s=async e=>{let r=e.target.closest("button[value]");if(!r)return;let n=r.value;if(!["accept","reject","save"].includes(n))return;let s=[...this.querySelectorAll('input[type="checkbox"]')],i={};n==="accept"?s.forEach(o=>{i[o.name]=!0}):n==="reject"?s.forEach(o=>{i[o.name]=!!o.disabled}):s.forEach(o=>{i[o.name]=o.checked}),await this.#d({preferences:i,action:n}),this.dispatchEvent(new CustomEvent("consent-banner:change",{bubbles:!0,detail:{preferences:i,action:n}})),this.#l()};#u=async e=>{let r=this.getAttribute("trigger");if(!r||!e.target.closest(r))return;e.preventDefault();let s=await this.#i();if(s?.preferences)for(let[i,o]of Object.entries(s.preferences)){let d=this.querySelector(`input[type="checkbox"][name="${CSS.escape(i)}"]`);d&&!d.disabled&&(d.checked=o)}this.hidden=!1,this.#n()};async#i(){let e=this.#a;return await c.get("consent",this.#t,e?{maxAge:e}:void 0)}async#d(e){await c.set("consent",this.#t,e)}static async reset(e="banner"){await c.remove("consent",e)}static async getConsent(e="banner"){return await c.get("consent",e)}};m("consent-banner",h);export{h as ConsentBanner};
1
+ var x=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function b(t,e,n={}){let r=n.priority??10,i={impl:e,bundle:n.bundle,contract:n.contract,priority:r},s=m.get(t);if(customElements.get(t)){if(!s||s.priority>=r){s&&s.priority===r&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}m.set(t,i),customElements.define(t,e)}var u=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,r,i){e.addEventListener(n,r,i),this.#e.push(()=>e.removeEventListener(n,r,i))}_reinit(){for(let e of this.#e)e();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,n){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{n?r.add(e):r.delete(e)}catch{let i=`--${e}`;n?r.add(i):r.delete(i)}}_adoptInternals(e){this.#t||(this.#t=e)}#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}};function A(){let t=globalThis.localStorage;if(!t)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(e){return t.getItem(e)},async setRaw(e,n){t.setItem(e,n)},async removeRaw(e){t.removeItem(e)},async keys(e){let n=[];for(let r=0;r<t.length;r++){let i=t.key(r);i&&i.startsWith(e)&&n.push(i)}return n}}}var l="__vbStoreBackend",d=globalThis;function a(){return d[l]||(d[l]=A()),d[l]}function p(t,e){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof e!="string"||!e)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${t}:${e}`}function g(t){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${t}:`}function w(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"&&typeof e.timestamp=="number")return e}catch{}return null}var c={configure(t={}){d[l]=t.backend??null},async set(t,e,n){let r={data:n,timestamp:Date.now()};await a().setRaw(p(t,e),JSON.stringify(r))},async get(t,e,n){let r=await a().getRaw(p(t,e));if(r==null)return null;let i=w(r);return!i||n?.maxAge!=null&&Date.now()-i.timestamp>n.maxAge?null:i.data},async remove(t,e){await a().removeRaw(p(t,e))},async list(t){let e=g(t),n=await a().keys(e),r=[];for(let i of n){let s=await a().getRaw(i);if(s==null)continue;let o=w(s);o&&r.push({key:i.slice(e.length),data:o.data,timestamp:o.timestamp})}return r},async clear(t){let e=g(t),n=await a().keys(e);for(let r of n)await a().removeRaw(r)},async clearAll(){let t=await a().keys("vb:");for(let e of t)await a().removeRaw(e)},async setMany(t,e){for(let[n,r]of e)await c.set(t,n,r)}};if(typeof window<"u"){let t=window.VB??(window.VB={});t.store??=c}var f="banner",E=365,k=864e5;function v(t){if(t===0||t==="0"||t==="never")return;let e=t==null||t===""?E:Number.parseFloat(String(t));return Number.isFinite(e)?e>0?e*k:void 0:E*k}var S=0,y=class extends u{#e=null;static get observedAttributes(){return["position"]}get#t(){return this.getAttribute("persist")||f}get#n(){return v(this.getAttribute("expires"))}get#r(){return this.getAttribute("position")==="center"}setup(){return this.#e=this.querySelector("dialog"),this.#e?(this.#a(),this.getAttribute("trigger")&&this.listen(document,"click",this.#f),this.listen(this,"click",this.#d),this.listen(this.#e,"cancel",this.#l),this.#c(),!0):!1}attributeChangedCallback(e,n,r){n===r||!this.#e?.open||(this.#e.close(),this.#i())}#a(){let e=this.#e;if(e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby"))return;let n=e.querySelector("h1, h2, h3, h4, h5, h6");n?(n.id||(n.id=`consent-banner-title-${++S}`),e.setAttribute("aria-labelledby",n.id)):e.setAttribute("aria-label","Cookie consent")}async#c(){if(await this.#o()){this.getAttribute("trigger")?this.hidden=!0:this.remove();return}this.#s()}#i(){this.#r?this.#e.showModal():this.#e.show()}#s(){!this.isConnected||this.#e.open||this.#i()}#u(){this.#e.close(),this.getAttribute("trigger")?this.hidden=!0:this.remove()}#l=e=>{this.#r&&e.preventDefault()};#d=async e=>{if(!this.#e.open)return;let n=e.target.closest("button[value]");if(!n||!this.#e.contains(n))return;let r=n.value;if(!["accept","reject","save"].includes(r))return;let i=[...this.querySelectorAll('input[type="checkbox"]')],s={};r==="accept"?i.forEach(o=>{s[o.name]=!0}):r==="reject"?i.forEach(o=>{s[o.name]=!!o.disabled}):i.forEach(o=>{s[o.name]=o.checked}),await this.#h({preferences:s,action:r}),this.dispatchEvent(new CustomEvent("consent-banner:change",{bubbles:!0,detail:{preferences:s,action:r}})),this.#u()};#f=async e=>{let n=this.getAttribute("trigger");if(!n||!e.target.closest(n))return;e.preventDefault();let i=await this.#o();if(i?.preferences)for(let[s,o]of Object.entries(i.preferences)){let h=this.querySelector(`input[type="checkbox"][name="${CSS.escape(s)}"]`);h&&!h.disabled&&(h.checked=o)}this.hidden=!1,this.#s()};async#o(){let e=this.#n;try{return await c.get("consent",this.#t,e?{maxAge:e}:void 0)}catch{return null}}async#h(e){try{await c.set("consent",this.#t,e)}catch{}}static async reset(e=f){try{await c.remove("consent",e)}catch{}}static async getConsent(e=f,n={}){let r=n.expires;r===void 0&&typeof document<"u"&&(r=[...document.querySelectorAll("consent-banner")].find(o=>(o.getAttribute("persist")||f)===e)?.getAttribute("expires")??void 0);let i=v(r);try{return await c.get("consent",e,i?{maxAge:i}:void 0)}catch{return null}}};b("consent-banner",y);export{y as ConsentBanner};
2
2
  //# sourceMappingURL=consent-banner.js.map
@@ -1,2 +1,2 @@
1
- var p=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function f(i,e,t={}){let n=t.priority??10,r={impl:e,bundle:t.bundle,contract:t.contract,priority:n},s=u.get(i);if(customElements.get(i)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${s.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}u.set(i,r),customElements.define(i,e)}var c=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,n,r){e.addEventListener(t,n,r),this.#e.push(()=>e.removeEventListener(t,n,r))}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{t?n.add(e):n.delete(e)}catch{let r=`--${e}`;t?n.add(r):n.delete(r)}}_adoptInternals(e){this.#t||(this.#t=e)}};var a=class extends c{#e=new Map;#t="";#n=null;setup(){if(this.#i(),this.#e.size===0)return!1;this.#o(),this.#c();let e=this.#l();return this.#s(e,!1),!0}#i(){for(let e of this.children){let t=e.getAttribute("data-lens-name");t&&this.#e.set(t,e)}}#o(){let e=this.getAttribute("data-lens-src");if(e)for(let t of this.#e.values())!t.hasAttribute("data-lens-src")&&!t.hasAttribute("src")&&t.setAttribute("data-lens-src",e)}#c(){if(this.getAttribute("data-lens-controls")==="off"||this.#n?.parentNode===this)return;let e=document.createElement("nav");e.setAttribute("data-content-lens-controls",""),e.setAttribute("aria-label","Switch lens");let t=document.createElement("fieldset"),n=document.createElement("legend");n.textContent="View",t.append(n);let r=`content-lens-${Math.random().toString(36).slice(2,8)}`;for(let[s,h]of this.#e){let l=document.createElement("label"),o=document.createElement("input");o.type="radio",o.name=r,o.value=s,o.addEventListener("change",()=>{o.checked&&this.#s(s,!0)});let d=document.createElement("span");d.textContent=h.getAttribute("data-lens-label")||this.#a(s),l.append(o,d),t.append(l)}e.append(t),this.prepend(e),this.#n=e}#a(e){return e.replace(/-/g," ").replace(/\b\w/g,t=>t.toUpperCase())}#r(){return`vb:content-lens:${this.getAttribute("data-lens-storage")||(typeof location<"u"?location.pathname:"default")}`}#l(){let e=(()=>{try{return typeof sessionStorage<"u"?sessionStorage.getItem(this.#r()):null}catch{return null}})();if(e&&this.#e.has(e))return e;let t=this.getAttribute("data-lens-default");return t&&this.#e.has(t)?t:[...this.#e.keys()][0]}#s(e,t){if(this.#e.has(e)){for(let[n,r]of this.#e){let s=n===e;r.toggleAttribute("hidden",!s),r.setAttribute("aria-hidden",s?"false":"true")}if(this.#n){let n=this.#n.querySelector(`input[value="${e}"]`);n&&(n.checked=!0)}if(this.#t=e,this.setAttribute("data-active-lens",e),t)try{sessionStorage.setItem(this.#r(),e)}catch{}this.dispatchEvent(new CustomEvent("content-lens:change",{detail:{lens:e},bubbles:!0}))}}get activeLens(){return this.#t}setLens(e){this.#s(e,!0)}};f("content-lens",a);export{a as ContentLens};
1
+ var f=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function h(r,t,e={}){let n=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:n},s=u.get(r);if(customElements.get(r)){if(!s||s.priority>=n){s&&s.priority===n&&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>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.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;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,i){t.addEventListener(e,n,i),this.#t.push(()=>t.removeEventListener(e,n,i))}_reinit(){for(let t of this.#t)t();this.#t=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#e||(this.#e=this.attachInternals());let n=this.#e.states;try{e?n.add(t):n.delete(t)}catch{let i=`--${t}`;e?n.add(i):n.delete(i)}}_adoptInternals(t){this.#e||(this.#e=t)}#n(){return this.constructor.formAssociated&&this.#e?this.#e: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 d=class extends c{#t=new Map;#e="";#n=null;setup(){if(this.#r(),this.#t.size===0)return!1;this.#o(),this.#a();let t=this.#d();return this.#s(t,{persist:!1,notify:!1}),!0}#r(){for(let t of this.children){let e=t.getAttribute("data-lens-name");e&&this.#t.set(e,t)}}#o(){let t=this.getAttribute("data-lens-src");if(t)for(let e of this.#t.values()){if(e.hasAttribute("data-lens-src")||e.hasAttribute("src"))continue;e.setAttribute("data-lens-src",t);let n=e;e.hasAttribute("data-upgraded")&&typeof n._reinit=="function"&&n._reinit()}}#a(){if(this.getAttribute("data-lens-controls")==="off"||this.#n?.parentNode===this)return;let t=document.createElement("fieldset");t.setAttribute("data-content-lens-controls","");let e=document.createElement("legend");e.textContent="View",t.append(e);let n=`content-lens-${Math.random().toString(36).slice(2,8)}`;for(let[i,s]of this.#t){let a=document.createElement("label"),o=document.createElement("input");o.type="radio",o.name=n,o.value=i,o.addEventListener("change",()=>{o.checked&&this.#s(i,{persist:!0,notify:!0})});let l=document.createElement("span");l.textContent=s.getAttribute("data-lens-label")||this.#c(i),a.append(o,l),t.append(a)}this.prepend(t),this.#n=t}#c(t){return t.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}#i(){return`vb:content-lens:${this.getAttribute("data-lens-storage")||(typeof location<"u"?location.pathname:"default")}`}#d(){let t=(()=>{try{return typeof sessionStorage<"u"?sessionStorage.getItem(this.#i()):null}catch{return null}})();if(t&&this.#t.has(t))return t;let e=this.getAttribute("data-lens-default");return e&&this.#t.has(e)?e:[...this.#t.keys()][0]}#s(t,{persist:e,notify:n}){if(!this.#t.has(t))return;let i=t!==this.#e;for(let[s,a]of this.#t){let o=s===t;a.toggleAttribute("hidden",!o),a.setAttribute("aria-hidden",o?"false":"true")}if(this.#n){let s=this.#n.querySelector(`input[value="${CSS.escape(t)}"]`);s&&(s.checked=!0)}if(this.#e=t,this.setAttribute("data-active-lens",t),e)try{sessionStorage.setItem(this.#i(),t)}catch{}n&&i&&this.dispatchEvent(new CustomEvent("content-lens:change",{detail:{lens:t},bubbles:!0}))}get activeLens(){return this.#e}setLens(t){this.#s(t,{persist:!0,notify:!0})}};h("content-lens",d);export{d as ContentLens};
2
2
  //# sourceMappingURL=content-lens.js.map
@@ -1,2 +1,2 @@
1
- function y(t){return document.startViewTransition?document.startViewTransition(t):t()}var M=window.matchMedia("(prefers-reduced-motion: reduce)");var m=new Map;function E(t,e,o={}){let n=o.priority??10,r={impl:e,bundle:o.bundle,contract:o.contract,priority:n},s=m.get(t);if(customElements.get(t)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${o.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${o.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=n){s.priority===n&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}". Skipping "${o.bundle}" (first wins at equal priority).`);return}m.set(t,r),customElements.define(t,e)}var p=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,o,n,r){e.addEventListener(o,n,r),this.#t.push(()=>e.removeEventListener(o,n,r))}setup(){}teardown(){}setState(e,o){this.#e||(this.#e=this.attachInternals());let n=this.#e.states;try{o?n.add(e):n.delete(e)}catch{let r=`--${e}`;o?n.add(r):n.delete(r)}}_adoptInternals(e){this.#e||(this.#e=e)}};var k=0;function b(t,e){return t.matches("content-swap")?e:`data-${e}`}function l(t){t.style.viewTransitionName||(t.style.viewTransitionName=`content-swap-${++k}`);let e=t.querySelector(':scope > [data-face="front"]'),o=t.querySelector(':scope > [data-face="back"]');if(!e||!o)return;let n=[];function r(i,a,u,c){i.addEventListener(a,u,c),n.push(()=>i.removeEventListener(a,u,c))}let s=[...t.querySelectorAll("[data-swap]")].filter(i=>i!==t&&i.closest("content-swap, [data-swap]")===t);return s.length===0?(t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.getAttribute("aria-label")||t.setAttribute("aria-label","Toggle content"),r(t,"click",()=>d(t,"pointer")),r(t,"keydown",i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),d(t,"keyboard"))})):s.forEach(i=>{r(i,"click",a=>{a.stopPropagation(),d(t,"pointer")}),r(i,"keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),d(t,"keyboard"))})}),t.matches('[data-gesture="flick"], [data-gesture="swipe"]')&&(r(t,"swipe-left",()=>d(t,"pointer")),r(t,"swipe-right",()=>d(t,"pointer"))),v(t,e,o),()=>{for(let i of n)i();n.length=0}}function v(t,e,o){let n=t.hasAttribute(b(t,"swapped"));e.inert=n,o.inert=!n}function A(t){return{front:t.querySelector(':scope > [data-face="front"]'),back:t.querySelector(':scope > [data-face="back"]')}}function f(t,e,o="api"){let{front:n,back:r}=A(t);if(!n||!r)return;let s=b(t,"swapped");if(e&&t.hasAttribute(s)||!e&&!t.hasAttribute(s))return;let w=()=>{e?t.setAttribute(s,""):t.removeAttribute(s),v(t,n,r),T(t,o);let u=e?r:n,c=u.querySelector("[autofocus]");c?c.focus():o==="keyboard"&&$(u)},i=u=>{let c=t;typeof c.setState=="function"&&c.setState("transition-running",u)};i(!0);let a=y(w);a&&a.finished&&typeof a.finished.finally=="function"?a.finished.finally(()=>i(!1)):i(!1)}function d(t,e="api"){f(t,!t.hasAttribute(b(t,"swapped")),e)}function T(t,e="internal"){t.dispatchEvent(new CustomEvent("content-swap:swap",{detail:{swapped:t.hasAttribute(b(t,"swapped")),source:e},bubbles:!0}))}function $(t){let e=t.querySelector("[data-swap], button, a, input, select, textarea");e&&e.focus()}var h=class extends p{#t=null;setup(){this.#t=l(this)??null}teardown(){this.#t?.(),this.#t=null}flip(){f(this,!0)}unflip(){f(this,!1)}toggle(){d(this)}get flipped(){return this.hasAttribute("swapped")}set flipped(e){f(this,!!e)}get swapped(){return this.hasAttribute("swapped")}set swapped(e){f(this,!!e)}};E("content-swap",h);function g(){document.querySelectorAll("[data-swap]:not(content-swap):not([data-swap-init])").forEach(t=>{t.querySelector(":scope > [data-face]")&&(l(t),t.setAttribute("data-swap-init",""))})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",g):g();var S=new MutationObserver(t=>{for(let e of t)for(let o of e.addedNodes){if(o.nodeType!==Node.ELEMENT_NODE)continue;let n=o;n.hasAttribute("data-swap")&&!n.matches("content-swap")&&!n.hasAttribute("data-swap-init")&&n.querySelector(":scope > [data-face]")&&(l(n),n.setAttribute("data-swap-init","")),n.querySelectorAll("[data-swap]:not(content-swap):not([data-swap-init])").forEach(r=>{r.querySelector(":scope > [data-face]")&&(l(r),r.setAttribute("data-swap-init",""))})}});document.body?S.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{S.observe(document.body,{childList:!0,subtree:!0})});export{h as ContentSwap};
1
+ function E(t){return document.startViewTransition?document.startViewTransition(t):t()}var x=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function S(t,e,n={}){let r=n.priority??10,i={impl:e,bundle:n.bundle,contract:n.contract,priority:r},s=v.get(t);if(customElements.get(t)){if(!s||s.priority>=r){s&&s.priority===r&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=r){s.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${s.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}v.set(t,i),customElements.define(t,e)}var h=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 e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,r,i){e.addEventListener(n,r,i),this.#t.push(()=>e.removeEventListener(n,r,i))}_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,n){this.#e||(this.#e=this.attachInternals());let r=this.#e.states;try{n?r.add(e):r.delete(e)}catch{let i=`--${e}`;n?r.add(i):r.delete(i)}}_adoptInternals(e){this.#e||(this.#e=e)}#n(){return this.constructor.formAssociated&&this.#e?this.#e: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 M=0;function y(t,e){return t.matches("content-swap")?e:`data-${e}`}function b(t){let e=t.querySelector(':scope > [data-face="front"]'),n=t.querySelector(':scope > [data-face="back"]');if(!e||!n)return;t.style.viewTransitionName||(t.style.viewTransitionName=`content-swap-${++M}`);let r=t.matches("content-swap");r||t.setAttribute("data-swap-init","");let i=[];function s(o,a,u,f){o.addEventListener(a,u,f),i.push(()=>o.removeEventListener(a,u,f))}let p=[...t.querySelectorAll("[data-swap]")].filter(o=>o.parentElement?.closest("content-swap, [data-swap]")===t),w=p.length===0,c=t.querySelector(":scope > [data-swap-toggle]");if(w){if(!c){let o=document.createElement("button");o.type="button",o.setAttribute("data-swap-toggle",""),o.textContent="Show back",t.append(o),c=o}s(c,"click",o=>{o.stopPropagation(),d(t,o.detail===0?"keyboard":"pointer")}),s(t,"click",o=>{let u=o.target.closest?.(q);u&&u!==t&&t.contains(u)||d(t,"pointer")})}else c&&!c.hasAttribute("data-swap")&&c.remove(),c=null,p.forEach(o=>{s(o,"click",a=>{a.stopPropagation(),d(t,"pointer")}),s(o,"keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),d(t,"keyboard"))})});if(t.matches('[data-gesture="flick"], [data-gesture="swipe"]')&&(s(t,"swipe-left",()=>d(t,"pointer")),s(t,"swipe-right",()=>d(t,"pointer"))),!r){let o=new MutationObserver(()=>m(t,e,n));o.observe(t,{attributes:!0,attributeFilter:["data-swapped"]}),i.push(()=>o.disconnect())}return m(t,e,n),$([e,n]),()=>{for(let o of i)o();i.length=0}}var q='a[href], button, input, select, textarea, label, summary, [contenteditable=""], [contenteditable="true"], [tabindex]';function $(t){let e=t.map(n=>n.style.transition);for(let n of t)n.style.transition="none";for(let n of t)getComputedStyle(n).transform;t.forEach((n,r)=>{n.style.transition=e[r]})}function m(t,e,n){let r=t.hasAttribute(y(t,"swapped"));e.inert=r,n.inert=!r,t.querySelector(":scope > [data-swap-toggle]")?.setAttribute("aria-pressed",String(r))}function T(t){return{front:t.querySelector(':scope > [data-face="front"]'),back:t.querySelector(':scope > [data-face="back"]')}}function l(t,e,n="api"){let{front:r,back:i}=T(t);if(!r||!i)return;let s=y(t,"swapped");if(e&&t.hasAttribute(s)||!e&&!t.hasAttribute(s))return;let p=document.activeElement,w=()=>{e?t.setAttribute(s,""):t.removeAttribute(s),m(t,r,i),C(t,n);let a=e?i:r,u=e?r:i,f=a.querySelector("[autofocus]");f?f.focus():n==="keyboard"&&u.contains(p)&&L(a)},c=a=>{let u=t;typeof u.setState=="function"&&u.setState("transition-running",a)};c(!0);let o=E(w);o&&o.finished&&typeof o.finished.finally=="function"?o.finished.finally(()=>c(!1)):c(!1)}function d(t,e="api"){l(t,!t.hasAttribute(y(t,"swapped")),e)}function C(t,e="internal"){t.dispatchEvent(new CustomEvent("content-swap:swap",{detail:{swapped:t.hasAttribute(y(t,"swapped")),source:e},bubbles:!0}))}function L(t){let e=t.querySelector("[data-swap], button, a, input, select, textarea");e&&e.focus()}var g=class extends h{static observedAttributes=["swapped"];#t=null;attributeChangedCallback(){if(!this.isConnected)return;let{front:e,back:n}=T(this);e&&n&&m(this,e,n)}setup(){this.#t=b(this)??null}teardown(){this.#t?.(),this.#t=null}flip(){l(this,!0)}unflip(){l(this,!1)}toggle(){d(this)}get flipped(){return this.hasAttribute("swapped")}set flipped(e){l(this,!!e)}get swapped(){return this.hasAttribute("swapped")}set swapped(e){l(this,!!e)}};S("content-swap",g);function k(){document.querySelectorAll("[data-swap]:not(content-swap):not([data-swap-init])").forEach(t=>{t.querySelector(":scope > [data-face]")&&b(t)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k):k();var A=new MutationObserver(t=>{for(let e of t)for(let n of e.addedNodes){if(n.nodeType!==Node.ELEMENT_NODE)continue;let r=n;r.hasAttribute("data-swap")&&!r.matches("content-swap")&&!r.hasAttribute("data-swap-init")&&r.querySelector(":scope > [data-face]")&&b(r),r.querySelectorAll("[data-swap]:not(content-swap):not([data-swap-init])").forEach(i=>{i.querySelector(":scope > [data-face]")&&b(i)})}});document.body?A.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{A.observe(document.body,{childList:!0,subtree:!0})});export{g as ContentSwap};
2
2
  //# sourceMappingURL=content-swap.js.map
@@ -1,2 +1,2 @@
1
- var u=/Mac|iPhone|iPad|iPod/.test(navigator.platform??""),m={mac:{meta:"\u2318",cmd:"\u2318",alt:"\u2325",shift:"\u21E7",ctrl:"\u2303"},other:{meta:"Ctrl",cmd:"Ctrl",alt:"Alt",shift:"Shift",ctrl:"Ctrl"}};function b(n){let t=u?m.mac:m.other;return n.split("+").map(s=>{let e=s.trim().toLowerCase();return t[e]??e.toUpperCase()}).join(u?"":"+")}function y(n){let t=n.toLowerCase().split("+").map(e=>e.trim());return{key:t.pop()??"",meta:t.includes("meta")||t.includes("cmd"),ctrl:t.includes("ctrl"),shift:t.includes("shift"),alt:t.includes("alt")}}function g(n,t){if(n.key.toLowerCase()!==t.key)return!1;let s,e;return u?(s=t.meta,e=t.ctrl):(s=!1,e=t.meta||t.ctrl),!(s!==n.metaKey||e!==n.ctrlKey||t.shift!==n.shiftKey||t.alt!==n.altKey)}var k=new Set(["INPUT","TEXTAREA","SELECT"]),h=[],w=!1;function x(n){let t=k.has(n.target.tagName)||n.target.isContentEditable;for(let s of h)if(!(t&&!s.global)&&g(n,s.descriptor)){n.preventDefault(),s.callback(n);return}}function C(){w||(document.addEventListener("keydown",x),w=!0)}function E(n,t,s={}){C();let e=y(n),i={combo:n,descriptor:e,callback:t,global:s.global===!0};return h.find(r=>r.combo===n)&&console.warn(`[hotkey-bind] Shortcut "${n}" already bound. Last-connected-wins.`),h.unshift(i),function(){let a=h.indexOf(i);a!==-1&&h.splice(a,1)}}var L=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function l(n,t,s={}){let e=s.priority??10,i={impl:t,bundle:s.bundle,contract:s.contract,priority:e},o=v.get(n);if(customElements.get(n)){if(!o||o.priority>=e){o&&o.priority===e&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=e){o.priority===e&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}v.set(n,i),customElements.define(n,t)}var c=class extends HTMLElement{#s=[];#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.#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))}setup(){}teardown(){}setState(t,s){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{s?e.add(t):e.delete(t)}catch{let i=`--${t}`;s?e.add(i):e.delete(i)}}_adoptInternals(t){this.#t||(this.#t=t)}};var d=CSS.supports("anchor-name","--x"),S=CSS.supports("position-area","bottom"),$=0,p=class extends c{#s=null;#t=null;#e=null;#i=null;setup(){this.id||(this.id=`pop-over-${++$}`);let t=this.dataset.mode||"auto";this.hasAttribute("popover")||this.setAttribute("popover",t),this.#o(),this.#n(),this.#e=s=>{let e=s.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:s.newState},bubbles:!0,composed:!0})),!d&&s.newState==="open"&&this.#s&&this.#c()},this.listen(this,"beforetoggle",this.#e),d||(this.#i=()=>{this.matches(":popover-open")&&this.#s&&this.#c()},this.listen(window,"resize",this.#i),this.listen(window,"scroll",this.#i,{capture:!0,passive:!0}))}show(){this.matches(":popover-open")||this.showPopover()}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#o(){let t=this.dataset.anchor;t?this.#s=document.getElementById(t)||document.querySelector(t):this.#s=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#n(){if(!(!this.#s||!d)&&(this.#t=`--pop-over-anchor-${this.id}`,this.#s.style.setProperty("anchor-name",this.#t),this.style.setProperty("position-anchor",this.#t),this.setAttribute("data-anchor-name",this.#t||""),!S)){let t=this.dataset.position||"bottom";this.#r(t)}}#r(t){let s="var(--_pop-over-offset, var(--size-xs))",e={top:{bottom:`calc(anchor(top) + ${s})`,left:"anchor(left)"},bottom:{top:`calc(anchor(bottom) + ${s})`,left:"anchor(left)"},left:{right:`calc(anchor(left) + ${s})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${s})`,top:"anchor(top)"}},i=t.split("-")[0],o=e[i]||e.bottom;Object.entries(o).forEach(([r,a])=>this.style.setProperty(r,a))}#c(){if(!this.#s)return;let t=this.#s.getBoundingClientRect(),s=this.dataset.position||"bottom",e=this.#h(),i,o;switch(s.split("-")[0]){case"top":i=t.top-this.offsetHeight-e,o=t.left;break;case"left":i=t.top,o=t.left-this.offsetWidth-e;break;case"right":i=t.top,o=t.right+e;break;default:i=t.bottom+e,o=t.left;break}s.endsWith("-end")&&(s.startsWith("top")||s.startsWith("bottom")?o=t.right-this.offsetWidth:i=t.bottom-this.offsetHeight),this.style.position="fixed",this.style.top=`${Math.round(i)}px`,this.style.left=`${Math.round(o)}px`,this.style.margin="0"}#h(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset]??t.xs}};l("pop-over",p);var A=0,f=class extends c{#s;#t;#e;#i=[];#o=-1;#n=!1;#r=[];setup(){let t=this.querySelector(":scope > [data-trigger]"),s=this.querySelector('menu, ul[role="menu"]');if(!t||!s)return!1;this.#s=t,this.#t=s;let e=this.querySelector(":scope > pop-over[data-context-menu-host]");return e?this.#e=e:(this.#e=document.createElement("pop-over"),this.#e.setAttribute("data-context-menu-host",""),this.#e.id=`ctx-menu-${++A}`,this.#e.dataset.mode="auto",this.#e.appendChild(this.#t),this.appendChild(this.#e)),this.#t.parentElement!==this.#e&&this.#e.appendChild(this.#t),this.#s?.setAttribute("aria-expanded","false"),this.#t.setAttribute("role","menu"),this.#t.id||(this.#t.id=`ctx-menu-list-${++A}`),this.#t.querySelectorAll(":scope > li[data-group]").forEach(i=>{i.setAttribute("role","presentation"),i.classList.add("ctx-group-label")}),this.#i=Array.from(this.#t.querySelectorAll('button, a, [role="menuitem"]')).filter(i=>!i.disabled&&!i.hasAttribute("data-disabled")),this.#i.forEach(i=>{i.setAttribute("role","menuitem"),i.setAttribute("tabindex","-1"),this.listen(i,"click",this.#u);let o=i.getAttribute("data-shortcut");if(o){let r=document.createElement("kbd");r.className="ctx-kbd",r.textContent=b(o),i.appendChild(r);let a=E(o,()=>i.click());this.#r.push(a)}}),this.#t.querySelectorAll('li:empty:not([data-group]), [role="separator"], hr').forEach(i=>{i.setAttribute("role","separator")}),this.listen(this.#s,"contextmenu",this.#c),this.listen(this.#t,"keydown",this.#l),this.listen(window,"scroll",this.#p,{capture:!0}),this.listen(this.#e,"pop-over:hide",this.#d),!0}teardown(){this.#r.forEach(t=>t()),this.#r=[]}get items(){if(!this.#t)return[];let t=[];for(let s of this.#t.querySelectorAll(":scope > li")){if(s.hasAttribute("data-group")){t.push({group:s.textContent.trim()});continue}if(s.matches(':empty, [role="separator"]')||s.querySelector("hr")){t.push({separator:!0});continue}let e=s.querySelector('button, a, [role="menuitem"]');e&&t.push({label:e.textContent.trim().replace(/\s+/g," "),value:e.getAttribute("data-value")||void 0,href:e.tagName==="A"?e.getAttribute("href"):void 0,shortcut:e.getAttribute("data-shortcut")||void 0,disabled:e.disabled||e.hasAttribute("data-disabled")||void 0})}return t}set items(t){let s=Array.isArray(t)?t:[],e=this.querySelector('menu, ul[role="menu"]');for(e||(e=document.createElement("menu"),this.appendChild(e));e.firstChild;)e.firstChild.remove();for(let i of s){let o=document.createElement("li");if(i.separator)o.setAttribute("role","separator");else if(i.group!=null)o.setAttribute("data-group",""),o.textContent=i.group;else{let r=i.href?document.createElement("a"):document.createElement("button");i.href&&r.setAttribute("href",i.href),i.value&&r.setAttribute("data-value",i.value),i.shortcut&&r.setAttribute("data-shortcut",i.shortcut),i.disabled&&(r.tagName==="BUTTON"?r.disabled=!0:r.setAttribute("data-disabled","")),r.textContent=i.label||"",o.appendChild(r)}e.appendChild(o)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("context-menu:items-changed",{detail:{items:s,source:"property"},bubbles:!0}))}#c=t=>{t.preventDefault(),t.buttons!==0?this.listen(window,"pointerup",()=>{setTimeout(()=>this.#h(t.clientX,t.clientY),0)},{once:!0,capture:!0}):this.#h(t.clientX,t.clientY)};#h(t,s){this.#n=!0,this.setAttribute("data-open",""),this.#s?.setAttribute("aria-expanded","true"),this.#e.style.top=`${s}px`,this.#e.style.left=`${t}px`,this.#e.show(),requestAnimationFrame(()=>{let e=this.#e.getBoundingClientRect(),i=t+e.width>window.innerWidth?t-e.width:t,o=s+e.height>window.innerHeight?s-e.height:s;this.#e.style.top=`${Math.max(0,o)}px`,this.#e.style.left=`${Math.max(0,i)}px`}),this.#o=-1,this.#a(0),this.dispatchEvent(new CustomEvent("context-menu:open",{bubbles:!0}))}close(){this.#n&&(this.#n=!1,this.removeAttribute("data-open"),this.#s?.setAttribute("aria-expanded","false"),this.#o=-1,this.#e?.hide(),this.dispatchEvent(new CustomEvent("context-menu:close",{bubbles:!0})))}#l=t=>{switch(t.key){case"ArrowDown":case"Down":t.preventDefault(),this.#a(this.#o+1);break;case"ArrowUp":case"Up":t.preventDefault(),this.#a(this.#o-1);break;case"Home":t.preventDefault(),this.#a(0);break;case"End":t.preventDefault(),this.#a(this.#i.length-1);break;case"Enter":case" ":t.preventDefault(),this.#o>=0&&this.#i[this.#o].click();break;case"Tab":this.close();break}};#u=()=>{this.close(),this.dispatchEvent(new CustomEvent("context-menu:select",{bubbles:!0,detail:{item:this.#i[this.#o]}}))};#d=()=>{this.#n&&(this.#n=!1,this.removeAttribute("data-open"),this.#s?.setAttribute("aria-expanded","false"),this.#o=-1,this.dispatchEvent(new CustomEvent("context-menu:close",{bubbles:!0})))};#p=()=>{this.#n&&this.close()};#a(t){this.#i.length!==0&&(t<0&&(t=this.#i.length-1),t>=this.#i.length&&(t=0),this.#o=t,this.#i[t].focus())}get isOpen(){return this.#n}};l("context-menu",f);export{f as ContextMenuWc};
1
+ var h=/Mac|iPhone|iPad|iPod/.test(navigator.platform??""),$={mac:{meta:"\u2318",cmd:"\u2318",alt:"\u2325",option:"\u2325",shift:"\u21E7",ctrl:"\u2303",control:"\u2303"},other:{meta:"Ctrl",cmd:"Ctrl",alt:"Alt",option:"Alt",shift:"Shift",ctrl:"Ctrl",control:"Ctrl"}},T={mac:{meta:"Command",cmd:"Command",alt:"Option",option:"Option",shift:"Shift",ctrl:"Control",control:"Control"},other:{meta:"Control",cmd:"Control",alt:"Alt",option:"Alt",shift:"Shift",ctrl:"Control",control:"Control"}},F={escape:{label:"Esc",spoken:"Escape"},esc:{label:"Esc",spoken:"Escape"},enter:{label:"Enter",spoken:"Enter"},return:{label:"Enter",spoken:"Enter"},tab:{label:"Tab",spoken:"Tab"},space:{label:"Space",spoken:"Space"},backspace:{label:"Backspace",spoken:"Backspace"},delete:{label:"Del",spoken:"Delete"},del:{label:"Del",spoken:"Delete"},insert:{label:"Ins",spoken:"Insert"},home:{label:"Home",spoken:"Home"},end:{label:"End",spoken:"End"},pageup:{label:"PgUp",spoken:"Page up"},pagedown:{label:"PgDn",spoken:"Page down"},arrowup:{label:"\u2191",spoken:"Up arrow"},up:{label:"\u2191",spoken:"Up arrow"},arrowdown:{label:"\u2193",spoken:"Down arrow"},down:{label:"\u2193",spoken:"Down arrow"},arrowleft:{label:"\u2190",spoken:"Left arrow"},left:{label:"\u2190",spoken:"Left arrow"},arrowright:{label:"\u2192",spoken:"Right arrow"},right:{label:"\u2192",spoken:"Right arrow"},"+":{label:"+",spoken:"Plus"},plus:{label:"+",spoken:"Plus"}};function M(o){return[...String(o??"").trim().toLowerCase().matchAll(/([^+]+|\+)(?:\+|$)/g)].map(e=>e[1].trim()).filter(Boolean).map(e=>e==="plus"?"+":e)}function j(o,t=h){let e=t?$.mac:$.other;if(o in e)return{label:e[o],spoken:(t?T.mac:T.other)[o],modifier:!0};let s=F[o];if(s)return{...s,modifier:!1};let n=o.toUpperCase();return{label:n,spoken:n,modifier:!1}}function D(o){return M(o).map(t=>j(t).label).join(h?"":"+")}var Y={esc:"escape",return:"enter",del:"delete",ins:"insert",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",space:" ",spacebar:" ",plus:"+",pgup:"pageup",pgdn:"pagedown"};function W(o){let t=String(o??"").toLowerCase();return Y[t]??t}function d(o){let t=M(o);return{key:W(t.pop()??""),meta:t.includes("meta")||t.includes("cmd"),ctrl:t.includes("ctrl")||t.includes("control"),shift:t.includes("shift"),alt:t.includes("alt")||t.includes("option")}}function q(o){return o.length===1&&!/[a-z0-9 ]/.test(o)}function H(o,t){let s=(o.key==="Spacebar"?" ":String(o.key??"").toLowerCase())===t.key;if(!s&&(o.altKey||o.shiftKey)&&/^[a-z0-9]$/.test(t.key)){let r=/\d/.test(t.key)?`Digit${t.key}`:`Key${t.key.toUpperCase()}`;s=o.code===r}if(!s)return!1;let n,i;return h?(n=t.meta,i=t.ctrl):(n=!1,i=t.meta||t.ctrl),!(n!==o.metaKey||i!==o.ctrlKey||!q(t.key)&&t.shift!==o.shiftKey||t.alt!==o.altKey)}function L(o){let t=typeof o=="string"?d(o):o;return!t.meta&&!t.ctrl&&!t.alt&&t.key.length===1}function N(o,t){let e=d(o),s=d(t),n=h?e.ctrl:e.ctrl||e.meta,i=h?s.ctrl:s.ctrl||s.meta,r=h&&e.meta,l=h&&s.meta,a=!q(e.key);return e.key===s.key&&n===i&&r===l&&e.alt===s.alt&&(!a||e.shift===s.shift)}var X={" ":"Space","+":"Plus",escape:"Escape",enter:"Enter",tab:"Tab",backspace:"Backspace",delete:"Delete",insert:"Insert",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown",arrowup:"ArrowUp",arrowdown:"ArrowDown",arrowleft:"ArrowLeft",arrowright:"ArrowRight"};function B(o,t=h){let e=d(o),s=[];e.alt&&s.push("Alt"),(e.ctrl||e.meta&&!t)&&s.push("Control"),e.meta&&t&&s.push("Meta"),e.shift&&s.push("Shift");let n=X[e.key];return n||(n=/^f\d{1,2}$/.test(e.key)||e.key.length===1?e.key.toUpperCase():e.key[0].toUpperCase()+e.key.slice(1)),[...s,n].join("+")}var w="data-char-shortcuts";var z="vb:settings:extensions";function k(){return typeof document>"u"?!0:document.documentElement.getAttribute(w)!=="off"}function G(){try{let o=globalThis.localStorage?.getItem(z);if(!o)return null;let t=JSON.parse(o)?.data?.charShortcuts;return typeof t=="boolean"?t:null}catch{return null}}var J=!0;if(typeof document<"u"){let o=G();o===null&&(J=k()),o===!1?document.documentElement.setAttribute(w,"off"):o===!0&&document.documentElement.removeAttribute(w)}var Q=new Set(["INPUT","TEXTAREA","SELECT"]),f=[],I=!1;function Z(o){let t=o;return!t||!t.tagName?!1:Q.has(t.tagName)||t.isContentEditable}function tt(o){if(o.repeat||o.isComposing||o.defaultPrevented)return;let t=Z(o.target),e=!k(),s=document.activeElement;for(let n of f)if(!(t&&!n.global)&&!(n.scope&&!(n.scope.isConnected&&n.scope.contains(s)))&&!(e&&n.character&&!n.scope)&&!(n.enabled&&!n.enabled())&&H(o,n.descriptor)){o.preventDefault(),n.callback(o);return}}function et(){I||(document.addEventListener("keydown",tt),I=!0)}function O(o,t,e={}){et();let s=d(o),n={combo:o,descriptor:s,callback:t,global:e.global===!0,scope:e.scope??null,enabled:typeof e.enabled=="function"?e.enabled:null,character:L(s)},i=f.find(r=>!r.scope&&!n.scope&&N(r.combo,o));return i&&console.warn(`[hotkey-bind] Shortcut "${o}" is already bound as "${i.combo}". Last-bound wins.`),f.unshift(n),function(){let l=f.indexOf(n);l!==-1&&f.splice(l,1)}}var gt=window.matchMedia("(prefers-reduced-motion: reduce)");var K=new Map;function m(o,t,e={}){let s=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:s},i=K.get(o);if(customElements.get(o)){if(!i||i.priority>=s){i&&i.priority===s&&i.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=s){i.priority===s&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${i.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}K.set(o,n),customElements.define(o,t)}var p=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,n){t.addEventListener(e,s,n),this.#t.push(()=>t.removeEventListener(e,s,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 s=this.#e.states;try{e?s.add(t):s.delete(t)}catch{let n=`--${t}`;e?s.add(n):s.delete(n)}}_adoptInternals(t){this.#e||(this.#e=t)}#o(){return this.constructor.formAssociated&&this.#e?this.#e:null}get validity(){return this.#o()?.validity}get validationMessage(){return this.#o()?.validationMessage??""}get willValidate(){return this.#o()?.willValidate??!1}get form(){return this.#o()?.form??null}checkValidity(){return this.#o()?.checkValidity()??!0}reportValidity(){return this.#o()?.reportValidity()??!0}};var b=CSS.supports("anchor-name","--x"),ot=CSS.supports("position-area","bottom"),st=(()=>{let o=document.createElement("span");return o.setAttribute("popover","hint"),o.popover==="hint"})(),nt=["auto","manual","hint"];function it(o){let t=nt.includes(o||"")?o:"auto";return t==="hint"&&!st?"auto":t}var rt=["top","bottom","left","right","inset-inline-start","inset-inline-end"],at=["position","top","left","right","bottom","margin"],_=8,lt=0,ct=0;function R(o){return!o||o==="none"?[]:o.split(",").map(t=>t.trim()).filter(Boolean)}var E=class extends p{static get observedAttributes(){return["data-mode","data-anchor","data-position"]}#t=null;#e=null;#o=`--pop-over-anchor-${++ct}`;#n=!1;#i=!1;#s=!1;setup(){if(this.id||(this.id=`pop-over-${++lt}`),(!this.hasAttribute("popover")||this.#n)&&this.#r(),this.#u(),this.#h(),this.listen(this,"beforetoggle",t=>{let e=t.newState==="open"?"show":"hide";this.dispatchEvent(new CustomEvent(`pop-over:${e}`,{detail:{state:t.newState},bubbles:!0,composed:!0})),!b&&t.newState==="open"&&this.#t&&queueMicrotask(()=>{this.matches(":popover-open")&&this.#a()})}),!b){let t=()=>{this.matches(":popover-open")&&this.#t&&this.#a()};this.listen(window,"resize",t),this.listen(window,"scroll",t,{capture:!0,passive:!0})}}teardown(){this.#d(),this.#i&&(rt.forEach(t=>this.style.removeProperty(t)),this.#i=!1),this.#s&&(at.forEach(t=>this.style.removeProperty(t)),this.#s=!1),this.#t=null}attributeChangedCallback(t,e,s){if(e!==s){if(!this.hasAttribute("data-upgraded")){t==="data-mode"&&this.hasAttribute("popover")&&!this.isConnected&&(this.#n=!0);return}if(t==="data-mode"){this.#r();return}this._reinit()}}#r(){let t=it(this.dataset.mode);this.getAttribute("popover")!==t&&this.setAttribute("popover",t),this.#n=!0}show(){this.matches(":popover-open")||(this.showPopover(),!b&&this.#t&&this.matches(":popover-open")&&this.#a())}hide(){this.matches(":popover-open")&&this.hidePopover()}toggle(){this.matches(":popover-open")?this.hide():this.show()}get open(){return this.matches(":popover-open")}#u(){let t=this.dataset.anchor;if(t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch{e=null}this.#t=e}else this.#t=document.querySelector(`[popovertarget="${CSS.escape(this.id)}"]`)}#h(){if(!this.#t||!b)return;let t=this.#t,e=t.style.getPropertyValue("anchor-name"),s=R(e||getComputedStyle(t).getPropertyValue("anchor-name"));s.includes(this.#o)||s.push(this.#o),t.style.setProperty("anchor-name",s.join(", ")),this.#e=this.#o,this.style.setProperty("position-anchor",this.#o),this.setAttribute("data-anchor-name",this.#o),ot||this.#p(this.dataset.position||"bottom")}#d(){if(this.#t&&this.#e){let t=R(this.#t.style.getPropertyValue("anchor-name")).filter(e=>e!==this.#e);t.length?this.#t.style.setProperty("anchor-name",t.join(", ")):this.#t.style.removeProperty("anchor-name")}this.#e=null,this.style.getPropertyValue("position-anchor")&&this.style.removeProperty("position-anchor"),this.hasAttribute("data-anchor-name")&&this.removeAttribute("data-anchor-name")}#p(t){let e="var(--_pop-over-offset, var(--size-xs))",s=t.endsWith("-end")?{"inset-inline-end":"anchor(end)"}:{"inset-inline-start":"anchor(start)"},n={top:{bottom:`calc(anchor(top) + ${e})`,...s},bottom:{top:`calc(anchor(bottom) + ${e})`,...s},left:{right:`calc(anchor(left) + ${e})`,top:"anchor(top)"},right:{left:`calc(anchor(right) + ${e})`,top:"anchor(top)"}},i=t.split("-")[0],r=n[i]||n.bottom;Object.entries(r).forEach(([l,a])=>this.style.setProperty(l,a)),this.#i=!0}#a(){if(!this.#t)return;let t=this.#t.getBoundingClientRect(),e=this.dataset.position||"bottom",s=this.#l(),n=document.documentElement.clientWidth,i=document.documentElement.clientHeight;this.style.position="fixed",this.style.margin="0",this.style.right="auto",this.style.bottom="auto",this.#s=!0;let r=this.offsetWidth,l=this.offsetHeight,a=e.split("-")[0];["top","bottom","left","right"].includes(a)||(a="bottom");let y={top:t.top-s,bottom:i-t.bottom-s,left:t.left-s,right:n-t.right-s},S={top:"bottom",bottom:"top",left:"right",right:"left"},U=a==="top"||a==="bottom"?l:r;y[a]<U&&y[S[a]]>y[a]&&(a=S[a]);let c,u;switch(a){case"top":c=t.top-l-s,u=t.left;break;case"left":c=t.top,u=t.left-r-s;break;case"right":c=t.top,u=t.right+s;break;default:c=t.bottom+s,u=t.left;break}if(a==="top"||a==="bottom"){let A=getComputedStyle(this).direction==="rtl";u=e.endsWith("-end")!==A?t.right-r:t.left}else e.endsWith("-end")&&(c=t.bottom-l);let x=(A,P,V)=>Math.max(_,Math.min(A,V-P-_));u=x(u,r,n),c=x(c,l,i),this.style.top=`${Math.round(c)}px`,this.style.left=`${Math.round(u)}px`}#l(){let t={none:0,xs:4,s:8,m:16,l:24};return t[this.dataset.offset||""]??t.xs}};m("pop-over",E);var v=0,ut='a[href], button, input, select, textarea, summary, iframe, [tabindex], [contenteditable]:not([contenteditable="false"])';function g(o){return o.hasAttribute("data-disabled")||o.getAttribute("aria-disabled")==="true"||!!o.disabled}function ht(o){return o.pointerType===""||o.pointerId===-1||o.button===-1||o.clientX===0&&o.clientY===0&&o.buttons===0}var C=class extends p{#t;#e;#o;#n=[];#i=-1;#s=!1;#r=[];setup(){let t=this.querySelector(":scope > [data-trigger]"),e=this.querySelector('menu, ul[role="menu"]');if(!t||!e)return!1;this.#t=t,this.#e=e;let s=this.querySelector(":scope > pop-over[data-context-menu-host]");s?this.#o=s:(this.#o=document.createElement("pop-over"),this.#o.setAttribute("data-context-menu-host",""),this.#o.id=`ctx-menu-${++v}`,this.#o.dataset.mode="auto",this.#o.appendChild(this.#e),this.appendChild(this.#o)),this.#e.parentElement!==this.#o&&this.#o.appendChild(this.#e),this.#e.setAttribute("role","menu"),this.#e.id||(this.#e.id=`ctx-menu-list-${++v}`),this.#t.setAttribute("aria-haspopup","menu"),this.#t.setAttribute("aria-expanded","false"),this.#t.setAttribute("aria-controls",this.#e.id),this.#t.matches(ut)||this.#t.setAttribute("tabindex","0"),this.#e.querySelectorAll(':scope > li:empty:not([data-group]), :scope > [role="separator"], :scope > hr').forEach(i=>{i.setAttribute("role","separator")}),this.#u();let n=Array.from(this.#e.querySelectorAll('button, a, [role="menuitem"]'));return n.forEach(i=>{i.setAttribute("role","menuitem"),i.setAttribute("tabindex","-1")}),this.#n=n.filter(i=>!i.disabled),this.#e.querySelectorAll("li").forEach(i=>{i.querySelector(':scope > :is(button, a, [role="menuitem"])')&&i.setAttribute("role","none")}),this.#n.forEach(i=>{i.hasAttribute("data-disabled")&&i.setAttribute("aria-disabled","true"),this.listen(i,"click",this.#y);let r=i.getAttribute("data-shortcut");if(r){if(!i.querySelector(":scope > .ctx-kbd")){let a=document.createElement("kbd");a.className="ctx-kbd",a.setAttribute("aria-hidden","true"),a.textContent=D(r),i.appendChild(a)}i.setAttribute("aria-keyshortcuts",B(r));let l=O(r,()=>{g(i)||i.click()});this.#r.push(l)}}),this.listen(this.#t,"contextmenu",this.#d),this.listen(this.#t,"keydown",this.#p),this.listen(this.#e,"keydown",this.#b),this.listen(this.#e,"click",this.#g,{capture:!0}),this.listen(window,"scroll",this.#w,{capture:!0}),this.listen(this.#o,"pop-over:hide",this.#A),!0}teardown(){this.#r.forEach(t=>t()),this.#r=[],this.#s&&(this.#s=!1,this.removeAttribute("data-open"),this.#o?.hide?.()),this.#i=-1,this.#n=[],this.#e?.querySelectorAll(".ctx-kbd").forEach(t=>t.remove()),this.#h()}#u(){let t=this.#e;for(let e of Array.from(t.querySelectorAll(":scope > li[data-group]"))){e.id||(e.id=`ctx-group-${++v}`),e.classList.add("ctx-group-label"),e.setAttribute("aria-hidden","true");let s=document.createElement("li");s.setAttribute("role","group"),s.setAttribute("aria-labelledby",e.id),s.setAttribute("data-ctx-group","");let n=document.createElement("ul");n.setAttribute("role","none"),s.appendChild(n),t.insertBefore(s,e),n.appendChild(e);let i=s.nextElementSibling;for(;i&&!i.hasAttribute("data-group")&&i.getAttribute("role")!=="separator";){let r=i;i=i.nextElementSibling,n.appendChild(r)}}}#h(){let t=this.#e;if(t)for(let e of Array.from(t.querySelectorAll(":scope > li[data-ctx-group]"))){let s=e.querySelector(":scope > ul");if(s)for(let n of Array.from(s.children))t.insertBefore(n,e);e.remove()}}get items(){if(!this.#e)return[];let t=[],e=this.#e.querySelectorAll(":scope > li:not([data-ctx-group]), :scope > li[data-ctx-group] > ul > li");for(let s of e){if(s.hasAttribute("data-group")){t.push({group:s.textContent.trim()});continue}if(s.matches(':empty, [role="separator"]')||s.querySelector("hr")){t.push({separator:!0});continue}let n=s.querySelector('button, a, [role="menuitem"]');if(!n)continue;let i=Array.from(n.childNodes).filter(r=>!(r instanceof Element&&r.classList.contains("ctx-kbd"))).map(r=>r.textContent).join("");t.push({label:i.trim().replace(/\s+/g," "),value:n.getAttribute("data-value")||void 0,href:n.tagName==="A"?n.getAttribute("href"):void 0,shortcut:n.getAttribute("data-shortcut")||void 0,disabled:n.disabled||n.hasAttribute("data-disabled")||void 0})}return t}set items(t){let e=Array.isArray(t)?t:[],s=this.querySelector('menu, ul[role="menu"]');for(s||(s=document.createElement("menu"),this.appendChild(s));s.firstChild;)s.firstChild.remove();for(let n of e){let i=document.createElement("li");if(n.separator)i.setAttribute("role","separator");else if(n.group!=null)i.setAttribute("data-group",""),i.textContent=n.group;else{let r=n.href?document.createElement("a"):document.createElement("button");n.href&&r.setAttribute("href",n.href),n.value&&r.setAttribute("data-value",n.value),n.shortcut&&r.setAttribute("data-shortcut",n.shortcut),n.disabled&&r.setAttribute("data-disabled",""),r.tagName==="BUTTON"&&r.setAttribute("type","button"),r.textContent=n.label||"",i.appendChild(r)}s.appendChild(i)}this._reinit(),this.dispatchEvent(new CustomEvent("context-menu:items-changed",{detail:{items:e,source:"property"},bubbles:!0}))}#d=t=>{if(t.preventDefault(),ht(t)){this.#s||this.#a();return}t.buttons!==0?this.listen(window,"pointerup",()=>{setTimeout(()=>this.#l(t.clientX,t.clientY),0)},{once:!0,capture:!0}):this.#l(t.clientX,t.clientY)};#p=t=>{t.target===this.#t&&(t.key==="ContextMenu"||t.key==="F10"&&t.shiftKey)&&(t.preventDefault(),this.#s||this.#a())};#a(){let t=this.#t.getBoundingClientRect();this.#l(t.left,t.bottom)}#l(t,e){this.#s=!0,this.setAttribute("data-open",""),this.#t?.setAttribute("aria-expanded","true"),this.#o.style.top=`${e}px`,this.#o.style.left=`${t}px`,this.#o.show(),requestAnimationFrame(()=>{let s=this.#o.getBoundingClientRect(),n=t+s.width>window.innerWidth?t-s.width:t,i=e+s.height>window.innerHeight?e-s.height:e;this.#o.style.top=`${Math.max(0,i)}px`,this.#o.style.left=`${Math.max(0,n)}px`}),this.#i=-1,this.#c(0),this.dispatchEvent(new CustomEvent("context-menu:open",{bubbles:!0}))}close(){if(!this.#s)return;let t=this.#f();this.#s=!1,this.removeAttribute("data-open"),this.#t?.setAttribute("aria-expanded","false"),this.#i=-1,this.#o?.hide(),t&&this.#m(),this.dispatchEvent(new CustomEvent("context-menu:close",{bubbles:!0}))}#f(){let t=document.activeElement;return!t||t===document.body||!!this.#o?.contains(t)}#m(){this.#t?.isConnected&&this.#t.focus({preventScroll:!0})}#b=t=>{switch(t.key){case"ArrowDown":case"Down":t.preventDefault(),this.#c(this.#i+1);break;case"ArrowUp":case"Up":t.preventDefault(),this.#c(this.#i-1);break;case"Home":t.preventDefault(),this.#c(0);break;case"End":t.preventDefault(),this.#c(this.#n.length-1);break;case"Enter":case" ":{t.preventDefault();let e=this.#n[this.#i];e&&!g(e)&&e.click();break}case"Tab":this.close();break}};#g=t=>{let e=t.target.closest?.('button, a, [role="menuitem"]');e&&this.#e.contains(e)&&g(e)&&(t.preventDefault(),t.stopPropagation())};#y=t=>{let e=t.currentTarget;g(e)||(this.close(),this.dispatchEvent(new CustomEvent("context-menu:select",{bubbles:!0,detail:{item:e,value:e.getAttribute("data-value")||void 0}})))};#A=()=>{this.#s&&(this.#s=!1,this.removeAttribute("data-open"),this.#t?.setAttribute("aria-expanded","false"),this.#i=-1,this.#f()&&this.#m(),this.dispatchEvent(new CustomEvent("context-menu:close",{bubbles:!0})))};#w=()=>{this.#s&&this.close()};#c(t){this.#n.length!==0&&(t<0&&(t=this.#n.length-1),t>=this.#n.length&&(t=0),this.#i=t,this.#n[t].focus())}get isOpen(){return this.#s}};m("context-menu",C);export{C as ContextMenuWc};
2
2
  //# sourceMappingURL=context-menu.js.map
@@ -1,2 +1,2 @@
1
- var E=window.matchMedia("(prefers-reduced-motion: reduce)");var A=new Map;function w(h,e,t={}){let s=t.priority??10,i={impl:e,bundle:t.bundle,contract:t.contract,priority:s},n=A.get(h);if(customElements.get(h)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${h}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=s){n.priority===s&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${n.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}A.set(h,i),customElements.define(h,e)}var m=class extends HTMLElement{#i=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#i)e();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,s,i){e.addEventListener(t,s,i),this.#i.push(()=>e.removeEventListener(t,s,i))}setup(){}teardown(){}setState(e,t){this.#t||(this.#t=this.attachInternals());let s=this.#t.states;try{t?s.add(e):s.delete(e)}catch{let i=`--${e}`;t?s.add(i):s.delete(i)}}_adoptInternals(e){this.#t||(this.#t=e)}};function x({newItems:h,nodes:e,keyOf:t,renderItem:s,containerFor:i}){let n=[],r=[],a=[],d=new Set;for(let l of h)d.add(t(l));for(let[l,o]of[...e])d.has(l)||(o.remove(),e.delete(l),a.push(l));let c=new Map;for(let l of h){let o=t(l),u=e.get(o)||null,f=i(l,u);c.has(f)||c.set(f,[]),c.get(f)?.push({item:l,key:o,existing:u})}for(let[l,o]of c)for(let u=0;u<o.length;u++){let{item:f,key:p,existing:v}=o[u],b=v;b?(b.parentElement!==l||l.children[u]!==b)&&r.push(p):(b=s(f),e.set(p,b),n.push(p));let y=l.children[u];y!==b&&l.insertBefore(b,y||null)}return{added:n,moved:r,removed:a}}var g=class h extends m{#i;#t;#c=[];#s=[];#e=[];#o=-1;#d=null;#n=1;#r=0;#p=null;#b=null;#h=null;#l="";#a=null;#x=null;#m=[];#v=new Map;#g=[];setup(){return this.#i=this.querySelector(":scope > table"),!this.#i||(this.#t=this.#i.querySelector("tbody"),!this.#t)?!1:(this.#F(),!0)}teardown(){this.#L(),this.#c=[],this.#s=[],this.#e=[]}#F(){this.#s=[...this.#t.querySelectorAll(":scope > tr:not([data-expand-content])")],this.#e=[...this.#s],this.#g=[...this.#i.tHead?.rows[0]?.cells||[]].map(t=>({key:t.getAttribute("data-key")||t.textContent.trim().toLowerCase(),label:t.textContent.trim(),sort:t.getAttribute("data-sort")||void 0})),this.#v.clear(),this.#m=[];for(let t of this.#s){let s=t.getAttribute("data-id")||t.getAttribute("data-key");s&&(this.#v.set(s,t),this.#m.push({id:s}))}this.#B(),this.#M(),this.#R(),this.#P(),this.#i.hasAttribute("data-filterable")&&this.#K();let e=this.#i.getAttribute("data-paginate");e&&(this.#r=parseInt(e,10),this.#r>0&&this.#j()),this.#z(),this.#G(),this.#f()}get rows(){return this.#m}set rows(e){let t=e||[],s=x({newItems:t,nodes:this.#v,keyOf:i=>i.id,renderItem:i=>this._renderRow(i),containerFor:()=>this.#t});this.#m=t,this.#s=[...this.#t.querySelectorAll(":scope > tr:not([data-expand-content])")],this.#M(),this.#R(),this.#w(this.#l),this.dispatchEvent(new CustomEvent("data-table:rows-changed",{detail:{rows:t,added:s.added,moved:s.moved,removed:s.removed,source:"api"},bubbles:!0}))}get columns(){return this.#g}_renderRow(e){let t=this;if(typeof t.renderRow=="function"){let i=t.renderRow(e,this.#g);if(!(i instanceof Element))throw new Error("data-table: renderRow must return an Element");return i.hasAttribute("data-id")||i.setAttribute("data-id",String(e.id)),i}let s=document.createElement("tr");s.setAttribute("data-id",String(e.id));for(let i of this.#g){let n=document.createElement("td"),r=e[i.key];n.textContent=r==null?"":String(r),s.appendChild(n)}return s}#k=[];#u=[];#y=[];#B(){let e=[...this.#i.tHead?.rows[0]?.cells||[]];this.#k=e.map(t=>{let s=parseFloat(t.getAttribute("data-weight"));return Number.isFinite(s)?s:null}),this.#u=e.map(t=>t.getAttribute("data-rollup")||null),this.#y=e.map(t=>t.getAttribute("data-heatmap")||null)}#M(){if(this.#u.some(Boolean))for(let e=0;e<this.#u.length;e++){let t=this.#u[e];if(t)for(let s of this.#s){let i=s.children[e];if(!i)continue;let n=this.#$(s,e,t),r=h.#N(n);i.textContent=r,i.setAttribute("data-rollup-value",String(n)),i.hasAttribute("data-sort-value")||i.setAttribute("data-sort-value",String(n))}}}#$(e,t,s){let i=[...e.children],n=0,r=0,a=-1/0,d=0,c=1,l=!1;for(let o=0;o<i.length;o++){if(o===t||this.#u[o])continue;let u=i[o].getAttribute("data-sort-value")??i[o].textContent??"",f=parseFloat(u);if(!Number.isFinite(f))continue;n+=f,r++,f>a&&(a=f),c*=f,l=!0;let p=this.#k[o];p!==null&&(d+=f*p)}switch(s){case"sum":return n;case"avg":return r?n/r:0;case"max":return a===-1/0?0:a;case"weighted-sum":return d;case"product":return l?c:0;default:return n}}static#N(e){return Number.isFinite(e)?Number.isInteger(e)?String(e):(Math.round(e*100)/100).toString():""}#R(){if(this.#y.some(Boolean))for(let e=0;e<this.#y.length;e++){let t=this.#y[e];if(!t)continue;let s=this.#s.map(d=>{let c=d.children[e];if(!c)return null;let l=c.getAttribute("data-rollup-value")??c.getAttribute("data-sort-value")??c.textContent??"",o=parseFloat(l);return Number.isFinite(o)?o:null}),i=s.filter(d=>d!==null);if(!i.length)continue;let n=Math.min(...i),a=Math.max(...i)-n||1;for(let d=0;d<this.#s.length;d++){let c=this.#s[d].children[e];if(!c)continue;let l=s[d];if(l===null){c.removeAttribute("data-heat-level");continue}let o=(l-n)/a;t==="low-good"&&(o=1-o);let u=o<.34?"low":o<.67?"mid":"high";c.setAttribute("data-heat-level",u)}}}#L(){this.#h&&clearTimeout(this.#h),this.#p?.parentElement?.remove(),this.#b?.remove()}#P(){this.#i.querySelectorAll("thead th[data-sort]").forEach((t,s)=>{let i=t.getAttribute("data-sort"),n=this.#V(t);this.#c.push({th:t,sortType:i,columnIndex:n}),t.setAttribute("tabindex","0"),t.setAttribute("role","columnheader"),t.setAttribute("aria-sort","none"),t.dataset.columnIndex=n,this.listen(t,"click",this.#H),this.listen(t,"keydown",this.#D)})}#V(e){return[...e.parentElement.children].indexOf(e)}#H=e=>{let t=e.currentTarget,s=parseInt(t.dataset.columnIndex,10);this.#q(s)};#D=e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();let t=e.currentTarget,s=parseInt(t.dataset.columnIndex,10);this.#q(s)}};#O(e,t,s){let i=this.#e;if(i.length<2)return!0;let n=s==="asc"?1:-1;for(let r=1;r<i.length;r++){let a=this.#A(i[r-1].children[e],t),d=this.#A(i[r].children[e],t);if((typeof a=="string"?a.localeCompare(d)*n:(a-d)*n)>0)return!1}return!0}#q(e){let t=this.#c.find(i=>i.columnIndex===e);if(!t)return;let s;this.#o===e?s=this.#d==="asc"?"desc":"asc":this.#O(e,t.sortType,"asc")?s="desc":s="asc",this.#c.forEach(({th:i})=>{i.setAttribute("aria-sort","none")}),t.th.setAttribute("aria-sort",s==="asc"?"ascending":"descending"),this.#o=e,this.#d=s,this.#E(e,s,t.sortType),this.#n=1,this.#f(),this.dispatchEvent(new CustomEvent("data-table:sort",{detail:{column:e,direction:s,columnName:t.th.textContent.trim()},bubbles:!0}))}#E(e,t,s){let i=t==="asc"?1:-1;this.#e.sort((n,r)=>{let a=n.children[e],d=r.children[e];if(!a||!d)return 0;let c=this.#A(a,s),l=this.#A(d,s),o=0;switch(s){case"number":o=c-l;break;case"date":o=c-l;break;default:o=c.localeCompare(l,void 0,{numeric:!0,sensitivity:"base"});break}return o*i})}#A(e,t){let i=e.getAttribute("data-sort-value")??e.textContent.trim();switch(t){case"number":return parseFloat(i)||0;case"date":return new Date(i).getTime()||0;default:return i.toLowerCase()}}#K(){let e=document.createElement("div");e.setAttribute("data-table-filter","");let t=document.createElement("input");t.type="search",t.setAttribute("data-filter-input",""),t.setAttribute("placeholder","Filter table..."),t.setAttribute("aria-label","Filter table rows"),e.appendChild(t),this.insertBefore(e,this.#i),this.#p=t,this.listen(t,"input",this.#_)}#_=e=>{let t=e.target.value;this.#h&&clearTimeout(this.#h),this.#h=setTimeout(()=>{this.#w(t)},150)};#w(e){if(this.#l=e.toLowerCase().trim(),this.#l===""?this.#e=[...this.#s]:this.#e=this.#s.filter(t=>[...t.children].some(i=>(i.getAttribute("data-filter-value")??i.textContent).toLowerCase().includes(this.#l))),this.#o>=0&&this.#d){let t=this.#c.find(s=>s.columnIndex===this.#o);t&&this.#E(this.#o,this.#d,t.sortType)}this.#n=1,this.#f(),this.dispatchEvent(new CustomEvent("data-table:filter",{detail:{query:this.#l,count:this.#e.length},bubbles:!0}))}#j(){let e=document.createElement("nav");e.setAttribute("data-pagination",""),e.setAttribute("aria-label","Table pagination"),this.appendChild(e),this.#b=e}#z(){this.listen(this.#i,"click",this.#Q)}#Q=e=>{let t=e.target.closest('[data-action="toggle-expand"]');if(!t)return;let s=t.closest("tr[data-expandable]");if(!s)return;let i=s.hasAttribute("data-state-expanded"),n=s.nextElementSibling;i?(s.removeAttribute("data-state-expanded"),t.setAttribute("aria-expanded","false"),n?.hasAttribute("data-expand-content")&&(n.hidden=!0,n.setAttribute("aria-hidden","true"))):(s.setAttribute("data-state-expanded",""),t.setAttribute("aria-expanded","true"),n?.hasAttribute("data-expand-content")&&(n.hidden=!1,n.removeAttribute("aria-hidden"))),this.dispatchEvent(new CustomEvent("data-table:expand",{detail:{row:s,expanded:!i},bubbles:!0}))};#G(){this.#a=this.#i.querySelector('thead [data-action="select-all"]'),this.#a&&this.listen(this.#a,"change",this.#J),this.listen(this.#t,"change",this.#U),this.#x=this.querySelector("[data-selected-count]"),this.#T()}#J=e=>{let t=e.target.checked;this.#t.querySelectorAll("tr[data-selectable]").forEach(i=>{let n=i.querySelector('[data-action="select-row"]');t?(i.setAttribute("data-state-selected",""),n&&(n.checked=!0)):(i.removeAttribute("data-state-selected"),n&&(n.checked=!1))}),e.target.indeterminate=!1,this.#C(),this.#I()};#U=e=>{let t=e.target.closest('[data-action="select-row"]');if(!t)return;let s=t.closest("tr[data-selectable]");s&&(t.checked?s.setAttribute("data-state-selected",""):s.removeAttribute("data-state-selected"),this.#T(),this.#I())};#T(){if(!this.#a){this.#C();return}let e=this.#t.querySelectorAll("tr[data-selectable]"),t=this.#t.querySelectorAll("tr[data-selectable][data-state-selected]"),s=e.length,i=t.length;i===0?(this.#a.checked=!1,this.#a.indeterminate=!1):i===s?(this.#a.checked=!0,this.#a.indeterminate=!1):(this.#a.checked=!1,this.#a.indeterminate=!0),this.#C()}#C(){let t=this.#t.querySelectorAll("tr[data-selectable][data-state-selected]").length;this.#x&&(this.#x.textContent=t)}#I(){let e=[...this.#t.querySelectorAll("tr[data-selectable][data-state-selected]")];this.dispatchEvent(new CustomEvent("data-table:selection",{detail:{count:e.length,rows:e},bubbles:!0}))}#W(){if(!this.#b||this.#r<=0)return;let e=this.#b,t=Math.ceil(this.#e.length/this.#r);if(e.innerHTML="",t<=1)return;let s=document.createElement("button");s.type="button",s.textContent="Previous",s.setAttribute("data-pagination-prev",""),s.disabled=this.#n===1,s.addEventListener("click",()=>this.goToPage(this.#n-1)),e.appendChild(s),this.#X(t).forEach(r=>{if(r==="..."){let a=document.createElement("span");a.textContent="...",a.setAttribute("data-pagination-ellipsis",""),e.appendChild(a)}else{let a=document.createElement("button");a.type="button",a.textContent=r,a.setAttribute("data-pagination-page",""),r===this.#n&&(a.setAttribute("aria-current","page"),a.setAttribute("data-current","")),a.addEventListener("click",()=>this.goToPage(r)),e.appendChild(a)}});let n=document.createElement("button");n.type="button",n.textContent="Next",n.setAttribute("data-pagination-next",""),n.disabled=this.#n===t,n.addEventListener("click",()=>this.goToPage(this.#n+1)),e.appendChild(n)}#X(e){let t=this.#n,s=[];if(e<=7)for(let i=1;i<=e;i++)s.push(i);else{s.push(1),t>3&&s.push("...");let i=Math.max(2,t-1),n=Math.min(e-1,t+1);for(let r=i;r<=n;r++)s.push(r);t<e-2&&s.push("..."),s.push(e)}return s}#f(){this.#s.forEach(t=>{t.setAttribute("data-state-hidden","")});let e;if(this.#r>0){let t=(this.#n-1)*this.#r,s=t+this.#r;e=this.#e.slice(t,s)}else e=this.#e;e.forEach(t=>{t.removeAttribute("data-state-hidden"),this.#t.appendChild(t);let s=t.nextElementSibling?.hasAttribute?.("data-expand-content")?t.nextElementSibling:this.#S(t);s&&this.#t.appendChild(s)}),this.#e.forEach(t=>{if(t.hasAttribute("data-state-hidden")){this.#t.appendChild(t);let s=this.#S(t);s&&this.#t.appendChild(s)}}),this.#s.forEach(t=>{if(!this.#e.includes(t)){this.#t.appendChild(t);let s=this.#S(t);s&&this.#t.appendChild(s)}}),this.#W()}#S(e){if(!e.hasAttribute("data-expandable"))return null;let t=e.nextElementSibling;return t?.hasAttribute("data-expand-content")?t:null}goToPage(e){let t=Math.ceil(this.#e.length/this.#r),s=Math.max(1,Math.min(e,t));s!==this.#n&&(this.#n=s,this.#f(),this.dispatchEvent(new CustomEvent("data-table:page",{detail:{page:this.#n},bubbles:!0})))}setFilter(e){this.#p&&(this.#p.value=e),this.#w(e)}refresh(){if(this.#s=[...this.#t.querySelectorAll(":scope > tr")],this.#l?this.#w(this.#l):this.#e=[...this.#s],this.#o>=0&&this.#d){let t=this.#c.find(s=>s.columnIndex===this.#o);t&&this.#E(this.#o,this.#d,t.sortType)}let e=Math.max(1,Math.ceil(this.#e.length/this.#r));this.#n>e&&(this.#n=e),this.#f()}get currentPage(){return this.#n}get totalPages(){return this.#r<=0?1:Math.ceil(this.#e.length/this.#r)}get filteredCount(){return this.#e.length}get totalCount(){return this.#s.length}getSelectedRows(){return this.#t?[...this.#t.querySelectorAll("tr[data-selectable][data-state-selected]")]:[]}};w("data-table",g);export{g as DataTable};
1
+ var C=window.matchMedia("(prefers-reduced-motion: reduce)");var y=new Map;function v(u,t,e={}){let s=e.priority??10,i={impl:t,bundle:e.bundle,contract:e.contract,priority:s},n=y.get(u);if(customElements.get(u)){if(!n||n.priority>=s){n&&n.priority===s&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${u}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${u}> 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 <${u}> already registered by "${n.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}y.set(u,i),customElements.define(u,t)}var m=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,s,i){t.addEventListener(e,s,i),this.#e.push(()=>t.removeEventListener(e,s,i))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#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)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};function x({newItems:u,nodes:t,keyOf:e,renderItem:s,containerFor:i}){let n=[],a=[],c=[],o=new Set;for(let d of u)o.add(e(d));for(let[d,l]of[...t])o.has(d)||(l.remove(),t.delete(d),c.push(d));let r=new Map;for(let d of u){let l=e(d),h=t.get(l)||null,f=i(d,h);r.has(f)||r.set(f,[]),r.get(f)?.push({item:d,key:l,existing:h})}for(let[d,l]of r)for(let h=0;h<l.length;h++){let{item:f,key:p,existing:E}=l[h],b=E;b?(b.parentElement!==d||d.children[h]!==b)&&a.push(p):(b=s(f),t.set(p,b),n.push(p));let w=d.children[h];w!==b&&d.insertBefore(b,w||null)}return{added:n,moved:a,removed:c}}var g=":scope > tr:not([data-expand-content])",A=class u extends m{#e;#t;#r=[];#s=[];#i=[];#c=-1;#d=null;#n=1;#a=0;#u=null;#h=null;#f=null;#l="";#o=null;#C=null;#m=null;#p=null;#g=[];#S=new Map;#A=[];setup(){return this.#e=this.querySelector(":scope > table"),!this.#e||(this.#t=this.#e.querySelector("tbody"),!this.#t)?!1:(this.#V(),!0)}teardown(){this.#O(),this.#r=[],this.#s=[],this.#i=[]}#V(){this.#s=[...this.#t.querySelectorAll(g)],this.#i=[...this.#s],this.#n=1,this.#c=-1,this.#d=null,this.#l="",this.#a=0,this.#A=[...this.#e.tHead?.rows[0]?.cells||[]].map(e=>({key:e.getAttribute("data-key")||e.textContent.trim().toLowerCase(),label:e.textContent.trim(),sort:e.getAttribute("data-sort")||void 0})),this.#S.clear(),this.#g=[];for(let e of this.#s){let s=e.getAttribute("data-id")||e.getAttribute("data-key");s&&(this.#S.set(s,e),this.#g.push({id:s}))}this.#L(),this.#k(),this.#M(),this.#D(),this.#_(),this.#e.hasAttribute("data-filterable")&&this.#G();let t=this.#e.getAttribute("data-paginate");t&&(this.#a=parseInt(t,10),this.#a>0&&this.#U()),this.#X(),this.#Z(),this.#x()}get rows(){return this.#g}set rows(t){let e=t||[],s=x({newItems:e,nodes:this.#S,keyOf:i=>i.id,renderItem:i=>this._renderRow(i),containerFor:()=>this.#t});this.#g=e,this.#s=[...this.#t.querySelectorAll(g)],this.#k(),this.#M(),this.#v(this.#l),this.dispatchEvent(new CustomEvent("data-table:rows-changed",{detail:{rows:e,added:s.added,moved:s.moved,removed:s.removed,source:"api"},bubbles:!0}))}get columns(){return this.#A}_renderRow(t){let e=this;if(typeof e.renderRow=="function"){let i=e.renderRow(t,this.#A);if(!(i instanceof Element))throw new Error("data-table: renderRow must return an Element");return i.hasAttribute("data-id")||i.setAttribute("data-id",String(t.id)),i}let s=document.createElement("tr");s.setAttribute("data-id",String(t.id));for(let i of this.#A){let n=document.createElement("td"),a=t[i.key];n.textContent=a==null?"":String(a),s.appendChild(n)}return s}#N=[];#b=[];#w=[];#L(){let t=[...this.#e.tHead?.rows[0]?.cells||[]];this.#N=t.map(e=>{let s=parseFloat(e.getAttribute("data-weight"));return Number.isFinite(s)?s:null}),this.#b=t.map(e=>e.getAttribute("data-rollup")||null),this.#w=t.map(e=>e.getAttribute("data-heatmap")||null)}#k(){if(this.#b.some(Boolean))for(let t=0;t<this.#b.length;t++){let e=this.#b[t];if(e)for(let s of this.#s){let i=s.children[t];if(!i)continue;let n=this.#P(s,t,e),a=u.#H(n);i.textContent=a,i.setAttribute("data-rollup-value",String(n)),i.hasAttribute("data-sort-value")||i.setAttribute("data-sort-value",String(n))}}}#P(t,e,s){let i=[...t.children],n=0,a=0,c=-1/0,o=0,r=1,d=!1;for(let l=0;l<i.length;l++){if(l===e||this.#b[l])continue;let h=i[l].getAttribute("data-sort-value")??i[l].textContent??"",f=parseFloat(h);if(!Number.isFinite(f))continue;n+=f,a++,f>c&&(c=f),r*=f,d=!0;let p=this.#N[l];p!==null&&(o+=f*p)}switch(s){case"sum":return n;case"avg":return a?n/a:0;case"max":return c===-1/0?0:c;case"weighted-sum":return o;case"product":return d?r:0;default:return n}}static#H(t){return Number.isFinite(t)?Number.isInteger(t)?String(t):(Math.round(t*100)/100).toString():""}#M(){if(this.#w.some(Boolean))for(let t=0;t<this.#w.length;t++){let e=this.#w[t];if(!e)continue;let s=this.#s.map(o=>{let r=o.children[t];if(!r)return null;let d=r.getAttribute("data-rollup-value")??r.getAttribute("data-sort-value")??r.textContent??"",l=parseFloat(d);return Number.isFinite(l)?l:null}),i=s.filter(o=>o!==null);if(!i.length)continue;let n=Math.min(...i),c=Math.max(...i)-n||1;for(let o=0;o<this.#s.length;o++){let r=this.#s[o].children[t];if(!r)continue;let d=s[o];if(d===null){r.removeAttribute("data-heat-level");continue}let l=(d-n)/c;e==="low-good"&&(l=1-l);let h=l<.34?"low":l<.67?"mid":"high";r.setAttribute("data-heat-level",h)}}}#O(){this.#f&&clearTimeout(this.#f),this.#u?.parentElement?.remove(),this.#h?.remove(),this.#m?.remove(),this.#p?.remove(),this.#u=null,this.#h=null,this.#m=null,this.#p=null}#T(t,e){return this.dataset[`label${t}`]||e}#D(){let t=document.createElement("span");t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.setAttribute("data-table-status",""),t.className="visually-hidden",this.appendChild(t),this.#m=t}#R(t){let e=this.#m;e&&(e.textContent=e.textContent===t?`${t}\xA0`:t)}#_(){this.#e.querySelectorAll("thead th[data-sort]").forEach((e,s)=>{let i=e.getAttribute("data-sort"),n=this.#j(e);this.#r.push({th:e,sortType:i,columnIndex:n}),e.setAttribute("aria-sort","none"),u.#K(e),e.dataset.columnIndex=n,this.listen(e,"click",this.#z)})}static#K(t){if(t.querySelector(":scope > button[data-sort-button]"))return;let e=document.createElement("button");e.type="button",e.setAttribute("data-sort-button",""),e.append(...t.childNodes),t.appendChild(e)}#j(t){return[...t.parentElement.children].indexOf(t)}#z=t=>{let e=t.currentTarget,s=t.target.closest?.("a, input, select, textarea, button:not([data-sort-button])");if(s&&e.contains(s))return;let i=parseInt(e.dataset.columnIndex,10);this.#W(i)};#Q(t,e,s){let i=this.#i;if(i.length<2)return!0;let n=s==="asc"?1:-1;for(let a=1;a<i.length;a++){let c=this.#y(i[a-1].children[t],e),o=this.#y(i[a].children[t],e);if((typeof c=="string"?c.localeCompare(o)*n:(c-o)*n)>0)return!1}return!0}#W(t){let e=this.#r.find(n=>n.columnIndex===t);if(!e)return;let s;this.#c===t?s=this.#d==="asc"?"desc":"asc":this.#Q(t,e.sortType,"asc")?s="desc":s="asc",this.#r.forEach(({th:n})=>{n.setAttribute("aria-sort","none")}),e.th.setAttribute("aria-sort",s==="asc"?"ascending":"descending"),this.#c=t,this.#d=s,this.#B(t,s,e.sortType),this.#n=1,this.#x();let i=e.th.textContent.trim();this.#R(`Sorted by ${i}, ${s==="asc"?"ascending":"descending"}`),this.dispatchEvent(new CustomEvent("data-table:sort",{detail:{column:t,direction:s,columnName:i},bubbles:!0}))}#B(t,e,s){let i=e==="asc"?1:-1;this.#i.sort((n,a)=>{let c=n.children[t],o=a.children[t];if(!c||!o)return 0;let r=this.#y(c,s),d=this.#y(o,s),l=0;switch(s){case"number":l=r-d;break;case"date":l=r-d;break;default:l=r.localeCompare(d,void 0,{numeric:!0,sensitivity:"base"});break}return l*i})}#y(t,e){let i=t.getAttribute("data-sort-value")??t.textContent.trim();switch(e){case"number":return parseFloat(i)||0;case"date":return new Date(i).getTime()||0;default:return i.toLowerCase()}}#G(){let t=document.createElement("div");t.setAttribute("data-table-filter","");let e=document.createElement("input");e.type="search",e.setAttribute("data-filter-input",""),e.setAttribute("placeholder","Filter table..."),e.setAttribute("aria-label","Filter table rows"),t.appendChild(e),this.insertBefore(t,this.#e),this.#u=e;let s=document.createElement("p");s.setAttribute("data-table-empty",""),s.hidden=!0,s.textContent=this.#T("NoResults","No matching rows found"),this.#e.after(s),this.#p=s,this.listen(e,"input",this.#J)}#J=t=>{let e=t.target.value;this.#f&&clearTimeout(this.#f),this.#f=setTimeout(()=>{this.#v(e,{announce:!0})},150)};#v(t,{announce:e=!1,keepPage:s=!1}={}){if(this.#l=String(t??"").toLowerCase().trim(),this.#l===""?this.#i=[...this.#s]:this.#i=this.#s.filter(i=>[...i.children].some(a=>(a.getAttribute("data-filter-value")??a.textContent).toLowerCase().includes(this.#l))),this.#c>=0&&this.#d){let i=this.#r.find(n=>n.columnIndex===this.#c);i&&this.#B(this.#c,this.#d,i.sortType)}if(s?this.#n=Math.min(this.#n,this.totalPages):this.#n=1,this.#x(),e){let i=this.#i.length,n=this.#s.length;this.#R(i===0?this.#T("NoResults","No matching rows found"):this.#l?`${i} of ${n} ${n===1?"row":"rows"} shown`:`All ${n} ${n===1?"row":"rows"} shown`)}this.dispatchEvent(new CustomEvent("data-table:filter",{detail:{query:this.#l,count:this.#i.length},bubbles:!0}))}#U(){let t=document.createElement("nav");t.setAttribute("data-pagination",""),t.setAttribute("aria-label","Table pagination"),this.appendChild(t),this.#h=t}#X(){for(let t of this.#t.querySelectorAll(":scope > tr[data-expandable]")){let e=t.querySelector('[data-action="toggle-expand"]');e&&e.setAttribute("aria-expanded",String(t.hasAttribute("data-state-expanded")))}this.listen(this.#e,"click",this.#Y)}#Y=t=>{let e=t.target.closest('[data-action="toggle-expand"]');if(!e)return;let s=e.closest("tr[data-expandable]");if(!s)return;let i=s.hasAttribute("data-state-expanded"),n=s.nextElementSibling;i?(s.removeAttribute("data-state-expanded"),e.setAttribute("aria-expanded","false"),n?.hasAttribute("data-expand-content")&&(n.hidden=!0,n.setAttribute("aria-hidden","true"))):(s.setAttribute("data-state-expanded",""),e.setAttribute("aria-expanded","true"),n?.hasAttribute("data-expand-content")&&(n.hidden=!1,n.removeAttribute("aria-hidden"))),this.dispatchEvent(new CustomEvent("data-table:expand",{detail:{row:s,expanded:!i},bubbles:!0}))};#Z(){this.#o=this.#e.querySelector('thead [data-action="select-all"]'),this.#o&&this.listen(this.#o,"change",this.#tt),this.listen(this.#t,"change",this.#et),this.#C=this.querySelector("[data-selected-count]"),this.#$()}#tt=t=>{let e=t.target.checked;this.#t.querySelectorAll("tr[data-selectable]").forEach(i=>{let n=i.querySelector('[data-action="select-row"]');e?(i.setAttribute("data-state-selected",""),n&&(n.checked=!0)):(i.removeAttribute("data-state-selected"),n&&(n.checked=!1))}),t.target.indeterminate=!1,this.#q(),this.#F(),this.#I()};#et=t=>{let e=t.target.closest('[data-action="select-row"]');if(!e)return;let s=e.closest("tr[data-selectable]");s&&(e.checked?s.setAttribute("data-state-selected",""):s.removeAttribute("data-state-selected"),this.#$(),this.#F(),this.#I())};#F(){let t=this.getSelectedRows().length;this.#R(`${t} ${t===1?"row":"rows"} selected`)}#$(){if(!this.#o){this.#q();return}let t=this.#t.querySelectorAll("tr[data-selectable]"),e=this.#t.querySelectorAll("tr[data-selectable][data-state-selected]"),s=t.length,i=e.length;i===0?(this.#o.checked=!1,this.#o.indeterminate=!1):i===s?(this.#o.checked=!0,this.#o.indeterminate=!1):(this.#o.checked=!1,this.#o.indeterminate=!0),this.#q()}#q(){let e=this.#t.querySelectorAll("tr[data-selectable][data-state-selected]").length;this.#C&&(this.#C.textContent=e)}#I(){let t=[...this.#t.querySelectorAll("tr[data-selectable][data-state-selected]")];this.dispatchEvent(new CustomEvent("data-table:selection",{detail:{count:t.length,rows:t},bubbles:!0}))}#st(){if(!this.#h||this.#a<=0)return;let t=this.#h,e=Math.ceil(this.#i.length/this.#a),s=document.activeElement,i=null;if(s instanceof HTMLElement&&t.contains(s)&&(i=s.hasAttribute("data-pagination-prev")?"prev":s.hasAttribute("data-pagination-next")?"next":"page"),t.replaceChildren(),e<=1)return;let n=document.createElement("button");n.type="button",n.textContent="Previous",n.setAttribute("data-pagination-prev",""),n.disabled=this.#n===1,n.addEventListener("click",()=>this.goToPage(this.#n-1)),t.appendChild(n),this.#it(e).forEach(o=>{if(o==="..."){let r=document.createElement("span");r.textContent="...",r.setAttribute("data-pagination-ellipsis",""),t.appendChild(r)}else{let r=document.createElement("button");r.type="button",r.textContent=o,r.setAttribute("data-pagination-page",""),o===this.#n&&(r.setAttribute("aria-current","page"),r.setAttribute("data-current","")),r.addEventListener("click",()=>this.goToPage(o)),t.appendChild(r)}});let c=document.createElement("button");if(c.type="button",c.textContent="Next",c.setAttribute("data-pagination-next",""),c.disabled=this.#n===e,c.addEventListener("click",()=>this.goToPage(this.#n+1)),t.appendChild(c),i){let o=t.querySelector('[aria-current="page"]');(i==="prev"&&!n.disabled?n:i==="next"&&!c.disabled?c:o)?.focus()}}#it(t){let e=this.#n,s=[];if(t<=7)for(let i=1;i<=t;i++)s.push(i);else{s.push(1),e>3&&s.push("...");let i=Math.max(2,e-1),n=Math.min(t-1,e+1);for(let a=i;a<=n;a++)s.push(a);e<t-2&&s.push("..."),s.push(t)}return s}#x(){this.#s.forEach(s=>{s.setAttribute("data-state-hidden",""),this.#E(s)?.setAttribute("data-state-hidden","")});let t;if(this.#a>0){let s=(this.#n-1)*this.#a,i=s+this.#a;t=this.#i.slice(s,i)}else t=this.#i;t.forEach(s=>{s.removeAttribute("data-state-hidden");let i=this.#E(s);this.#t.appendChild(s),i&&(i.removeAttribute("data-state-hidden"),this.#t.appendChild(i))}),this.#i.forEach(s=>{if(s.hasAttribute("data-state-hidden")){let i=this.#E(s);this.#t.appendChild(s),i&&this.#t.appendChild(i)}});let e=new Set(this.#i);this.#s.forEach(s=>{if(!e.has(s)){let i=this.#E(s);this.#t.appendChild(s),i&&this.#t.appendChild(i)}}),this.#p&&(this.#p.hidden=!(this.#l&&this.#i.length===0&&this.#s.length>0)),this.#st()}#E(t){if(!t.hasAttribute("data-expandable"))return null;let e=t.nextElementSibling;return e?.hasAttribute("data-expand-content")?e:null}goToPage(t){if(this.#a<=0)return;let e=Math.max(1,Math.ceil(this.#i.length/this.#a)),s=Math.max(1,Math.min(Math.trunc(Number(t))||1,e));s!==this.#n&&(this.#n=s,this.#x(),this.dispatchEvent(new CustomEvent("data-table:page",{detail:{page:this.#n},bubbles:!0})))}setFilter(t){this.#u&&(this.#u.value=t),this.#v(t,{announce:!0})}refresh(){this.#t&&(this.#s=[...this.#t.querySelectorAll(g)],this.#k(),this.#M(),this.#v(this.#l,{keepPage:!0}),this.#$())}get currentPage(){return this.#n}get totalPages(){return this.#a<=0?1:Math.max(1,Math.ceil(this.#i.length/this.#a))}get filteredCount(){return this.#i.length}get totalCount(){return this.#s.length}getSelectedRows(){return this.#t?[...this.#t.querySelectorAll("tr[data-selectable][data-state-selected]")]:[]}};v("data-table",A);export{A as DataTable};
2
2
  //# sourceMappingURL=data-table.js.map
@@ -1,2 +1,2 @@
1
- var S=window.matchMedia("(prefers-reduced-motion: reduce)");var A=new Map;function E(a,t,i={}){let e=i.priority??10,s={impl:t,bundle:i.bundle,contract:i.contract,priority:e},n=A.get(a);if(customElements.get(a)){if(!n||n.priority>=e){n&&n.priority===e&&n.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=e){n.priority===e&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${n.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}A.set(a,s),customElements.define(a,t)}var m=class extends HTMLElement{#c=[];#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 t of this.#c)t();this.#c=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,i,e,s){t.addEventListener(i,e,s),this.#c.push(()=>t.removeEventListener(i,e,s))}setup(){}teardown(){}setState(t,i){this.#i||(this.#i=this.attachInternals());let e=this.#i.states;try{i?e.add(t):e.delete(t)}catch{let s=`--${t}`;i?e.add(s):e.delete(s)}}_adoptInternals(t){this.#i||(this.#i=t)}};var C="popover"in HTMLElement.prototype;var x=["Su","Mo","Tu","We","Th","Fr","Sa"],k=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],D=["january","february","march","april","may","june","july","august","september","october","november","december"];function d(a){let t=a.getFullYear(),i=String(a.getMonth()+1).padStart(2,"0"),e=String(a.getDate()).padStart(2,"0");return`${t}-${i}-${e}`}function p(a){if(!a)return null;let[t,i,e]=a.split("-").map(Number);return new Date(t,i-1,e)}function b(a,t){return new Date(a,t+1,0).getDate()}function F(){try{let a=new Intl.Locale(navigator.language);if(a.weekInfo)return a.weekInfo.firstDay%7}catch{}return 0}function N(a){try{return new Intl.DateTimeFormat(void 0,{year:"numeric",month:"long",day:"numeric"}).format(a)}catch{return d(a)}}function g(a,t){return a&&t&&a.getFullYear()===t.getFullYear()&&a.getMonth()===t.getMonth()&&a.getDate()===t.getDate()}function T(){let a=new Map;D.forEach((t,i)=>{a.set(t,i),a.set(t.slice(0,3),i)});try{for(let t=0;t<12;t++){let i=new Intl.DateTimeFormat(void 0,{month:"long"}).format(new Date(2e3,t,1)).toLowerCase(),e=new Intl.DateTimeFormat(void 0,{month:"short"}).format(new Date(2e3,t,1)).toLowerCase().replace(".","");a.set(i,t),a.set(e,t)}}catch{}return a}var w=T();function y(a){let t=a.trim();if(!t)return{date:null,partial:null};if(/^\d{4}-\d{2}-\d{2}$/.test(t)){let r=p(t);return r&&!isNaN(r.getTime())?{date:r,partial:null}:{date:null,partial:null}}if(/^\d{4}\/\d{2}\/\d{2}$/.test(t)){let r=p(t.replace(/\//g,"-"));return r&&!isNaN(r.getTime())?{date:r,partial:null}:{date:null,partial:null}}let i=/^([a-z\u00C0-\u024F]+)\s+(\d{1,2}),?\s+(\d{4})$/i,e=t.match(i);if(e){let r=w.get(e[1].toLowerCase());if(r!==void 0){let h=new Date(Number(e[3]),r,Number(e[2]));if(!isNaN(h.getTime()))return{date:h,partial:null}}}let s=/^(\d{1,2})\s+([a-z\u00C0-\u024F]+)\s+(\d{4})$/i;if(e=t.match(s),e){let r=w.get(e[2].toLowerCase());if(r!==void 0){let h=new Date(Number(e[3]),r,Number(e[1]));if(!isNaN(h.getTime()))return{date:h,partial:null}}}let n=/^([a-z\u00C0-\u024F]+)\s+(\d{4})$/i;if(e=t.match(n),e){let r=w.get(e[1].toLowerCase());if(r!==void 0)return{date:null,partial:{year:Number(e[2]),month:r}}}return{date:null,partial:null}}var v=class extends m{static formAssociated=!0;#c;#i;#t;#p;#b;#a;#y;#f;#D;#u;#l=!1;#v=!1;#e=null;#n=null;#r=new Date().getFullYear();#s=new Date().getMonth();#h=null;#o=null;#x=new Map;#k=new Map;#S=null;#A=0;constructor(){super(),this.#c=this.attachInternals(),this._adoptInternals(this.#c)}setup(){if(this.#i=this.querySelector(':scope > input[type="date"]'),!this.#i)return!1;this.#h=p(this.#i.getAttribute("min")),this.#o=p(this.#i.getAttribute("max")),this.#A=F();let t=this.getAttribute("data-disabled-dates");t&&t.split(",").forEach(s=>{let[n,r]=s.trim().split(":");this.#x.set(n,r||"")});let i=this.getAttribute("data-highlight-dates");i&&i.split(",").forEach(s=>{let[n,r]=s.trim().split(":");this.#k.set(n,r||"")}),this.#e=p(this.#i.value),this.#S=this.#i.value;let e=new Date;return this.#o&&e>this.#o&&(e=this.#o),this.#h&&e<this.#h&&(e=this.#h),this.#r=this.#e?this.#e.getFullYear():e.getFullYear(),this.#s=this.#e?this.#e.getMonth():e.getMonth(),this.#n=this.#e||e,this.#i.setAttribute("tabindex","-1"),this.#i.setAttribute("aria-hidden","true"),this.#i.style.cssText="position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;overflow:hidden;",this.#P(),this.#B(),this.#g(),this.#E(),this.#C(),this.#v=C,this.#v&&this.#a.setAttribute("popover","manual"),this.listen(document,"click",this.#z),(this.#i.disabled||this.hasAttribute("disabled"))&&(this.setAttribute("data-disabled",""),this.#t.disabled=!0),!0}teardown(){window.removeEventListener("scroll",this.#w,{capture:!0}),window.removeEventListener("resize",this.#w)}#P(){this.#b=document.createElement("div"),this.#b.className="date-trigger",this.#t=document.createElement("input"),this.#t.type="text",this.#t.className="date-input",this.#t.setAttribute("role","combobox"),this.#t.setAttribute("aria-haspopup","dialog"),this.#t.setAttribute("aria-expanded","false"),this.#t.setAttribute("autocomplete","off"),this.#t.setAttribute("placeholder","Type a date\u2026"),this.#b.appendChild(this.#t),this.#p=document.createElement("button"),this.#p.type="button",this.#p.className="date-trigger-icon",this.#p.setAttribute("aria-label","Toggle calendar"),this.#p.setAttribute("tabindex","-1");let t=document.createElement("icon-wc");t.setAttribute("name","calendar"),t.setAttribute("size","sm"),t.setAttribute("aria-hidden","true"),this.#p.appendChild(t),this.#b.appendChild(this.#p),this.appendChild(this.#b),this.listen(this.#p,"click",i=>{i.stopPropagation(),this.#l?this.#m():this.#T(),this.#t.focus()}),this.listen(this.#t,"focus",()=>this.#t.select()),this.listen(this.#t,"input",this.#O),this.listen(this.#t,"keydown",this.#q),this.listen(this.#t,"blur",this.#R)}#B(){this.#y=`dp-${Math.random().toString(36).slice(2,8)}`,this.#a=document.createElement("div"),this.#a.className="calendar",this.#a.id=this.#y,this.#a.setAttribute("role","dialog"),this.#a.setAttribute("aria-modal","false"),this.#a.setAttribute("aria-label","Choose date"),this.#a.hidden=!0,this.#t.setAttribute("aria-controls",this.#y);let t=document.createElement("div");t.className="calendar-header";let i=document.createElement("button");i.type="button",i.className="calendar-nav",i.setAttribute("aria-label","Previous month");let e=document.createElement("icon-wc");e.setAttribute("name","chevron-left"),e.setAttribute("size","sm"),e.setAttribute("aria-hidden","true"),i.appendChild(e);let s=document.createElement("span");s.className="calendar-title",s.id=`${this.#y}-title`,s.setAttribute("aria-live","polite"),this.#D=document.createElement("span"),this.#D.className="calendar-month",this.#u=document.createElement("select"),this.#u.className="calendar-year",this.#u.setAttribute("aria-label","Year"),this.#Y(),s.appendChild(this.#D),s.appendChild(this.#u);let n=document.createElement("button");n.type="button",n.className="calendar-nav",n.setAttribute("aria-label","Next month");let r=document.createElement("icon-wc");r.setAttribute("name","chevron-right"),r.setAttribute("size","sm"),r.setAttribute("aria-hidden","true"),n.appendChild(r),t.appendChild(i),t.appendChild(s),t.appendChild(n),this.#a.appendChild(t);let h=document.createElement("table");h.setAttribute("role","grid"),h.setAttribute("aria-labelledby",`${this.#y}-title`);let u=document.createElement("thead"),c=document.createElement("tr");for(let l=0;l<7;l++){let o=(this.#A+l)%7,f=document.createElement("th");f.setAttribute("abbr",k[o]),f.setAttribute("scope","col"),f.textContent=x[o],c.appendChild(f)}u.appendChild(c),h.appendChild(u),this.#f=document.createElement("tbody"),h.appendChild(this.#f),this.#a.appendChild(h),this.appendChild(this.#a),this.#d(),this.listen(i,"click",()=>this.#L(-1)),this.listen(n,"click",()=>this.#L(1)),this.listen(this.#u,"change",()=>{this.#r=Number(this.#u.value);let l=b(this.#r,this.#s),o=Math.min(this.#n?.getDate()??1,l);this.#n=new Date(this.#r,this.#s,o),this.#d()}),this.listen(this.#f,"click",this.#H),this.listen(this.#a,"keydown",this.#V)}#d(){try{this.#D.textContent=new Intl.DateTimeFormat(void 0,{month:"long"}).format(new Date(this.#r,this.#s,1))}catch{this.#D.textContent=D[this.#s].charAt(0).toUpperCase()+D[this.#s].slice(1)}this.#u.querySelector(`option[value="${this.#r}"]`)||this.#Y(),this.#u.value=String(this.#r),this.#f.innerHTML="";let t=b(this.#r,this.#s),e=(new Date(this.#r,this.#s,1).getDay()-this.#A+7)%7,s=new Date,n=document.createElement("tr");for(let h=0;h<e;h++)n.appendChild(document.createElement("td"));for(let h=1;h<=t;h++){let u=new Date(this.#r,this.#s,h),c=d(u),l=document.createElement("td"),o=document.createElement("button");o.type="button",o.setAttribute("data-date",c),o.textContent=String(h),g(u,s)&&o.setAttribute("aria-current","date"),g(u,this.#e)&&o.setAttribute("aria-selected","true");let f=this.#$(u,c);if(f.disabled&&(o.setAttribute("aria-disabled","true"),o.setAttribute("disabled",""),f.reason&&o.setAttribute("data-disabled-reason",f.reason)),this.#k.has(c)){let M=this.#k.get(c);o.setAttribute("data-highlight",M||"")}g(u,this.#n)?(o.setAttribute("tabindex","0"),g(u,this.#e)||o.setAttribute("data-focused","")):o.setAttribute("tabindex","-1"),l.appendChild(o),n.appendChild(l),(e+h)%7===0&&(this.#f.appendChild(n),n=document.createElement("tr"))}let r=(e+t)%7;if(r>0){for(let h=r;h<7;h++)n.appendChild(document.createElement("td"));this.#f.appendChild(n)}}#F(t,i){return this.#$(t,i).disabled}#$(t,i){return this.#x.has(i)?{disabled:!0,reason:this.#x.get(i)}:this.#h&&t<this.#h?{disabled:!0,reason:null}:this.#o&&t>this.#o?{disabled:!0,reason:null}:{disabled:!1,reason:null}}#Y(){this.#u.innerHTML="";let t=new Date().getFullYear(),i=this.#h?this.#h.getFullYear():t-100,e=this.#o?this.#o.getFullYear():t+10;for(let s=i;s<=e;s++){let n=document.createElement("option");n.value=String(s),n.textContent=String(s),this.#u.appendChild(n)}}#L(t){this.#s+=t,this.#s>11?(this.#s=0,this.#r++):this.#s<0&&(this.#s=11,this.#r--);let i=b(this.#r,this.#s),e=Math.min(this.#n?.getDate()??1,i);this.#n=new Date(this.#r,this.#s,e),this.#d(),this.#N(this.#n)}#M(t,i="internal"){let e=d(t);this.#F(t,e)||this.#e&&d(this.#e)===e||(this.#e=t,this.#n=t,this.#g(),this.#E(),this.#C(),this.#d(),this.#m(),this.#t.focus(),this.dispatchEvent(new CustomEvent("date-picker:change",{bubbles:!0,detail:{value:e,date:new Date(t),source:i}})))}#N(t){let i=d(t),e=this.#f.querySelector(`[data-date="${i}"]`);e&&(this.#f.querySelectorAll('button[tabindex="0"]').forEach(s=>{s.setAttribute("tabindex","-1")}),e.setAttribute("tabindex","0"),e.focus())}#g(){this.#e?this.#t.value=N(this.#e):this.#t.value=""}#T(){if(!this.#l){if(this.#l=!0,this.setAttribute("open",""),this.#t.setAttribute("aria-expanded","true"),this.#a.hidden=!1,this.#n&&(this.#r=this.#n.getFullYear(),this.#s=this.#n.getMonth()),this.#d(),this.#v){try{this.#a.showPopover()}catch{}this.#I(),window.addEventListener("scroll",this.#w,{capture:!0,passive:!0}),window.addEventListener("resize",this.#w,{passive:!0})}this.dispatchEvent(new CustomEvent("date-picker:open",{bubbles:!0}))}}#m(){if(this.#l){if(this.#l=!1,this.removeAttribute("open"),this.#t.setAttribute("aria-expanded","false"),this.#a.hidden=!0,this.#v){try{this.#a.hidePopover()}catch{}window.removeEventListener("scroll",this.#w,{capture:!0}),window.removeEventListener("resize",this.#w)}this.dispatchEvent(new CustomEvent("date-picker:close",{bubbles:!0}))}}#I(){if(!this.#v)return;let t=this.#b.getBoundingClientRect(),i=this.#a.getBoundingClientRect(),e=4,s=8,n=window.innerHeight,r=window.innerWidth,h=n-t.bottom-s,u=t.top-s,c;h<i.height&&u>h?(c=t.top-i.height-e,this.#a.dataset.placement="top"):(c=t.bottom+e,delete this.#a.dataset.placement);let l=t.left;l+i.width>r-s&&(l=r-i.width-s),l<s&&(l=s),this.#a.style.setProperty("--calendar-top",`${c}px`),this.#a.style.setProperty("--calendar-left",`${l}px`)}#w=()=>{this.#l&&this.#I()};#O=()=>{let t=this.#t.value,{date:i,partial:e}=y(t);if(i)this.#n=i,this.#r=i.getFullYear(),this.#s=i.getMonth(),this.#d();else if(e){this.#r=e.year,this.#s=e.month;let s=b(e.year,e.month),n=Math.min(this.#n?.getDate()??1,s);this.#n=new Date(e.year,e.month,n),this.#d()}!this.#l&&t.length>0&&this.#T()};#q=t=>{switch(t.key){case"Enter":{t.preventDefault(),t.stopPropagation();let{date:i}=y(this.#t.value);i&&!this.#F(i,d(i))&&this.#M(i);return}case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.#l||this.#T(),requestAnimationFrame(()=>this.#N(this.#n));return;case"Escape":t.preventDefault(),t.stopPropagation(),this.#l&&this.#m(),this.#g();return;case"Tab":this.#l&&this.#m();return}};#R=t=>{if(t.relatedTarget&&this.contains(t.relatedTarget))return;let i=this.#t.value.trim();if(i){let{date:e}=y(i);e&&!this.#F(e,d(e))&&(this.#e=e,this.#n=e,this.#E(),this.#C(),this.dispatchEvent(new CustomEvent("date-picker:change",{bubbles:!0,detail:{value:d(e),date:new Date(e)}})))}this.#g(),this.#l&&this.#m(),this.#i.dispatchEvent(new Event("blur",{bubbles:!0}))};#z=t=>{this.#l&&!this.contains(t.target)&&this.#m()};#H=t=>{let e=t.target?.closest("button[data-date]");if(!e||e.hasAttribute("disabled"))return;let s=p(e.getAttribute("data-date"));s&&this.#M(s)};#V=t=>{if(t.key==="Tab"){this.#m();return}let i=this.#n;if(!i)return;let e;switch(t.key){case"ArrowRight":e=new Date(i.getFullYear(),i.getMonth(),i.getDate()+1);break;case"ArrowLeft":e=new Date(i.getFullYear(),i.getMonth(),i.getDate()-1);break;case"ArrowDown":e=new Date(i.getFullYear(),i.getMonth(),i.getDate()+7);break;case"ArrowUp":e=new Date(i.getFullYear(),i.getMonth(),i.getDate()-7);break;case"PageDown":t.shiftKey?e=new Date(i.getFullYear()+1,i.getMonth(),i.getDate()):e=new Date(i.getFullYear(),i.getMonth()+1,i.getDate());break;case"PageUp":t.shiftKey?e=new Date(i.getFullYear()-1,i.getMonth(),i.getDate()):e=new Date(i.getFullYear(),i.getMonth()-1,i.getDate());break;case"Home":e=new Date(i.getFullYear(),i.getMonth(),i.getDate()-i.getDay()+this.#A);break;case"End":e=new Date(i.getFullYear(),i.getMonth(),i.getDate()+(6-i.getDay()+this.#A));break;case"Enter":case" ":t.preventDefault(),t.stopPropagation(),this.#M(i);return;case"Escape":t.preventDefault(),t.stopPropagation(),this.#m(),this.#t.focus();return;default:return}t.preventDefault(),t.stopPropagation(),e&&(this.#h&&e<this.#h&&(e=this.#h),this.#o&&e>this.#o&&(e=this.#o),this.#n=e,(e.getMonth()!==this.#s||e.getFullYear()!==this.#r)&&(this.#s=e.getMonth(),this.#r=e.getFullYear(),this.#d()),this.#N(e))};#E(){let t=this.#e?d(this.#e):"";this.#c.setFormValue(t||null),this.#i.value=t,this.#i.dispatchEvent(new Event("input",{bubbles:!0}))}#C(){(this.hasAttribute("required")||this.#i.hasAttribute("required"))&&!this.#e?this.#c.setValidity({valueMissing:!0},"Please select a date",this.#t||this):this.#c.setValidity({})}formResetCallback(){this.#e=p(this.#S);let t=new Date;this.#n=this.#e||t,this.#r=this.#n.getFullYear(),this.#s=this.#n.getMonth(),this.#g(),this.#E(),this.#C(),this.#l&&this.#d()}formStateRestoreCallback(t){t&&(this.#e=p(t),this.#e&&(this.#n=this.#e,this.#r=this.#e.getFullYear(),this.#s=this.#e.getMonth(),this.#g(),this.#E(),this.#C()))}get value(){return this.#e?d(this.#e):""}set value(t){let i=p(t);i&&this.#M(i,"api")}get min(){return this.#h?d(this.#h):""}set min(t){this.#h=t?p(t):null,this.#i&&this.#i.setAttribute("min",t||""),this.#d()}get max(){return this.#o?d(this.#o):""}set max(t){this.#o=t?p(t):null,this.#i&&this.#i.setAttribute("max",t||""),this.#d()}};E("date-picker",v);export{v as DatePicker};
1
+ var W=window.matchMedia("(prefers-reduced-motion: reduce)");var S=new Map;function $(n,t,i={}){let e=i.priority??10,s={impl:t,bundle:i.bundle,contract:i.contract,priority:e},r=S.get(n);if(customElements.get(n)){if(!r||r.priority>=e){r&&r.priority===e&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=e){r.priority===e&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${r.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}S.set(n,s),customElements.define(n,t)}var v=class extends HTMLElement{#a=[];#d;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.#a)t();this.#a=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,i,e,s){t.addEventListener(i,e,s),this.#a.push(()=>t.removeEventListener(i,e,s))}_reinit(){for(let t of this.#a)t();this.#a=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,i){this.#d||(this.#d=this.attachInternals());let e=this.#d.states;try{i?e.add(t):e.delete(t)}catch{let s=`--${t}`;i?e.add(s):e.delete(s)}}_adoptInternals(t){this.#d||(this.#d=t)}#o(){return this.constructor.formAssociated&&this.#d?this.#d:null}get validity(){return this.#o()?.validity}get validationMessage(){return this.#o()?.validationMessage??""}get willValidate(){return this.#o()?.willValidate??!1}get form(){return this.#o()?.form??null}checkValidity(){return this.#o()?.checkValidity()??!0}reportValidity(){return this.#o()?.reportValidity()??!0}};var F="popover"in HTMLElement.prototype;var m=[{ja:"\u4EE4\u548C",latin:"R",start:[2019,5,1]},{ja:"\u5E73\u6210",latin:"H",start:[1989,1,8]},{ja:"\u662D\u548C",latin:"S",start:[1926,12,25]},{ja:"\u5927\u6B63",latin:"T",start:[1912,7,30]},{ja:"\u660E\u6CBB",latin:"M",start:[1868,10,23]}],O=new RegExp(`^(?:(${m.map(n=>n.ja).join("|")})|(${m.map(n=>n.latin).join("|")}))`+String.raw`\s*(元|\d{1,2})年?[/.\-]?\s*(\d{1,2})月?[/.\-]?\s*(\d{1,2})日?$`,"i"),B=/^(\d{4})年(\d{1,2})月(\d{1,2})日?$/;function L(n){return n.trim().replace(/[0-9]/g,t=>String(t.charCodeAt(0)-65296)).replace(/\s+/g,"")}function T(n,t,i){let e=new Date(2e3,t-1,i);return e.setFullYear(n),e.getMonth()===t-1&&e.getDate()===i?e:null}function I(n){let t=L(n).match(O);if(!t)return null;let i=t[1]?m.find(a=>a.ja===t[1]):m.find(a=>a.latin.toUpperCase()===t[2].toUpperCase());if(!i)return null;let e=t[3]==="\u5143"?1:Number(t[3]);if(e<1)return null;let s=T(i.start[0]+e-1,Number(t[4]),Number(t[5]));if(!s||s<new Date(i.start[0],i.start[1]-1,i.start[2]))return null;let r=m.indexOf(i);if(r>0){let a=m[r-1].start;if(s>=new Date(a[0],a[1]-1,a[2]))return null}return s}function Y(n){let t=L(n).match(B);return t?T(Number(t[1]),Number(t[2]),Number(t[3])):null}function V(n){return n.split("-")[0].toLowerCase()}function R(n,t="en-US"){try{if(n)return Intl.getCanonicalLocales(n),n}catch{}try{return Intl.getCanonicalLocales(t),t}catch{return"en-US"}}var M=["january","february","march","april","may","june","july","august","september","october","november","december"],U=0;function c(n){let t=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),e=String(n.getDate()).padStart(2,"0");return`${t}-${i}-${e}`}function k(n,t,i){if(!Number.isInteger(n)||!Number.isInteger(t)||!Number.isInteger(i))return null;let e=new Date(n,t,i);return e.getFullYear()!==n||e.getMonth()!==t||e.getDate()!==i?null:e}function f(n){if(!n)return null;let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(String(n).trim());return t?k(Number(t[1]),Number(t[2])-1,Number(t[3])):null}function g(n,t){return new Date(n,t+1,0).getDate()}function A(n,t){let i=new Date(n.getFullYear(),n.getMonth()+t,1),e=i.getFullYear(),s=i.getMonth();return new Date(e,s,Math.min(n.getDate(),g(e,s)))}function _(n){try{let t=new Intl.Locale(n),i=t.getWeekInfo?.()??t.weekInfo;if(i)return i.firstDay%7}catch{}return 0}var D=new Map;function q(n,t){let i=`${n}:${t}`;if(D.has(i))return D.get(i);let e;try{let s=new Intl.DateTimeFormat(n,{weekday:t});e=Array.from({length:7},(r,a)=>s.format(new Date(2026,0,4+a)))}catch{e=t==="long"?["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}return D.set(i,e),e}function P(n,t){try{return new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"numeric"}).format(n)}catch{return c(n)}}function E(n,t){return!!(n&&t&&n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate())}var C=new Map;function z(n){if(C.has(n))return C.get(n);let t=new Map;M.forEach((i,e)=>{t.set(i,e),t.set(i.slice(0,3),e)});try{let i=new Intl.DateTimeFormat(n,{month:"long"}),e=new Intl.DateTimeFormat(n,{month:"short"});for(let s=0;s<12;s++){let r=new Date(2e3,s,1);t.set(i.format(r).toLowerCase(),s),t.set(e.format(r).toLowerCase().replace(".",""),s)}}catch{}return C.set(n,t),t}function x(n,t){let i=n.trim(),e={date:null,partial:null};if(!i)return e;if(/^\d{4}[-/]\d{2}[-/]\d{2}$/.test(i)){let o=f(i.replace(/\//g,"-"));return o?{date:o,partial:null}:e}if(V(t)==="ja"){let o=I(i);if(o)return{date:o,partial:null}}let s=Y(i);if(s)return{date:s,partial:null};let r=z(t),a=i.match(/^([a-zÀ-ɏ]+)\.?\s+(\d{1,2}),?\s+(\d{4})$/i);if(a){let o=r.get(a[1].toLowerCase());if(o===void 0)return e;let h=k(Number(a[3]),o,Number(a[2]));return h?{date:h,partial:null}:e}if(a=i.match(/^(\d{1,2})\.?\s+([a-zÀ-ɏ]+)\.?\s+(\d{4})$/i),a){let o=r.get(a[2].toLowerCase());if(o===void 0)return e;let h=k(Number(a[3]),o,Number(a[1]));return h?{date:h,partial:null}:e}if(a=i.match(/^([a-zÀ-ɏ]+)\.?\s+(\d{4})$/i),a){let o=r.get(a[1].toLowerCase());if(o!==void 0)return{date:null,partial:{year:Number(a[2]),month:o}}}return e}function j(n){let t=new Map;if(!n)return t;for(let i of n.split(",")){let[e,s]=i.trim().split(":");e&&t.set(e,s||"")}return t}var N=class extends v{static formAssociated=!0;static get observedAttributes(){return["disabled","required"]}#a;#d=`dp${++U}`;#o=!1;#n;#t;#g;#v;#s;#y;#E;#f;#u=!1;#C=!1;#p="en-US";#c=null;#e=null;#i=new Date().getFullYear();#r=new Date().getMonth();#h=null;#l=null;#N=new Map;#S=new Map;#T;#x;#$=0;#O="";#F=!1;constructor(){super(),this.#a=this.attachInternals(),this._adoptInternals(this.#a)}setup(){let t=this.querySelector(':scope > input[type="date"]');if(!t)return!1;this.#n=t,this.#p=R(this.closest("[lang]")?.lang||navigator.language),this.#$=_(this.#p),this.#h=f(t.getAttribute("min")),this.#l=f(t.getAttribute("max")),this.#N=j(this.getAttribute("data-disabled-dates")),this.#S=j(this.getAttribute("data-highlight-dates"));let i=t.getAttribute("name");i&&(this.hasAttribute("name")||this.setAttribute("name",i),t.removeAttribute("name")),t.hasAttribute("disabled")&&(t.removeAttribute("disabled"),this.hasAttribute("disabled")||this.setAttribute("disabled",""));let e=`${this.#d}-no-form`,s=t.getAttribute("form");s&&s!==e&&!this.hasAttribute("form")&&this.setAttribute("form",s),t.setAttribute("form",e),this.#T===void 0&&(this.#T=t.defaultValue),this.#x!==void 0&&(t.value=this.#x,this.#x=void 0),this.#c=f(t.value);let r=new Date;return this.#l&&r>this.#l&&(r=this.#l),this.#h&&r<this.#h&&(r=this.#h),this.#e=this.#c||r,this.#i=this.#e.getFullYear(),this.#r=this.#e.getMonth(),t.setAttribute("tabindex","-1"),t.setAttribute("aria-hidden","true"),t.style.cssText="position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;overflow:hidden;",this.listen(t,"click",this.#G),this.listen(t,"focus",this.#Y),this.#X(),this.#Q(),this.#o=!0,this.#J(),this.#k(),this.#P(!1),this.#D(),this.#C=F,this.#C&&this.#s.setAttribute("popover","manual"),this.listen(document,"click",this.#it),this.listen(this,"invalid",this.#W),this.#I(this.matches(":disabled")),!0}teardown(){this.#u=!1,this.removeAttribute("open"),window.removeEventListener("scroll",this.#A,{capture:!0}),window.removeEventListener("resize",this.#A),this.#v?.remove(),this.#s?.remove(),this.#N=new Map,this.#S=new Map,this.#o=!1}attributeChangedCallback(t){this.#o&&(t==="disabled"&&this.#I(this.matches(":disabled")),t==="required"&&this.#D())}formDisabledCallback(t){this.#o&&this.#I(t)}#I(t){this.#t.disabled=t,this.#g.disabled=t,t&&this.#b()}#w(t,i){return this.dataset[`label${t}`]||i}#Y=()=>{this.#o&&!this.#t.disabled&&this.#t.focus()};#G=t=>{t.preventDefault(),this.#Y()};#J(){let t=new Set([...Array.from(this.#n.labels||[]),...Array.from(this.#a.labels||[])]),i=[];for(let a of t)a.id||(a.id=`${this.#d}-label-${i.length}`),i.push(a.id),this.listen(a,"click",this.#Y);let e=this.#t,s=i.join(" ")||this.#n.getAttribute("aria-labelledby")||this.getAttribute("aria-labelledby");s?e.setAttribute("aria-labelledby",s):e.setAttribute("aria-label",this.#n.getAttribute("aria-label")||this.getAttribute("aria-label")||this.#w("Input","Date"));let r=this.#n.getAttribute("aria-describedby");r&&e.setAttribute("aria-describedby",r)}#X(){this.#v=document.createElement("div"),this.#v.className="date-trigger",this.#t=document.createElement("input"),this.#t.type="text",this.#t.className="date-input",this.#t.setAttribute("role","combobox"),this.#t.setAttribute("aria-haspopup","dialog"),this.#t.setAttribute("aria-expanded","false"),this.#t.setAttribute("autocomplete","off"),this.#t.setAttribute("placeholder",this.#w("Placeholder","Type a date\u2026")),this.#v.appendChild(this.#t),this.#g=document.createElement("button"),this.#g.type="button",this.#g.className="date-trigger-icon",this.#g.setAttribute("aria-label",this.#w("Toggle","Toggle calendar")),this.#g.setAttribute("tabindex","-1");let t=document.createElement("icon-wc");t.setAttribute("name","calendar"),t.setAttribute("size","sm"),t.setAttribute("aria-hidden","true"),this.#g.appendChild(t),this.#v.appendChild(this.#g),this.appendChild(this.#v),this.listen(this.#g,"click",i=>{i.stopPropagation(),this.#u?this.#b():this.#q(),this.#t.focus()}),this.listen(this.#t,"focus",()=>this.#t.select()),this.listen(this.#t,"input",this.#Z),this.listen(this.#t,"keydown",this.#tt),this.listen(this.#t,"blur",this.#et)}#Q(){let t=`${this.#d}-calendar`;this.#s=document.createElement("div"),this.#s.className="calendar",this.#s.id=t,this.#s.setAttribute("role","dialog"),this.#s.setAttribute("aria-modal","false"),this.#s.setAttribute("aria-label",this.#w("Dialog","Choose date")),this.#s.hidden=!0,this.#t.setAttribute("aria-controls",t);let i=document.createElement("div");i.className="calendar-header";let e=document.createElement("button");e.type="button",e.className="calendar-nav",e.setAttribute("aria-label",this.#w("Prev","Previous month"));let s=document.createElement("icon-wc");s.setAttribute("name","chevron-left"),s.setAttribute("size","sm"),s.setAttribute("aria-hidden","true"),e.appendChild(s);let r=document.createElement("span");r.className="calendar-title",r.id=`${t}-title`,r.setAttribute("aria-live","polite"),this.#E=document.createElement("span"),this.#E.className="calendar-month",this.#f=document.createElement("select"),this.#f.className="calendar-year",this.#f.setAttribute("aria-label",this.#w("Year","Year")),this.#U(),r.appendChild(this.#E),r.appendChild(this.#f);let a=document.createElement("button");a.type="button",a.className="calendar-nav",a.setAttribute("aria-label",this.#w("Next","Next month"));let o=document.createElement("icon-wc");o.setAttribute("name","chevron-right"),o.setAttribute("size","sm"),o.setAttribute("aria-hidden","true"),a.appendChild(o),i.appendChild(e),i.appendChild(r),i.appendChild(a),this.#s.appendChild(i);let h=document.createElement("table");h.setAttribute("role","grid"),h.setAttribute("aria-labelledby",`${t}-title`);let d=q(this.#p,"short"),u=q(this.#p,"long"),l=document.createElement("thead"),b=document.createElement("tr");for(let p=0;p<7;p++){let y=(this.#$+p)%7,w=document.createElement("th");w.setAttribute("abbr",u[y]),w.setAttribute("scope","col"),w.textContent=d[y],b.appendChild(w)}l.appendChild(b),h.appendChild(l),this.#y=document.createElement("tbody"),h.appendChild(this.#y),this.#s.appendChild(h),this.appendChild(this.#s),this.#m(),this.listen(e,"click",()=>this.#_(-1)),this.listen(a,"click",()=>this.#_(1)),this.listen(this.#f,"change",()=>{this.#i=Number(this.#f.value);let p=g(this.#i,this.#r),y=Math.min(this.#e?.getDate()??1,p);this.#e=new Date(this.#i,this.#r,y),this.#m()}),this.listen(this.#y,"click",this.#st),this.listen(this.#s,"keydown",this.#nt)}#m(){try{this.#E.textContent=new Intl.DateTimeFormat(this.#p,{month:"long"}).format(new Date(this.#i,this.#r,1))}catch{this.#E.textContent=M[this.#r].charAt(0).toUpperCase()+M[this.#r].slice(1)}this.#f.querySelector(`option[value="${this.#i}"]`)||this.#U(),this.#f.value=String(this.#i),this.#y.replaceChildren();let t=g(this.#i,this.#r),e=(new Date(this.#i,this.#r,1).getDay()-this.#$+7)%7,s=new Date,r=document.createElement("tr");for(let o=0;o<e;o++)r.appendChild(document.createElement("td"));for(let o=1;o<=t;o++){let h=new Date(this.#i,this.#r,o),d=c(h),u=document.createElement("td"),l=document.createElement("button");l.type="button",l.setAttribute("data-date",d),l.textContent=String(o),E(h,s)&&l.setAttribute("aria-current","date");let b=E(h,this.#c);u.setAttribute("aria-selected",String(b));let p=this.#B(h,d);p.disabled&&(l.setAttribute("aria-disabled","true"),p.reason&&l.setAttribute("data-disabled-reason",p.reason)),this.#S.has(d)&&l.setAttribute("data-highlight",this.#S.get(d)||""),E(h,this.#e)?(l.setAttribute("tabindex","0"),b||l.setAttribute("data-focused","")):l.setAttribute("tabindex","-1"),u.appendChild(l),r.appendChild(u),(e+o)%7===0&&(this.#y.appendChild(r),r=document.createElement("tr"))}let a=(e+t)%7;if(a>0){for(let o=a;o<7;o++)r.appendChild(document.createElement("td"));this.#y.appendChild(r)}}#L(t){return this.#B(t,c(t)).disabled}#B(t,i){return this.#N.has(i)?{disabled:!0,reason:this.#N.get(i)}:this.#h&&t<this.#h?{disabled:!0,reason:null}:this.#l&&t>this.#l?{disabled:!0,reason:null}:{disabled:!1,reason:null}}#U(){this.#f.replaceChildren();let t=new Date().getFullYear(),i=this.#h?this.#h.getFullYear():t-100,e=this.#l?this.#l.getFullYear():t+10;i=Math.min(i,this.#i),e=Math.max(e,this.#i);for(let s=i;s<=e;s++){let r=document.createElement("option");r.value=String(s),r.textContent=String(s),this.#f.appendChild(r)}}#_(t){let i=this.#e??new Date(this.#i,this.#r,1),e=new Date(this.#i,this.#r,Math.min(i.getDate(),g(this.#i,this.#r)));this.#e=A(e,t),this.#i=this.#e.getFullYear(),this.#r=this.#e.getMonth(),this.#m(),this.#R(this.#e)}#M(t,i){if(t&&this.#L(t))return!1;let e=this.value,s=t?c(t):"";return this.#c=t,t&&(this.#e=t),this.#k(),s===e?!1:(this.#P(),this.#D(),t&&i==="api"&&(this.#i=t.getFullYear(),this.#r=t.getMonth()),(this.#u||i==="api")&&this.#m(),this.dispatchEvent(new CustomEvent("date-picker:change",{bubbles:!0,detail:{value:s,date:t?new Date(t):null,source:i}})),!0)}#V(t,i){this.#L(t)||(this.#M(t,i),this.#b(),this.#t.focus())}#R(t){let i=this.#y.querySelector(`[data-date="${c(t)}"]`);if(i){for(let e of this.#y.querySelectorAll("button[data-date]"))e.setAttribute("tabindex",e===i?"0":"-1"),e!==i&&e.removeAttribute("data-focused");i.closest("td")?.getAttribute("aria-selected")!=="true"&&i.setAttribute("data-focused",""),i.focus()}}#k(){this.#t.value=this.#c?P(this.#c,this.#p):""}#q(){if(!(this.#u||this.#t.disabled)){if(this.#u=!0,this.setAttribute("open",""),this.#t.setAttribute("aria-expanded","true"),this.#s.hidden=!1,this.#e&&(this.#i=this.#e.getFullYear(),this.#r=this.#e.getMonth()),this.#m(),this.#C){try{this.#s.showPopover()}catch{}this.#z(),window.addEventListener("scroll",this.#A,{capture:!0,passive:!0}),window.addEventListener("resize",this.#A,{passive:!0})}this.dispatchEvent(new CustomEvent("date-picker:open",{bubbles:!0}))}}#b(){if(this.#u){if(this.#u=!1,this.removeAttribute("open"),this.#t.setAttribute("aria-expanded","false"),this.#s.hidden=!0,this.#C){try{this.#s.hidePopover()}catch{}window.removeEventListener("scroll",this.#A,{capture:!0}),window.removeEventListener("resize",this.#A)}this.dispatchEvent(new CustomEvent("date-picker:close",{bubbles:!0}))}}#z(){if(!this.#C)return;let t=this.#v.getBoundingClientRect(),i=this.#s.getBoundingClientRect(),e=4,s=8,r=window.innerHeight,a=window.innerWidth,o=r-t.bottom-s,h=t.top-s,d;o<i.height&&h>o?(d=t.top-i.height-e,this.#s.dataset.placement="top"):(d=t.bottom+e,delete this.#s.dataset.placement);let u=t.left;u+i.width>a-s&&(u=a-i.width-s),u<s&&(u=s),this.#s.style.setProperty("--calendar-top",`${d}px`),this.#s.style.setProperty("--calendar-left",`${u}px`)}#A=()=>{this.#u&&this.#z()};#Z=()=>{let t=this.#t.value,{date:i,partial:e}=x(t,this.#p);if(i)this.#e=i,this.#i=i.getFullYear(),this.#r=i.getMonth(),this.#m();else if(e){this.#i=e.year,this.#r=e.month;let s=g(e.year,e.month),r=Math.min(this.#e?.getDate()??1,s);this.#e=new Date(e.year,e.month,r),this.#m()}!this.#u&&t.length>0&&this.#q()};#tt=t=>{switch(t.key){case"Enter":{t.preventDefault(),t.stopPropagation();let i=this.#t.value.trim();if(!i){this.#M(null,"keyboard"),this.#b();return}let{date:e}=x(i,this.#p);e&&!this.#L(e)&&this.#V(e,"keyboard");return}case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.#u||this.#q(),requestAnimationFrame(()=>{this.#e&&this.#R(this.#e)});return;case"Escape":t.preventDefault(),t.stopPropagation(),this.#u&&this.#b(),this.#k();return;case"Tab":this.#u&&this.#b();return}};#et=t=>{if(t.relatedTarget instanceof Node&&this.contains(t.relatedTarget))return;let i=this.#t.value.trim();if(!i)this.#M(null,"keyboard");else{let{date:e}=x(i,this.#p);e&&!this.#L(e)&&this.#M(e,"keyboard")}this.#k(),this.#u&&this.#b(),this.#W()};#W=()=>{this.#o&&(this.#F||(this.#F=!0,this.#D()),this.#n.dispatchEvent(new Event("blur",{bubbles:!0})))};#it=t=>{this.#u&&!this.contains(t.target)&&this.#b()};#st=t=>{let e=t.target?.closest("button[data-date]");if(!e||e.getAttribute("aria-disabled")==="true")return;let s=f(e.getAttribute("data-date"));s&&this.#V(s,"pointer")};#nt=t=>{if(t.key==="Tab"){this.#b();return}let i=t.target instanceof Element&&this.#y.contains(t.target),e=this.#e;if(!e)return;let s,r=(e.getDay()-this.#$+7)%7;switch(t.key){case"ArrowRight":s=new Date(e.getFullYear(),e.getMonth(),e.getDate()+1);break;case"ArrowLeft":s=new Date(e.getFullYear(),e.getMonth(),e.getDate()-1);break;case"ArrowDown":s=new Date(e.getFullYear(),e.getMonth(),e.getDate()+7);break;case"ArrowUp":s=new Date(e.getFullYear(),e.getMonth(),e.getDate()-7);break;case"PageDown":s=A(e,t.shiftKey?12:1);break;case"PageUp":s=A(e,t.shiftKey?-12:-1);break;case"Home":s=new Date(e.getFullYear(),e.getMonth(),e.getDate()-r);break;case"End":s=new Date(e.getFullYear(),e.getMonth(),e.getDate()+(6-r));break;case"Enter":case" ":if(!i)return;t.preventDefault(),t.stopPropagation(),this.#V(e,"keyboard");return;case"Escape":t.preventDefault(),t.stopPropagation(),this.#b(),this.#t.focus();return;default:return}i&&(t.preventDefault(),t.stopPropagation(),this.#h&&s<this.#h&&(s=this.#h),this.#l&&s>this.#l&&(s=this.#l),this.#e=s,(s.getMonth()!==this.#r||s.getFullYear()!==this.#i)&&(this.#r=s.getMonth(),this.#i=s.getFullYear(),this.#m()),this.#R(s))};#P(t=!0){let i=this.#c?c(this.#c):"";this.#a.setFormValue(i||null),this.#n.value=i,t&&this.#n.dispatchEvent(new Event("input",{bubbles:!0}))}#j(t,i,e,s=null){let r=this.#n.getAttribute(`data-message-${t.toLowerCase()}`)??this.#w(i,e);return s?r.replaceAll("{date}",P(s,this.#p)):r}#D(){if(!this.#o)return!1;let t=this.hasAttribute("required")||this.#n.hasAttribute("required");t?this.#t.setAttribute("aria-required","true"):this.#t.removeAttribute("aria-required");let i=this.#c,e={},s="";t&&!i?(e={valueMissing:!0},s=this.#j("valueMissing","Required","Please select a date")):i&&this.#h&&i<this.#h?(e={rangeUnderflow:!0},s=this.#j("rangeUnderflow","RangeUnderflow","Choose a date on or after {date}",this.#h)):i&&this.#l&&i>this.#l&&(e={rangeOverflow:!0},s=this.#j("rangeOverflow","RangeOverflow","Choose a date on or before {date}",this.#l));let r=this.#a.validationMessage;return s?this.#a.setValidity(e,s,this.#t):this.#a.setValidity({}),s&&(i||this.#F)?this.#t.setAttribute("aria-invalid","true"):this.#t.removeAttribute("aria-invalid"),(this.#n.validationMessage===this.#O||!this.#n.validity.customError)&&(this.#n.setCustomValidity(s),this.#O=s),r!==s}#K(){this.#o&&(this.#m(),this.#D()&&this.#n.dispatchEvent(new Event("input",{bubbles:!0})))}#H(t){let i=t||new Date;this.#c=t,this.#e=i,this.#i=i.getFullYear(),this.#r=i.getMonth(),this.#k(),this.#P(),this.#D(),this.#m()}formResetCallback(){this.#o&&(this.#F=!1,this.#H(f(this.#T)))}formStateRestoreCallback(t){!this.#o||typeof t!="string"||this.#H(f(t))}get form(){return this.#a.form}get validity(){return this.#a.validity}get validationMessage(){return this.#a.validationMessage}get willValidate(){return this.#a.willValidate}checkValidity(){return this.#a.checkValidity()}reportValidity(){return this.#a.reportValidity()}get value(){return this.#o?this.#c?c(this.#c):"":this.#x??""}set value(t){let i=t==null?"":String(t).trim(),e=i?f(i):null;if(!(i&&!e)){if(!this.#o){this.#x=i;return}this.#M(e,"api")}}get min(){return this.#h?c(this.#h):""}set min(t){this.#h=f(t),this.#n&&(this.#h?this.#n.setAttribute("min",c(this.#h)):this.#n.removeAttribute("min")),this.#K()}get max(){return this.#l?c(this.#l):""}set max(t){this.#l=f(t),this.#n&&(this.#l?this.#n.setAttribute("max",c(this.#l)):this.#n.removeAttribute("max")),this.#K()}};$("date-picker",N);export{N as DatePicker};
2
2
  //# sourceMappingURL=date-picker.js.map
@@ -1,2 +1,2 @@
1
- var b=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,t,s){e.addEventListener(n,t,s),this.#t.push(()=>e.removeEventListener(n,t,s))}setup(){}teardown(){}setState(e,n){this.#e||(this.#e=this.attachInternals());let t=this.#e.states;try{n?t.add(e):t.delete(e)}catch{let s=`--${e}`;n?t.add(s):t.delete(s)}}_adoptInternals(e){this.#e||(this.#e=e)}};var q=window.matchMedia("(prefers-reduced-motion: reduce)");var w=new Map;function x(h,e,n={}){let t=n.priority??10,s={impl:e,bundle:n.bundle,contract:n.contract,priority:t},r=w.get(h);if(customElements.get(h)){if(!r||r.priority>=t){r&&r.priority===t&&r.impl!==e&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${h}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=t){r.priority===t&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${r.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}w.set(h,s),customElements.define(h,e)}var v=class extends b{#t=null;setup(){if(this.#t=this.querySelector("ol"),!this.#t&&this.dataset.startHour==="auto"&&this.#e(),!this.#t)return!1;let e=this.#t;this.#n(),this.listen(e,"click",t=>{let r=t.target?.closest("calendar-event");r&&this.dispatchEvent(new CustomEvent("day-view:event-click",{bubbles:!0,detail:{time:r.querySelector("time[datetime]")?.getAttribute("datetime"),text:r.textContent?.trim()??"",element:r,category:r.dataset.category,duration:r.dataset.duration}}))}),this.listen(e,"keydown",t=>{let s=t,p=s.target?.closest("calendar-event");if(!p)return;let i=[...e.querySelectorAll("calendar-event")],a=i.indexOf(p);if(a===-1)return;let c;s.key==="ArrowDown"&&a<i.length-1&&(c=i[a+1]),s.key==="ArrowUp"&&a>0&&(c=i[a-1]),c&&(s.preventDefault(),c.setAttribute("tabindex","0"),p.setAttribute("tabindex","-1"),c.focus())});let n=e.querySelector("calendar-event");return n&&n.setAttribute("tabindex","0"),!0}#e(){let e=[...this.querySelectorAll(":scope > calendar-event")];if(e.length===0)return;let n=new Map,t=[];if(e.forEach(d=>{let o=d,l=o.querySelector("time[datetime]");if(!l){t.push(o);return}let g=l.getAttribute("datetime");if(!g){t.push(o);return}let f=g.split(":"),u=parseInt(f[0],10),m=parseInt(f[1]||"0",10);if(isNaN(u)){t.push(o);return}m>=30&&!o.dataset.start&&(o.dataset.start="30"),n.has(u)||n.set(u,[]),n.get(u).push(o)}),t.length>0){let d=document.createElement("ul");d.className="all-day-events",t.forEach(o=>{let l=document.createElement("li");l.appendChild(o),d.appendChild(l)}),this.prepend(d)}let s=[...n.keys()].sort((d,o)=>d-o);if(s.length===0)return;let r=Math.max(0,s[0]-1),p=Math.min(23,s[s.length-1]+1),i=this.closest("[lang]")?.lang||navigator.language,a=new Intl.DateTimeFormat(i,{hour:"numeric"}),c=document.createElement("ol");for(let d=r;d<=p;d++){let o=document.createElement("li"),l=document.createElement("time"),g=String(d).padStart(2,"0");l.setAttribute("datetime",`${g}:00`),l.textContent=a.format(new Date(2026,0,1,d));let f=document.createElement("hour-view"),u=n.get(d)||[];u.length>1&&(f.dataset.overlap=""),u.forEach(m=>f.appendChild(m)),o.append(l,f),c.appendChild(o)}this.appendChild(c),this.#t=c}teardown(){this.querySelectorAll("calendar-event.dv-spanning").forEach(e=>{e.style.cssText="",e.classList.remove("dv-spanning")})}refresh(){this.teardown(),this.#n()}get events(){return[...this.querySelectorAll("calendar-event")].map(e=>{let n=e;return{time:n.querySelector("time[datetime]")?.getAttribute("datetime")||void 0,text:n.textContent?.trim()??"",category:n.dataset.category||void 0,duration:n.dataset.duration||void 0,href:n.querySelector("a[href]")?.getAttribute("href")||void 0}})}set events(e){let n=Array.isArray(e)?e:[];for(;this.firstChild;)this.firstChild.remove();this.dataset.startHour="auto";for(let t of n){let s=document.createElement("calendar-event");if(t.category&&(s.dataset.category=t.category),t.duration&&(s.dataset.duration=String(t.duration)),t.time){let r=document.createElement("time");r.setAttribute("datetime",t.time),r.textContent=t.time,s.appendChild(r),s.appendChild(document.createTextNode(" "))}if(t.href){let r=document.createElement("a");r.href=t.href,r.textContent=t.text||"",s.appendChild(r)}else s.appendChild(document.createTextNode(t.text||""));this.appendChild(s)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("day-view:events-changed",{detail:{events:n,source:"property"},bubbles:!0}))}#n(){let e=this.#t;if(!e)return;let n=e.querySelectorAll("calendar-event[data-duration]");n.length!==0&&requestAnimationFrame(()=>{let t=e.getBoundingClientRect(),s=new Map,r=64;e.querySelectorAll(":scope > li").forEach(i=>{let a=i.querySelector(":scope > time");if(!a)return;let c=a.getAttribute("datetime");if(!c)return;let d=parseInt(c.split(":")[0],10),o=i.getBoundingClientRect();s.set(d,{top:o.top-t.top,height:o.height}),r=a.getBoundingClientRect().width});let p=[];n.forEach(i=>{let a=i,c=a.closest("ol > li");if(!c)return;let o=c.querySelector(":scope > time")?.getAttribute("datetime");if(!o)return;let l=parseInt(o.split(":")[0],10),g=parseInt(a.dataset.start||"0",10),f=a.dataset.duration??"",u=60,m=f.match(/(\d+)h/),E=f.match(/(\d+)m/);(m||E)&&(u=(m?parseInt(m[1],10)*60:0)+(E?parseInt(E[1],10):0));let y=s.get(l);if(!y)return;let A=g/60,C=y.top+y.height*A,S=y.height*(u/60);p.push({event:a,top:C,height:S})}),p.forEach(({event:i,top:a,height:c})=>{i.style.position="absolute",i.style.top=a+"px",i.style.height=c+"px",i.style.left=r+4+"px",i.style.right="4px",i.classList.add("dv-spanning")})})}};x("day-view",v);export{v as DayView};
1
+ var A=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,s){t.addEventListener(e,n,s),this.#e.push(()=>t.removeEventListener(e,n,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{e?n.add(t):n.delete(t)}catch{let s=`--${t}`;e?n.add(s):n.delete(s)}}_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 P=window.matchMedia("(prefers-reduced-motion: reduce)");var N=new Map;function T(o,t,e={}){let n=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:n},r=N.get(o);if(customElements.get(o)){if(!r||r.priority>=n){r&&r.priority===n&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=n){r.priority===n&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}N.set(o,s),customElements.define(o,t)}function L(o,t="en-US"){try{if(o)return Intl.getCanonicalLocales(o),o}catch{}try{return Intl.getCanonicalLocales(t),t}catch{return"en-US"}}function E(o){if(!o)return null;let t=/(?:^|T|\s)(\d{1,2}):(\d{2})/.exec(String(o).trim());if(!t)return null;let e=Math.min(23,Math.max(0,parseInt(t[1],10))),n=Math.min(59,Math.max(0,parseInt(t[2],10)));return{hour:e,minute:n}}var $=60,v="(\\d+(?:\\.\\d+)?)",D=new RegExp(`^PT(?:${v}H)?(?:${v}M)?(?:${v}S)?$`,"i"),H=new RegExp(`^(?:${v}\\s*h(?:ours?|rs?)?)?\\s*(?:${v}\\s*m(?:in(?:utes?|s)?)?)?$`,"i"),I=new RegExp(`^${v}$`);function k(o){if(o==null)return null;let t=String(o).trim();if(!t)return null;let e=null,n;return(n=I.exec(t))?e=parseFloat(n[1]):(n=D.exec(t))&&(n[1]||n[2]||n[3])?e=(n[1]?parseFloat(n[1])*60:0)+(n[2]?parseFloat(n[2]):0)+(n[3]?parseFloat(n[3])/60:0):(n=H.exec(t))&&(n[1]||n[2])&&(e=(n[1]?parseFloat(n[1])*60:0)+(n[2]?parseFloat(n[2]):0)),e===null||!Number.isFinite(e)?null:(e=Math.round(e),e>0?e:null)}function S(o){let t=[...o].sort((l,u)=>l.start-u.start||u.end-l.end),e=[],n=[],s=[],r=-1/0,a=()=>{for(let l of n)l.columns=s.length;n=[],s=[]};for(let l of t){l.start>=r&&(a(),r=-1/0);let u=s.findIndex(b=>b<=l.start);u===-1?(u=s.length,s.push(l.end)):s[u]=l.end;let y={...l,column:u,columns:1};n.push(y),e.push(y),r=Math.max(r,l.end)}return a(),e}function q(o){let t=o.filter(e=>!e.dataset.duration).map(e=>{let n=e.dataset.start==="30"?30:0;return{start:n,end:n+30}});return S(t).some(e=>e.columns>1)}function F(o){let t=o.cloneNode(!0);return t.querySelectorAll('details, time[datetime^="PT"]').forEach(e=>e.remove()),(t.textContent||"").replace(/\s+/g," ").trim()}var R=["position","top","height","inset-inline-start","inset-inline-end"];var O=7,U=19,B=["ArrowDown","ArrowUp","Home","End"];function _(o,t){let e=parseInt(o??"",10);return Number.isNaN(e)?t:Math.min(23,Math.max(0,e))}var w=new WeakMap,M=class extends A{#e=null;#t=0;#n=null;setup(){return this.#e=this.querySelector(":scope > ol"),!this.#e&&this.querySelector(":scope > calendar-event")&&this.#h(),!this.#e&&!this.querySelector(":scope > .all-day-events")?!1:(this.#u(),this.#d(),this.listen(this,"click",t=>{let e=this.#i(t.target);e&&this.#o(e)}),this.listen(this,"keydown",t=>{let e=t,n=this.#i(e.target);if(!n)return;if((e.key==="Enter"||e.key===" ")&&e.target===n){e.preventDefault(),this.#o(n);return}if(!B.includes(e.key))return;let s=this.#r(),r=s.indexOf(n);if(r===-1)return;let a;e.key==="ArrowDown"?a=s[r+1]:e.key==="ArrowUp"?a=s[r-1]:e.key==="Home"?a=s[0]:e.key==="End"&&(a=s[s.length-1]),a&&a!==n&&(e.preventDefault(),n.setAttribute("tabindex","-1"),a.setAttribute("tabindex","0"),a.focus())}),this.#e&&(typeof ResizeObserver<"u"&&(this.#n=new ResizeObserver(()=>this.#a()),this.#n.observe(this.#e)),this.#a()),!0)}teardown(){this.#t&&cancelAnimationFrame(this.#t),this.#t=0,this.#n?.disconnect(),this.#n=null,this.#l()}refresh(){this.#t&&cancelAnimationFrame(this.#t),this.#t=0,this.#c()}get events(){return this.#r().map(t=>({time:t.querySelector("time[datetime]")?.getAttribute("datetime")||void 0,text:t.textContent?.trim()??"",category:t.dataset.category||void 0,duration:t.dataset.duration||void 0,href:t.querySelector("a[href]")?.getAttribute("href")||void 0}))}set events(t){let e=Array.isArray(t)?t:[];for(;this.firstChild;)this.firstChild.remove();this.dataset.startHour="auto";let n=new Intl.DateTimeFormat(this.#s(),{hour:"numeric",minute:"2-digit"});for(let s of e){let r=document.createElement("calendar-event");if(s.category&&(r.dataset.category=s.category),s.duration&&(r.dataset.duration=String(s.duration)),s.time){let a=document.createElement("time");a.setAttribute("datetime",s.time);let l=E(s.time);a.textContent=l?n.format(new Date(2026,0,1,l.hour,l.minute)):s.time,r.appendChild(a),r.appendChild(document.createTextNode(" "))}if(s.href){let a=document.createElement("a");a.href=s.href,a.textContent=s.text||"",r.appendChild(a)}else r.appendChild(document.createTextNode(s.text||""));this.appendChild(r)}this._reinit(),this.dispatchEvent(new CustomEvent("day-view:events-changed",{detail:{events:e,source:"property"},bubbles:!0}))}#s(){return L(this.closest("[lang]")?.lang||navigator.language)}#r(){return[...this.querySelectorAll("calendar-event")].filter(t=>t.closest("day-view")===this)}#i(t){let n=(t instanceof Element?t:null)?.closest("calendar-event")??null;return n&&n.closest("day-view")===this?n:null}#o(t){this.dispatchEvent(new CustomEvent("day-view:event-click",{bubbles:!0,detail:{date:this.dataset.date,time:t.querySelector("time[datetime]")?.getAttribute("datetime"),text:t.textContent?.trim()??"",element:t,category:t.dataset.category,duration:t.dataset.duration}}))}#u(){let t=this.#e,e=this.dataset.date;if(!t||!e||t.hasAttribute("aria-label")&&!w.has(t))return;let n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!n)return;let s=new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));if(Number.isNaN(s.getTime()))return;let r=new Intl.DateTimeFormat(this.#s(),{dateStyle:"full"}).format(s);w.set(t,r),t.setAttribute("aria-label",r)}#d(){let t=this.#r(),e=t.find(s=>s.getAttribute("tabindex")==="0");for(let s of t){if(s.hasAttribute("role")||s.setAttribute("role","group"),!s.hasAttribute("aria-label")||w.has(s)){let r=F(s);w.set(s,r),s.setAttribute("aria-label",r)}s.setAttribute("tabindex","-1")}let n=e??t[0];n&&n.setAttribute("tabindex","0")}#h(){let t=[...this.querySelectorAll(":scope > calendar-event")];if(t.length===0)return;let e=new Map,n=[];for(let c of t){let f=E(c.querySelector("time[datetime]")?.getAttribute("datetime"));if(!f){n.push(c);continue}f.minute>=30&&!c.dataset.start&&(c.dataset.start="30");let i=e.get(f.hour)??[];i.push(c),e.set(f.hour,i)}if(n.length>0){let c=this.querySelector(":scope > .all-day-events");c||(c=document.createElement("ul"),c.className="all-day-events",this.prepend(c));for(let f of n){let i=document.createElement("li");i.appendChild(f),c.appendChild(i)}}let s=[...e.keys()].sort((c,f)=>c-f),r=s[0],a=s[s.length-1],l,u;if(this.dataset.startHour==="auto"){if(s.length===0)return;l=Math.max(0,r-1),u=Math.min(23,a+1)}else l=_(this.dataset.startHour,O),u=Math.max(l,_(this.dataset.endHour,U)),s.length>0&&(l=Math.min(l,r),u=Math.max(u,a));let y=new Intl.DateTimeFormat(this.#s(),{hour:"numeric"}),b=document.createElement("ol");for(let c=l;c<=u;c++){let f=document.createElement("li"),i=document.createElement("time");i.setAttribute("datetime",`${String(c).padStart(2,"0")}:00`),i.textContent=y.format(new Date(2026,0,1,c));let h=document.createElement("hour-view"),d=e.get(c)||[];q(d)&&(h.dataset.overlap=""),d.forEach(m=>h.appendChild(m)),f.append(i,h),b.appendChild(f)}this.appendChild(b),this.#e=b}#a(){this.#t||(this.#t=requestAnimationFrame(()=>{this.#t=0,this.#c()}))}#l(){this.querySelectorAll("calendar-event.dv-spanning").forEach(t=>{let e=t;for(let s of R)e.style.removeProperty(s);e.classList.remove("dv-spanning"),e.removeAttribute("data-continues");let n=w.get(e);n!==void 0&&e.setAttribute("aria-label",n)})}#c(){let t=this.#e;if(this.#l(),!t||!t.isConnected)return;let e=[...t.querySelectorAll("calendar-event[data-duration]")];if(e.length===0)return;let n=t.getBoundingClientRect(),s=new Map,r=64,a=-1,l=0;if(t.querySelectorAll(":scope > li").forEach(i=>{let h=i.querySelector(":scope > time"),d=E(h?.getAttribute("datetime"));if(!h||!d)return;let m=i.getBoundingClientRect(),g=m.top-n.top;s.set(d.hour,{top:g,height:m.height}),d.hour>a&&(a=d.hour,l=g+m.height),r=h.getBoundingClientRect().width}),s.size===0)return;let u=(a+1)*60,y=i=>{let h=s.get(Math.floor(i/60));return h?h.top+h.height*(i%60/60):null},b=[];for(let i of e){let h=i.closest("ol > li"),d=E(h?.querySelector(":scope > time")?.getAttribute("datetime"));if(!d||!s.has(d.hour))continue;let m=E(i.querySelector("time[datetime]")?.getAttribute("datetime")),g=i.dataset.start?parseInt(i.dataset.start,10)||0:m&&m.hour===d.hour?m.minute:0,x=d.hour*60+Math.min(59,Math.max(0,g)),p=k(i.dataset.duration)??$;b.push({event:i,start:x,end:x+p})}let c=Math.max(0,n.width-r-8),f=this.dataset.labelContinues||"continues after the visible hours";for(let i of S(b)){let h=s.get(Math.floor(i.start/60)),d=y(i.start),m=i.end>u,g=m||i.end===u?l:y(i.end);g===null&&(g=d+h.height*((i.end-i.start)/60));let x=c/i.columns,{event:p}=i;if(p.style.position="absolute",p.style.top=`${d}px`,p.style.height=`${Math.max(g-d,1)}px`,p.style.insetInlineStart=`${r+4+i.column*x}px`,p.style.insetInlineEnd=`${4+(i.columns-1-i.column)*x}px`,p.classList.add("dv-spanning"),m){p.setAttribute("data-continues","");let C=w.get(p);C!==void 0&&p.setAttribute("aria-label",`${C}, ${f}`)}}}};T("day-view",M);export{M as DayView};
2
2
  //# sourceMappingURL=day-view.js.map
@@ -1,3 +1,3 @@
1
- var B=window.matchMedia("(prefers-reduced-motion: reduce)");var w=new Map;function C(i,t,e={}){let o=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:o},r=w.get(i);if(customElements.get(i)){if(!r||r.priority>=o){r&&r.priority===o&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${i}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=o){r.priority===o&&console.warn(`[VB Bundle] Tag <${i}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}w.set(i,s),customElements.define(i,t)}var g=class extends HTMLElement{#c=[];#r;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.#c)t();this.#c=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,o,s){t.addEventListener(e,o,s),this.#c.push(()=>t.removeEventListener(e,o,s))}setup(){}teardown(){}setState(t,e){this.#r||(this.#r=this.attachInternals());let o=this.#r.states;try{e?o.add(t):o.delete(t)}catch{let s=`--${t}`;e?o.add(s):o.delete(s)}}_adoptInternals(t){this.#r||(this.#r=t)}};function n(i,t,e){return i.getPropertyValue(t).trim()||e}function d(i,t){if(!t)return t;let e=document.createElement("span");e.style.color=t,e.style.position="absolute",e.style.visibility="hidden",e.style.pointerEvents="none",(i.parentElement||document.body).appendChild(e);let o=getComputedStyle(e).color;if(e.remove(),!o)return t;let s=d,r=s._canvas||(s._canvas=document.createElement("canvas"));r.width=r.height=1;let l=s._ctx||(s._ctx=r.getContext("2d",{willReadFrequently:!0}));l.clearRect(0,0,1,1),l.fillStyle=o,l.fillRect(0,0,1,1);let[a,u,f,m]=l.getImageData(0,0,1,1).data;return m===255?`rgb(${a},${u},${f})`:`rgba(${a},${u},${f},${(m/255).toFixed(3)})`}function S(i){let t=getComputedStyle(i),e=d(i,n(t,"--color-text","#1a1a1a")),o=d(i,n(t,"--color-surface","#ffffff")),s=d(i,n(t,"--color-surface-raised",n(t,"--color-surface","#ffffff"))),r=d(i,n(t,"--color-border","#e0e0e0")),l=d(i,n(t,"--color-primary",n(t,"--color-interactive","#3b82f6"))),a=d(i,n(t,"--color-secondary",n(t,"--color-surface-raised","#f8f9fa"))),u=d(i,n(t,"--color-accent",n(t,"--color-primary","#3b82f6"))),f=d(i,n(t,"--color-text-muted",n(t,"--color-text","#1a1a1a"))),m=n(t,"--font-sans",'system-ui, -apple-system, "Segoe UI", sans-serif'),x=n(t,"--font-size-m","14px"),p=[l,u,a],h={};for(let c=0;c<12;c++)h[`cScale${c}`]=p[c%p.length],h[`cScaleLabel${c}`]=e,h[`cScalePeer${c}`]=r,h[`cScaleInv${c}`]=o;let b={};for(let c=0;c<8;c++)b[`git${c}`]=p[c%p.length],b[`gitInv${c}`]=o,b[`gitBranchLabel${c}`]=e;return{primaryColor:l,primaryBorderColor:r,primaryTextColor:e,nodeTextColor:e,secondaryColor:a,secondaryBorderColor:r,secondaryTextColor:e,tertiaryColor:u,tertiaryBorderColor:r,tertiaryTextColor:e,background:o,mainBkg:o,secondBkg:s,tertiaryBkg:s,lineColor:r,nodeBorder:r,gridColor:r,defaultLinkColor:f,clusterBkg:s,clusterBorder:r,actorBkg:o,actorBorder:r,actorTextColor:e,actorLineColor:r,signalColor:e,signalTextColor:e,labelBoxBkgColor:s,labelBoxBorderColor:r,labelTextColor:e,loopTextColor:e,noteBkgColor:s,noteBorderColor:r,noteTextColor:e,edgeLabelBackground:o,titleColor:e,fontFamily:m,fontSize:x,...h,...b}}function v(i,t={}){return{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:t.themeBase||"base",themeVariables:S(i)}}var $="https://cdn.jsdelivr.net/npm/mermaid@11.14.0/dist/mermaid.esm.min.mjs",E=new Map;function T(i){let t=i||typeof window<"u"&&window.VB_MERMAID_URL||$,e=E.get(t);return e||(e=import(t).then(o=>o.default||o),E.set(t,e)),e}var y=class i extends g{static#c=0;static#r=0;#t=null;#i=null;#e=null;#o=null;#s=null;#n=!1;setup(){this.hasAttribute("type")||this.setAttribute("type","mermaid");let t=this.getAttribute("min-height");t&&(this.style.minBlockSize=t);let e=this.querySelector(":scope > pre");e&&(this.#i=document.createElement("template"),this.#i.appendChild(e.cloneNode(!0)),this.#t=this.#h(e),this.setAttribute("data-rendering",""));let o=this.querySelector(":scope > .dwc-figure");o&&(this.#e=o,this.#n=!0,this.removeAttribute("data-rendering")),this.listen(window,"vb:theme-change",()=>{this.#s&&clearTimeout(this.#s),this.#s=setTimeout(()=>{this.#n&&this.#a()},50)});let s=this.getAttribute("src");s?this.#f(s).then(()=>this.#d()):this.#t&&this.#d()}teardown(){if(this.#o&&(this.#o.disconnect(),this.#o=null),this.#s&&(clearTimeout(this.#s),this.#s=null),this.#e&&(this.#e.remove(),this.#e=null),this.#i){let t=this.#i.content.firstElementChild;t&&!this.querySelector(":scope > pre")&&this.appendChild(t.cloneNode(!0))}this.#n=!1}#d(){if(this.getAttribute("loading")!=="lazy"){this.#a();return}if(!("IntersectionObserver"in window)){this.#a();return}this.#o=new IntersectionObserver(t=>{for(let e of t)if(e.isIntersecting){this.#o?.disconnect(),this.#o=null,this.#a();break}},{rootMargin:"200px"}),this.#o.observe(this)}async#a(){if(!this.#t)return;let t=this.getAttribute("type")||"mermaid";if(t!=="mermaid"){this.#l(new Error(`Unsupported diagram type "${t}". v1 supports "mermaid" only.`));return}try{let e=await T(this.dataset.mermaidSrc),o=v(this,{themeBase:this.dataset.themeBase||"base"});e.initialize(o);let s=`diagram-wc-${++i.#c}`,{svg:r}=await e.render(s,this.#t);this.#u(r),this.#n=!0,this.removeAttribute("data-rendering"),this.removeAttribute("data-error"),this.querySelector(":scope > .dwc-error")?.remove(),this.dispatchEvent(new CustomEvent("diagram-wc:ready",{bubbles:!0,detail:{svg:r,type:t,source:this.#t}}))}catch(e){this.removeAttribute("data-rendering"),this.#n||this.setAttribute("data-error",""),this.#l(e)}}#u(t){let e=document.createElement("figure");e.className="dwc-figure",e.setAttribute("role","img");let o=this.getAttribute("caption")||`${this.getAttribute("type")||"diagram"} diagram`;e.setAttribute("aria-label",o),e.innerHTML=t;let s=this.getAttribute("caption");if(s){let a=document.createElement("figcaption");a.className="dwc-caption",a.textContent=s,e.appendChild(a)}let r=this.#e,l=()=>{r&&r.isConnected?r.replaceWith(e):this.appendChild(e),this.querySelector(":scope > pre")?.remove(),this.#e=e};if(r?.isConnected&&"startViewTransition"in document&&!matchMedia("(prefers-reduced-motion: reduce)").matches){let a=`dwc-vt-${++i.#r}`;r.style.viewTransitionName=a,e.style.viewTransitionName=a,document.startViewTransition(l).finished.finally(()=>{e.style.viewTransitionName=""})}else l()}#l(t){if(!this.#n){if(!this.querySelector(":scope > pre")&&this.#i){let s=this.#i.content.firstElementChild;s&&this.appendChild(s.cloneNode(!0))}this.#e&&(this.#e.remove(),this.#e=null)}this.querySelector(":scope > .dwc-error")?.remove();let e=document.createElement("p");e.className="dwc-error",e.setAttribute("role","status");let o=(t.message||String(t)).split(`
2
- `)[0].slice(0,240);e.textContent=`Diagram syntax error: ${o}`,this.appendChild(e),this.dispatchEvent(new CustomEvent("diagram-wc:error",{bubbles:!0,detail:{error:t,source:this.#t,type:this.getAttribute("type")}}))}#h(t){let e=t.querySelector("code");return(e?e.textContent:t.textContent)||""}async#f(t){try{let e=await fetch(t);if(!e.ok)throw new Error(`HTTP ${e.status}`);this.#t=await e.text()}catch(e){this.#l(e)}}get source(){return this.#t||""}set source(t){let e=String(t||"");e!==this.#t&&(this.#t=e,this.#e&&(this.#e.remove(),this.#e=null),this.querySelector(":scope > .dwc-error")?.remove(),this.dispatchEvent(new CustomEvent("diagram-wc:source-changed",{bubbles:!0,detail:{source:e}})),this.#a())}get svg(){return this.#e?.querySelector("svg")?.outerHTML||""}};C("diagram-wc",y);export{y as DiagramWc};
1
+ var L=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function C(n,e,t={}){let i=t.priority??10,r={impl:e,bundle:t.bundle,contract:t.contract,priority:i},o=v.get(n);if(customElements.get(n)){if(!o||o.priority>=i){o&&o.priority===i&&o.impl!==e&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=i){o.priority===i&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${o.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}v.set(n,r),customElements.define(n,e)}var y=class extends HTMLElement{#r=[];#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 e of this.#r)e();this.#r=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,i,r){e.addEventListener(t,i,r),this.#r.push(()=>e.removeEventListener(t,i,r))}_reinit(){for(let e of this.#r)e();this.#r=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,t){this.#e||(this.#e=this.attachInternals());let i=this.#e.states;try{t?i.add(e):i.delete(e)}catch{let r=`--${e}`;t?i.add(r):i.delete(r)}}_adoptInternals(e){this.#e||(this.#e=e)}#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 $=0;function E(n,e,t="vb-vt"){if(!n?.isConnected||typeof document>"u"||!("startViewTransition"in document)||matchMedia("(prefers-reduced-motion: reduce)").matches)return e(),null;let i=`${t}-${++$}`;n.style.viewTransitionName=i;let r=document.startViewTransition(e);return r.finished.finally(()=>{n.style.viewTransitionName===i&&(n.style.viewTransitionName="")}),r}function c(n,e,t){return n.getPropertyValue(e).trim()||t}function g(n,e){if(!e)return e;let t=document.createElement("span");t.style.color=e,t.style.position="absolute",t.style.visibility="hidden",t.style.pointerEvents="none",(n.parentElement||document.body).appendChild(t);let i=getComputedStyle(t).color;if(t.remove(),!i)return e;let r=g,o=r._canvas||(r._canvas=document.createElement("canvas"));o.width=o.height=1;let a=r._ctx||(r._ctx=o.getContext("2d",{willReadFrequently:!0}));a.clearRect(0,0,1,1),a.fillStyle=i,a.fillRect(0,0,1,1);let[s,m,l,f]=a.getImageData(0,0,1,1).data;return f===255?`rgb(${s},${m},${l})`:`rgba(${s},${m},${l},${(f/255).toFixed(3)})`}function T(n){let e=getComputedStyle(n),t=g(n,c(e,"--color-text","#1a1a1a")),i=g(n,c(e,"--color-surface","#ffffff")),r=g(n,c(e,"--color-surface-raised",c(e,"--color-surface","#ffffff"))),o=g(n,c(e,"--color-border","#e0e0e0")),a=g(n,c(e,"--color-primary",c(e,"--color-interactive","#3b82f6"))),s=g(n,c(e,"--color-secondary",c(e,"--color-surface-raised","#f8f9fa"))),m=g(n,c(e,"--color-accent",c(e,"--color-primary","#3b82f6"))),l=g(n,c(e,"--color-text-muted",c(e,"--color-text","#1a1a1a"))),f=c(e,"--font-sans",'system-ui, -apple-system, "Segoe UI", sans-serif'),u=c(e,"--font-size-m","14px"),h=[a,m,s],p={};for(let d=0;d<12;d++)p[`cScale${d}`]=h[d%h.length],p[`cScaleLabel${d}`]=t,p[`cScalePeer${d}`]=o,p[`cScaleInv${d}`]=i;let b={};for(let d=0;d<8;d++)b[`git${d}`]=h[d%h.length],b[`gitInv${d}`]=i,b[`gitBranchLabel${d}`]=t;return{primaryColor:a,primaryBorderColor:o,primaryTextColor:t,nodeTextColor:t,secondaryColor:s,secondaryBorderColor:o,secondaryTextColor:t,tertiaryColor:m,tertiaryBorderColor:o,tertiaryTextColor:t,background:i,mainBkg:i,secondBkg:r,tertiaryBkg:r,lineColor:o,nodeBorder:o,gridColor:o,defaultLinkColor:l,clusterBkg:r,clusterBorder:o,actorBkg:i,actorBorder:o,actorTextColor:t,actorLineColor:o,signalColor:t,signalTextColor:t,labelBoxBkgColor:r,labelBoxBorderColor:o,labelTextColor:t,loopTextColor:t,noteBkgColor:r,noteBorderColor:o,noteTextColor:t,edgeLabelBackground:i,titleColor:t,fontFamily:f,fontSize:u,...p,...b}}function x(n,e={}){return{startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:e.themeBase||"base",themeVariables:T(n)}}function M(n=document,e={}){let t=e.language||"mermaid",i=e.type||"mermaid",r=Array.isArray(e.primingSvgs)?e.primingSvgs:null,o=`pre > code.language-${t}`,a=[],s=0;for(let m of n.querySelectorAll(o)){let l=m.parentElement;if(!l||l.parentElement?.tagName.toLowerCase()==="diagram-wc")continue;let f=l.parentNode,u=l.nextSibling,h=document.createElement("diagram-wc");if(h.setAttribute("type",i),h.appendChild(l),r&&r[s]){let p=document.createElement("figure");p.className="dwc-figure",p.innerHTML=r[s],h.appendChild(p)}f?.insertBefore(h,u),a.push(h),s++}return a}var B="https://cdn.jsdelivr.net/npm/mermaid@11.14.0/dist/mermaid.esm.min.mjs",A=new Map;function k(){let n=typeof window<"u"&&window.VB_MERMAID_URL||B,e=A.get(n);return e||(e=import(n).then(t=>t.default||t),A.set(n,e)),e}var S=Promise.resolve();function q(n){let e=S.then(n,n);return S=e.catch(()=>{}),e}var w=class n extends y{static#r=0;#e=null;#t=null;#l=null;#n=null;#i=null;#s=null;#o=!1;#a=0;setup(){this.hasAttribute("type")||this.setAttribute("type","mermaid");let e=this.getAttribute("min-height");e&&(this.style.minBlockSize=e);let t=this.querySelector(":scope > pre");if(this.#e===null&&t&&(this.#e=this.#m(t)),!this.#n){let r=this.querySelector(":scope > .dwc-figure");r&&(this.#h(r,this.#e||""),this.#n=r,this.#o=!0)}!this.#o&&(this.#e||this.hasAttribute("src"))&&this.setAttribute("data-rendering",""),this.listen(window,"vb:theme-change",()=>{this.#s&&clearTimeout(this.#s),this.#s=setTimeout(()=>{this.#o&&this.#c()},50)});let i=this.getAttribute("src");i&&i!==this.#l?this.#p(i).then(r=>{r&&this.#u()}):this.#e&&this.#e!==this.#t&&this.#u()}teardown(){this.#i&&(this.#i.disconnect(),this.#i=null),this.#s&&(clearTimeout(this.#s),this.#s=null)}#u(){if(this.getAttribute("loading")!=="lazy"||!("IntersectionObserver"in window)){this.#c();return}this.#i||(this.#i=new IntersectionObserver(e=>{for(let t of e)if(t.isIntersecting){this.#i?.disconnect(),this.#i=null,this.#c();break}},{rootMargin:"200px"}),this.#i.observe(this))}async#c(){let e=this.#e;if(!e)return;let t=++this.#a,i=this.getAttribute("type")||"mermaid";if(i!=="mermaid"){this.removeAttribute("data-rendering"),this.#o||this.setAttribute("data-error",""),this.#d(new Error(`Unsupported diagram type "${i}". v1 supports "mermaid" only.`));return}try{let r=await k(),o=this.dataset.themeBase||"base",a=`diagram-wc-${++n.#r}`,s=await q(async()=>(r.initialize(x(this,{themeBase:o})),(await r.render(a,e)).svg));if(t!==this.#a||(await this.#f(s,e),t!==this.#a))return;this.#o=!0,this.#t=e,this.removeAttribute("data-rendering"),this.removeAttribute("data-error"),this.querySelector(":scope > .dwc-error")?.remove(),this.dispatchEvent(new CustomEvent("diagram-wc:ready",{bubbles:!0,detail:{svg:s,type:i,source:e}}))}catch(r){if(t!==this.#a)return;this.removeAttribute("data-rendering"),this.#o||this.setAttribute("data-error",""),this.#d(r)}}#h(e,t){e.classList.add("dwc-figure"),e.removeAttribute("role"),e.removeAttribute("aria-label"),e.querySelectorAll(":scope > .dwc-source, :scope > .dwc-caption").forEach(u=>u.remove());let i=`dwc-${++n.#r}`,r=e.querySelector("svg"),o=document.createElement("details");o.className="dwc-source";let a=document.createElement("summary");a.textContent="Diagram source";let s=document.createElement("pre");s.id=`${i}-src`;let m=document.createElement("code");m.className=`language-${this.getAttribute("type")||"mermaid"}`,m.textContent=t,s.appendChild(m),o.append(a,s),e.appendChild(o);let l=this.getAttribute("caption"),f="";if(l){let u=document.createElement("figcaption");u.className="dwc-caption",u.id=f=`${i}-cap`,u.textContent=l,e.appendChild(u)}if(r){!r.getAttribute("aria-labelledby")&&!r.getAttribute("aria-label")&&f&&r.setAttribute("aria-labelledby",f);let u=(r.getAttribute("aria-describedby")||"").split(/\s+/).filter(h=>h&&!/^dwc-\d+-src$/.test(h));u.push(s.id),r.setAttribute("aria-describedby",u.join(" "))}}async#f(e,t){let i=document.createElement("figure");i.innerHTML=e,this.#h(i,t);let r=this.#n,o=!!r&&r.parentNode===this,a=()=>{r&&r.parentNode===this?r.replaceWith(i):this.appendChild(i),this.querySelector(":scope > pre")?.remove(),this.#n=i};if(o&&this.isConnected){let s=E(this,a,"dwc-vt");s&&await s.updateCallbackDone.catch(()=>{}),this.#n!==i&&a()}else a()}#d(e){if(!this.#o){let r=this.querySelector(":scope > pre");if(!r&&this.#e!==null){r=document.createElement("pre");let o=document.createElement("code");o.className=`language-${this.getAttribute("type")||"mermaid"}`,r.appendChild(o),this.prepend(r)}if(r&&this.#e!==null&&this.#m(r)!==this.#e){let o=r.querySelector("code")||r;o.textContent=this.#e}}this.querySelector(":scope > .dwc-error")?.remove();let t=document.createElement("p");t.className="dwc-error",t.setAttribute("role","status");let i=(e.message||String(e)).split(`
2
+ `)[0].slice(0,240);t.textContent=`Diagram syntax error: ${i}`,this.appendChild(t),this.dispatchEvent(new CustomEvent("diagram-wc:error",{bubbles:!0,detail:{error:e,source:this.#e,type:this.getAttribute("type")}}))}#m(e){let t=e.querySelector("code");return(t?t.textContent:e.textContent)||""}async#p(e){try{let t=await fetch(e);if(!t.ok)throw new Error(`HTTP ${t.status}`);return this.#e=await t.text(),this.#l=e,!0}catch(t){return this.removeAttribute("data-rendering"),this.#o||this.setAttribute("data-error",""),this.#d(t),!1}}get source(){return this.#e||""}set source(e){let t=String(e||"");t!==this.#e&&(this.#e=t,this.dispatchEvent(new CustomEvent("diagram-wc:source-changed",{bubbles:!0,detail:{source:t}})),this.isConnected&&this.hasAttribute("data-upgraded")&&this.#c())}get svg(){return this.#n?.querySelector("svg")?.outerHTML||""}};C("diagram-wc",w);export{w as DiagramWc,M as enhanceMermaidFences};
3
3
  //# sourceMappingURL=diagram-wc.js.map