vanilla-breeze 0.1.2 → 0.1.4

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 (268) hide show
  1. package/dist/cdn/components/accessibility-specimen.js +11 -0
  2. package/dist/cdn/components/accordion-wc.js +1 -1
  3. package/dist/cdn/components/activity-feed.js +2 -0
  4. package/dist/cdn/components/adr-wc.js +17 -17
  5. package/dist/cdn/components/ai-chat.js +28 -0
  6. package/dist/cdn/components/ai-summary.js +10 -0
  7. package/dist/cdn/components/analytics-panel.js +5 -5
  8. package/dist/cdn/components/audio-player.js +3 -3
  9. package/dist/cdn/components/audio-visualizer.js +2 -2
  10. package/dist/cdn/components/author-index.js +2 -2
  11. package/dist/cdn/components/brand-mark.js +1 -1
  12. package/dist/cdn/components/bread-crumb.js +2 -0
  13. package/dist/cdn/components/breakpoint-specimen.js +26 -0
  14. package/dist/cdn/components/burndown-chart.js +2 -0
  15. package/dist/cdn/components/calendar-wc.js +2 -2
  16. package/dist/cdn/components/capacity-plan.js +25 -0
  17. package/dist/cdn/components/card-list.js +1 -1
  18. package/dist/cdn/components/carousel-wc.js +1 -1
  19. package/dist/cdn/components/change-set.js +2 -2
  20. package/dist/cdn/components/chart-wc.js +58 -36
  21. package/dist/cdn/components/chat-input.js +1 -1
  22. package/dist/cdn/components/chat-window.js +1 -1
  23. package/dist/cdn/components/color-palette.js +9 -9
  24. package/dist/cdn/components/color-picker.js +1 -1
  25. package/dist/cdn/components/combo-box.js +1 -1
  26. package/dist/cdn/components/command-palette.js +1 -1
  27. package/dist/cdn/components/comment-box.js +60 -0
  28. package/dist/cdn/components/comment-thread.js +60 -0
  29. package/dist/cdn/components/comment-wc.js +1 -1
  30. package/dist/cdn/components/compare-surface.js +1 -1
  31. package/dist/cdn/components/component-sampler.js +4 -4
  32. package/dist/cdn/components/consent-banner.js +1 -1
  33. package/dist/cdn/components/content-lens.js +1 -1
  34. package/dist/cdn/components/content-swap.js +1 -1
  35. package/dist/cdn/components/context-menu.js +1 -1
  36. package/dist/cdn/components/data-table.js +1 -1
  37. package/dist/cdn/components/date-picker.js +1 -1
  38. package/dist/cdn/components/day-view.js +1 -1
  39. package/dist/cdn/components/diagram-wc.js +3 -0
  40. package/dist/cdn/components/drag-surface.js +1 -1
  41. package/dist/cdn/components/drop-down.js +1 -1
  42. package/dist/cdn/components/emoji-picker.js +1 -1
  43. package/dist/cdn/components/empathy-map.js +41 -43
  44. package/dist/cdn/components/flow-diagram.js +1 -1
  45. package/dist/cdn/components/font-pairer.js +81 -81
  46. package/dist/cdn/components/foot-notes.js +1 -1
  47. package/dist/cdn/components/form-field.js +1 -1
  48. package/dist/cdn/components/gantt-chart.js +1 -1
  49. package/dist/cdn/components/geo-map.js +25 -23
  50. package/dist/cdn/components/glossary-index.js +1 -1
  51. package/dist/cdn/components/glossary-wc.js +1 -1
  52. package/dist/cdn/components/gradient-builder.js +29 -29
  53. package/dist/cdn/components/heading-links.js +1 -1
  54. package/dist/cdn/components/highlight-wc.js +2 -2
  55. package/dist/cdn/components/image-gallery.js +1 -1
  56. package/dist/cdn/components/image-map.js +1 -1
  57. package/dist/cdn/components/impact-effort.js +1 -1
  58. package/dist/cdn/components/include-file.js +1 -1
  59. package/dist/cdn/components/iron-triangle.js +2 -0
  60. package/dist/cdn/components/kanban-board.js +1 -1
  61. package/dist/cdn/components/layout-specimen.js +35 -0
  62. package/dist/cdn/components/manifest.json +228 -100
  63. package/dist/cdn/components/markdown-editor.js +1 -1
  64. package/dist/cdn/components/markdown-viewer.js +12 -12
  65. package/dist/cdn/components/motion-specimen.js +12 -12
  66. package/dist/cdn/components/nav-bar.js +2 -0
  67. package/dist/cdn/components/note-wc.js +2 -2
  68. package/dist/cdn/components/notification-wc.js +4 -4
  69. package/dist/cdn/components/page-info.js +21 -21
  70. package/dist/cdn/components/page-stats.js +1 -1
  71. package/dist/cdn/components/page-toc.js +1 -1
  72. package/dist/cdn/components/page-tools.js +1 -1
  73. package/dist/cdn/components/page-tour.js +6 -6
  74. package/dist/cdn/components/pager-wc.js +2 -0
  75. package/dist/cdn/components/palette-generator.js +11 -11
  76. package/dist/cdn/components/poll-wc.js +2 -0
  77. package/dist/cdn/components/pop-over.js +2 -0
  78. package/dist/cdn/components/popularity-index.js +2 -2
  79. package/dist/cdn/components/print-page.js +1 -1
  80. package/dist/cdn/components/product-roadmap.js +3 -0
  81. package/dist/cdn/components/progress-tracker.js +2 -0
  82. package/dist/cdn/components/qr-code.js +1 -1
  83. package/dist/cdn/components/quadrant-grid.js +3 -0
  84. package/dist/cdn/components/quality-target.js +12 -0
  85. package/dist/cdn/components/reaction-bar.js +2 -0
  86. package/dist/cdn/components/reader-view.js +3 -3
  87. package/dist/cdn/components/reading-progress.js +2 -0
  88. package/dist/cdn/components/recently-visited.js +26 -2
  89. package/dist/cdn/components/requirement-card.js +122 -0
  90. package/dist/cdn/components/review-surface.js +34 -40
  91. package/dist/cdn/components/risk-register.js +25 -0
  92. package/dist/cdn/components/roadmap.js +3 -0
  93. package/dist/cdn/components/score-card.js +197 -0
  94. package/dist/cdn/components/selection-menu.js +1 -1
  95. package/dist/cdn/components/semantic-palette.js +15 -15
  96. package/dist/cdn/components/settings-panel.js +12 -12
  97. package/dist/cdn/components/share-wc.js +2 -2
  98. package/dist/cdn/components/short-cuts.js +1 -1
  99. package/dist/cdn/components/site-index.js +4 -4
  100. package/dist/cdn/components/site-map-wc.js +1 -1
  101. package/dist/cdn/components/site-map.js +1 -1
  102. package/dist/cdn/components/site-search.js +9 -9
  103. package/dist/cdn/components/slide-accept.js +1 -1
  104. package/dist/cdn/components/social-embed.js +1 -1
  105. package/dist/cdn/components/spacing-specimen.js +5 -5
  106. package/dist/cdn/components/split-surface.js +1 -1
  107. package/dist/cdn/components/star-rating.js +1 -1
  108. package/dist/cdn/components/status-wc.js +2 -0
  109. package/dist/cdn/components/stepper-wc.js +2 -0
  110. package/dist/cdn/components/story-map.js +1 -1
  111. package/dist/cdn/components/tab-set.js +1 -1
  112. package/dist/cdn/components/text-reader.js +2 -2
  113. package/dist/cdn/components/theme-catalog.js +28 -0
  114. package/dist/cdn/components/theme-export.js +20 -12
  115. package/dist/cdn/components/theme-import.js +44 -0
  116. package/dist/cdn/components/theme-picker.js +31 -28
  117. package/dist/cdn/components/time-index.js +2 -2
  118. package/dist/cdn/components/time-picker.js +1 -1
  119. package/dist/cdn/components/toast-msg.js +3 -3
  120. package/dist/cdn/components/token-specimen.js +14 -14
  121. package/dist/cdn/components/tool-tip.js +1 -1
  122. package/dist/cdn/components/topic-map.js +3 -2
  123. package/dist/cdn/components/traceability-matrix.js +3 -0
  124. package/dist/cdn/components/trust-filter.js +3 -3
  125. package/dist/cdn/components/type-specimen.js +15 -15
  126. package/dist/cdn/components/user-journey.js +63 -70
  127. package/dist/cdn/components/user-persona.js +75 -13
  128. package/dist/cdn/components/user-story.js +13 -12
  129. package/dist/cdn/components/version-switcher.js +17 -0
  130. package/dist/cdn/components/video-player.js +4 -4
  131. package/dist/cdn/components/watch-wc.js +2 -2
  132. package/dist/cdn/components/week-view.js +1 -1
  133. package/dist/cdn/components/work-item.js +29 -28
  134. package/dist/cdn/components/youtube-player.js +1 -1
  135. package/dist/cdn/packs/design-system.full.js +59 -51
  136. package/dist/cdn/packs/effects.full.js +1 -1
  137. package/dist/cdn/packs/icons.effects.js +1 -1
  138. package/dist/cdn/packs/icons.full.js +1 -1
  139. package/dist/cdn/packs/kawaii.full.css +1 -1
  140. package/dist/cdn/packs/kawaii.full.js +6 -6
  141. package/dist/cdn/packs/kawaii.theme.css +1 -1
  142. package/dist/cdn/packs/manifest.json +11 -11
  143. package/dist/cdn/packs/ui.full.css +1 -1
  144. package/dist/cdn/packs/ui.full.js +54 -51
  145. package/dist/cdn/packs/ux-planning.full.css +1 -1
  146. package/dist/cdn/packs/ux-planning.full.js +324 -248
  147. package/dist/cdn/themes/8bit.css +1 -1
  148. package/dist/cdn/themes/8bit.tokens.json +662 -0
  149. package/dist/cdn/themes/alpha1999-dark.tokens.json +693 -0
  150. package/dist/cdn/themes/alpha1999.css +1 -1
  151. package/dist/cdn/themes/alpha1999.tokens.json +869 -0
  152. package/dist/cdn/themes/anthropic.css +2 -0
  153. package/dist/cdn/themes/anthropic.tokens.json +564 -0
  154. package/dist/cdn/themes/art-deco-dark.tokens.json +407 -0
  155. package/dist/cdn/themes/art-deco.css +1 -1
  156. package/dist/cdn/themes/art-deco.tokens.json +581 -0
  157. package/dist/cdn/themes/bauhaus-dark.tokens.json +260 -0
  158. package/dist/cdn/themes/bauhaus.css +1 -1
  159. package/dist/cdn/themes/bauhaus.tokens.json +589 -0
  160. package/dist/cdn/themes/brutalist-dark.tokens.json +503 -0
  161. package/dist/cdn/themes/brutalist.tokens.json +677 -0
  162. package/dist/cdn/themes/catalog/atlassian.tokens.json +303 -0
  163. package/dist/cdn/themes/catalog/bootstrap.tokens.json +304 -0
  164. package/dist/cdn/themes/catalog/carbon.tokens.json +301 -0
  165. package/dist/cdn/themes/catalog/catppuccin-mocha.tokens.json +301 -0
  166. package/dist/cdn/themes/catalog/govuk.tokens.json +301 -0
  167. package/dist/cdn/themes/catalog/manifest.json +132 -0
  168. package/dist/cdn/themes/catalog/material.tokens.json +289 -0
  169. package/dist/cdn/themes/catalog/salesforce.tokens.json +301 -0
  170. package/dist/cdn/themes/catalog/tailwind.tokens.json +302 -0
  171. package/dist/cdn/themes/catppuccin-frappe.css +1 -1
  172. package/dist/cdn/themes/catppuccin-frappe.tokens.json +608 -0
  173. package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +472 -0
  174. package/dist/cdn/themes/catppuccin-latte.css +1 -1
  175. package/dist/cdn/themes/catppuccin-latte.tokens.json +608 -0
  176. package/dist/cdn/themes/catppuccin-macchiato.css +1 -1
  177. package/dist/cdn/themes/catppuccin-macchiato.tokens.json +608 -0
  178. package/dist/cdn/themes/catppuccin-mocha.tokens.json +608 -0
  179. package/dist/cdn/themes/classic-dark.tokens.json +503 -0
  180. package/dist/cdn/themes/classic.tokens.json +640 -0
  181. package/dist/cdn/themes/claymorphism-dark.tokens.json +493 -0
  182. package/dist/cdn/themes/claymorphism.css +1 -1
  183. package/dist/cdn/themes/claymorphism.tokens.json +626 -0
  184. package/dist/cdn/themes/clinical-dark.tokens.json +472 -0
  185. package/dist/cdn/themes/clinical.tokens.json +608 -0
  186. package/dist/cdn/themes/cottagecore-dark.tokens.json +412 -0
  187. package/dist/cdn/themes/cottagecore.css +1 -1
  188. package/dist/cdn/themes/cottagecore.tokens.json +544 -0
  189. package/dist/cdn/themes/cyber.tokens.json +668 -0
  190. package/dist/cdn/themes/dawn-dark.tokens.json +472 -0
  191. package/dist/cdn/themes/dawn.css +1 -1
  192. package/dist/cdn/themes/dawn.tokens.json +608 -0
  193. package/dist/cdn/themes/dracula.tokens.json +534 -0
  194. package/dist/cdn/themes/dusk.tokens.json +533 -0
  195. package/dist/cdn/themes/editorial-dark.tokens.json +400 -0
  196. package/dist/cdn/themes/editorial.tokens.json +690 -0
  197. package/dist/cdn/themes/financial-dark.tokens.json +472 -0
  198. package/dist/cdn/themes/financial.css +1 -1
  199. package/dist/cdn/themes/financial.tokens.json +607 -0
  200. package/dist/cdn/themes/genai.tokens.json +534 -0
  201. package/dist/cdn/themes/glassmorphism-dark.tokens.json +489 -0
  202. package/dist/cdn/themes/glassmorphism.css +1 -1
  203. package/dist/cdn/themes/glassmorphism.tokens.json +632 -0
  204. package/dist/cdn/themes/government-dark.tokens.json +472 -0
  205. package/dist/cdn/themes/government.tokens.json +608 -0
  206. package/dist/cdn/themes/gruvbox-dark.tokens.json +472 -0
  207. package/dist/cdn/themes/gruvbox.tokens.json +608 -0
  208. package/dist/cdn/themes/high-noon-dark.tokens.json +397 -0
  209. package/dist/cdn/themes/high-noon.tokens.json +533 -0
  210. package/dist/cdn/themes/ibm.css +2 -0
  211. package/dist/cdn/themes/ibm.tokens.json +568 -0
  212. package/dist/cdn/themes/kawaii-dark.tokens.json +549 -0
  213. package/dist/cdn/themes/kawaii.css +1 -1
  214. package/dist/cdn/themes/kawaii.tokens.json +641 -0
  215. package/dist/cdn/themes/magna-dark.tokens.json +482 -0
  216. package/dist/cdn/themes/magna.css +1 -1
  217. package/dist/cdn/themes/magna.tokens.json +632 -0
  218. package/dist/cdn/themes/manifest.json +162 -62
  219. package/dist/cdn/themes/mcdonalds.css +2 -0
  220. package/dist/cdn/themes/mcdonalds.tokens.json +533 -0
  221. package/dist/cdn/themes/midnight.tokens.json +534 -0
  222. package/dist/cdn/themes/minimal-dark.tokens.json +294 -0
  223. package/dist/cdn/themes/minimal.tokens.json +494 -0
  224. package/dist/cdn/themes/modern-dark.tokens.json +490 -0
  225. package/dist/cdn/themes/modern.tokens.json +573 -0
  226. package/dist/cdn/themes/nes-dark.tokens.json +564 -0
  227. package/dist/cdn/themes/nes.css +1 -1
  228. package/dist/cdn/themes/nes.tokens.json +687 -0
  229. package/dist/cdn/themes/neumorphism-dark.tokens.json +471 -0
  230. package/dist/cdn/themes/neumorphism.css +1 -1
  231. package/dist/cdn/themes/neumorphism.tokens.json +589 -0
  232. package/dist/cdn/themes/nord-dark.tokens.json +484 -0
  233. package/dist/cdn/themes/nord.tokens.json +619 -0
  234. package/dist/cdn/themes/organic-dark.tokens.json +532 -0
  235. package/dist/cdn/themes/organic.tokens.json +685 -0
  236. package/dist/cdn/themes/rose-pine-dark.tokens.json +472 -0
  237. package/dist/cdn/themes/rose-pine.tokens.json +608 -0
  238. package/dist/cdn/themes/rough-dark.tokens.json +515 -0
  239. package/dist/cdn/themes/rough.css +1 -1
  240. package/dist/cdn/themes/rough.tokens.json +650 -0
  241. package/dist/cdn/themes/solarized-dark.tokens.json +397 -0
  242. package/dist/cdn/themes/solarized.tokens.json +532 -0
  243. package/dist/cdn/themes/starbucks.css +2 -0
  244. package/dist/cdn/themes/starbucks.tokens.json +593 -0
  245. package/dist/cdn/themes/startup-dark.tokens.json +522 -0
  246. package/dist/cdn/themes/startup.css +1 -1
  247. package/dist/cdn/themes/startup.tokens.json +607 -0
  248. package/dist/cdn/themes/super2026-dark.tokens.json +667 -0
  249. package/dist/cdn/themes/super2026.tokens.json +863 -0
  250. package/dist/cdn/themes/swiss-dark.tokens.json +390 -0
  251. package/dist/cdn/themes/swiss.tokens.json +750 -0
  252. package/dist/cdn/themes/terminal.css +1 -1
  253. package/dist/cdn/themes/terminal.tokens.json +689 -0
  254. package/dist/cdn/themes/tokyo-night-dark.tokens.json +472 -0
  255. package/dist/cdn/themes/tokyo-night.tokens.json +608 -0
  256. package/dist/cdn/themes/vaporwave-dark.tokens.json +413 -0
  257. package/dist/cdn/themes/vaporwave.tokens.json +549 -0
  258. package/dist/cdn/themes/win9x-dark.tokens.json +563 -0
  259. package/dist/cdn/themes/win9x.tokens.json +700 -0
  260. package/dist/cdn/vanilla-breeze-charts.css +1 -1
  261. package/dist/cdn/vanilla-breeze-charts.js +58 -36
  262. package/dist/cdn/vanilla-breeze-core.css +1 -1
  263. package/dist/cdn/vanilla-breeze-core.js +246 -51
  264. package/dist/cdn/vanilla-breeze-dev.js +1 -1
  265. package/dist/cdn/vanilla-breeze-extras.js +90 -80
  266. package/dist/cdn/vanilla-breeze.css +1 -1
  267. package/dist/cdn/vanilla-breeze.js +1395 -405
  268. package/package.json +14 -4
@@ -1,3 +1,3 @@
1
- var mt=Object.defineProperty;var O=(n,t)=>()=>(n&&(t=n(n=0)),t);var gt=(n,t)=>{for(var e in t)mt(n,e,{get:t[e],enumerable:!0})};function yt(){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 o=n.key(i);o&&o.startsWith(t)&&e.push(o)}return e}}}function m(){return L||(L=yt()),L}function M(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 Q(n){if(typeof n!="string"||!n)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${n}:`}function Z(n){try{let t=JSON.parse(n);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var L,y,H=O(()=>{L=null;y={configure(n={}){L=n.backend??null},async set(n,t,e){let i={data:e,timestamp:Date.now()};await m().setRaw(M(n,t),JSON.stringify(i))},async get(n,t,e){let i=await m().getRaw(M(n,t));if(i==null)return null;let o=Z(i);return!o||e?.maxAge!=null&&Date.now()-o.timestamp>e.maxAge?null:o.data},async remove(n,t){await m().removeRaw(M(n,t))},async list(n){let t=Q(n),e=await m().keys(t),i=[];for(let o of e){let s=await m().getRaw(o);if(s==null)continue;let r=Z(s);r&&i.push({key:o.slice(t.length),data:r.data,timestamp:r.timestamp})}return i},async clear(n){let t=Q(n),e=await m().keys(t);for(let i of e)await m().removeRaw(i)},async clearAll(){let n=await m().keys("vb:");for(let t of n)await m().removeRaw(t)},async setMany(n,t){for(let[e,i]of t)await y.set(n,e,i)}}});function bt(n,t){if(!t)return n;let e=n??new URLSearchParams;for(let[i,o]of Object.entries(t))o!=null&&e.set(i,String(o));return e}async function wt(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}}function tt(n){return n.endsWith("/")?n.slice(0,-1):n}var p,S,C,et=O(()=>{p={baseUrl:"/go",headers:{},services:{}},S=class extends Error{constructor(t,e,i,o){super(`VBService(${i}): ${t} ${o}`),this.name="VBServiceError",this.status=t,this.body=e,this.role=i,this.path=o}};C=class n{static configure(t={}){p={baseUrl:t.baseUrl??p.baseUrl,headers:{...p.headers,...t.headers??{}},services:{...p.services,...t.services??{}}}}static resolve(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");return p.services[t]?tt(p.services[t]):p.baseUrl?`${tt(p.baseUrl)}/${t}`:`/go/${t}`}static _reset(){p={baseUrl:"/go",headers:{},services:{}}}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.#t("GET",t,{params:e})}async post(t,e){return this.#t("POST",t,{body:e})}async patch(t,e){return this.#t("PATCH",t,{body:e})}async delete(t){return this.#t("DELETE",t,{})}async#t(t,e,i){let o=n.resolve(this.role),s=e?e.startsWith("/")?e:`/${e}`:"",r=new URL(`${o}${s}`,globalThis.location?.origin??"http://localhost"),d=bt(r.searchParams,i.params);d&&(r.search=d.toString());let a={method:t,headers:{...p.headers}};i.body!==void 0&&(a.body=JSON.stringify(i.body),a.headers["content-type"]="application/json");let c=r.toString(),l=await fetch(c,a),f=await wt(l);if(!l.ok)throw new S(l.status,f,this.role,`${s||"/"}`);return f}}});function $(n){let t=2166136261;for(let e=0;e<n.length;e++)t^=n.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function St(){return"hn-"+crypto.randomUUID().slice(0,8)}function rt(n,t){return getComputedStyle(n).getPropertyValue(`--highlight-${t}`).trim()}function Ct(n){if(E){k++;return}E=new CSSStyleSheet;let t=n.map(e=>`::highlight(hn-${e}) { background-color: var(--highlight-${e}); text-decoration-line: underline; text-decoration-color: var(--highlight-${e}); text-underline-offset: 2px; }`).join(`
2
- `);E.replaceSync(t),document.adoptedStyleSheets=[...document.adoptedStyleSheets,E],k=1}function At(){k--,k<=0&&E&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(n=>n!==E),E=null,k=0)}function kt(){return h||(h=document.createElement("div"),h.className="hn-toolbar",h.setAttribute("role","toolbar"),h.setAttribute("aria-label","Highlight tools"),h.setAttribute("popover","auto"),h.hidden=!0,document.body.appendChild(h),h.addEventListener("toggle",n=>{n.newState==="closed"&&(h.hidden=!0,R=null)}),h)}function I(n,t,e){let i=kt();i.innerHTML="",R=t;let o=t.colors,s=t.element,r=e?.color,d=document.createElement("div");if(d.className="hn-swatches",d.setAttribute("role","group"),d.setAttribute("aria-label","Highlight colors"),o.forEach((a,c)=>{let l=document.createElement("button");l.type="button",l.className="hn-swatch",l.dataset.color=a,l.setAttribute("aria-label",`Highlight ${a}${r===a?" (current)":""}`),l.setAttribute("tabindex",c===0?"0":"-1");let f=rt(s,a);f&&(l.style.backgroundColor=f),r===a&&l.setAttribute("aria-pressed","true"),l.addEventListener("click",()=>{e?t._changeColor(e.id,a):t._createFromSelection(a),A()}),d.appendChild(l)}),i.appendChild(d),e){let a=document.createElement("span");a.className="hn-separator",a.setAttribute("aria-hidden","true"),i.appendChild(a);let c=document.createElement("button");c.type="button",c.className="hn-action",c.textContent=e.note?"Edit Note":"Add Note",c.addEventListener("click",()=>{at(t,e),A()}),i.appendChild(c);let l=document.createElement("button");l.type="button",l.className="hn-action hn-action-remove",l.textContent="Remove",l.addEventListener("click",()=>{t.removeHighlight(e.id),A()}),i.appendChild(l)}d.addEventListener("keydown",a=>{let c=[...d.querySelectorAll("button")],l=c.indexOf(document.activeElement);if(l<0)return;let f=-1;if(a.key==="ArrowRight"||a.key==="ArrowDown")a.preventDefault(),f=(l+1)%c.length;else if(a.key==="ArrowLeft"||a.key==="ArrowUp")a.preventDefault(),f=(l-1+c.length)%c.length;else if(a.key==="Escape"){A();return}f>=0&&(c[l].setAttribute("tabindex","-1"),c[f].setAttribute("tabindex","0"),c[f].focus())}),i.hidden=!1;try{i.showPopover()}catch{}xt(n),requestAnimationFrame(()=>{let a=i.querySelector(".hn-swatch");a&&a.focus()})}function at(n,t){v();let e=n.element,i=w(e,t.startOffset,t.endOffset);if(!i)return;u=document.createElement("div"),u.className="hn-note-panel",u.setAttribute("role","dialog"),u.setAttribute("aria-label","Private note");let o=document.createElement("header");o.className="hn-note-header",o.innerHTML="<small>PRIVATE NOTE</small>",u.appendChild(o);let s=document.createElement("blockquote");s.className="hn-note-quote",s.textContent=t.text.length>80?t.text.slice(0,80)+"\u2026":t.text,u.appendChild(s);let r=document.createElement("textarea");r.className="hn-note-textarea",r.placeholder="Add a note\u2026",r.value=t.note||"",r.rows=3,r.setAttribute("aria-label","Note for highlighted text"),u.appendChild(r);let d=document.createElement("footer");d.className="hn-note-actions";let a=document.createElement("button");a.type="button",a.className="hn-action hn-action-save",a.textContent="Save",a.addEventListener("click",()=>{n._updateNote(t.id,r.value.trim()),v()});let c=document.createElement("button");c.type="button",c.className="hn-action",c.textContent="Cancel",c.addEventListener("click",()=>v()),d.append(a,c),u.appendChild(d),r.addEventListener("keydown",g=>{g.key==="Escape"&&(g.preventDefault(),v()),g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&(g.preventDefault(),n._updateNote(t.id,r.value.trim()),v())}),e.style.position="relative",e.appendChild(u);let l=i.getClientRects()[0],f=e.getBoundingClientRect();if(l){let g=l.top-f.top;u.style.top=`${g}px`}requestAnimationFrame(()=>{r.focus(),document.addEventListener("pointerdown",ct)})}function ct(n){u&&!u.contains(n.target)&&v()}function v(){u&&(document.removeEventListener("pointerdown",ct),u.remove(),u=null)}function xt(n){h&&requestAnimationFrame(()=>{let t=h.getBoundingClientRect(),e=t.width||200,i=t.height||40,o=n.top-i-it,s=n.left+n.width/2-e/2;o<P&&(o=n.bottom+it);let r=window.innerWidth-e-P;s=Math.max(P,Math.min(s,r)),h.style.top=`${o}px`,h.style.left=`${s}px`})}function A(){if(h){try{h.hidePopover()}catch{}h.hidden=!0,R=null}}function q(n){b||(b=document.createElement("div"),b.setAttribute("aria-live","polite"),b.setAttribute("aria-atomic","true"),b.className="hn-sr-only",document.body.appendChild(b)),b.textContent="",requestAnimationFrame(()=>{b.textContent=n})}function ot(n,t,e){let i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT),o=0;for(;i.nextNode();){if(i.currentNode===t)return o+e;o+=(i.currentNode.textContent??"").length}return-1}function w(n,t,e){let i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT),o=0,s=null,r=0,d=null,a=0;for(;i.nextNode();){let c=i.currentNode,l=(c.textContent??"").length;if(!s&&o+l>t&&(s=c,r=t-o),o+l>=e){d=c,a=e-o;break}o+=l}if(!s||!d)return null;try{let c=document.createRange();return c.setStart(s,Math.min(r,(s.textContent??"").length)),c.setEnd(d,Math.min(a,(d.textContent??"").length)),c}catch{return null}}function _(n){if(D.has(n))return D.get(n);let t=new F(n);return D.set(n,t),t}function st(n=document){n.querySelectorAll(W).forEach(t=>{t.hasAttribute("data-highlights-init")||_(t)})}var W,nt,vt,it,P,Et,E,k,h,R,u,b,F,D,Nt,lt=O(()=>{H();W="[data-highlights]",nt="highlights",vt=["yellow","green","blue","pink"],it=8,P=8,Et=typeof CSS<"u"&&"highlights"in CSS;E=null,k=0;h=null,R=null;u=null;b=null;F=class{#t;#s;#n;#r;#e=[];#c=!Et;#l;#d;#h=!1;#u=[];constructor(t){this.#t=t,this.#r=t.hasAttribute("data-highlights-readonly");let e=t.dataset.highlights;this.#s=e&&e!==""?e:location.pathname;let i=t.dataset.highlightsColors;this.#n=i?i.split(",").map(o=>o.trim()).filter(Boolean):[...vt],this.#c||Ct(this.#n),this.#o(),this.#r||(this.#l=this.#m.bind(this),this.#d=this.#g.bind(this),t.addEventListener("pointerup",this.#l),t.addEventListener("click",this.#d)),t.setAttribute("data-highlights-init",""),this.#b().then(()=>{this.#h||this.#o()})}get colors(){return[...this.#n]}get element(){return this.#t}getHighlights(){return this.#e.map(t=>({...t}))}removeHighlight(t){let e=this.#e.findIndex(i=>i.id===t);e<0||(this.#e.splice(e,1),this.#i(),this.#o(),this.#a("highlights:removed",{id:t}),q("Highlight removed"))}clearAll(){this.#e=[],this.#i(),this.#o()}exportHighlights(){return JSON.stringify({version:1,highlights:this.#e})}importHighlights(t){try{let e=typeof t=="string"?JSON.parse(t):t;if(!e.highlights||!Array.isArray(e.highlights))return;this.#e=e.highlights,this.#i(),this.#o()}catch{}}destroy(){if(!this.#h){if(this.#h=!0,this.#l&&this.#t.removeEventListener("pointerup",this.#l),this.#d&&this.#t.removeEventListener("click",this.#d),this.#c)this.#t.querySelectorAll("mark[data-hn-id]").forEach(t=>{let e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t),e.normalize()});else{for(let t of this.#n)CSS.highlights.delete(`hn-${t}`);At()}this.#f(),this.#t.removeAttribute("data-highlights-init"),R===this&&A(),v()}}#m(){requestAnimationFrame(()=>{if(this.#h||this.#t.hasAttribute("data-selection-menu"))return;let t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return;let e=t.getRangeAt(0);if(!this.#t.contains(e.commonAncestorContainer))return;let i=e.getBoundingClientRect();I(i,this,null)})}#g(t){if(this.#t.hasAttribute("data-selection-menu"))return;let e=t.target.closest?.(".hn-margin-annotation");if(e){let o=e.dataset.hnId,s=this.#e.find(r=>r.id===o);if(s){at(this,s);return}}let i=t.target.closest?.("mark[data-hn-id]");if(i){let o=i.dataset.hnId,s=this.#e.find(r=>r.id===o);if(s){this.#a("highlights:clicked",{id:o});let r=i.getBoundingClientRect();I(r,this,s);return}}if(!this.#c){let o=this.#y(t.clientX,t.clientY);if(o){this.#a("highlights:clicked",{id:o.id});let s=w(this.#t,o.startOffset,o.endOffset);s&&I(s.getBoundingClientRect(),this,o)}}}#y(t,e){for(let i of this.#e){let o=w(this.#t,i.startOffset,i.endOffset);if(!o)continue;let s=o.getClientRects();for(let r of s)if(t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom)return i}return null}_createFromSelection(t){let e=window.getSelection();if(!e||e.isCollapsed)return;let i=e.getRangeAt(0);if(!this.#t.contains(i.commonAncestorContainer))return;let o=ot(this.#t,i.startContainer,i.startOffset),s=ot(this.#t,i.endContainer,i.endOffset);if(o<0||s<0||o>=s)return;let r=e.toString().trim(),d={id:St(),startOffset:o,endOffset:s,text:r,color:t,note:"",created:Date.now()};this.#e.push(d),this.#i(),this.#o(),e.removeAllRanges(),this.#a("highlights:added",{id:d.id,text:r,color:t,note:""}),q("Highlight added")}_changeColor(t,e){let i=this.#e.find(o=>o.id===t);i&&(i.color=e,this.#i(),this.#o())}_updateNote(t,e){let i=this.#e.find(o=>o.id===t);i&&(i.note=e,this.#i(),this.#p(),this.#a("highlights:note-changed",{id:t,note:e}),q("Note saved"))}async#b(){let t=await y.get(nt,this.#s);if(!t||!Array.isArray(t.highlights))return;let e=$(this.#t.textContent);t.contentHash&&t.contentHash!==e?(this.#e=t.highlights.filter(i=>{let o=w(this.#t,i.startOffset,i.endOffset);return o?o.toString().trim()===i.text:!1}),this.#i()):this.#e=t.highlights}#i(){let t={version:1,contentHash:$(this.#t.textContent),highlights:this.#e};y.set(nt,this.#s,t).catch(()=>{})}#o(){this.#c?this.#v():this.#w(),this.#p()}#w(){let t=new Map;for(let e of this.#n)t.set(e,[]);for(let e of this.#e){let i=w(this.#t,e.startOffset,e.endOffset);i&&t.has(e.color)&&t.get(e.color).push(i)}for(let[e,i]of t){let o=`hn-${e}`;i.length===0?CSS.highlights.delete(o):CSS.highlights.set(o,new Highlight(...i))}}#v(){this.#t.querySelectorAll("mark[data-hn-id]").forEach(e=>{let i=e.parentNode;for(;e.firstChild;)i.insertBefore(e.firstChild,e);i.removeChild(e)}),this.#t.normalize();let t=[...this.#e].sort((e,i)=>i.startOffset-e.startOffset);for(let e of t){let i=w(this.#t,e.startOffset,e.endOffset);if(!i)continue;let o=rt(this.#t,e.color),s=document.createElement("mark");s.dataset.hnId=e.id,s.dataset.hnColor=e.color,o&&(s.style.backgroundColor=o,s.style.textDecorationColor=o);try{i.surroundContents(s)}catch{let r=i.extractContents();s.appendChild(r),i.insertNode(s)}}}#f(){for(let t of this.#u)t.remove();this.#u=[]}#p(){if(this.#f(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");for(let e of this.#e){let i=w(this.#t,e.startOffset,e.endOffset);if(!i)continue;let o=i.getClientRects();if(o.length===0)continue;let s=o[0],r=this.#t.getBoundingClientRect(),d=s.top-r.top,a=document.createElement("span");a.className="hn-margin-annotation",a.dataset.hnId=e.id,a.setAttribute("aria-hidden","true"),a.style.top=`${d}px`,e.note?(a.innerHTML='<span class="hn-note-indicator">*</span> You highlighted',a.classList.add("hn-has-note")):a.textContent="You highlighted",this.#t.appendChild(a),this.#u.push(a)}}#a(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}},D=new WeakMap;document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>st()):st();Nt=new MutationObserver(n=>{for(let t of n)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let i=e;i.matches(W)&&_(i),i.querySelectorAll(W).forEach(o=>{o.hasAttribute("data-highlights-init")||_(o)})}});Nt.observe(document.documentElement,{childList:!0,subtree:!0})});var ut={};gt(ut,{currentHash:()=>z,initPageWatch:()=>X,readWatch:()=>B,removeWatch:()=>ht,writeWatch:()=>x});function dt(){return typeof window<"u"&&window.vbPageWatch?.serverSync===!0?!0:document.querySelector('meta[name="vb-page-watch-server"]')?.getAttribute("content")==="true"}async function Ot(n){if(!dt())return null;try{let t=new C("notify"),e={url:n.url,type:"page-watch",notify:["panel"]},i=await t.post("/subscribe",e);return typeof i?.id=="string"?i.id:null}catch(t){let e=t instanceof S?`${t.status}`:String(t);return console.warn("[page-watch] server subscribe failed; client-only watch in effect.",e),null}}async function Tt(n){if(!(!n||!dt()))try{await new C("notify").delete(`/subscribe/${encodeURIComponent(n)}`)}catch(t){let e=t instanceof S?`${t.status}`:String(t);console.warn("[page-watch] server unsubscribe failed; local state already cleared.",e)}}function Lt(){return document.querySelector("main")||document.querySelector("article")||document.body}function N(){return location.pathname||"/"}function z(){let n=Lt();return n?$(n.textContent||""):""}function $t(){return document.title||N()}async function B(){return await y.get(G,N())}async function x(n){await y.set(G,N(),n)}async function ht(){await y.remove(G,N())}function U(n,t){n.setAttribute("aria-pressed",t?"true":"false"),n.dataset.watching="",t||delete n.dataset.watching;let e=n.querySelector("icon-wc");e&&e.setAttribute("name",t?"bookmark-check":"bookmark");let i=[...n.childNodes].find(o=>o.nodeType===Node.TEXT_NODE&&(o.textContent||"").trim());i&&!n.hasAttribute("data-watch-label-locked")&&(i.textContent=t?"Watching":"Watch for updates"),n.setAttribute("title",t?"Stop watching this page":"Watch this page for content updates")}async function j(n){if(n.hasAttribute("data-watch-page-init"))return;n.setAttribute("data-watch-page-init",""),n.setAttribute("type",n.getAttribute("type")||"button");let t=await B();U(n,!!t),n.addEventListener("click",async e=>{e.preventDefault();let i=await B();if(i)await ht(),U(n,!1),n.dispatchEvent(new CustomEvent("page-watch:remove",{bubbles:!0,composed:!0,detail:{url:i.url,subscriptionId:i.subscriptionId}})),Tt(i.subscriptionId);else{let o={url:N(),title:$t(),contentHash:z(),watchedAt:new Date().toISOString(),lastChecked:new Date().toISOString(),lastChanged:null,subscriptionId:null};await x(o),U(n,!0),n.dispatchEvent(new CustomEvent("page-watch:add",{bubbles:!0,composed:!0,detail:{entry:o}}));let s=await Ot(o);s&&await x({...o,subscriptionId:s})}})}async function Rt(){let n=await B();if(!n)return;let t=z(),e=new Date().toISOString(),i=n.contentHash,o={...n,lastChecked:e};if(t&&t!==i){o.contentHash=t,o.lastChanged=e,await x(o);let s={id:`page-watch:${n.url}:${t}`,type:"watch",title:`Updated: ${n.title}`,body:"Content changed since your last visit.",url:n.url,date:e,read:!1,dismissed:!1,priority:"normal"};document.dispatchEvent(new CustomEvent("notification-wc:new",{bubbles:!0,composed:!0,detail:{notification:s}}))}else await x(o)}function X(n=document){for(let t of n.querySelectorAll(V))j(t);Rt()}var V,G,Bt,ft=O(()=>{H();et();lt();V="[data-watch-page]",G="watches";document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>X()):X();Bt=new MutationObserver(n=>{for(let t of n)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let i=e;i.matches?.(V)&&j(i),i.querySelectorAll?.(V).forEach(o=>j(o))}});Bt.observe(document.documentElement,{childList:!0,subtree:!0})});var Pt=window.matchMedia("(prefers-reduced-motion: reduce)");var K=new Map;function Y(n,t,e={}){let i=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=K.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}K.set(n,o),customElements.define(n,t)}var T=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,o){t.addEventListener(e,i,o),this.#t.push(()=>t.removeEventListener(e,i,o))}setup(){}teardown(){}};var pt="Watch for updates",Mt="Watching",J=class extends T{#t=null;setup(){if(this.hasAttribute("server-sync")){let e=window;e.vbPageWatch={...e.vbPageWatch??{},serverSync:!0}}let t=this.#s();this.dataset.variant=t;for(let e of Array.from(this.children))e.hasAttribute?.("data-watch-page")&&e.remove();this.#t=this.#n(t),this.appendChild(this.#t),this.listen(document,"page-watch:add",this.#r),this.listen(document,"page-watch:remove",this.#r)}teardown(){this.#t&&(this.#t.remove(),this.#t=null)}#s(){let t=this.getAttribute("variant");return t==="compact"||t==="button"?t:"icon"}#n(t){let e=document.createElement("button");e.type="button",e.setAttribute("data-watch-page",""),e.className="ghost",e.setAttribute("aria-label","Watch this page for updates");let i=t==="icon"?"sm":"xs",o=this.getAttribute("label")??pt;return t==="icon"?e.innerHTML=`<icon-wc name="bookmark" size="${i}"></icon-wc>`:(e.innerHTML=`<icon-wc name="bookmark" size="${i}"></icon-wc><span>${this.#e(o)}</span>`,e.setAttribute("data-watch-label-locked","")),e}#r=async()=>{if(this.#t)try{let{readWatch:t}=await Promise.resolve().then(()=>(ft(),ut)),i=!!await t();this.#t.setAttribute("aria-pressed",i?"true":"false");let o=this.#t.querySelector("icon-wc");o&&o.setAttribute("name",i?"bookmark-check":"bookmark");let s=this.#t.querySelector("span");if(s&&this.#s()!=="icon"){let r=this.getAttribute("label");s.textContent=r||(i?Mt:pt)}this.#t.setAttribute("title",i?"Stop watching this page":"Watch this page for content updates")}catch{}};#e(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}};Y("watch-wc",J);export{J as WatchWc};
1
+ var it=Object.defineProperty;var E=(n,t)=>()=>(n&&(t=n(n=0)),t);var st=(n,t)=>{for(var e in t)it(n,e,{get:t[e],enumerable:!0})};function rt(){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}}}function d(){return A||(A=rt()),A}function O(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 V(n){if(typeof n!="string"||!n)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${n}:`}function j(n){try{let t=JSON.parse(n);if(t&&typeof t=="object"&&typeof t.timestamp=="number")return t}catch{}return null}var A,u,T=E(()=>{A=null;u={configure(n={}){A=n.backend??null},async set(n,t,e){let i={data:e,timestamp:Date.now()};await d().setRaw(O(n,t),JSON.stringify(i))},async get(n,t,e){let i=await d().getRaw(O(n,t));if(i==null)return null;let s=j(i);return!s||e?.maxAge!=null&&Date.now()-s.timestamp>e.maxAge?null:s.data},async remove(n,t){await d().removeRaw(O(n,t))},async list(n){let t=V(n),e=await d().keys(t),i=[];for(let s of e){let r=await d().getRaw(s);if(r==null)continue;let o=j(r);o&&i.push({key:s.slice(t.length),data:o.data,timestamp:o.timestamp})}return i},async clear(n){let t=V(n),e=await d().keys(t);for(let i of e)await d().removeRaw(i)},async clearAll(){let n=await d().keys("vb:");for(let t of n)await d().removeRaw(t)},async setMany(n,t){for(let[e,i]of t)await u.set(n,e,i)}}});function ot(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 at(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}}function X(n){return n.endsWith("/")?n.slice(0,-1):n}var h,m,b,G=E(()=>{h={baseUrl:"/go",headers:{},services:{}},m=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}};b=class n{static configure(t={}){h={baseUrl:t.baseUrl??h.baseUrl,headers:{...h.headers,...t.headers??{}},services:{...h.services,...t.services??{}}}}static resolve(t){if(!t||typeof t!="string")throw new TypeError("VBService: role must be a non-empty string");return h.services[t]?X(h.services[t]):h.baseUrl?`${X(h.baseUrl)}/${t}`:`/go/${t}`}static _reset(){h={baseUrl:"/go",headers:{},services:{}}}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.#t("GET",t,{params:e})}async post(t,e){return this.#t("POST",t,{body:e})}async patch(t,e){return this.#t("PATCH",t,{body:e})}async delete(t){return this.#t("DELETE",t,{})}async#t(t,e,i){let s=n.resolve(this.role),r=e?e.startsWith("/")?e:`/${e}`:"",o=new URL(`${s}${r}`,globalThis.location?.origin??"http://localhost"),c=ot(o.searchParams,i.params);c&&(o.search=c.toString());let a={method:t,headers:{...h.headers}};i.body!==void 0&&(a.body=JSON.stringify(i.body),a.headers["content-type"]="application/json");let l=o.toString(),g=await fetch(l,a),F=await at(g);if(!g.ok)throw new m(g.status,F,this.role,`${r||"/"}`);return F}}});function k(n){let t=2166136261;for(let e=0;e<n.length;e++)t^=n.charCodeAt(e),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function lt(){return"hn-"+crypto.randomUUID().slice(0,8)}function dt(n,t){return getComputedStyle(n).getPropertyValue(`--highlight-${t}`).trim()}function ut(n){if(p){w++;return}p=new CSSStyleSheet;let t=n.map(e=>`::highlight(hn-${e}) { background-color: var(--highlight-${e}); text-decoration-line: underline; text-decoration-color: var(--highlight-${e}); text-underline-offset: 2px; }`).join(`
2
+ `);p.replaceSync(t),document.adoptedStyleSheets=[...document.adoptedStyleSheets,p],w=1}function ft(){w--,w<=0&&p&&(document.adoptedStyleSheets=document.adoptedStyleSheets.filter(n=>n!==p),p=null,w=0)}function $(n){f||(f=document.createElement("div"),f.setAttribute("aria-live","polite"),f.setAttribute("aria-atomic","true"),f.className="hn-sr-only",document.body.appendChild(f)),f.textContent="",requestAnimationFrame(()=>{f.textContent=n})}function J(n,t,e){let i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT),s=0;for(;i.nextNode();){if(i.currentNode===t)return s+e;s+=(i.currentNode.textContent??"").length}return-1}function y(n,t,e){let i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT),s=0,r=null,o=0,c=null,a=0;for(;i.nextNode();){let l=i.currentNode,g=(l.textContent??"").length;if(!r&&s+g>t&&(r=l,o=t-s),s+g>=e){c=l,a=e-s;break}s+=g}if(!r||!c)return null;try{let l=document.createRange();return l.setStart(r,Math.min(o,(r.textContent??"").length)),l.setEnd(c,Math.min(a,(c.textContent??"").length)),l}catch{return null}}function M(n){if(N.has(n))return N.get(n);let t=new R(n);return N.set(n,t),t}function K(n=document){n.querySelectorAll(L).forEach(t=>{t.hasAttribute("data-highlights-init")||M(t)})}var L,z,ct,ht,p,w,f,R,N,gt,Y=E(()=>{T();L="[data-highlights]",z="highlights",ct=["yellow","green","blue","pink"],ht=typeof CSS<"u"&&"highlights"in CSS;p=null,w=0;f=null;R=class{#t;#n;#s;#a;#e=[];#c=!ht;#h;#l;#d=!1;#u=[];constructor(t){this.#t=t,this.#a=t.hasAttribute("data-highlights-readonly");let e=t.dataset.highlights;this.#n=e&&e!==""?e:location.pathname;let i=t.dataset.highlightsColors;this.#s=i?i.split(",").map(s=>s.trim()).filter(Boolean):[...ct],this.#c||ut(this.#s),this.#o(),this.#a||(this.#h=this.#p.bind(this),this.#l=this.#m.bind(this),t.addEventListener("pointerup",this.#h),t.addEventListener("click",this.#l)),t.setAttribute("data-highlights-init",""),this.#b().then(()=>{this.#d||this.#o()})}get colors(){return[...this.#s]}get element(){return this.#t}getHighlights(){return this.#e.map(t=>({...t}))}removeHighlight(t){let e=this.#e.findIndex(i=>i.id===t);e<0||(this.#e.splice(e,1),this.#r(),this.#o(),this.#i("highlights:removed",{id:t}),$("Highlight removed"))}clearAll(){this.#e=[],this.#r(),this.#o()}exportHighlights(){return JSON.stringify({version:1,highlights:this.#e})}importHighlights(t){try{let e=typeof t=="string"?JSON.parse(t):t;if(!e.highlights||!Array.isArray(e.highlights))return;this.#e=e.highlights,this.#r(),this.#o()}catch{}}destroy(){if(!this.#d){if(this.#d=!0,this.#h&&this.#t.removeEventListener("pointerup",this.#h),this.#l&&this.#t.removeEventListener("click",this.#l),this.#c)this.#t.querySelectorAll("mark[data-hn-id]").forEach(t=>{let e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t),e.normalize()});else{for(let t of this.#s)CSS.highlights.delete(`hn-${t}`);ft()}this.#f(),this.#t.removeAttribute("data-highlights-init")}}#p(){requestAnimationFrame(()=>{if(this.#d)return;let t=window.getSelection();if(!t||t.isCollapsed||!t.toString().trim())return;let e=t.getRangeAt(0);this.#t.contains(e.commonAncestorContainer)&&this.#i("highlights:selected",{text:t.toString().trim(),rect:e.getBoundingClientRect()})})}#m(t){let e=t.target.closest?.(".hn-margin-annotation");if(e){let s=e.dataset.hnId,r=this.#e.find(o=>o.id===s);if(r){this.#i("highlights:clicked",{id:s,highlight:{...r}}),this.#i("highlights:request-note",{id:s,highlight:{...r},controller:this});return}}let i=t.target.closest?.("mark[data-hn-id]");if(i){let s=i.dataset.hnId,r=this.#e.find(o=>o.id===s);if(r){this.#i("highlights:clicked",{id:s,highlight:{...r}});return}}if(!this.#c){let s=this.#y(t.clientX,t.clientY);s&&this.#i("highlights:clicked",{id:s.id,highlight:{...s}})}}findHighlightRect(t){let e=this.#e.find(r=>r.id===t);if(!e)return null;let i=y(this.#t,e.startOffset,e.endOffset);if(!i)return null;let s=i.getClientRects();return s.length?s[0]:null}#y(t,e){for(let i of this.#e){let s=y(this.#t,i.startOffset,i.endOffset);if(!s)continue;let r=s.getClientRects();for(let o of r)if(t>=o.left&&t<=o.right&&e>=o.top&&e<=o.bottom)return i}return null}_createFromSelection(t){let e=window.getSelection();if(!e||e.isCollapsed)return;let i=e.getRangeAt(0);if(!this.#t.contains(i.commonAncestorContainer))return;let s=J(this.#t,i.startContainer,i.startOffset),r=J(this.#t,i.endContainer,i.endOffset);if(s<0||r<0||s>=r)return;let o=e.toString().trim(),c={id:lt(),startOffset:s,endOffset:r,text:o,color:t,note:"",created:Date.now()};this.#e.push(c),this.#r(),this.#o(),e.removeAllRanges(),this.#i("highlights:added",{id:c.id,text:o,color:t,note:""}),$("Highlight added")}_changeColor(t,e){let i=this.#e.find(s=>s.id===t);i&&(i.color=e,this.#r(),this.#o())}_updateNote(t,e){let i=this.#e.find(s=>s.id===t);i&&(i.note=e,this.#r(),this.#g(),this.#i("highlights:note-changed",{id:t,note:e}),$("Note saved"))}async#b(){let t=await u.get(z,this.#n);if(!t||!Array.isArray(t.highlights))return;let e=k(this.#t.textContent);t.contentHash&&t.contentHash!==e?(this.#e=t.highlights.filter(i=>{let s=y(this.#t,i.startOffset,i.endOffset);return s?s.toString().trim()===i.text:!1}),this.#r()):this.#e=t.highlights}#r(){let t={version:1,contentHash:k(this.#t.textContent),highlights:this.#e};u.set(z,this.#n,t).catch(()=>{})}#o(){this.#c?this.#v():this.#w(),this.#g()}#w(){let t=new Map;for(let e of this.#s)t.set(e,[]);for(let e of this.#e){let i=y(this.#t,e.startOffset,e.endOffset);i&&t.has(e.color)&&t.get(e.color).push(i)}for(let[e,i]of t){let s=`hn-${e}`;i.length===0?CSS.highlights.delete(s):CSS.highlights.set(s,new Highlight(...i))}}#v(){this.#t.querySelectorAll("mark[data-hn-id]").forEach(e=>{let i=e.parentNode;for(;e.firstChild;)i.insertBefore(e.firstChild,e);i.removeChild(e)}),this.#t.normalize();let t=[...this.#e].sort((e,i)=>i.startOffset-e.startOffset);for(let e of t){let i=y(this.#t,e.startOffset,e.endOffset);if(!i)continue;let s=dt(this.#t,e.color),r=document.createElement("mark");r.dataset.hnId=e.id,r.dataset.hnColor=e.color,s&&(r.style.backgroundColor=s,r.style.textDecorationColor=s);try{i.surroundContents(r)}catch{let o=i.extractContents();r.appendChild(o),i.insertNode(r)}}}#f(){for(let t of this.#u)t.remove();this.#u=[]}#g(){if(this.#f(),this.#e.length===0)return;getComputedStyle(this.#t).position==="static"&&(this.#t.style.position="relative");for(let e of this.#e){let i=y(this.#t,e.startOffset,e.endOffset);if(!i)continue;let s=i.getClientRects();if(s.length===0)continue;let r=s[0],o=this.#t.getBoundingClientRect(),c=r.top-o.top,a=document.createElement("span");a.className="hn-margin-annotation",a.dataset.hnId=e.id,a.setAttribute("aria-hidden","true"),a.style.top=`${c}px`,e.note?(a.innerHTML='<span class="hn-note-indicator">*</span> You highlighted',a.classList.add("hn-has-note")):a.textContent="You highlighted",this.#t.appendChild(a),this.#u.push(a)}}#i(t,e={}){this.#t.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0}))}},N=new WeakMap;document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>K()):K();gt=new MutationObserver(n=>{for(let t of n)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let i=e;i.matches(L)&&M(i),i.querySelectorAll(L).forEach(s=>{s.hasAttribute("data-highlights-init")||M(s)})}});gt.observe(document.documentElement,{childList:!0,subtree:!0})});var tt={};st(tt,{currentHash:()=>q,initPageWatch:()=>P,readWatch:()=>x,removeWatch:()=>Z,writeWatch:()=>v});function Q(){return typeof window<"u"&&window.vbPageWatch?.serverSync===!0?!0:document.querySelector('meta[name="vb-page-watch-server"]')?.getAttribute("content")==="true"}async function pt(n){if(!Q())return null;try{let t=new b("notify"),e={url:n.url,type:"page-watch",notify:["panel"]},i=await t.post("/subscribe",e);return typeof i?.id=="string"?i.id:null}catch(t){let e=t instanceof m?`${t.status}`:String(t);return console.warn("[page-watch] server subscribe failed; client-only watch in effect.",e),null}}async function mt(n){if(!(!n||!Q()))try{await new b("notify").delete(`/subscribe/${encodeURIComponent(n)}`)}catch(t){let e=t instanceof m?`${t.status}`:String(t);console.warn("[page-watch] server unsubscribe failed; local state already cleared.",e)}}function yt(){return document.querySelector("main")||document.querySelector("article")||document.body}function S(){return location.pathname||"/"}function q(){let n=yt();return n?k(n.textContent||""):""}function bt(){return document.title||S()}async function x(){return await u.get(W,S())}async function v(n){await u.set(W,S(),n)}async function Z(){await u.remove(W,S())}function B(n,t){n.setAttribute("aria-pressed",t?"true":"false"),n.dataset.watching="",t||delete n.dataset.watching;let e=n.querySelector("icon-wc");e&&e.setAttribute("name",t?"bookmark-check":"bookmark");let i=[...n.childNodes].find(s=>s.nodeType===Node.TEXT_NODE&&(s.textContent||"").trim());i&&!n.hasAttribute("data-watch-label-locked")&&(i.textContent=t?"Watching":"Watch for updates"),n.setAttribute("title",t?"Stop watching this page":"Watch this page for content updates")}async function I(n){if(n.hasAttribute("data-watch-page-init"))return;n.setAttribute("data-watch-page-init",""),n.setAttribute("type",n.getAttribute("type")||"button");let t=await x();B(n,!!t),n.addEventListener("click",async e=>{e.preventDefault();let i=await x();if(i)await Z(),B(n,!1),n.dispatchEvent(new CustomEvent("page-watch:remove",{bubbles:!0,composed:!0,detail:{url:i.url,subscriptionId:i.subscriptionId}})),mt(i.subscriptionId);else{let s={url:S(),title:bt(),contentHash:q(),watchedAt:new Date().toISOString(),lastChecked:new Date().toISOString(),lastChanged:null,subscriptionId:null};await v(s),B(n,!0),n.dispatchEvent(new CustomEvent("page-watch:add",{bubbles:!0,composed:!0,detail:{entry:s}}));let r=await pt(s);r&&await v({...s,subscriptionId:r})}})}async function wt(){let n=await x();if(!n)return;let t=q(),e=new Date().toISOString(),i=n.contentHash,s={...n,lastChecked:e};if(t&&t!==i){s.contentHash=t,s.lastChanged=e,await v(s);let r={id:`page-watch:${n.url}:${t}`,type:"watch",title:`Updated: ${n.title}`,body:"Content changed since your last visit.",url:n.url,date:e,read:!1,dismissed:!1,priority:"normal"};document.dispatchEvent(new CustomEvent("notification-wc:new",{bubbles:!0,composed:!0,detail:{notification:r}}))}else await v(s)}function P(n=document){for(let t of n.querySelectorAll(H))I(t);wt()}var H,W,vt,et=E(()=>{T();G();Y();H="[data-watch-page]",W="watches";document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>P()):P();vt=new MutationObserver(n=>{for(let t of n)for(let e of t.addedNodes){if(e.nodeType!==Node.ELEMENT_NODE)continue;let i=e;i.matches?.(H)&&I(i),i.querySelectorAll?.(H).forEach(s=>I(s))}});vt.observe(document.documentElement,{childList:!0,subtree:!0})});var Ct=window.matchMedia("(prefers-reduced-motion: reduce)");var U=new Map;function _(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 C=class extends HTMLElement{#t=[];#n;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#t)t();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,e,i,s){t.addEventListener(e,i,s),this.#t.push(()=>t.removeEventListener(e,i,s))}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)}};var nt="Watch for updates",St="Watching",D=class extends C{#t=null;setup(){if(this.hasAttribute("server-sync")){let e=window;e.vbPageWatch={...e.vbPageWatch??{},serverSync:!0}}let t=this.#n();this.dataset.variant=t;for(let e of Array.from(this.children))e.hasAttribute?.("data-watch-page")&&e.remove();this.#t=this.#s(t),this.appendChild(this.#t),this.listen(document,"page-watch:add",this.#a),this.listen(document,"page-watch:remove",this.#a)}teardown(){this.#t&&(this.#t.remove(),this.#t=null)}#n(){let t=this.getAttribute("variant");return t==="compact"||t==="button"?t:"icon"}#s(t){let e=document.createElement("button");e.type="button",e.setAttribute("data-watch-page",""),e.className="ghost",e.setAttribute("aria-label","Watch this page for updates");let i=t==="icon"?"sm":"xs",s=this.getAttribute("label")??nt;return t==="icon"?e.innerHTML=`<icon-wc name="bookmark" size="${i}"></icon-wc>`:(e.innerHTML=`<icon-wc name="bookmark" size="${i}"></icon-wc><span>${this.#e(s)}</span>`,e.setAttribute("data-watch-label-locked","")),e}#a=async()=>{if(this.#t)try{let{readWatch:t}=await Promise.resolve().then(()=>(et(),tt)),i=!!await t();this.#t.setAttribute("aria-pressed",i?"true":"false");let s=this.#t.querySelector("icon-wc");s&&s.setAttribute("name",i?"bookmark-check":"bookmark");let r=this.#t.querySelector("span");if(r&&this.#n()!=="icon"){let o=this.getAttribute("label");r.textContent=o||(i?St:nt)}this.#t.setAttribute("title",i?"Stop watching this page":"Watch this page for content updates")}catch{}};#e(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}};_("watch-wc",D);export{D as WatchWc};
3
3
  //# sourceMappingURL=watch-wc.js.map
@@ -1,2 +1,2 @@
1
- var x=class extends HTMLElement{#t=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,r,n,c){e.addEventListener(r,n,c),this.#t.push(()=>e.removeEventListener(r,n,c))}setup(){}teardown(){}};var P=window.matchMedia("(prefers-reduced-motion: reduce)");var N=new Map;function B(d,e,r={}){let n=r.priority??10,c={impl:e,bundle:r.bundle,contract:r.contract,priority:n},t=N.get(d);if(customElements.get(d)){if(!t||t.priority>=n){t&&t.priority===n&&t.impl!==e&&console.warn(`[VB Bundle] Tag <${d}> already registered by "${t.bundle}" (priority ${t.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${d}> defined by "${t.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(t&&t.priority>=n){t.priority===n&&console.warn(`[VB Bundle] Tag <${d}> already registered by "${t.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}N.set(d,c),customElements.define(d,e)}function O(d){let e=d.getFullYear(),r=String(d.getMonth()+1).padStart(2,"0"),n=String(d.getDate()).padStart(2,"0");return`${e}-${r}-${n}`}var T=class extends x{#t;setup(){if(this.#t=this.querySelector("table"),this.#t||this.#n(),!this.#t)return!1;this.#e(),this.listen(this.#t,"click",r=>{let n=r.target.closest("calendar-event");if(!n)return;let t=n.closest("tr")?.querySelector("th time[datetime]");this.dispatchEvent(new CustomEvent("week-view:event-click",{bubbles:!0,detail:{date:n.dataset.date,time:n.querySelector("time[datetime]")?.getAttribute("datetime")||t?.getAttribute("datetime"),text:n.textContent.trim(),element:n,category:n.dataset.category,duration:n.dataset.duration}}))}),this.#r();let e=this.#t.querySelector("calendar-event");e&&e.setAttribute("tabindex","0")}teardown(){this.querySelectorAll("calendar-event.wv-spanning").forEach(e=>{e.style.cssText="",e.classList.remove("wv-spanning")})}refresh(){this.teardown(),this.#e()}#n(){let e=[...this.querySelectorAll(":scope > calendar-event")];if(e.length===0)return;let r=this.dataset.startDate;if(!r)return;let n=parseInt(this.dataset.days||"7",10),[c,t,h]=r.split("-").map(Number),m=new Date(c,t-1,h),l=[];for(let s=0;s<n;s++){let i=new Date(m);i.setDate(i.getDate()+s),l.push(i)}let u=l.map(O),o=new Map,a=new Set;e.forEach(s=>{let i=s.dataset.date;if(!i||!u.includes(i))return;let p=s.querySelector("time[datetime]");if(!p)return;let v=p.getAttribute("datetime").split(":"),A=parseInt(v[0],10),C=parseInt(v[1]||"0",10);if(isNaN(A))return;C>=30&&!s.dataset.start&&(s.dataset.start="30");let D=String(A).padStart(2,"0"),y=`${i}:${D}`;o.has(y)||o.set(y,[]),o.get(y).push(s),a.add(A)});let f=[...a].sort((s,i)=>s-i),b=this.dataset.startHour==="auto"||!this.dataset.startHour,E=b?f.length>0?Math.max(0,f[0]-1):7:parseInt(this.dataset.startHour,10),g=b?f.length>0?Math.min(23,f[f.length-1]+1):19:parseInt(this.dataset.endHour||"19",10),S=this.closest("[lang]")?.lang||navigator.language,M=new Intl.DateTimeFormat(S,{weekday:"short",day:"numeric"}),$=new Intl.DateTimeFormat(S,{hour:"numeric"});this.style.setProperty("--wv-days",n);let w=document.createElement("table"),F=document.createElement("thead"),q=document.createElement("tr"),L=document.createElement("th");L.setAttribute("aria-label","Time"),q.appendChild(L),l.forEach(s=>{let i=document.createElement("th");i.setAttribute("scope","col");let p=document.createElement("time");p.setAttribute("datetime",O(s)),p.textContent=M.format(s),i.appendChild(p),q.appendChild(i)}),F.appendChild(q),w.appendChild(F);let H=document.createElement("tbody");for(let s=E;s<=g;s++){let i=document.createElement("tr"),p=document.createElement("th");p.setAttribute("scope","row");let k=document.createElement("time"),v=String(s).padStart(2,"0");k.setAttribute("datetime",`${v}:00`),k.textContent=$.format(new Date(2026,0,1,s)),p.appendChild(k),i.appendChild(p),u.forEach(A=>{let C=document.createElement("td"),D=`${A}:${v}`,y=o.get(D)||[];if(y.length>0){let I=document.createElement("hour-view");y.length>1&&(I.dataset.overlap=""),y.forEach(R=>I.appendChild(R)),C.appendChild(I)}i.appendChild(C)}),H.appendChild(i)}w.appendChild(H),this.appendChild(w),this.#t=w}#e(){let e=this.#t.querySelector("tbody");if(!e)return;let r=e.querySelectorAll("calendar-event[data-duration]");r.length!==0&&requestAnimationFrame(()=>{let n=e.getBoundingClientRect(),c=new Map;e.querySelectorAll(":scope > tr").forEach(t=>{let h=t.querySelector("th time[datetime]");if(!h)return;let m=parseInt(h.getAttribute("datetime").split(":")[0],10),l=t.getBoundingClientRect();c.set(m,{top:l.top-n.top,height:l.height})}),r.forEach(t=>{let h=t.closest("td"),m=h?.closest("tr");if(!h||!m)return;let l=m.querySelector("th time[datetime]"),u=parseInt(l?.getAttribute("datetime")?.split(":")[0],10),o=parseInt(t.dataset.start||"0",10),a=t.dataset.duration,f=60,b=a.match(/(\d+)h/),E=a.match(/(\d+)m/);(b||E)&&(f=(b?parseInt(b[1],10)*60:0)+(E?parseInt(E[1],10):0));let g=c.get(u);if(!g)return;let S=h.getBoundingClientRect(),M=o/60,$=g.top+g.height*M,w=g.height*(f/60);t.style.position="absolute",t.style.top=$+"px",t.style.height=w+"px",t.style.left=S.left-n.left+2+"px",t.style.right=n.right-S.right+2+"px",t.classList.add("wv-spanning")})})}#r(){this.listen(this.#t,"keydown",e=>{if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key))return;let r=e.target.closest("calendar-event");if(!r)return;let n=r.closest("td"),c=n?.closest("tr");if(!n||!c)return;let t=[...c.parentElement.children],h=t.indexOf(c),m=[...c.children],l=m.indexOf(n),u=null;if(e.key==="ArrowDown")for(let o=h+1;o<t.length;o++){let a=t[o].children[l]?.querySelector("calendar-event");if(a){u=a;break}}else if(e.key==="ArrowUp")for(let o=h-1;o>=0;o--){let a=t[o].children[l]?.querySelector("calendar-event");if(a){u=a;break}}else if(e.key==="ArrowRight")for(let o=l+1;o<m.length;o++){let a=m[o]?.querySelector("calendar-event");if(a){u=a;break}}else if(e.key==="ArrowLeft")for(let o=l-1;o>=1;o--){let a=m[o]?.querySelector("calendar-event");if(a){u=a;break}}u&&(e.preventDefault(),u.setAttribute("tabindex","0"),r.setAttribute("tabindex","-1"),u.focus())})}};B("week-view",T);export{T as WeekView};
1
+ var I=class extends HTMLElement{#t=[];#e;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#t)e();this.#t=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,n,t,r){e.addEventListener(n,t,r),this.#t.push(()=>e.removeEventListener(n,t,r))}setup(){}teardown(){}setState(e,n){this.#e||(this.#e=this.attachInternals());let t=this.#e.states;try{n?t.add(e):t.delete(e)}catch{let r=`--${e}`;n?t.add(r):t.delete(r)}}_adoptInternals(e){this.#e||(this.#e=e)}};var P=window.matchMedia("(prefers-reduced-motion: reduce)");var H=new Map;function B(h,e,n={}){let t=n.priority??10,r={impl:e,bundle:n.bundle,contract:n.contract,priority:t},s=H.get(h);if(customElements.get(h)){if(!s||s.priority>=t){s&&s.priority===t&&s.impl!==e&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${n.bundle}".`);return}console.warn(`[VB Bundle] Tag <${h}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${n.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=t){s.priority===t&&console.warn(`[VB Bundle] Tag <${h}> already registered by "${s.bundle}". Skipping "${n.bundle}" (first wins at equal priority).`);return}H.set(h,r),customElements.define(h,e)}function O(h){let e=h.getFullYear(),n=String(h.getMonth()+1).padStart(2,"0"),t=String(h.getDate()).padStart(2,"0");return`${e}-${n}-${t}`}var N=class extends I{#t=null;setup(){if(this.#t=this.querySelector("table"),this.#t||this.#e(),!this.#t)return!1;this.#n(),this.listen(this.#t,"click",n=>{let r=n.target?.closest("calendar-event");if(!r)return;let a=r.closest("tr")?.querySelector("th time[datetime]");this.dispatchEvent(new CustomEvent("week-view:event-click",{bubbles:!0,detail:{date:r.dataset.date,time:r.querySelector("time[datetime]")?.getAttribute("datetime")||a?.getAttribute("datetime"),text:r.textContent?.trim()??"",element:r,category:r.dataset.category,duration:r.dataset.duration}}))}),this.#r();let e=this.#t.querySelector("calendar-event");return e&&e.setAttribute("tabindex","0"),!0}teardown(){this.querySelectorAll("calendar-event.wv-spanning").forEach(e=>{e.style.cssText="",e.classList.remove("wv-spanning")})}refresh(){this.teardown(),this.#n()}get events(){return[...this.querySelectorAll("calendar-event")].map(e=>{let n=e;return{date:n.dataset.date||void 0,time:n.querySelector("time[datetime]")?.getAttribute("datetime")||void 0,text:n.textContent?.trim()??"",category:n.dataset.category||void 0,duration:n.dataset.duration||void 0}})}set events(e){let n=Array.isArray(e)?e:[];for(;this.firstChild;)this.firstChild.remove();for(let t of n){let r=document.createElement("calendar-event");if(t.date&&(r.dataset.date=t.date),t.category&&(r.dataset.category=t.category),t.duration&&(r.dataset.duration=String(t.duration)),t.time){let s=document.createElement("time");s.setAttribute("datetime",t.time),s.textContent=t.time,r.appendChild(s),r.appendChild(document.createTextNode(" "))}r.appendChild(document.createTextNode(t.text||"")),this.appendChild(r)}this.teardown(),this.removeAttribute("data-upgraded"),this.setup(),this.dispatchEvent(new CustomEvent("week-view:events-changed",{detail:{events:n,source:"property"},bubbles:!0}))}#e(){let e=[...this.querySelectorAll(":scope > calendar-event")];if(e.length===0)return;let n=this.dataset.startDate;if(!n)return;let t=parseInt(this.dataset.days||"7",10),[r,s,a]=n.split("-").map(Number),u=new Date(r,s-1,a),m=[];for(let l=0;l<t;l++){let i=new Date(u);i.setDate(i.getDate()+l),m.push(i)}let y=m.map(O),f=new Map,g=new Set;e.forEach(l=>{let i=l,p=i.dataset.date;if(!p||!y.includes(p))return;let S=i.querySelector("time[datetime]");if(!S)return;let k=S.getAttribute("datetime");if(!k)return;let T=k.split(":"),A=parseInt(T[0],10),D=parseInt(T[1]||"0",10);if(isNaN(A))return;D>=30&&!i.dataset.start&&(i.dataset.start="30");let q=String(A).padStart(2,"0"),b=`${p}:${q}`;f.has(b)||f.set(b,[]),f.get(b).push(i),g.add(A)});let d=[...g].sort((l,i)=>l-i),o=this.dataset.startHour==="auto"||!this.dataset.startHour,c=o?d.length>0?Math.max(0,d[0]-1):7:parseInt(this.dataset.startHour??"",10),C=o?d.length>0?Math.min(23,d[d.length-1]+1):19:parseInt(this.dataset.endHour||"19",10),v=this.closest("[lang]")?.lang||navigator.language,E=new Intl.DateTimeFormat(v,{weekday:"short",day:"numeric"}),M=new Intl.DateTimeFormat(v,{hour:"numeric"});this.style.setProperty("--wv-days",String(t));let w=document.createElement("table"),$=document.createElement("thead"),x=document.createElement("tr"),F=document.createElement("th");F.setAttribute("aria-label","Time"),x.appendChild(F),m.forEach(l=>{let i=document.createElement("th");i.setAttribute("scope","col");let p=document.createElement("time");p.setAttribute("datetime",O(l)),p.textContent=E.format(l),i.appendChild(p),x.appendChild(i)}),$.appendChild(x),w.appendChild($);let L=document.createElement("tbody");for(let l=c;l<=C;l++){let i=document.createElement("tr"),p=document.createElement("th");p.setAttribute("scope","row");let S=document.createElement("time"),k=String(l).padStart(2,"0");S.setAttribute("datetime",`${k}:00`),S.textContent=M.format(new Date(2026,0,1,l)),p.appendChild(S),i.appendChild(p),y.forEach(T=>{let A=document.createElement("td"),D=`${T}:${k}`,q=f.get(D)||[];if(q.length>0){let b=document.createElement("hour-view");q.length>1&&(b.dataset.overlap=""),q.forEach(R=>b.appendChild(R)),A.appendChild(b)}i.appendChild(A)}),L.appendChild(i)}w.appendChild(L),this.appendChild(w),this.#t=w}#n(){let e=this.#t?.querySelector("tbody");if(!e)return;let n=e.querySelectorAll("calendar-event[data-duration]");n.length!==0&&requestAnimationFrame(()=>{let t=e.getBoundingClientRect(),r=new Map;e.querySelectorAll(":scope > tr").forEach(s=>{let a=s.querySelector("th time[datetime]");if(!a)return;let u=a.getAttribute("datetime");if(!u)return;let m=parseInt(u.split(":")[0],10),y=s.getBoundingClientRect();r.set(m,{top:y.top-t.top,height:y.height})}),n.forEach(s=>{let a=s,u=a.closest("td"),m=u?.closest("tr");if(!u||!m)return;let f=m.querySelector("th time[datetime]")?.getAttribute("datetime");if(!f)return;let g=parseInt(f.split(":")[0],10),d=parseInt(a.dataset.start||"0",10),o=a.dataset.duration??"",c=60,C=o.match(/(\d+)h/),v=o.match(/(\d+)m/);(C||v)&&(c=(C?parseInt(C[1],10)*60:0)+(v?parseInt(v[1],10):0));let E=r.get(g);if(!E)return;let M=u.getBoundingClientRect(),w=d/60,$=E.top+E.height*w,x=E.height*(c/60);a.style.position="absolute",a.style.top=$+"px",a.style.height=x+"px",a.style.left=M.left-t.left+2+"px",a.style.right=t.right-M.right+2+"px",a.classList.add("wv-spanning")})})}#r(){let e=this.#t;e&&this.listen(e,"keydown",n=>{let t=n;if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(t.key))return;let s=t.target?.closest("calendar-event");if(!s)return;let a=s.closest("td"),u=a?.closest("tr");if(!a||!u||!u.parentElement)return;let m=[...u.parentElement.children],y=m.indexOf(u),f=[...u.children],g=f.indexOf(a),d=null;if(t.key==="ArrowDown")for(let o=y+1;o<m.length;o++){let c=m[o].children[g]?.querySelector("calendar-event");if(c){d=c;break}}else if(t.key==="ArrowUp")for(let o=y-1;o>=0;o--){let c=m[o].children[g]?.querySelector("calendar-event");if(c){d=c;break}}else if(t.key==="ArrowRight")for(let o=g+1;o<f.length;o++){let c=f[o]?.querySelector("calendar-event");if(c){d=c;break}}else if(t.key==="ArrowLeft")for(let o=g-1;o>=1;o--){let c=f[o]?.querySelector("calendar-event");if(c){d=c;break}}d&&(t.preventDefault(),d.setAttribute("tabindex","0"),s.setAttribute("tabindex","-1"),d.focus())})}};B("week-view",N);export{N as WeekView};
2
2
  //# sourceMappingURL=week-view.js.map
@@ -88,12 +88,13 @@ var c=`
88
88
  height: 12px;
89
89
  }
90
90
 
91
- /* Type colors */
92
- .wi-type[data-type="task"] { color: #3b82f6; background: rgba(59, 130, 246, 0.1); }
93
- .wi-type[data-type="bug"] { color: #dc2626; background: rgba(220, 38, 38, 0.1); }
94
- .wi-type[data-type="chore"] { color: #6b7280; background: rgba(107, 114, 128, 0.1); }
95
- .wi-type[data-type="spike"] { color: #8b5cf6; background: rgba(139, 92, 246, 0.1); }
96
- .wi-type[data-type="feature"] { color: #059669; background: rgba(5, 150, 105, 0.1); }
91
+ /* Type colors \u2014 driven by VB theme tokens, with color-mix surfaces so the
92
+ pill background shifts with the active theme. */
93
+ .wi-type[data-type="task"] { color: var(--color-info, #3b82f6); background: color-mix(in oklch, var(--color-info, #3b82f6) 12%, transparent); }
94
+ .wi-type[data-type="bug"] { color: var(--color-error, #dc2626); background: color-mix(in oklch, var(--color-error, #dc2626) 12%, transparent); }
95
+ .wi-type[data-type="chore"] { color: var(--color-text-muted, #6b7280); background: color-mix(in oklch, var(--color-text-muted, #6b7280) 12%, transparent); }
96
+ .wi-type[data-type="spike"] { color: var(--color-accent, #8b5cf6); background: color-mix(in oklch, var(--color-accent, #8b5cf6) 12%, transparent); }
97
+ .wi-type[data-type="feature"] { color: var(--color-success, #059669); background: color-mix(in oklch, var(--color-success, #059669) 12%, transparent); }
97
98
 
98
99
  /* \u2500\u2500 Badges \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
99
100
  .wi-badges {
@@ -176,7 +177,7 @@ var c=`
176
177
  display: flex;
177
178
  align-items: center;
178
179
  justify-content: center;
179
- color: #fff;
180
+ color: var(--color-text-inverted, #fff);
180
181
  flex-shrink: 0;
181
182
  }
182
183
 
@@ -243,12 +244,12 @@ var c=`
243
244
  .wi-section-icon svg {
244
245
  width: 13px;
245
246
  height: 13px;
246
- fill: white;
247
+ fill: var(--color-text-inverted, #fff);
247
248
  }
248
249
 
249
- .wi-section-icon.description { background: #3b82f6; }
250
- .wi-section-icon.checklist { background: #22c55e; }
251
- .wi-section-icon.notes { background: #f59e0b; }
250
+ .wi-section-icon.description { background: var(--color-info, #3b82f6); }
251
+ .wi-section-icon.checklist { background: var(--color-success, #22c55e); }
252
+ .wi-section-icon.notes { background: var(--color-warning, #f59e0b); }
252
253
 
253
254
  .wi-section-title {
254
255
  font-size: var(--_font-xs);
@@ -359,31 +360,31 @@ var c=`
359
360
  }
360
361
 
361
362
  .state-msg { padding: var(--_space-m); font-size: var(--_font-sm); color: var(--_muted); font-style: italic; }
362
- .state-msg--error { color: #dc2626; }
363
- `;var k=window.matchMedia("(prefers-reduced-motion: reduce)");var g=new Map;function w(r,t,i={}){let e=i.priority??10,s={impl:t,bundle:i.bundle,contract:i.contract,priority:e},a=g.get(r);if(customElements.get(r)){if(!a||a.priority>=e){a&&a.priority===e&&a.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${a.bundle}" (priority ${a.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${a.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(a&&a.priority>=e){a.priority===e&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${a.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}g.set(r,s),customElements.define(r,t)}function o(r){return String(r).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function b(r){return r.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function v(r){let t=0;for(let e=0;e<r.length;e++)t=r.charCodeAt(e)+((t<<5)-t);return`hsl(${(t%360+360)%360}, 65%, 55%)`}function p(r){return`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${r}</svg>`}var d={user:'<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',check:'<path d="M20 6 9 17l-5-5"/>',target:'<circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/>',alertTriangle:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',messageCircle:'<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/>',lightbulb:'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',wrench:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',heart:'<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',mapPin:'<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/>',checkCircle:'<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/>',send:'<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/>'},M={says:{label:"Says",icon:d.messageCircle,color:"#3b82f6"},thinks:{label:"Thinks",icon:d.lightbulb,color:"#8b5cf6"},does:{label:"Does",icon:d.wrench,color:"#f59e0b"},feels:{label:"Feels",icon:d.heart,color:"#ef4444"}};var y={task:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="m9 12 2 2 4-4"/>',bug:'<path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/>',chore:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',spike:'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',feature:'<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>'},h={critical:{label:"Critical",color:"#dc2626",bg:"rgba(220, 38, 38, 0.1)"},high:{label:"High",color:"#ea580c",bg:"rgba(234, 88, 12, 0.1)"},medium:{label:"Medium",color:"#ca8a04",bg:"rgba(202, 138, 4, 0.1)"},low:{label:"Low",color:"#16a34a",bg:"rgba(22, 163, 74, 0.1)"}},m={backlog:{label:"Backlog",color:"#6b7280",bg:"rgba(107, 114, 128, 0.1)"},"to-do":{label:"To Do",color:"#3b82f6",bg:"rgba(59, 130, 246, 0.1)"},"in-progress":{label:"In Progress",color:"#8b5cf6",bg:"rgba(139, 92, 246, 0.1)"},review:{label:"Review",color:"#f59e0b",bg:"rgba(245, 158, 11, 0.1)"},done:{label:"Done",color:"#22c55e",bg:"rgba(34, 197, 94, 0.1)"},blocked:{label:"Blocked",color:"#dc2626",bg:"rgba(220, 38, 38, 0.1)"}},u=class extends HTMLElement{static get observedAttributes(){return["item-id","type","priority","status","estimate","assignee","story-ids","detail","compact","src"]}#t=new Map;constructor(){super(),this.attachShadow({mode:"open"})}#i(){for(let t of[...this.children]){let i=t.getAttribute("slot");i&&this.#t.set(i,t.textContent.trim())}}_resolve(t){return this.getAttribute(t)||this.#t.get(t)||""}connectedCallback(){this.#i(),this.itemId&&!this.id&&(this.id=this.itemId),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#e(),this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded")}attributeChangedCallback(t,i,e){i!==e&&this.shadowRoot&&(t==="src"&&this.isConnected?this._loadSrc(e):this.#e())}get itemId(){return this.getAttribute("item-id")||""}get itemTitle(){return this.querySelector('[slot="title"]')?.textContent?.trim()||this.#t.get("title")||""}get itemType(){return this.getAttribute("type")||"task"}get priority(){return this.getAttribute("priority")||"medium"}get status(){return this.getAttribute("status")||"backlog"}get estimate(){return this.getAttribute("estimate")||""}get assignee(){return this.getAttribute("assignee")||""}get storyIds(){let t=this.getAttribute("story-ids")||"";return t?t.split(",").map(i=>i.trim()).filter(Boolean):[]}get _detailLevel(){return this.getAttribute("detail")?this.getAttribute("detail"):this.hasAttribute("compact")?"compact":"full"}get _minimalLabel(){return this.itemTitle||this.itemId||"Work item"}updateStatus(t){m[t]&&(this.setAttribute("status",t),this.dispatchEvent(new CustomEvent("work-item:status",{detail:{status:t,itemId:this.itemId},bubbles:!0,composed:!0})))}updatePriority(t){h[t]&&(this.setAttribute("priority",t),this.dispatchEvent(new CustomEvent("work-item:priority",{detail:{priority:t,itemId:this.itemId},bubbles:!0,composed:!0})))}async _loadSrc(t){if(t){this.shadowRoot.innerHTML=`<style>${c}</style><div class="state-msg">Loading\u2026</div>`;try{let i=await fetch(t);if(!i.ok)throw new Error(`HTTP ${i.status}`);let e=await i.json();for(let[s,a]of[["itemId","item-id"],["type","type"],["priority","priority"],["status","status"],["estimate","estimate"],["assignee","assignee"],["detail","detail"]])e[s]!=null&&this.setAttribute(a,String(e[s]));if(e.storyIds&&this.setAttribute("story-ids",Array.isArray(e.storyIds)?e.storyIds.join(","):e.storyIds),e.title&&!this.querySelector('[slot="title"]')){let s=document.createElement("h3");s.slot="title",s.textContent=e.title,this.appendChild(s)}for(let s of["description","notes"])if(e[s]&&!this.querySelector(`[slot="${s}"]`)){let a=document.createElement("p");a.slot=s,a.textContent=e[s],this.appendChild(a)}if(e.checklist&&!this.querySelector('[slot="checklist"]')){let s=document.createElement("ul");s.slot="checklist";let a=Array.isArray(e.checklist)?e.checklist:[e.checklist];for(let l of a){let n=document.createElement("li");n.textContent=l,s.appendChild(n)}this.appendChild(s)}this.#e()}catch(i){this.shadowRoot.innerHTML=`<style>${c}</style><div class="state-msg state-msg--error">Could not load: ${o(i.message)}</div>`}}}#e(){let t=h[this.priority]||h.medium,i=m[this.status]||m.backlog,e=this.itemType,s=y[e]||y.task,a=this._detailLevel,l=this.itemId?`Work item: ${o(this.itemId)}`:"Work item";if(a==="minimal"){this.shadowRoot.innerHTML=`<style>${c}</style>
364
- <article class="wi-card wi-card--minimal" role="article" aria-label="${l}"
363
+ .state-msg--error { color: var(--color-error-text, var(--color-error, #dc2626)); }
364
+ `;var _=window.matchMedia("(prefers-reduced-motion: reduce)");var v=new Map;function w(r,t,e={}){let i=e.priority??10,o={impl:t,bundle:e.bundle,contract:e.contract,priority:i},s=v.get(r);if(customElements.get(r)){if(!s||s.priority>=i){s&&s.priority===i&&s.impl!==t&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}" (priority ${s.priority}). Skipping "${e.bundle}".`);return}console.warn(`[VB Bundle] Tag <${r}> defined by "${s.bundle}" cannot be replaced (customElements.define is permanent). "${e.bundle}" has higher priority but arrived late.`);return}if(s&&s.priority>=i){s.priority===i&&console.warn(`[VB Bundle] Tag <${r}> already registered by "${s.bundle}". Skipping "${e.bundle}" (first wins at equal priority).`);return}v.set(r,o),customElements.define(r,t)}function a(r){return String(r).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function b(r){return r.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function y(r){let t=0;for(let i=0;i<r.length;i++)t=r.charCodeAt(i)+((t<<5)-t);return`hsl(${(t%360+360)%360}, 65%, 55%)`}function d(r){return`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${r}</svg>`}var l={user:'<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',pencil:'<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',check:'<path d="M20 6 9 17l-5-5"/>',target:'<circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/>',alertTriangle:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',messageCircle:'<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"/>',lightbulb:'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',wrench:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',heart:'<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',mapPin:'<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/>',checkCircle:'<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/>',x:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',download:'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/>',send:'<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/>'},$={says:{label:"Says",icon:l.messageCircle,color:"#3b82f6"},thinks:{label:"Thinks",icon:l.lightbulb,color:"#8b5cf6"},does:{label:"Does",icon:l.wrench,color:"#f59e0b"},feels:{label:"Feels",icon:l.heart,color:"#ef4444"}};var x={task:'<rect x="3" y="3" width="18" height="18" rx="2"/><path d="m9 12 2 2 4-4"/>',bug:'<path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/><path d="M6.53 9C4.6 8.8 3 7.1 3 5"/><path d="M6 13H2"/><path d="M3 21c0-2.1 1.7-3.9 3.8-4"/><path d="M20.97 5c0 2.1-1.6 3.8-3.5 4"/><path d="M22 13h-4"/><path d="M17.2 17c2.1.1 3.8 1.9 3.8 4"/>',chore:'<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>',spike:'<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',feature:'<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>'},h={critical:{label:"Critical",color:"#dc2626",bg:"rgba(220, 38, 38, 0.1)"},high:{label:"High",color:"#ea580c",bg:"rgba(234, 88, 12, 0.1)"},medium:{label:"Medium",color:"#ca8a04",bg:"rgba(202, 138, 4, 0.1)"},low:{label:"Low",color:"#16a34a",bg:"rgba(22, 163, 74, 0.1)"}},m={backlog:{label:"Backlog",color:"#6b7280",bg:"rgba(107, 114, 128, 0.1)"},"to-do":{label:"To Do",color:"#3b82f6",bg:"rgba(59, 130, 246, 0.1)"},"in-progress":{label:"In Progress",color:"#8b5cf6",bg:"rgba(139, 92, 246, 0.1)"},review:{label:"Review",color:"#f59e0b",bg:"rgba(245, 158, 11, 0.1)"},done:{label:"Done",color:"#22c55e",bg:"rgba(34, 197, 94, 0.1)"},blocked:{label:"Blocked",color:"#dc2626",bg:"rgba(220, 38, 38, 0.1)"}},u=class extends HTMLElement{static get observedAttributes(){return["item-id","type","priority","status","estimate","assignee","story-ids","detail","compact","src"]}#e=new Map;constructor(){super(),this.attachShadow({mode:"open"})}#i(){for(let t of[...this.children]){let e=t.getAttribute("slot");e&&this.#e.set(e,t.textContent.trim())}}_resolve(t){return this.getAttribute(t)||this.#e.get(t)||""}connectedCallback(){this.#i(),this.itemId&&!this.id&&(this.id=this.itemId),this.hasAttribute("src")&&this._loadSrc(this.getAttribute("src")),this.#t(),this.setAttribute("data-upgraded","")}disconnectedCallback(){this.removeAttribute("data-upgraded")}attributeChangedCallback(t,e,i){e!==i&&this.shadowRoot&&(t==="src"&&this.isConnected?this._loadSrc(i):this.#t())}get itemId(){return this.getAttribute("item-id")||""}get itemTitle(){return this.querySelector('[slot="title"]')?.textContent?.trim()||this.#e.get("title")||""}get itemType(){return this.getAttribute("type")||"task"}get priority(){return this.getAttribute("priority")||"medium"}get status(){return this.getAttribute("status")||"backlog"}get estimate(){return this.getAttribute("estimate")||""}get assignee(){return this.getAttribute("assignee")||""}get storyIds(){let t=this.getAttribute("story-ids")||"";return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}get _detailLevel(){return this.getAttribute("detail")?this.getAttribute("detail"):this.hasAttribute("compact")?"compact":"full"}get _minimalLabel(){return this.itemTitle||this.itemId||"Work item"}updateStatus(t){m[t]&&(this.setAttribute("status",t),this.dispatchEvent(new CustomEvent("work-item:status",{detail:{status:t,itemId:this.itemId},bubbles:!0,composed:!0})))}updatePriority(t){h[t]&&(this.setAttribute("priority",t),this.dispatchEvent(new CustomEvent("work-item:priority",{detail:{priority:t,itemId:this.itemId},bubbles:!0,composed:!0})))}get data(){return{itemId:this.itemId||void 0,type:this.itemType,priority:this.priority,status:this.status,estimate:this.estimate||void 0,assignee:this.assignee||void 0,storyIds:this.storyIds.length?this.storyIds:void 0,detail:this.getAttribute("detail")||void 0,title:this.itemTitle||void 0}}set data(t){!t||typeof t!="object"||(this._applyData(t),this.shadowRoot&&this.#t(),this.dispatchEvent(new CustomEvent("work-item:data-changed",{detail:{data:this.data,source:"property"},bubbles:!0,composed:!0})))}_applyData(t){for(let[e,i]of[["itemId","item-id"],["type","type"],["priority","priority"],["status","status"],["estimate","estimate"],["assignee","assignee"],["detail","detail"]])t[e]!=null&&this.setAttribute(i,String(t[e]));if(t.storyIds&&this.setAttribute("story-ids",Array.isArray(t.storyIds)?t.storyIds.join(","):String(t.storyIds)),t.title&&!this.querySelector('[slot="title"]')){let e=document.createElement("h3");e.slot="title",e.textContent=String(t.title),this.appendChild(e)}for(let e of["description","notes"])if(t[e]&&!this.querySelector(`[slot="${e}"]`)){let i=document.createElement("p");i.slot=e,i.textContent=String(t[e]),this.appendChild(i)}if(t.checklist&&!this.querySelector('[slot="checklist"]')){let e=document.createElement("ul");e.slot="checklist";let i=Array.isArray(t.checklist)?t.checklist:[t.checklist];for(let o of i){let s=document.createElement("li");s.textContent=String(o),e.appendChild(s)}this.appendChild(e)}}async _loadSrc(t){if(!t)return;let e=this.shadowRoot;e.innerHTML=`<style>${c}</style><div class="state-msg">Loading\u2026</div>`;try{let i=await fetch(t);if(!i.ok)throw new Error(`HTTP ${i.status}`);let o=await i.json();this._applyData(o),this.#t()}catch(i){e.innerHTML=`<style>${c}</style><div class="state-msg state-msg--error">Could not load: ${a(i.message)}</div>`}}#t(){let t=this.shadowRoot,e=h[this.priority]||h.medium,i=m[this.status]||m.backlog,o=this.itemType,s=x[o]||x.task,p=this._detailLevel,f=this.itemId?`Work item: ${a(this.itemId)}`:"Work item";if(p==="minimal"){t.innerHTML=`<style>${c}</style>
365
+ <article class="wi-card wi-card--minimal" role="article" aria-label="${f}"
365
366
  tabindex="0">
366
367
  <div class="wi-body">
367
368
  <div class="wi-meta">
368
- ${this.itemId?`<span class="wi-id">${o(this.itemId)}</span>`:""}
369
- <span class="wi-type" data-type="${o(e)}">${p(s)} ${o(e)}</span>
369
+ ${this.itemId?`<span class="wi-id">${a(this.itemId)}</span>`:""}
370
+ <span class="wi-type" data-type="${a(o)}">${d(s)} ${a(o)}</span>
370
371
  </div>
371
372
  <div class="wi-title-wrap">
372
- <slot name="title"><span class="wi-title-fallback">${o(this._minimalLabel)}</span></slot>
373
+ <slot name="title"><span class="wi-title-fallback">${a(this._minimalLabel)}</span></slot>
373
374
  </div>
374
375
  </div>
375
- </article>`;return}if(this.shadowRoot.innerHTML=`<style>${c}</style>
376
- <article class="wi-card wi-card--${a}" role="article" aria-label="${l}">
376
+ </article>`;return}if(t.innerHTML=`<style>${c}</style>
377
+ <article class="wi-card wi-card--${p}" role="article" aria-label="${f}">
377
378
 
378
379
  <header class="wi-header">
379
380
  <div class="wi-meta">
380
- ${this.itemId?`<span class="wi-id">${o(this.itemId)}</span>`:""}
381
- <span class="wi-type" data-type="${o(e)}">${p(s)} ${o(e)}</span>
381
+ ${this.itemId?`<span class="wi-id">${a(this.itemId)}</span>`:""}
382
+ <span class="wi-type" data-type="${a(o)}">${d(s)} ${a(o)}</span>
382
383
  </div>
383
384
  <div class="wi-badges">
384
- <span class="wi-priority" style="color:${t.color};background:${t.bg}">${o(t.label)}</span>
385
- <span class="wi-status" style="color:${i.color};background:${i.bg}">${o(i.label)}</span>
386
- ${this.estimate?`<span class="wi-estimate" title="Estimate">${o(this.estimate)}</span>`:""}
385
+ <span class="wi-priority" style="color:${e.color};background:${e.bg}">${a(e.label)}</span>
386
+ <span class="wi-status" style="color:${i.color};background:${i.bg}">${a(i.label)}</span>
387
+ ${this.estimate?`<span class="wi-estimate" title="Estimate">${a(this.estimate)}</span>`:""}
387
388
  </div>
388
389
  </header>
389
390
 
@@ -394,13 +395,13 @@ var c=`
394
395
 
395
396
  ${this.assignee?`
396
397
  <div class="wi-assignee">
397
- <span class="wi-assignee__avatar" style="background:${v(this.assignee)}">${b(this.assignee)}</span>
398
- ${o(this.assignee)}
398
+ <span class="wi-assignee__avatar" style="background:${y(this.assignee)}">${b(this.assignee)}</span>
399
+ ${a(this.assignee)}
399
400
  </div>`:""}
400
401
 
401
402
  ${this.storyIds.length?`
402
403
  <div class="wi-links">
403
- ${this.storyIds.map(n=>`<a class="wi-link" href="#${o(n)}">${p('<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M7 7h10"/><path d="M7 12h10"/><path d="M7 17h10"/>')} ${o(n)}</a>`).join("")}
404
+ ${this.storyIds.map(n=>`<a class="wi-link" href="#${a(n)}">${d('<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M7 7h10"/><path d="M7 12h10"/><path d="M7 17h10"/>')} ${a(n)}</a>`).join("")}
404
405
  </div>`:""}
405
406
  </div>
406
407
 
@@ -442,5 +443,5 @@ var c=`
442
443
  </div>
443
444
  </div>
444
445
 
445
- </article>`,a==="compact")for(let n of this.shadowRoot.querySelectorAll(".wi-section")){let f=n.querySelector("slot");f&&f.assignedNodes().length===0&&n.setAttribute("data-empty","")}this.dispatchEvent(new CustomEvent("work-item:ready",{detail:{itemId:this.itemId,title:this.itemTitle,type:e,priority:this.priority,status:this.status},bubbles:!0,composed:!0}))}};w("work-item",u);export{u as WorkItem};
446
+ </article>`,p==="compact")for(let n of t.querySelectorAll(".wi-section")){let g=n.querySelector("slot");g&&g.assignedNodes().length===0&&n.setAttribute("data-empty","")}this.dispatchEvent(new CustomEvent("work-item:ready",{detail:{itemId:this.itemId,title:this.itemTitle,type:o,priority:this.priority,status:this.status},bubbles:!0,composed:!0}))}};w("work-item",u);export{u as WorkItem};
446
447
  //# sourceMappingURL=work-item.js.map
@@ -1,2 +1,2 @@
1
- var o=class extends HTMLElement{#e=[];connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&this.setAttribute("data-upgraded","")}disconnectedCallback(){for(let e of this.#e)e();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,i,r,n){e.addEventListener(i,r,n),this.#e.push(()=>e.removeEventListener(i,r,n))}setup(){}teardown(){}};var f=window.matchMedia("(prefers-reduced-motion: reduce)");var c=new Map;function d(s,e,i={}){let r=i.priority??10,n={impl:e,bundle:i.bundle,contract:i.contract,priority:r},t=c.get(s);if(customElements.get(s)){if(!t||t.priority>=r){t&&t.priority===r&&t.impl!==e&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${t.bundle}" (priority ${t.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${t.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(t&&t.priority>=r){t.priority===r&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${t.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}c.set(s,n),customElements.define(s,e)}var l='<svg viewBox="0 0 68 48" width="68" height="48" aria-hidden="true" focusable="false"><path d="M66.52 7.74c-.78-2.93-2.49-5.41-5.42-6.19C55.79.13 34 0 34 0S12.21.13 6.9 1.55c-2.93.78-4.64 3.26-5.42 6.19C.06 13.05 0 24 0 24s.06 10.95 1.48 16.26c.78 2.93 2.49 5.41 5.42 6.19C12.21 47.87 34 48 34 48s21.79-.13 27.1-1.55c2.93-.78 4.64-3.26 5.42-6.19C67.94 34.95 68 24 68 24s-.06-10.95-1.48-16.26z" fill="var(--color-error, #f00)"/><path d="M45 24 27 14v20z" fill="#fff"/></svg>',u={hq:"hqdefault",mq:"mqdefault",sd:"sddefault",maxres:"maxresdefault"},a=class extends o{#e;#t;setup(){if(this.#e=this.getAttribute("video-id"),this.#t=this.getAttribute("title")??"Play video",!this.#e)return console.warn("youtube-player: missing required video-id attribute"),!1;this.hasAttribute("autoplay")?this.#i():this.#a()}#n(){let e=new URLSearchParams({autoplay:"1"}),i=this.getAttribute("start");i&&e.set("start",i);let r=this.getAttribute("list");return r&&e.set("list",r),this.getAttribute("params")&&new URLSearchParams(this.getAttribute("params")).forEach((n,t)=>e.set(t,n)),`https://www.youtube-nocookie.com/embed/${this.#e}?${e}`}#o(){let e=this.getAttribute("thumbnail")??"hq";return`https://i.ytimg.com/vi/${this.#e}/${u[e]??"hqdefault"}.jpg`}#a(){this.setAttribute("state","ready"),this.setAttribute("tabindex","0"),this.setAttribute("role","button"),this.setAttribute("aria-label",`Play ${this.#t}`),this.innerHTML=`<img src="${this.#o()}" alt="" loading="lazy" decoding="async"><button type="button" aria-label="Play ${this.#t}">${l}</button>`,this.addEventListener("click",this.#r,{once:!0}),this.addEventListener("keydown",this.#s)}#r=()=>{this.removeEventListener("keydown",this.#s),this.#i()};#s=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.removeEventListener("click",this.#r),this.#i())};#i(){this.setAttribute("state","active"),this.removeAttribute("tabindex"),this.removeAttribute("role"),this.removeAttribute("aria-label"),this.innerHTML=`<iframe src="${this.#n()}" title="${this.#t}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen loading="lazy"></iframe>`,this.querySelector("iframe")?.focus()}};d("youtube-player",a);export{a as YouTubePlayer};
1
+ var o=class extends HTMLElement{#e=[];#t;connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,i,e,n){t.addEventListener(i,e,n),this.#e.push(()=>t.removeEventListener(i,e,n))}setup(){}teardown(){}setState(t,i){this.#t||(this.#t=this.attachInternals());let e=this.#t.states;try{i?e.add(t):e.delete(t)}catch{let n=`--${t}`;i?e.add(n):e.delete(n)}}_adoptInternals(t){this.#t||(this.#t=t)}};var f=window.matchMedia("(prefers-reduced-motion: reduce)");var c=new Map;function l(s,t,i={}){let e=i.priority??10,n={impl:t,bundle:i.bundle,contract:i.contract,priority:e},r=c.get(s);if(customElements.get(s)){if(!r||r.priority>=e){r&&r.priority===e&&r.impl!==t&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}" (priority ${r.priority}). Skipping "${i.bundle}".`);return}console.warn(`[VB Bundle] Tag <${s}> defined by "${r.bundle}" cannot be replaced (customElements.define is permanent). "${i.bundle}" has higher priority but arrived late.`);return}if(r&&r.priority>=e){r.priority===e&&console.warn(`[VB Bundle] Tag <${s}> already registered by "${r.bundle}". Skipping "${i.bundle}" (first wins at equal priority).`);return}c.set(s,n),customElements.define(s,t)}var d='<svg viewBox="0 0 68 48" width="68" height="48" aria-hidden="true" focusable="false"><path d="M66.52 7.74c-.78-2.93-2.49-5.41-5.42-6.19C55.79.13 34 0 34 0S12.21.13 6.9 1.55c-2.93.78-4.64 3.26-5.42 6.19C.06 13.05 0 24 0 24s.06 10.95 1.48 16.26c.78 2.93 2.49 5.41 5.42 6.19C12.21 47.87 34 48 34 48s21.79-.13 27.1-1.55c2.93-.78 4.64-3.26 5.42-6.19C67.94 34.95 68 24 68 24s-.06-10.95-1.48-16.26z" fill="var(--color-error, #f00)"/><path d="M45 24 27 14v20z" fill="#fff"/></svg>',u={hq:"hqdefault",mq:"mqdefault",sd:"sddefault",maxres:"maxresdefault"},a=class extends o{#e;#t;setup(){return this.#e=this.getAttribute("video-id"),this.#t=this.getAttribute("title")??"Play video",this.#e?(this.hasAttribute("autoplay")?this.#i():this.#a(),!0):(console.warn("youtube-player: missing required video-id attribute"),!1)}#n(){let t=new URLSearchParams({autoplay:"1"}),i=this.getAttribute("start");i&&t.set("start",i);let e=this.getAttribute("list");return e&&t.set("list",e),this.getAttribute("params")&&new URLSearchParams(this.getAttribute("params")||"").forEach((n,r)=>t.set(r,n)),`https://www.youtube-nocookie.com/embed/${this.#e}?${t}`}#o(){let t=this.getAttribute("thumbnail")??"hq";return`https://i.ytimg.com/vi/${this.#e}/${u[t]??"hqdefault"}.jpg`}#a(){this.setAttribute("state","ready"),this.setAttribute("tabindex","0"),this.setAttribute("role","button"),this.setAttribute("aria-label",`Play ${this.#t}`),this.innerHTML=`<img src="${this.#o()}" alt="" loading="lazy" decoding="async"><button type="button" aria-label="Play ${this.#t}">${d}</button>`,this.addEventListener("click",this.#r,{once:!0}),this.addEventListener("keydown",this.#s)}#r=()=>{this.removeEventListener("keydown",this.#s),this.#i()};#s=t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.removeEventListener("click",this.#r),this.#i())};#i(){this.setAttribute("state","active"),this.removeAttribute("tabindex"),this.removeAttribute("role"),this.removeAttribute("aria-label"),this.innerHTML=`<iframe src="${this.#n()}" title="${this.#t}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen loading="lazy"></iframe>`,this.querySelector("iframe")?.focus()}};l("youtube-player",a);export{a as YouTubePlayer};
2
2
  //# sourceMappingURL=youtube-player.js.map