@pure-ds/core 0.7.29 → 0.7.32

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 (76) hide show
  1. package/.github/copilot-instructions.md +20 -11
  2. package/LOCALIZATION.md +197 -0
  3. package/dist/types/pds.config.d.ts +1 -1
  4. package/dist/types/pds.config.d.ts.map +1 -1
  5. package/dist/types/pds.d.ts +150 -0
  6. package/dist/types/public/assets/pds/components/pds-form.d.ts +2 -2
  7. package/dist/types/public/assets/pds/components/pds-form.d.ts.map +1 -1
  8. package/dist/types/public/assets/pds/components/pds-omnibox.d.ts +2 -2
  9. package/dist/types/public/assets/pds/components/pds-omnibox.d.ts.map +1 -1
  10. package/dist/types/public/assets/pds/components/pds-rating.d.ts +1 -119
  11. package/dist/types/public/assets/pds/components/pds-rating.d.ts.map +1 -1
  12. package/dist/types/public/assets/pds/components/pds-treeview.d.ts.map +1 -1
  13. package/dist/types/public/assets/pds/components/pds-upload.d.ts.map +1 -1
  14. package/dist/types/src/js/common/ask.d.ts.map +1 -1
  15. package/dist/types/src/js/common/font-loader.d.ts.map +1 -1
  16. package/dist/types/src/js/common/localization-resource-provider.d.ts +49 -0
  17. package/dist/types/src/js/common/localization-resource-provider.d.ts.map +1 -0
  18. package/dist/types/src/js/common/localization.d.ts +25 -0
  19. package/dist/types/src/js/common/localization.d.ts.map +1 -0
  20. package/dist/types/src/js/common/msg.d.ts +1 -2
  21. package/dist/types/src/js/common/msg.d.ts.map +1 -1
  22. package/dist/types/src/js/common/pds-log.d.ts +3 -0
  23. package/dist/types/src/js/common/pds-log.d.ts.map +1 -0
  24. package/dist/types/src/js/lit.d.ts +0 -6
  25. package/dist/types/src/js/lit.d.ts.map +1 -1
  26. package/dist/types/src/js/pds-core/pds-config.d.ts +51 -0
  27. package/dist/types/src/js/pds-core/pds-config.d.ts.map +1 -1
  28. package/dist/types/src/js/pds-core/pds-enhancers.d.ts.map +1 -1
  29. package/dist/types/src/js/pds-core/pds-live.d.ts.map +1 -1
  30. package/dist/types/src/js/pds-core/pds-registry.d.ts.map +1 -1
  31. package/dist/types/src/js/pds-core/pds-runtime.d.ts.map +1 -1
  32. package/dist/types/src/js/pds-core/pds-start-helpers.d.ts.map +1 -1
  33. package/dist/types/src/js/pds-localization.d.ts +3 -0
  34. package/dist/types/src/js/pds-localization.d.ts.map +1 -0
  35. package/dist/types/src/js/pds-singleton.d.ts +13 -0
  36. package/dist/types/src/js/pds-singleton.d.ts.map +1 -0
  37. package/dist/types/src/js/pds.d.ts +9 -1
  38. package/dist/types/src/js/pds.d.ts.map +1 -1
  39. package/package.json +8 -3
  40. package/packages/pds-cli/README.md +2 -0
  41. package/packages/pds-cli/lib/pds-mcp-core.js +2 -2
  42. package/public/assets/js/app.js +9 -11
  43. package/public/assets/js/lit.js +2 -2
  44. package/public/assets/js/pds-ask.js +4 -4
  45. package/public/assets/js/pds-enhancers.js +1 -1
  46. package/public/assets/js/pds-localization.js +1 -0
  47. package/public/assets/js/pds-manager.js +118 -118
  48. package/public/assets/js/pds.js +2 -2
  49. package/public/assets/pds/components/pds-calendar.js +4 -4
  50. package/public/assets/pds/components/pds-daterange.js +11 -8
  51. package/public/assets/pds/components/pds-form.js +22 -22
  52. package/public/assets/pds/components/pds-live-edit.js +503 -42
  53. package/public/assets/pds/components/pds-live-importer.js +66 -66
  54. package/public/assets/pds/components/pds-live-template-canvas.js +3 -3
  55. package/public/assets/pds/components/pds-omnibox.js +4 -4
  56. package/public/assets/pds/components/pds-rating.js +5 -3
  57. package/public/assets/pds/components/pds-tags.js +5 -5
  58. package/public/assets/pds/components/pds-theme.js +4 -4
  59. package/public/assets/pds/components/pds-toaster.js +6 -6
  60. package/public/assets/pds/components/pds-treeview.js +8 -4
  61. package/public/assets/pds/components/pds-upload.js +7 -6
  62. package/public/assets/pds/core/pds-ask.js +4 -4
  63. package/public/assets/pds/core/pds-enhancers.js +1 -1
  64. package/public/assets/pds/core/pds-localization.js +1 -0
  65. package/public/assets/pds/core/pds-manager.js +118 -118
  66. package/public/assets/pds/core.js +2 -2
  67. package/public/assets/pds/external/lit.js +2 -2
  68. package/readme.md +34 -6
  69. package/src/js/pds-core/pds-config.js +34 -11
  70. package/src/js/pds-core/pds-enhancers.js +5 -3
  71. package/src/js/pds-core/pds-live.js +7 -5
  72. package/src/js/pds-core/pds-registry.js +6 -4
  73. package/src/js/pds-core/pds-runtime.js +12 -8
  74. package/src/js/pds-core/pds-start-helpers.js +9 -4
  75. package/src/js/pds.d.ts +150 -0
  76. package/src/js/pds.js +420 -40
@@ -1,2 +1,2 @@
1
- var Ue=Object.defineProperty;var Ce=(e,t)=>{for(var n in t)Ue(e,n,{get:t[n],enumerable:!0})};var X=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(t={}){this._mode="static",this._staticPaths={...this._staticPaths,...t}}async getStylesheet(t){if(this._mode==="live")return null;try{return(await import(this._staticPaths[t]))[t]}catch(n){console.error(`[PDS Registry] Failed to load static ${t}:`,n),console.error(`[PDS Registry] Looking for: ${this._staticPaths[t]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let r=new CSSStyleSheet;return r.replaceSync("/* Failed to load "+t+" */"),r}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},M=new X;async function fe(e,t=[],n=null){try{let r=n?.primitivesStylesheet?n.primitivesStylesheet:await M.getStylesheet("primitives");e.adoptedStyleSheets=[r,...t]}catch(r){let a=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${a}> failed to adopt primitives:`,r),e.adoptedStyleSheets=t}}async function me(e,t=["primitives"],n=[],r=null){let a=Array.isArray(n)?n.filter(Boolean):[];if(a.length){let l=(Array.isArray(e.adoptedStyleSheets)?e.adoptedStyleSheets:[]).filter(y=>!a.includes(y));e.adoptedStyleSheets=[...l,...a]}try{let l=(await Promise.all(t.map(async y=>{if(r)switch(y){case"tokens":return r.tokensStylesheet;case"primitives":return r.primitivesStylesheet;case"components":return r.componentsStylesheet;case"utilities":return r.utilitiesStylesheet;default:break}return M.getStylesheet(y)}))).filter(y=>y!==null);e.adoptedStyleSheets=[...l,...a]}catch(o){let l=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${l}> failed to adopt layers:`,o),e.adoptedStyleSheets=a}}function he(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var ye={FontWeights:{light:300,normal:400,medium:500,semibold:600,bold:700},LineHeights:{tight:1.25,normal:1.5,relaxed:1.75},BorderWidths:{hairline:.5,thin:1,medium:2,thick:3},RadiusSizes:{none:0,small:4,medium:8,large:16,xlarge:24,xxlarge:32},ShadowDepths:{none:"none",light:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",medium:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",deep:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",extreme:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},TransitionSpeeds:{fast:150,normal:250,slow:350},AnimationEasings:{linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},TouchTargetSizes:{compact:36,standard:44,comfortable:48,spacious:56},LinkStyles:{inline:"inline",block:"block",button:"button"},FocusStyles:{ring:"ring",outline:"outline",border:"border",glow:"glow"},TabSizes:{compact:2,standard:4,wide:8},SelectIcons:{chevron:"chevron",arrow:"arrow",caret:"caret",none:"none"},IconSizes:{xs:16,sm:20,md:24,lg:32,xl:48,"2xl":64,"3xl":96}};var ee={};Ce(ee,{deepMerge:()=>we,fragmentFromTemplateLike:()=>je,isObject:()=>I,parseHTML:()=>Z});function I(e){return e&&typeof e=="object"&&!Array.isArray(e)}function we(e,t){let n={...e};return I(e)&&I(t)&&Object.keys(t).forEach(r=>{I(t[r])?r in e?n[r]=we(e[r],t[r]):Object.assign(n,{[r]:t[r]}):Object.assign(n,{[r]:t[r]})}),n}function je(e){let t=Array.isArray(e?.strings)?e.strings:[],n=Array.isArray(e?.values)?e.values:[],r=new Set,a=[],o=/(\s)(\.[\w-]+)=\s*$/;for(let i=0;i<t.length;i+=1){let S=t[i]??"",f=S.match(o);if(f&&i<n.length){let g=f[2].slice(1),L=`pds-val-${i}`;S=S.replace(o,`$1data-pds-prop="${g}:${L}"`),r.add(i)}a.push(S),i<n.length&&!r.has(i)&&a.push(`<!--pds-val-${i}-->`)}let l=document.createElement("template");l.innerHTML=a.join("");let y=(i,S)=>{let f=i.parentNode;if(!f)return;if(S==null){f.removeChild(i);return}let b=g=>{if(g!=null){if(g instanceof Node){f.insertBefore(g,i);return}if(Array.isArray(g)){g.forEach(L=>b(L));return}f.insertBefore(document.createTextNode(String(g)),i)}};b(S),f.removeChild(i)},E=document.createTreeWalker(l.content,NodeFilter.SHOW_COMMENT),h=[];for(;E.nextNode();){let i=E.currentNode;i?.nodeValue?.startsWith("pds-val-")&&h.push(i)}return h.forEach(i=>{let S=Number(i.nodeValue.replace("pds-val-",""));y(i,n[S])}),l.content.querySelectorAll("*").forEach(i=>{let S=i.getAttribute("data-pds-prop");if(!S)return;let[f,b]=S.split(":"),g=Number(String(b).replace("pds-val-",""));f&&Number.isInteger(g)&&(i[f]=n[g]),i.removeAttribute("data-pds-prop")}),l.content}function Z(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes}var ge="pds",$e=/^([a-z][a-z0-9+\-.]*:)?\/\//i,Se=/^[a-z]:/i;function U(e=""){return e.endsWith("/")?e:`${e}/`}function Oe(e="",t=ge){let n=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(n)?n:`${n}/${t}`}function Ie(e){return e.replace(/^\.\/+/,"")}function Ne(e){return Se.test(e)?e.replace(Se,"").replace(/^\/+/,""):e}function ze(e){return e.startsWith("public/")?e.substring(7):e}function N(e,t={}){let n=t.segment||ge,r=t.defaultRoot||`/assets/${n}/`,a=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!a||typeof a!="string")return U(r);let o=a.trim();return o?(o=o.replace(/\\/g,"/"),o=Oe(o,n),o=U(o),$e.test(o)?o:(o=Ie(o),o=Ne(o),o.startsWith("/")||(o=ze(o),o.startsWith("/")||(o=`/${o}`),o=o.replace(/\/+/g,(l,y)=>y===0?l:"/")),U(o))):U(r)}async function Fe(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let n=e,{baseURL:r,mapper:a=h=>`${h}.js`,onError:o=(h,c)=>console.error(`[defineWebComponents] ${h}:`,c)}=t,l=r?new URL(r,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),y=h=>h.toLowerCase().replace(/(^|-)([a-z])/g,(c,i,S)=>S.toUpperCase()),E=async h=>{try{if(customElements.get(h))return{tag:h,status:"already-defined"};let c=a(h),S=await import(c instanceof URL?c.href:new URL(c,l).href),f=S?.default??S?.[y(h)];if(!f){if(customElements.get(h))return{tag:h,status:"self-defined"};throw new Error(`No export found for ${h}. Expected default export or named export "${y(h)}".`)}return customElements.get(h)?{tag:h,status:"race-already-defined"}:(customElements.define(h,f),{tag:h,status:"defined"})}catch(c){throw o(h,c),c}};return Promise.all(n.map(E))}var z=class{constructor(t={}){let{baseURL:n,mapper:r,onError:a,predicate:o=()=>!0,attributeModule:l="data-module",root:y=document,scanExisting:E=!0,debounceMs:h=16,observeShadows:c=!0,enhancers:i=[],patchAttachShadow:S=!0}=t,f=new Set,b=new Set,g=new Set,L=new Map,x=new WeakMap,_=new WeakMap,m=0,w=!1,v=null,O=d=>{if(!d||!i.length)return;let p=_.get(d);p||(p=new Set,_.set(d,p));for(let u of i)if(!(!u.selector||!u.run)&&!p.has(u.selector))try{d.matches&&d.matches(u.selector)&&(u.run(d),p.add(u.selector))}catch(A){console.warn(`[AutoDefiner] Error applying enhancer for selector "${u.selector}":`,A)}},k=(d,p)=>{if(!w&&!(!d||!d.includes("-"))&&!customElements.get(d)&&!b.has(d)&&!g.has(d)){if(p&&p.getAttribute){let u=p.getAttribute(l);u&&!L.has(d)&&L.set(d,u)}f.add(d),ke()}},ke=()=>{m||(m=setTimeout(de,h))},D=d=>{if(d){if(d.nodeType===1){let p=d,u=p.tagName?.toLowerCase();u&&u.includes("-")&&!customElements.get(u)&&o(u,p)&&k(u,p),O(p),c&&p.shadowRoot&&J(p.shadowRoot)}d.querySelectorAll&&d.querySelectorAll("*").forEach(p=>{let u=p.tagName?.toLowerCase();u&&u.includes("-")&&!customElements.get(u)&&o(u,p)&&k(u,p),O(p),c&&p.shadowRoot&&J(p.shadowRoot)})}},J=d=>{if(!d||x.has(d))return;D(d);let p=new MutationObserver(u=>{for(let A of u)A.addedNodes?.forEach(P=>{D(P)}),A.type==="attributes"&&A.target&&D(A.target)});p.observe(d,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...i.map(u=>u.selector).filter(u=>u.startsWith("data-"))]}),x.set(d,p)};async function de(){if(clearTimeout(m),m=0,!f.size)return;let d=Array.from(f);f.clear(),d.forEach(p=>b.add(p));try{let p=u=>L.get(u)??(r?r(u):`${u}.js`);await Fe(...d,{baseURL:n,mapper:p,onError:(u,A)=>{g.add(u),a?.(u,A)}})}catch{}finally{d.forEach(p=>b.delete(p))}}let ue=y===document?document.documentElement:y,pe=new MutationObserver(d=>{for(let p of d)p.addedNodes?.forEach(u=>{D(u)}),p.type==="attributes"&&p.target&&D(p.target)});if(pe.observe(ue,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...i.map(d=>d.selector).filter(d=>d.startsWith("data-"))]}),c&&S&&Element.prototype.attachShadow){let d=Element.prototype.attachShadow;Element.prototype.attachShadow=function(u){let A=d.call(this,u);if(u&&u.mode==="open"){J(A);let P=this.tagName?.toLowerCase();P&&P.includes("-")&&!customElements.get(P)&&k(P,this)}return A},v=()=>Element.prototype.attachShadow=d}return E&&D(ue),{stop(){w=!0,pe.disconnect(),v&&v(),m&&(clearTimeout(m),m=0),x.forEach(d=>d.disconnect())},flush:de}}static async define(...t){let n={};t.length&&typeof t[t.length-1]=="object"&&(n=t.pop()||{});let r=t,{baseURL:a,mapper:o=c=>`${c}.js`,onError:l=(c,i)=>console.error(`[defineWebComponents] ${c}:`,i)}=n,y=a?new URL(a,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),E=c=>c.toLowerCase().replace(/(^|-)([a-z])/g,(i,S,f)=>f.toUpperCase()),h=async c=>{try{if(customElements.get(c))return{tag:c,status:"already-defined"};let i=o(c),f=await import(i instanceof URL?i.href:new URL(i,y).href),b=f?.default??f?.[E(c)];if(!b){if(customElements.get(c))return{tag:c,status:"self-defined"};throw new Error(`No export found for ${c}. Expected default export or named export "${E(c)}".`)}return customElements.get(c)?{tag:c,status:"race-already-defined"}:(customElements.define(c,b),{tag:c,status:"defined"})}catch(i){throw l(c,i),i}};return Promise.all(r.map(h))}};var We=/^[a-z][a-z0-9+\-.]*:\/\//i,C=(()=>{try{return import.meta.url}catch{return}})(),F=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function W(e,t={}){if(!e||We.test(e))return e;let{preferModule:n=!0}=t,r=()=>{if(!C)return null;try{return new URL(e,C).href}catch{return null}},a=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(e,window.location.origin).href}catch{return null}};return(n?r()||a():a()||r())||e}var Ee=(()=>{if(C)try{let e=new URL(C);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",C).href}catch{return}})(),be=!1;function _e(e){be||typeof document>"u"||(be=!0,e.addEventListener("pds:ready",t=>{let n=t.detail?.mode;n&&document.documentElement.classList.add(`pds-${n}`,"pds-ready")}))}function Le({manageTheme:e,themeStorageKey:t,applyResolvedTheme:n,setupSystemListenerIfNeeded:r}){let a="light",o=null;if(e&&typeof window<"u"){try{o=localStorage.getItem(t)||null}catch{o=null}try{n?.(o),r?.(o)}catch{}o?o==="system"?a=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a=o:a=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:a,storedTheme:o}}function B(e,{resolvePublicAssetURL:t}){let n=!!(e?.public?.root||e?.static?.root),r=t(e);return!n&&Ee&&(r=Ee),F(W(r))}async function Ae(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:n="/auto-define/",autoDefinePreload:r=[],autoDefineMapper:a=null,enhancers:o=[],autoDefineOverrides:l=null,autoDefinePreferModule:y=!0}=e,E=(()=>{let c=new Map;return(t||[]).forEach(i=>c.set(i.selector,i)),(o||[]).forEach(i=>c.set(i.selector,i)),Array.from(c.values())})(),h=null;if(typeof window<"u"&&typeof document<"u"){let c=z,i=m=>{switch(m){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${m}.js`}},{mapper:S,enhancers:f,...b}=l&&typeof l=="object"?l:{},g=f?Array.isArray(f)?f:typeof f=="object"?Object.values(f):[]:[],L=(()=>{let m=new Map;return(E||[]).forEach(w=>{w?.selector&&m.set(w.selector,w)}),(g||[]).forEach(w=>{if(!w?.selector)return;let v=m.get(w.selector)||null;m.set(w.selector,{...v||{},...w,run:typeof w?.run=="function"?w.run:v?.run})}),Array.from(m.values())})(),_={baseURL:n&&F(W(n,{preferModule:y})),predefine:r,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:L,onError:(m,w)=>{if(typeof m=="string"&&m.startsWith("pds-")){let O=["pds-form","pds-drawer"].includes(m),k=w?.message?.includes("#pds/lit")||w?.message?.includes("Failed to resolve module specifier");O&&k?console.error(`\u274C PDS component <${m}> requires Lit but #pds/lit is not in import map.
2
- See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):console.warn(`\u26A0\uFE0F PDS component <${m}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${m}>:`,w)},...b,mapper:m=>{if(customElements.get(m))return null;if(typeof a=="function")try{let w=a(m);return w===void 0?i(m):w}catch(w){return console.warn("Custom autoDefine.mapper error; falling back to default:",w?.message||w),i(m)}return i(m)}};h=new c(_),r.length>0&&typeof c.define=="function"&&await c.define(...r,{baseURL:n,mapper:_.mapper,onError:_.onError})}return{autoDefiner:h,mergedEnhancers:E}}var te=["light","dark"],ne=new Set(te);function Be(e){let n=(Array.isArray(e?.themes)?e.themes.map(r=>String(r).toLowerCase()):te).filter(r=>ne.has(r));return n.length?n:te}function re(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(ne.has(n))return n;if(t&&typeof document<"u"){let r=document.documentElement?.getAttribute("data-theme");if(ne.has(r))return r}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function xe(e,t){let n=re(t);return Be(e).includes(n)}var ie=class extends EventTarget{},Re="__PURE_DS_PDS_SINGLETON__",ae=typeof globalThis<"u"?globalThis:window,se=ae?.[Re],s=se&&typeof se.addEventListener=="function"?se:new ie;ae&&(ae[Re]=s);typeof s.initializing!="boolean"&&(s.initializing=!1);"currentPreset"in s||(s.currentPreset=null);typeof s.debug!="boolean"&&(s.debug=!1);"currentConfig"in s||(s.currentConfig=null);"compiled"in s||(s.compiled=null);var q=null,V=null,H=null,G=null;function K(e,t){return t&&typeof t=="string"?t:`${B(s.currentConfig||{},{resolvePublicAssetURL:N})}core/${e}`}async function qe(){return Array.isArray(s.defaultEnhancers)&&s.defaultEnhancers.length>0?s.defaultEnhancers:(G||(G=import(K("pds-enhancers.js",s.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return s.defaultEnhancers=n,n}).catch(t=>{throw G=null,t})),G)}async function Ve(){return typeof s.ask=="function"&&s.ask!==De?s.ask:(V||(V=import(K("pds-ask.js",s.currentConfig?.askURL)).then(t=>{let n=t?.ask;if(typeof n!="function")throw new Error("Failed to load ask helper");return s.ask=n,n}).catch(t=>{throw V=null,t})),V)}async function $(){return typeof s.toast=="function"&&s.toast!==T?s.toast:(H||(H=import(K("pds-toast.js",s.currentConfig?.toastURL)).then(t=>{let n=t?.toast;if(typeof n!="function")throw new Error("Failed to load toast helper");return s.toast=n,n}).catch(t=>{throw H=null,t})),H)}async function De(...e){return(await Ve())(...e)}async function T(...e){return(await $())(...e)}T.success=async(...e)=>(await $()).success(...e);T.error=async(...e)=>(await $()).error(...e);T.warning=async(...e)=>(await $()).warning(...e);T.info=async(...e)=>(await $()).info(...e);var ve=function(e="log",t,...n){let r=!!(s.registry&&!s.registry.isLive),a=(this?.debug||this?.design?.debug||s.debug||!1)===!0;if(r){if(!s.debug)return}else if(!a&&e!=="error"&&e!=="warn")return;let o=console[e]||console.log;n.length>0?o(t,...n):o(t)};function ce(e){if(e==null)return e;if(typeof e=="function")return;if(typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>ce(n)).filter(n=>n!==void 0);let t={};for(let[n,r]of Object.entries(e)){let a=ce(r);a!==void 0&&(t[n]=a)}return t}function Pe(e,t=new WeakSet){if(!e||typeof e!="object"||t.has(e))return e;t.add(e),Object.freeze(e);for(let n of Object.keys(e))Pe(e[n],t);return e}function le(e){return e==null||typeof e!="object"?e:Pe(structuredClone(ce(e)))}async function He(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let n=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let r=await fetch(n,{cache:"no-store"});return r.ok?await r.json():null}catch{return null}}s.registry=M;s.enums=ye;s.adoptLayers=me;s.adoptPrimitives=fe;s.parse=Z;s.createStylesheet=he;s.isLiveMode=()=>M.isLive;s.ask=De;s.toast=T;s.common=ee;s.AutoComplete=null;s.loadAutoComplete=async()=>{if(s.AutoComplete&&typeof s.AutoComplete.connect=="function")return s.AutoComplete;let e=K("pds-autocomplete.js",s.currentConfig?.autoCompleteURL);return q||(q=import(e).then(t=>{let n=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!n)throw new Error("AutoComplete export not found in module");return s.AutoComplete=n,n}).catch(t=>{throw q=null,t})),q};function Me(e){let t=typeof CustomEvent=="function";try{let n=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");s.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:e,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",n))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",n))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}function Te(e={}){let t=typeof CustomEvent=="function",n={at:Date.now(),...e};try{let r=t?new CustomEvent("pds:config-changed",{detail:n}):new Event("pds:config-changed");s.dispatchEvent(r)}catch{}if(typeof document<"u")if(t){let r={detail:n,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",r))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var oe="pure-ds-theme",R=null,j=null;function Q(e){try{if(typeof document>"u")return;let t="light";e?e==="system"?t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t=e:t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t)}catch{}}function Y(e){try{if(R&&j){try{typeof R.removeEventListener=="function"?R.removeEventListener("change",j):typeof R.removeListener=="function"&&R.removeListener(j)}catch{}R=null,j=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=r=>{let a=r?.matches===void 0?t.matches:r.matches;try{let o=a?"dark":"light";document.documentElement.setAttribute("data-theme",o),s.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:o,source:"system"}}))}catch{}};R=t,j=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}var Ge=Object.getOwnPropertyDescriptor(s,"theme");Ge||Object.defineProperty(s,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(oe)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=s.currentConfig?.design||null,n=re(e);if(t&&!xe(t,n)){let r=t?.name||s.currentPreset?.name||s.currentConfig?.preset||"current preset";console.warn(`PDS theme "${n}" not supported by preset "${r}".`),s.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:n,preset:r}}));return}e==null?localStorage.removeItem(oe):localStorage.setItem(oe,e),Q(e),Y(e),s.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});s.defaultEnhancers=[];async function Ke(e){s.initializing=!0;try{let t=e&&e.mode||"live",{mode:n,...r}=e||{};s.currentConfig=le(r);let a;if(t==="static")a=await Qe(r);else{let l=B(r,{resolvePublicAssetURL:N}),y=r?.managerURL||r?.public?.managerURL||r?.manager?.url||new URL("core/pds-manager.js",l).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:E}=await import(y);a=await E(s,r,{emitReady:Me,emitConfigChanged:Te,applyResolvedTheme:Q,setupSystemListenerIfNeeded:Y})}s.compiled=le(a?.config||null);let o=s?.compiled?.design?.icons?.externalPath||"/assets/img/icons/";return typeof console<"u"&&typeof console.info=="function"&&console.info(`[PDS] startup ready; external icon path: ${o}`),a}finally{s.initializing=!1}}s.start=Ke;async function Qe(e){if(!e||typeof e!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let t=e.applyGlobalStyles??!0,n=e.manageTheme??!0,r=e.themeStorageKey??"pure-ds-theme",a=e.staticPaths??{},o=B(e,{resolvePublicAssetURL:N}),l=e&&e.autoDefine||null,y;l&&l.baseURL?y=F(W(l.baseURL,{preferModule:!1})):y=`${o}components/`;let E=l&&Array.isArray(l.predefine)&&l.predefine||[],h=l&&typeof l.mapper=="function"&&l.mapper||null;try{_e(s);let{resolvedTheme:c}=Le({manageTheme:n,themeStorageKey:r,applyResolvedTheme:Q,setupSystemListenerIfNeeded:Y}),i=await He(o,e),S=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],f=i?.config?{...i.config,...e,design:e?.design||i.config.design,preset:e?.preset||i.config.preset}:{...e},b={tokens:`${o}styles/pds-tokens.css.js`,primitives:`${o}styles/pds-primitives.css.js`,components:`${o}styles/pds-components.css.js`,utilities:`${o}styles/pds-utilities.css.js`,styles:`${o}styles/pds-styles.css.js`},g=i?.paths||{};if(a={...b,...g,...a},s.registry.setStaticMode(a),t&&typeof document<"u")try{let _=await s.registry.getStylesheet("styles");if(_){_._pds=!0;let m=(document.adoptedStyleSheets||[]).filter(w=>w._pds!==!0);document.adoptedStyleSheets=[...m,_],Te({mode:"static",source:"static:styles-applied"})}}catch(_){ve.call(s,"warn","Failed to apply static styles:",_)}let L=null,x=[];try{let _=await qe(),m=await Ae({autoDefineBaseURL:y,autoDefinePreload:E,autoDefineMapper:h,enhancers:S,autoDefineOverrides:l||null,autoDefinePreferModule:!(l&&l.baseURL)},{baseEnhancers:_});L=m.autoDefiner,x=m.mergedEnhancers||[]}catch(_){ve.call(s,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",_)}return s.compiled=le({mode:"static",...f,theme:c,enhancers:x}),Me({mode:"static",config:f,theme:c,autoDefiner:L}),{config:f,theme:c,autoDefiner:L}}catch(c){throw s.dispatchEvent(new CustomEvent("pds:error",{detail:{error:c}})),c}}var pt=Q,ft=Y;export{s as PDS,pt as applyResolvedTheme,ft as setupSystemListenerIfNeeded};
1
+ var nt=Object.defineProperty;var ot=(e,t)=>{for(var n in t)nt(e,n,{get:t[n],enumerable:!0})};var ie=class extends EventTarget{constructor(){super(),this.mode=null,this.compiled=null,this.log=()=>{},this.logHandler=null}},Le="__PURE_DS_PDS_SINGLETON__",ae=typeof globalThis<"u"?globalThis:window,se=ae?.[Le],r=se&&typeof se.addEventListener=="function"?se:new ie;ae&&(ae[Le]=r);typeof r.log!="function"&&(r.log=(e="log",t,...n)=>{if(typeof console>"u")return;let o=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;o&&(n.length>0?o(t,...n):o(t))});typeof r.logHandler!="function"&&(r.logHandler=null);var ce=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(t={}){this._mode="static",this._staticPaths={...this._staticPaths,...t}}async getStylesheet(t){if(this._mode==="live")return null;try{return(await import(this._staticPaths[t]))[t]}catch(n){r.log("error",`Registry: failed to load static ${t}:`,n),r.log("error",`Registry: looking for ${this._staticPaths[t]}`),r.log("error","Registry: make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let o=new CSSStyleSheet;return o.replaceSync("/* Failed to load "+t+" */"),o}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},C=new ce;async function Ee(e,t=[],n=null){try{let o=n?.primitivesStylesheet?n.primitivesStylesheet:await C.getStylesheet("primitives");e.adoptedStyleSheets=[o,...t]}catch(o){let c=e.host?.tagName?.toLowerCase()||"unknown";r.log("error",`Adopter: <${c}> failed to adopt primitives:`,o),e.adoptedStyleSheets=t}}async function Ae(e,t=["primitives"],n=[],o=null){let c=Array.isArray(n)?n.filter(Boolean):[];if(c.length){let l=(Array.isArray(e.adoptedStyleSheets)?e.adoptedStyleSheets:[]).filter(y=>!c.includes(y));e.adoptedStyleSheets=[...l,...c]}try{let l=(await Promise.all(t.map(async y=>{if(o)switch(y){case"tokens":return o.tokensStylesheet;case"primitives":return o.primitivesStylesheet;case"components":return o.componentsStylesheet;case"utilities":return o.utilitiesStylesheet;default:break}return C.getStylesheet(y)}))).filter(y=>y!==null);e.adoptedStyleSheets=[...l,...c]}catch(s){let l=e.host?.tagName?.toLowerCase()||"unknown";r.log("error",`Adopter: <${l}> failed to adopt layers:`,s),e.adoptedStyleSheets=c}}function ve(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var Pe={FontWeights:{light:300,normal:400,medium:500,semibold:600,bold:700},LineHeights:{tight:1.25,normal:1.5,relaxed:1.75},BorderWidths:{hairline:.5,thin:1,medium:2,thick:3},RadiusSizes:{none:0,small:4,medium:8,large:16,xlarge:24,xxlarge:32},ShadowDepths:{none:"none",light:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",medium:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",deep:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",extreme:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},TransitionSpeeds:{fast:150,normal:250,slow:350},AnimationEasings:{linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},TouchTargetSizes:{compact:36,standard:44,comfortable:48,spacious:56},LinkStyles:{inline:"inline",block:"block",button:"button"},FocusStyles:{ring:"ring",outline:"outline",border:"border",glow:"glow"},TabSizes:{compact:2,standard:4,wide:8},SelectIcons:{chevron:"chevron",arrow:"arrow",caret:"caret",none:"none"},IconSizes:{xs:16,sm:20,md:24,lg:32,xl:48,"2xl":64,"3xl":96}};var ue={};ot(ue,{deepMerge:()=>Re,fragmentFromTemplateLike:()=>rt,isObject:()=>W,parseHTML:()=>le});function W(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Re(e,t){let n={...e};return W(e)&&W(t)&&Object.keys(t).forEach(o=>{W(t[o])?o in e?n[o]=Re(e[o],t[o]):Object.assign(n,{[o]:t[o]}):Object.assign(n,{[o]:t[o]})}),n}function rt(e){let t=Array.isArray(e?.strings)?e.strings:[],n=Array.isArray(e?.values)?e.values:[],o=new Set,c=[],s=/(\s)(\.[\w-]+)=\s*$/;for(let i=0;i<t.length;i+=1){let S=t[i]??"",m=S.match(s);if(m&&i<n.length){let b=m[2].slice(1),A=`pds-val-${i}`;S=S.replace(s,`$1data-pds-prop="${b}:${A}"`),o.add(i)}c.push(S),i<n.length&&!o.has(i)&&c.push(`<!--pds-val-${i}-->`)}let l=document.createElement("template");l.innerHTML=c.join("");let y=(i,S)=>{let m=i.parentNode;if(!m)return;if(S==null){m.removeChild(i);return}let L=b=>{if(b!=null){if(b instanceof Node){m.insertBefore(b,i);return}if(Array.isArray(b)){b.forEach(A=>L(A));return}m.insertBefore(document.createTextNode(String(b)),i)}};L(S),m.removeChild(i)},g=document.createTreeWalker(l.content,NodeFilter.SHOW_COMMENT),u=[];for(;g.nextNode();){let i=g.currentNode;i?.nodeValue?.startsWith("pds-val-")&&u.push(i)}return u.forEach(i=>{let S=Number(i.nodeValue.replace("pds-val-",""));y(i,n[S])}),l.content.querySelectorAll("*").forEach(i=>{let S=i.getAttribute("data-pds-prop");if(!S)return;let[m,L]=S.split(":"),b=Number(String(L).replace("pds-val-",""));m&&Number.isInteger(b)&&(i[m]=n[b]),i.removeAttribute("data-pds-prop")}),l.content}function le(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes}var De="pds",st=/^([a-z][a-z0-9+\-.]*:)?\/\//i,xe=/^[a-z]:/i;function U(e=""){return e.endsWith("/")?e:`${e}/`}function it(e="",t=De){let n=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(n)?n:`${n}/${t}`}function at(e){return e.replace(/^\.\/+/,"")}function ct(e){return xe.test(e)?e.replace(xe,"").replace(/^\/+/,""):e}function lt(e){return e.startsWith("public/")?e.substring(7):e}function H(e,t={}){let n=t.segment||De,o=t.defaultRoot||`/assets/${n}/`,c=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!c||typeof c!="string")return U(o);let s=c.trim();return s?(s=s.replace(/\\/g,"/"),s=it(s,n),s=U(s),st.test(s)?s:(s=at(s),s=ct(s),s.startsWith("/")||(s=lt(s),s.startsWith("/")||(s=`/${s}`),s=s.replace(/\/+/g,(l,y)=>y===0?l:"/")),U(s))):U(o)}async function ut(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let n=e,{baseURL:o,mapper:c=u=>`${u}.js`,onError:s=(u,a)=>console.error(`[defineWebComponents] ${u}:`,a)}=t,l=o?new URL(o,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),y=u=>u.toLowerCase().replace(/(^|-)([a-z])/g,(a,i,S)=>S.toUpperCase()),g=async u=>{try{if(customElements.get(u))return{tag:u,status:"already-defined"};let a=c(u),S=await import(a instanceof URL?a.href:new URL(a,l).href),m=S?.default??S?.[y(u)];if(!m){if(customElements.get(u))return{tag:u,status:"self-defined"};throw new Error(`No export found for ${u}. Expected default export or named export "${y(u)}".`)}return customElements.get(u)?{tag:u,status:"race-already-defined"}:(customElements.define(u,m),{tag:u,status:"defined"})}catch(a){throw s(u,a),a}};return Promise.all(n.map(g))}var B=class{constructor(t={}){let{baseURL:n,mapper:o,onError:c,predicate:s=()=>!0,attributeModule:l="data-module",root:y=document,scanExisting:g=!0,debounceMs:u=16,observeShadows:a=!0,enhancers:i=[],patchAttachShadow:S=!0}=t,m=new Set,L=new Set,b=new Set,A=new Map,P=new WeakMap,E=new WeakMap,h=0,w=!1,R=null,F=d=>{if(!d||!i.length)return;let p=E.get(d);p||(p=new Set,E.set(d,p));for(let f of i)if(!(!f.selector||!f.run)&&!p.has(f.selector))try{d.matches&&d.matches(f.selector)&&(f.run(d),p.add(f.selector))}catch(v){console.warn(`[AutoDefiner] Error applying enhancer for selector "${f.selector}":`,v)}},M=(d,p)=>{if(!w&&!(!d||!d.includes("-"))&&!customElements.get(d)&&!L.has(d)&&!b.has(d)){if(p&&p.getAttribute){let f=p.getAttribute(l);f&&!A.has(d)&&A.set(d,f)}m.add(d),tt()}},tt=()=>{h||(h=setTimeout(Se,u))},D=d=>{if(d){if(d.nodeType===1){let p=d,f=p.tagName?.toLowerCase();f&&f.includes("-")&&!customElements.get(f)&&s(f,p)&&M(f,p),F(p),a&&p.shadowRoot&&re(p.shadowRoot)}d.querySelectorAll&&d.querySelectorAll("*").forEach(p=>{let f=p.tagName?.toLowerCase();f&&f.includes("-")&&!customElements.get(f)&&s(f,p)&&M(f,p),F(p),a&&p.shadowRoot&&re(p.shadowRoot)})}},re=d=>{if(!d||P.has(d))return;D(d);let p=new MutationObserver(f=>{for(let v of f)v.addedNodes?.forEach(z=>{D(z)}),v.type==="attributes"&&v.target&&D(v.target)});p.observe(d,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...i.map(f=>f.selector).filter(f=>f.startsWith("data-"))]}),P.set(d,p)};async function Se(){if(clearTimeout(h),h=0,!m.size)return;let d=Array.from(m);m.clear(),d.forEach(p=>L.add(p));try{let p=f=>A.get(f)??(o?o(f):`${f}.js`);await ut(...d,{baseURL:n,mapper:p,onError:(f,v)=>{b.add(f),c?.(f,v)}})}catch{}finally{d.forEach(p=>L.delete(p))}}let be=y===document?document.documentElement:y,_e=new MutationObserver(d=>{for(let p of d)p.addedNodes?.forEach(f=>{D(f)}),p.type==="attributes"&&p.target&&D(p.target)});if(_e.observe(be,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...i.map(d=>d.selector).filter(d=>d.startsWith("data-"))]}),a&&S&&Element.prototype.attachShadow){let d=Element.prototype.attachShadow;Element.prototype.attachShadow=function(f){let v=d.call(this,f);if(f&&f.mode==="open"){re(v);let z=this.tagName?.toLowerCase();z&&z.includes("-")&&!customElements.get(z)&&M(z,this)}return v},R=()=>Element.prototype.attachShadow=d}return g&&D(be),{stop(){w=!0,_e.disconnect(),R&&R(),h&&(clearTimeout(h),h=0),P.forEach(d=>d.disconnect())},flush:Se}}static async define(...t){let n={};t.length&&typeof t[t.length-1]=="object"&&(n=t.pop()||{});let o=t,{baseURL:c,mapper:s=a=>`${a}.js`,onError:l=(a,i)=>console.error(`[defineWebComponents] ${a}:`,i)}=n,y=c?new URL(c,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),g=a=>a.toLowerCase().replace(/(^|-)([a-z])/g,(i,S,m)=>m.toUpperCase()),u=async a=>{try{if(customElements.get(a))return{tag:a,status:"already-defined"};let i=s(a),m=await import(i instanceof URL?i.href:new URL(i,y).href),L=m?.default??m?.[g(a)];if(!L){if(customElements.get(a))return{tag:a,status:"self-defined"};throw new Error(`No export found for ${a}. Expected default export or named export "${g(a)}".`)}return customElements.get(a)?{tag:a,status:"race-already-defined"}:(customElements.define(a,L),{tag:a,status:"defined"})}catch(i){throw l(a,i),i}};return Promise.all(o.map(u))}};var dt=/^[a-z][a-z0-9+\-.]*:\/\//i,j=(()=>{try{return import.meta.url}catch{return}})(),K=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function G(e,t={}){if(!e||dt.test(e))return e;let{preferModule:n=!0}=t,o=()=>{if(!j)return null;try{return new URL(e,j).href}catch{return null}},c=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(e,window.location.origin).href}catch{return null}};return(n?o()||c():c()||o())||e}var ze=(()=>{if(j)try{let e=new URL(j);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",j).href}catch{return}})(),Ce=!1;function Te(e){Ce||typeof document>"u"||(Ce=!0,e.addEventListener("pds:ready",t=>{let n=t.detail?.mode;n&&document.documentElement.classList.add(`pds-${n}`,"pds-ready")}))}function ke({manageTheme:e,themeStorageKey:t,applyResolvedTheme:n,setupSystemListenerIfNeeded:o}){let c="light",s=null;if(e&&typeof window<"u"){try{s=localStorage.getItem(t)||null}catch{s=null}try{n?.(s),o?.(s)}catch{}s?s==="system"?c=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":c=s:c=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:c,storedTheme:s}}function q(e,{resolvePublicAssetURL:t}){let n=!!(e?.public?.root||e?.static?.root),o=t(e);return!n&&ze&&(o=ze),K(G(o))}async function Me(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:n="/auto-define/",autoDefinePreload:o=[],autoDefineMapper:c=null,enhancers:s=[],autoDefineOverrides:l=null,autoDefinePreferModule:y=!0}=e,g=(()=>{let a=new Map;return(t||[]).forEach(i=>a.set(i.selector,i)),(s||[]).forEach(i=>a.set(i.selector,i)),Array.from(a.values())})(),u=null;if(typeof window<"u"&&typeof document<"u"){let a=B,i=h=>{switch(h){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${h}.js`}},{mapper:S,enhancers:m,...L}=l&&typeof l=="object"?l:{},b=m?Array.isArray(m)?m:typeof m=="object"?Object.values(m):[]:[],A=(()=>{let h=new Map;return(g||[]).forEach(w=>{w?.selector&&h.set(w.selector,w)}),(b||[]).forEach(w=>{if(!w?.selector)return;let R=h.get(w.selector)||null;h.set(w.selector,{...R||{},...w,run:typeof w?.run=="function"?w.run:R?.run})}),Array.from(h.values())})(),E={baseURL:n&&K(G(n,{preferModule:y})),predefine:o,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:A,onError:(h,w)=>{if(typeof h=="string"&&h.startsWith("pds-")){let F=["pds-form","pds-drawer"].includes(h),M=w?.message?.includes("#pds/lit")||w?.message?.includes("Failed to resolve module specifier");F&&M?r.log("error",`\u274C PDS component <${h}> requires Lit but #pds/lit is not in import map.
2
+ See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):r.log("warn",`\u26A0\uFE0F PDS component <${h}> not found. Assets may not be installed.`)}else r.log("error",`\u274C Auto-define error for <${h}>:`,w)},...L,mapper:h=>{if(customElements.get(h))return null;if(typeof c=="function")try{let w=c(h);return w===void 0?i(h):w}catch(w){return r.log("warn","Custom autoDefine.mapper error; falling back to default:",w?.message||w),i(h)}return i(h)}};u=new a(E),o.length>0&&typeof a.define=="function"&&await a.define(...o,{baseURL:n,mapper:E.mapper,onError:E.onError})}return{autoDefiner:u,mergedEnhancers:g}}var de=["light","dark"],fe=new Set(de);function ft(e){let n=(Array.isArray(e?.themes)?e.themes.map(o=>String(o).toLowerCase()):de).filter(o=>fe.has(o));return n.length?n:de}function pe(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(fe.has(n))return n;if(t&&typeof document<"u"){let o=document.documentElement?.getAttribute("data-theme");if(fe.has(o))return o}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ue(e,t){let n=pe(t);return ft(e).includes(n)}var pt=new Set(["log","warn","error","debug","info"]),mt="__PURE_DS_PDS_SINGLETON__",me=null,he=null;function Oe(){try{let t=(typeof globalThis<"u"?globalThis:window)?.[mt];if(t&&typeof t=="object")return t}catch{return null}return null}function ht(e){return!e||typeof e!="object"?null:{mode:e.mode==="live"||e.mode==="static"?e.mode:null,debug:e.debug===!0,thisArg:e.thisArg}}function yt(e){if(typeof e!="string")return"log";let t=e.toLowerCase();return pt.has(t)?t:"log"}function gt(){if(typeof he=="function")try{let t=ht(he());if(t)return t}catch{}let e=Oe();if(e){let t=e?.mode||e?.compiled?.mode||(e?.registry?.isLive?"live":"static"),n=(e?.debug||e?.currentConfig?.debug||e?.currentConfig?.design?.debug||e?.compiled?.debug||e?.compiled?.design?.debug||!1)===!0;return{mode:t,debug:n,thisArg:e}}return{mode:null,debug:!1}}function wt(){if(typeof me=="function")try{let t=me();if(typeof t=="function")return t}catch{}let e=Oe();return typeof e?.logHandler=="function"?e.logHandler:null}function je(e,t,...n){if(typeof console>"u")return;let o=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;o&&(n.length>0?o(t,...n):o(t))}function St(e,t){let n=t?.debug===!0;return!(t?.mode==="static"&&!n||!n&&e!=="error"&&e!=="warn")}function Ne({getLogger:e,getContext:t}={}){me=typeof e=="function"?e:null,he=typeof t=="function"?t:null}function $e(e="log",t,...n){let o=yt(e),c=gt(),s=wt();if(s)try{s.call(c?.thisArg,o,t,...n);return}catch(l){je("error","Custom log handler failed:",l)}St(o,c)&&je(o,t,...n)}typeof r.initializing!="boolean"&&(r.initializing=!1);"currentPreset"in r||(r.currentPreset=null);typeof r.debug!="boolean"&&(r.debug=!1);"currentConfig"in r||(r.currentConfig=null);"compiled"in r||(r.compiled=null);typeof r.logHandler!="function"&&(r.logHandler=null);"mode"in r||(r.mode=null);var V=null,J=null,Y=null,Q=null,Z=null,X=null,Fe="__pdsLocalizationRuntime";function T(){if(X)return X;let e=r?.[Fe];return e&&typeof e=="object"?(X=e,e):null}function bt(e){let t=e&&typeof e=="object"?e:null;X=t,r[Fe]=t}Ne({getLogger:()=>typeof r.logHandler=="function"?r.logHandler:null,getContext:()=>{let e=r?.mode||r?.compiled?.mode||(r?.registry?.isLive?"live":"static"),t=(r?.debug||r?.currentConfig?.debug||r?.currentConfig?.design?.debug||r?.compiled?.debug||r?.compiled?.design?.debug||!1)===!0;return{mode:e,debug:t,thisArg:r}}});r.log=(e="log",t,...n)=>{$e(e,t,...n)};var _={locale:"en",messages:{},hasProvider:!1},ee=new Set;function We(e){return!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e}function He(e=[]){let t="";for(let n=0;n<=e.length-1;n+=1)t+=e[n],n<e.length-1&&(t+=`{${n}}`);return t}function _t(e,t){return String(e).replace(/\{(\d+)\}/g,(n,o)=>t(Number(o)))}function Lt(e){if(!e||typeof e!="object")return{};let t={};for(let[n,o]of Object.entries(e)){if(typeof o=="string"){t[n]=o;continue}o&&typeof o=="object"&&typeof o.content=="string"&&(t[n]=o.content)}return t}function Et(e,...t){return{strTag:!0,strings:Array.from(e||[]),values:t,raw:Array.from(e?.raw||[])}}function At(e){if(!e)return"";if(We(e)){let n=He(e.strings||[]),o=_.messages[n]||n;return _t(o,c=>e.values?.[c])}let t=String(e);return _.messages[t]||t}function vt(e){if(!e)return;let t=We(e)?He(e.strings||[]):String(e);typeof t=="string"&&t.length>0&&ee.add(t)}function Be(e){if(!e||typeof e.msg!="function"||ee.size===0)return;let t=Array.from(ee);ee.clear();for(let n of t)try{e.msg(n)}catch{}}async function N(){let e=T();return e||(Z||(Z=import($("pds-localization.js")).then(n=>{if(typeof n?.msg!="function"||typeof n?.str!="function"||typeof n?.configureLocalization!="function"||typeof n?.loadLocale!="function"||typeof n?.setLocale!="function"||typeof n?.getLocalizationState!="function")throw new Error("Failed to load localization runtime exports");return bt(n),Be(n),n}).catch(n=>{throw Z=null,n})),Z)}var Ke=(e,t={})=>{let n=T();return typeof n?.msg=="function"?n.msg(e,t):(vt(e),At(e,t))},Ge=(e,...t)=>{let n=T();return typeof n?.str=="function"?n.str(e,...t):Et(e,...t)},te=(e=null)=>{let t=T();if(typeof t?.configureLocalization=="function")return t.configureLocalization(e);if(!e||typeof e!="object")return _.locale="en",_.messages={},_.hasProvider=!1,{locale:_.locale,messages:{..._.messages},hasProvider:_.hasProvider};typeof e.locale=="string"&&e.locale.trim()&&(_.locale=e.locale.trim()),Object.prototype.hasOwnProperty.call(e,"messages")&&(_.messages=Lt(e.messages));let n=!!(e.provider||e.translate||e.loadLocale||e.setLocale);return _.hasProvider=n,n&&N().then(o=>{o.configureLocalization(e),Be(o)}).catch(()=>{}),{locale:_.locale,messages:{..._.messages},hasProvider:_.hasProvider}},qe=async e=>(await N()).loadLocale(e),Ve=async(e,t={})=>(await N()).setLocale(e,t),Je=()=>{let e=T();return typeof e?.getLocalizationState=="function"?e.getLocalizationState():{locale:_.locale,messages:{..._.messages},hasProvider:_.hasProvider}},Ye=(e={})=>{let t=T();if(typeof t?.createJSONLocalization=="function")return t.createJSONLocalization(e);let n=typeof e?.locale=="string"&&e.locale.trim()?e.locale.trim().toLowerCase():"en",o=Array.isArray(e?.locales)?e.locales.map(g=>String(g||"").trim().toLowerCase()).filter(Boolean):[],c=Array.from(new Set([n,...o])),s=null,l=async()=>(s||(s=N().then(g=>typeof g?.createJSONLocalization=="function"?g.createJSONLocalization(e):null).catch(()=>null)),s),y=async(g="loadLocale")=>{let u=await l();if(!u||typeof u!="object")return null;let a=u.provider;if(!a||typeof a!="object")return null;let i=a[g];return typeof i=="function"?i:g==="setLocale"&&typeof a.loadLocale=="function"?a.loadLocale:null};return{locale:n,locales:[...c],provider:{locales:[...c],async loadLocale(g={}){let u=await y("loadLocale");return typeof u!="function"?{}:u(g)},async setLocale(g={}){let u=await y("setLocale");return typeof u!="function"?{}:u(g)}}}};function $(e,t){return t&&typeof t=="string"?t:`${q(r.currentConfig||{},{resolvePublicAssetURL:H})}core/${e}`}async function Pt(){return Array.isArray(r.defaultEnhancers)&&r.defaultEnhancers.length>0?r.defaultEnhancers:(Q||(Q=import($("pds-enhancers.js",r.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return r.defaultEnhancers=n,n}).catch(t=>{throw Q=null,t})),Q)}async function Rt(){return typeof r.ask=="function"&&r.ask!==Qe?r.ask:(J||(J=import($("pds-ask.js",r.currentConfig?.askURL)).then(t=>{let n=t?.ask;if(typeof n!="function")throw new Error("Failed to load ask helper");return r.ask=n,n}).catch(t=>{throw J=null,t})),J)}async function I(){return typeof r.toast=="function"&&r.toast!==k?r.toast:(Y||(Y=import($("pds-toast.js",r.currentConfig?.toastURL)).then(t=>{let n=t?.toast;if(typeof n!="function")throw new Error("Failed to load toast helper");return r.toast=n,n}).catch(t=>{throw Y=null,t})),Y)}async function Qe(...e){return(await Rt())(...e)}async function k(...e){return(await I())(...e)}k.success=async(...e)=>(await I()).success(...e);k.error=async(...e)=>(await I()).error(...e);k.warning=async(...e)=>(await I()).warning(...e);k.info=async(...e)=>(await I()).info(...e);var Ie=function(e="log",t,...n){r.log(e,t,...n)};function ge(e){if(e==null)return e;if(typeof e=="function")return;if(typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>ge(n)).filter(n=>n!==void 0);let t={};for(let[n,o]of Object.entries(e)){let c=ge(o);c!==void 0&&(t[n]=c)}return t}function Ze(e,t=new WeakSet){if(!e||typeof e!="object"||t.has(e))return e;t.add(e),Object.freeze(e);for(let n of Object.keys(e))Ze(e[n],t);return e}function we(e){return e==null||typeof e!="object"?e:Ze(structuredClone(ge(e)))}async function xt(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let n=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let o=await fetch(n,{cache:"no-store"});return o.ok?await o.json():null}catch{return null}}r.registry=C;r.enums=Pe;r.adoptLayers=Ae;r.adoptPrimitives=Ee;r.parse=le;r.createStylesheet=ve;r.isLiveMode=()=>C.isLive;r.ask=Qe;r.toast=k;r.common=ue;r.msg=Ke;r.str=Ge;r.configureLocalization=te;r.loadLocale=qe;r.setLocale=Ve;r.getLocalizationState=Je;r.createJSONLocalization=Ye;r.i18n={msg:Ke,str:Ge,configure:te,loadLocale:qe,setLocale:Ve,getState:Je,createJSONLocalization:Ye};r.AutoComplete=null;r.loadAutoComplete=async()=>{if(r.AutoComplete&&typeof r.AutoComplete.connect=="function")return r.AutoComplete;let e=$("pds-autocomplete.js",r.currentConfig?.autoCompleteURL);return V||(V=import(e).then(t=>{let n=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!n)throw new Error("AutoComplete export not found in module");return r.AutoComplete=n,n}).catch(t=>{throw V=null,t})),V};function Xe(e){let t=typeof CustomEvent=="function";try{let n=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");r.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:e,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",n))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",n))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}function et(e={}){let t=typeof CustomEvent=="function",n={at:Date.now(),...e};try{let o=t?new CustomEvent("pds:config-changed",{detail:n}):new Event("pds:config-changed");r.dispatchEvent(o)}catch{}if(typeof document<"u")if(t){let o={detail:n,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",o))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var ye="pure-ds-theme",x=null,O=null;function ne(e){try{if(typeof document>"u")return;let t="light";e?e==="system"?t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t=e:t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t)}catch{}}function oe(e){try{if(x&&O){try{typeof x.removeEventListener=="function"?x.removeEventListener("change",O):typeof x.removeListener=="function"&&x.removeListener(O)}catch{}x=null,O=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=o=>{let c=o?.matches===void 0?t.matches:o.matches;try{let s=c?"dark":"light";document.documentElement.setAttribute("data-theme",s),r.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:s,source:"system"}}))}catch{}};x=t,O=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}var Dt=Object.getOwnPropertyDescriptor(r,"theme");Dt||Object.defineProperty(r,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(ye)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=r.currentConfig?.design||null,n=pe(e);if(t&&!Ue(t,n)){let o=t?.name||r.currentPreset?.name||r.currentConfig?.preset||"current preset";r.log("warn",`PDS theme "${n}" not supported by preset "${o}".`),r.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:n,preset:o}}));return}e==null?localStorage.removeItem(ye):localStorage.setItem(ye,e),ne(e),oe(e),r.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});r.defaultEnhancers=[];async function zt(e){r.initializing=!0;try{let t=e&&e.mode||"live",{mode:n,...o}=e||{};r.mode=t,r.logHandler=typeof o?.log=="function"?o.log:null,r.currentConfig=we(o);let c=o&&typeof o.localization=="object"&&o.localization?o.localization:null;c?(await N(),te(c)):te(null);let s;if(t==="static")s=await Ct(o);else{let y=q(o,{resolvePublicAssetURL:H}),g=o?.managerURL||o?.public?.managerURL||o?.manager?.url||new URL("core/pds-manager.js",y).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:u}=await import(g);s=await u(r,o,{emitReady:Xe,emitConfigChanged:et,applyResolvedTheme:ne,setupSystemListenerIfNeeded:oe})}r.compiled=we(s?.config||null);let l=r?.compiled?.design?.icons?.externalPath||"/assets/img/icons/";return r.log("info",`startup ready; external icon path: ${l}`),s}finally{r.initializing=!1}}r.start=zt;async function Ct(e){if(!e||typeof e!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let t=e.applyGlobalStyles??!0,n=e.manageTheme??!0,o=e.themeStorageKey??"pure-ds-theme",c=e.staticPaths??{},s=q(e,{resolvePublicAssetURL:H}),l=e&&e.autoDefine||null,y;l&&l.baseURL?y=K(G(l.baseURL,{preferModule:!1})):y=`${s}components/`;let g=l&&Array.isArray(l.predefine)&&l.predefine||[],u=l&&typeof l.mapper=="function"&&l.mapper||null;try{Te(r);let{resolvedTheme:a}=ke({manageTheme:n,themeStorageKey:o,applyResolvedTheme:ne,setupSystemListenerIfNeeded:oe}),i=await xt(s,e),S=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],m=i?.config?{...i.config,...e,design:e?.design||i.config.design,preset:e?.preset||i.config.preset}:{...e},L={tokens:`${s}styles/pds-tokens.css.js`,primitives:`${s}styles/pds-primitives.css.js`,components:`${s}styles/pds-components.css.js`,utilities:`${s}styles/pds-utilities.css.js`,styles:`${s}styles/pds-styles.css.js`},b=i?.paths||{};if(c={...L,...b,...c},r.registry.setStaticMode(c),t&&typeof document<"u")try{let E=await r.registry.getStylesheet("styles");if(E){E._pds=!0;let h=(document.adoptedStyleSheets||[]).filter(w=>w._pds!==!0);document.adoptedStyleSheets=[...h,E],et({mode:"static",source:"static:styles-applied"})}}catch(E){Ie.call(r,"warn","Failed to apply static styles:",E)}let A=null,P=[];try{let E=await Pt(),h=await Me({autoDefineBaseURL:y,autoDefinePreload:g,autoDefineMapper:u,enhancers:S,autoDefineOverrides:l||null,autoDefinePreferModule:!(l&&l.baseURL)},{baseEnhancers:E});A=h.autoDefiner,P=h.mergedEnhancers||[]}catch(E){Ie.call(r,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",E)}return r.compiled=we({mode:"static",...m,theme:a,enhancers:P}),Xe({mode:"static",config:m,theme:a,autoDefiner:A}),{config:m,theme:a,autoDefiner:A}}catch(a){throw r.dispatchEvent(new CustomEvent("pds:error",{detail:{error:a}})),a}}var tn=ne,nn=oe;export{r as PDS,tn as applyResolvedTheme,te as configureLocalization,Ye as createJSONLocalization,Je as getLocalizationState,qe as loadLocale,Ke as msg,Ve as setLocale,nn as setupSystemListenerIfNeeded,Ge as str};
@@ -1,6 +1,6 @@
1
- var I=globalThis,G=I.ShadowRoot&&(I.ShadyCSS===void 0||I.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,rt=Symbol(),Ct=new WeakMap,R=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==rt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(G&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=Ct.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Ct.set(e,t))}return t}toString(){return this.cssText}},Et=s=>new R(typeof s=="string"?s:s+"",void 0,rt),ot=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((i,r,o)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[o+1],s[0]);return new R(e,s,rt)},xt=(s,t)=>{if(G)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let i=document.createElement("style"),r=I.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=e.cssText,s.appendChild(i)}},nt=G?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let i of t.cssRules)e+=i.cssText;return Et(e)})(s):s;var{is:Ft,defineProperty:Qt,getOwnPropertyDescriptor:te,getOwnPropertyNames:ee,getOwnPropertySymbols:se,getPrototypeOf:ie}=Object,z=globalThis,wt=z.trustedTypes,re=wt?wt.emptyScript:"",oe=z.reactiveElementPolyfillSupport,O=(s,t)=>s,at={toAttribute(s,t){switch(t){case Boolean:s=s?re:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},Pt=(s,t)=>!Ft(s,t),bt={attribute:!0,type:String,converter:at,reflect:!1,useDefault:!1,hasChanged:Pt};Symbol.metadata??=Symbol("metadata"),z.litPropertyMetadata??=new WeakMap;var v=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=bt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let i=Symbol(),r=this.getPropertyDescriptor(t,i,e);r!==void 0&&Qt(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){let{get:r,set:o}=te(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:r,set(n){let c=r?.call(this);o?.call(this,n),this.requestUpdate(t,c,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??bt}static _$Ei(){if(this.hasOwnProperty(O("elementProperties")))return;let t=ie(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(O("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(O("properties"))){let e=this.properties,i=[...ee(e),...se(e)];for(let r of i)this.createProperty(r,e[r])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[i,r]of e)this.elementProperties.set(i,r)}this._$Eh=new Map;for(let[e,i]of this.elementProperties){let r=this._$Eu(e,i);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let r of i)e.unshift(nt(r))}else t!==void 0&&e.push(nt(t));return e}static _$Eu(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){let i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(r!==void 0&&i.reflect===!0){let o=(i.converter?.toAttribute!==void 0?i.converter:at).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){let i=this.constructor,r=i._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let o=i.getPropertyOptions(r),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:at;this._$Em=r;let c=n.fromAttribute(e,o.type);this[r]=c??this._$Ej?.get(r)??c,this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){let r=this.constructor,o=this[t];if(i??=r.getPropertyOptions(t),!((i.hasChanged??Pt)(o,e)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:r,wrapped:o},n){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),r===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[r,o]of i){let{wrapped:n}=o,c=this[r];n!==!0||this._$AL.has(r)||c===void 0||this.C(r,void 0,o,c)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};v.elementStyles=[],v.shadowRootOptions={mode:"open"},v[O("elementProperties")]=new Map,v[O("finalized")]=new Map,oe?.({ReactiveElement:v}),(z.reactiveElementVersions??=[]).push("2.1.1");var ct=globalThis,W=ct.trustedTypes,Tt=W?W.createPolicy("lit-html",{createHTML:s=>s}):void 0,lt="$lit$",y=`lit$${Math.random().toFixed(9).slice(2)}$`,dt="?"+y,ne=`<${dt}>`,w=document,L=()=>w.createComment(""),k=s=>s===null||typeof s!="object"&&typeof s!="function",pt=Array.isArray,Ot=s=>pt(s)||typeof s?.[Symbol.iterator]=="function",ht=`[
1
+ var j=globalThis,G=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,rt=Symbol(),Ct=new WeakMap,R=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==rt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(G&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=Ct.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Ct.set(e,t))}return t}toString(){return this.cssText}},Et=s=>new R(typeof s=="string"?s:s+"",void 0,rt),ot=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((i,r,o)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[o+1],s[0]);return new R(e,s,rt)},xt=(s,t)=>{if(G)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let i=document.createElement("style"),r=j.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=e.cssText,s.appendChild(i)}},nt=G?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let i of t.cssRules)e+=i.cssText;return Et(e)})(s):s;var{is:Xt,defineProperty:Ft,getOwnPropertyDescriptor:Qt,getOwnPropertyNames:te,getOwnPropertySymbols:ee,getPrototypeOf:se}=Object,z=globalThis,bt=z.trustedTypes,ie=bt?bt.emptyScript:"",re=z.reactiveElementPolyfillSupport,O=(s,t)=>s,at={toAttribute(s,t){switch(t){case Boolean:s=s?ie:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},Pt=(s,t)=>!Xt(s,t),wt={attribute:!0,type:String,converter:at,reflect:!1,useDefault:!1,hasChanged:Pt};Symbol.metadata??=Symbol("metadata"),z.litPropertyMetadata??=new WeakMap;var g=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=wt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let i=Symbol(),r=this.getPropertyDescriptor(t,i,e);r!==void 0&&Ft(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){let{get:r,set:o}=Qt(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:r,set(n){let l=r?.call(this);o?.call(this,n),this.requestUpdate(t,l,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??wt}static _$Ei(){if(this.hasOwnProperty(O("elementProperties")))return;let t=se(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(O("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(O("properties"))){let e=this.properties,i=[...te(e),...ee(e)];for(let r of i)this.createProperty(r,e[r])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[i,r]of e)this.elementProperties.set(i,r)}this._$Eh=new Map;for(let[e,i]of this.elementProperties){let r=this._$Eu(e,i);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let r of i)e.unshift(nt(r))}else t!==void 0&&e.push(nt(t));return e}static _$Eu(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){let i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(r!==void 0&&i.reflect===!0){let o=(i.converter?.toAttribute!==void 0?i.converter:at).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){let i=this.constructor,r=i._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let o=i.getPropertyOptions(r),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:at;this._$Em=r;let l=n.fromAttribute(e,o.type);this[r]=l??this._$Ej?.get(r)??l,this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){let r=this.constructor,o=this[t];if(i??=r.getPropertyOptions(t),!((i.hasChanged??Pt)(o,e)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:r,wrapped:o},n){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),r===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[r,o]of i){let{wrapped:n}=o,l=this[r];n!==!0||this._$AL.has(r)||l===void 0||this.C(r,void 0,o,l)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};g.elementStyles=[],g.shadowRootOptions={mode:"open"},g[O("elementProperties")]=new Map,g[O("finalized")]=new Map,re?.({ReactiveElement:g}),(z.reactiveElementVersions??=[]).push("2.1.1");var lt=globalThis,W=lt.trustedTypes,Tt=W?W.createPolicy("lit-html",{createHTML:s=>s}):void 0,ct="$lit$",y=`lit$${Math.random().toFixed(9).slice(2)}$`,dt="?"+y,oe=`<${dt}>`,b=document,L=()=>b.createComment(""),k=s=>s===null||typeof s!="object"&&typeof s!="function",pt=Array.isArray,Ot=s=>pt(s)||typeof s?.[Symbol.iterator]=="function",ht=`[
2
2
  \f\r]`,D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Mt=/-->/g,Ut=/>/g,E=RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ht=/'/g,Nt=/"/g,Dt=/^(?:script|style|textarea|title)$/i,ut=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),X=ut(1),ft=ut(2),Lt=ut(3),m=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Rt=new WeakMap,x=w.createTreeWalker(w,129);function kt(s,t){if(!pt(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Tt!==void 0?Tt.createHTML(t):t}var jt=(s,t)=>{let e=s.length-1,i=[],r,o=t===2?"<svg>":t===3?"<math>":"",n=D;for(let c=0;c<e;c++){let a=s[c],l,p,h=-1,f=0;for(;f<a.length&&(n.lastIndex=f,p=n.exec(a),p!==null);)f=n.lastIndex,n===D?p[1]==="!--"?n=Mt:p[1]!==void 0?n=Ut:p[2]!==void 0?(Dt.test(p[2])&&(r=RegExp("</"+p[2],"g")),n=E):p[3]!==void 0&&(n=E):n===E?p[0]===">"?(n=r??D,h=-1):p[1]===void 0?h=-2:(h=n.lastIndex-p[2].length,l=p[1],n=p[3]===void 0?E:p[3]==='"'?Nt:Ht):n===Nt||n===Ht?n=E:n===Mt||n===Ut?n=D:(n=E,r=void 0);let u=n===E&&s[c+1].startsWith("/>")?" ":"";o+=n===D?a+ne:h>=0?(i.push(l),a.slice(0,h)+lt+a.slice(h)+y+u):a+y+(h===-2?c:u)}return[kt(s,o+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},j=class s{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let o=0,n=0,c=t.length-1,a=this.parts,[l,p]=jt(t,e);if(this.el=s.createElement(l,i),x.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=x.nextNode())!==null&&a.length<c;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(lt)){let f=p[n++],u=r.getAttribute(h).split(y),$=/([.?@])?(.*)/.exec(f);a.push({type:1,index:o,name:$[2],strings:u,ctor:$[1]==="."?q:$[1]==="?"?Z:$[1]==="@"?Y:P}),r.removeAttribute(h)}else h.startsWith(y)&&(a.push({type:6,index:o}),r.removeAttribute(h));if(Dt.test(r.tagName)){let h=r.textContent.split(y),f=h.length-1;if(f>0){r.textContent=W?W.emptyScript:"";for(let u=0;u<f;u++)r.append(h[u],L()),x.nextNode(),a.push({type:2,index:++o});r.append(h[f],L())}}}else if(r.nodeType===8)if(r.data===dt)a.push({type:2,index:o});else{let h=-1;for(;(h=r.data.indexOf(y,h+1))!==-1;)a.push({type:7,index:o}),h+=y.length-1}o++}}static createElement(t,e){let i=w.createElement("template");return i.innerHTML=t,i}};function b(s,t,e=s,i){if(t===m)return t;let r=i!==void 0?e._$Co?.[i]:e._$Cl,o=k(t)?void 0:t._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(s),r._$AT(s,e,i)),i!==void 0?(e._$Co??=[])[i]=r:e._$Cl=r),r!==void 0&&(t=b(s,r._$AS(s,t.values),r,i)),t}var K=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:i}=this._$AD,r=(t?.creationScope??w).importNode(e,!0);x.currentNode=r;let o=x.nextNode(),n=0,c=0,a=i[0];for(;a!==void 0;){if(n===a.index){let l;a.type===2?l=new U(o,o.nextSibling,this,t):a.type===1?l=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(l=new J(o,this,t)),this._$AV.push(l),a=i[++c]}n!==a?.index&&(o=x.nextNode(),n++)}return x.currentNode=w,r}p(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},U=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=b(this,t,e),k(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==m&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ot(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&k(this._$AH)?this._$AA.nextSibling.data=t:this.T(w.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=j.createElement(kt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(e);else{let o=new K(r,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o}}_$AC(t){let e=Rt.get(t.strings);return e===void 0&&Rt.set(t.strings,e=new j(t)),e}k(t){pt(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,r=0;for(let o of t)r===e.length?e.push(i=new s(this.O(L()),this.O(L()),this,this.options)):i=e[r],i._$AI(o),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let i=t.nextSibling;t.remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=d}_$AI(t,e=this,i,r){let o=this.strings,n=!1;if(o===void 0)t=b(this,t,e,0),n=!k(t)||t!==this._$AH&&t!==m,n&&(this._$AH=t);else{let c=t,a,l;for(t=o[0],a=0;a<o.length-1;a++)l=b(this,c[i+a],e,a),l===m&&(l=this._$AH[a]),n||=!k(l)||l!==this._$AH[a],l===d?t=d:t!==d&&(t+=(l??"")+o[a+1]),this._$AH[a]=l}n&&!r&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},q=class extends P{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},Z=class extends P{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}},Y=class extends P{constructor(t,e,i,r,o){super(t,e,i,r,o),this.type=5}_$AI(t,e=this){if((t=b(this,t,e,0)??d)===m)return;let i=this._$AH,r=t===d&&i!==d||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==d&&(i===d||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},J=class{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){b(this,t)}},Vt={M:lt,P:y,A:dt,C:1,L:jt,R:K,D:Ot,V:b,I:U,H:P,N:Z,U:Y,B:q,F:J},ae=ct.litHtmlPolyfillSupport;ae?.(j,U),(ct.litHtmlVersions??=[]).push("3.3.1");var $t=(s,t,e)=>{let i=e?.renderBefore??t,r=i._$litPart$;if(r===void 0){let o=e?.renderBefore??null;i._$litPart$=r=new U(t.insertBefore(L(),o),o,void 0,e??{})}return r._$AI(s),r};var _t=globalThis,T=class extends v{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=$t(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return m}};T._$litElement$=!0,T.finalized=!0,_t.litElementHydrateSupport?.({LitElement:T});var he=_t.litElementPolyfillSupport;he?.({LitElement:T});(_t.litElementVersions??=[]).push("4.2.1");var S={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},_=s=>(...t)=>({_$litDirective$:s,values:t}),A=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:ce}=Vt,It=s=>s===null||typeof s!="object"&&typeof s!="function";var Gt=s=>s.strings===void 0,Bt=()=>document.createComment(""),H=(s,t,e)=>{let i=s._$AA.parentNode,r=t===void 0?s._$AB:t._$AA;if(e===void 0){let o=i.insertBefore(Bt(),r),n=i.insertBefore(Bt(),r);e=new ce(o,n,s,s.options)}else{let o=e._$AB.nextSibling,n=e._$AM,c=n!==s;if(c){let a;e._$AQ?.(s),e._$AM=s,e._$AP!==void 0&&(a=s._$AU)!==n._$AU&&e._$AP(a)}if(o!==r||c){let a=e._$AA;for(;a!==o;){let l=a.nextSibling;i.insertBefore(a,r),a=l}}}return e},C=(s,t,e=s)=>(s._$AI(t,e),s),le={},F=(s,t=le)=>s._$AH=t,zt=s=>s._$AH,Q=s=>{s._$AR(),s._$AA.remove()};var Wt=(s,t,e)=>{let i=new Map;for(let r=t;r<=e;r++)i.set(s[r],r);return i},Xe=_(class extends A{constructor(s){if(super(s),s.type!==S.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,t,e){let i;e===void 0?e=t:t!==void 0&&(i=t);let r=[],o=[],n=0;for(let c of s)r[n]=i?i(c,n):n,o[n]=e(c,n),n++;return{values:o,keys:r}}render(s,t,e){return this.dt(s,t,e).values}update(s,[t,e,i]){let r=zt(s),{values:o,keys:n}=this.dt(t,e,i);if(!Array.isArray(r))return this.ut=n,o;let c=this.ut??=[],a=[],l,p,h=0,f=r.length-1,u=0,$=o.length-1;for(;h<=f&&u<=$;)if(r[h]===null)h++;else if(r[f]===null)f--;else if(c[h]===n[u])a[u]=C(r[h],o[u]),h++,u++;else if(c[f]===n[$])a[$]=C(r[f],o[$]),f--,$--;else if(c[h]===n[$])a[$]=C(r[h],o[$]),H(s,a[$+1],r[h]),h++,$--;else if(c[f]===n[u])a[u]=C(r[f],o[u]),H(s,r[h],r[f]),f--,u++;else if(l===void 0&&(l=Wt(n,u,$),p=Wt(c,h,f)),l.has(c[h]))if(l.has(c[f])){let g=p.get(n[u]),it=g!==void 0?r[g]:null;if(it===null){let St=H(s,r[h]);C(St,o[u]),a[u]=St}else a[u]=C(it,o[u]),H(s,r[h],it),r[g]=null;u++}else Q(r[f]),f--;else Q(r[h]),h++;for(;u<=$;){let g=H(s,a[$+1]);C(g,o[u]),a[u++]=g}for(;h<=f;){let g=r[h++];g!==null&&Q(g)}return this.ut=n,F(s,a),m}});var os=_(class extends A{constructor(){super(...arguments),this.key=d}render(s,t){return this.key=s,t}update(s,[t,e]){return t!==this.key&&(F(s),this.key=t),e}});var ps=_(class extends A{constructor(s){if(super(s),s.type!==S.ATTRIBUTE||s.name!=="class"||s.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(t=>s[t]).join(" ")+" "}update(s,[t]){if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(let i in t)t[i]&&!this.nt?.has(i)&&this.st.add(i);return this.render(t)}let e=s.element.classList;for(let i of this.st)i in t||(e.remove(i),this.st.delete(i));for(let i in t){let r=!!t[i];r===this.st.has(i)||this.nt?.has(i)||(r?(e.add(i),this.st.add(i)):(e.remove(i),this.st.delete(i)))}return m}});var V=(s,t)=>{let e=s._$AN;if(e===void 0)return!1;for(let i of e)i._$AO?.(t,!1),V(i,t);return!0},tt=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while(e?.size===0)},Kt=s=>{for(let t;t=s._$AM;s=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(s))break;e.add(s),ue(t)}};function de(s){this._$AN!==void 0?(tt(this),this._$AM=s,Kt(this)):this._$AM=s}function pe(s,t=!1,e=0){let i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(i))for(let o=e;o<i.length;o++)V(i[o],!1),tt(i[o]);else i!=null&&(V(i,!1),tt(i));else V(this,s)}var ue=s=>{s.type==S.CHILD&&(s._$AP??=pe,s._$AQ??=de)},N=class extends A{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),Kt(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(V(this,t),tt(this))}setValue(t){if(Gt(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var fe=()=>new At,At=class{},mt=new WeakMap,$e=_(class extends N{render(s){return d}update(s,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=s.options?.host,this.rt(this.ct=s.element)),d}rt(s){if(this.isConnected||(s=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=mt.get(t);e===void 0&&(e=new WeakMap,mt.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,s),s!==void 0&&this.G.call(this.ht,s)}else this.G.value=s}get lt(){return typeof this.G=="function"?mt.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var _e=s=>s??d;var et=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},st=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var qt=s=>!It(s)&&typeof s.then=="function",Zt=1073741823,gt=class extends N{constructor(){super(...arguments),this._$Cwt=Zt,this._$Cbt=[],this._$CK=new et(this),this._$CX=new st}render(...t){return t.find(e=>!qt(e))??m}update(t,e){let i=this._$Cbt,r=i.length;this._$Cbt=e;let o=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let c=0;c<e.length&&!(c>this._$Cwt);c++){let a=e[c];if(!qt(a))return this._$Cwt=c,a;c<r&&a===i[c]||(this._$Cwt=Zt,r=0,Promise.resolve(a).then(async l=>{for(;n.get();)await n.get();let p=o.deref();if(p!==void 0){let h=p._$Cbt.indexOf(a);h>-1&&h<p._$Cwt&&(p._$Cwt=h,p.setValue(l))}}))}return m}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},me=_(gt);var M=class extends A{constructor(t){if(super(t),this.it=d,t.type!==S.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===d||t==null)return this._t=void 0,this.it=t;if(t===m)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};M.directiveName="unsafeHTML",M.resultType=1;var Ae=_(M);var B=class extends M{};B.directiveName="unsafeSVG",B.resultType=2;var ge=_(B);var ve=["127.0.0.1","localhost"].includes(window.location.hostname),ye=s=>typeof s!="string"&&"strTag"in s;function Se(s){let t="";for(let e=0;e<=s.length-1;e++)t+=s[e],e<s.length-1&&(t+=`{${e}}`);return t}function Ce(s,t){return s.replace(/\{(\d+)\}/g,(e,i)=>t(i))}var Ee=(s,t,e)=>{let i=Se(s),r=Yt(i,e);return Ce(r,o=>t[o])};function Yt(s,t={}){window.__strings=window.__strings??{};let e=window.__strings[s]?.content;return!e&&ve&&console.log("\u{1F310}",s,t.desc?`(${t.desc})`:""),window.env?.DEBUG_TRANSLATIONS?`__${e??s}`:e??s}var xe=(s,t={})=>s?ye(s)?Ee(s.strings,s.values,t):Yt(s,t):"";var Xt=Symbol.for(""),we=s=>{if(s?.r===Xt)return s?._$litStatic$},be=s=>({_$litStatic$:s,r:Xt});var Jt=new Map,vt=s=>(t,...e)=>{let i=e.length,r,o,n=[],c=[],a,l=0,p=!1;for(;l<i;){for(a=t[l];l<i&&(o=e[l],(r=we(o))!==void 0);)a+=r+t[++l],p=!0;l!==i&&c.push(o),n.push(a),l++}if(l===i&&n.push(t[i]),p){let h=n.join("$$lit$$");(t=Jt.get(h))===void 0&&(n.raw=n,Jt.set(h,t=n)),e=c}return s(t,...e)},Pe=vt(X),ei=vt(ft),si=vt(Lt);var ai=X,hi=ot;var yt=class extends A{#t=null;#e=null;render(t){return d}update(t,[e]){let i=t.element;return this.#e!==i?(this.#e=i,this.#t=e,this.#s()):JSON.stringify(this.#t)!==JSON.stringify(e)&&(this.#t=e,this.#s()),d}async#s(){if(!this.#e||!this.#t)return;let t=this.#e.tagName.toLowerCase();await customElements.whenDefined(t);for(let[e,i]of Object.entries(this.#t))this.#e[e]=i}},li=_(yt);async function di(s){try{window.__strings=await fetch(`/assets/locales/${s}.json`).then(t=>t.json())}catch{window.__strings={}}}export{T as LitElement,ps as classMap,fe as createRef,hi as css,ai as html,_e as ifDefined,os as keyed,li as lazyProps,di as loadLocale,xe as msg,d as nothing,$e as ref,$t as render,Xe as repeat,Pe as staticHtml,ft as svg,Ae as unsafeHTML,ge as unsafeSVG,be as unsafeStatic,me as until};
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ht=/'/g,Nt=/"/g,Dt=/^(?:script|style|textarea|title)$/i,ut=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),X=ut(1),ft=ut(2),Lt=ut(3),_=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Rt=new WeakMap,x=b.createTreeWalker(b,129);function kt(s,t){if(!pt(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Tt!==void 0?Tt.createHTML(t):t}var Vt=(s,t)=>{let e=s.length-1,i=[],r,o=t===2?"<svg>":t===3?"<math>":"",n=D;for(let l=0;l<e;l++){let a=s[l],c,p,h=-1,f=0;for(;f<a.length&&(n.lastIndex=f,p=n.exec(a),p!==null);)f=n.lastIndex,n===D?p[1]==="!--"?n=Mt:p[1]!==void 0?n=Ut:p[2]!==void 0?(Dt.test(p[2])&&(r=RegExp("</"+p[2],"g")),n=E):p[3]!==void 0&&(n=E):n===E?p[0]===">"?(n=r??D,h=-1):p[1]===void 0?h=-2:(h=n.lastIndex-p[2].length,c=p[1],n=p[3]===void 0?E:p[3]==='"'?Nt:Ht):n===Nt||n===Ht?n=E:n===Mt||n===Ut?n=D:(n=E,r=void 0);let u=n===E&&s[l+1].startsWith("/>")?" ":"";o+=n===D?a+oe:h>=0?(i.push(c),a.slice(0,h)+ct+a.slice(h)+y+u):a+y+(h===-2?l:u)}return[kt(s,o+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},V=class s{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let o=0,n=0,l=t.length-1,a=this.parts,[c,p]=Vt(t,e);if(this.el=s.createElement(c,i),x.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=x.nextNode())!==null&&a.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(ct)){let f=p[n++],u=r.getAttribute(h).split(y),$=/([.?@])?(.*)/.exec(f);a.push({type:1,index:o,name:$[2],strings:u,ctor:$[1]==="."?q:$[1]==="?"?Z:$[1]==="@"?Y:P}),r.removeAttribute(h)}else h.startsWith(y)&&(a.push({type:6,index:o}),r.removeAttribute(h));if(Dt.test(r.tagName)){let h=r.textContent.split(y),f=h.length-1;if(f>0){r.textContent=W?W.emptyScript:"";for(let u=0;u<f;u++)r.append(h[u],L()),x.nextNode(),a.push({type:2,index:++o});r.append(h[f],L())}}}else if(r.nodeType===8)if(r.data===dt)a.push({type:2,index:o});else{let h=-1;for(;(h=r.data.indexOf(y,h+1))!==-1;)a.push({type:7,index:o}),h+=y.length-1}o++}}static createElement(t,e){let i=b.createElement("template");return i.innerHTML=t,i}};function w(s,t,e=s,i){if(t===_)return t;let r=i!==void 0?e._$Co?.[i]:e._$Cl,o=k(t)?void 0:t._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(s),r._$AT(s,e,i)),i!==void 0?(e._$Co??=[])[i]=r:e._$Cl=r),r!==void 0&&(t=w(s,r._$AS(s,t.values),r,i)),t}var K=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:i}=this._$AD,r=(t?.creationScope??b).importNode(e,!0);x.currentNode=r;let o=x.nextNode(),n=0,l=0,a=i[0];for(;a!==void 0;){if(n===a.index){let c;a.type===2?c=new U(o,o.nextSibling,this,t):a.type===1?c=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(c=new J(o,this,t)),this._$AV.push(c),a=i[++l]}n!==a?.index&&(o=x.nextNode(),n++)}return x.currentNode=b,r}p(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},U=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=w(this,t,e),k(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==_&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ot(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&k(this._$AH)?this._$AA.nextSibling.data=t:this.T(b.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=V.createElement(kt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(e);else{let o=new K(r,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o}}_$AC(t){let e=Rt.get(t.strings);return e===void 0&&Rt.set(t.strings,e=new V(t)),e}k(t){pt(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,r=0;for(let o of t)r===e.length?e.push(i=new s(this.O(L()),this.O(L()),this,this.options)):i=e[r],i._$AI(o),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let i=t.nextSibling;t.remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=d}_$AI(t,e=this,i,r){let o=this.strings,n=!1;if(o===void 0)t=w(this,t,e,0),n=!k(t)||t!==this._$AH&&t!==_,n&&(this._$AH=t);else{let l=t,a,c;for(t=o[0],a=0;a<o.length-1;a++)c=w(this,l[i+a],e,a),c===_&&(c=this._$AH[a]),n||=!k(c)||c!==this._$AH[a],c===d?t=d:t!==d&&(t+=(c??"")+o[a+1]),this._$AH[a]=c}n&&!r&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},q=class extends P{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},Z=class extends P{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}},Y=class extends P{constructor(t,e,i,r,o){super(t,e,i,r,o),this.type=5}_$AI(t,e=this){if((t=w(this,t,e,0)??d)===_)return;let i=this._$AH,r=t===d&&i!==d||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==d&&(i===d||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},J=class{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){w(this,t)}},Bt={M:ct,P:y,A:dt,C:1,L:Vt,R:K,D:Ot,V:w,I:U,H:P,N:Z,U:Y,B:q,F:J},ne=lt.litHtmlPolyfillSupport;ne?.(V,U),(lt.litHtmlVersions??=[]).push("3.3.1");var $t=(s,t,e)=>{let i=e?.renderBefore??t,r=i._$litPart$;if(r===void 0){let o=e?.renderBefore??null;i._$litPart$=r=new U(t.insertBefore(L(),o),o,void 0,e??{})}return r._$AI(s),r};var mt=globalThis,T=class extends g{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=$t(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return _}};T._$litElement$=!0,T.finalized=!0,mt.litElementHydrateSupport?.({LitElement:T});var ae=mt.litElementPolyfillSupport;ae?.({LitElement:T});(mt.litElementVersions??=[]).push("4.2.1");var S={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},m=s=>(...t)=>({_$litDirective$:s,values:t}),A=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:he}=Bt,jt=s=>s===null||typeof s!="object"&&typeof s!="function";var Gt=s=>s.strings===void 0,It=()=>document.createComment(""),H=(s,t,e)=>{let i=s._$AA.parentNode,r=t===void 0?s._$AB:t._$AA;if(e===void 0){let o=i.insertBefore(It(),r),n=i.insertBefore(It(),r);e=new he(o,n,s,s.options)}else{let o=e._$AB.nextSibling,n=e._$AM,l=n!==s;if(l){let a;e._$AQ?.(s),e._$AM=s,e._$AP!==void 0&&(a=s._$AU)!==n._$AU&&e._$AP(a)}if(o!==r||l){let a=e._$AA;for(;a!==o;){let c=a.nextSibling;i.insertBefore(a,r),a=c}}}return e},C=(s,t,e=s)=>(s._$AI(t,e),s),le={},F=(s,t=le)=>s._$AH=t,zt=s=>s._$AH,Q=s=>{s._$AR(),s._$AA.remove()};var Wt=(s,t,e)=>{let i=new Map;for(let r=t;r<=e;r++)i.set(s[r],r);return i},ze=m(class extends A{constructor(s){if(super(s),s.type!==S.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,t,e){let i;e===void 0?e=t:t!==void 0&&(i=t);let r=[],o=[],n=0;for(let l of s)r[n]=i?i(l,n):n,o[n]=e(l,n),n++;return{values:o,keys:r}}render(s,t,e){return this.dt(s,t,e).values}update(s,[t,e,i]){let r=zt(s),{values:o,keys:n}=this.dt(t,e,i);if(!Array.isArray(r))return this.ut=n,o;let l=this.ut??=[],a=[],c,p,h=0,f=r.length-1,u=0,$=o.length-1;for(;h<=f&&u<=$;)if(r[h]===null)h++;else if(r[f]===null)f--;else if(l[h]===n[u])a[u]=C(r[h],o[u]),h++,u++;else if(l[f]===n[$])a[$]=C(r[f],o[$]),f--,$--;else if(l[h]===n[$])a[$]=C(r[h],o[$]),H(s,a[$+1],r[h]),h++,$--;else if(l[f]===n[u])a[u]=C(r[f],o[u]),H(s,r[h],r[f]),f--,u++;else if(c===void 0&&(c=Wt(n,u,$),p=Wt(l,h,f)),c.has(l[h]))if(c.has(l[f])){let v=p.get(n[u]),it=v!==void 0?r[v]:null;if(it===null){let St=H(s,r[h]);C(St,o[u]),a[u]=St}else a[u]=C(it,o[u]),H(s,r[h],it),r[v]=null;u++}else Q(r[f]),f--;else Q(r[h]),h++;for(;u<=$;){let v=H(s,a[$+1]);C(v,o[u]),a[u++]=v}for(;h<=f;){let v=r[h++];v!==null&&Q(v)}return this.ut=n,F(s,a),_}});var Fe=m(class extends A{constructor(){super(...arguments),this.key=d}render(s,t){return this.key=s,t}update(s,[t,e]){return t!==this.key&&(F(s),this.key=t),e}});var os=m(class extends A{constructor(s){if(super(s),s.type!==S.ATTRIBUTE||s.name!=="class"||s.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(t=>s[t]).join(" ")+" "}update(s,[t]){if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(let i in t)t[i]&&!this.nt?.has(i)&&this.st.add(i);return this.render(t)}let e=s.element.classList;for(let i of this.st)i in t||(e.remove(i),this.st.delete(i));for(let i in t){let r=!!t[i];r===this.st.has(i)||this.nt?.has(i)||(r?(e.add(i),this.st.add(i)):(e.remove(i),this.st.delete(i)))}return _}});var B=(s,t)=>{let e=s._$AN;if(e===void 0)return!1;for(let i of e)i._$AO?.(t,!1),B(i,t);return!0},tt=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while(e?.size===0)},Kt=s=>{for(let t;t=s._$AM;s=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(s))break;e.add(s),pe(t)}};function ce(s){this._$AN!==void 0?(tt(this),this._$AM=s,Kt(this)):this._$AM=s}function de(s,t=!1,e=0){let i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(i))for(let o=e;o<i.length;o++)B(i[o],!1),tt(i[o]);else i!=null&&(B(i,!1),tt(i));else B(this,s)}var pe=s=>{s.type==S.CHILD&&(s._$AP??=de,s._$AQ??=ce)},N=class extends A{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),Kt(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(B(this,t),tt(this))}setValue(t){if(Gt(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var ue=()=>new At,At=class{},_t=new WeakMap,fe=m(class extends N{render(s){return d}update(s,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=s.options?.host,this.rt(this.ct=s.element)),d}rt(s){if(this.isConnected||(s=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=_t.get(t);e===void 0&&(e=new WeakMap,_t.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,s),s!==void 0&&this.G.call(this.ht,s)}else this.G.value=s}get lt(){return typeof this.G=="function"?_t.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var $e=s=>s??d;var et=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},st=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var qt=s=>!jt(s)&&typeof s.then=="function",Zt=1073741823,vt=class extends N{constructor(){super(...arguments),this._$Cwt=Zt,this._$Cbt=[],this._$CK=new et(this),this._$CX=new st}render(...t){return t.find(e=>!qt(e))??_}update(t,e){let i=this._$Cbt,r=i.length;this._$Cbt=e;let o=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let l=0;l<e.length&&!(l>this._$Cwt);l++){let a=e[l];if(!qt(a))return this._$Cwt=l,a;l<r&&a===i[l]||(this._$Cwt=Zt,r=0,Promise.resolve(a).then(async c=>{for(;n.get();)await n.get();let p=o.deref();if(p!==void 0){let h=p._$Cbt.indexOf(a);h>-1&&h<p._$Cwt&&(p._$Cwt=h,p.setValue(c))}}))}return _}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},me=m(vt);var M=class extends A{constructor(t){if(super(t),this.it=d,t.type!==S.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===d||t==null)return this._t=void 0,this.it=t;if(t===_)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};M.directiveName="unsafeHTML",M.resultType=1;var _e=m(M);var I=class extends M{};I.directiveName="unsafeSVG",I.resultType=2;var Ae=m(I);var Jt=Symbol.for(""),ve=s=>{if(s?.r===Jt)return s?._$litStatic$},ge=s=>({_$litStatic$:s,r:Jt});var Yt=new Map,gt=s=>(t,...e)=>{let i=e.length,r,o,n=[],l=[],a,c=0,p=!1;for(;c<i;){for(a=t[c];c<i&&(o=e[c],(r=ve(o))!==void 0);)a+=r+t[++c],p=!0;c!==i&&l.push(o),n.push(a),c++}if(c===i&&n.push(t[i]),p){let h=n.join("$$lit$$");(t=Yt.get(h))===void 0&&(n.raw=n,Yt.set(h,t=n)),e=l}return s(t,...e)},ye=gt(X),qs=gt(ft),Zs=gt(Lt);var Qs=X,ti=ot;var yt=class extends A{#t=null;#e=null;render(t){return d}update(t,[e]){let i=t.element;return this.#e!==i?(this.#e=i,this.#t=e,this.#s()):JSON.stringify(this.#t)!==JSON.stringify(e)&&(this.#t=e,this.#s()),d}async#s(){if(!this.#e||!this.#t)return;let t=this.#e.tagName.toLowerCase();await customElements.whenDefined(t);for(let[e,i]of Object.entries(this.#t))this.#e[e]=i}},si=m(yt);export{T as LitElement,os as classMap,ue as createRef,ti as css,Qs as html,$e as ifDefined,Fe as keyed,si as lazyProps,d as nothing,fe as ref,$t as render,ze as repeat,ye as staticHtml,ft as svg,_e as unsafeHTML,Ae as unsafeSVG,ge as unsafeStatic,me as until};
4
4
  /*! Bundled license information:
5
5
 
6
6
  @lit/reactive-element/css-tag.js:
package/readme.md CHANGED
@@ -119,6 +119,7 @@ PDS follows the [Pure Web Manifesto](https://pureweb.dev/manifesto)—sustainabl
119
119
  - [The Three Layers](#the-three-layers)
120
120
  - [Who is it For?](#who-is-it-for)
121
121
  - [Getting Started](#getting-started)
122
+ - [Localization](#localization)
122
123
  - [Core Architecture](#core-architecture)
123
124
  - [Styling Layers](#styling-layers)
124
125
  - [Shadow DOM Adoption](#shadow-dom-adoption)
@@ -323,6 +324,19 @@ This covers the project starter, existing-project setup, CDN usage, Storybook, a
323
324
 
324
325
  ---
325
326
 
327
+ ## Localization
328
+
329
+ PDS localization is framework-independent and context-aware via DOM `lang` scope.
330
+
331
+ - Use `msg()` directly in markup in both root UI and nested language islands.
332
+ - Configure a provider in `pds.config.js` to load locale bundles dynamically.
333
+ - `localization.locale` is the default fallback locale, not a forced global language.
334
+ - In live edit quick settings, Language appears when startup localization strings infer at least 2 locales.
335
+
336
+ See the full guide in [LOCALIZATION.md](LOCALIZATION.md).
337
+
338
+ ---
339
+
326
340
  ## Core Architecture
327
341
 
328
342
  PDS has three integrated systems that work together to create complete design systems.
@@ -1337,6 +1351,17 @@ await PDS.adoptLayers(shadowRoot, ['primitives'], [customSheet]);
1337
1351
 
1338
1352
  Adopt primitives layer (convenience method).
1339
1353
 
1354
+ ### PDS.log(level, message, ...data)
1355
+
1356
+ Unified logging entry point used by runtime internals and consumer code.
1357
+
1358
+ ```typescript
1359
+ PDS.log('info', 'Design system initialized');
1360
+ PDS.log('warn', 'Missing optional preset metadata', { preset: 'travel-market' });
1361
+ ```
1362
+
1363
+ > Configure behavior with `config.log(level, message, ...data)` in `PDS.start(...)`.
1364
+
1340
1365
  ### PDS.createStylesheet(css)
1341
1366
 
1342
1367
  Create constructable stylesheet from CSS string.
@@ -1352,6 +1377,7 @@ PDS.enums // Enumeration values (live-only)
1352
1377
  PDS.currentConfig // Current configuration (read-only)
1353
1378
  PDS.compiled // Compiled state (live mode only)
1354
1379
  PDS.theme // Current theme (getter/setter)
1380
+ PDS.log(level, message) // Canonical logging API
1355
1381
  PDS.defaultEnhancers // Built-in enhancements
1356
1382
  ```
1357
1383
 
@@ -1852,10 +1878,12 @@ export default {
1852
1878
  </script>
1853
1879
  ```
1854
1880
 
1855
- **About the bundle:** `#pds/lit` is a convenience bundle that re-exports official Lit APIs and adds PDS helpers:
1856
- - `lazyProps` (waits for custom element definition before applying object props)
1857
- - `msg()` (PDS localization helper)
1858
- - `loadLocale()` (loads translation strings)
1881
+ **About the bundle:** `#pds/lit` is a convenience bundle that re-exports official Lit APIs and includes `lazyProps` (waits for custom element definition before applying object props).
1882
+
1883
+ **Localization is runtime-level:** import localization helpers from `#pds`, not `#pds/lit`.
1884
+ - `msg()` (localized message lookup)
1885
+ - `str` (tagged template helper compatible with `msg(str\`...\`)`)
1886
+ - `setLocale()` / `loadLocale()` (provider-driven locale switching/loading)
1859
1887
 
1860
1888
  **Prefer not to use the bundle?** Create your own module and alias `#pds/lit` to it:
1861
1889
 
@@ -1871,8 +1899,8 @@ export { until } from "lit/directives/until.js";
1871
1899
  export { unsafeHTML } from "lit/directives/unsafe-html.js";
1872
1900
  export { unsafeSVG } from "lit/directives/unsafe-svg.js";
1873
1901
 
1874
- // Optional: use PDS localization helper
1875
- // export { msg } from "@pure-ds/core/src/js/common/msg.js";
1902
+ // Localization comes from #pds root exports
1903
+ // import { msg, str, setLocale, loadLocale } from "#pds";
1876
1904
 
1877
1905
  // Minimal lazyProps implementation (see src/js/lit.js)
1878
1906
  import { Directive, directive } from "lit/directive.js";
@@ -1,4 +1,5 @@
1
1
  import { enums } from "./pds-enums.js";
2
+ import { PDS } from "../pds-singleton.js";
2
3
 
3
4
  /**
4
5
  * Design config types (SSoT) - mirror generator input and document output impact.
@@ -247,6 +248,24 @@ import { enums } from "./pds-enums.js";
247
248
  * @property {boolean} [debug]
248
249
  */
249
250
 
251
+ /**
252
+ * @typedef {Object} PDSLocalizationProvider
253
+ * @property {(context: { key: string, values: any[], options?: Record<string, any>, locale: string, defaultLocale: string, messages: Record<string, string>, messagesByLocale?: Record<string, Record<string, string>>, template?: { strings: string[], values: any[] } | null }) => (string | undefined | null)} [translate]
254
+ * @property {(context: { locale: string, defaultLocale: string, reason?: string, loadedLocales?: string[], messages?: Record<string, string>, load?: boolean }) => (Promise<Record<string, string | { content?: string }>> | Record<string, string | { content?: string }> | void)} [loadLocale]
255
+ * @property {(context: { locale: string, defaultLocale: string, reason?: string, loadedLocales?: string[], messages?: Record<string, string>, load?: boolean }) => (Promise<Record<string, string | { content?: string }>> | Record<string, string | { content?: string }> | void)} [setLocale]
256
+ */
257
+
258
+ /**
259
+ * @typedef {Object} PDSLocalizationConfig
260
+ * @property {string} [locale]
261
+ * @property {string[]} [locales]
262
+ * @property {Record<string, string | { content?: string }>} [messages]
263
+ * @property {PDSLocalizationProvider} [provider]
264
+ * @property {PDSLocalizationProvider["translate"]} [translate]
265
+ * @property {PDSLocalizationProvider["loadLocale"]} [loadLocale]
266
+ * @property {PDSLocalizationProvider["setLocale"]} [setLocale]
267
+ */
268
+
250
269
  /**
251
270
  * @typedef {Object} PDSInitConfig
252
271
  * @property {string} [mode]
@@ -262,6 +281,7 @@ import { enums } from "./pds-enums.js";
262
281
  * @property {string} [managerURL]
263
282
  * @property {any} [manager]
264
283
  * @property {boolean} [liveEdit]
284
+ * @property {PDSLocalizationConfig} [localization]
265
285
  * @property {any} [log]
266
286
  */
267
287
 
@@ -794,6 +814,19 @@ const __INIT_CONFIG_SPEC__ = {
794
814
  managerURL: { type: "string" },
795
815
  manager: { type: __ANY_TYPE__ },
796
816
  liveEdit: { type: "boolean" },
817
+ localization: {
818
+ type: "object",
819
+ allowUnknown: false,
820
+ properties: {
821
+ locale: { type: "string" },
822
+ locales: { type: "array", items: { type: "string" } },
823
+ messages: { type: "object", allowUnknown: true },
824
+ provider: { type: __ANY_TYPE__ },
825
+ translate: { type: __ANY_TYPE__ },
826
+ loadLocale: { type: __ANY_TYPE__ },
827
+ setLocale: { type: __ANY_TYPE__ },
828
+ },
829
+ },
797
830
  log: { type: __ANY_TYPE__ },
798
831
  },
799
832
  };
@@ -2641,15 +2674,5 @@ export const PDS_DEFAULT_CONFIG_FORM_SCHEMA = buildDesignConfigFormSchema(
2641
2674
  * @param {...any} data - additional data to log
2642
2675
  */
2643
2676
  export function defaultLog(level = "log", message, ...data) {
2644
- // Access debug from 'this' context when called as method, or check for common locations
2645
- const debug = this?.debug || this?.design?.debug || false;
2646
-
2647
- if (debug || level === "error" || level === "warn") {
2648
- const method = console[level] || console.log;
2649
- if (data.length > 0) {
2650
- method(message, ...data);
2651
- } else {
2652
- method(message);
2653
- }
2654
- }
2677
+ PDS.log(level, message, ...data);
2655
2678
  }
@@ -1,3 +1,5 @@
1
+ import { msg } from "../common/localization.js";
2
+
1
3
  /**
2
4
  * PDS Enhancers - Single Source of Truth
3
5
  *
@@ -502,7 +504,7 @@ function enhanceColorInput(elem) {
502
504
 
503
505
  if (isUnset) {
504
506
  output.value = "";
505
- output.textContent = "not set";
507
+ output.textContent = msg("not set");
506
508
  control.dataset.value = "";
507
509
  control.dataset.unset = "1";
508
510
  swatch.dataset.unset = "1";
@@ -686,7 +688,7 @@ function enhanceRequired(elem) {
686
688
  if (form && !form.querySelector(".required-legend")) {
687
689
  const legend = document.createElement("small");
688
690
  legend.classList.add("required-legend");
689
- legend.textContent = "* Required fields";
691
+ legend.textContent = msg("* Required fields");
690
692
  form.insertBefore(
691
693
  legend,
692
694
  form.querySelector(".form-actions") || form.lastElementChild,
@@ -707,7 +709,7 @@ function enhanceOpenGroup(elem) {
707
709
 
708
710
  const addInput = document.createElement("input");
709
711
  addInput.type = "text";
710
- addInput.placeholder = "Add item...";
712
+ addInput.placeholder = msg("Add item...");
711
713
  addInput.classList.add("input-text", "input-sm");
712
714
  addInput.style.width = "auto";
713
715
 
@@ -751,7 +751,7 @@ async function __attachLiveAPIs(PDS, { applyResolvedTheme, setupSystemListenerIf
751
751
  PDS.applyLivePreset = async function(presetId, options = {}) {
752
752
  if (!presetId) return false;
753
753
  if (!PDS.registry?.isLive) {
754
- console.warn("PDS.applyLivePreset is only available in live mode.");
754
+ PDS.log("warn", "PDS.applyLivePreset is only available in live mode.");
755
755
  return false;
756
756
  }
757
757
 
@@ -775,7 +775,8 @@ async function __attachLiveAPIs(PDS, { applyResolvedTheme, setupSystemListenerIf
775
775
  normalized.presetInfo?.name ||
776
776
  normalized.generatorConfig?.design?.name ||
777
777
  presetId;
778
- console.warn(
778
+ PDS.log(
779
+ "warn",
779
780
  `PDS theme "${resolvedTheme}" not supported by preset "${presetName}".`
780
781
  );
781
782
  }
@@ -886,7 +887,7 @@ async function __attachLiveAPIs(PDS, { applyResolvedTheme, setupSystemListenerIf
886
887
  document.head.insertBefore(styleEl, document.head.firstChild);
887
888
  }
888
889
  } catch (error) {
889
- console.warn("PDS preload failed:", error);
890
+ PDS.log("warn", "PDS preload failed:", error);
890
891
  }
891
892
  };
892
893
 
@@ -947,7 +948,7 @@ export async function startLive(PDS, config, { emitReady, emitConfigChanged, app
947
948
  document.adoptedStyleSheets = [foucSheet, ...document.adoptedStyleSheets];
948
949
  }
949
950
  } catch (e) {
950
- console.warn("Constructable stylesheets not supported, using <style> tag fallback:", e);
951
+ PDS.log("warn", "Constructable stylesheets not supported, using <style> tag fallback:", e);
951
952
  const existingFoucStyle = document.head.querySelector("style[data-pds-fouc]");
952
953
  if (!existingFoucStyle) {
953
954
  const foucStyle = document.createElement("style");
@@ -989,7 +990,8 @@ export async function startLive(PDS, config, { emitReady, emitConfigChanged, app
989
990
  normalized.generatorConfig?.design?.name ||
990
991
  normalized.generatorConfig?.preset ||
991
992
  "current preset";
992
- console.warn(
993
+ PDS.log(
994
+ "warn",
993
995
  `PDS theme "${resolvedTheme}" not supported by preset "${presetName}".`
994
996
  );
995
997
  }
@@ -3,6 +3,8 @@
3
3
  // PDS REGISTRY - Global mode manager for live vs static mode
4
4
  // ============================================================================
5
5
 
6
+ import { PDS } from "../pds-singleton.js";
7
+
6
8
  class PDSRegistry {
7
9
  constructor() {
8
10
  this._mode = "static"; // Default to static mode
@@ -46,10 +48,10 @@ class PDSRegistry {
46
48
  const module = await import(/* @vite-ignore */ this._staticPaths[layer]);
47
49
  return module[layer]; // Return exported stylesheet
48
50
  } catch (error) {
49
- // No access to config in static mode, fall back to console
50
- console.error(`[PDS Registry] Failed to load static ${layer}:`, error);
51
- console.error(`[PDS Registry] Looking for: ${this._staticPaths[layer]}`);
52
- console.error(`[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path`);
51
+ // Route through centralized logger fallback behavior
52
+ PDS.log("error", `Registry: failed to load static ${layer}:`, error);
53
+ PDS.log("error", `Registry: looking for ${this._staticPaths[layer]}`);
54
+ PDS.log("error", "Registry: make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");
53
55
  // Return empty stylesheet as fallback
54
56
  const fallback = new CSSStyleSheet();
55
57
  fallback.replaceSync("/* Failed to load " + layer + " */");
@@ -4,6 +4,7 @@
4
4
  * generator bundle lean and optional.
5
5
  */
6
6
  import { registry as pdsRegistry } from "./pds-registry.js";
7
+ import { PDS } from "../pds-singleton.js";
7
8
 
8
9
  /**
9
10
  * Install runtime styles for PDS using constructable stylesheets when
@@ -48,7 +49,7 @@ export function installRuntimeStyles(cssText) {
48
49
  // Update the stylesheet content in place
49
50
  el.textContent = cssText;
50
51
  } catch (err) {
51
- console.warn("installRuntimeStyles failed:", err);
52
+ PDS.log("warn", "installRuntimeStyles failed:", err);
52
53
  }
53
54
  }
54
55
 
@@ -60,8 +61,9 @@ export function applyStyles(generator) {
60
61
  const target = generator;
61
62
 
62
63
  if (!target || typeof target !== "object") {
63
- console.error(
64
- "[Runtime] applyStyles requires an explicit generator instance in live mode"
64
+ PDS.log(
65
+ "error",
66
+ "Runtime applyStyles requires an explicit generator instance in live mode"
65
67
  );
66
68
  return;
67
69
  }
@@ -72,7 +74,7 @@ export function applyStyles(generator) {
72
74
  if (!cssText) {
73
75
  target.options?.log?.(
74
76
  "warn",
75
- "[Runtime] No CSS available on generator to apply"
77
+ "Runtime: no CSS available on generator to apply"
76
78
  );
77
79
  return;
78
80
  }
@@ -108,8 +110,9 @@ export async function adoptPrimitives(
108
110
  shadowRoot.adoptedStyleSheets = [primitives, ...additionalSheets];
109
111
  } catch (error) {
110
112
  const componentName = shadowRoot.host?.tagName?.toLowerCase() || "unknown";
111
- console.error(
112
- `[PDS Adopter] <${componentName}> failed to adopt primitives:`,
113
+ PDS.log(
114
+ "error",
115
+ `Adopter: <${componentName}> failed to adopt primitives:`,
113
116
  error
114
117
  );
115
118
  // Continue with just additional sheets as fallback
@@ -177,8 +180,9 @@ export async function adoptLayers(
177
180
  shadowRoot.adoptedStyleSheets = [...validStylesheets, ...safeAdditionalSheets];
178
181
  } catch (error) {
179
182
  const componentName = shadowRoot.host?.tagName?.toLowerCase() || "unknown";
180
- console.error(
181
- `[PDS Adopter] <${componentName}> failed to adopt layers:`,
183
+ PDS.log(
184
+ "error",
185
+ `Adopter: <${componentName}> failed to adopt layers:`,
182
186
  error
183
187
  );
184
188
  // Continue with just additional sheets as fallback