vanilla-breeze 0.6.2 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/custom-elements.json +6768 -6425
  2. package/dist/cdn/components/accordion-wc.js +1 -1
  3. package/dist/cdn/components/activity-feed.js +1 -1
  4. package/dist/cdn/components/ai-chat.js +6 -6
  5. package/dist/cdn/components/ai-summary.js +2 -2
  6. package/dist/cdn/components/analytics-panel.js +2 -2
  7. package/dist/cdn/components/audio-player.js +4 -4
  8. package/dist/cdn/components/audio-visualizer.js +2 -2
  9. package/dist/cdn/components/author-index.js +2 -2
  10. package/dist/cdn/components/brand-mark.js +1 -1
  11. package/dist/cdn/components/bread-crumb.js +1 -1
  12. package/dist/cdn/components/calendar-wc.js +2 -2
  13. package/dist/cdn/components/card-list.js +1 -1
  14. package/dist/cdn/components/carousel-wc.js +1 -1
  15. package/dist/cdn/components/change-set.js +1 -1
  16. package/dist/cdn/components/chart-wc.js +13 -13
  17. package/dist/cdn/components/chat-input.js +1 -1
  18. package/dist/cdn/components/chat-window.js +1 -1
  19. package/dist/cdn/components/color-picker.js +1 -1
  20. package/dist/cdn/components/combo-box.js +1 -1
  21. package/dist/cdn/components/command-palette.js +1 -1
  22. package/dist/cdn/components/comment-box.js +35 -35
  23. package/dist/cdn/components/comment-thread.js +38 -38
  24. package/dist/cdn/components/comment-wc.js +1 -1
  25. package/dist/cdn/components/compare-surface.js +1 -1
  26. package/dist/cdn/components/consent-banner.js +1 -1
  27. package/dist/cdn/components/content-lens.js +1 -1
  28. package/dist/cdn/components/content-swap.js +1 -1
  29. package/dist/cdn/components/context-menu.js +1 -1
  30. package/dist/cdn/components/data-table.js +1 -1
  31. package/dist/cdn/components/date-picker.js +1 -1
  32. package/dist/cdn/components/day-view.js +1 -1
  33. package/dist/cdn/components/diagram-wc.js +2 -2
  34. package/dist/cdn/components/drag-surface.js +1 -1
  35. package/dist/cdn/components/drop-down.js +1 -1
  36. package/dist/cdn/components/emoji-picker.js +1 -1
  37. package/dist/cdn/components/flow-diagram.js +1 -1
  38. package/dist/cdn/components/foot-notes.js +1 -1
  39. package/dist/cdn/components/form-field.js +1 -1
  40. package/dist/cdn/components/geo-map.js +3 -3
  41. package/dist/cdn/components/glossary-index.js +1 -1
  42. package/dist/cdn/components/glossary-wc.js +1 -1
  43. package/dist/cdn/components/heading-links.js +1 -1
  44. package/dist/cdn/components/highlight-wc.js +2 -2
  45. package/dist/cdn/components/icon-wc.js +2 -2
  46. package/dist/cdn/components/image-gallery.js +1 -1
  47. package/dist/cdn/components/image-map.js +1 -1
  48. package/dist/cdn/components/include-file.js +1 -1
  49. package/dist/cdn/components/manifest.json +58 -54
  50. package/dist/cdn/components/markdown-editor.js +25 -25
  51. package/dist/cdn/components/markdown-viewer.js +27 -27
  52. package/dist/cdn/components/nav-bar.js +1 -1
  53. package/dist/cdn/components/note-wc.js +2 -2
  54. package/dist/cdn/components/notification-wc.js +23 -23
  55. package/dist/cdn/components/page-info.js +6 -6
  56. package/dist/cdn/components/page-stats.js +1 -1
  57. package/dist/cdn/components/page-toc.js +1 -1
  58. package/dist/cdn/components/page-tools.js +1 -1
  59. package/dist/cdn/components/page-tour.js +1 -1
  60. package/dist/cdn/components/pager-wc.js +1 -1
  61. package/dist/cdn/components/poll-wc.js +1 -1
  62. package/dist/cdn/components/pop-over.js +1 -1
  63. package/dist/cdn/components/popularity-index.js +1 -1
  64. package/dist/cdn/components/print-page.js +1 -1
  65. package/dist/cdn/components/progress-tracker.js +1 -1
  66. package/dist/cdn/components/qr-code.js +1 -1
  67. package/dist/cdn/components/reaction-bar.js +1 -1
  68. package/dist/cdn/components/reading-progress.js +1 -1
  69. package/dist/cdn/components/recently-visited.js +1 -1
  70. package/dist/cdn/components/score-card.js +2 -2
  71. package/dist/cdn/components/selection-menu.js +1 -1
  72. package/dist/cdn/components/settings-panel.js +6 -6
  73. package/dist/cdn/components/share-wc.js +2 -2
  74. package/dist/cdn/components/short-cuts.js +1 -1
  75. package/dist/cdn/components/site-index.js +1 -1
  76. package/dist/cdn/components/site-map.js +1 -1
  77. package/dist/cdn/components/site-search.js +1 -1
  78. package/dist/cdn/components/slide-accept.js +1 -1
  79. package/dist/cdn/components/social-embed.js +1 -1
  80. package/dist/cdn/components/social-links.js +2 -0
  81. package/dist/cdn/components/split-surface.js +1 -1
  82. package/dist/cdn/components/star-rating.js +1 -1
  83. package/dist/cdn/components/status-wc.js +1 -1
  84. package/dist/cdn/components/stepper-wc.js +1 -1
  85. package/dist/cdn/components/tab-set.js +1 -1
  86. package/dist/cdn/components/text-reader.js +2 -2
  87. package/dist/cdn/components/theme-picker.js +20 -20
  88. package/dist/cdn/components/time-index.js +1 -1
  89. package/dist/cdn/components/time-picker.js +1 -1
  90. package/dist/cdn/components/toast-msg.js +2 -2
  91. package/dist/cdn/components/tool-tip.js +1 -1
  92. package/dist/cdn/components/topic-map.js +4 -4
  93. package/dist/cdn/components/trust-filter.js +1 -1
  94. package/dist/cdn/components/version-switcher.js +6 -6
  95. package/dist/cdn/components/video-player.js +4 -4
  96. package/dist/cdn/components/watch-wc.js +2 -2
  97. package/dist/cdn/components/week-view.js +1 -1
  98. package/dist/cdn/components/youtube-player.js +1 -1
  99. package/dist/cdn/fonts/barlow-condensed-latin-400-italic.woff2 +0 -0
  100. package/dist/cdn/fonts/barlow-condensed-latin-700-italic.woff2 +0 -0
  101. package/dist/cdn/fonts/barlow-condensed-latin-ext-400-italic.woff2 +0 -0
  102. package/dist/cdn/fonts/barlow-condensed-latin-ext-700-italic.woff2 +0 -0
  103. package/dist/cdn/fonts/dm-sans-latin-ext-wght-italic.woff2 +0 -0
  104. package/dist/cdn/fonts/dm-sans-latin-wght-italic.woff2 +0 -0
  105. package/dist/cdn/fonts/dm-serif-display-latin-400-italic.woff2 +0 -0
  106. package/dist/cdn/fonts/dm-serif-display-latin-ext-400-italic.woff2 +0 -0
  107. package/dist/cdn/fonts/exo-2-latin-ext-wght-italic.woff2 +0 -0
  108. package/dist/cdn/fonts/exo-2-latin-wght-italic.woff2 +0 -0
  109. package/dist/cdn/fonts/inter-latin-ext-wght-italic.woff2 +0 -0
  110. package/dist/cdn/fonts/inter-latin-wght-italic.woff2 +0 -0
  111. package/dist/cdn/fonts/jetbrains-mono-latin-ext-wght-italic.woff2 +0 -0
  112. package/dist/cdn/fonts/jetbrains-mono-latin-wght-italic.woff2 +0 -0
  113. package/dist/cdn/fonts/josefin-sans-latin-ext-wght-italic.woff2 +0 -0
  114. package/dist/cdn/fonts/josefin-sans-latin-wght-italic.woff2 +0 -0
  115. package/dist/cdn/fonts/lora-latin-ext-wght-italic.woff2 +0 -0
  116. package/dist/cdn/fonts/lora-latin-wght-italic.woff2 +0 -0
  117. package/dist/cdn/fonts/merriweather-latin-ext-wght-italic.woff2 +0 -0
  118. package/dist/cdn/fonts/merriweather-latin-wght-italic.woff2 +0 -0
  119. package/dist/cdn/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
  120. package/dist/cdn/fonts/nunito-latin-wght-italic.woff2 +0 -0
  121. package/dist/cdn/packs/effects.full.js +1 -1
  122. package/dist/cdn/packs/kawaii/fonts/nunito-latin-ext-wght-italic.woff2 +0 -0
  123. package/dist/cdn/packs/kawaii/fonts/nunito-latin-wght-italic.woff2 +0 -0
  124. package/dist/cdn/packs/kawaii.full.css +1 -1
  125. package/dist/cdn/packs/kawaii.theme.css +1 -1
  126. package/dist/cdn/packs/manifest.json +4 -4
  127. package/dist/cdn/packs/prototype.full.js +1 -1
  128. package/dist/cdn/packs/ui.full.js +19 -19
  129. package/dist/cdn/themes/8bit.tokens.json +8 -37
  130. package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
  131. package/dist/cdn/themes/alpha1999.css +1 -1
  132. package/dist/cdn/themes/alpha1999.tokens.json +3 -6
  133. package/dist/cdn/themes/art-deco-dark.tokens.json +3 -27
  134. package/dist/cdn/themes/art-deco.css +1 -1
  135. package/dist/cdn/themes/art-deco.tokens.json +5 -11
  136. package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
  137. package/dist/cdn/themes/bauhaus.css +1 -1
  138. package/dist/cdn/themes/bauhaus.tokens.json +13 -7
  139. package/dist/cdn/themes/brutalist-dark.tokens.json +3 -27
  140. package/dist/cdn/themes/brutalist.tokens.json +5 -11
  141. package/dist/cdn/themes/catppuccin-frappe.css +1 -1
  142. package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
  143. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
  144. package/dist/cdn/themes/catppuccin-latte.css +1 -1
  145. package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
  146. package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
  147. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
  148. package/dist/cdn/themes/catppuccin-mocha.css +1 -1
  149. package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
  150. package/dist/cdn/themes/classic-dark.tokens.json +41 -41
  151. package/dist/cdn/themes/classic.tokens.json +25 -31
  152. package/dist/cdn/themes/claymorphism-dark.tokens.json +533 -161
  153. package/dist/cdn/themes/claymorphism.css +1 -1
  154. package/dist/cdn/themes/claymorphism.tokens.json +531 -135
  155. package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
  156. package/dist/cdn/themes/clinical.tokens.json +1 -1
  157. package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
  158. package/dist/cdn/themes/cottagecore.css +1 -1
  159. package/dist/cdn/themes/cottagecore.tokens.json +1 -1
  160. package/dist/cdn/themes/cyber.css +1 -1
  161. package/dist/cdn/themes/cyber.tokens.json +5 -11
  162. package/dist/cdn/themes/dawn-dark.tokens.json +3 -27
  163. package/dist/cdn/themes/dawn.css +1 -1
  164. package/dist/cdn/themes/dawn.tokens.json +1 -1
  165. package/dist/cdn/themes/dracula.tokens.json +1 -1
  166. package/dist/cdn/themes/dusk.tokens.json +1 -1
  167. package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
  168. package/dist/cdn/themes/editorial.tokens.json +19 -16
  169. package/dist/cdn/themes/financial-dark.tokens.json +1 -1
  170. package/dist/cdn/themes/financial.css +1 -1
  171. package/dist/cdn/themes/financial.tokens.json +1 -1
  172. package/dist/cdn/themes/genai.css +1 -1
  173. package/dist/cdn/themes/genai.tokens.json +1 -1
  174. package/dist/cdn/themes/glassmorphism-dark.tokens.json +233 -116
  175. package/dist/cdn/themes/glassmorphism.css +1 -1
  176. package/dist/cdn/themes/glassmorphism.tokens.json +233 -116
  177. package/dist/cdn/themes/government-dark.tokens.json +1 -1
  178. package/dist/cdn/themes/government.tokens.json +1 -1
  179. package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
  180. package/dist/cdn/themes/gruvbox.css +1 -1
  181. package/dist/cdn/themes/gruvbox.tokens.json +1 -1
  182. package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
  183. package/dist/cdn/themes/high-noon.tokens.json +1 -1
  184. package/dist/cdn/themes/journal-dark.tokens.json +3 -27
  185. package/dist/cdn/themes/journal.css +1 -1
  186. package/dist/cdn/themes/journal.tokens.json +21 -21
  187. package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
  188. package/dist/cdn/themes/kawaii.css +1 -1
  189. package/dist/cdn/themes/kawaii.tokens.json +1 -1
  190. package/dist/cdn/themes/magna-dark.tokens.json +1 -1
  191. package/dist/cdn/themes/magna.css +1 -1
  192. package/dist/cdn/themes/magna.tokens.json +2 -14
  193. package/dist/cdn/themes/manifest.json +25 -25
  194. package/dist/cdn/themes/midnight.tokens.json +1 -1
  195. package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
  196. package/dist/cdn/themes/minimal.tokens.json +25 -27
  197. package/dist/cdn/themes/modern-dark.tokens.json +41 -41
  198. package/dist/cdn/themes/modern.css +1 -1
  199. package/dist/cdn/themes/modern.tokens.json +21 -21
  200. package/dist/cdn/themes/nes-dark.tokens.json +3 -27
  201. package/dist/cdn/themes/nes.tokens.json +10 -39
  202. package/dist/cdn/themes/neumorphism-dark.tokens.json +266 -134
  203. package/dist/cdn/themes/neumorphism.css +1 -1
  204. package/dist/cdn/themes/neumorphism.tokens.json +266 -134
  205. package/dist/cdn/themes/nord-dark.tokens.json +3 -27
  206. package/dist/cdn/themes/nord.css +1 -1
  207. package/dist/cdn/themes/nord.tokens.json +1 -1
  208. package/dist/cdn/themes/organic-dark.tokens.json +1 -1
  209. package/dist/cdn/themes/organic.tokens.json +5 -14
  210. package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
  211. package/dist/cdn/themes/rose-pine.css +1 -1
  212. package/dist/cdn/themes/rose-pine.tokens.json +1 -1
  213. package/dist/cdn/themes/rough-dark.tokens.json +1 -1
  214. package/dist/cdn/themes/rough.tokens.json +1 -1
  215. package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
  216. package/dist/cdn/themes/solarized.tokens.json +1 -1
  217. package/dist/cdn/themes/startup-dark.tokens.json +1 -1
  218. package/dist/cdn/themes/startup.css +1 -1
  219. package/dist/cdn/themes/startup.tokens.json +1 -1
  220. package/dist/cdn/themes/super2026-dark.tokens.json +6 -30
  221. package/dist/cdn/themes/super2026.css +1 -1
  222. package/dist/cdn/themes/super2026.tokens.json +1 -1
  223. package/dist/cdn/themes/swiss-dark.tokens.json +4 -40
  224. package/dist/cdn/themes/swiss.tokens.json +34 -68
  225. package/dist/cdn/themes/terminal.tokens.json +286 -120
  226. package/dist/cdn/themes/tokyo-night-dark.tokens.json +3 -27
  227. package/dist/cdn/themes/tokyo-night.css +1 -1
  228. package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
  229. package/dist/cdn/themes/vaporwave-dark.tokens.json +3 -27
  230. package/dist/cdn/themes/vaporwave.tokens.json +1 -1
  231. package/dist/cdn/themes/win9x-dark.tokens.json +5 -29
  232. package/dist/cdn/themes/win9x.tokens.json +9 -9
  233. package/dist/cdn/vanilla-breeze-autoload.js +113 -108
  234. package/dist/cdn/vanilla-breeze-charts.js +13 -13
  235. package/dist/cdn/vanilla-breeze-core.css +1 -1
  236. package/dist/cdn/vanilla-breeze-core.js +80 -75
  237. package/dist/cdn/vanilla-breeze-extras.js +31 -31
  238. package/dist/cdn/vanilla-breeze.css +1 -1
  239. package/dist/cdn/vanilla-breeze.js +133 -133
  240. package/package.json +3 -3
@@ -1,39 +1,39 @@
1
- var O=window.matchMedia("(prefers-reduced-motion: reduce)");var k=new Map;function x(n,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},a=k.get(n);if(customElements.get(n)){if(!a||a.priority>=i){a&&a.priority===i&&a.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${a.bundle}" (priority ${a.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${a.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(a&&a.priority>=i){a.priority===i&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${a.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}k.set(n,s),customElements.define(n,t)}var w=class extends HTMLElement{#s=[];#n;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#s)t();this.#s=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#s.push(()=>t.removeEventListener(e,i,s))}_reinit(){for(let t of this.#s)t();this.#s=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#n||(this.#n=this.attachInternals());let i=this.#n.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#n||(this.#n=t)}#e(){return this.constructor.formAssociated&&this.#n?this.#n:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};function L(){let n=globalThis.localStorage;if(!n)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return n.getItem(t)},async setRaw(t,e){n.setItem(t,e)},async removeRaw(t){n.removeItem(t)},async keys(t){let e=[];for(let i=0;i<n.length;i++){let s=n.key(i);s&&s.startsWith(t)&&e.push(s)}return e}}}var v="__vbStoreBackend",$=globalThis;function u(){return $[v]||($[v]=L()),$[v]}function A(n,t){if(typeof n!="string"||!n)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${n}:${t}`}function C(n){if(typeof n!="string"||!n)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${n}:`}function T(n){try{let t=JSON.parse(n);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var f={configure(n={}){$[v]=n.backend??null},async set(n,t,e){let i={data:e,timestamp:Date.now()};await u().setRaw(A(n,t),JSON.stringify(i))},async get(n,t,e){let i=await u().getRaw(A(n,t));if(i==null)return null;let s=T(i);return!s||e?.maxAge!=null&&Date.now()-s.timestamp>e.maxAge?null:s.data},async remove(n,t){await u().removeRaw(A(n,t))},async list(n){let t=C(n),e=await u().keys(t),i=[];for(let s of e){let a=await u().getRaw(s);if(a==null)continue;let o=T(a);o&&i.push({key:s.slice(t.length),data:o.data,timestamp:o.timestamp})}return i},async clear(n){let t=C(n),e=await u().keys(t);for(let i of e)await u().removeRaw(i)},async clearAll(){let n=await u().keys("vb:");for(let t of n)await u().removeRaw(t)},async setMany(n,t){for(let[e,i]of t)await f.set(n,e,i)}};if(typeof window<"u"){let n=window.VB??(window.VB={});n.store??=f}var b="__vbServiceConfig",m=globalThis,N=()=>({baseUrl:"/go",headers:{},services:{}});m[b]||(m[b]=N());var S=()=>m[b],p=class extends Error{constructor(t,e,i,s){super(`VBService(${i}): ${t} ${s}`),this.name="VBServiceError",this.status=t,this.body=e,this.role=i,this.path=s}};function I(n,t){if(!t)return n;let e=n??new URLSearchParams;for(let[i,s]of Object.entries(t))s!=null&&e.set(i,String(s));return e}async function P(n){if((n.headers.get("content-type")??"").includes("application/json"))try{return await n.json()}catch{return null}try{return await n.text()}catch{return null}}var y=class n{static configure(t={}){let e=S();m[b]={baseUrl:t.baseUrl??e.baseUrl,headers:{...e.headers,...t.headers??{}},services:{...e.services,...t.services??{}}}}static resolve(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");let e=S();return e.services[t]?q(e.services[t]):e.baseUrl?`${q(e.baseUrl)}/${t}`:`/go/${t}`}static _reset(){m[b]=N()}constructor(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");this.role=t}async get(t,e){return this.#s("GET",t,{params:e})}async post(t,e){return this.#s("POST",t,{body:e})}async patch(t,e){return this.#s("PATCH",t,{body:e})}async delete(t){return this.#s("DELETE",t,{})}async#s(t,e,i){let s=n.resolve(this.role),a=e?e.startsWith("/")?e:`/${e}`:"",o=new URL(`${s}${a}`,globalThis.location?.origin??"http://localhost"),l=I(o.searchParams,i.params);l&&(o.search=l.toString());let d={method:t,headers:{...S().headers}};i.body!==void 0&&(d.body=JSON.stringify(i.body),d.headers["content-type"]="application/json");let r=o.toString(),h=await fetch(r,d),g=await P(h);if(!h.ok)throw new p(h.status,g,this.role,`${a||"/"}`);return g}};function q(n){return n.endsWith("/")?n.slice(0,-1):n}if(typeof window<"u"){let n=window.VB??(window.VB={});n.service??=y,n.ServiceError??=p}var R={update:"package",alert:"alert-triangle",watch:"eye",system:"settings",message:"mail",stewardship:"shield"},V={trigger:"Notifications",unread:"{n} unread",title:"Notifications","mark-all":"Mark all read",close:"Close notifications",tabs:"Notification categories",all:"All",watching:"Watching",empty:"No notifications","watch-empty":"You aren\u2019t watching any pages yet. Use the \u201CWatch\u201D button on a page to start.","last-checked":"Last checked: {date}",never:"\u2014",changed:"Changed",unwatch:"Unwatch {title}",new:"New notification","variant-info":"Information:","variant-success":"Success:","variant-warning":"Warning:","variant-error":"Error:"};function c(n){return String(n??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function B(n){if(typeof n!="string"||!n.trim())return null;try{let{protocol:t}=new URL(n,location.href);return t==="http:"||t==="https:"?n:null}catch{return null}}function M(n,t){let e=new Date(n);if(Number.isNaN(e.getTime()))return String(n);let s=/^\d{4}-\d{2}-\d{2}$/.test(n)?{dateStyle:"medium",timeZone:"UTC"}:{dateStyle:"medium",timeStyle:"short"};try{return new Intl.DateTimeFormat(t||void 0,s).format(e)}catch{return new Intl.DateTimeFormat(void 0,s).format(e)}}var D=0,E=class extends w{static observedAttributes=["variant","position"];#s="panel";#n=0;#e=null;#p=null;#t=null;#d=null;#r=new Set;#h=[];#a=!1;#f=null;#T=new Set;#w="all";#o=[];#b=[];setup(){let t=++this.#n;return this.#s=this.getAttribute("mode")==="banner"?"banner":"panel",this.#s==="banner"?this.#N(t):this.#L(t),!0}teardown(){this.#n++,this.#f!=null&&(clearInterval(this.#f),this.#f=null),this.#a&&(this.#a=!1,this.#x(),this.#t&&(this.#t.hidden=!0),this.#e?.setAttribute("aria-expanded","false"))}attributeChangedCallback(t,e,i){e===i||this.#s!=="banner"||!this.hasAttribute("data-upgraded")||(t==="variant"&&(this.dataset.variant=i||"info",this.#$()),t==="position"&&(this.dataset.position=i||"top"))}#c(t){return t===this.#n&&this.isConnected}#i(t,e={}){let i=this.getAttribute(`data-label-${t}`)??V[t]??t;for(let[s,a]of Object.entries(e))i=i.replaceAll(`{${s}}`,String(a));return i}#q(){let t=(this.getAttribute("toast-new")||"").trim(),e=null;if(t){try{e=document.querySelector(t)}catch{e=null}e&&e.localName!=="toast-msg"&&(e=null)}return e??document.querySelector("toast-msg")}#v(){return this.closest("[lang]")?.lang||document.documentElement.lang||void 0}get notifications(){return[...this.#h]}set notifications(t){this.#s==="panel"&&(this.#h=Array.isArray(t)?t:[],this.#u(),this.dispatchEvent(new CustomEvent("notification-wc:notifications-changed",{detail:{notifications:this.#h,source:"property"},bubbles:!0})))}async#N(t){let e=this.getAttribute("persist");if(e||console.warn("[notification-wc] banner mode requires a persist attribute"),this.dataset.mode="banner",this.dataset.variant=this.getAttribute("variant")||"info",this.dataset.position=this.getAttribute("position")||"top",this.#$(),e){let s=Number(this.getAttribute("expires")??""),a=Number.isFinite(s)&&s>0?s*864e5:void 0,o=await f.get("notifications",e,a?{maxAge:a}:void 0);if(!this.#c(t))return;if(o&&o.dismissed){this.hidden=!0;return}}let i=this.querySelector('[value="dismiss"], [data-dismiss]');i&&this.listen(i,"click",this.#B)}#$(){let t=this.dataset.variant||"info",e=this.querySelector(":scope [data-variant-prefix]");e||(e=document.createElement("span"),e.className="visually-hidden",e.setAttribute("data-variant-prefix",""),(this.querySelector(":scope > :is(p, strong, span, h2, h3, h4)")||this).prepend(e)),e.textContent=`${this.#i(`variant-${t}`)} `}#B=async t=>{t.preventDefault();let e=this.contains(document.activeElement),i=this.getAttribute("persist");this.hidden=!0,e&&this.#M(),i&&await f.set("notifications",i,{dismissed:!0}),this.dispatchEvent(new CustomEvent("notification-wc:dismiss",{bubbles:!0,composed:!0,detail:{id:i}}))};#M(){let t=document.querySelector('main, [role="main"]')||document.querySelector("h1");t&&(t.hasAttribute("tabindex")||(t.setAttribute("tabindex","-1"),t.addEventListener("blur",()=>t.removeAttribute("tabindex"),{once:!0})),t.focus({preventScroll:!0}))}async#L(t){if(this.dataset.mode="panel",this.listen(document,"notification-wc:new",this.#D),await this.#I(),!!this.#c(t)&&(this.#P(),this.#R(),this.listen(document,"click",this.#W),this.listen(document,"keydown",this.#K),this.listen(this,"focusout",this.#z),this.listen(document,"page-watch:add",this.#E),this.listen(document,"page-watch:remove",this.#E),await this.#y(),!!this.#c(t)&&this.getAttribute("src"))){if(await this.#C(t),!this.#c(t))return;let e=Number(this.getAttribute("poll"));Number.isFinite(e)&&e>0&&(this.#f=setInterval(()=>this.#C(t),e))}}async#I(){let t=this.getAttribute("storage-key")||"notifications",e=await f.get(t,"read-ids");Array.isArray(e)&&(this.#r=new Set(e.filter(i=>typeof i=="string")))}async#A(){let t=this.getAttribute("storage-key")||"notifications";await f.set(t,"read-ids",Array.from(this.#r))}#P(){if(this.#e=this.querySelector(":scope > [data-trigger]"),this.#e){if(!this.#e.classList.contains("notification-trigger")&&this.#p===null){let e=this.#e.cloneNode(!0);e.querySelector(".notification-badge")?.remove(),this.#p=(this.#e.getAttribute("aria-label")||e.textContent||"").trim()}}else{let e=document.createElement("button");e.type="button",e.setAttribute("data-trigger",""),e.className="notification-trigger",e.innerHTML='<icon-wc name="bell" size="sm" aria-hidden="true"></icon-wc><span class="notification-badge" aria-hidden="true" hidden>0</span>',this.#e=e,this.prepend(e)}let t=this.#e.querySelector(".notification-badge");t||(t=document.createElement("span"),t.className="notification-badge",t.setAttribute("aria-hidden","true"),t.hidden=!0,this.#e.appendChild(t)),this.#d=t,this.#e.setAttribute("aria-haspopup","dialog"),this.#e.setAttribute("aria-expanded","false"),this.listen(this.#e,"click",this.#_)}#R(){let t=this.querySelector(":scope > .notification-panel");t||(t=document.createElement("div"),t.className="notification-panel",t.id=`notification-panel-${++D}-${Math.random().toString(36).slice(2,7)}`,this.appendChild(t)),this.#t=t;let e=t.id;t.setAttribute("role","dialog"),t.setAttribute("aria-labelledby",`${e}-title`),t.tabIndex=-1,t.hidden=!0,this.#e?.setAttribute("aria-controls",e);let i=this.#w==="all";t.innerHTML=`
1
+ var Y=window.matchMedia("(prefers-reduced-motion: reduce)");var k=new Map;function x(s,t,e={}){let i=e.priority??10,n={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=k.get(s);if(customElements.get(s)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}k.set(s,n),customElements.define(s,t)}var w=class extends HTMLElement{#n=[];#s;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#n)t();this.#n=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,n){t.addEventListener(e,i,n),this.#n.push(()=>t.removeEventListener(e,i,n))}_reinit(){for(let t of this.#n)t();this.#n=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#s||(this.#s=this.attachInternals());let i=this.#s.states;try{e?i.add(t):i.delete(t)}catch{let n=`--${t}`;e?i.add(n):i.delete(n)}}_adoptInternals(t){this.#s||(this.#s=t)}#e(){return this.constructor.formAssociated&&this.#s?this.#s:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};function I(){let s=globalThis.localStorage;if(!s)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(t){return s.getItem(t)},async setRaw(t,e){s.setItem(t,e)},async removeRaw(t){s.removeItem(t)},async keys(t){let e=[];for(let i=0;i<s.length;i++){let n=s.key(i);n&&n.startsWith(t)&&e.push(n)}return e}}}var v="__vbStoreBackend",A=globalThis;function h(){return A[v]||(A[v]=I()),A[v]}function S(s,t){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof t!="string"||!t)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${s}:${t}`}function C(s){if(typeof s!="string"||!s)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${s}:`}function T(s){try{let t=JSON.parse(s);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var f={configure(s={}){A[v]=s.backend??null},async set(s,t,e){let i={data:e,timestamp:Date.now()};await h().setRaw(S(s,t),JSON.stringify(i))},async get(s,t,e){let i=await h().getRaw(S(s,t));if(i==null)return null;let n=T(i);return!n||e?.maxAge!=null&&Date.now()-n.timestamp>e.maxAge?null:n.data},async remove(s,t){await h().removeRaw(S(s,t))},async list(s){let t=C(s),e=await h().keys(t),i=[];for(let n of e){let r=await h().getRaw(n);if(r==null)continue;let a=T(r);a&&i.push({key:n.slice(t.length),data:a.data,timestamp:a.timestamp})}return i},async clear(s){let t=C(s),e=await h().keys(t);for(let i of e)await h().removeRaw(i)},async clearAll(){let s=await h().keys("vb:");for(let t of s)await h().removeRaw(t)},async setMany(s,t){for(let[e,i]of t)await f.set(s,e,i)}};if(typeof window<"u"){let s=window.VB??(window.VB={});s.store??=f}var m="__vbServiceConfig",g=globalThis,L=()=>({baseUrl:"/go",headers:{},services:{}});g[m]||(g[m]=L());var E=()=>g[m],p=class extends Error{constructor(t,e,i,n){super(`VBService(${i}): ${t} ${n}`),this.name="VBServiceError",this.status=t,this.body=e,this.role=i,this.path=n}};function F(s,t){if(!t)return s;let e=s??new URLSearchParams;for(let[i,n]of Object.entries(t))n!=null&&e.set(i,String(n));return e}async function _(s){if((s.headers.get("content-type")??"").includes("application/json"))try{return await s.json()}catch{return null}try{return await s.text()}catch{return null}}var y=class s{static configure(t={}){let e=E();g[m]={baseUrl:t.baseUrl??e.baseUrl,headers:{...e.headers,...t.headers??{}},services:{...e.services,...t.services??{}}}}static resolve(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");let e=E();return e.services[t]?q(e.services[t]):e.baseUrl?`${q(e.baseUrl)}/${t}`:`/go/${t}`}static _reset(){g[m]=L()}constructor(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");this.role=t}async get(t,e){return this.#n("GET",t,{params:e})}async post(t,e){return this.#n("POST",t,{body:e})}async patch(t,e){return this.#n("PATCH",t,{body:e})}async delete(t){return this.#n("DELETE",t,{})}async#n(t,e,i){let n=s.resolve(this.role),r=e?e.startsWith("/")?e:`/${e}`:"",a=new URL(`${n}${r}`,globalThis.location?.origin??"http://localhost"),c=F(a.searchParams,i.params);c&&(a.search=c.toString());let l={method:t,headers:{...E().headers}};i.body!==void 0&&(l.body=JSON.stringify(i.body),l.headers["content-type"]="application/json");let o=a.toString(),u=await fetch(o,l),b=await _(u);if(!u.ok)throw new p(u.status,b,this.role,`${r||"/"}`);return b}};function q(s){return s.endsWith("/")?s.slice(0,-1):s}if(typeof window<"u"){let s=window.VB??(window.VB={});s.service??=y,s.ServiceError??=p}var V=["position:absolute","inline-size:1px","block-size:1px","padding:0","margin:-1px","overflow:hidden","clip-path:inset(50%)","white-space:nowrap","border:0"].join(";"),P=new WeakMap;function D(s,t){let e=P.get(t);e||P.set(t,e=new Map);let i=e.get(s);if(!i||!i.region.isConnected){let r=(t.ownerDocument||document).createElement("span");r.setAttribute("data-vb-announcer",s),r.setAttribute("role",s==="assertive"?"alert":"status"),r.setAttribute("aria-live",s),r.setAttribute("aria-atomic","true"),r.style.cssText=V,t.appendChild(r),i={region:r},e.set(s,i)}return i}function B(s,{politeness:t="polite",root:e}={}){let i=String(s??"").trim();if(!i||typeof document>"u")return null;let n=e||document.body;if(!n)return null;let a=D(t==="assertive"?"assertive":"polite",n);return clearTimeout(a.write),clearTimeout(a.clear),a.region.textContent="",a.write=setTimeout(()=>{a.region.textContent=i,a.clear=setTimeout(()=>{a.region.textContent=""},7e3)},50),a.region}var O={update:"package",alert:"alert-triangle",watch:"eye",system:"settings",message:"mail",stewardship:"shield"},j={trigger:"Notifications",unread:"{n} unread",title:"Notifications","mark-all":"Mark all read",close:"Close notifications",tabs:"Notification categories",all:"All",watching:"Watching",empty:"No notifications","watch-empty":"You aren\u2019t watching any pages yet. Use the \u201CWatch\u201D button on a page to start.","last-checked":"Last checked: {date}",never:"\u2014",changed:"Changed",unwatch:"Unwatch {title}",new:"New notification",added:"New notification: {title}. {n} unread","variant-info":"Information:","variant-success":"Success:","variant-warning":"Warning:","variant-error":"Error:"};function d(s){return String(s??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function M(s){if(typeof s!="string"||!s.trim())return null;try{let{protocol:t}=new URL(s,location.href);return t==="http:"||t==="https:"?s:null}catch{return null}}function R(s,t){let e=new Date(s);if(Number.isNaN(e.getTime()))return String(s);let n=/^\d{4}-\d{2}-\d{2}$/.test(s)?{dateStyle:"medium",timeZone:"UTC"}:{dateStyle:"medium",timeStyle:"short"};try{return new Intl.DateTimeFormat(t||void 0,n).format(e)}catch{return new Intl.DateTimeFormat(void 0,n).format(e)}}var H=0,$=class extends w{static observedAttributes=["variant","position"];#n="panel";#s=0;#e=null;#p=null;#t=null;#d=null;#r=new Set;#u=[];#a=!1;#f=null;#R=new Set;#E="all";#o=[];#b=[];#m=new Set;#g=!1;#y=!1;#w=null;setup(){let t=++this.#s;return this.#n=this.getAttribute("mode")==="banner"?"banner":"panel",this.#n==="banner"?this.#F(t):(this.#y&&(this.removeAttribute("role"),this.#y=!1),this.#O(t)),!0}teardown(){this.#s++,this.#g=!1,this.#f!=null&&(clearInterval(this.#f),this.#f=null),this.#a&&(this.#a=!1,this.#B(),this.#t&&(this.#t.hidden=!0),this.#e?.setAttribute("aria-expanded","false"))}attributeChangedCallback(t,e,i){e===i||this.#n!=="banner"||!this.hasAttribute("data-upgraded")||(t==="variant"&&(this.dataset.variant=i||"info",this.#x(),this.#k()),t==="position"&&(this.dataset.position=i||"top"))}#c(t){return t===this.#s&&this.isConnected}#i(t,e={}){let i=this.getAttribute(`data-label-${t}`)??j[t]??t;for(let[n,r]of Object.entries(e))i=i.replaceAll(`{${n}}`,String(r));return i}#I(){let t=(this.getAttribute("toast-new")||"").trim(),e=null;if(t){try{e=document.querySelector(t)}catch{e=null}e&&e.localName!=="toast-msg"&&(e=null)}return e??document.querySelector("toast-msg")}#$(){return this.closest("[lang]")?.lang||document.documentElement.lang||void 0}get notifications(){return[...this.#u]}set notifications(t){this.#n==="panel"&&(this.#u=Array.isArray(t)?t:[],this.#h(),this.dispatchEvent(new CustomEvent("notification-wc:notifications-changed",{detail:{notifications:this.#u,source:"property"},bubbles:!0})))}async#F(t){let e=this.getAttribute("persist");if(e||console.warn("[notification-wc] banner mode requires a persist attribute"),this.dataset.mode="banner",this.dataset.variant=this.getAttribute("variant")||"info",this.dataset.position=this.getAttribute("position")||"top",this.#x(),this.#k(),this.listen(this,"focusin",this.#V),e){let n=Number(this.getAttribute("expires")??""),r=Number.isFinite(n)&&n>0?n*864e5:void 0,a=await f.get("notifications",e,r?{maxAge:r}:void 0);if(!this.#c(t))return;if(a&&a.dismissed){this.hidden=!0;return}}let i=this.querySelector('[value="dismiss"], [data-dismiss]');i&&this.listen(i,"click",this.#_)}#k(){this.setAttribute("role",this.dataset.variant==="error"?"alert":"status"),this.#y=!0}#x(){let t=this.dataset.variant||"info",e=this.querySelector(":scope [data-variant-prefix]");e||(e=document.createElement("span"),e.className="visually-hidden",e.setAttribute("data-variant-prefix",""),(this.querySelector(":scope > :is(p, strong, span, h2, h3, h4)")||this).prepend(e)),e.textContent=`${this.#i(`variant-${t}`)} `}#_=async t=>{t.preventDefault();let e=this.contains(document.activeElement),i=this.getAttribute("persist");this.hidden=!0,e&&this.#D(),i&&await f.set("notifications",i,{dismissed:!0}),this.dispatchEvent(new CustomEvent("notification-wc:dismiss",{bubbles:!0,composed:!0,detail:{id:i}}))};#V=t=>{let e=t.relatedTarget;e&&!this.contains(e)&&(this.#w=e)};#D(){let t=c=>!!c?.isConnected&&(typeof c.checkVisibility!="function"||c.checkVisibility()),e=[...document.querySelectorAll('notification-wc[mode="banner"]')],i=e.indexOf(this),n=[...e.slice(i+1),...e.slice(0,i).reverse()];for(let c of n){if(!t(c))continue;let l=c.querySelector("a[href], button:not([disabled])");if(l&&(l.focus({preventScroll:!0}),document.activeElement===l))return}let r=this.#w;if(this.#w=null,t(r)&&(r.focus({preventScroll:!0}),document.activeElement===r))return;let a=document.querySelector('main, [role="main"]')||document.querySelector("h1");a&&(a.hasAttribute("tabindex")||(a.setAttribute("tabindex","-1"),a.addEventListener("blur",()=>a.removeAttribute("tabindex"),{once:!0})),a.focus({preventScroll:!0}))}async#O(t){if(this.dataset.mode="panel",this.listen(document,"notification-wc:new",this.#Y),await this.#j(),!!this.#c(t)&&(this.#H(),this.#U(),this.listen(document,"click",this.#Z),this.listen(this,"keydown",this.#et),this.listen(this,"focusout",this.#tt),this.listen(document,"page-watch:add",this.#L),this.listen(document,"page-watch:remove",this.#L),await this.#A(),!!this.#c(t))){if(this.getAttribute("src")){if(await this.#M(t),!this.#c(t))return;let e=Number(this.getAttribute("poll"));Number.isFinite(e)&&e>0&&(this.#f=setInterval(()=>this.#M(t),e))}this.#g=!0}}async#j(){let t=this.getAttribute("storage-key")||"notifications",e=await f.get(t,"read-ids");Array.isArray(e)&&(this.#r=new Set(e.filter(i=>typeof i=="string")))}async#C(){let t=this.getAttribute("storage-key")||"notifications";await f.set(t,"read-ids",Array.from(this.#r))}#H(){if(this.#e=this.querySelector(":scope > [data-trigger]"),this.#e){if(!this.#e.classList.contains("notification-trigger")&&this.#p===null){let e=this.#e.cloneNode(!0);e.querySelector(".notification-badge")?.remove(),this.#p=(this.#e.getAttribute("aria-label")||e.textContent||"").trim()}}else{let e=document.createElement("button");e.type="button",e.setAttribute("data-trigger",""),e.className="notification-trigger",e.innerHTML='<icon-wc name="bell" size="sm" aria-hidden="true"></icon-wc><span class="notification-badge" aria-hidden="true" hidden>0</span>',this.#e=e,this.prepend(e)}let t=this.#e.querySelector(".notification-badge");t||(t=document.createElement("span"),t.className="notification-badge",t.setAttribute("aria-hidden","true"),t.hidden=!0,this.#e.appendChild(t)),this.#d=t,this.#e.setAttribute("aria-haspopup","dialog"),this.#e.setAttribute("aria-expanded","false"),this.listen(this.#e,"click",this.#N)}#U(){let t=this.querySelector(":scope > .notification-panel");t||(t=document.createElement("div"),t.className="notification-panel",t.id=`notification-panel-${++H}-${Math.random().toString(36).slice(2,7)}`,this.appendChild(t)),this.#t=t;let e=t.id;t.setAttribute("role","dialog"),t.setAttribute("aria-labelledby",`${e}-title`),t.tabIndex=-1,t.hidden=!0,this.#e?.setAttribute("aria-controls",e);let i=this.#E==="all";t.innerHTML=`
2
2
  <header class="notification-header">
3
- <strong id="${e}-title">${c(this.#i("title"))}</strong>
4
- <button type="button" class="notification-mark-all">${c(this.#i("mark-all"))}</button>
5
- <button type="button" class="notification-close" aria-label="${c(this.#i("close"))}"><icon-wc name="x" size="sm" aria-hidden="true"></icon-wc></button>
3
+ <strong id="${e}-title">${d(this.#i("title"))}</strong>
4
+ <button type="button" class="notification-mark-all">${d(this.#i("mark-all"))}</button>
5
+ <button type="button" class="notification-close" aria-label="${d(this.#i("close"))}"><icon-wc name="x" size="sm" aria-hidden="true"></icon-wc></button>
6
6
  </header>
7
- <div class="notification-tabs" role="tablist" aria-label="${c(this.#i("tabs"))}">
8
- <button type="button" role="tab" id="${e}-tab-all" data-tab="all" aria-controls="${e}-all" aria-selected="${i}" tabindex="${i?0:-1}">${c(this.#i("all"))}</button>
9
- <button type="button" role="tab" id="${e}-tab-watching" data-tab="watching" aria-controls="${e}-watching" aria-selected="${!i}" tabindex="${i?-1:0}">${c(this.#i("watching"))} <span class="notification-tab-count" hidden>0</span></button>
7
+ <div class="notification-tabs" role="tablist" aria-label="${d(this.#i("tabs"))}">
8
+ <button type="button" role="tab" id="${e}-tab-all" data-tab="all" aria-controls="${e}-all" aria-selected="${i}" tabindex="${i?0:-1}">${d(this.#i("all"))}</button>
9
+ <button type="button" role="tab" id="${e}-tab-watching" data-tab="watching" aria-controls="${e}-watching" aria-selected="${!i}" tabindex="${i?-1:0}">${d(this.#i("watching"))} <span class="notification-tab-count" hidden>0</span></button>
10
10
  </div>
11
11
  <div class="notification-tabpanel" role="tabpanel" id="${e}-all" aria-labelledby="${e}-tab-all" data-tab-panel="all"${i?"":" hidden"}>
12
12
  <ul class="notification-list" role="list"></ul>
13
- <p class="notification-footer" hidden><em>${c(this.#i("empty"))}</em></p>
13
+ <p class="notification-footer" hidden><em>${d(this.#i("empty"))}</em></p>
14
14
  </div>
15
15
  <div class="notification-tabpanel" role="tabpanel" id="${e}-watching" aria-labelledby="${e}-tab-watching" data-tab-panel="watching"${i?" hidden":""}>
16
16
  <ul class="notification-watch-list" role="list"></ul>
17
17
  </div>
18
- `,this.listen(t,"click",this.#U),this.listen(t,"keydown",this.#F),this.#u(),this.#g()}#m(){let t=Array.from(this.querySelectorAll(":scope > article")),e=new Map;for(let i of t){let s=i.getAttribute("data-id")||i.id||`static-${e.size}`,a=i.getAttribute("data-type")||"update",o=i.getAttribute("data-date")||"",l=i.querySelector("h1, h2, h3, h4, h5, h6")?.textContent?.trim()||s,r=i.querySelector("p")?.textContent?.trim()||"",h=i.querySelector("a");e.set(s,{id:s,type:a,date:o,title:l,body:r,url:h?.getAttribute("href")||null,source:"static"})}for(let i of[...this.#b,...this.#h])if(!(!i||typeof i.id!="string")){if(i.dismissed){e.delete(i.id);continue}e.set(i.id,{...e.get(i.id),...i,source:"dynamic"})}return Array.from(e.values()).sort((i,s)=>{let a=i.date&&Date.parse(i.date)||0;return(s.date&&Date.parse(s.date)||0)-a})}#u(){if(!this.#t)return;let t=this.#t.querySelector(".notification-list"),e=this.#t.querySelector(".notification-footer");if(!t)return;let i=this.#m(),s=this.#v();t.innerHTML=i.map(a=>this.#V(a,s)).join(""),e&&(e.hidden=i.length>0),this.#S(i)}#V(t,e){let i=R[t.type]||"bell",s=this.#r.has(t.id),a=t.date?M(t.date,e):"",o=`
19
- <icon-wc class="notification-type-icon" name="${c(i)}" size="sm" aria-hidden="true"></icon-wc>
18
+ `,this.listen(t,"click",this.#J),this.listen(t,"keydown",this.#X),this.#h(),this.#S()}#v(){let t=Array.from(this.querySelectorAll(":scope > article")),e=new Map;for(let i of t){let n=i.getAttribute("data-id")||i.id||`static-${e.size}`,r=i.getAttribute("data-type")||"update",a=i.getAttribute("data-date")||"",c=i.querySelector("h1, h2, h3, h4, h5, h6")?.textContent?.trim()||n,o=i.querySelector("p")?.textContent?.trim()||"",u=i.querySelector("a");e.set(n,{id:n,type:r,date:a,title:c,body:o,url:u?.getAttribute("href")||null,source:"static"})}for(let i of[...this.#b,...this.#u])if(!(!i||typeof i.id!="string")){if(i.dismissed){e.delete(i.id);continue}e.set(i.id,{...e.get(i.id),...i,source:"dynamic"})}return Array.from(e.values()).sort((i,n)=>{let r=i.date&&Date.parse(i.date)||0;return(n.date&&Date.parse(n.date)||0)-r})}#h(){if(!this.#t)return;let t=this.#t.querySelector(".notification-list"),e=this.#t.querySelector(".notification-footer");if(!t)return;let i=this.#v(),n=this.#$(),r=this.#T(t,a=>a.getAttribute("data-notification-id"));t.innerHTML=i.map(a=>this.#z(a,n)).join(""),r(),e&&(e.hidden=i.length>0),this.#q(i),this.#W(i)}#W(t){let e=t.filter(r=>!this.#m.has(r.id));for(let r of e)this.#m.add(r.id);if(!this.#g)return;let i=e.find(r=>!this.#r.has(r.id));if(!i)return;let n=t.filter(r=>!this.#r.has(r.id)).length;B(this.#i("added",{title:i.title||this.#i("new"),n}))}#T(t,e){let i=document.activeElement,n=i&&t.contains(i)?i.closest("li"):null;if(!i||!n)return()=>{};let r=e(n),a=[...t.children].indexOf(n),c=i.matches("[data-watch-unwatch]")?"[data-watch-unwatch]":"a, button";return()=>{let l=[...t.children],o=r!=null&&l.find(b=>e(b)===r)||l[Math.min(a,l.length-1)];(o?.querySelector(c)??o?.querySelector("a, button")??this.#t)?.focus({preventScroll:!0})}}#z(t,e){let i=O[t.type]||"bell",n=this.#r.has(t.id),r=t.date?R(t.date,e):"",a=`
19
+ <icon-wc class="notification-type-icon" name="${d(i)}" size="sm" aria-hidden="true"></icon-wc>
20
20
  <span class="notification-body">
21
- <strong class="notification-title">${c(t.title)}</strong>
22
- ${t.body?`<span class="notification-text">${c(t.body)}</span>`:""}
23
- ${a?`<time datetime="${c(t.date)}">${c(a)}</time>`:""}
21
+ <strong class="notification-title">${d(t.title)}</strong>
22
+ ${t.body?`<span class="notification-text">${d(t.body)}</span>`:""}
23
+ ${r?`<time datetime="${d(t.date)}">${d(r)}</time>`:""}
24
24
  </span>
25
- `,l=B(t.url),d=l?"a":"button",r=l?`href="${c(l)}"`:'type="button"';return`<li data-notification-id="${c(t.id)}" data-type="${c(t.type||"update")}"${s?" data-read":""}>
26
- <${d} class="notification-row" ${r}>${o}</${d}>
27
- </li>`}#S(t=this.#m()){if(!this.#d||!this.#e)return;let e=t.filter(a=>!this.#r.has(a.id)).length,i=this.#e.querySelector("icon-wc");e>0?(this.#d.textContent=String(e),this.#d.hidden=!1,i?.setAttribute("name","bell-dot"),this.setAttribute("data-unread",String(e))):(this.#d.hidden=!0,i?.setAttribute("name","bell"),this.removeAttribute("data-unread"));let s=this.#p||this.#i("trigger");this.#e.setAttribute("aria-label",e>0?`${s}, ${this.#i("unread",{n:e})}`:s)}#D=t=>{if(t.target instanceof Element&&t.target.localName==="notification-wc")return;let e=t.detail?.notification;!e||typeof e.id!="string"||this.#b.some(i=>i.id===e.id)||(this.#b.push(e),this.#u())};#E=()=>{this.#y()};async#y(){let t=this.#n,e;try{e=await f.list("watches")}catch{e=[]}this.#c(t)&&(this.#o=Array.isArray(e)?e:[],this.#g())}#g(){if(!this.#t)return;let t=this.#t.querySelector(".notification-watch-list"),e=this.#t.querySelector(".notification-tab-count");if(!t)return;let i=this.#v();if(t.innerHTML=this.#o.map(s=>this.#O(s,i)).join("")||`<li class="notification-empty"><em>${c(this.#i("watch-empty"))}</em></li>`,e){let s=this.#o.length;e.textContent=String(s),e.hidden=s===0}}#O(t,e){let i=t.data||{},s=i.url||t.key,a=i.title||s,o=i.lastChecked?M(i.lastChecked,e):this.#i("never"),l=!!i.lastChanged,d=B(s),r=`
25
+ `,c=M(t.url),l=c?"a":"button",o=c?`href="${d(c)}"`:'type="button"';return`<li data-notification-id="${d(t.id)}" data-type="${d(t.type||"update")}"${n?" data-read":""}>
26
+ <${l} class="notification-row" ${o}>${a}</${l}>
27
+ </li>`}#q(t=this.#v()){if(!this.#d||!this.#e)return;let e=t.filter(r=>!this.#r.has(r.id)).length,i=this.#e.querySelector("icon-wc");e>0?(this.#d.textContent=String(e),this.#d.hidden=!1,i?.setAttribute("name","bell-dot"),this.setAttribute("data-unread",String(e))):(this.#d.hidden=!0,i?.setAttribute("name","bell"),this.removeAttribute("data-unread"));let n=this.#p||this.#i("trigger");this.#e.setAttribute("aria-label",e>0?`${n}, ${this.#i("unread",{n:e})}`:n)}#Y=t=>{if(t.target instanceof Element&&t.target.localName==="notification-wc")return;let e=t.detail?.notification;!e||typeof e.id!="string"||this.#b.some(i=>i.id===e.id)||(this.#b.push(e),this.#h())};#L=()=>{this.#A()};async#A(){let t=this.#s,e;try{e=await f.list("watches")}catch{e=[]}this.#c(t)&&(this.#o=Array.isArray(e)?e:[],this.#S())}#S(){if(!this.#t)return;let t=this.#t.querySelector(".notification-watch-list"),e=this.#t.querySelector(".notification-tab-count");if(!t)return;let i=this.#$(),n=this.#T(t,r=>r.querySelector("[data-watch-key]")?.getAttribute("data-watch-key"));if(t.innerHTML=this.#o.map(r=>this.#K(r,i)).join("")||`<li class="notification-empty"><em>${d(this.#i("watch-empty"))}</em></li>`,n(),e){let r=this.#o.length;e.textContent=String(r),e.hidden=r===0}}#K(t,e){let i=t.data||{},n=i.url||t.key,r=i.title||n,a=i.lastChecked?R(i.lastChecked,e):this.#i("never"),c=!!i.lastChanged,l=M(n),o=`
28
28
  <icon-wc class="notification-type-icon" name="eye" size="sm" aria-hidden="true"></icon-wc>
29
29
  <span class="notification-body">
30
- <strong class="notification-title">${c(a)}${l?` <span class="notification-changed-badge">${c(this.#i("changed"))}</span>`:""}</strong>
31
- <span class="notification-text">${c(s)}</span>
32
- <time>${c(this.#i("last-checked",{date:o}))}</time>
33
- </span>`,h=d?`<a class="notification-watch-row" href="${c(d)}">${r}</a>`:`<span class="notification-watch-row">${r}</span>`;return`<li class="notification-watch-item"${l?" data-changed":""}>
34
- ${h}
35
- <button type="button" class="notification-unwatch" data-watch-unwatch data-watch-key="${c(t.key)}" aria-label="${c(this.#i("unwatch",{title:a}))}">
30
+ <strong class="notification-title">${d(r)}${c?` <span class="notification-changed-badge">${d(this.#i("changed"))}</span>`:""}</strong>
31
+ <span class="notification-text">${d(n)}</span>
32
+ <time>${d(this.#i("last-checked",{date:a}))}</time>
33
+ </span>`,u=l?`<a class="notification-watch-row" href="${d(l)}">${o}</a>`:`<span class="notification-watch-row">${o}</span>`;return`<li class="notification-watch-item"${c?" data-changed":""}>
34
+ ${u}
35
+ <button type="button" class="notification-unwatch" data-watch-unwatch data-watch-key="${d(t.key)}" aria-label="${d(this.#i("unwatch",{title:r}))}">
36
36
  <icon-wc name="x" size="xs" aria-hidden="true"></icon-wc>
37
37
  </button>
38
- </li>`}#k(t,{focus:e=!1}={}){if(this.#t){this.#w=t;for(let i of this.#t.querySelectorAll('[role="tab"]')){let s=i.dataset.tab===t;i.setAttribute("aria-selected",s?"true":"false"),i.setAttribute("tabindex",s?"0":"-1"),s&&e&&i.focus()}for(let i of this.#t.querySelectorAll("[data-tab-panel]"))i.hidden=i.dataset.tabPanel!==t}}#F=t=>{let e=t.target.closest?.('[role="tab"]');if(!e||!this.#t)return;let i=[...this.#t.querySelectorAll('[role="tab"]')],s=i.indexOf(e),a=getComputedStyle(this.#t).direction==="rtl",o=-1;if(t.key==="ArrowRight")o=a?s-1:s+1;else if(t.key==="ArrowLeft")o=a?s+1:s-1;else if(t.key==="Home")o=0;else if(t.key==="End")o=i.length-1;else return;t.preventDefault(),o=(o+i.length)%i.length;let l=i[o].dataset.tab;l&&this.#k(l,{focus:!0})};#U=t=>{let e=t.target,i=e.closest('[role="tab"]');if(i?.dataset.tab){this.#k(i.dataset.tab);return}if(e.closest(".notification-mark-all")){this.#Y();return}if(e.closest(".notification-close")){this.#l({restoreFocus:!0});return}let s=e.closest("[data-watch-unwatch]");if(s){this.#j(t,s);return}let a=e.closest(".notification-list .notification-row");a&&this.#X(a)};async#j(t,e){t.preventDefault(),t.stopPropagation();let i=e.getAttribute("data-watch-key");if(!i||!this.#t)return;let a=[...this.#t.querySelectorAll("[data-watch-unwatch]")].indexOf(e),o=this.#o.find(r=>r.key===i);await f.remove("watches",i),this.#o=this.#o.filter(r=>r.key!==i),this.#g();let l=[...this.#t.querySelectorAll("[data-watch-unwatch]")];(l[Math.min(a,l.length-1)]||this.#t.querySelector('[role="tab"][data-tab="watching"]'))?.focus(),this.dispatchEvent(new CustomEvent("page-watch:remove",{bubbles:!0,composed:!0,detail:{url:o?.data?.url||i,subscriptionId:o?.data?.subscriptionId||null}}))}#_=t=>{t.stopPropagation(),this.#a?this.#l():this.#J()};#W=t=>{if(this.#a){if(!this.contains(t.target)){this.#l();return}if(t.target===this.#t&&this.#t?.matches(":popover-open")){let e=this.#t.getBoundingClientRect(),{clientX:i,clientY:s}=t;(i<e.left||i>e.right||s<e.top||s>e.bottom)&&this.#l({restoreFocus:!0})}}};#H(){return!!this.closest("[popover]")||matchMedia("(width < 37.5rem)").matches}#z=t=>{let e=t.relatedTarget;this.#a&&e&&!this.contains(e)&&this.#l()};#K=t=>{t.key==="Escape"&&this.#a&&(t.preventDefault(),this.#l({restoreFocus:!0}))};async#X(t){let e=t.closest("[data-notification-id]"),i=e?.getAttribute("data-notification-id");!e||!i||this.#r.has(i)||(this.#r.add(i),e.setAttribute("data-read",""),this.#S(),this.dispatchEvent(new CustomEvent("notification-wc:read",{bubbles:!0,composed:!0,detail:{id:i}})),await this.#A())}async#Y(){let t=this.#m();for(let e of t)this.#r.add(e.id);this.#u();for(let e of t)this.dispatchEvent(new CustomEvent("notification-wc:read",{bubbles:!0,composed:!0,detail:{id:e.id}}));await this.#A()}#J(){this.#t&&(this.#a=!0,this.#t.hidden=!1,this.#H()&&typeof this.#t.showPopover=="function"&&(this.#t.setAttribute("popover","manual"),this.#t.showPopover()),this.#e?.setAttribute("aria-expanded","true"),this.#t.focus({preventScroll:!0}),this.#y(),this.dispatchEvent(new CustomEvent("notification-wc:open",{bubbles:!0,composed:!0})))}#l({restoreFocus:t=!1}={}){if(!this.#t)return;let e=this.#t.contains(document.activeElement);this.#a=!1,this.#x(),this.#t.hidden=!0,this.#e?.setAttribute("aria-expanded","false"),(t||e)&&this.#e?.focus(),this.dispatchEvent(new CustomEvent("notification-wc:close",{bubbles:!0,composed:!0}))}#x(){let t=this.#t;t?.hasAttribute("popover")&&(t.matches(":popover-open")&&t.hidePopover(),t.removeAttribute("popover"))}async#C(t){let e=this.getAttribute("src");if(!e)return;let i,s=0;try{if(e.startsWith("http")||e.startsWith("/")){let r=await fetch(e,{headers:{accept:"application/json"}});if(s=r.status,!r.ok)throw new Error(`${r.status}`);i=await r.json()}else i=await new y(e).get("/")}catch(r){let h=r instanceof p?r.status:s;if(h===404||h===503)return;let g=r instanceof p?`${r.status}`:String(r);console.warn("[notification-wc] failed to fetch",e,g);return}if(!this.#c(t))return;let a=Array.isArray(i)?i:Array.isArray(i?.notifications)?i.notifications:[],o=this.#T,l=o.size===0,d=this.hasAttribute("toast-new")?this.#q():null;for(let r of a)r?.id&&(o.has(r.id)||(this.dispatchEvent(new CustomEvent("notification-wc:new",{bubbles:!0,composed:!0,detail:{notification:r}})),!l&&d&&typeof d.show=="function"&&d.show({message:r.title||r.body||this.#i("new"),variant:r.type==="alert"||r.type==="stewardship"?"warning":"info",duration:5e3})),o.add(r.id));this.#h=a,this.#u()}};x("notification-wc",E);export{E as NotificationWc};
38
+ </li>`}#P(t,{focus:e=!1}={}){if(this.#t){this.#E=t;for(let i of this.#t.querySelectorAll('[role="tab"]')){let n=i.dataset.tab===t;i.setAttribute("aria-selected",n?"true":"false"),i.setAttribute("tabindex",n?"0":"-1"),n&&e&&i.focus()}for(let i of this.#t.querySelectorAll("[data-tab-panel]"))i.hidden=i.dataset.tabPanel!==t}}#X=t=>{let e=t.target.closest?.('[role="tab"]');if(!e||!this.#t)return;let i=[...this.#t.querySelectorAll('[role="tab"]')],n=i.indexOf(e),r=getComputedStyle(this.#t).direction==="rtl",a=-1;if(t.key==="ArrowRight")a=r?n-1:n+1;else if(t.key==="ArrowLeft")a=r?n+1:n-1;else if(t.key==="Home")a=0;else if(t.key==="End")a=i.length-1;else return;t.preventDefault(),a=(a+i.length)%i.length;let c=i[a].dataset.tab;c&&this.#P(c,{focus:!0})};#J=t=>{let e=t.target,i=e.closest('[role="tab"]');if(i?.dataset.tab){this.#P(i.dataset.tab);return}if(e.closest(".notification-mark-all")){this.#nt();return}if(e.closest(".notification-close")){this.#l({restoreFocus:!0});return}let n=e.closest("[data-watch-unwatch]");if(n){this.#G(t,n);return}let r=e.closest(".notification-list .notification-row");r&&this.#it(r)};async#G(t,e){t.preventDefault(),t.stopPropagation();let i=e.getAttribute("data-watch-key");if(!i||!this.#t)return;let r=[...this.#t.querySelectorAll("[data-watch-unwatch]")].indexOf(e),a=this.#o.find(o=>o.key===i);await f.remove("watches",i),this.#o=this.#o.filter(o=>o.key!==i),this.#S();let c=[...this.#t.querySelectorAll("[data-watch-unwatch]")];(c[Math.min(r,c.length-1)]||this.#t.querySelector('[role="tab"][data-tab="watching"]'))?.focus(),this.dispatchEvent(new CustomEvent("page-watch:remove",{bubbles:!0,composed:!0,detail:{url:a?.data?.url||i,subscriptionId:a?.data?.subscriptionId||null}}))}#N=t=>{t.stopPropagation(),this.#a?this.#l():this.#st()};#Z=t=>{if(this.#a){if(!this.contains(t.target)){this.#l();return}if(t.target===this.#t&&this.#t?.matches(":popover-open")){let e=this.#t.getBoundingClientRect(),{clientX:i,clientY:n}=t;(i<e.left||i>e.right||n<e.top||n>e.bottom)&&this.#l({restoreFocus:!0})}}};#Q(){return!!this.closest("[popover]")||matchMedia("(width < 37.5rem)").matches}#tt=t=>{let e=t.relatedTarget;this.#a&&e&&!this.contains(e)&&this.#l()};#et=t=>{t.key==="Escape"&&!t.defaultPrevented&&this.#a&&(t.preventDefault(),this.#l({restoreFocus:!0}))};async#it(t){let e=t.closest("[data-notification-id]"),i=e?.getAttribute("data-notification-id");!e||!i||this.#r.has(i)||(this.#r.add(i),e.setAttribute("data-read",""),this.#q(),this.dispatchEvent(new CustomEvent("notification-wc:read",{bubbles:!0,composed:!0,detail:{id:i}})),await this.#C())}async#nt(){let t=this.#v();for(let e of t)this.#r.add(e.id);this.#h();for(let e of t)this.dispatchEvent(new CustomEvent("notification-wc:read",{bubbles:!0,composed:!0,detail:{id:e.id}}));await this.#C()}#st(){this.#t&&(this.#a=!0,this.#t.hidden=!1,this.#Q()&&typeof this.#t.showPopover=="function"&&(this.#t.setAttribute("popover","manual"),this.#t.showPopover()),this.#e?.setAttribute("aria-expanded","true"),this.#t.focus({preventScroll:!0}),this.#A(),this.dispatchEvent(new CustomEvent("notification-wc:open",{bubbles:!0,composed:!0})))}#l({restoreFocus:t=!1}={}){if(!this.#t)return;let e=this.#t.contains(document.activeElement);this.#a=!1,this.#B(),this.#t.hidden=!0,this.#e?.setAttribute("aria-expanded","false"),(t||e)&&this.#e?.focus(),this.dispatchEvent(new CustomEvent("notification-wc:close",{bubbles:!0,composed:!0}))}#B(){let t=this.#t;t?.hasAttribute("popover")&&(t.matches(":popover-open")&&t.hidePopover(),t.removeAttribute("popover"))}async#M(t){let e=this.getAttribute("src");if(!e)return;let i,n=0;try{if(e.startsWith("http")||e.startsWith("/")){let o=await fetch(e,{headers:{accept:"application/json"}});if(n=o.status,!o.ok)throw new Error(`${o.status}`);i=await o.json()}else i=await new y(e).get("/")}catch(o){let u=o instanceof p?o.status:n;if(u===404||u===503)return;let b=o instanceof p?`${o.status}`:String(o);console.warn("[notification-wc] failed to fetch",e,b);return}if(!this.#c(t))return;let r=Array.isArray(i)?i:Array.isArray(i?.notifications)?i.notifications:[],a=this.#R,c=a.size===0,l=this.hasAttribute("toast-new")?this.#I():null;for(let o of r)o?.id&&(a.has(o.id)||(this.dispatchEvent(new CustomEvent("notification-wc:new",{bubbles:!0,composed:!0,detail:{notification:o}})),!c&&l&&typeof l.show=="function"&&(l.show({message:o.title||o.body||this.#i("new"),variant:o.type==="alert"||o.type==="stewardship"?"warning":"info",duration:5e3}),this.#m.add(o.id))),a.add(o.id));this.#u=r,this.#h()}};x("notification-wc",$);export{$ as NotificationWc};
39
39
  //# sourceMappingURL=notification-wc.js.map
@@ -1,10 +1,10 @@
1
- var Ce=window.matchMedia("(prefers-reduced-motion: reduce)");var _=new Map;function B(t,e,n={}){let r=n.priority??10,i={impl:e,bundle:n.bundle,contract:n.contract,priority:r},o=_.get(t);if(customElements.get(t)){if(!o||o.priority>=r){o&&o.priority===r&&o.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=r){o.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${o.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}_.set(t,i),customElements.define(t,e)}var T=class extends HTMLElement{#n=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#n)e();this.#n=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,r,i){e.addEventListener(n,r,i),this.#n.push(()=>e.removeEventListener(n,r,i))}_reinit(){for(let e of this.#n)e();this.#n=[],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)}#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 ue="https://vanilla-breeze.com/specs/canonical-document-v1",le=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT","NAV","ASIDE","HEADER","FOOTER","FIGCAPTION","PAGE-INFO","CHANGE-SET","PAGE-TOC","PAGE-TOOLS","PAGE-STATS","CONTENT-LENS","BUTTON","DIALOG","MENU","FORM","DEL"]),de=new Set(["ARTICLE","SECTION","ASIDE","NAV","HEADER","FOOTER","DIV","MAIN","HGROUP","H1","H2","H3","H4","H5","H6","P","BLOCKQUOTE","PRE","HR","OL","UL","LI","DL","DT","DD","TABLE","THEAD","TBODY","TFOOT","TR","TD","TH","CAPTION","FIGURE","DETAILS","SUMMARY","ADDRESS","FORM","FIELDSET","LEGEND"]),fe=new Set(["PRE","TEXTAREA"]);function he(t){return!t||t.nodeType!==1?!1:!!(le.has(t.tagName)||t.hasAttribute("hidden")||t.getAttribute("aria-hidden")==="true"||t.getAttribute("data-signable")==="false")}function j(t,e,n){if(he(t))return;let r=de.has(t.tagName),i=n||fe.has(t.tagName);for(let o of t.childNodes)if(o.nodeType===3){let s=o.nodeValue||"";if(!s)continue;if(i)G(e,s.normalize("NFC"));else{let a=s.normalize("NFC").replace(/\s+/g," ");if(a===""||a===" "&&(e.text===""||e.text.endsWith(" ")||e.text.endsWith(`
2
- `)))continue;G(e,a)}}else if(o.nodeType===1){if(o.tagName==="BR"){O(e,`
3
- `);continue}j(o,e,i)}r&&O(e,`
1
+ var He=window.matchMedia("(prefers-reduced-motion: reduce)");var G=new Map;function N(t,e,n={}){let r=n.priority??10,o={impl:e,bundle:n.bundle,contract:n.contract,priority:r},i=G.get(t);if(customElements.get(t)){if(!i||i.priority>=r){i&&i.priority===r&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=r){i.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${i.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}G.set(t,o),customElements.define(t,e)}var $=class extends HTMLElement{#n=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#n)e();this.#n=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,r,o){e.addEventListener(n,r,o),this.#n.push(()=>e.removeEventListener(n,r,o))}_reinit(){for(let e of this.#n)e();this.#n=[],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 o=`--${e}`;n?r.add(o):r.delete(o)}}_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 fe="https://vanilla-breeze.com/specs/canonical-document-v1",he=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT","NAV","ASIDE","HEADER","FOOTER","FIGCAPTION","PAGE-INFO","PAGE-TOC","PAGE-TOOLS","PAGE-STATS","CONTENT-LENS","BUTTON","DIALOG","MENU","FORM","DEL"]),pe=["data-change-caption","data-controls"],me=new Set(["ARTICLE","SECTION","ASIDE","NAV","HEADER","FOOTER","DIV","MAIN","HGROUP","H1","H2","H3","H4","H5","H6","P","BLOCKQUOTE","PRE","HR","OL","UL","LI","DL","DT","DD","TABLE","THEAD","TBODY","TFOOT","TR","TD","TH","CAPTION","FIGURE","DETAILS","SUMMARY","ADDRESS","FORM","FIELDSET","LEGEND"]),be=new Set(["PRE","TEXTAREA"]);function ge(t){return!t||t.nodeType!==1?!1:!!(he.has(t.tagName)||t.hasAttribute("hidden")||t.getAttribute("aria-hidden")==="true"||t.getAttribute("data-signable")==="false"||t.parentNode?.tagName==="CHANGE-SET"&&pe.some(e=>t.hasAttribute(e)))}function W(t,e,n){if(ge(t))return;let r=me.has(t.tagName),o=n||be.has(t.tagName);for(let i of t.childNodes)if(i.nodeType===3){let s=i.nodeValue||"";if(!s)continue;if(o)j(e,s.normalize("NFC"));else{let a=s.normalize("NFC").replace(/\s+/g," ");if(a===""||a===" "&&(e.text===""||e.text.endsWith(" ")||e.text.endsWith(`
2
+ `)))continue;j(e,a)}}else if(i.nodeType===1){if(i.tagName==="BR"){_(e,`
3
+ `);continue}W(i,e,o)}r&&_(e,`
4
4
 
5
- `),t.tagName==="HR"&&O(e,`
5
+ `),t.tagName==="HR"&&_(e,`
6
6
 
7
- `)}function G(t,e){t.text+=e}function O(t,e){if(!t.text.endsWith(e)){if(e===`
7
+ `)}function j(t,e){t.text+=e}function _(t,e){if(!t.text.endsWith(e)){if(e===`
8
8
 
9
9
  `&&t.text.endsWith(`
10
10
  `)){t.text=t.text.replace(/\n+$/,"")+`
@@ -12,5 +12,5 @@ var Ce=window.matchMedia("(prefers-reduced-motion: reduce)");var _=new Map;funct
12
12
  `;return}e===`
13
13
  `&&t.text.endsWith(`
14
14
 
15
- `)||(t.text+=e)}}function pe(t){let e=[...t.querySelectorAll("[data-signable]")],n=e.filter(i=>!e.some(o=>o!==i&&o.contains(i))),r={text:""};for(let i of n)j(i,r,!1);return r.text.replace(/^\s+/,"").replace(/\s+$/,"")}function m(t,e){return t.querySelector(`meta[name="${k(e)}"]`)?.getAttribute("content")||""}function C(t,e){return t.querySelector(`meta[property="${k(e)}"]`)?.getAttribute("content")||""}function me(t,e){return t.querySelector(`meta[itemprop="${k(e)}"]`)?.getAttribute("content")||""}function K(t,e){return t.querySelector(`link[rel~="${k(e)}" i]`)?.getAttribute("href")||""}function k(t){return String(t).replace(/[^a-zA-Z0-9:_\-/]/g,"")}function ge(t){if(!t)return"";let e=String(t).trim();try{let n=new URL(e);n.search="",n.hash="";let r=`${n.protocol}//${n.hostname.toLowerCase()}`;return n.port&&(r+=`:${n.port}`),r+=n.pathname,r}catch{return e.replace(/[?#].*$/,"")}}function z(t){return t?.querySelector?.('link[rel~="canonical" i]')?.getAttribute("href")?.trim()||""}function W(t){if(!t)return"";let e=String(t).match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:""}function be(t){return C(t,"og:title")||t.title||""}function ye(t){let e=m(t,"keywords");return e?e.split(",").map(n=>n.trim()).filter(Boolean):[]}function Ae(t){let e=new Set;for(let n of t.querySelectorAll('meta[name="concept"]')){let r=(n.getAttribute("content")||"").trim();r&&e.add(r)}return[...e].sort()}function ve(t){return K(t,"license")||m(t,"license")}function Y(t,e={}){let n=e.url??t?.location?.href??"",r=W(C(t,"article:published_time")),i=W(m(t,"last-modified")||C(t,"article:modified_time"));return{"@context":ue,"@version":1,url:ge(n),title:be(t),author:m(t,"author"),authorUrl:C(t,"article:author")||K(t,"author"),published:r,modified:i,version:me(t,"version"),keywords:ye(t),concepts:Ae(t),provenance:m(t,"vb:provenance"),review:m(t,"vb:review"),status:m(t,"vb:status"),license:ve(t),content:pe(t)}}function J(t){return JSON.stringify(t)}var Se=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT","PAGE-INFO","PAGE-STATS"]),Ee=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/u,P=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/gu;function X(t){return!!(Se.has(t.tagName)||t.hasAttribute("hidden")||t.hasAttribute("inert")||t.getAttribute("aria-hidden")==="true"||t.getAttribute("data-signable")==="false"||t.hasAttribute("data-stats-ignore"))}function Z(t){let e=[...t].filter(i=>i&&!X(i)),n=e.filter(i=>!e.some(o=>o!==i&&o.contains(i))),r=[];for(let i of n)Q(i,r);return r.join(" ")}function Q(t,e){for(let n of t.childNodes)n.nodeType===3?n.nodeValue&&e.push(n.nodeValue):n.nodeType===1&&!X(n)&&Q(n,e)}function ee(t,e){let n=0,r=0,i=0,o=Intl.Segmenter;if(typeof o=="function"){let s;try{s=new o(e||void 0,{granularity:"word"})}catch{s=new o(void 0,{granularity:"word"})}for(let{segment:a,isWordLike:l}of s.segment(t))l&&(n++,Ee.test(a)&&(i++,r+=a.match(P)?.length??0));return{words:n,cjkChars:r,cjkWords:i}}for(let s of t.split(/\s+/)){if(!s)continue;let a=s.match(P)?.length??0;r+=a,i+=a,n+=a+(s.replace(P,"")?1:0)}return{words:n,cjkChars:r,cjkWords:i}}function te({words:t,cjkChars:e,cjkWords:n},r=238,i=500){let o=Math.max(0,t-n);return Math.max(1,Math.ceil(o/r+e/i))}function ne(t){let e=t?.closest?.("[lang]")?.getAttribute("lang")||document.documentElement.lang||"";if(e)try{return Intl.getCanonicalLocales(e)[0]}catch{return}}var we=/^(\d{4})-(\d{2})-(\d{2})$/;function re(t){if(!t)return null;let e=String(t).trim(),n=new Date(e);return Number.isNaN(n.getTime())?null:{date:n,dateOnly:we.test(e)}}function ie({date:t,dateOnly:e},n){let r=e?{dateStyle:"long",timeZone:"UTC"}:{dateStyle:"long"};return new Intl.DateTimeFormat(n,r).format(t)}function oe({date:t,dateOnly:e},n,r=Date.now()){let i=new Intl.RelativeTimeFormat(n,{numeric:"auto"}),o=(t.getTime()-r)/1e3;if(e){let f=new Date(r),d=Date.UTC(f.getFullYear(),f.getMonth(),f.getDate()),b=Math.round((t.getTime()-d)/864e5);if(Math.abs(b)<1)return i.format(0,"day");o=b*86400}let s=Math.abs(o),a=[[60,"second"],[3600,"minute"],[86400,"hour"],[86400*7,"day"],[86400*30,"week"],[86400*365,"month"]],l={second:1,minute:60,hour:3600,day:86400,week:604800,month:2592e3,year:31536e3};if(s<45)return i.format(0,"second");for(let[f,d]of a)if(s<f)return i.format(Math.round(o/l[d]),d);return i.format(Math.round(o/l.year),"year")}var H={author:"Author",history:"History",provenance:"How this was made",topic:"Topic",published:"Published",updated:"Last updated",version:"Version",authorship:"Authorship","ai-tools":"AI tools used",review:"Review",status:"Status",license:"License",concepts:"Concepts",keywords:"Keywords","reading-time":"~{n}","tier-declared":"Self-declared","tier-verified":"Verified","tier-failed":"Signature failed","tier-key-unavailable":"Key unavailable","provenance-human":"Human written","provenance-ai-assisted":"Human-written, AI-assisted","provenance-ai-generated":"AI-generated","provenance-translated":"Translated","provenance-synthesized":"Synthesized from sources","provenance-migrated":"Migrated content","review-unreviewed":"Unreviewed","review-fact-checked":"Fact-checked","review-editor-reviewed":"Editor-reviewed","status-draft":"Draft","status-published":"Published","status-archived":"Archived"},Te={undeclared:0,declared:1,verified:3,failed:-1,"key-unavailable":-2};function u(t,e={},...n){let r=document.createElement(t);for(let[i,o]of Object.entries(e))o!=null&&r.setAttribute(i,o);for(let i of n)i!=null&&i!==!1&&r.append(i);return r}function L(t){if(!t)return null;let e=String(t).trim();if(!e)return null;try{let{protocol:n}=new URL(e,document.baseURI);return n==="http:"||n==="https:"?e:null}catch{return null}}var q=class t extends T{#n=null;static#e=new WeakMap;setup(){this.#n=new AbortController;let e=ne(this);this.hasAttribute("auto")&&this.#d(),this.#o(e),this.#a(e),this.#c(),this.#u(this.#n.signal)}teardown(){this.#n?.abort(),this.#n=null}#t(e){return this.getAttribute(`data-label-${e}`)??H[e]??e}#o(e){for(let n of this.querySelectorAll("time[data-relative]")){let r=re(n.getAttribute("datetime"));if(!r)continue;let i=ie(r,e);(!n.hasAttribute("title")||n.hasAttribute("data-title-generated"))&&(n.setAttribute("title",i),n.setAttribute("data-title-generated","")),n.textContent=oe(r,e)}}#a(e){let n=this.querySelector("[data-reading-time]");if(!n)return;let r=document.querySelectorAll("[data-signable]");if(!r.length)return;let i=ee(Z(r),e),o=te(i),s=new Intl.NumberFormat(e,{style:"unit",unit:"minute",unitDisplay:"short"}).format(o),a=this.#t("reading-time");n.textContent=a.includes("{n}")?a.replaceAll("{n}",s):`${a} ${s}`}#s(){return this.querySelector(".page-info-badge:not([data-status])")}#c(){let e=!!document.querySelector('meta[name="vb:provenance"], meta[name="author"]');this.#r(e?"declared":"undeclared")}async#u(e){let n=document.querySelector('meta[name="vb:signature"]')?.content;if(!n)return;let r=document.querySelector('meta[name="vb:signature-algorithm"]')?.content;if(r&&r!=="ECDSA-P256-SHA256"){this.#r("failed",{reason:`unsupported-algorithm:${r}`});return}let i=document.querySelector('link[rel~="author-key" i]')?.getAttribute("href");if(!i){this.#r("failed",{reason:"missing-author-key"});return}let o;try{let l=new URL(i,document.baseURI),f=await fetch(l,{credentials:"omit",signal:e});if(!f.ok)throw new Error(`status ${f.status}`);let d=await f.json();o=await crypto.subtle.importKey("jwk",{kty:d.kty,crv:d.crv,x:d.x,y:d.y,use:d.use||"sig",key_ops:["verify"]},{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])}catch(l){if(e.aborted)return;this.#r("key-unavailable",{reason:l.message});return}if(e.aborted)return;let s;try{s=J(Y(document,{url:z(document)}))}catch(l){this.#r("failed",{reason:`canonicalize:${l.message}`});return}let a;try{let l=new TextEncoder().encode(s),f=Uint8Array.from(atob(n),d=>d.charCodeAt(0));a=await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},o,f,l)}catch(l){if(e.aborted)return;this.#r("failed",{reason:`verify:${l.message}`});return}e.aborted||this.#r(a?"verified":"failed",{reason:a?"ok":"mismatch"})}#r(e,n={}){let r=Te[e]??0,i=this.#s();if(i){i.setAttribute("data-trust",e);let o=e==="undeclared"?"":this.#t(`tier-${e}`),s=i.querySelector(":scope > .page-info-tier");o?(s||(s=u("span",{class:"page-info-tier"}),i.append(s)),s.setAttribute("data-tier",e),s.textContent=o):s?.remove(),t.#e.has(i)||t.#e.set(i,i.getAttribute("aria-label"));let a=t.#e.get(i);a&&i.setAttribute("aria-label",o?`${a} \u2014 ${o}`:a)}this.dispatchEvent(new CustomEvent("page-info:verified",{detail:{status:e,tier:r,...n},bubbles:!0}))}#l(e){return e?String(e).trim().split(/\s+/).filter(Boolean).map(n=>this.getAttribute(`data-label-provenance-${n}`)??H[`provenance-${n}`]??n).join(" \xB7 "):""}#i(e,n){if(!n)return"";let r=`${e}-${n.trim()}`;return this.getAttribute(`data-label-${r}`)??H[r]??n.trim()}#d(){let e=c=>document.querySelector(`meta[name="${c}"]`)?.content?.trim()||"",n=c=>document.querySelector(`meta[property="${c}"]`)?.content?.trim()||"",r=c=>document.querySelector(`meta[itemprop="${c}"]`)?.content?.trim()||"",i=c=>document.querySelector(`link[rel~="${c}" i]`)?.getAttribute("href")||"",o=e("author"),s=L(n("article:author")||i("author")),a=e("last-modified")||n("article:modified_time"),l=n("article:published_time"),f=e("keywords"),d=e("license"),b=L(i("license")),$=r("version"),y=e("vb:provenance"),U=e("vb:review"),A=e("vb:status"),N=e("vb:ai-tools"),ae=L(e("vb:version-url")),x=[...document.querySelectorAll('meta[name="concept"]')].map(c=>c.getAttribute("content")?.trim()||"").filter(Boolean),F=L(this.dataset.conceptBase??"/topics/"),D=this.#l(y),V=this.#i("review",U),v=this.#i("status",A),se=Math.min(6,Math.max(2,parseInt(this.dataset.headingLevel||"",10)||2)),S=c=>u(`h${se}`,{class:"page-info-section-heading"},this.#t(c)),ce=()=>u("span",{class:"page-info-sep","aria-hidden":"true"},"\xB7"),M=c=>u("time",{datetime:c,"data-relative":""},c),I=(c,p,R)=>c?u("a",{href:c,rel:R},p):p,h=(c,...p)=>u("dl-item",{},u("dt",{},this.#t(c)),u("dd",{},...p)),E=[],w=c=>{E.length&&E.push(ce()),E.push(c)};o&&w(u("span",{class:"page-info-author"},o)),a&&w(M(a)),D&&w(u("span",{class:"page-info-badge","data-provenance":y,"data-trust":"declared"},D)),A&&A!=="published"&&w(u("span",{class:"page-info-badge","data-status":A},v));let g=[];if(o&&g.push(u("section",{},S("author"),u("p",{},I(s,o,"author")))),(a||l||$)&&g.push(u("section",{},S("history"),u("dl",{},l&&h("published",M(l)),a&&h("updated",M(a)),$&&h("version",I(ae,$))))),(y||N||U||d||v)&&g.push(u("section",{},S("provenance"),u("dl",{},y&&h("authorship",D),N&&h("ai-tools",N),V&&h("review",V),v&&h("status",v),d&&h("license",I(b,d,"license"))))),f||x.length){let c=[];x.forEach((p,R)=>{R&&c.push(", "),c.push(F?u("a",{href:`${F}${encodeURIComponent(p)}/`,rel:"tag","data-concept":p},p):p)}),g.push(u("section",{},S("topic"),u("dl",{},x.length>0&&h("concepts",...c),f&&h("keywords",f))))}this.replaceChildren(u("details",{},u("summary",{},...E),u("div",{class:"page-info-panel"},...g)))}};B("page-info",q);export{q as PageInfo};
15
+ `)||(t.text+=e)}}function ye(t){let e=[...t.querySelectorAll("[data-signable]")],n=e.filter(o=>!e.some(i=>i!==o&&i.contains(o))),r={text:""};for(let o of n)W(o,r,!1);return r.text.replace(/^\s+/,"").replace(/\s+$/,"")}function y(t,e){return t.querySelector(`meta[name="${x(e)}"]`)?.getAttribute("content")||""}function k(t,e){return t.querySelector(`meta[property="${x(e)}"]`)?.getAttribute("content")||""}function ve(t,e){return t.querySelector(`meta[itemprop="${x(e)}"]`)?.getAttribute("content")||""}function z(t,e){return t.querySelector(`link[rel~="${x(e)}" i]`)?.getAttribute("href")||""}function x(t){return String(t).replace(/[^a-zA-Z0-9:_\-/]/g,"")}function Ee(t){if(!t)return"";let e=String(t).trim();try{let n=new URL(e);n.search="",n.hash="";let r=`${n.protocol}//${n.hostname.toLowerCase()}`;return n.port&&(r+=`:${n.port}`),r+=n.pathname,r}catch{return e.replace(/[?#].*$/,"")}}function Y(t){return t?.querySelector?.('link[rel~="canonical" i]')?.getAttribute("href")?.trim()||""}function K(t){if(!t)return"";let e=String(t).match(/^(\d{4}-\d{2}-\d{2})/);return e?e[1]:""}function Ae(t){return k(t,"og:title")||t.title||""}function Se(t){let e=y(t,"keywords");return e?e.split(",").map(n=>n.trim()).filter(Boolean):[]}function we(t){let e=new Set;for(let n of t.querySelectorAll('meta[name="concept"]')){let r=(n.getAttribute("content")||"").trim();r&&e.add(r)}return[...e].sort()}function Te(t){return z(t,"license")||y(t,"license")}function J(t,e={}){let n=e.url??t?.location?.href??"",r=K(k(t,"article:published_time")),o=K(y(t,"last-modified")||k(t,"article:modified_time"));return{"@context":fe,"@version":1,url:Ee(n),title:Ae(t),author:y(t,"author"),authorUrl:k(t,"article:author")||z(t,"author"),published:r,modified:o,version:ve(t,"version"),keywords:Se(t),concepts:we(t),provenance:y(t,"vb:provenance"),review:y(t,"vb:review"),status:y(t,"vb:status"),license:Te(t),content:ye(t)}}function X(t){return JSON.stringify(t)}async function Z(t){let e=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",e);return Ce(new Uint8Array(n))}function Ce(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}var $e="ECDSA-P256-SHA256";function ke(t,e=Date.now()){let n=t?.metadata?.expires;if(n==null||n==="")return!1;let r=Date.parse(String(n));return Number.isNaN(r)||e>=r}function L(t,e,n){return t.querySelector(e)?.getAttribute(n)?.trim()||""}async function Q(t,e){let{origin:n,signal:r,now:o}=e,i=e.fetch??globalThis.fetch,s=L(t,'meta[name="vb:signature"]',"content");if(!s)return null;let a=L(t,'meta[name="vb:signature-algorithm"]',"content");if(a&&a!==$e)return{status:"failed",reason:`unsupported-algorithm:${a}`};let f=L(t,'link[rel~="author-key" i]',"href");if(!f)return{status:"failed",reason:"missing-author-key"};let l,h;try{let d=new URL(f,e.baseURI??t.baseURI);if(d.origin!==n)return{status:"failed",reason:"key-origin",label:"key-untrusted"};let g=await i(d,{credentials:"omit",redirect:"error",signal:r});if(!g.ok)throw new Error(`status ${g.status}`);l=await g.json(),h=await crypto.subtle.importKey("jwk",{kty:l.kty,crv:l.crv,x:l.x,y:l.y,use:l.use||"sig",key_ops:["verify"]},{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])}catch(d){return r?.aborted?null:{status:"key-unavailable",reason:d.message}}if(r?.aborted)return null;if(ke(l,o))return{status:"failed",reason:"key-expired",label:"key-expired"};let b;try{b=X(J(t,{url:Y(t)}))}catch(d){return{status:"failed",reason:`canonicalize:${d.message}`}}let v;try{let d=L(t,'meta[name="vb:hash"]',"content");if(d&&d!==`sha256-${await Z(b)}`)return r?.aborted?null:{status:"failed",reason:"hash-mismatch"};let g=Uint8Array.from(atob(s),E=>E.charCodeAt(0));v=await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},h,g,new TextEncoder().encode(b))}catch(d){return r?.aborted?null:{status:"failed",reason:`verify:${d.message}`}}return r?.aborted?null:v?{status:"verified",reason:"ok"}:{status:"failed",reason:"mismatch"}}var xe=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT","PAGE-INFO","PAGE-STATS"]),Le=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/u,q=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/gu;function ee(t){return!!(xe.has(t.tagName)||t.hasAttribute("hidden")||t.hasAttribute("inert")||t.getAttribute("aria-hidden")==="true"||t.getAttribute("data-signable")==="false"||t.hasAttribute("data-stats-ignore"))}function te(t){let e=[...t].filter(o=>o&&!ee(o)),n=e.filter(o=>!e.some(i=>i!==o&&i.contains(o))),r=[];for(let o of n)ne(o,r);return r.join(" ")}function ne(t,e){for(let n of t.childNodes)n.nodeType===3?n.nodeValue&&e.push(n.nodeValue):n.nodeType===1&&!ee(n)&&ne(n,e)}function re(t,e){let n=0,r=0,o=0,i=Intl.Segmenter;if(typeof i=="function"){let s;try{s=new i(e||void 0,{granularity:"word"})}catch{s=new i(void 0,{granularity:"word"})}for(let{segment:a,isWordLike:f}of s.segment(t))f&&(n++,Le.test(a)&&(o++,r+=a.match(q)?.length??0));return{words:n,cjkChars:r,cjkWords:o}}for(let s of t.split(/\s+/)){if(!s)continue;let a=s.match(q)?.length??0;r+=a,o+=a,n+=a+(s.replace(q,"")?1:0)}return{words:n,cjkChars:r,cjkWords:o}}function ie({words:t,cjkChars:e,cjkWords:n},r=238,o=500){let i=Math.max(0,t-n);return Math.max(1,Math.ceil(i/r+e/o))}function oe(t){let e=t?.closest?.("[lang]")?.getAttribute("lang")||document.documentElement.lang||"";if(e)try{return Intl.getCanonicalLocales(e)[0]}catch{return}}var Me=/^(\d{4})-(\d{2})-(\d{2})$/;function ae(t){if(!t)return null;let e=String(t).trim(),n=new Date(e);return Number.isNaN(n.getTime())?null:{date:n,dateOnly:Me.test(e)}}function se({date:t,dateOnly:e},n){let r=e?{dateStyle:"long",timeZone:"UTC"}:{dateStyle:"long"};return new Intl.DateTimeFormat(n,r).format(t)}function ce({date:t,dateOnly:e},n,r=Date.now()){let o=new Intl.RelativeTimeFormat(n,{numeric:"auto"}),i=(t.getTime()-r)/1e3;if(e){let l=new Date(r),h=Date.UTC(l.getFullYear(),l.getMonth(),l.getDate()),b=Math.round((t.getTime()-h)/864e5);if(Math.abs(b)<1)return o.format(0,"day");i=b*86400}let s=Math.abs(i),a=[[60,"second"],[3600,"minute"],[86400,"hour"],[86400*7,"day"],[86400*30,"week"],[86400*365,"month"]],f={second:1,minute:60,hour:3600,day:86400,week:604800,month:2592e3,year:31536e3};if(s<45)return o.format(0,"second");for(let[l,h]of a)if(s<l)return o.format(Math.round(i/f[h]),h);return o.format(Math.round(i/f.year),"year")}var B={author:"Author",history:"History",provenance:"How this was made",topic:"Topic",published:"Published",updated:"Last updated",version:"Version",authorship:"Authorship","ai-tools":"AI tools used",review:"Review",status:"Status",license:"License",concepts:"Concepts",keywords:"Keywords","reading-time":"~{n}","tier-declared":"Self-declared","tier-verified":"Verified","tier-failed":"Signature failed","tier-key-unavailable":"Key unavailable","tier-key-untrusted":"Key not from this site","tier-key-expired":"Key expired","provenance-human":"Human written","provenance-ai-assisted":"Human-written, AI-assisted","provenance-ai-generated":"AI-generated","provenance-translated":"Translated","provenance-synthesized":"Synthesized from sources","provenance-migrated":"Migrated content","review-unreviewed":"Unreviewed","review-fact-checked":"Fact-checked","review-editor-reviewed":"Editor-reviewed","status-draft":"Draft","status-published":"Published","status-archived":"Archived"},De={undeclared:0,declared:1,verified:3,failed:-1,"key-unavailable":-2};function u(t,e={},...n){let r=document.createElement(t);for(let[o,i]of Object.entries(e))i!=null&&r.setAttribute(o,i);for(let o of n)o!=null&&o!==!1&&r.append(o);return r}function M(t){if(!t)return null;let e=String(t).trim();if(!e)return null;try{let{protocol:n}=new URL(e,document.baseURI);return n==="http:"||n==="https:"?e:null}catch{return null}}var F=class t extends ${#n=null;static#e=new WeakMap;setup(){this.#n=new AbortController;let e=oe(this);this.hasAttribute("auto")&&this.#d(),this.#o(e),this.#a(e),this.#c(),this.#u(this.#n.signal)}teardown(){this.#n?.abort(),this.#n=null}#t(e){return this.getAttribute(`data-label-${e}`)??B[e]??e}#o(e){for(let n of this.querySelectorAll("time[data-relative]")){let r=ae(n.getAttribute("datetime"));if(!r)continue;let o=se(r,e);(!n.hasAttribute("title")||n.hasAttribute("data-title-generated"))&&(n.setAttribute("title",o),n.setAttribute("data-title-generated","")),n.textContent=ce(r,e)}}#a(e){let n=this.querySelector("[data-reading-time]");if(!n)return;let r=document.querySelectorAll("[data-signable]");if(!r.length)return;let o=re(te(r),e),i=ie(o),s=new Intl.NumberFormat(e,{style:"unit",unit:"minute",unitDisplay:"short"}).format(i),a=this.#t("reading-time");n.textContent=a.includes("{n}")?a.replaceAll("{n}",s):`${a} ${s}`}#s(){return this.querySelector(".page-info-badge:not([data-status])")}#c(){let e=!!document.querySelector('meta[name="vb:provenance"], meta[name="author"]');this.#r(e?"declared":"undeclared")}async#u(e){let n=await Q(document,{origin:location.origin,signal:e});!n||e.aborted||this.#r(n.status,{reason:n.reason},n.label)}#r(e,n={},r=e){let o=De[e]??0,i=this.#s();if(i){i.setAttribute("data-trust",e);let s=e==="undeclared"?"":this.#t(`tier-${r}`),a=i.querySelector(":scope > .page-info-tier");s?(a||(a=u("span",{class:"page-info-tier"}),i.append(a)),a.setAttribute("data-tier",e),a.textContent=s):a?.remove(),t.#e.has(i)||t.#e.set(i,i.getAttribute("aria-label"));let f=t.#e.get(i);f&&i.setAttribute("aria-label",s?`${f} \u2014 ${s}`:f)}this.dispatchEvent(new CustomEvent("page-info:verified",{detail:{status:e,tier:o,...n},bubbles:!0}))}#l(e){return e?String(e).trim().split(/\s+/).filter(Boolean).map(n=>this.getAttribute(`data-label-provenance-${n}`)??B[`provenance-${n}`]??n).join(" \xB7 "):""}#i(e,n){if(!n)return"";let r=`${e}-${n.trim()}`;return this.getAttribute(`data-label-${r}`)??B[r]??n.trim()}#d(){let e=c=>document.querySelector(`meta[name="${c}"]`)?.content?.trim()||"",n=c=>document.querySelector(`meta[property="${c}"]`)?.content?.trim()||"",r=c=>document.querySelector(`meta[itemprop="${c}"]`)?.content?.trim()||"",o=c=>document.querySelector(`link[rel~="${c}" i]`)?.getAttribute("href")||"",i=e("author"),s=M(n("article:author")||o("author")),a=e("last-modified")||n("article:modified_time"),f=n("article:published_time"),l=e("keywords"),h=e("license"),b=M(o("license")),v=r("version"),d=e("vb:provenance"),g=e("vb:review"),E=e("vb:status"),D=e("vb:ai-tools"),ue=M(e("vb:version-url")),P=[...document.querySelectorAll('meta[name="concept"]')].map(c=>c.getAttribute("content")?.trim()||"").filter(Boolean),U=M(this.dataset.conceptBase??"/topics/"),I=this.#l(d),V=this.#i("review",g),S=this.#i("status",E),le=Math.min(6,Math.max(2,parseInt(this.dataset.headingLevel||"",10)||2)),w=c=>u(`h${le}`,{class:"page-info-section-heading"},this.#t(c)),de=()=>u("span",{class:"page-info-sep","aria-hidden":"true"},"\xB7"),R=c=>u("time",{datetime:c,"data-relative":""},c),H=(c,m,O)=>c?u("a",{href:c,rel:O},m):m,p=(c,...m)=>u("dl-item",{},u("dt",{},this.#t(c)),u("dd",{},...m)),T=[],C=c=>{T.length&&T.push(de()),T.push(c)};i&&C(u("span",{class:"page-info-author"},i)),a&&C(R(a)),I&&C(u("span",{class:"page-info-badge","data-provenance":d,"data-trust":"declared"},I)),E&&E!=="published"&&C(u("span",{class:"page-info-badge","data-status":E},S));let A=[];if(i&&A.push(u("section",{},w("author"),u("p",{},H(s,i,"author")))),(a||f||v)&&A.push(u("section",{},w("history"),u("dl",{},f&&p("published",R(f)),a&&p("updated",R(a)),v&&p("version",H(ue,v))))),(d||D||g||h||S)&&A.push(u("section",{},w("provenance"),u("dl",{},d&&p("authorship",I),D&&p("ai-tools",D),V&&p("review",V),S&&p("status",S),h&&p("license",H(b,h,"license"))))),l||P.length){let c=[];P.forEach((m,O)=>{O&&c.push(", "),c.push(U?u("a",{href:`${U}${encodeURIComponent(m)}/`,rel:"tag","data-concept":m},m):m)}),A.push(u("section",{},w("topic"),u("dl",{},P.length>0&&p("concepts",...c),l&&p("keywords",l))))}this.replaceChildren(u("details",{},u("summary",{},...T),u("div",{class:"page-info-panel"},...A)))}};N("page-info",F);export{F as PageInfo};
16
16
  //# sourceMappingURL=page-info.js.map
@@ -1,2 +1,2 @@
1
- var D=window.matchMedia("(prefers-reduced-motion: reduce)");var b=new Map;function g(a,t,e={}){let n=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:n},o=b.get(a);if(customElements.get(a)){if(!o||o.priority>=n){o&&o.priority===n&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=n){o.priority===n&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${o.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}b.set(a,r),customElements.define(a,t)}var f=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,r){t.addEventListener(e,n,r),this.#e.push(()=>t.removeEventListener(e,n,r))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{e?n.add(t):n.delete(t)}catch{let r=`--${t}`;e?n.add(r):n.delete(r)}}_adoptInternals(t){this.#t||(this.#t=t)}#n(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var N=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT","PAGE-INFO","PAGE-STATS"]),x=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/u,m=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/gu;function y(a){return!!(N.has(a.tagName)||a.hasAttribute("hidden")||a.hasAttribute("inert")||a.getAttribute("aria-hidden")==="true"||a.getAttribute("data-signable")==="false"||a.hasAttribute("data-stats-ignore"))}function w(a){let t=[...a].filter(r=>r&&!y(r)),e=t.filter(r=>!t.some(o=>o!==r&&o.contains(r))),n=[];for(let r of e)E(r,n);return n.join(" ")}function E(a,t){for(let e of a.childNodes)e.nodeType===3?e.nodeValue&&t.push(e.nodeValue):e.nodeType===1&&!y(e)&&E(e,t)}function A(a,t){let e=0,n=0,r=0,o=Intl.Segmenter;if(typeof o=="function"){let d;try{d=new o(t||void 0,{granularity:"word"})}catch{d=new o(void 0,{granularity:"word"})}for(let{segment:c,isWordLike:l}of d.segment(a))l&&(e++,x.test(c)&&(r++,n+=c.match(m)?.length??0));return{words:e,cjkChars:n,cjkWords:r}}for(let d of a.split(/\s+/)){if(!d)continue;let c=d.match(m)?.length??0;n+=c,r+=c,e+=c+(d.replace(m,"")?1:0)}return{words:e,cjkChars:n,cjkWords:r}}function S({words:a,cjkChars:t,cjkWords:e},n=238,r=500){let o=Math.max(0,a-e);return Math.max(1,Math.ceil(o/n+t/r))}function h(a){let t=a?.closest?.("[lang]")?.getAttribute("lang")||document.documentElement.lang||"";if(t)try{return Intl.getCanonicalLocales(t)[0]}catch{return}}var $=/^(\d{4})-(\d{2})-(\d{2})$/;function M(a){if(!a)return null;let t=String(a).trim(),e=new Date(t);return Number.isNaN(e.getTime())?null:{date:e,dateOnly:$.test(t)}}function T({date:a,dateOnly:t},e){let n=t?{dateStyle:"long",timeZone:"UTC"}:{dateStyle:"long"};return new Intl.DateTimeFormat(e,n).format(a)}function k({date:a,dateOnly:t},e,n=Date.now()){let r=new Intl.RelativeTimeFormat(e,{numeric:"auto"}),o=(a.getTime()-n)/1e3;if(t){let i=new Date(n),s=Date.UTC(i.getFullYear(),i.getMonth(),i.getDate()),u=Math.round((a.getTime()-s)/864e5);if(Math.abs(u)<1)return r.format(0,"day");o=u*86400}let d=Math.abs(o),c=[[60,"second"],[3600,"minute"],[86400,"hour"],[86400*7,"day"],[86400*30,"week"],[86400*365,"month"]],l={second:1,minute:60,hour:3600,day:86400,week:604800,month:2592e3,year:31536e3};if(d<45)return r.format(0,"second");for(let[i,s]of c)if(d<i)return r.format(Math.round(o/l[s]),s);return r.format(Math.round(o/l.year),"year")}var L=["reading-time","word-count","last-modified"],p=class extends f{static observedAttributes=["data-for","data-wpm","data-show","data-label-reading-time","data-label-word-count","data-label-last-modified","data-label-min-read","data-label-words"];attributeChangedCallback(t,e,n){e===n||!this.hasAttribute("data-upgraded")||this._reinit()}setup(){for(let i of this.querySelectorAll(":scope > dl[data-generated]"))i.remove();if(this.querySelector(":scope > dl"))return;let t=this.dataset.for;if(!t)return;let e=document.getElementById(t);if(!e)return;let n=h(this),r=parseInt(this.dataset.wpm||"",10)||238,o=(this.dataset.show||"reading-time").split(",").map(i=>i.trim()).filter(i=>L.includes(i)),d=A(w([e]),h(e)??n),c=S(d,r),l=document.createElement("dl");if(l.className="page-stats-list",l.dataset.generated="",o.includes("reading-time")){let i=document.createElement("time");i.setAttribute("datetime",`PT${c}M`);let s=new Intl.NumberFormat(n,{style:"unit",unit:"minute",unitDisplay:"short"}).format(c),u=(n??"en").toLowerCase().startsWith("en")?"{n} read":"{n}";i.textContent=this.#e("data-label-min-read",u,s),l.append(this.#t(this.dataset.labelReadingTime||"Reading time",i))}if(o.includes("word-count")){let i=d.words,s=new Intl.PluralRules(n).select(i),u=this.hasAttribute(`data-label-words-${s}`)?`data-label-words-${s}`:"data-label-words",v=s==="one"?"{n} word":"{n} words",C=this.#e(u,v,new Intl.NumberFormat(n).format(i));l.append(this.#t(this.dataset.labelWordCount||"Word count",C))}if(o.includes("last-modified")){let i=this.#n();if(i){let s=document.createElement("time");s.setAttribute("datetime",i.raw),s.title=T(i,n),s.textContent=k(i,n),l.append(this.#t(this.dataset.labelLastModified||"Last updated",s))}}this.append(l)}#e(t,e,n){let r=this.getAttribute(t)??e;return r.includes("{n}")?r.replaceAll("{n}",n):`${n} ${r}`}#t(t,e){let n=document.createElement("dl-item"),r=document.createElement("dt");r.className="visually-hidden",r.textContent=t;let o=document.createElement("dd");return o.append(e),n.append(r,o),n}#n(){let t=document.querySelector('meta[name="last-modified"]')?.content||document.querySelector('meta[property="article:modified_time"]')?.content,e=M(t);return e?{...e,raw:String(t).trim()}:null}};g("page-stats",p);export{p as PageStats};
1
+ var F=window.matchMedia("(prefers-reduced-motion: reduce)");var b=new Map;function g(o,t,e={}){let n=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:n},s=b.get(o);if(customElements.get(o)){if(!s||s.priority>=n){s&&s.priority===n&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${o}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${o}> 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 <${o}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}b.set(o,r),customElements.define(o,t)}var f=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,n,r){t.addEventListener(e,n,r),this.#e.push(()=>t.removeEventListener(e,n,r))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{e?n.add(t):n.delete(t)}catch{let r=`--${t}`;e?n.add(r):n.delete(r)}}_adoptInternals(t){this.#t||(this.#t=t)}#n(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#n()?.validity}get validationMessage(){return this.#n()?.validationMessage??""}get willValidate(){return this.#n()?.willValidate??!1}get form(){return this.#n()?.form??null}checkValidity(){return this.#n()?.checkValidity()??!0}reportValidity(){return this.#n()?.reportValidity()??!0}};var k=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT","PAGE-INFO","PAGE-STATS"]),x=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/u,h=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/gu;function y(o){return!!(k.has(o.tagName)||o.hasAttribute("hidden")||o.hasAttribute("inert")||o.getAttribute("aria-hidden")==="true"||o.getAttribute("data-signable")==="false"||o.hasAttribute("data-stats-ignore"))}function w(o){let t=[...o].filter(r=>r&&!y(r)),e=t.filter(r=>!t.some(s=>s!==r&&s.contains(r))),n=[];for(let r of e)E(r,n);return n.join(" ")}function E(o,t){for(let e of o.childNodes)e.nodeType===3?e.nodeValue&&t.push(e.nodeValue):e.nodeType===1&&!y(e)&&E(e,t)}function S(o,t){let e=0,n=0,r=0,s=Intl.Segmenter;if(typeof s=="function"){let d;try{d=new s(t||void 0,{granularity:"word"})}catch{d=new s(void 0,{granularity:"word"})}for(let{segment:c,isWordLike:u}of d.segment(o))u&&(e++,x.test(c)&&(r++,n+=c.match(h)?.length??0));return{words:e,cjkChars:n,cjkWords:r}}for(let d of o.split(/\s+/)){if(!d)continue;let c=d.match(h)?.length??0;n+=c,r+=c,e+=c+(d.replace(h,"")?1:0)}return{words:e,cjkChars:n,cjkWords:r}}function v({words:o,cjkChars:t,cjkWords:e},n=238,r=500){let s=Math.max(0,o-e);return Math.max(1,Math.ceil(s/n+t/r))}function m(o){let t=o?.closest?.("[lang]")?.getAttribute("lang")||document.documentElement.lang||"";if(t)try{return Intl.getCanonicalLocales(t)[0]}catch{return}}var L=/^(\d{4})-(\d{2})-(\d{2})$/;function A(o){if(!o)return null;let t=String(o).trim(),e=new Date(t);return Number.isNaN(e.getTime())?null:{date:e,dateOnly:L.test(t)}}function T({date:o,dateOnly:t},e){let n=t?{dateStyle:"long",timeZone:"UTC"}:{dateStyle:"long"};return new Intl.DateTimeFormat(e,n).format(o)}function $({date:o,dateOnly:t},e,n=Date.now()){let r=new Intl.RelativeTimeFormat(e,{numeric:"auto"}),s=(o.getTime()-n)/1e3;if(t){let a=new Date(n),i=Date.UTC(a.getFullYear(),a.getMonth(),a.getDate()),l=Math.round((o.getTime()-i)/864e5);if(Math.abs(l)<1)return r.format(0,"day");s=l*86400}let d=Math.abs(s),c=[[60,"second"],[3600,"minute"],[86400,"hour"],[86400*7,"day"],[86400*30,"week"],[86400*365,"month"]],u={second:1,minute:60,hour:3600,day:86400,week:604800,month:2592e3,year:31536e3};if(d<45)return r.format(0,"second");for(let[a,i]of c)if(d<a)return r.format(Math.round(s/u[i]),i);return r.format(Math.round(s/u.year),"year")}var _=["reading-time","word-count","last-modified"],p=class extends f{static observedAttributes=["data-for","data-wpm","data-show","data-label-reading-time","data-label-word-count","data-label-last-modified","data-label-min-read","data-label-words"];attributeChangedCallback(t,e,n){e===n||!this.hasAttribute("data-upgraded")||this._reinit()}setup(){for(let a of this.querySelectorAll(":scope > dl[data-generated]"))a.remove();if(this.querySelector(":scope > dl"))return;let t=this.dataset.for;if(!t)return;let e=document.getElementById(t);if(!e)return;let n=m(this),r=parseInt(this.dataset.wpm||"",10)||238,s=(this.dataset.show||"reading-time").split(",").map(a=>a.trim()).filter(a=>_.includes(a)),d=S(w([e]),m(e)??n),c=v(d,r),u=document.createElement("dl");if(u.className="page-stats-list",u.dataset.generated="",s.includes("reading-time")){let a=document.createElement("time");a.setAttribute("datetime",`PT${c}M`);let i=new Intl.NumberFormat(n,{style:"unit",unit:"minute",unitDisplay:"short"}).format(c),l=(n??"en").toLowerCase().startsWith("en")?"{n} read":"{n}";a.textContent=this.#e("data-label-min-read",l,i),u.append(this.#t(this.dataset.labelReadingTime||"Reading time",a))}if(s.includes("word-count")){let a=d.words,i=new Intl.PluralRules(n).select(a),l=this.hasAttribute(`data-label-words-${i}`)?`data-label-words-${i}`:"data-label-words",M=i==="one"?"{n} word":"{n} words",C=this.#e(l,M,new Intl.NumberFormat(n).format(a));u.append(this.#t(this.dataset.labelWordCount||"Word count",C))}if(s.includes("last-modified")){let a=this.#n();if(a){let i=document.createElement("time");i.setAttribute("datetime",a.raw),i.title=T(a,n),i.textContent=$(a,n),u.append(this.#t(this.dataset.labelLastModified||"Last updated",i))}}this.append(u)}#e(t,e,n){let r=this.getAttribute(t)??e;return r.includes("{n}")?r.replaceAll("{n}",n):`${n} ${r}`}#t(t,e){let n=document.createElement("dl-item"),r=document.createElement("dt");r.className="visually-hidden",r.textContent=t;let s=document.createElement("dd");return s.append(e),n.append(r,s),n}#n(){let t=document.querySelector('meta[name="last-modified"]')?.content||document.querySelector('meta[property="article:modified_time"]')?.content,e=A(t);return e?{...e,raw:String(t).trim()}:null}};g("page-stats",p);export{p as PageStats};
2
2
  //# sourceMappingURL=page-stats.js.map
@@ -1,2 +1,2 @@
1
- var A=window.matchMedia("(prefers-reduced-motion: reduce)");var y=new Map;function v(n,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=y.get(n);if(customElements.get(n)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}y.set(n,r),customElements.define(n,t)}var m=class extends HTMLElement{#i=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#i)t();this.#i=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,r){t.addEventListener(e,i,r),this.#i.push(()=>t.removeEventListener(e,i,r))}_reinit(){for(let t of this.#i)t();this.#i=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let r=`--${t}`;e?i.add(r):i.delete(r)}}_adoptInternals(t){this.#t||(this.#t=t)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var k="dialog, [data-toc-ignore], browser-window";function w(n){return!!n.closest(k)}function E(n){if(typeof n.checkVisibility!="function"||n.checkVisibility()||n.closest("details:not([open])")?.checkVisibility())return!0;let e=n.closest('[hidden="until-found"]');return!!e?.parentElement&&(e.parentElement.checkVisibility?.()??!0)}var b=class extends m{#i;#t=[];#e=new Map;#c;#s=null;#l=0;#n=0;#o;#r=0;#d=!1;setup(){this.#c=window.matchMedia("(min-width: 64rem)"),this.listen(this.#c,"change",this.#w),this.listen(window,"resize",this.#E),this.listen(window,"hashchange",this.#k),this.listen(this,"click",this.#A),this.#n=requestAnimationFrame(()=>{this.#n=0,this.#h()})}teardown(){cancelAnimationFrame(this.#n),this.#n=0,cancelAnimationFrame(this.#r),this.#r=0,clearTimeout(this.#l),this.#f()}get entries(){return this.#t.map(t=>({id:t.id||void 0,text:t.textContent?.trim()||"",level:parseInt(t.tagName.slice(1),10)||0}))}refresh(){this.isConnected&&(cancelAnimationFrame(this.#n),this.#n=0,this.#h())}#f(){this.#i?.disconnect(),this.#i=void 0,this.#o?.disconnect(),this.#o=void 0;for(let t of this.querySelectorAll(":scope > [data-page-toc-generated]"))t.remove();this.#t=[],this.#e.clear(),this.#s=null,this.#d=!1}#h(){this.#f(),this.#d=this.#y(),this.#d?this.#v():(this.#S(),this.#C()),this.#s&&this.#m()&&(this.#s.open=!0),this.#$(),this.#a()}#y(){return Array.from(this.querySelectorAll("nav, details")).some(t=>!t.closest("[data-page-toc-generated]"))}#v(){this.#s=this.querySelector("details");for(let t of this.querySelectorAll('a[href^="#"]')){let e=g(t.getAttribute("href")?.slice(1)||"");if(!e)continue;let i=document.getElementById(e);!i||this.#e.has(e)||(this.#t.push(i),this.#e.set(e,t),t.classList.add("link"))}}#m(){return this.#c?.matches??!1}#w=t=>{t.matches&&this.#s&&(this.#s.open=!0)};#E=()=>{clearTimeout(this.#l),this.#l=window.setTimeout(()=>this.#a(),150)};#k=()=>{this.#a()};#A=t=>{let e=t.target instanceof Element?t.target:null;if(!e)return;let i=e.closest("summary");if(i&&this.#s&&i.parentElement===this.#s&&this.#m()){t.preventDefault();return}let r=e.closest('a[href^="#"]');if(!r||!this.contains(r)||t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let s=g(r.getAttribute("href")?.slice(1)||"");if(this.#e.get(s)!==r)return;let a=document.getElementById(s);a&&(t.preventDefault(),this.#x(a))};#a(){let t=g(window.location.hash.slice(1));t&&this.#e.has(t)&&this.#u(t)}#u(t){for(let i of this.#e.values())i.classList.remove("active"),i.removeAttribute("aria-current");let e=this.#e.get(t);e&&(e.classList.add("active"),e.setAttribute("aria-current","true"))}#p(){return(this.getAttribute("levels")||"h2,h3").split(",").map(t=>t.trim().toLowerCase())}#g(){return document.querySelector(this.getAttribute("scope")||"main")}#b(t){return Array.from(t.querySelectorAll(this.#p().join(","))).filter(e=>e.id&&!this.contains(e)&&!w(e)&&E(e))}#C(){let t=this.#g();t&&(this.#o=new MutationObserver(e=>{e.every(i=>this.contains(i.target))||this.#r||(this.#r=requestAnimationFrame(()=>{this.#r=0;let i=this.#b(t);i.length===this.#t.length&&i.every((s,a)=>s===this.#t[a]&&this.#e.has(s.id))||this.#h()}))}),this.#o.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-toc-ignore","id","hidden"]}))}#S(){let t=this.#p(),e=this.dataset.title||"On this page",i=this.#g();if(!i||(this.#t=this.#b(i),this.#t.length===0))return;let r={depth:-1,children:[]},s=[r];for(let f of this.#t){let l=t.indexOf(f.tagName.toLowerCase());for(;s[s.length-1].depth>=l;)s.pop();let o={heading:f,depth:l,children:[]};s[s.length-1].children.push(o),s.push(o)}let a=f=>{let l=document.createElement("ul");l.className="list";for(let o of f){let d=document.createElement("li");d.className="item",d.dataset.level=String(o.depth);let h=document.createElement("a");h.href=`#${o.heading.id}`,h.className="link",h.textContent=this.#M(o.heading),d.appendChild(h),o.children.length&&d.appendChild(a(o.children)),l.appendChild(d),this.#e.set(o.heading.id,h)}return l},c=document.createElement("details");c.className="details",c.setAttribute("data-page-toc-generated",""),c.open=!0;let p=document.createElement("summary");p.className="summary",p.textContent=e,c.appendChild(p);let u=document.createElement("nav");u.className="nav",u.setAttribute("aria-label",e),u.appendChild(a(r.children)),c.appendChild(u),this.#s=c,this.appendChild(c)}#M(t){let e=t.cloneNode(!0);return e.querySelectorAll(".heading-anchor").forEach(r=>r.remove()),e.textContent.trim()}#x(t){let e=new URL(window.location.href);e.hash=t.id,window.history.pushState(null,"",e);let i=window.matchMedia("(prefers-reduced-motion: reduce)").matches;t.scrollIntoView({behavior:i?"auto":"smooth",block:"start"}),t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}),this.#u(t.id),this.dispatchEvent(new CustomEvent("page-toc:navigate",{bubbles:!0,detail:{id:t.id}}))}#$(){if(this.#t.length===0)return;let t=new Set;this.#i=new IntersectionObserver(e=>{for(let i of e)i.isIntersecting?t.add(i.target.id):t.delete(i.target.id);this.#L(t)},{rootMargin:"-80px 0px -70% 0px",threshold:0});for(let e of this.#t)this.#i.observe(e)}#L(t){for(let e of this.#t)if(t.has(e.id)){this.#u(e.id);return}this.#a()}};function g(n){try{return decodeURIComponent(n)}catch{return n}}v("page-toc",b);export{b as PageToc};
1
+ var $=window.matchMedia("(prefers-reduced-motion: reduce)");var y=new Map;function v(r,e,t={}){let n=t.priority??10,s={impl:e,bundle:t.bundle,contract:t.contract,priority:n},i=y.get(r);if(customElements.get(r)){if(!i||i.priority>=n){i&&i.priority===n&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${t.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${t.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=n){i.priority===n&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${i.bundle}". Skipping "${t.bundle}" (first wins at equal priority).`);return}y.set(r,s),customElements.define(r,e)}var p=class extends HTMLElement{#n=[];#e;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#n)e();this.#n=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,t,n,s){e.addEventListener(t,n,s),this.#n.push(()=>e.removeEventListener(t,n,s))}_reinit(){for(let e of this.#n)e();this.#n=[],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 n=this.#e.states;try{t?n.add(e):n.delete(e)}catch{let s=`--${e}`;t?n.add(s):n.delete(s)}}_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 A="dialog, [data-toc-ignore], browser-window";function w(r){return!!r.closest(A)}function E(r){if(typeof r.checkVisibility!="function"||r.checkVisibility()||r.closest("details:not([open])")?.checkVisibility())return!0;let t=r.closest('[hidden="until-found"]');return!!t?.parentElement&&(t.parentElement.checkVisibility?.()??!0)}var g=class extends p{#n;#e=[];#t=new Map;#c;#i=null;#d=0;#r=0;#o;#s=0;#l=!1;setup(){this.#c=window.matchMedia("(min-width: 64rem)"),this.listen(this.#c,"change",this.#w),this.listen(window,"resize",this.#E),this.listen(window,"hashchange",this.#A),this.listen(this,"click",this.#S),this.#r=requestAnimationFrame(()=>{this.#r=0,this.#u()})}teardown(){cancelAnimationFrame(this.#r),this.#r=0,cancelAnimationFrame(this.#s),this.#s=0,clearTimeout(this.#d),this.#f()}get entries(){return this.#e.map(e=>({id:e.id||void 0,text:e.textContent?.trim()||"",level:parseInt(e.tagName.slice(1),10)||0}))}refresh(){this.isConnected&&(cancelAnimationFrame(this.#r),this.#r=0,this.#u())}#f(){this.#n?.disconnect(),this.#n=void 0,this.#o?.disconnect(),this.#o=void 0;for(let e of this.querySelectorAll(":scope > [data-page-toc-generated]"))e.remove();this.#e=[],this.#t.clear(),this.#i=null,this.#l=!1}#u(){this.#f(),this.#l=this.#y(),this.#l?this.#v():(this.#k(),this.#C()),this.#i&&this.#p()&&(this.#i.open=!0),this.#M(),this.#a()}#y(){return Array.from(this.querySelectorAll("nav, details")).some(e=>!e.closest("[data-page-toc-generated]"))}#v(){this.#i=this.querySelector("details");for(let e of this.querySelectorAll('a[href^="#"]')){let t=b(e.getAttribute("href")?.slice(1)||"");if(!t)continue;let n=document.getElementById(t);!n||this.#t.has(t)||(this.#e.push(n),this.#t.set(t,e),e.classList.add("link"))}}#p(){return this.#c?.matches??!1}#w=e=>{e.matches&&this.#i&&(this.#i.open=!0)};#E=()=>{clearTimeout(this.#d),this.#d=window.setTimeout(()=>this.#a(),150)};#A=()=>{this.#a()};#S=e=>{let t=e.target instanceof Element?e.target:null;if(!t)return;let n=t.closest("summary");if(n&&this.#i&&n.parentElement===this.#i&&this.#p()){e.preventDefault();return}let s=t.closest('a[href^="#"]');if(!s||!this.contains(s)||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let i=b(s.getAttribute("href")?.slice(1)||"");if(this.#t.get(i)!==s)return;let a=document.getElementById(i);a&&(e.preventDefault(),this.#x(a))};#a(){let e=b(window.location.hash.slice(1));e&&this.#t.has(e)&&this.#h(e)}#h(e){for(let n of this.#t.values())n.classList.remove("active"),n.removeAttribute("aria-current");let t=this.#t.get(e);t&&(t.classList.add("active"),t.setAttribute("aria-current","true"))}#m(){return(this.getAttribute("levels")||"h2,h3").split(",").map(e=>e.trim().toLowerCase())}#b(){return document.querySelector(this.getAttribute("scope")||"main")}#g(e){return Array.from(e.querySelectorAll(this.#m().join(","))).filter(t=>t.id&&!this.contains(t)&&!w(t)&&E(t))}#C(){let e=this.#b();e&&(this.#o=new MutationObserver(t=>{t.every(n=>this.contains(n.target))||this.#s||(this.#s=requestAnimationFrame(()=>{this.#s=0;let n=this.#g(e);n.length===this.#e.length&&n.every((i,a)=>i===this.#e[a]&&this.#t.has(i.id))||this.#u()}))}),this.#o.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-toc-ignore","id","hidden"]}))}#k(){let e=this.#m(),t=this.dataset.title||"On this page",n=this.#b();if(!n||(this.#e=this.#g(n),this.#e.length===0))return;let s={depth:-1,children:[]},i=[s];for(let f of this.#e){let d=e.indexOf(f.tagName.toLowerCase());for(;i[i.length-1].depth>=d;)i.pop();let o={heading:f,depth:d,children:[]};i[i.length-1].children.push(o),i.push(o)}let a=f=>{let d=document.createElement("ul");d.className="list";for(let o of f){let l=document.createElement("li");l.className="item",l.dataset.level=String(o.depth);let u=document.createElement("a");u.href=`#${o.heading.id}`,u.className="link",u.textContent=this.#$(o.heading),l.appendChild(u),o.children.length&&l.appendChild(a(o.children)),d.appendChild(l),this.#t.set(o.heading.id,u)}return d},c=document.createElement("details");c.className="details",c.setAttribute("data-page-toc-generated",""),c.open=!0;let m=document.createElement("summary");m.className="summary",m.textContent=t,c.appendChild(m);let h=document.createElement("nav");h.className="nav",h.setAttribute("aria-label",t),h.appendChild(a(s.children)),c.appendChild(h),this.#i=c,this.appendChild(c)}#$(e){let t=e.cloneNode(!0);return t.querySelectorAll(".heading-anchor").forEach(s=>s.remove()),t.textContent.trim()}#x(e){let t=new URL(window.location.href);t.hash=e.id,window.history.pushState(null,"",t);let n=window.matchMedia("(prefers-reduced-motion: reduce)").matches;e.scrollIntoView({behavior:n?"auto":"smooth",block:"start"}),e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}),this.#h(e.id),this.dispatchEvent(new CustomEvent("page-toc:navigate",{bubbles:!0,detail:{id:e.id}}))}#M(){if(this.#e.length===0)return;let e=new Set;this.#n=new IntersectionObserver(t=>{for(let n of t)n.isIntersecting?e.add(n.target.id):e.delete(n.target.id);this.#T(e)},{rootMargin:"-80px 0px -70% 0px",threshold:0});for(let t of this.#e)this.#n.observe(t)}#T(e){for(let t of this.#e)if(e.has(t.id)){this.#h(t.id);return}this.#a()}};function b(r){try{return decodeURIComponent(r)}catch{return r}}v("page-toc",g);export{g as PageToc};
2
2
  //# sourceMappingURL=page-toc.js.map
@@ -1,2 +1,2 @@
1
- var y=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function f(n,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=u.get(n);if(customElements.get(n)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}u.set(n,s),customElements.define(n,t)}var l=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,i,s){t.addEventListener(e,i,s),this.#e.push(()=>t.removeEventListener(e,i,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 i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#i(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var p=0,b="button, a[href], input, select, textarea, [tabindex]",m='input:not([type="checkbox"]):not([type="radio"]):not([type="button"]), select, textarea, [contenteditable]',d=class extends l{static get observedAttributes(){return["data-orientation","data-position"]}#e=null;#t=null;#i=null;#s=!1;#n=null;#a=!1;#r=0;#l=null;setup(){this.hasAttribute("role")||this.setAttribute("role","toolbar"),this.getAttribute("aria-label")||this.setAttribute("aria-label","Page tools"),this.#u(),this.#g();let t=this.dataset.breakpoint||"48rem";this.#i=matchMedia(`(max-width: ${t})`),this.#p(this.#i),this.listen(this.#i,"change",e=>this.#p(e)),this.listen(this,"keydown",this.#y),this.listen(this,"focusin",this.#m),this.#n=new MutationObserver(e=>{for(let i of e)i.type==="childList"&&i.target===this&&this.#s&&this.#E();this.#d()}),this.#n.observe(this,{childList:!0,subtree:!0}),this.#d()}teardown(){this.#n?.disconnect(),this.#n=null,cancelAnimationFrame(this.#r),this.#r=0,this.#s&&this.#b(),this.#e?.remove(),this.#t?.remove(),this.#e=null,this.#t=null,this.#l=null}attributeChangedCallback(t,e,i){e===i||!this.hasAttribute("data-upgraded")||this.#u()}get tools(){let t=this.#s&&this.#t?this.#t:this;return Array.from(t.children).filter(e=>!e.hasAttribute("data-page-tools-internal"))}#u(){let t=this.dataset.orientation||"auto",e=this.dataset.position||"sticky",i=t==="horizontal"||t==="vertical"?t:e==="inline"?"horizontal":"vertical";this.setAttribute("data-resolved-orientation",i),this.#h()}#f(){return this.#s?"vertical":this.dataset.resolvedOrientation||"vertical"}#h(){this.setAttribute("aria-orientation",this.#f())}#c(){return Array.from(this.querySelectorAll(b)).filter(t=>!t.closest("[data-page-tools-internal]:not(.page-tools-popover)")&&!t.matches(":disabled")&&!t.closest("[inert]")&&t.checkVisibility())}#d(){this.#r||(this.#r=requestAnimationFrame(()=>{this.#r=0,this.#o()}))}#o(t=null){let e=this.#c();if(!e.length)return;let i=[t,this.#l].find(s=>s&&e.includes(s))||e[0];this.#l=i;for(let s of e)s.tabIndex=s===i?0:-1}#m=t=>{let e=t.target;e!==this.#e&&this.#c().includes(e)&&this.#o(e)};#y=t=>{if(t.altKey||t.ctrlKey||t.metaKey)return;let e=t.target;if(e===this.#e||e.matches(m))return;let i=this.#c(),s=i.indexOf(e);if(s===-1)return;let r=this.#f()==="horizontal",h=getComputedStyle(this).direction==="rtl",c=r?h?"ArrowRight":"ArrowLeft":"ArrowUp",a=r?h?"ArrowLeft":"ArrowRight":"ArrowDown",o=-1;t.key===a?o=(s+1)%i.length:t.key===c?o=(s-1+i.length)%i.length:t.key==="Home"?o=0:t.key==="End"&&(o=i.length-1),o!==-1&&(t.preventDefault(),this.#o(i[o]),i[o].focus())};#g(){let t=`pt-${++p}`,e=this.dataset.fabIcon||"ellipsis-vertical",i=this.dataset.fabLabel||"Page tools";this.#e=document.createElement("button"),this.#e.type="button",this.#e.className="page-tools-fab",this.#e.setAttribute("data-page-tools-internal",""),this.#e.setAttribute("popovertarget",t),this.#e.setAttribute("aria-label",i),this.#e.hidden=!0;let s=document.createElement("icon-wc");s.setAttribute("name",e),s.setAttribute("size","md"),s.setAttribute("aria-hidden","true"),this.#e.appendChild(s),this.#t=document.createElement("section"),this.#t.className="page-tools-popover",this.#t.setAttribute("data-page-tools-internal",""),this.#t.id=t,this.#t.setAttribute("popover",""),this.#t.setAttribute("aria-label",i),this.appendChild(this.#e),this.appendChild(this.#t),this.listen(this.#t,"beforetoggle",r=>{r.newState==="closed"?this.#a=!!this.#t?.contains(document.activeElement):this.#v()}),this.listen(this.#t,"toggle",r=>{if(r.newState==="open"){this.#o();return}let c=this.#a&&this.#s;if(this.#a=!1,!c)return;let a=document.activeElement;(!a||a===document.body||this.#t?.contains(a))&&this.#e?.focus()})}#v(){if(!this.#e||!this.#t)return;if(this.#e.parentElement===this){this.#t.style.removeProperty("--_fab-top"),this.#t.style.removeProperty("--_fab-end");return}let t=this.#e.getBoundingClientRect(),i=getComputedStyle(this.#e).direction==="rtl"?t.left:document.documentElement.clientWidth-t.right;this.#t.style.setProperty("--_fab-top",`${Math.round(window.innerHeight-t.top+8)}px`),this.#t.style.setProperty("--_fab-end",`${Math.max(8,Math.round(i))}px`)}#p(t){t.matches??t?this.#A():this.#b()}#A(){if(this.#s||!this.#e||!this.#t)return;let t=this.tools;for(let e of t)this.#t.appendChild(e);this.#s=!0,this.#e.hidden=!1,document.querySelector("fab-stack")?.append(this.#e),this.setAttribute("data-collapsed",""),this.#h()}#b(){if(!this.#s||!this.#e||!this.#t)return;this.#s=!1,this.#t.matches(":popover-open")&&this.#t.hidePopover?.(),this.#e.parentElement!==this&&this.insertBefore(this.#e,this.#t);let t=Array.from(this.#t.children);for(let e of t)this.insertBefore(e,this.#e);this.#e.hidden=!0,this.removeAttribute("data-collapsed"),this.#h(),this.#d()}#E(){if(!this.#t)return;let t=Array.from(this.children).filter(e=>!e.hasAttribute("data-page-tools-internal"));for(let e of t)this.#t.appendChild(e)}};f("page-tools",d);export{d as PageTools};
1
+ var A=window.matchMedia("(prefers-reduced-motion: reduce)");var u=new Map;function f(n,t,e={}){let i=e.priority??10,r={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=u.get(n);if(customElements.get(n)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${n}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${n}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}u.set(n,r),customElements.define(n,t)}var c=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,i,r){t.addEventListener(e,i,r),this.#e.push(()=>t.removeEventListener(e,i,r))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,e){this.#t||(this.#t=this.attachInternals());let i=this.#t.states;try{e?i.add(t):i.delete(t)}catch{let r=`--${t}`;e?i.add(r):i.delete(r)}}_adoptInternals(t){this.#t||(this.#t=t)}#i(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#i()?.validity}get validationMessage(){return this.#i()?.validationMessage??""}get willValidate(){return this.#i()?.willValidate??!1}get form(){return this.#i()?.form??null}checkValidity(){return this.#i()?.checkValidity()??!0}reportValidity(){return this.#i()?.reportValidity()??!0}};var p=0,b="button, a[href], input, select, textarea, [tabindex]",m='input:not([type="checkbox"]):not([type="radio"]):not([type="button"]), select, textarea, [contenteditable]',h=class extends c{static get observedAttributes(){return["data-orientation","data-position"]}#e=null;#t=null;#i=null;#r=!1;#n=null;#a=!1;#s=0;#c=null;#l=!1;setup(){this.hasAttribute("role")||(this.setAttribute("role","toolbar"),this.#l=!0),this.getAttribute("aria-label")||this.setAttribute("aria-label","Page tools"),this.#p(),this.#g();let t=this.dataset.breakpoint||"48rem";this.#i=matchMedia(`(max-width: ${t})`),this.#b(this.#i),this.listen(this.#i,"change",e=>this.#b(e)),this.listen(this,"keydown",this.#v),this.listen(this,"focusin",this.#y),this.#n=new MutationObserver(e=>{for(let i of e)i.type==="childList"&&i.target===this&&this.#r&&this.#w();this.#f()}),this.#n.observe(this,{childList:!0,subtree:!0}),this.#f()}teardown(){this.#n?.disconnect(),this.#n=null,cancelAnimationFrame(this.#s),this.#s=0,this.#r&&this.#m(),this.#e?.remove(),this.#t?.remove(),this.#e=null,this.#t=null,this.#c=null}attributeChangedCallback(t,e,i){e===i||!this.hasAttribute("data-upgraded")||this.#p()}get tools(){let t=this.#r&&this.#t?this.#t:this;return Array.from(t.children).filter(e=>!e.hasAttribute("data-page-tools-internal"))}#p(){let t=this.dataset.orientation||"auto",e=this.dataset.position||"sticky",i=t==="horizontal"||t==="vertical"?t:e==="inline"?"horizontal":"vertical";this.setAttribute("data-resolved-orientation",i),this.#h()}#d(){return this.#r?"vertical":this.dataset.resolvedOrientation||"vertical"}#h(){if(this.#r&&this.#l){this.removeAttribute("role"),this.removeAttribute("aria-orientation"),this.#t?.setAttribute("role","toolbar"),this.#t?.setAttribute("aria-orientation",this.#d());return}this.#t?.removeAttribute("role"),this.#t?.removeAttribute("aria-orientation"),this.#l&&this.setAttribute("role","toolbar"),this.setAttribute("aria-orientation",this.#d())}#u(){return Array.from(this.querySelectorAll(b)).filter(t=>!t.closest("[data-page-tools-internal]:not(.page-tools-popover)")&&!t.matches(":disabled")&&!t.closest("[inert]")&&t.checkVisibility())}#f(){this.#s||(this.#s=requestAnimationFrame(()=>{this.#s=0,this.#o()}))}#o(t=null){let e=this.#u();if(!e.length)return;let i=[t,this.#c].find(r=>r&&e.includes(r))||e[0];this.#c=i;for(let r of e)r.tabIndex=r===i?0:-1}#y=t=>{let e=t.target;e!==this.#e&&this.#u().includes(e)&&this.#o(e)};#v=t=>{if(t.altKey||t.ctrlKey||t.metaKey)return;let e=t.target;if(e===this.#e||e.matches(m))return;let i=this.#u(),r=i.indexOf(e);if(r===-1)return;let s=this.#d()==="horizontal",l=getComputedStyle(this).direction==="rtl",d=s?l?"ArrowRight":"ArrowLeft":"ArrowUp",a=s?l?"ArrowLeft":"ArrowRight":"ArrowDown",o=-1;t.key===a?o=(r+1)%i.length:t.key===d?o=(r-1+i.length)%i.length:t.key==="Home"?o=0:t.key==="End"&&(o=i.length-1),o!==-1&&(t.preventDefault(),this.#o(i[o]),i[o].focus())};#g(){let t=`pt-${++p}`,e=this.dataset.fabIcon||"ellipsis-vertical",i=this.dataset.fabLabel||"Page tools";this.#e=document.createElement("button"),this.#e.type="button",this.#e.className="page-tools-fab",this.#e.setAttribute("data-page-tools-internal",""),this.#e.setAttribute("popovertarget",t),this.#e.setAttribute("aria-label",i),this.#e.hidden=!0;let r=document.createElement("icon-wc");r.setAttribute("name",e),r.setAttribute("size","md"),r.setAttribute("aria-hidden","true"),this.#e.appendChild(r),this.#t=document.createElement("section"),this.#t.className="page-tools-popover",this.#t.setAttribute("data-page-tools-internal",""),this.#t.id=t,this.#t.setAttribute("popover",""),this.#t.setAttribute("aria-label",i),this.appendChild(this.#e),this.appendChild(this.#t),this.listen(this.#t,"beforetoggle",s=>{s.newState==="closed"?this.#a=!!this.#t?.contains(document.activeElement):this.#A()}),this.listen(this.#t,"toggle",s=>{if(s.newState==="open"){this.#o();return}let d=this.#a&&this.#r;if(this.#a=!1,!d)return;let a=document.activeElement;(!a||a===document.body||this.#t?.contains(a))&&this.#e?.focus()})}#A(){if(!this.#e||!this.#t)return;if(this.#e.parentElement===this){this.#t.style.removeProperty("--_fab-top"),this.#t.style.removeProperty("--_fab-end");return}let t=this.#e.getBoundingClientRect(),i=getComputedStyle(this.#e).direction==="rtl"?t.left:document.documentElement.clientWidth-t.right;this.#t.style.setProperty("--_fab-top",`${Math.round(window.innerHeight-t.top+8)}px`),this.#t.style.setProperty("--_fab-end",`${Math.max(8,Math.round(i))}px`)}#b(t){t.matches??t?this.#E():this.#m()}#E(){if(this.#r||!this.#e||!this.#t)return;let t=this.tools;for(let e of t)this.#t.appendChild(e);this.#r=!0,this.#e.hidden=!1,document.querySelector("fab-stack")?.append(this.#e),this.setAttribute("data-collapsed",""),this.#h()}#m(){if(!this.#r||!this.#e||!this.#t)return;this.#r=!1,this.#t.matches(":popover-open")&&this.#t.hidePopover?.(),this.#e.parentElement!==this&&this.insertBefore(this.#e,this.#t);let t=Array.from(this.#t.children);for(let e of t)this.insertBefore(e,this.#e);this.#e.hidden=!0,this.removeAttribute("data-collapsed"),this.#h(),this.#f()}#w(){if(!this.#t)return;let t=Array.from(this.children).filter(e=>!e.hasAttribute("data-page-tools-internal"));for(let e of t)this.#t.appendChild(e)}};f("page-tools",h);export{h as PageTools};
2
2
  //# sourceMappingURL=page-tools.js.map
@@ -1,2 +1,2 @@
1
- var q=window.matchMedia("(prefers-reduced-motion: reduce)");var E=new Map;function A(a,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=E.get(a);if(customElements.get(a)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${a}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${a}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}E.set(a,s),customElements.define(a,t)}var m=class extends HTMLElement{#e=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#e.push(()=>t.removeEventListener(e,i,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.#i||(this.#i=this.attachInternals());let i=this.#i.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#i||(this.#i=t)}#s(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#s()?.validity}get validationMessage(){return this.#s()?.validationMessage??""}get willValidate(){return this.#s()?.willValidate??!1}get form(){return this.#s()?.form??null}checkValidity(){return this.#s()?.checkValidity()??!0}reportValidity(){return this.#s()?.reportValidity()??!0}};var b=CSS.supports("anchor-name","--x")&&CSS.supports("position-area","bottom"),C=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches,M="--tour-target",w='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',N='input, textarea, select, [contenteditable]:not([contenteditable="false"])',T={title:"Page Tour",step:"Step {n} of {total}",skip:"Skip tour",close:"Close",prev:"Previous",next:"Next",finish:"Finish",nav:"Tour navigation",ready:"Done. Next is available."},L=0,k=class extends HTMLElement{get target(){return this.dataset.target??""}get placement(){return this.dataset.placement??"auto"}get action(){return this.dataset.action??"none"}get actionHint(){return this.dataset.actionHint??null}get skippable(){return this.dataset.skippable!=="false"}get scrollBehavior(){return this.dataset.scroll??"smooth"}};function $(a){if(!a?.target)return null;try{return document.querySelector(a.target)}catch{return null}}function h(a,t,e){let i=document.createElement(a);return t&&(i.className=t),e!=null&&(i.textContent=e),i}var S=class a extends m{#e=[];#i=0;#s=!1;#c=null;#r=null;#t=null;#n=null;#A=null;#u=null;#g="";#b=null;#m=null;#w=null;#d=null;#l=null;#v=null;#p=null;static#h=null;static observedAttributes=["data-step"];setup(){if(this.#e=[...this.querySelectorAll("tour-step")],this.#e.length===0)return!1;let t=this.querySelector(".page-tour-start-btn");if(t&&this.listen(t,"click",e=>{e.preventDefault(),this.start()}),this.id&&this.listen(document,"click",e=>{e.target?.closest?.(`[data-tour="${CSS.escape(this.id)}"]`)&&(e.preventDefault(),this.start())}),this.dataset.trigger==="auto"){let e=this.#W();e?.complete||e?.skipped?this.setAttribute("data-complete",""):this.#p=setTimeout(()=>{this.#p=null,this.isConnected&&this.start(e?.step??0)},400)}return!0}teardown(){this.#p&&(clearTimeout(this.#p),this.#p=null),this.#s&&this.stop()}attributeChangedCallback(t,e,i){if(t==="data-step"&&this.#s&&e!==null){let s=parseInt(i,10);!Number.isNaN(s)&&s!==this.#i&&this.goto(s)}}start(t=0){let e=Math.min(Math.max(0,Number(t)||0),this.#e.length-1);if(this.#s){this.goto(e);return}let i=this.#a(e,1,!0);if(i===-1&&(i=this.#a(e-1,-1,!0)),i===-1){console.warn("[page-tour] No step target found on the page; tour not started");return}a.#h&&a.#h!==this&&a.#h.stop(),this.#A=document.activeElement,this.#s=!0,a.#h=this,this.#F(),this.setAttribute("data-active",""),this.removeAttribute("data-complete"),this.#f("tour:start",{step:i}),this.#y(i,"next")}stop(){this.#s&&(this.#U(),this.#s=!1,this.removeAttribute("data-active"),a.#h===this&&(a.#h=null))}next(){if(!this.#s||this.#q())return;let t=this.#a(this.#i+1,1,!0);t===-1?this.#J():this.#y(t,"next")}prev(){if(!this.#s)return;let t=this.#a(this.#i-1,-1,!0);t!==-1&&this.#y(t,"prev")}goto(t){if(!this.#s)return;let e=Number(t);if(!Number.isInteger(e)||e<0||e>=this.#e.length)return;let i=e>=this.#i?"next":"prev",s=i==="next"?1:-1,r=this.#a(e,s,!0);r===-1&&(r=this.#a(e-s,s===1?-1:1,!0)),!(r===-1||r===this.#i)&&this.#y(r,i)}skip(){this.#s&&this.#k(this.#e[this.#i])&&(this.#f("tour:skip",{step:this.#i}),this.#E({skipped:!0}),this.stop(),this.setAttribute("data-complete",""))}reset(){this.#G(),this.removeAttribute("data-complete"),this.dataset.step="0"}#o(t){return(t==="title"?this.dataset.title:this.getAttribute(`data-label-${t}`))??T[t]}#k(t){return(this.dataset.mode??"passive")!=="forced"&&(t?.skippable??!0)}#q(){return!!this.#t?.querySelector(".page-tour-next[data-waiting]")}#a(t,e,i=!1){for(let s=t;s>=0&&s<this.#e.length;s+=e){if($(this.#e[s]))return s;i&&console.warn(`[page-tour] Target "${this.#e[s].target}" not found, skipping step ${s}`)}return-1}#F(){this.#c=h("div","page-tour-backdrop"),this.#c.setAttribute("aria-hidden","true"),this.#c.addEventListener("click",()=>this.skip()),this.#r=h("div","page-tour-spotlight"),this.#r.setAttribute("aria-hidden","true"),this.#t=h("div","page-tour-card"),this.#t.setAttribute("popover","manual"),this.#t.setAttribute("role","dialog"),this.#t.setAttribute("aria-label",this.#o("title")),this.#t.setAttribute("tabindex","-1"),this.#t.toggleAttribute("data-anchored",b),this.#t.addEventListener("click",e=>this.#K(e));let t=parseFloat(this.dataset.spotlightPadding??"");if(Number.isFinite(t)&&t>=0)for(let e of[this.#r,this.#t])e.style.setProperty("--tour-spotlight-padding",`${t}px`);this.#n=h("div","visually-hidden"),this.#n.setAttribute("aria-live","polite"),this.#n.setAttribute("aria-atomic","true"),this.#n.id=`page-tour-announcer-${++L}`,this.append(this.#c,this.#r,this.#t,this.#n),this.#t.showPopover(),this.#m=new AbortController,document.addEventListener("keydown",e=>this.#V(e),{signal:this.#m.signal}),requestAnimationFrame(()=>{this.#c?.setAttribute("data-state-visible","")})}#B(t){this.#u=t;let e=getComputedStyle(t).position==="static";t.setAttribute("data-tour-target",e?"raised":""),b&&(this.#g=t.style.getPropertyValue("anchor-name"),t.style.setProperty("anchor-name",M))}#C(){let t=this.#u;t&&(t.removeAttribute("data-tour-target"),b&&(this.#g?t.style.setProperty("anchor-name",this.#g):t.style.removeProperty("anchor-name"),t.getAttribute("style")||t.removeAttribute("style")),this.#g="",this.#u=null)}#$(t){if(!this.#r)return;let e=t.getBoundingClientRect();Object.assign(this.#r.style,{top:`${e.top}px`,left:`${e.left}px`,width:`${e.width}px`,height:`${e.height}px`})}#O(t,e){let i=getComputedStyle(this).direction==="rtl";switch(e){case"top":case"bottom":return e;case"inline-start":return i?"right":"left";case"inline-end":return i?"left":"right";default:return this.#D(t)}}#M(t,e){if(!this.#t)return;let i=this.#O(t,e);this.#t.dataset.side=i,b||this.#P(t,i)}#P(t,e){let i=this.#t;if(!i)return;let s=t.getBoundingClientRect(),r=12,c=8,n=this.#r&&parseFloat(getComputedStyle(this.#r).paddingTop)||0;i.style.visibility="hidden",i.style.top="0",i.style.left="0";let o=i.getBoundingClientRect();i.style.visibility="";let d=0,l=0;switch(e){case"bottom":d=s.bottom+n+r,l=s.left+(s.width-o.width)/2;break;case"top":d=s.top-n-r-o.height,l=s.left+(s.width-o.width)/2;break;case"right":d=s.top+(s.height-o.height)/2,l=s.right+n+r;break;case"left":d=s.top+(s.height-o.height)/2,l=s.left-n-r-o.width;break}l=Math.max(c,Math.min(l,window.innerWidth-o.width-c)),d=Math.max(c,Math.min(d,window.innerHeight-o.height-c)),i.style.top=`${d}px`,i.style.left=`${l}px`}#D(t){let e=t.getBoundingClientRect(),i=window.innerHeight-e.bottom,s=e.top,r=window.innerWidth-e.right,c=e.left,n=Math.max(i,s,r,c);return n===i?"bottom":n===s?"top":n===r?"right":"left"}#I(t,e){let i=this.#t;if(!i)return;let s=this.#e.length,r=this.#a(e+1,1)!==-1,c=this.#a(e-1,-1)!==-1,n=t.action!=="none",o=h("div","page-tour-progress");o.setAttribute("aria-hidden","true"),this.#e.forEach((u,x)=>{let y=h("span","page-tour-pip");x===e&&y.setAttribute("data-active",""),x<e&&y.setAttribute("data-visited",""),o.append(y)});let d=h("p","page-tour-meta");d.append(h("span","page-tour-step-count",this.#o("step").replace("{n}",String(e+1)).replace("{total}",String(s))));let l=h("div","page-tour-content");for(let u of t.childNodes)l.append(u.cloneNode(!0));let f=h("footer","page-tour-footer");if(this.#k(t)){let u=h("button","page-tour-skip",this.#o(r?"skip":"close"));u.type="button",u.dataset.action="skip",f.append(u)}let g=h("nav","page-tour-nav");if(g.setAttribute("aria-label",this.#o("nav")),c){let u=h("button","page-tour-prev",this.#o("prev"));u.type="button",u.dataset.action="prev",g.append(u)}let p=h("button","page-tour-next",this.#o(r?"next":"finish"));p.type="button",p.dataset.action="next",g.append(p),f.append(g);let v=[o,d,l];if(n&&(p.setAttribute("data-waiting",""),p.setAttribute("aria-disabled","true"),t.actionHint)){let u=h("p","page-tour-action-hint",t.actionHint);u.id=`${this.#n?.id??"page-tour"}-hint`,p.setAttribute("aria-describedby",u.id),v.push(u)}v.push(f),i.replaceChildren(...v),n?i.removeAttribute("aria-modal"):i.setAttribute("aria-modal","true")}#y(t,e="next"){let i=this.#e[t],s=$(i);if(!i||!s)return;if(this.#d?.abort(),this.#d=null,this.#T(),this.#C(),this.#i=t,this.#B(s),i.scrollBehavior!=="none"){let o=C()?"instant":i.scrollBehavior;s.scrollIntoView({block:"nearest",behavior:o})}this.#I(i,t),this.#$(s),this.#M(s,i.placement);let r=this.#t;r?.focus(),requestAnimationFrame(()=>{if(this.#t!==r||this.#i!==t)return;let o=r?.querySelector(".page-tour-content :is(h2, h3, h4)")??null;o?(o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.focus()):(r?.querySelector(".page-tour-next")??null)?.focus()});let c=i.querySelector("h2, h3, h4"),n=this.#o("step").replace("{n}",String(t+1)).replace("{total}",String(this.#e.length));this.#L(c?.textContent?`${n}: ${c.textContent.trim()}`:n),this.dataset.step=String(t),i.action!=="none"&&this.#R(i,s),this.#j(s),this.#E({step:t}),this.#f("tour:step",{step:t,target:s,direction:e})}#R(t,e){let i=new AbortController;this.#d=i;let r={click:"click",focus:"focus",input:"input",change:"change"}[t.action];r?e.addEventListener(r,()=>{i.abort(),this.#N(),this.#f("tour:action",{step:this.#i,action:t.action})},{signal:i.signal}):t.action==="custom"&&this.addEventListener("tour:action",()=>{i.abort(),this.#N()},{signal:i.signal})}#N(){let t=this.#t?.querySelector(".page-tour-next");t&&(t.removeAttribute("data-waiting"),t.removeAttribute("aria-disabled"),t.removeAttribute("aria-describedby"),this.#t?.querySelector(".page-tour-action-hint")?.remove(),this.#L(this.#o("ready")))}#V(t){if(!this.#s||t.defaultPrevented)return;let i=!!(t.target instanceof Element?t.target:null)?.closest(N),s=t.altKey||t.ctrlKey||t.metaKey;switch(t.key){case"Escape":this.#k(this.#e[this.#i])&&(t.preventDefault(),this.skip());break;case"ArrowRight":case"ArrowDown":if(i||s)return;t.preventDefault(),this.next();break;case"ArrowLeft":case"ArrowUp":if(i||s)return;t.preventDefault(),this.prev();break;case"Home":if(i||s)return;t.preventDefault(),this.goto(0);break;case"End":if(i||s)return;t.preventDefault(),this.goto(this.#e.length-1);break;case"Tab":this.#H(t);break}}#H(t){if(!this.#t)return;let e=p=>!p.disabled&&(p.checkVisibility?.()??!0),i=[...this.#t.querySelectorAll(w)].filter(e),s=[],r=this.#e[this.#i],c=this.#u;r&&r.action!=="none"&&c&&(s=(c.matches(w)?[c]:[...c.querySelectorAll(w)]).filter(e));let n=[...i,...s];if(n.length===0)return;let o=n[0],d=n[n.length-1],l=document.activeElement,f=!l||!n.includes(l),g=f?-1:n.indexOf(l);t.preventDefault(),t.shiftKey?(f||l===o?d:n[g-1]).focus():(f||l===d?o:n[g+1]).focus()}#K(t){let e=t.target.closest?.("[data-action]")??null;if(e)switch(e.dataset.action){case"next":this.next();break;case"prev":this.prev();break;case"skip":this.skip();break}}#j(t){let e=new AbortController;this.#w=e;let i=()=>this.#z();document.addEventListener("scroll",i,{capture:!0,passive:!0,signal:e.signal}),window.addEventListener("resize",i,{passive:!0,signal:e.signal}),this.#b=new ResizeObserver(i),this.#b.observe(t),this.#v=setTimeout(i,C()?0:300)}#T(){this.#w?.abort(),this.#w=null,this.#b?.disconnect(),this.#b=null,this.#v&&(clearTimeout(this.#v),this.#v=null),this.#l&&(cancelAnimationFrame(this.#l),this.#l=null)}#z(){this.#l||(this.#l=requestAnimationFrame(()=>{this.#l=null;let t=this.#u;!this.#s||!t||(this.#$(t),b||this.#M(t,this.#e[this.#i].placement))}))}#J(){this.#f("tour:complete",{steps:this.#e.length}),this.#E({complete:!0}),this.stop(),this.setAttribute("data-complete","")}#U(){this.#m?.abort(),this.#m=null,this.#d?.abort(),this.#d=null,this.#T(),this.#C();let t=document.activeElement,e=!t||t===document.body||!!this.#t?.contains(t);this.#c?.remove(),this.#r?.remove(),this.#t?.matches(":popover-open")&&this.#t.hidePopover(),this.#t?.remove(),this.#n?.remove(),this.#c=null,this.#r=null,this.#t=null,this.#n=null;let i=this.#A;this.#A=null,e&&i?.isConnected&&typeof i.focus=="function"&&i.focus()}#L(t){let e=this.#n;e&&(e.textContent="",requestAnimationFrame(()=>{this.#n===e&&(e.textContent=t)}))}#f(t,e){let i=t!=="tour:skip";this.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:i,detail:e}))}#S(){let t=this.dataset.persist??"session";return t==="session"?sessionStorage:t==="local"?localStorage:null}#x(){return`vb-tour-${this.dataset.persistKey??window.location.pathname}`}#E(t){let e=this.#S();if(!e)return;let i=this.#x(),s={};try{s=JSON.parse(e.getItem(i)??"null")??{}}catch{}e.setItem(i,JSON.stringify({...s,...t}))}#W(){let t=this.#S();if(!t)return null;try{return JSON.parse(t.getItem(this.#x())??"null")}catch{return null}}#G(){let t=this.#S();t&&t.removeItem(this.#x())}};A("page-tour",S);A("tour-step",k);export{S as PageTour,k as TourStep};
1
+ var O=window.matchMedia("(prefers-reduced-motion: reduce)");var C=new Map;function w(c,t,e={}){let i=e.priority??10,s={impl:t,bundle:e.bundle,contract:e.contract,priority:i},r=C.get(c);if(customElements.get(c)){if(!r||r.priority>=i){r&&r.priority===i&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=i){r.priority===i&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${r.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}C.set(c,s),customElements.define(c,t)}var m=class extends HTMLElement{#e=[];#i;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#e.push(()=>t.removeEventListener(e,i,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.#i||(this.#i=this.attachInternals());let i=this.#i.states;try{e?i.add(t):i.delete(t)}catch{let s=`--${t}`;e?i.add(s):i.delete(s)}}_adoptInternals(t){this.#i||(this.#i=t)}#s(){return this.constructor.formAssociated&&this.#i?this.#i:null}get validity(){return this.#s()?.validity}get validationMessage(){return this.#s()?.validationMessage??""}get willValidate(){return this.#s()?.willValidate??!1}get form(){return this.#s()?.form??null}checkValidity(){return this.#s()?.checkValidity()??!0}reportValidity(){return this.#s()?.reportValidity()??!0}};var g=CSS.supports("anchor-name","--x")&&CSS.supports("position-area","bottom"),x=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches,T="--tour-target",A='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',M='input, textarea, select, [contenteditable]:not([contenteditable="false"])',L={title:"Page Tour",step:"Step {n} of {total}",skip:"Skip tour",close:"Close",prev:"Previous",next:"Next",finish:"Finish",nav:"Tour navigation",ready:"Done. Next is available."},P=0,S=class extends HTMLElement{get target(){return this.dataset.target??""}get placement(){return this.dataset.placement??"auto"}get action(){return this.dataset.action??"none"}get actionHint(){return this.dataset.actionHint??null}get skippable(){return this.dataset.skippable!=="false"}get scrollBehavior(){return this.dataset.scroll??"smooth"}};function $(c){if(!c?.target)return null;try{return document.querySelector(c.target)}catch{return null}}function u(c,t,e){let i=document.createElement(c);return t&&(i.className=t),e!=null&&(i.textContent=e),i}var E=class c extends m{#e=[];#i=0;#s=!1;#c=null;#r=null;#t=null;#n=null;#w=null;#h=null;#b="";#g=null;#m=null;#A=null;#d=null;#l=null;#v=null;#p=null;static#u=null;static observedAttributes=["data-step"];setup(){if(this.#e=[...this.querySelectorAll("tour-step")],this.#e.length===0)return!1;let t=this.querySelector(".page-tour-start-btn");if(t&&this.listen(t,"click",e=>{e.preventDefault(),this.start()}),this.id&&this.listen(document,"click",e=>{e.target?.closest?.(`[data-tour="${CSS.escape(this.id)}"]`)&&(e.preventDefault(),this.start())}),this.dataset.trigger==="auto"){let e=this.#W();e?.complete||e?.skipped?this.setAttribute("data-complete",""):this.#p=setTimeout(()=>{this.#p=null,this.isConnected&&this.start(e?.step??0)},400)}return!0}teardown(){this.#p&&(clearTimeout(this.#p),this.#p=null),this.#s&&this.stop()}attributeChangedCallback(t,e,i){if(t==="data-step"&&this.#s&&e!==null){let s=parseInt(i,10);!Number.isNaN(s)&&s!==this.#i&&this.goto(s)}}start(t=0){let e=Math.min(Math.max(0,Number(t)||0),this.#e.length-1);if(this.#s){this.goto(e);return}let i=this.#a(e,1,!0);if(i===-1&&(i=this.#a(e-1,-1,!0)),i===-1){console.warn("[page-tour] No step target found on the page; tour not started");return}c.#u&&c.#u!==this&&c.#u.stop(),this.#w=document.activeElement,this.#s=!0,c.#u=this,this.#B(),this.setAttribute("data-active",""),this.removeAttribute("data-complete"),this.#f("tour:start",{step:i}),this.#y(i,"next")}stop(){this.#s&&(this.#U(),this.#s=!1,this.removeAttribute("data-active"),c.#u===this&&(c.#u=null))}next(){if(!this.#s||this.#q())return;let t=this.#a(this.#i+1,1,!0);t===-1?this.#J():this.#y(t,"next")}prev(){if(!this.#s)return;let t=this.#a(this.#i-1,-1,!0);t!==-1&&this.#y(t,"prev")}goto(t){if(!this.#s)return;let e=Number(t);if(!Number.isInteger(e)||e<0||e>=this.#e.length)return;let i=e>=this.#i?"next":"prev",s=i==="next"?1:-1,r=this.#a(e,s,!0);r===-1&&(r=this.#a(e-s,s===1?-1:1,!0)),!(r===-1||r===this.#i)&&this.#y(r,i)}skip(){this.#s&&this.#S(this.#e[this.#i])&&(this.#f("tour:skip",{step:this.#i}),this.#C({skipped:!0}),this.stop(),this.setAttribute("data-complete",""))}reset(){this.#G(),this.removeAttribute("data-complete"),this.dataset.step="0"}#o(t){return(t==="title"?this.dataset.title:this.getAttribute(`data-label-${t}`))??L[t]}#S(t){return(this.dataset.mode??"passive")!=="forced"&&(t?.skippable??!0)}#q(){return!!this.#t?.querySelector(".page-tour-next[data-waiting]")}#a(t,e,i=!1){for(let s=t;s>=0&&s<this.#e.length;s+=e){if($(this.#e[s]))return s;i&&console.warn(`[page-tour] Target "${this.#e[s].target}" not found, skipping step ${s}`)}return-1}#B(){this.#c=u("div","page-tour-backdrop"),this.#c.setAttribute("aria-hidden","true"),this.#c.addEventListener("click",()=>this.skip()),this.#r=u("div","page-tour-spotlight"),this.#r.setAttribute("aria-hidden","true"),this.#t=u("div","page-tour-card"),this.#t.setAttribute("popover","manual"),this.#t.setAttribute("role","dialog"),this.#t.setAttribute("aria-label",this.#o("title")),this.#t.setAttribute("tabindex","-1"),this.#t.toggleAttribute("data-anchored",g),this.#t.addEventListener("click",e=>this.#j(e));let t=parseFloat(this.dataset.spotlightPadding??"");if(Number.isFinite(t)&&t>=0)for(let e of[this.#r,this.#t])e.style.setProperty("--tour-spotlight-padding",`${t}px`);this.#n=u("div","visually-hidden"),this.#n.setAttribute("aria-live","polite"),this.#n.setAttribute("aria-atomic","true"),this.#n.id=`page-tour-announcer-${++P}`,this.append(this.#c,this.#r,this.#t,this.#n),this.#t.showPopover(),this.#m=new AbortController,document.addEventListener("keydown",e=>this.#I(e),{signal:this.#m.signal}),requestAnimationFrame(()=>{this.#c?.setAttribute("data-state-visible","")})}#F(t){this.#h=t;let e=getComputedStyle(t).position==="static";t.setAttribute("data-tour-target",e?"raised":""),g&&(this.#b=t.style.getPropertyValue("anchor-name"),t.style.setProperty("anchor-name",T))}#x(){let t=this.#h;t&&(t.removeAttribute("data-tour-target"),g&&(this.#b?t.style.setProperty("anchor-name",this.#b):t.style.removeProperty("anchor-name"),t.getAttribute("style")||t.removeAttribute("style")),this.#b="",this.#h=null)}#$(t){if(!this.#r)return;let e=t.getBoundingClientRect();Object.assign(this.#r.style,{top:`${e.top}px`,left:`${e.left}px`,width:`${e.width}px`,height:`${e.height}px`})}#O(t,e){let i=getComputedStyle(this).direction==="rtl";switch(e){case"top":case"bottom":return e;case"inline-start":return i?"right":"left";case"inline-end":return i?"left":"right";default:return this.#D(t)}}#T(t,e){if(!this.#t)return;let i=this.#O(t,e);this.#t.dataset.side=i,g||this.#H(t,i)}#H(t,e){let i=this.#t;if(!i)return;let s=t.getBoundingClientRect(),r=12,o=8,n=this.#r&&parseFloat(getComputedStyle(this.#r).paddingTop)||0;i.style.visibility="hidden",i.style.top="0",i.style.left="0";let a=i.getBoundingClientRect();i.style.visibility="";let d=0,l=0;switch(e){case"bottom":d=s.bottom+n+r,l=s.left+(s.width-a.width)/2;break;case"top":d=s.top-n-r-a.height,l=s.left+(s.width-a.width)/2;break;case"right":d=s.top+(s.height-a.height)/2,l=s.right+n+r;break;case"left":d=s.top+(s.height-a.height)/2,l=s.left-n-r-a.width;break}l=Math.max(o,Math.min(l,window.innerWidth-a.width-o)),d=Math.max(o,Math.min(d,window.innerHeight-a.height-o)),i.style.top=`${d}px`,i.style.left=`${l}px`}#D(t){let e=t.getBoundingClientRect(),i=window.innerHeight-e.bottom,s=e.top,r=window.innerWidth-e.right,o=e.left,n=Math.max(i,s,r,o);return n===i?"bottom":n===s?"top":n===r?"right":"left"}#R(t,e){let i=this.#t;if(!i)return;let s=this.#e.length,r=this.#a(e+1,1)!==-1,o=this.#a(e-1,-1)!==-1,n=t.action!=="none",a=u("div","page-tour-progress");a.setAttribute("aria-hidden","true"),this.#e.forEach((h,k)=>{let y=u("span","page-tour-pip");k===e&&y.setAttribute("data-active",""),k<e&&y.setAttribute("data-visited",""),a.append(y)});let d=u("p","page-tour-meta");d.append(u("span","page-tour-step-count",this.#o("step").replace("{n}",String(e+1)).replace("{total}",String(s))));let l=u("div","page-tour-content");for(let h of t.childNodes)l.append(h.cloneNode(!0));let f=u("footer","page-tour-footer");if(this.#S(t)){let h=u("button","page-tour-skip",this.#o(r?"skip":"close"));h.type="button",h.dataset.action="skip",f.append(h)}let b=u("nav","page-tour-nav");if(b.setAttribute("aria-label",this.#o("nav")),o){let h=u("button","page-tour-prev",this.#o("prev"));h.type="button",h.dataset.action="prev",b.append(h)}let p=u("button","page-tour-next",this.#o(r?"next":"finish"));p.type="button",p.dataset.action="next",b.append(p),f.append(b);let v=[a,d,l];if(n&&(p.setAttribute("data-waiting",""),p.setAttribute("aria-disabled","true"),t.actionHint)){let h=u("p","page-tour-action-hint",t.actionHint);h.id=`${this.#n?.id??"page-tour"}-hint`,p.setAttribute("aria-describedby",h.id),v.push(h)}v.push(f),i.replaceChildren(...v),n?i.removeAttribute("aria-modal"):i.setAttribute("aria-modal","true")}#y(t,e="next"){let i=this.#e[t],s=$(i);if(!i||!s)return;if(this.#d?.abort(),this.#d=null,this.#L(),this.#x(),this.#i=t,this.#F(s),i.scrollBehavior!=="none"){let a=x()?"instant":i.scrollBehavior;s.scrollIntoView({block:"nearest",behavior:a})}this.#R(i,t),this.#$(s),this.#T(s,i.placement);let r=this.#t;r?.focus(),requestAnimationFrame(()=>{if(this.#t!==r||this.#i!==t)return;let a=r?.querySelector(".page-tour-content :is(h2, h3, h4)")??null;a?(a.hasAttribute("tabindex")||a.setAttribute("tabindex","-1"),a.focus()):(r?.querySelector(".page-tour-next")??null)?.focus()});let o=i.querySelector("h2, h3, h4"),n=this.#o("step").replace("{n}",String(t+1)).replace("{total}",String(this.#e.length));this.#P(o?.textContent?`${n}: ${o.textContent.trim()}`:n),this.dataset.step=String(t),i.action!=="none"&&this.#V(i,s),this.#K(s),this.#C({step:t}),this.#f("tour:step",{step:t,target:s,direction:e})}#V(t,e){let i=new AbortController;this.#d=i;let r={click:"click",focus:"focus",input:"input",change:"change"}[t.action];r?e.addEventListener(r,()=>{i.abort(),this.#M(),this.#f("tour:action",{step:this.#i,action:t.action})},{signal:i.signal}):t.action==="custom"&&this.addEventListener("tour:action",()=>{i.abort(),this.#M()},{signal:i.signal})}#M(){let t=this.#t?.querySelector(".page-tour-next");t&&(t.removeAttribute("data-waiting"),t.removeAttribute("aria-disabled"),t.removeAttribute("aria-describedby"),this.#t?.querySelector(".page-tour-action-hint")?.remove(),this.#P(this.#o("ready")))}#I(t){if(!this.#s||t.defaultPrevented)return;let e=t.target instanceof Element?t.target:null,i=!!e&&(!!this.#t?.contains(e)||e===document.body),s=!!e?.closest(M),r=!i||s||t.altKey||t.ctrlKey||t.metaKey,o=t.key;switch(getComputedStyle(document.documentElement).direction==="rtl"&&(o==="ArrowRight"?o="ArrowLeft":o==="ArrowLeft"&&(o="ArrowRight")),o){case"Escape":this.#S(this.#e[this.#i])&&(t.preventDefault(),this.skip());break;case"ArrowRight":case"ArrowDown":if(r)return;t.preventDefault(),this.next();break;case"ArrowLeft":case"ArrowUp":if(r)return;t.preventDefault(),this.prev();break;case"Home":if(r)return;t.preventDefault(),this.goto(0);break;case"End":if(r)return;t.preventDefault(),this.goto(this.#e.length-1);break;case"Tab":this.#_(t);break}}#_(t){if(!this.#t)return;let e=p=>!p.disabled&&(p.checkVisibility?.()??!0),i=[...this.#t.querySelectorAll(A)].filter(e),s=[],r=this.#e[this.#i],o=this.#h;r&&r.action!=="none"&&o&&(s=(o.matches(A)?[o]:[...o.querySelectorAll(A)]).filter(e));let n=[...i,...s];if(n.length===0)return;let a=n[0],d=n[n.length-1],l=document.activeElement,f=!l||!n.includes(l),b=f?-1:n.indexOf(l);t.preventDefault(),t.shiftKey?(f||l===a?d:n[b-1]).focus():(f||l===d?a:n[b+1]).focus()}#j(t){let e=t.target.closest?.("[data-action]")??null;if(e)switch(e.dataset.action){case"next":this.next();break;case"prev":this.prev();break;case"skip":this.skip();break}}#K(t){let e=new AbortController;this.#A=e;let i=()=>this.#z();document.addEventListener("scroll",i,{capture:!0,passive:!0,signal:e.signal}),window.addEventListener("resize",i,{passive:!0,signal:e.signal}),this.#g=new ResizeObserver(i),this.#g.observe(t),this.#v=setTimeout(i,x()?0:300)}#L(){this.#A?.abort(),this.#A=null,this.#g?.disconnect(),this.#g=null,this.#v&&(clearTimeout(this.#v),this.#v=null),this.#l&&(cancelAnimationFrame(this.#l),this.#l=null)}#z(){this.#l||(this.#l=requestAnimationFrame(()=>{this.#l=null;let t=this.#h;!this.#s||!t||(this.#$(t),g||this.#T(t,this.#e[this.#i].placement))}))}#J(){this.#f("tour:complete",{steps:this.#e.length}),this.#C({complete:!0}),this.stop(),this.setAttribute("data-complete","")}#U(){this.#m?.abort(),this.#m=null,this.#d?.abort(),this.#d=null,this.#L(),this.#x();let t=document.activeElement,e=!t||t===document.body||!!this.#t?.contains(t);this.#c?.remove(),this.#r?.remove(),this.#t?.matches(":popover-open")&&this.#t.hidePopover(),this.#t?.remove(),this.#n?.remove(),this.#c=null,this.#r=null,this.#t=null,this.#n=null;let i=this.#w;this.#w=null,e&&i?.isConnected&&typeof i.focus=="function"&&i.focus()}#P(t){let e=this.#n;e&&(e.textContent="",requestAnimationFrame(()=>{this.#n===e&&(e.textContent=t)}))}#f(t,e){let i=t!=="tour:skip";this.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:i,detail:e}))}#E(){let t=this.dataset.persist??"session";return t==="session"?sessionStorage:t==="local"?localStorage:null}#k(){return`vb-tour-${this.dataset.persistKey??window.location.pathname}`}#C(t){let e=this.#E();if(!e)return;let i=this.#k(),s={};try{s=JSON.parse(e.getItem(i)??"null")??{}}catch{}e.setItem(i,JSON.stringify({...s,...t}))}#W(){let t=this.#E();if(!t)return null;try{return JSON.parse(t.getItem(this.#k())??"null")}catch{return null}}#G(){let t=this.#E();t&&t.removeItem(this.#k())}};w("page-tour",E);w("tour-step",S);export{E as PageTour,S as TourStep};
2
2
  //# sourceMappingURL=page-tour.js.map