contour-ds 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/dist/build-manifest.json +44 -44
  3. package/dist/contour-wc.esm.js +1012 -67
  4. package/dist/contour-wc.esm.min.js +1 -1
  5. package/dist/contour-wc.js +1012 -67
  6. package/dist/contour-wc.min.js +1 -1
  7. package/dist/contour.components.json +403 -16
  8. package/dist/contour.css +328 -10
  9. package/dist/contour.d.ts +31 -0
  10. package/dist/contour.esm.js +12 -0
  11. package/dist/contour.esm.min.js +1 -1
  12. package/dist/contour.js +12 -0
  13. package/dist/contour.min.css +1 -1
  14. package/dist/contour.min.js +1 -1
  15. package/dist/docs/actions.md +1 -1
  16. package/dist/docs/affordances.md +1 -1
  17. package/dist/docs/colour.md +1 -1
  18. package/dist/docs/data.md +1 -1
  19. package/dist/docs/docs.md +1 -1
  20. package/dist/docs/feedback.md +1 -1
  21. package/dist/docs/field.md +1 -1
  22. package/dist/docs/forms.md +1 -1
  23. package/dist/docs/index.json +15 -4
  24. package/dist/docs/install.md +1 -1
  25. package/dist/docs/landing.md +1 -1
  26. package/dist/docs/mapengine.md +1 -1
  27. package/dist/docs/motion.md +1 -1
  28. package/dist/docs/navigation.md +1 -1
  29. package/dist/docs/overlays.md +1 -1
  30. package/dist/docs/overview.md +1 -1
  31. package/dist/docs/patterns.md +1 -1
  32. package/dist/docs/playground.md +1 -1
  33. package/dist/docs/principles.md +1 -1
  34. package/dist/docs/recipes.md +1 -1
  35. package/dist/docs/space.md +1 -1
  36. package/dist/docs/status.md +1 -1
  37. package/dist/docs/surfaces.md +1 -1
  38. package/dist/docs/theming.md +1 -1
  39. package/dist/docs/type.md +1 -1
  40. package/dist/docs/webcomponents.md +1 -1
  41. package/dist/registry/items/contour-core.json +1 -1
  42. package/dist/registry/items/contour-data.json +2 -2
  43. package/dist/registry/items/contour-docs.json +1 -1
  44. package/dist/registry/items/contour-landing.json +2 -2
  45. package/dist/registry/registry.json +6 -6
  46. package/dist/surfaces/contour-data.min.css +1 -1
  47. package/dist/surfaces/contour-landing.min.css +1 -1
  48. package/dist/wc/core.mjs +13 -5
  49. package/dist/wc/data.mjs +687 -26
  50. package/dist/wc/index.mjs +1 -1
  51. package/dist/wc/interaction.mjs +3 -2
  52. package/dist/wc/map.mjs +189 -27
  53. package/dist/wc/shadow.mjs +29 -1
  54. package/dist/wc/svg.mjs +16 -1
  55. package/dist/wc/ui.mjs +77 -8
  56. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";export const REGISTERED=[];const DISPOSERS=new WeakMap();export const onDispose=(host,fn)=>{let list=DISPOSERS.get(host);if(!list){list=[];DISPOSERS.set(host,list)}list.push(fn)};const runDisposers=(host)=>{const list=DISPOSERS.get(host);if(!list)return;DISPOSERS.delete(host);for(const fn of list){try{fn()}catch(e){}}};let _contourIdCounter=0;export const contourId=(prefix)=>prefix+"-"+(++_contourIdCounter).toString(36);export const define=(name,cls)=>{if(customElements.get(name))return;customElements.define(name,cls);REGISTERED.push(name)};export const MODS=["variant","size","color"];export const CONTOUR_EVENTS=Object.freeze({"contour:activate":{payload:[],composed:true},"contour:add":{payload:["value"],composed:true},"contour:activity-select":{payload:["index","text"],composed:true},"contour:advanced-toggle":{payload:["title"],composed:true},"contour:affordance-activate":{payload:["name"],composed:true},"contour:bearing":{payload:["direction","degrees"],composed:true},"contour:btn-group-change":{payload:["index","label"],composed:true},"contour:change":{payload:["name","value","checked"],composed:true},"contour:close":{payload:[],composed:true},"contour:copy":{payload:["text"],composed:true},"contour:dash-action":{payload:["label"],composed:true},"contour:diff-activate":{payload:["kind","text"],composed:true},"contour:drag":{payload:["value"],composed:true},"contour:do-dont-activate":{payload:["kind","text"],composed:true},"contour:docs-nav-select":{payload:["label","href"],composed:true},"contour:dragend":{payload:["value"],composed:true},"contour:dragstart":{payload:["value"],composed:true},"contour:drop":{payload:["value","label"],composed:true},"contour:empty-action":{payload:["state"],composed:true},"contour:error":{payload:["src","message","name","status"],composed:true},"contour:hide":{payload:[],composed:true},"contour:input":{payload:["name","value","checked"],composed:true},"contour:layer-opacity":{payload:["name","opacity"],composed:true},"contour:layer-toggle":{payload:["name"],composed:true},"contour:layer-visibility":{payload:["name","visible"],composed:true},"contour:legend-toggle":{payload:["label","key","layers","pressed"],composed:true},"contour:load":{payload:["src","count"],composed:true},"contour:map-control":{payload:["control"],composed:true},"contour:map-attach":{payload:[],composed:true},"contour:map-detach":{payload:[],composed:true},"contour:move":{payload:["direction"],composed:true},"contour:open":{payload:[],composed:true},"contour:page":{payload:["page"],composed:true},"contour:ready":{payload:["version","count"],composed:true},"contour:remove":{payload:["label","key","layers","value"],composed:true},"contour:range-change":{payload:["value"],composed:true},"contour:retry":{payload:["src"],composed:true},"contour:select":{payload:["series","index","label","value"],composed:true},"contour:showcase-activate":{payload:["title"],composed:true},"contour:step-activate":{payload:["index","title"],composed:true},"contour:step-change":{payload:["index","title"],composed:true},"contour:show":{payload:[],composed:true},"contour:sort":{payload:["column","direction"],composed:true},"contour:stream-state":{payload:["running"],composed:true},"contour:tab-change":{payload:["index","label"],composed:true},"contour:theme-change":{payload:["theme"],composed:true},"contour:tick":{payload:["frame"],composed:true},"contour:time-change":{payload:["value"],composed:true},"contour:time-range-change":{payload:["value"],composed:true},"contour:toggle":{payload:["open","label"],composed:true},"contour:view-enter":{payload:[],composed:true},"contour:view-leave":{payload:[],composed:true},});export function sanitizeHtml(input){const str=String(input==null?"":input);if(typeof DOMParser==="undefined")return str;const doc=new DOMParser().parseFromString(str,"text/html");const drop=new Set(["script","iframe","object","embed","style","link","meta","base","form","input","button"]);const walk=(node)=>{const children=Array.from(node.childNodes);for(const c of children){if(c.nodeType===1){const tag=c.tagName.toLowerCase();if(drop.has(tag)){c.remove();continue}for(const attr of Array.from(c.attributes)){const name=attr.name.toLowerCase();if(name.startsWith("on")){c.removeAttribute(attr.name);continue}const val=String(attr.value||"").trim().toLowerCase();if((name==="href"||name==="src"||name==="xlink:href")&&(val.startsWith("javascript:")||val.startsWith("data:text/html"))){c.removeAttribute(attr.name)}}walk(c)}}};walk(doc.body);return doc.body.innerHTML}export const OBSERVED=["accept","action","actions","after","anchor","answer","area","article","attribution","attribution-mark","autoplay","axis","axis-x","axis-y","before","body","brand","breakpoint","cache-key","canvas","center","clearable","cols","columns","color","command","cells","checked","chrome","closable","colors","content","controls","copyable","count","current","date","delta","demo","density","desc","dir","direction","disabled","dismissible","divider","do","dont","dot","empty","error","exclusive","format","heading","hint","href","icon","illustration","index","instrument","interval","items","key","layers","label","lazy","lede","legend","line","link","links","live","loading","locale","max","media","message","method","month","menu","min","multiple","name","needle","next","no","no-cache","nodes","note","norm","options","orientation","page-size","pages","pause","paused","pausable","persist","placeholder","playing","point","points","prev","progress","prompt","question","recent","required","quote","ramp","refresh","removable","reverse","rings","retry","rows","scale","selectable","start","end","selected","separator","series","shortcut","side","size","skeleton","sort","sort-dir","speed","status","step","submit","timeout","trigger","virtual","state","steps","subtitle","summary","src","tabs","tag","text","ticks","title","type","unit","variant","values","viewport","yes","zoomable","x","y",];export function headingTag(host,fallback="h3"){const v=host&&host.getAttribute?host.getAttribute("heading"):null;return/^h[1-6]$/.test(v||"")?v:fallback}export class ContourBase extends HTMLElement{static formAssociated=false;constructor(){super();if(this.constructor.formAssociated&&typeof this.attachInternals==="function"){this._internals=this.attachInternals()}}static get observed(){return OBSERVED}static get observedAttributes(){return this.observed}static get properties(){return{}}get renderCount(){return this._contourRenderCount||0}_countRender(){this._contourRenderCount=(this._contourRenderCount||0)+1}static _propsInstalled=false;_installProperties(){const ctor=this.constructor;if(ctor._propsInstalled)return;ctor._propsInstalled=true;const props=ctor.properties||{};for(const[name,spec]of Object.entries(props)){const attr=(spec&&spec.attribute)||name;const type=(spec&&spec.type)||String;Object.defineProperty(ctor.prototype,name,{get(){const raw=this.getAttribute(attr);if(raw===null)return spec&&spec.default!==undefined?spec.default:null;if(type===Boolean)return true;if(type===Number){const n=Number(raw);return Number.isNaN(n)?null:n}return raw},set(v){if(v===null||v===undefined||v===false)this.removeAttribute(attr);else if(type===Boolean){if(v)this.setAttribute(attr,"");else this.removeAttribute(attr)}else this.setAttribute(attr,String(v))},configurable:true,})}}connectedCallback(){if(this._contourAuthored){this._wireFormData();return}this._installProperties();this._contourAuthored={nodes:Array.from(this.childNodes),cls:this.getAttribute("class"),};const before=Array.from(this.childNodes);this._contourRenderGen=(this._contourRenderGen||0)+1;this._ensureCache=new Map();this._ensureCacheGen=this._contourRenderGen;this._countRender();try{this.render()}catch(e){console.error("Contour render error:",e);this.textContent="Component failed to render."}this._contourGenerated=Array.from(this.childNodes).filter((n)=>!before.includes(n));this._applyParts(this);this._applyDensity();this.enhance();this._detachInnerFormControls();this._wireFormData()}attributeChangedCallback(name,oldValue,newValue){if(oldValue===newValue)return;if(!this.isConnected||!this._contourAuthored)return;if(this._batchDepth>0){this._batchDirty=true;return}if(this._contourRendering){if(!this._pendingRerender){this._pendingRerender=true;queueMicrotask(()=>{this._pendingRerender=false;if(!this.isConnected||!this._contourAuthored)return;this.attributeChangedCallback("__rerender__",null,"")})}return}if(name==="checked")this._checkedAttrChanged=true;this._contourRendering=true;try{const savedControls=Array.from(this.querySelectorAll("input, textarea, select"));const savedValues=savedControls.map((el)=>({key:el.name||el.id||null,value:el.value,checked:el.checked,type:el.type}));const hadFocus=this.contains(document.activeElement)?document.activeElement:null;const _focusableSelector="button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])";const _focusablesBefore=Array.from(this.querySelectorAll(_focusableSelector));const hadFocusIndex=hadFocus?_focusablesBefore.indexOf(hadFocus):-1;const hadFocusName=hadFocus?(hadFocus.getAttribute("name")||null):null;const savedScrolls=Array.from(this.querySelectorAll("*")).filter((el)=>el.scrollHeight>el.clientHeight||el.scrollWidth>el.clientWidth).map((el)=>({el,top:el.scrollTop,left:el.scrollLeft}));const savedDetails=Array.from(this.querySelectorAll("details")).map((d)=>({id:d.id||null,open:d.open}));for(const g of(this._contourGenerated||[])){if(!g||g.parentNode!==this)continue;let wrapper=null;if(g.classList&&(g.classList.contains("c-panel__body")||g.classList.contains("c-dialog__body")))wrapper=g;else if(g.tagName==="PRE")wrapper=g.querySelector("code")||g;if(wrapper){while(wrapper.firstChild)this.insertBefore(wrapper.firstChild,g)}}for(const g of(this._contourGenerated||[])){if(g.parentNode===this)this.removeChild(g)}const generated=new Set(this._contourGenerated||[]);const authoredNow=Array.from(this.childNodes).filter((n)=>!generated.has(n));this._contourAuthored.nodes=authoredNow;while(this.firstChild)this.removeChild(this.firstChild);for(const node of this._contourAuthored.nodes)this.appendChild(node);if(this._contourAuthored.cls===null)this.removeAttribute("class");else this.setAttribute("class",this._contourAuthored.cls);const before=Array.from(this.childNodes);this._contourRenderGen=(this._contourRenderGen||0)+1;this._ensureCache=new Map();this._ensureCacheGen=this._contourRenderGen;this._countRender();try{this.render()}catch(e){console.error("Contour render error:",e);this.textContent="Component failed to render."}this._contourGenerated=Array.from(this.childNodes).filter((n)=>!before.includes(n));this._applyParts(this);this._applyDensity();const newControls=Array.from(this.querySelectorAll("input, textarea, select"));const keyed=savedValues.filter((sv)=>sv.key);const unkeyed=savedValues.filter((sv)=>!sv.key);const used=new Set();for(const el of newControls){const key=el.name||el.id||null;if(!key)continue;const match=keyed.find((sv)=>sv.key===key&&!used.has(sv));if(!match)continue;used.add(match);if(el.value===""&&el.getAttribute("value")===null){el.value=match.value}if((el.type==="checkbox"||el.type==="radio")&&typeof match.checked==="boolean"&&!this._checkedAttrChanged){el.checked=match.checked}}let u=0;for(const el of newControls){if(el.name||el.id)continue;const saved=unkeyed[u];u+=1;if(!saved)continue;if(el.value===""&&el.getAttribute("value")===null){el.value=saved.value}if((el.type==="checkbox"||el.type==="radio")&&typeof saved.checked==="boolean"&&!this._checkedAttrChanged){el.checked=saved.checked}}const newDetails=Array.from(this.querySelectorAll("details"));const keyedDetails=savedDetails.filter((sd)=>sd.id);const usedIds=new Set();for(const d of newDetails){const id=d.id||null;if(!id)continue;const match=keyedDetails.find((sd)=>sd.id===id&&!usedIds.has(sd.id));if(!match)continue;usedIds.add(match.id);d.open=match.open}let di=0;const plainSaved=savedDetails.filter((sd)=>!sd.id);for(const d of newDetails){if(d.id)continue;const sd=plainSaved[di];di+=1;if(!sd)break;d.open=sd.open}const newScrolls=Array.from(this.querySelectorAll("*")).filter((el)=>el.scrollHeight>el.clientHeight||el.scrollWidth>el.clientWidth);const keyedScrolls=savedScrolls.filter((s)=>s.el.id);const usedScrolls=new Set();for(const el of newScrolls){const id=el.id||null;if(!id)continue;const match=keyedScrolls.find((s)=>s.el.id===id&&!usedScrolls.has(s.el));if(!match)continue;usedScrolls.add(match.el);el.scrollTop=match.top;el.scrollLeft=match.left}let si=0;const plainScrolls=savedScrolls.filter((s)=>!s.el.id);for(const el of newScrolls){if(el.id)continue;const s=plainScrolls[si];si+=1;if(!s)break;el.scrollTop=s.top;el.scrollLeft=s.left}if(hadFocus){let target=null;if(hadFocus.id){try{target=this.querySelector("#"+CSS.escape(hadFocus.id))}catch(e){target=null}}if(!target&&hadFocusName){try{target=this.querySelector('[name="'+CSS.escape(hadFocusName)+'"]')}catch(e){target=null}}if(!target&&hadFocusIndex>=0){const after=Array.from(this.querySelectorAll(_focusableSelector));if(after.length){target=after[Math.min(hadFocusIndex,after.length-1)]}}if(target&&typeof target.focus==="function"){try{target.focus()}catch(e){}}else if(document.contains(hadFocus)){try{hadFocus.focus()}catch(e){}}else{const first=this.querySelector(_focusableSelector);if(first)try{first.focus()}catch(e){}else try{this.focus()}catch(e){}}}this.enhance();this._detachInnerFormControls();this._checkedAttrChanged=false}finally{this._contourRendering=false}}disconnectedCallback(){this._pendingRerender=false;this._ensureCache=null;this._batchDepth=0;this._batchDirty=false;this._wiredFormData=false;runDisposers(this)}adoptedCallback(){if(this._contourAuthored){this._applyParts(this);this._applyDensity()}}enhance(){}_syncFormValue(){if(!this._internals)return;const ctl=this.querySelector("input:checked, textarea, select")||this.querySelector("input, textarea, select");if(!ctl)return;const boolean=ctl.type==="checkbox"||ctl.type==="radio";const value=boolean?(ctl.checked?(ctl.value||"on"):null):ctl.value;this._internals.setFormValue(value);this._syncValidity(this.hasAttribute("required")&&!value)}_syncValidity(valueMissing){if(!this._internals)return;if(valueMissing)this._internals.setValidity({valueMissing:true},"This field is required.");else this._internals.setValidity({});this._setCustomState("data-invalid",!!valueMissing)}_setCustomState(name,on){let internals=this._internals;if(!internals){if(this._stateInternals)internals=this._stateInternals;else if(typeof this.attachInternals==="function"){try{internals=this._stateInternals=this.attachInternals()}catch(e){return}}}const states=internals&&internals.states;if(!states)return;if(on){if(!states.has(name))states.add(name)}else if(states.has(name))states.delete(name)}_emitForm(type){if(!this._internals)return;const ctl=this.querySelector("input:checked, textarea, select")||this.querySelector("input, textarea, select");if(!ctl)return;const boolean=ctl.type==="checkbox"||ctl.type==="radio";this.dispatchEvent(new CustomEvent(type,{bubbles:true,composed:true,detail:{name:this.getAttribute("name"),value:boolean?(ctl.checked?(ctl.value||"on"):null):ctl.value,checked:boolean?ctl.checked:null,},}))}formResetCallback(){for(const ctl of this.querySelectorAll("input, textarea, select")){if(ctl.type==="checkbox"||ctl.type==="radio"){ctl.checked=this.hasAttribute("checked")}else if(ctl.tagName==="SELECT"){const chosen=ctl.querySelector("option[selected], option:first-of-type");ctl.value=chosen?chosen.value:""}else{ctl.value=this.hasAttribute("value")?this.getAttribute("value"):(ctl.getAttribute("value")||"")}}this._syncFormValue()}formDisabledCallback(disabled){for(const ctl of this.querySelectorAll("input, textarea, select, button")){if(disabled)ctl.setAttribute("disabled","");else ctl.removeAttribute("disabled")}}formStateRestoreCallback(state){if(!this._internals||state===null||state===undefined)return;const controls=Array.from(this.querySelectorAll("input, textarea, select"));const str=String(state);const match=controls.find((c)=>(c.type==="checkbox"||c.type==="radio")&&c.value===str);if(match){match.checked=true;for(const other of controls){if(other!==match&&other.type==="radio"&&other.name===match.name)other.checked=false}}else if(controls.length){controls[0].value=str}this._syncFormValue()}checkValidity(){return this._internals?this._internals.checkValidity():true}reportValidity(){return this._internals?this._internals.reportValidity():true}_wireFormData(){if(!this._internals||this._wiredFormData)return;const form=this._internals.form;if(!form)return;this._wiredFormData=true;const myName=this.getAttribute("name");const onFormChange=(e)=>{const t=e.target;if(t&&t.type==="radio"&&t.name&&t.name===myName)this._syncFormValue()};form.addEventListener("change",onFormChange);const onFormData=()=>this._syncFormValue();form.addEventListener("formdata",onFormData);onDispose(this,()=>{form.removeEventListener("change",onFormChange);form.removeEventListener("formdata",onFormData)})}_detachInnerFormControls(){if(!this._internals)return;for(const ctl of this.querySelectorAll("input, textarea, select")){if(ctl.hasAttribute("name")&&ctl.getAttribute("form")!=="")ctl.setAttribute("form","")}}batch(fn){if(typeof fn!=="function")return;this._batchDepth=(this._batchDepth||0)+1;this._batchDirty=this._batchDirty||false;try{fn()}finally{this._batchDepth-=1;if(this._batchDepth===0&&this._batchDirty){this._batchDirty=false;if(this.isConnected&&this._contourAuthored){this.attributeChangedCallback("__rerender__",null,"")}}}}requestRender(){if(this._contourRerenderQueued)return;this._contourRerenderQueued=true;queueMicrotask(()=>{this._contourRerenderQueued=false;if(!this.isConnected||!this._contourAuthored)return;this.attributeChangedCallback("__rerender__",null,"")})}_applyParts(root){const scope=root||this;const nodes=scope.querySelectorAll?Array.from(scope.querySelectorAll("[class]")):[];for(const node of nodes){if(node.hasAttribute("part"))continue;if(typeof node.className!=="string")continue;for(const c of node.className.split(/\s+/)){const m=c.match(/^c-[a-z0-9-]+__([a-z0-9-]+)$/);if(m){node.setAttribute("part",m[1]);break}}}}_applyDensity(){const density=this.getAttribute("density");if(density!==null)this.setAttribute("data-density",density);else if(this.hasAttribute("data-density"))this.removeAttribute("data-density")}_ownerBetween(node,root){for(let p=node.parentElement;p&&p!==root;p=p.parentElement){if(p instanceof ContourBase)return p}return null}ensure(selector,factory,parent){const root=parent||this;if(!root._ensureCache||root._ensureCacheGen!==this._contourRenderGen){root._ensureCache=new Map();root._ensureCacheGen=this._contourRenderGen}const cache=root._ensureCache;const key=root===this?selector:"\u0000"+root+"\u0000"+selector;let node=cache.get(key);if(node===undefined){node=null;for(const candidate of root.querySelectorAll(selector)){if(!this._ownerBetween(candidate,root)){node=candidate;break}}cache.set(key,node)}if(!node){node=factory();if(node&&node.setAttribute&&!node.hasAttribute("part")){const m=String(selector).match(/\.c-[a-z0-9-]+__([a-z0-9-]+)/);if(m)node.setAttribute("part",m[1])}root.appendChild(node);cache.set(key,node)}return node}}export const simple=(classes)=>class extends ContourBase{render(){classes.forEach((c)=>this.classList.add(c));for(const c of Array.from(this.classList)){if(classes.some((base)=>c.startsWith(base+"--")))this.classList.remove(c)}MODS.forEach((attr)=>{if(this.hasAttribute(attr)){const val=this.getAttribute(attr);classes.forEach((c)=>{const prefix=c.replace("c-","");this.classList.add(`c-${prefix}--${val}`)})}})}};export const CLASS_ONLY=["box","cluster","container","row","scrim","stack"];export function supportsUntilFound(){try{const t=document.createElement("div");t.setAttribute("hidden","until-found");return t.getAttribute("hidden")==="until-found"}catch(e){return false}}export function formatValue(value,format,locale){if(!format)return value;const loc=locale||(typeof navigator!=="undefined"&&navigator.language)||"en";if(format==="date"||format==="time"){try{const opts=format==="time"?{timeStyle:"short"}:undefined;return new Intl.DateTimeFormat(loc,opts).format(new Date(value))}catch(e){return value}}let opts={};if(format==="currency")opts={style:"currency",currency:"USD"};else if(format==="percent")opts={style:"percent"};else if(format==="compact")opts={notation:"compact"};else if(format!=="number"){try{opts=JSON.parse(format)}catch(e){return value}}try{return new Intl.NumberFormat(loc,opts).format(Number(value))}catch(e){return value}}"use strict";export function arcPath(cx,cy,r,inner,startAngle,endAngle){cx=Number.isFinite(cx)?cx:0;cy=Number.isFinite(cy)?cy:0;r=Number.isFinite(r)&&r>0?r:0;inner=Number.isFinite(inner)&&inner>=0?inner:0;startAngle=Number.isFinite(startAngle)?startAngle:0;endAngle=Number.isFinite(endAngle)?endAngle:0;const largeArc=endAngle-startAngle>Math.PI?1:0;const x1=cx+r*Math.cos(startAngle);const y1=cy+r*Math.sin(startAngle);const x2=cx+r*Math.cos(endAngle);const y2=cy+r*Math.sin(endAngle);if(inner<=0){return`M ${cx} ${cy} L ${x1} ${y1} A ${r} ${r} 0 ${largeArc} 1 ${x2} ${y2} Z`}const ix1=cx+inner*Math.cos(endAngle);const iy1=cy+inner*Math.sin(endAngle);const ix2=cx+inner*Math.cos(startAngle);const iy2=cy+inner*Math.sin(startAngle);return`M ${x1} ${y1} A ${r} ${r} 0 ${largeArc} 1 ${x2} ${y2} L ${ix1} ${iy1} A ${inner} ${inner} 0 ${largeArc} 0 ${ix2} ${iy2} Z`}export function donutSlices(values,opts){opts=opts||{};const cx=opts.cx!=null?opts.cx:100;const cy=opts.cy!=null?opts.cy:100;const r=opts.r!=null?opts.r:90;const inner=opts.inner!=null?opts.inner:55;const gap=opts.gap!=null?opts.gap:0.02;const total=values.reduce((a,b)=>a+(Number(b)||0),0)||1;let angle=-Math.PI/2;const out=[];values.forEach((v,i)=>{const num=Number(v)||0;const frac=num/total;if(!(num>0)){angle+=frac*Math.PI*2;return}const sweep=frac*Math.PI*2-gap;const start=angle+gap/2;const end=start+Math.max(0,sweep);out.push({path:arcPath(cx,cy,r,inner,start,end),value:num,index:i});angle+=frac*Math.PI*2});return out}export function barRects(values,opts){opts=opts||{};const width=opts.width!=null?opts.width:300;const height=opts.height!=null?opts.height:120;const gap=opts.gap!=null?opts.gap:2;const max=opts.max!=null?opts.max:(Math.max.apply(null,values.map((v)=>Number(v)||0))||1);if(!Number.isFinite(max)||max<=0)return values.map(()=>({x:0,y:height,width:0,height:0}));const n=values.length||1;const slot=width/n;const barW=Math.max(1,slot-gap);return values.map((v,i)=>{const h=((Number(v)||0)/max)*height;return{x:i*slot+gap/2,y:height-h,width:barW,height:h}})}export function polylinePoints(values,opts){opts=opts||{};const width=opts.width!=null?opts.width:300;const height=opts.height!=null?opts.height:120;const nums=values.map((v)=>Number(v)||0);if(!nums.length)return"";const max=opts.max!=null?opts.max:Math.max.apply(null,nums);const min=opts.min!=null?opts.min:Math.min.apply(null,nums);const range=(Number.isFinite(max-min)&&(max-min)!==0)?(max-min):1;const n=nums.length||1;return nums.map((v,i)=>{const x=(i/Math.max(1,n-1))*width;const y=height-((v-min)/range)*height;return x.toFixed(2)+","+y.toFixed(2)}).join(" ")}export function smoothPath(values,opts){const pts=polylinePoints(values,opts).split(" ").map((p)=>p.split(",").map(Number));if(!pts.length)return"";let d=`M ${pts[0][0]} ${pts[0][1]}`;for(let i=1;i<pts.length;i++){const prev=pts[i-1];const cur=pts[i];const cpx=(prev[0]+cur[0])/2;d+=` C ${cpx} ${prev[1]}, ${cpx} ${cur[1]}, ${cur[0]} ${cur[1]}`}return d}export function compassNeedle(cx,cy,length,angleDeg,width){angleDeg=angleDeg==null?0:angleDeg;width=width==null?3:width;const a=(angleDeg-90)*Math.PI/180;const tipX=cx+length*Math.cos(a);const tipY=cy+length*Math.sin(a);const tail=length*0.25;const tailX=cx-tail*Math.cos(a);const tailY=cy-tail*Math.sin(a);const perpX=Math.cos(a+Math.PI/2);const perpY=Math.sin(a+Math.PI/2);const b1x=cx+width*perpX;const b1y=cy+width*perpY;const b2x=cx-width*perpX;const b2y=cy-width*perpY;return`M ${tipX.toFixed(2)} ${tipY.toFixed(2)} L ${b1x.toFixed(2)} ${b1y.toFixed(2)} L ${tailX.toFixed(2)} ${tailY.toFixed(2)} L ${b2x.toFixed(2)} ${b2y.toFixed(2)} Z`}export function scaleBarTicks(value,segments){value=Number(value)||0;segments=Math.max(1,Math.round(segments||4));const out=[];for(let i=0;i<=segments;i++){out.push((value/segments)*i)}return out}const WIRED_HOSTS=new WeakMap();export const wcReset=(host)=>{WIRED_HOSTS.delete(host)};const wcClaim=(host,name)=>{let set=WIRED_HOSTS.get(host);if(!set){set=new Set();WIRED_HOSTS.set(host,set)}if(set.has(name))return false;set.add(name);return true};const wcScopes=(host)=>(host.shadowRoot?[host,host.shadowRoot]:[host]);const wcAll=(host,sel)=>{const found=[];for(const scope of wcScopes(host)){for(const el of scope.querySelectorAll(sel))if(!found.includes(el))found.push(el)}return found};const wcOne=(host,sel)=>wcAll(host,sel)[0]||null;const wcSelfOrAll=(host,sel)=>{const found=typeof host.matches==="function"&&host.matches(sel)?[host]:[];for(const el of wcAll(host,sel))if(!found.includes(el))found.push(el);return found};const wcShadowOf=(node)=>{const root=node&&node.getRootNode?node.getRootNode():null;return root&&root.host?root:null};const wcGroup=(host,group,sel)=>{const found=Array.from(group.querySelectorAll(sel));if(wcShadowOf(group)&&wcShadowOf(group).host===host){for(const el of host.querySelectorAll(sel))if(!found.includes(el))found.push(el)}return found};const HEARD=new WeakMap();const wcListen=(host,type,handler)=>{const scoped=(e)=>{let seen=HEARD.get(e);if(!seen){seen=new Set();HEARD.set(e,seen)}if(seen.has(scoped))return;seen.add(scoped);handler(e)};for(const scope of wcScopes(host))scope.addEventListener(type,scoped)};const wcOwned=(host,node)=>!!node&&wcScopes(host).some((scope)=>scope.contains(node));const wcClosest=(host,target,sel)=>(typeof target?.closest==="function"&&wcOwned(host,target))?target.closest(sel):null;const wcEmit=(host,name,detail)=>{host.dispatchEvent(new CustomEvent(name,{detail,bubbles:true,composed:true}))};function isRtl(host){let el=host;while(el&&el.nodeType===1){const d=el.getAttribute&&el.getAttribute("dir");if(d)return d.toLowerCase()==="rtl";el=el.parentElement}try{return(document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl"}catch(e){return false}}export function wireTabs(host){if(!wcClaim(host,"tabs"))return;for(const list of wcSelfOrAll(host,".c-tabs__list, .c-code-tabs__list")){const isCode=list.classList.contains("c-code-tabs__list");const panelSel=isCode?".c-code-tabs__panel":".c-tabs__panel";const tabsOf=()=>wcGroup(host,list,"[role='tab']");const activate=(tab,focus)=>{const tabs=tabsOf();tabs.forEach((t)=>{const selected=t===tab;t.setAttribute("aria-selected",String(selected));t.tabIndex=selected?0:-1;const ctrl=t.getAttribute("aria-controls");if(!ctrl)return;const panel=wcOne(host,"#"+CSS.escape(ctrl))||document.getElementById(ctrl);if(panel)panel.hidden=!selected});const panels=wcAll(host,panelSel);if(panels.length){const index=tabs.indexOf(tab);panels.forEach((p,i)=>{p.hidden=i!==index})}if(focus)try{tab.focus()}catch(e){}const name=tab.getAttribute("aria-controls")||tab.textContent||"";host.dispatchEvent(new CustomEvent("contour:tab-change",{bubbles:true,composed:true,detail:{index:tabs.indexOf(tab),label:name}}))};const runActivation=(tab,focus)=>{const can=!focus&&typeof document.startViewTransition==="function"&&!(typeof matchMedia==="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches);if(can){try{document.startViewTransition(()=>activate(tab,focus));return}catch(e){}}activate(tab,focus)};wcListen(host,"click",(e)=>{const tab=wcClosest(host,e.target,"[role='tab']");if(tab&&tabsOf().includes(tab))runActivation(tab,false)});wcListen(host,"keydown",(e)=>{let tab=wcClosest(host,e.target,"[role='tab']");if(!tab&&e.target&&e.target.getAttribute&&e.target.getAttribute("role")==="tab"&&wcOwned(host,e.target))tab=e.target;const tabs=tabsOf();const index=tabs.indexOf(tab);if(index<0)return;const vertical=host.getAttribute("orientation")==="vertical";const rtl=isRtl(host);const move=vertical?(rtl?{ArrowDown:index-1,ArrowUp:index+1,Home:tabs.length-1,End:0}:{ArrowDown:index+1,ArrowUp:index-1,Home:0,End:tabs.length-1}):(rtl?{ArrowRight:index-1,ArrowLeft:index+1,Home:tabs.length-1,End:0}:{ArrowRight:index+1,ArrowLeft:index-1,Home:0,End:tabs.length-1});if(!(e.key in move))return;e.preventDefault();const next=tabs[(move[e.key]+tabs.length)%tabs.length];if(next)runActivation(next,true)});const tabs=tabsOf();const persist=host.getAttribute("persist");let restored=null;if(persist==="storage"&&host.id){try{restored=localStorage.getItem("contour-tabs:"+host.id)}catch(e){restored=null}}else if(persist==="url"){try{const params=new URLSearchParams(window.location.search);const v=params.get("c-tabs");if(v!==null)restored=v}catch(e){restored=null}}const marked=tabs.find((t)=>t.getAttribute("aria-selected")==="true");let first=marked||tabs[0];if(restored!==null){const idx=parseInt(restored,10);if(Number.isFinite(idx)&&tabs[idx])first=tabs[idx]}if(first)activate(first,false);if(persist==="storage"&&host.id){host.addEventListener("contour:tab-change",(e)=>{try{localStorage.setItem("contour-tabs:"+host.id,String(e.detail&&e.detail.index))}catch(err){}})}else if(persist==="url"){host.addEventListener("contour:tab-change",(e)=>{try{const url=new URL(window.location.href);url.searchParams.set("c-tabs",String(e.detail&&e.detail.index));window.history.replaceState(null,"",url.toString())}catch(err){}})}}}export function wireSegmented(host){const groups=wcSelfOrAll(host,".c-segmented");const normalize=()=>{const authored=host.getAttribute("value");const chosen=authored!==host._segAuthorValue?authored:null;if(chosen!==null)host._segAuthorValue=authored;let seen=0;for(const g of groups){if(!g.hasAttribute("role"))g.setAttribute("role","group");const label=host.getAttribute("label");if(label&&!g.hasAttribute("aria-label"))g.setAttribute("aria-label",label);const opts=wcGroup(host,g,"button");seen+=opts.length;opts.forEach((b)=>{b.classList.add("c-segmented__option");b.setAttribute("aria-pressed",chosen!==null&&chosen!==undefined?String(b.dataset.value===chosen):(b.getAttribute("aria-pressed")==="true"?"true":"false"))});const chosenOpt=opts.find((b)=>b.getAttribute("aria-pressed")==="true")||opts[0];opts.forEach((b)=>{b.tabIndex=b===chosenOpt?0:-1})}return seen};if(!normalize()){if(!host._segRetryScheduled){host._segRetryScheduled=true;setTimeout(()=>{host._segRetryScheduled=false;normalize()},0)}}if(!wcClaim(host,"segmented"))return;const activate=(btn)=>{const seg=groups.find((g)=>wcGroup(host,g,"button").includes(btn));if(!seg)return;wcGroup(host,seg,"button").forEach((o)=>{const on=o===btn;o.setAttribute("aria-pressed",String(on));o.tabIndex=on?0:-1});wcEmit(host,"contour:change",{value:btn.dataset.value||btn.textContent.trim()})};wcListen(host,"click",(e)=>{const btn=wcClosest(host,e.target,"button");if(!btn)return;activate(btn)});wcListen(host,"keydown",(e)=>{const btn=wcClosest(host,e.target,"button");if(!btn)return;const seg=groups.find((g)=>wcGroup(host,g,"button").includes(btn));if(!seg)return;const opts=wcGroup(host,seg,"button");const idx=opts.indexOf(btn);let next=-1;const rtl=isRtl(host);if(e.key==="ArrowRight"||e.key==="ArrowDown")next=rtl?Math.max(idx-1,0):Math.min(idx+1,opts.length-1);else if(e.key==="ArrowLeft"||e.key==="ArrowUp")next=rtl?Math.min(idx+1,opts.length-1):Math.max(idx-1,0);else if(e.key==="Home")next=0;else if(e.key==="End")next=opts.length-1;else if(e.key==="Enter"||e.key===" "){e.preventDefault();activate(btn);return}if(next>=0&&next!==idx){e.preventDefault();opts[next].focus()}})}export function wireCombobox(host){wireComboboxDocDismiss();const input=wcOne(host,".c-combobox__input");const list=wcOne(host,".c-combobox__list");if(!input||!list)return;const optionList=()=>wcAll(host,".c-combobox__option");if(!list.id)list.id=contourId("c-combobox-list");list.setAttribute("role","listbox");input.setAttribute("role","combobox");input.setAttribute("aria-haspopup","listbox");input.setAttribute("aria-controls",list.id);input.setAttribute("aria-expanded",list.hasAttribute("hidden")?"false":"true");if(!input.hasAttribute("aria-autocomplete"))input.setAttribute("aria-autocomplete","list");optionList().forEach((opt,i)=>{if(!opt.id)opt.id=contourId("c-combobox-option");opt.setAttribute("role","option");if(!opt.hasAttribute("aria-selected"))opt.setAttribute("aria-selected","false")});if(!wcClaim(host,"combobox"))return;const liveInput=()=>wcOne(host,".c-combobox__input");const liveList=()=>wcOne(host,".c-combobox__list");let cursor=-1;const mark=(visible)=>{const field=liveInput();visible.forEach((o,i)=>{const on=i===cursor;o.classList.toggle("c-combobox__option--active",on);o.setAttribute("aria-selected",String(on))});if(field){const active=cursor>=0?visible[cursor]:null;if(active)field.setAttribute("aria-activedescendant",active.id);else field.removeAttribute("aria-activedescendant")}};const filter=(query)=>{const q=(query||"").toLowerCase();optionList().forEach((o)=>{o.hidden=!!(q&&!o.textContent.toLowerCase().includes(q))});cursor=-1};const open=()=>{const l=liveList();if(!l)return;l.removeAttribute("hidden");const field=liveInput();if(field)field.setAttribute("aria-expanded","true")};const close=()=>{const l=liveList();if(l)l.setAttribute("hidden","");const field=liveInput();if(field){field.setAttribute("aria-expanded","false");field.removeAttribute("aria-activedescendant")}cursor=-1;optionList().forEach((o)=>{o.classList.remove("c-combobox__option--active");o.setAttribute("aria-selected","false")})};const commit=(opt)=>{const field=liveInput();if(!field)return;if(host.hasAttribute("multiple")){const now=opt.getAttribute("aria-selected")==="true";opt.setAttribute("aria-selected",String(!now));opt.classList.toggle("c-combobox__option--selected",!now);const selected=optionList().filter((o)=>o.getAttribute("aria-selected")==="true").map((o)=>o.textContent.trim());host.setAttribute("value",selected.join(","));if(typeof host._syncFormValue==="function")host._syncFormValue();wcEmit(host,"contour:select",{value:selected});field.focus();return}field.value=opt.textContent;wcEmit(host,"contour:select",{value:field.value});close();field.focus()};const isField=(target)=>wcClosest(host,target,".c-combobox__input")!==null;wcListen(host,"input",(e)=>{if(!isField(e.target))return;filter(e.target.value);open();if(typeof host._emitForm==="function")host._emitForm("contour:input")});wcListen(host,"focusin",(e)=>{if(!isField(e.target))return;filter(e.target.value);open()});wcListen(host,"keydown",(e)=>{if(!isField(e.target))return;const visible=optionList().filter((o)=>!o.hidden);if(e.key==="ArrowDown"){e.preventDefault();cursor=Math.min(cursor+1,visible.length-1);mark(visible)}else if(e.key==="ArrowUp"){e.preventDefault();cursor=Math.max(cursor-1,0);mark(visible)}else if(e.key==="Enter"){e.preventDefault();if(cursor>=0&&visible[cursor])commit(visible[cursor])}else if(e.key==="Escape")close()});wcListen(host,"click",(e)=>{const opt=wcClosest(host,e.target,".c-combobox__option");if(opt){commit(opt);return}if(!wcOwned(host,e.target)||!host.contains(e.target))close()})}let _comboboxDocWired=false;function wireComboboxDocDismiss(){if(_comboboxDocWired)return;_comboboxDocWired=true;document.addEventListener("click",(e)=>{for(const host of document.querySelectorAll("contour-combobox, contour-shadow-combobox")){const list=host.shadowRoot?host.shadowRoot.querySelector(".c-combobox__list"):host.querySelector(".c-combobox__list");const input=host.shadowRoot?host.shadowRoot.querySelector(".c-combobox__input"):host.querySelector(".c-combobox__input");if(!list||list.hasAttribute("hidden"))continue;const root=host.shadowRoot||host;if(root.contains(e.target))continue;list.setAttribute("hidden","")}})}const visibleStops=(host)=>wcAll(host,".c-tree__toggle, .c-tree__leaf").filter((el)=>!el.closest(".c-tree__children[hidden]"));export function wireTree(host){const nodes=()=>wcAll(host,".c-tree__node");const rootList=wcSelfOrAll(host,"ul.c-tree")[0];if(rootList&&!rootList.hasAttribute("role"))rootList.setAttribute("role","tree");wcAll(host,".c-tree__children").forEach((ul)=>{if(!ul.hasAttribute("role"))ul.setAttribute("role","group")});const levelOf=(node)=>{let level=1;for(let p=node.parentElement;p;p=p.parentElement)if(p.classList&&p.classList.contains("c-tree__children"))level++;return level};nodes().forEach((node)=>{if(node.getAttribute("role")!=="treeitem")node.setAttribute("role","treeitem");node.setAttribute("aria-level",String(levelOf(node)));const row=node.querySelector(":scope > .c-tree__row");if(row)node.setAttribute("aria-expanded",row.getAttribute("aria-expanded")||"false");else if(node.hasAttribute("aria-expanded"))node.removeAttribute("aria-expanded")});const stops=visibleStops(host);const authored=stops.find((el)=>el.getAttribute("tabindex")==="0");const active=authored||stops.find((el)=>el===document.activeElement)||stops[0];stops.forEach((el)=>el.setAttribute("tabindex",el===active?"0":"-1"));wcAll(host,".c-tree__toggle, .c-tree__leaf").forEach((el)=>{if(!stops.includes(el))el.setAttribute("tabindex","-1")});if(!wcClaim(host,"tree"))return;host._selectedTree=host._selectedTree||new Set();let lastTreeIndex=-1;wcListen(host,"change",(e)=>{const cb=e.target&&e.target.closest?e.target.closest(".c-tree__select"):null;if(!cb||!host.contains(cb))return;const cbs=Array.from(host.querySelectorAll(".c-tree__select"));const idx=cbs.indexOf(cb);const label=(cb.parentElement&&cb.parentElement.textContent||"").trim().slice(0,120);if(e.shiftKey&&lastTreeIndex>=0){const from=Math.min(lastTreeIndex,idx);const to=Math.max(lastTreeIndex,idx);for(let i=from;i<=to;i++){cbs[i].checked=cb.checked;const lbl=(cbs[i].parentElement&&cbs[i].parentElement.textContent||"").trim().slice(0,120);if(cb.checked)host._selectedTree.add(lbl);else host._selectedTree.delete(lbl)}}else if(!e.ctrlKey&&!e.metaKey){if(cb.checked){cbs.forEach((c,i)=>{if(i!==idx&&c.checked){c.checked=false;const lbl=(c.parentElement&&c.parentElement.textContent||"").trim().slice(0,120);host._selectedTree.delete(lbl)}})}if(cb.checked)host._selectedTree.add(label);else host._selectedTree.delete(label)}else{if(cb.checked)host._selectedTree.add(label);else host._selectedTree.delete(label)}lastTreeIndex=idx;wcEmit(host,"contour:select",{labels:Array.from(host._selectedTree)})});wcAll(host,".c-tree__node, .c-tree__leaf").forEach((n)=>{if(!n.hasAttribute("draggable"))n.setAttribute("draggable","true")});let dragLabel=null;wcListen(host,"dragstart",(e)=>{const node=wcClosest(host,e.target,".c-tree__node, .c-tree__leaf");if(!node)return;dragLabel=(node.textContent||"").trim().slice(0,120);if(e.dataTransfer){e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",dragLabel)}catch(err){}}});wcListen(host,"dragover",(e)=>{const node=wcClosest(host,e.target,".c-tree__node, .c-tree__leaf");if(!node)return;e.preventDefault();if(e.dataTransfer)e.dataTransfer.dropEffect="move"});wcListen(host,"drop",(e)=>{const node=wcClosest(host,e.target,".c-tree__node, .c-tree__leaf");if(!node||!dragLabel)return;e.preventDefault();const toLabel=(node.textContent||"").trim().slice(0,120);if(toLabel&&toLabel!==dragLabel){wcEmit(host,"contour:move",{from:dragLabel,to:toLabel})}dragLabel=null});const persist=host.getAttribute("persist");if(persist==="storage"&&host.id){try{const saved=localStorage.getItem("contour-tree:"+host.id);if(saved!==null){const labels=JSON.parse(saved);if(Array.isArray(labels)){const want=new Set(labels.map((l)=>String(l)));wcAll(host,".c-tree__row").forEach((row)=>{if(row.getAttribute("aria-expanded")==="true")return;const label=(row.textContent||"").trim().slice(0,120);if(!want.has(label))return;const toggle=row.querySelector(":scope > .c-tree__toggle");if(!toggle)return;const node=row.closest(".c-tree__node");const children=node?node.querySelector(":scope > .c-tree__children"):null;toggle.setAttribute("aria-expanded","true");row.setAttribute("aria-expanded","true");if(node)node.setAttribute("aria-expanded","true");if(children)children.removeAttribute("hidden")})}}}catch(e){}}else if(persist==="url"){try{const v=new URLSearchParams(window.location.search).get("c-tree");if(v!==null){const labels=JSON.parse(v);if(Array.isArray(labels)){const want=new Set(labels.map((l)=>String(l)));wcAll(host,".c-tree__row").forEach((row)=>{if(row.getAttribute("aria-expanded")==="true")return;const label=(row.textContent||"").trim().slice(0,120);if(!want.has(label))return;const toggle=row.querySelector(":scope > .c-tree__toggle");if(!toggle)return;const node=row.closest(".c-tree__node");const children=node?node.querySelector(":scope > .c-tree__children"):null;toggle.setAttribute("aria-expanded","true");row.setAttribute("aria-expanded","true");if(node)node.setAttribute("aria-expanded","true");if(children)children.removeAttribute("hidden")})}}}catch(e){}}const toggleNode=(toggle)=>{const wasOpen=toggle.getAttribute("aria-expanded")==="true";toggle.setAttribute("aria-expanded",String(!wasOpen));const row=toggle.closest(".c-tree__row")||toggle.parentElement;if(row)row.setAttribute("aria-expanded",String(!wasOpen));const node=toggle.closest(".c-tree__node");const children=node?node.querySelector(":scope > .c-tree__children"):null;if(children){if(wasOpen){if(supportsUntilFound())children.setAttribute("hidden","until-found");else children.hidden=true}else{children.removeAttribute("hidden")}}if(node)node.setAttribute("aria-expanded",String(!wasOpen));wcEmit(host,"contour:toggle",{open:!wasOpen,label:(row?row.textContent:"").trim().slice(0,120)});if(persist==="storage"&&host.id){try{const open=[];wcAll(host,".c-tree__row").forEach((r)=>{if(r.getAttribute("aria-expanded")==="true")open.push((r.textContent||"").trim().slice(0,120))});localStorage.setItem("contour-tree:"+host.id,JSON.stringify(open))}catch(e){}}else if(persist==="url"){try{const open=[];wcAll(host,".c-tree__row").forEach((r)=>{if(r.getAttribute("aria-expanded")==="true")open.push((r.textContent||"").trim().slice(0,120))});const url=new URL(window.location.href);url.searchParams.set("c-tree",JSON.stringify(open));window.history.replaceState(null,"",url.toString())}catch(e){}}};const branchOf=(el)=>(el.classList&&el.classList.contains("c-tree__toggle")?el:null);const stopsOf=()=>visibleStops(host);const rove=(keep)=>{wcAll(host,".c-tree__toggle, .c-tree__leaf").forEach((el)=>el.setAttribute("tabindex",el===keep?"0":"-1"))};wcListen(host,"click",(e)=>{let toggle=wcClosest(host,e.target,".c-tree__toggle");if(!toggle){const row=wcClosest(host,e.target,".c-tree__row");if(row)toggle=row.querySelector(":scope > .c-tree__toggle")}if(!toggle)return;e.preventDefault();e.stopPropagation();toggleNode(toggle)});wcListen(host,"focusin",(e)=>{if(!wcClosest(host,e.target,".c-tree__toggle, .c-tree__leaf"))return;rove(e.target)});wcListen(host,"keydown",(e)=>{const toggle=wcClosest(host,e.target,".c-tree__toggle, .c-tree__leaf");if(!toggle)return;const items=stopsOf();const idx=items.indexOf(toggle);if(e.key==="Enter"||e.key===" "){if(branchOf(toggle)){e.preventDefault();toggleNode(toggle)}return}if(e.key==="ArrowRight"){const branch=branchOf(toggle);const closed=branch&&branch.getAttribute("aria-expanded")==="false";e.preventDefault();if(closed){toggleNode(branch);rove(toggle)}else{const next=items[idx+1];if(next){next.focus();rove(next)}}return}if(e.key==="ArrowLeft"){const branch=branchOf(toggle);if(branch&&branch.getAttribute("aria-expanded")==="true"){e.preventDefault();toggleNode(branch);rove(toggle)}else{const parent=toggle.closest(".c-tree__children");const owner=parent?parent.closest(".c-tree__node"):null;const up=owner?owner.querySelector(":scope > .c-tree__row > .c-tree__toggle"):null;if(up){e.preventDefault();up.focus();rove(up)}}return}let next=-1;if(e.key==="ArrowDown")next=Math.min(idx+1,items.length-1);else if(e.key==="ArrowUp")next=Math.max(idx-1,0);else if(e.key==="Home")next=0;else if(e.key==="End")next=items.length-1;if(next>=0&&next!==idx){e.preventDefault();items[next].focus();rove(items[next])}})}export function wireMenu(host){wcAll(host,"[role='menuitem']").forEach((it)=>{if(!it.hasAttribute("tabindex"))it.setAttribute("tabindex",it.getAttribute("aria-disabled")==="true"?"-1":"-1")});const all=()=>wcAll(host,"[role='menuitem']");if(!all().some((it)=>it.getAttribute("tabindex")==="0")&&all().length){const first=all().find((it)=>it.getAttribute("aria-disabled")!=="true");if(first)first.setAttribute("tabindex","0")}if(!wcClaim(host,"menu"))return;const submenusOf=(item)=>item.querySelector(":scope > ul.c-menu, :scope > .c-menu");const closeAllSubmenus=()=>{wcAll(host,"[aria-haspopup='menu']").forEach((it)=>it.setAttribute("aria-expanded","false"))};wcListen(host,"keydown",(e)=>{const its=all().filter((it)=>it.getAttribute("aria-disabled")!=="true");if(!its.length)return;const index=its.indexOf(e.target);const target=index>=0?its[index]:null;const sub=target?submenusOf(target):null;if(target&&target.getAttribute("aria-haspopup")==="menu"&&(e.key==="ArrowRight"||e.key==="Enter"||e.key===" ")){if(sub){e.preventDefault();closeAllSubmenus();target.setAttribute("aria-expanded","true");const firstSub=sub.querySelector("[role='menuitem']");if(firstSub){firstSub.setAttribute("tabindex","0");try{firstSub.focus()}catch(err){}}return}}if(e.key==="ArrowLeft"||e.key==="Escape"){const parent=target?target.closest("ul.c-menu"):null;let ancestor=null;if(target){const ul=target.parentElement&&target.parentElement.tagName==="UL"?target.parentElement:null;let node=target.parentElement;while(node&&node!==host){if(node.getAttribute&&node.getAttribute("aria-haspopup")==="menu"&&node.contains(target)&&node!==target){ancestor=node;break}node=node.parentElement}}if(ancestor){e.preventDefault();ancestor.setAttribute("aria-expanded","false");try{ancestor.focus()}catch(err){}return}if(e.key==="Escape"){closeAllSubmenus()}}let next=-1;if(e.key==="ArrowDown")next=index<0?0:Math.min(index+1,its.length-1);else if(e.key==="ArrowUp")next=index<0?its.length-1:Math.max(index-1,0);else if(e.key==="Home")next=0;else if(e.key==="End")next=its.length-1;if(next>=0){e.preventDefault();its[next].focus();return}if((e.key==="Enter"||e.key===" ")&&index>=0&&!(target&&target.getAttribute("aria-haspopup")==="menu")){e.preventDefault();wcEmit(host,"contour:select",{index,label:its[index].textContent.trim()});closeAllSubmenus()}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){const ch=e.key.toLowerCase();const match=its.findIndex((it)=>(it.textContent||"").trim().toLowerCase().startsWith(ch));if(match>=0){e.preventDefault();its[match].focus()}}});wcListen(host,"click",(e)=>{const item=wcClosest(host,e.target,"[role='menuitem']");if(!item)return;if(item.getAttribute("aria-disabled")==="true")return;if(item.getAttribute("aria-haspopup")==="menu"){const sub=submenusOf(item);if(sub){const open=item.getAttribute("aria-expanded")==="true";closeAllSubmenus();item.setAttribute("aria-expanded",open?"false":"true");return}}const index=all().indexOf(item);if(index>=0){wcEmit(host,"contour:select",{index,label:item.textContent.trim()});closeAllSubmenus();if(typeof host.hidePopover==="function"){try{host.hidePopover()}catch(e){}}}})}export function wirePagination(host){wcAll(host,".c-pagination__link").forEach((b)=>{if(!b.hasAttribute("tabindex"))b.setAttribute("tabindex","0")});if(!wcClaim(host,"pagination"))return;const activate=(btn)=>{const page=parseInt(btn.textContent,10);if(!Number.isFinite(page))return;wcAll(host,".c-pagination__link").forEach((b)=>{if(parseInt(b.textContent,10)===page)b.setAttribute("aria-current","page");else b.removeAttribute("aria-current")});host.setAttribute("page",String(page));wcEmit(host,"contour:page",{page});if(host.getAttribute("persist")==="storage"&&host.id){try{localStorage.setItem("contour-pagination:"+host.id,String(page))}catch(e){}}else if(host.getAttribute("persist")==="url"){try{const url=new URL(window.location.href);url.searchParams.set("c-pagination",String(page));window.history.replaceState(null,"",url.toString())}catch(e){}}};wcListen(host,"click",(e)=>{const btn=wcClosest(host,e.target,".c-pagination__link");if(!btn)return;e.preventDefault();const action=btn.getAttribute("data-action");if(action==="prev"||action==="next"){const links=wcAll(host,".c-pagination__link").filter((b)=>!b.getAttribute("data-action"));const cur=links.find((b)=>b.getAttribute("aria-current")==="page");const curPage=cur?(parseInt(cur.textContent,10)||1):1;const page=action==="prev"?Math.max(1,curPage-1):Math.min(links.length,curPage+1);const target=links.find((b)=>parseInt(b.textContent,10)===page);if(target){activate(target);return}}activate(btn)});wcListen(host,"keydown",(e)=>{const btn=wcClosest(host,e.target,".c-pagination__link");if(!btn)return;const links=wcAll(host,".c-pagination__link");const idx=links.indexOf(btn);let next=-1;const rtl=isRtl(host);if(e.key==="ArrowRight")next=rtl?Math.max(idx-1,0):Math.min(idx+1,links.length-1);else if(e.key==="ArrowLeft")next=rtl?Math.min(idx+1,links.length-1):Math.max(idx-1,0);else if(e.key==="Home")next=0;else if(e.key==="End")next=links.length-1;else if(e.key==="Enter"||e.key===" "){e.preventDefault();activate(btn);return}if(next>=0&&next!==idx){e.preventDefault();links[next].focus()}})}export function wireCopy(host){if(!wcClaim(host,"copy"))return;wcListen(host,"click",(e)=>{const btn=wcClosest(host,e.target,".c-code__copy, .c-install__copy");if(!btn)return;const owner=wcClosest(host,btn,".c-code")||wcClosest(host,btn,".c-install")||host;const src=owner.querySelector("code, .c-install__command");const text=(src?src.textContent:owner.textContent)||"";const confirm=(ok)=>{const icon=btn.querySelector("use");const originalHref=icon&&icon.getAttribute("href");const originalLabel=btn.getAttribute("aria-label")||btn.title||"";if(ok&&icon)icon.setAttribute("href","#i-check");btn.setAttribute("aria-label",ok?"Copied":"Copy failed");btn.dataset.copied=String(ok);const timer=setTimeout(()=>{if(!btn.isConnected)return;if(icon&&originalHref)icon.setAttribute("href",originalHref);btn.setAttribute("aria-label",originalLabel);delete btn.dataset.copied},1600);onDispose(host,()=>clearTimeout(timer))};if(navigator.clipboard)navigator.clipboard.writeText(text).then(()=>confirm(true)).catch(()=>confirm(false));wcEmit(host,"contour:copy",{text})})}export function wireRemovable(host){if(!wcClaim(host,"removable"))return;wcListen(host,"click",(e)=>{const drop=(node)=>{if(node&&node.parentNode)node.parentNode.removeChild(node)};const tagBtn=wcClosest(host,e.target,".c-tag__remove");if(tagBtn){e.preventDefault();const tag=wcClosest(host,tagBtn,".c-tag");wcEmit(host,"contour:remove",{label:(tag&&tag.getAttribute("label"))||(tag?tag.textContent.trim():"")});drop(tag);return}const pillBtn=wcClosest(host,e.target,".c-filter-pill__remove");if(pillBtn){e.preventDefault();const pill=wcClosest(host,pillBtn,".c-filter-pill");wcEmit(host,"contour:remove",{key:pill&&pill.getAttribute("key"),value:pill&&pill.getAttribute("value")});drop(pill);return}if(wcClosest(host,e.target,"[data-empty-action]")){wcEmit(host,"contour:empty-action",{state:host.getAttribute("state")||"empty"})}const alertClose=wcClosest(host,e.target,".c-alert__close");if(alertClose){e.preventDefault();wcEmit(host,"contour:close",{});if(host.shadowRoot?host.shadowRoot.contains(alertClose):true){try{host.remove()}catch(err){}}return}const calloutClose=wcClosest(host,e.target,".c-callout__close");if(calloutClose){e.preventDefault();wcEmit(host,"contour:close",{});try{host.remove()}catch(err){}return}})}const modalDepth={n:0};let modalSavedOverflow=null;let modalSavedX=0;let modalSavedY=0;const modalInerted=new Set();const modalStack=[];let modalTrapWired=false;function modalFocusables(host){return Array.from(host.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])")).filter((el)=>!el.hasAttribute("disabled")&&el.getAttribute("aria-hidden")!=="true")}function modalTrapHandler(e){if(e.key!=="Tab")return;const host=modalStack[modalStack.length-1];if(!host)return;const f=modalFocusables(host);if(!f.length){e.preventDefault();return}const first=f[0];const last=f[f.length-1];const active=document.activeElement;if(e.shiftKey){if(active===first||!host.contains(active)){e.preventDefault();last.focus()}}else{if(active===last){e.preventDefault();first.focus()}}}export function modalContain(host,open){if(open){if(modalDepth.n===0){modalSavedX=window.scrollX;modalSavedY=window.scrollY;modalSavedOverflow=document.documentElement.style.overflow;document.documentElement.style.overflow="hidden"}modalDepth.n+=1;modalStack.push(host);if(modalDepth.n===1&&!modalTrapWired){modalTrapWired=true;document.addEventListener("keydown",modalTrapHandler)}for(let el=host;el&&el!==document.body;el=el.parentElement){for(const sib of el.parentElement.children){if(sib===el||sib.inert||modalInerted.has(sib))continue;sib.inert=true;modalInerted.add(sib)}}}else{const idx=modalStack.lastIndexOf(host);if(idx>=0)modalStack.splice(idx,1);modalDepth.n=Math.max(0,modalDepth.n-1);if(modalDepth.n===0){for(const el of modalInerted)el.inert=false;modalInerted.clear();document.documentElement.style.overflow=modalSavedOverflow||"";window.scrollTo(modalSavedX,modalSavedY)}}}export const STATE_FALLBACK={empty:"No data",loading:"Loading…",error:"Could not load.",};const remoteInflight=new Map();const REMOTE_CACHE_MAX=64;const remoteCache=new Map();function cacheResult(src,data){if(remoteCache.size>=REMOTE_CACHE_MAX)remoteCache.delete(remoteCache.keys().next().value);remoteCache.set(src,data)}function setStatus(host,status){host._remoteStatus=status;if(status!=="error")host._remoteError=null;if(status==="loading")host.setAttribute("aria-busy","true");else host.removeAttribute("aria-busy");if(typeof host._setCustomState==="function")host._setCustomState("data-loading",status==="loading")}function emitState(host,name,detail){host.dispatchEvent(new CustomEvent(name,{detail,bubbles:true,composed:true}))}function countOf(data){if(Array.isArray(data))return data.length;if(data&&typeof data==="object")return Object.keys(data).length;return data===null||data===undefined?0:1}function leaveRequest(host){const entry=host._remoteEntry;host._remoteEntry=null;if(!entry)return;entry.hosts.delete(host);if(entry.hosts.size===0&&entry.controller)entry.controller.abort()}export function loadRemote(host,fields){const src=host.getAttribute("src");if(!src){leaveRequest(host);setStatus(host,host._remoteData!==undefined?"ready":"idle");return}remoteRefresh(host);const wanted=typeof fields==="string"?[fields]:fields;if(wanted.every((f)=>host.getAttribute(f)!==null)){leaveRequest(host);setStatus(host,"ready");return}if(!remoteVisible(host)){setStatus(host,"loading");return}const noCache=host.hasAttribute("no-cache");const cacheKey=host.getAttribute("cache-key")||src;if(noCache){if(host._remoteSrc===src&&host._remoteData!==undefined){setStatus(host,"ready");return}}else{const cached=remoteCache.get(cacheKey);if(cached!==undefined){host._remoteSrc=src;host._remoteData=cached;setStatus(host,"ready");return}}if(host._remoteSrc===src&&(host._remoteStatus==="loading"||host._remoteStatus==="error"))return;leaveRequest(host);host._remoteSrc=src;setStatus(host,"loading");let entry=remoteInflight.get(src);if(!entry){entry={hosts:new Set(),controller:new AbortController(),cacheKey};remoteInflight.set(src,entry);entry.promise=startFetch(host,src,entry).then((data)=>{if(remoteInflight.get(src)===entry)remoteInflight.delete(src);cacheResult(src,data);const namedKey=entry.cacheKey;if(namedKey&&namedKey!==src)cacheResult(namedKey,data);for(const h of entry.hosts){h._remoteData=data;h._remoteEntry=null;setStatus(h,"ready");emitState(h,"contour:load",{src,count:countOf(data)})}},(err)=>{if(remoteInflight.get(src)===entry)remoteInflight.delete(src);for(const h of entry.hosts){h._remoteEntry=null;setStatus(h,"error");h._remoteError=err&&err.name==="HttpError"?`Could not load (${err.status})`:STATE_FALLBACK.error;emitState(h,"contour:error",{src,message:h._remoteError,name:err&&err.name,status:err&&err.status,})}}).finally(()=>{for(const h of entry.hosts)if(h.isConnected)h.requestRender();entry.hosts.clear()})}entry.hosts.add(host);host._remoteEntry=entry;if(!host._remoteDisposeRegistered){host._remoteDisposeRegistered=true;onDispose(host,()=>{host._remoteDisposeRegistered=false;leaveRequest(host)})}}export function remoteInvalidate(srcOrKey){remoteCache.delete(srcOrKey)}function startFetch(host,src,entry){const ms=parseInt(host.getAttribute("timeout")||"",10);let timer=null;let signal=entry.controller.signal;if(Number.isFinite(ms)&&ms>0){if(typeof AbortSignal!=="undefined"&&AbortSignal.timeout){signal=AbortSignal.any([signal,AbortSignal.timeout(ms)])}else{timer=setTimeout(()=>entry.controller.abort(),ms)}}onDispose(host,()=>{if(timer)clearTimeout(timer)});return fetch(src,{signal}).then((res)=>{if(timer)clearTimeout(timer);if(!res.ok){const e=new Error(`Could not load (${res.status})`);e.name="HttpError";e.status=res.status;throw e}return res.text()}).then((text)=>{try{return JSON.parse(text)}catch(err){const e=new Error(STATE_FALLBACK.error);e.name="ParseError";e.cause=err;throw e}})}export function remoteData(host,field){const authored=host.getAttribute(field);if(authored!==null)return authored;const data=host._remoteData;if(data===undefined||data===null)return null;if(Array.isArray(data))return JSON.stringify(data);if(typeof data==="object"){const keys=typeof field==="string"?[field]:field;for(const k of keys){if(data[k]===undefined)continue;return typeof data[k]==="string"?data[k]:JSON.stringify(data[k])}return null}return String(data)}export function remoteRefresh(host){const seconds=parseFloat(host.getAttribute("refresh")||"");const want=host.hasAttribute("src")&&Number.isFinite(seconds)&&seconds>0;if(!want){if(host._remoteTimer!==undefined){clearTimeout(host._remoteTimer);host._remoteTimer=undefined}return}if(host._remoteLoop)return;host._remoteLoop=true;const tick=()=>{host._remoteTimer=undefined;if(!host.isConnected||!host.hasAttribute("refresh")){host._remoteLoop=false;return}if(document.hidden){host._remoteTimer=setTimeout(tick,1000);return}const src=host.getAttribute("src");const namedKey=host.getAttribute("cache-key");if(namedKey)remoteCache.delete(namedKey);remoteCache.delete(src);host._remoteSrc=null;host._remoteLoop=false;host.requestRender()};host._remoteTimer=setTimeout(tick,Math.max(1000,seconds*1000));onDispose(host,()=>{clearTimeout(host._remoteTimer);host._remoteTimer=undefined;host._remoteLoop=false})}let _sharedLazyIO=null;const _sharedLazyTargets=new Map();export function remoteVisible(host){if(!host.hasAttribute("lazy"))return true;if(typeof IntersectionObserver!=="function")return true;if(host._remoteVisible)return true;if(!_sharedLazyIO){_sharedLazyIO=new IntersectionObserver((records)=>{for(const r of records){const activate=_sharedLazyTargets.get(r.target);if(!activate||!r.isIntersecting)continue;_sharedLazyTargets.delete(r.target);_sharedLazyIO.unobserve(r.target);activate()}},{rootMargin:"200px"})}const activate=()=>{host._remoteVisible=true;host.requestRender()};_sharedLazyTargets.set(host,activate);_sharedLazyIO.observe(host);onDispose(host,()=>{_sharedLazyIO.unobserve(host);_sharedLazyTargets.delete(host)});return false}export function watchViewport(host){if(host._contourViewWired)return()=>{};host._contourViewWired=true;const emit=(type)=>host.dispatchEvent(new CustomEvent(type,{bubbles:true,composed:true}));if(typeof IntersectionObserver!=="function"){emit("contour:view-enter");return()=>{}}const io=new IntersectionObserver((records)=>{for(const r of records){if(r.isIntersecting)emit("contour:view-enter");else emit("contour:view-leave")}});io.observe(host);onDispose(host,()=>io.disconnect());return()=>io.disconnect()}function stateNode(block,kind,text){const node=document.createElement("div");node.className="c-"+block+"__"+kind;node.dataset.contourState=kind;node.textContent=text;return node}function skeletonRow(i,total){const node=document.createElement("div");node.className="c-skeleton "+(i===0&&total>1?"c-skeleton--title":"c-skeleton--text");node.dataset.contourState="skeleton";return node}export function renderStates(host,block,opts){const options=opts||{};const loading=host.getAttribute("loading");if(loading!==null||host._remoteStatus==="loading"){host.appendChild(stateNode(block,"loading",loading||STATE_FALLBACK.loading));return true}const error=host.getAttribute("error");if(error!==null||host._remoteStatus==="error"){const message=(error!==null&&error!=="")?error:(host._remoteError||STATE_FALLBACK.error);const node=stateNode(block,"error",message);if(host.hasAttribute("retry")){const btn=document.createElement("button");btn.type="button";btn.className="c-btn c-btn--ghost c-btn--sm";btn.textContent=host.getAttribute("retry")||"Retry";btn.dataset.action="retry";node.appendChild(btn)}host.appendChild(node);return true}if(host.hasAttribute("skeleton")){const asked=parseInt(host.getAttribute("skeleton")||"3",10);const count=Math.min(options.max||6,Math.max(1,Number.isFinite(asked)?asked:3));for(let i=0;i<count;i++)host.appendChild(skeletonRow(i,count));return true}return false}export function renderEmpty(host,block){host.appendChild(stateNode(block,"empty",host.getAttribute("empty")||STATE_FALLBACK.empty))}export function wireStates(host){if(host._contourStatesWired)return;host._contourStatesWired=true;host.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest('[data-action="retry"]'):null;if(!btn||!host.contains(btn))return;e.preventDefault();const src=host.getAttribute("src");const namedKey=host.getAttribute("cache-key");if(namedKey)remoteCache.delete(namedKey);if(src)remoteCache.delete(src);leaveRequest(host);host._remoteSrc=null;host._remoteData=undefined;setStatus(host,"idle");emitState(host,"contour:retry",{src});host.requestRender()})}class ContourCard extends ContourBase{static get observed(){return["title","variant","heading"]}static get properties(){return{title:{attribute:"title"},variant:{attribute:"variant"}}}render(){this.classList.add("c-card");const variant=this.getAttribute("variant");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-card--"))this.classList.remove(c)});if(variant)this.classList.add("c-card--"+variant);const title=this.getAttribute("title");if(title){const h=this.ensure(".c-card__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-card__title";return el});if(h.parentNode===this&&this.firstChild!==h)this.prepend(h);h.textContent=title}else{const h=this.querySelector(".c-card__title");if(h)h.remove()}}}define("contour-card",ContourCard);class ContourFeature extends ContourBase{static get observed(){return["index","title","body","heading"]}static get properties(){return{index:{attribute:"index"},title:{attribute:"title"},body:{attribute:"body"}}}render(){this.classList.add("c-feature");const index=this.getAttribute("index");const title=this.getAttribute("title");const body=this.getAttribute("body");if(index){const x=this.ensure(".c-feature__index",()=>{const el=document.createElement("span");el.className="c-feature__index";return el});x.textContent=index}else{const x=this.querySelector(".c-feature__index");if(x)x.remove()}if(title){const t=this.ensure(".c-feature__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-feature__title";return el});t.textContent=title}else{const t=this.querySelector(".c-feature__title");if(t)t.remove()}if(body){const b=this.ensure(".c-feature__body",()=>{const el=document.createElement("p");el.className="c-feature__body";return el});b.textContent=body}else{const b=this.querySelector(".c-feature__body");if(b)b.remove()}}}define("contour-feature",ContourFeature);class ContourSteps extends ContourBase{static get observed(){return["steps","current","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","heading"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current",type:Number},src:{attribute:"src"}}}render(){this.classList.add("c-steps");this.setAttribute("role","list");wireStates(this);loadRemote(this,"steps");if(renderStates(this,"steps"))return;const steps=remoteData(this,"steps");const authored=Array.from(this.children).filter((n)=>n.classList&&n.classList.contains("c-steps__item"));if(steps&&!authored.length){Array.from(this.querySelectorAll(".c-steps__item")).forEach((n)=>n.remove());try{const parsed=JSON.parse(steps);parsed.forEach((st,i)=>{const item=document.createElement("div");item.className="c-steps__item";item.setAttribute("role","listitem");item.tabIndex=-1;const title=typeof st==="string"?st:st.title;const body=typeof st==="string"?"":st.body;if(title){const h=document.createElement(headingTag(this,"h3"));h.className="c-steps__title";h.textContent=title;item.appendChild(h)}if(body){const p=document.createElement("p");p.className="c-steps__body";p.textContent=body;item.appendChild(p)}this.appendChild(item)})}catch(e){}}else if(!steps&&!authored.length){renderEmpty(this,"steps")}const attrCurrent=this.getAttribute("current");const current=(this._current!=null)?this._current:(attrCurrent!=null?parseInt(attrCurrent,10):NaN);const items=Array.from(this.querySelectorAll(".c-steps__item"));items.forEach((it,i)=>{if(Number.isFinite(current)&&i===current)it.setAttribute("aria-current","step");else it.removeAttribute("aria-current");it.tabIndex=(Number.isFinite(current)&&i===current)?0:-1});if(items.length&&!Number.isFinite(current)){items[0].tabIndex=0}}enhance(){if(!this._wiredSteps){this._wiredSteps=true;this.addEventListener("keydown",(e)=>{const items=Array.from(this.querySelectorAll(".c-steps__item"));if(!items.length)return;const active=document.activeElement;const idx=items.indexOf(active);let next=-1;const rtl=(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl";if(e.key==="ArrowDown")next=idx<0?0:Math.min(items.length-1,idx+1);else if(e.key==="ArrowUp")next=idx<0?0:Math.max(0,idx-1);else if(e.key==="ArrowRight")next=rtl?(idx<0?0:Math.max(0,idx-1)):(idx<0?0:Math.min(items.length-1,idx+1));else if(e.key==="ArrowLeft")next=rtl?(idx<0?0:Math.min(items.length-1,idx+1)):(idx<0?0:Math.max(0,idx-1));else if(e.key==="Home")next=0;else if(e.key==="End")next=items.length-1;if(next>=0&&next!==idx){e.preventDefault();items[next].focus();this._current=next;items.forEach((it,i)=>{if(i===next)it.setAttribute("aria-current","step");else it.removeAttribute("aria-current");it.tabIndex=i===next?0:-1});if(idx>=0)items[idx].tabIndex=-1;const title=items[next].querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:true,composed:true,detail:{index:next,title}}))}if((e.key==="Enter"||e.key===" ")&&idx>=0){e.preventDefault();const title=items[idx].querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-activate",{bubbles:true,composed:true,detail:{index:idx,title}}))}});this.addEventListener("click",(e)=>{const item=e.target&&e.target.closest?e.target.closest(".c-steps__item"):null;if(!item||!this.contains(item))return;const items=Array.from(this.querySelectorAll(".c-steps__item"));const idx=items.indexOf(item);if(idx<0)return;this._current=idx;items.forEach((it,i)=>{if(i===idx)it.setAttribute("aria-current","step");else it.removeAttribute("aria-current");it.tabIndex=i===idx?0:-1});const title=item.querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-activate",{bubbles:true,composed:true,detail:{index:idx,title}}))})}}}define("contour-steps",ContourSteps);class ContourLink extends ContourBase{static get observed(){return["href","label"]}static get properties(){return{href:{attribute:"href"},label:{attribute:"label"}}}render(){this.classList.add("c-link");const href=this.getAttribute("href");const label=this.getAttribute("label");const prevLink=this.querySelector("a");if(prevLink)prevLink.remove();if(href&&label){const a=document.createElement("a");a.href=href;a.textContent=label;this.appendChild(a)}}}define("contour-link",ContourLink);class ContourBrand extends ContourBase{static get observed(){return["name","tag"]}static get properties(){return{name:{attribute:"name"},tag:{attribute:"tag"}}}render(){this.classList.add("c-brand");const name=this.getAttribute("name");const tag=this.getAttribute("tag");if(name){const n=this.ensure(".c-brand__name",()=>{const el=document.createElement("span");el.className="c-brand__name";return el});n.textContent=name}else{const n=this.querySelector(".c-brand__name");if(n)n.remove()}if(tag){const t=this.ensure(".c-brand__tag",()=>{const el=document.createElement("span");el.className="c-brand__tag";return el});t.textContent=tag}else{const t=this.querySelector(".c-brand__tag");if(t)t.remove()}}}define("contour-brand",ContourBrand);class ContourSectionHead extends ContourBase{static get observed(){return["title","desc","heading"]}static get properties(){return{title:{attribute:"title"},desc:{attribute:"desc"}}}render(){this.classList.add("c-section-head");const title=this.getAttribute("title");const desc=this.getAttribute("desc");if(!this.querySelector(".c-icon-badge")){const badge=document.createElement("div");badge.className="c-icon-badge";badge.innerHTML='<svg aria-hidden="true"><use href="#i-crosshair" /></svg>';this.prepend(badge)}let content=this.querySelector(":scope > div:not(.c-icon-badge)");if(!content){content=document.createElement("div");this.appendChild(content)}if(title){const t=this.ensure(".c-section-head__title",()=>{const el=document.createElement(headingTag(this,"h2"));el.className="c-section-head__title";return el});t.textContent=title;if(t.parentNode!==content)content.appendChild(t)}else{const t=this.querySelector(".c-section-head__title");if(t)t.remove()}if(desc){const d=this.ensure(".c-section-head__desc",()=>{const el=document.createElement("p");el.className="c-section-head__desc";return el});d.textContent=desc;if(d.parentNode!==content)content.appendChild(d)}else{const d=this.querySelector(".c-section-head__desc");if(d)d.remove()}}}define("contour-section-head",ContourSectionHead);class ContourDiff extends ContourBase{static get observed(){return["before","after"]}static get properties(){return{before:{attribute:"before"},after:{attribute:"after"}}}render(){this.classList.add("c-diff");this.setAttribute("role","group");this.setAttribute("aria-label","Diff");Array.from(this.querySelectorAll(".c-diff__line")).forEach((n)=>n.remove());const line=(kind,sign,text)=>{const el=document.createElement("div");el.className=kind?`c-diff__line c-diff__line--${kind}`:"c-diff__line";el.setAttribute("role","listitem");const s=document.createElement("span");s.className="c-diff__sign";s.textContent=sign;const code=document.createElement("span");code.textContent=text;el.append(s,code);return el};const before=this.getAttribute("before");const after=this.getAttribute("after");if(before)this.appendChild(line("del","−",before));if(after)this.appendChild(line("add","+",after))}enhance(){if(this._wiredDiff)return;this._wiredDiff=true;this.addEventListener("click",(e)=>{const line=e.target&&e.target.closest?e.target.closest(".c-diff__line"):null;if(line&&this.contains(line)){const kind=line.classList.contains("c-diff__line--add")?"add":line.classList.contains("c-diff__line--del")?"del":"context";const text=line.querySelector("span:last-child")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:diff-activate",{bubbles:true,composed:true,detail:{kind,text}}))}})}}define("contour-diff",ContourDiff);class ContourDoDont extends ContourBase{static get observed(){return["do","dont"]}static get properties(){return{do:{attribute:"do"},dont:{attribute:"dont"}}}render(){this.classList.add("c-do-dont");this.setAttribute("role","group");this.setAttribute("aria-label","Do and don't");Array.from(this.querySelectorAll(".c-do-dont__item")).forEach((n)=>n.remove());const item=(kind,word,text)=>{const el=document.createElement("div");el.className=`c-do-dont__item c-do-dont__item--${kind}`;el.setAttribute("role","listitem");const label=document.createElement("p");label.className="c-do-dont__label";label.textContent=word;const body=document.createElement("p");body.className="u-muted";body.textContent=text;el.append(label,body);return el};const doText=this.getAttribute("do");const dontText=this.getAttribute("dont");if(doText)this.appendChild(item("do","Do",doText));if(dontText)this.appendChild(item("dont","Don't",dontText))}enhance(){if(this._wiredDoDont)return;this._wiredDoDont=true;this.addEventListener("click",(e)=>{const item=e.target&&e.target.closest?e.target.closest(".c-do-dont__item"):null;if(item&&this.contains(item)){const kind=item.classList.contains("c-do-dont__item--do")?"do":"dont";const text=item.querySelector(".u-muted")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:do-dont-activate",{bubbles:true,composed:true,detail:{kind,text}}))}})}}define("contour-do-dont",ContourDoDont);class ContourFlag extends ContourBase{static get observed(){return["variant","label"]}static get properties(){return{variant:{attribute:"variant"},label:{attribute:"label"}}}render(){this.classList.add("c-flag");const variant=this.getAttribute("variant");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-flag--"))this.classList.remove(c)});if(variant)this.classList.add("c-flag--"+variant);const label=this.getAttribute("label");if(label){this.textContent=label}}}define("contour-flag",ContourFlag);class ContourInstallFull extends ContourBase{static get observed(){return["command","prompt","copyable"]}static get properties(){return{command:{attribute:"command"},prompt:{attribute:"prompt"},copyable:{attribute:"copyable"}}}render(){this.classList.add("c-install");const prompt=this.getAttribute("prompt")||"$";const command=this.getAttribute("command")||"";if(command){const p=this.ensure(".c-install__prompt",()=>{const el=document.createElement("span");el.className="c-install__prompt";return el});p.textContent=prompt;const c=this.ensure(".c-install__command",()=>{const el=document.createElement("span");el.className="c-install__command";return el});c.textContent=command;if(this.hasAttribute("copyable")){this.ensure(".c-install__copy",()=>{const btn=document.createElement("button");btn.className="c-btn c-btn--ghost c-btn--sm c-install__copy";btn.type="button";btn.setAttribute("aria-label","Copy command");btn.textContent="Copy";return btn})}else{const btn=this.querySelector(".c-install__copy");if(btn)btn.remove()}}}enhance(){wireCopy(this)}}define("contour-install",ContourInstallFull);class ContourTestimonialFull extends ContourBase{static get observed(){return["quote","name","role"]}static get properties(){return{quote:{attribute:"quote"},name:{attribute:"name"},role:{attribute:"role"}}}render(){this.classList.add("c-testimonial");const quote=this.getAttribute("quote");if(quote){const q=this.ensure(".c-testimonial__quote",()=>{const el=document.createElement("blockquote");el.className="c-testimonial__quote";return el});q.textContent=quote}else{const q=this.querySelector(".c-testimonial__quote");if(q)q.remove()}const name=this.getAttribute("name");const role=this.getAttribute("role");if(name){const by=this.ensure(".c-testimonial__byline",()=>{const el=document.createElement("div");el.className="c-testimonial__byline";return el});const n=by.querySelector(".c-testimonial__name")||(()=>{const el=document.createElement("span");el.className="c-testimonial__name";by.appendChild(el);return el})();n.className="c-testimonial__name";n.textContent=name;if(role){const r=by.querySelector(".c-testimonial__role")||(()=>{const el=document.createElement("span");el.className="c-testimonial__role";by.appendChild(el);return el})();r.className="c-testimonial__role";r.textContent=role}else{const r=by.querySelector(".c-testimonial__role");if(r)r.remove()}}else{const by=this.querySelector(".c-testimonial__byline");if(by)by.remove()}}}define("contour-testimonial",ContourTestimonialFull);class ContourShowcaseFull extends ContourBase{static get observed(){return["title","text","media","reverse","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","heading"]}static get properties(){return{title:{attribute:"title"},text:{attribute:"text"},media:{attribute:"media"},reverse:{attribute:"reverse"},items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-showcase");if(this.hasAttribute("reverse"))this.classList.add("c-showcase--reverse");else this.classList.remove("c-showcase--reverse");const title=this.getAttribute("title");if(title)this.setAttribute("aria-label",title);else this.removeAttribute("aria-label");this.setAttribute("role","region");wireStates(this);loadRemote(this,"items");if(renderStates(this,"showcase"))return;const items=remoteData(this,"items");const text=this.getAttribute("text");const media=this.getAttribute("media");if(media){const m=this.ensure(".c-showcase__media",()=>{const el=document.createElement("div");el.className="c-showcase__media";el.setAttribute("role","img");return el});m.innerHTML=sanitizeHtml(media);if(title)m.setAttribute("aria-label",title)}else{const m=this.querySelector(".c-showcase__media");if(m)m.remove()}if(title){const t=this.ensure(".c-showcase__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-showcase__title";return el});t.textContent=title}else{const t=this.querySelector(".c-showcase__title");if(t)t.remove()}if(text){const p=this.ensure(".c-showcase__text",()=>{const el=document.createElement("p");el.className="c-showcase__text";return el});p.textContent=text}else{const p=this.querySelector(".c-showcase__text");if(p)p.remove()}const ul=this.querySelector(".c-showcase__list");const authored=ul?Array.from(ul.children).filter((n)=>n.tagName==="LI"):[];if(items&&!authored.length){try{const parsed=JSON.parse(items);const l=this.ensure(".c-showcase__list",()=>{const el=document.createElement("ul");el.className="c-showcase__list";return el});l.innerHTML="";parsed.forEach((it)=>{const li=document.createElement("li");li.textContent=typeof it==="string"?it:it.label;l.appendChild(li)})}catch(e){}}else if(!items&&!authored.length&&!title&&!text&&!media){renderEmpty(this,"showcase")}else if(!items&&ul){ul.remove()}}enhance(){if(this._wiredShowcase)return;this._wiredShowcase=true;this.addEventListener("click",(e)=>{const media=e.target&&e.target.closest?e.target.closest(".c-showcase__media"):null;if(media&&this.contains(media)){const title=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:showcase-activate",{bubbles:true,composed:true,detail:{title}}))}})}}define("contour-showcase",ContourShowcaseFull);class ContourPricingFull extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-pricing")}}define("contour-pricing",ContourPricingFull);class ContourRecipeFull extends ContourBase{static get observed(){return["title","body","canvas","heading"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},canvas:{attribute:"canvas"}}}render(){this.classList.add("c-recipe");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-recipe__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-recipe__title";return el});t.textContent=title}else{const t=this.querySelector(".c-recipe__title");if(t)t.remove()}const body=this.getAttribute("body");if(body){const b=this.ensure(".c-recipe__desc",()=>{const el=document.createElement("p");el.className="c-recipe__desc";return el});b.textContent=body}else{const b=this.querySelector(".c-recipe__desc");if(b)b.remove()}const canvas=this.getAttribute("canvas");if(canvas){const c=this.ensure(".c-recipe__canvas",()=>{const el=document.createElement("div");el.className="c-recipe__canvas";return el});c.innerHTML=sanitizeHtml(canvas)}else{const c=this.querySelector(".c-recipe__canvas");if(c)c.remove()}}}define("contour-recipe",ContourRecipeFull);class ContourLogosFull extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-logos");if(!this.querySelector(".c-logos__item")){for(const name of["Cartolab","Nordwand"]){const span=document.createElement("span");span.className="c-logos__item";span.textContent=name;this.appendChild(span)}}}}define("contour-logos",ContourLogosFull);class ContourLandingFeaturesFull extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-landing-features");wireStates(this);loadRemote(this,"items");if(renderStates(this,"landing-features"))return;const items=remoteData(this,"items");const authored=Array.from(this.children).filter((n)=>n.classList&&n.classList.contains("c-landing-features__item"));if(items&&!authored.length){try{const parsed=JSON.parse(items);this.querySelectorAll(".c-landing-features__item").forEach((el)=>el.remove());parsed.forEach((it)=>{const item=document.createElement("div");item.className="c-landing-features__item";if(it.icon){const ic=document.createElement("span");ic.className="c-landing-features__icon";ic.innerHTML='<svg aria-hidden="true"><use href="#'+String(it.icon).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>';item.appendChild(ic)}if(it.title){const t=document.createElement("span");t.className="c-landing-features__title";t.textContent=it.title;item.appendChild(t)}if(it.text){const tx=document.createElement("p");tx.className="c-landing-features__text";tx.textContent=it.text;item.appendChild(tx)}this.appendChild(item)})}catch(e){}}else if(!items&&!authored.length){this.querySelectorAll(".c-landing-features__item").forEach((el)=>el.remove());renderEmpty(this,"landing-features")}}}define("contour-landing-features",ContourLandingFeaturesFull);class ContourLandingHeroFull extends ContourBase{static get observed(){return["actions","title","text","heading"]}static get properties(){return{actions:{attribute:"actions"},title:{attribute:"title"},text:{attribute:"text"}}}render(){this.classList.add("c-landing-hero");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-landing-hero__title",()=>{const el=document.createElement(headingTag(this,"h1"));el.className="c-landing-hero__title";return el});t.textContent=title}const text=this.getAttribute("text");if(text){const t=this.ensure(".c-landing-hero__text",()=>{const el=document.createElement("p");el.className="c-landing-hero__text";return el});t.textContent=text}const actions=this.getAttribute("actions");const a=this.querySelector(".c-landing-hero__actions");const authored=a?Array.from(a.children):[];if(actions&&!authored.length){const el=this.ensure(".c-landing-hero__actions",()=>{const e=document.createElement("div");e.className="c-landing-hero__actions";return e});el.innerHTML=sanitizeHtml(actions)}else if(!actions&&a&&!authored.length){a.remove()}}}define("contour-landing-hero",ContourLandingHeroFull);class ContourLinkishFull extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-linkish")}}define("contour-linkish",ContourLinkishFull);class ContourPriceFull extends ContourBase{static get observed(){return["value"]}static get properties(){return{value:{attribute:"value"}}}render(){this.classList.add("c-price");const value=this.getAttribute("value");if(value)this.textContent=value}}define("contour-price",ContourPriceFull);class ContourProseFull extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-prose")}}define("contour-prose",ContourProseFull);class ContourPanel extends ContourBase{static get observed(){return["title","subtitle","status","heading"]}static get properties(){return{title:{attribute:"title"},subtitle:{attribute:"subtitle"},status:{attribute:"status"}}}render(){this.classList.add("c-panel");const title=this.getAttribute("title");const subtitle=this.getAttribute("subtitle");const status=this.getAttribute("status");if(title){const h=this.ensure(".c-panel__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-panel__title";return el});if(h.parentNode===this&&this.firstChild!==h)this.prepend(h);h.textContent=title}else{const h=this.querySelector(".c-panel__title");if(h)h.remove()}if(subtitle){const sub=this.ensure(".c-panel__subtitle",()=>{const el=document.createElement("p");el.className="c-panel__subtitle";return el});sub.textContent=subtitle}else{const sub=this.querySelector(".c-panel__subtitle");if(sub)sub.remove()}if(status){const st=this.ensure(".c-panel__status",()=>{const el=document.createElement("span");el.className="c-panel__status";return el});st.textContent=status}else{const st=this.querySelector(".c-panel__status");if(st)st.remove()}const body=this.ensure(".c-panel__body",()=>{const el=document.createElement("div");el.className="c-panel__body";return el});const head=this.querySelector(".c-panel__head");Array.from(this.childNodes).forEach((n)=>{if(n===body||n===head)return;if(n.nodeType===1&&(n.classList.contains("c-panel__title")||n.classList.contains("c-panel__subtitle")||n.classList.contains("c-panel__status")))return;body.appendChild(n)});if(!body.parentNode)this.appendChild(body);if(head&&head.parentNode===this&&body.parentNode===this&&head.compareDocumentPosition(body)&Node.DOCUMENT_POSITION_PRECEDING){this.insertBefore(body,head.nextSibling)}}}define("contour-panel",ContourPanel);class ContourCta extends ContourBase{static get observed(){return["title","text","actions","heading"]}static get properties(){return{title:{attribute:"title"},text:{attribute:"text"},actions:{attribute:"actions"}}}render(){this.classList.add("c-cta");const title=this.getAttribute("title");const text=this.getAttribute("text");if(title){const t=this.ensure(".c-cta__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-cta__title";return el});t.textContent=title}else{const t=this.querySelector(".c-cta__title");if(t)t.remove()}if(text){const p=this.ensure(".c-cta__text",()=>{const el=document.createElement("p");el.className="c-cta__text";return el});p.textContent=text}else{const p=this.querySelector(".c-cta__text");if(p)p.remove()}const actions=this.getAttribute("actions");const prevWrap=this.querySelector(".c-cta__actions");if(prevWrap)prevWrap.remove();if(actions){try{const parsed=JSON.parse(actions);const wrap=document.createElement("div");wrap.className="c-cta__actions";parsed.forEach((a)=>{const btn=document.createElement("button");btn.className="c-btn c-btn--primary";btn.type="button";btn.textContent=typeof a==="string"?a:(a.label||a);wrap.appendChild(btn)});this.appendChild(wrap)}catch(e){}}}}define("contour-cta",ContourCta);class ContourCode extends ContourBase{static get observed(){return["title","copyable"]}static get properties(){return{title:{attribute:"title"},copyable:{attribute:"copyable",type:Boolean}}}render(){this.classList.add("c-code");const title=this.getAttribute("title");if(title){const head=this.ensure(".c-code__head",()=>{const el=document.createElement("div");el.className="c-code__head";return el});if(head.parentNode===this&&this.firstChild!==head)this.prepend(head);const t=head.querySelector(".c-code__title")||(()=>{const el=document.createElement("div");el.className="c-code__title";head.appendChild(el);return el})();t.textContent=title}else{const head=this.querySelector(".c-code__head");if(head)head.remove();const t=this.querySelector(".c-code__title");if(t)t.remove()}if(this.hasAttribute("copyable")){this.ensure(".c-code__copy",()=>{const btn=document.createElement("button");btn.className="c-code__copy";btn.type="button";btn.textContent="Copy";return btn})}else{const btn=this.querySelector(".c-code__copy");if(btn)btn.remove()}const pre=this.ensure("pre",()=>{const el=document.createElement("pre");return el});Array.from(this.childNodes).forEach((n)=>{if(n===pre||(n.nodeType===1&&(n.classList.contains("c-code__head")||n.classList.contains("c-code__copy"))))return;pre.appendChild(n)});if(!pre.querySelector("code")){const code=document.createElement("code");while(pre.firstChild)code.appendChild(pre.firstChild);pre.appendChild(code)}if(pre.parentNode!==this)this.appendChild(pre);const head=this.querySelector(".c-code__head");if(head&&head.parentNode===this&&pre.parentNode===this&&head.compareDocumentPosition(pre)&Node.DOCUMENT_POSITION_PRECEDING){this.insertBefore(pre,head.nextSibling)}}enhance(){wireCopy(this)}}define("contour-code",ContourCode);class ContourPlate extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-plate")}}define("contour-plate",ContourPlate);class ContourPullquote extends ContourBase{static get observed(){return["quote","name"]}static get properties(){return{quote:{attribute:"quote"},name:{attribute:"name"}}}render(){this.classList.add("c-pullquote");const quote=this.getAttribute("quote");if(quote){Array.from(this.childNodes).forEach((n)=>{if(n.nodeType===3)n.remove()});const cite=this.querySelector("cite");this.insertBefore(document.createTextNode(quote),cite)}const name=this.getAttribute("name");if(name){const by=this.ensure("cite",()=>{const el=document.createElement("cite");this.appendChild(el);return el});by.textContent=name}else{const by=this.querySelector("cite");if(by)by.remove()}}}define("contour-pullquote",ContourPullquote);class ContourAnchor extends ContourBase{static get observed(){return["href","label"]}static get properties(){return{href:{attribute:"href"},label:{attribute:"label"}}}render(){this.classList.add("c-anchor");const href=this.getAttribute("href");const label=this.getAttribute("label");const prevAnchor=this.querySelector("a");if(prevAnchor)prevAnchor.remove();if(href&&label){const a=document.createElement("a");a.href=href;a.textContent=label;this.appendChild(a)}}}define("contour-anchor",ContourAnchor);class ContourDashShell extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-dash-shell");this.setAttribute("role","region");const title=this.getAttribute("title");if(title){const bar=this.ensure(".c-dash-toolbar",()=>{const el=document.createElement("div");el.className="c-dash-toolbar";return el});const h=bar.querySelector(".c-dash-toolbar__title")||(()=>{const el=document.createElement("span");el.className="c-dash-toolbar__title";bar.appendChild(el);return el})();h.textContent=title;this.setAttribute("aria-label",title)}}}define("contour-dash-shell",ContourDashShell);class ContourDashToolbar extends ContourBase{static get observed(){return["title","actions"]}static get properties(){return{title:{attribute:"title"},actions:{attribute:"actions"}}}render(){this.classList.add("c-dash-toolbar");this.setAttribute("role","toolbar");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-dash-toolbar__title",()=>{const el=document.createElement("span");el.className="c-dash-toolbar__title";return el});t.textContent=title;this.setAttribute("aria-label",title)}else{const t=this.querySelector(".c-dash-toolbar__title");if(t)t.remove()}const actions=this.getAttribute("actions");if(actions){try{const parsed=JSON.parse(actions);const wrap=this.ensure(".c-dash-toolbar__actions",()=>{const el=document.createElement("div");el.className="c-dash-toolbar__actions";return el});wrap.innerHTML="";parsed.forEach((a)=>{const btn=document.createElement("button");btn.className="c-btn c-btn--ghost c-btn--sm";btn.type="button";btn.textContent=typeof a==="string"?a:(a.label||a);wrap.appendChild(btn)})}catch(e){}}else{const w=this.querySelector(".c-dash-toolbar__actions");if(w)w.remove()}}enhance(){if(this._wiredDashToolbar)return;this._wiredDashToolbar=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-btn"):null;if(btn&&this.contains(btn)){const label=btn.textContent||"";this.dispatchEvent(new CustomEvent("contour:dash-action",{bubbles:true,composed:true,detail:{label}}))}})}}define("contour-dash-toolbar",ContourDashToolbar);class ContourDashKpiRow extends ContourBase{static get observed(){return["items"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-dash-kpi-row");this.setAttribute("role","group");Array.from(this.querySelectorAll("contour-kpi")).forEach((n)=>n.remove());const items=this.getAttribute("items");let parsed=null;if(items){try{parsed=JSON.parse(items)}catch(e){parsed=null}}if(Array.isArray(parsed)&&parsed.length){parsed.forEach((it)=>{const k=document.createElement("contour-kpi");if(typeof it==="object"&&it!==null){if(it.value!==undefined)k.setAttribute("value",String(it.value));if(it.label!==undefined)k.setAttribute("label",String(it.label))}else{k.setAttribute("value",String(it))}this.appendChild(k)})}else if(!this.querySelector("contour-kpi")){const k=document.createElement("contour-kpi");k.setAttribute("value","0");k.setAttribute("label","KPI");this.appendChild(k)}}}define("contour-dash-kpi-row",ContourDashKpiRow);class ContourDashFreshness extends ContourBase{static get observed(){return["label","value"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"}}}render(){this.classList.add("c-dash-freshness");this.setAttribute("role","status");this.setAttribute("aria-live","polite");const label=this.getAttribute("label");const value=this.getAttribute("value");const dot=this.ensure(".c-dot",()=>{const el=document.createElement("span");el.className="c-dot c-dot--live c-dot--accent";el.setAttribute("aria-hidden","true");return el});if(dot.parentNode!==this)this.appendChild(dot);if(!this._freshnessText||!this._freshnessText.parentNode){this._freshnessText=document.createTextNode("");this.appendChild(this._freshnessText)}this._freshnessText.nodeValue=[label,value].filter(Boolean).join(" ")}}define("contour-dash-freshness",ContourDashFreshness);class ContourReadout extends ContourBase{static get observed(){return["rows","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","format","locale"]}static get properties(){return{rows:{attribute:"rows"},format:{attribute:"format"},locale:{attribute:"locale"},src:{attribute:"src"}}}render(){this.classList.add("c-readout");wireStates(this);loadRemote(this,"rows");if(renderStates(this,"readout"))return;const rows=remoteData(this,"rows");Array.from(this.querySelectorAll(".c-readout__row")).forEach((n)=>n.remove());const authored=Array.from(this.children).filter((n)=>!n.classList||!n.classList.contains("c-readout__row"));if(rows&&!authored.length){try{const parsed=JSON.parse(rows);parsed.forEach((r)=>{const row=document.createElement("div");row.className="c-readout__row";const key=document.createElement("span");key.className="c-readout__key";key.textContent=r.key||r[0];const val=document.createElement("span");val.className="c-readout__value"+(r.primary?" c-readout__value--primary":"")+(r.accent?" c-readout__value--accent":"")+(r.coord?" c-readout__value--coord":"");val.setAttribute("aria-live","polite");val.textContent=formatValue(r.value||r[1],this.getAttribute("format"),this.getAttribute("locale"));row.appendChild(key);row.appendChild(val);if(r.order){const ord=document.createElement("span");ord.className="c-readout__order";ord.textContent=r.order;row.appendChild(ord)}this.appendChild(row)})}catch(e){}}else if(!rows&&!authored.length){renderEmpty(this,"readout")}}}define("contour-readout",ContourReadout);class ContourKpi extends ContourBase{static get observed(){return["value","label","delta","direction","note","variant","unit","format","locale","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"},delta:{attribute:"delta"},direction:{attribute:"direction"},note:{attribute:"note"},variant:{attribute:"variant"},unit:{attribute:"unit"},format:{attribute:"format"},locale:{attribute:"locale"}}}render(){this.classList.add("c-kpi");wireStates(this);loadRemote(this,["value","label"]);if(renderStates(this,"kpi"))return;const value=remoteData(this,"value");const label=remoteData(this,"label");const delta=this.getAttribute("delta");const variant=this.getAttribute("variant");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-kpi--"))this.classList.remove(c)});if(variant)this.classList.add("c-kpi--"+variant);if(value){const v=this.ensure(".c-kpi__value",()=>{const el=document.createElement("div");el.className="c-kpi__value";el.setAttribute("aria-live","polite");return el});v.textContent=formatValue(value,this.getAttribute("format"),this.getAttribute("locale"))}else{const v=this.querySelector(".c-kpi__value");if(v)v.remove()}if(label){const h=this.ensure(".c-kpi__head",()=>{const el=document.createElement("div");el.className="c-kpi__head";return el});let l=h.querySelector(".c-kpi__label");if(!l){l=document.createElement("div");l.className="c-kpi__label";h.appendChild(l)}l.textContent=label;if(h.parentNode!==this)this.insertBefore(h,this.firstChild)}else{const h=this.querySelector(".c-kpi__head");if(h)h.remove()}if(delta){const f=this.ensure(".c-kpi__foot",()=>{const el=document.createElement("div");el.className="c-kpi__foot";return el});const d=f.querySelector(".c-delta")||document.createElement("span");if(!d.parentNode)f.insertBefore(d,f.firstChild);d.className="c-delta c-delta--"+(this.getAttribute("direction")||"up");d.textContent=delta}else{const d=this.querySelector(".c-kpi__foot .c-delta");if(d)d.remove()}const note=this.getAttribute("note");if(note){const f=this.ensure(".c-kpi__foot",()=>{const el=document.createElement("div");el.className="c-kpi__foot";return el});const n=f.querySelector(".c-kpi__note")||(()=>{const el=document.createElement("span");el.className="c-kpi__note";f.appendChild(el);return el})();n.textContent=note}else{const n=this.querySelector(".c-kpi__note");if(n)n.remove()}const unit=this.getAttribute("unit");const v=this.querySelector(".c-kpi__value");if(v){if(unit){let u=v.querySelector(".c-kpi__unit");if(!u){u=document.createElement("span");u.className="c-kpi__unit";v.appendChild(u)}u.textContent=unit}else{const u=v.querySelector(".c-kpi__unit");if(u)u.remove()}}if(!value&&!label){renderEmpty(this,"kpi")}}}define("contour-kpi",ContourKpi);class ContourTable extends ContourBase{static get observed(){return["columns","rows","page","page-size","sort","sort-dir","virtual","empty","loading","error","retry","skeleton","persist"]}static get properties(){return{columns:{attribute:"columns"},rows:{attribute:"rows"},page:{attribute:"page",type:Number},pageSize:{attribute:"page-size",type:Number}}}_cellValue(cell){if(cell===null||cell===undefined)return"";if(typeof cell==="object")return cell.value!==undefined?cell.value:(cell.label!==undefined?cell.label:JSON.stringify(cell));return cell}_compare(a,b,type){const av=this._cellValue(a);const bv=this._cellValue(b);if(type==="number"||type==="numeric"){return(parseFloat(av)||0)-(parseFloat(bv)||0)}return String(av).localeCompare(String(bv),undefined,{numeric:true})}render(){const columns=this.getAttribute("columns");const rows=this.getAttribute("rows");const authored=Array.from(this.children).filter((n)=>!n.classList||!n.classList.contains("c-table-wrap"));if(columns&&rows&&!authored.length){try{const cols=JSON.parse(columns);const data=JSON.parse(rows);if(this.hasAttribute("loading")){const wrap=this.ensure(".c-table-wrap",()=>{const el=document.createElement("div");el.className="c-table-wrap";return el});const colsKey=JSON.stringify(cols);const table=(wrap.querySelector("table.c-table")&&this._tableCols===colsKey)?wrap.querySelector("table.c-table"):(()=>{const t=document.createElement("table");t.className="c-table";const thead=document.createElement("thead");const tr=document.createElement("tr");cols.forEach((c)=>{const colLabel=typeof c==="string"?c:(c.label||c.title||c);const th=document.createElement("th");th.textContent=colLabel;tr.appendChild(th)});thead.appendChild(tr);t.appendChild(thead);t.appendChild(document.createElement("tbody"));return t})();this._tableCols=colsKey;const tbody=table.querySelector("tbody");tbody.innerHTML="";const tr=document.createElement("tr");const td=document.createElement("td");td.colSpan=cols.length;td.style.textAlign="center";td.style.color="var(--color-text-muted)";td.textContent=this.getAttribute("loading")||"Loading…";tr.appendChild(td);tbody.appendChild(tr);if(table.parentNode!==wrap){wrap.innerHTML="";wrap.appendChild(table)}if(wrap.parentNode!==this)this.appendChild(wrap);const footer=this.querySelector(".c-table__pagination");if(footer)footer.remove();return}if(this.hasAttribute("error")){const wrap=this.ensure(".c-table-wrap",()=>{const el=document.createElement("div");el.className="c-table-wrap";return el});const colsKey=JSON.stringify(cols);const table=(wrap.querySelector("table.c-table")&&this._tableCols===colsKey)?wrap.querySelector("table.c-table"):(()=>{const t=document.createElement("table");t.className="c-table";const thead=document.createElement("thead");const tr=document.createElement("tr");cols.forEach((c)=>{const colLabel=typeof c==="string"?c:(c.label||c.title||c);const th=document.createElement("th");th.textContent=colLabel;tr.appendChild(th)});thead.appendChild(tr);t.appendChild(thead);t.appendChild(document.createElement("tbody"));return t})();this._tableCols=colsKey;const tbody=table.querySelector("tbody");tbody.innerHTML="";const tr=document.createElement("tr");const td=document.createElement("td");td.colSpan=cols.length;td.textContent=this.getAttribute("error")||"Error";td.style.textAlign="center";td.style.color="var(--color-danger, var(--color-text))";if(this.hasAttribute("retry")){const btn=document.createElement("button");btn.className="c-btn c-btn--ghost c-btn--sm";btn.type="button";btn.textContent=this.getAttribute("retry")||"Retry";btn.style.marginInlineStart="var(--space-sm)";btn.dataset.action="retry";td.appendChild(btn)}tr.appendChild(td);tbody.appendChild(tr);if(table.parentNode!==wrap){wrap.innerHTML="";wrap.appendChild(table)}if(wrap.parentNode!==this)this.appendChild(wrap);const footer=this.querySelector(".c-table__pagination");if(footer)footer.remove();return}if(this.hasAttribute("skeleton")){const wrap=this.ensure(".c-table-wrap",()=>{const el=document.createElement("div");el.className="c-table-wrap";return el});const colsKey=JSON.stringify(cols);const table=(wrap.querySelector("table.c-table")&&this._tableCols===colsKey)?wrap.querySelector("table.c-table"):(()=>{const t=document.createElement("table");t.className="c-table";const thead=document.createElement("thead");const tr=document.createElement("tr");cols.forEach((c)=>{const colLabel=typeof c==="string"?c:(c.label||c.title||c);const th=document.createElement("th");th.textContent=colLabel;tr.appendChild(th)});thead.appendChild(tr);t.appendChild(thead);t.appendChild(document.createElement("tbody"));return t})();this._tableCols=colsKey;const tbody=table.querySelector("tbody");tbody.innerHTML="";const count=Math.min(5,Math.max(1,parseInt(this.getAttribute("skeleton")||"3",10)||3));for(let i=0;i<count;i++){const tr=document.createElement("tr");cols.forEach(()=>{const td=document.createElement("td");const sk=document.createElement("span");sk.className="c-skeleton";sk.style.display="inline-block";sk.style.inlineSize="60%";sk.style.blockSize="0.8rem";td.appendChild(sk);tr.appendChild(td)});tbody.appendChild(tr)}if(table.parentNode!==wrap){wrap.innerHTML="";wrap.appendChild(table)}if(wrap.parentNode!==this)this.appendChild(wrap);const footer=this.querySelector(".c-table__pagination");if(footer)footer.remove();return}if(this._sortCol===undefined){const sortAttr=this.getAttribute("sort");if(sortAttr!==null){const idx=Number(sortAttr);this._sortCol=Number.isFinite(idx)?idx:cols.findIndex((c)=>(typeof c==="object"&&c&&(c.label||c.title||c)===sortAttr));if(this._sortCol<0)this._sortCol=null}else{this._sortCol=null}const dirAttr=this.getAttribute("sort-dir");this._sortDir=dirAttr==="descending"||dirAttr==="desc"?-1:1}let working=Array.isArray(data)?data.slice():[];if(this._sortCol!==null&&this._sortCol!==undefined&&this._sortCol>=0&&this._sortCol<cols.length){const col=this._sortCol;const dir=this._sortDir||1;const colSpec=cols[col];const type=(typeof colSpec==="object"&&colSpec&&colSpec.sortType)?colSpec.sortType:"text";working.sort((a,b)=>this._compare(a&&a[col],b&&b[col],type)*dir)}if(!this._filters)this._filters={};const activeFilters=Object.keys(this._filters).filter((k)=>this._filters[k]);if(activeFilters.length){working=working.filter((row)=>activeFilters.every((k)=>{const ci=Number(k);const q=String(this._filters[ci]||"").toLowerCase();if(!q)return true;return String(this._cellValue(row[ci])).toLowerCase().includes(q)}))}const pageSizeRaw=this.getAttribute("page-size");const pageSize=pageSizeRaw!==null?parseInt(pageSizeRaw,10):NaN;const usePaging=Number.isFinite(pageSize)&&pageSize>0;let pageAttr=this.getAttribute("page");if(this.getAttribute("persist")&&this.id){const mode=this.getAttribute("persist");let stored=null;if(mode==="storage"){try{stored=localStorage.getItem("contour-table:"+this.id)}catch(e){}}else if(mode==="url"){try{stored=new URLSearchParams(window.location.search).get("c-table")}catch(e){}}if(stored!==null)pageAttr=stored}if(this._pageInternal){this._pageInternal=false;this._pageAttrLast=pageAttr}else if(pageAttr!==this._pageAttrLast){this._page=null;this._pageAttrLast=pageAttr}let page=this._page!==null?this._page:(parseInt(pageAttr||"1",10));if(!Number.isFinite(page)||page<1)page=1;let totalPages=1;let pageData=working;if(usePaging){totalPages=Math.max(1,Math.ceil(working.length/pageSize));if(page>totalPages)page=totalPages;const start=(page-1)*pageSize;pageData=working.slice(start,start+pageSize)}this._page=page;this._totalPages=totalPages;this._pageSize=pageSize;const wrap=this.ensure(".c-table-wrap",()=>{const el=document.createElement("div");el.className="c-table-wrap";return el});const colsKey=JSON.stringify(cols);const table=(wrap.querySelector("table.c-table")&&this._tableCols===colsKey)?wrap.querySelector("table.c-table"):(()=>{const t=document.createElement("table");t.className="c-table";const thead=document.createElement("thead");const tr=document.createElement("tr");cols.forEach((c,i)=>{const colLabel=typeof c==="string"?c:(c.label||c.title||c);const th=document.createElement("th");const sortable=(typeof c==="object"&&c!==null&&c.sort);const isSelect=(typeof c==="object"&&c!==null&&c.select);const isFilter=(typeof c==="object"&&c!==null&&c.filter);if(isFilter){th.className=(th.className+" c-table__filter").trim();const inp=document.createElement("input");inp.type="search";inp.className="c-table__filter-input";inp.placeholder=colLabel;inp.dataset.filterIndex=String(i);if(this._filters&&this._filters[i])inp.value=this._filters[i];th.appendChild(inp)}else if(isSelect){th.className=(th.className+" c-table__select").trim();const cb=document.createElement("input");cb.type="checkbox";cb.className="c-table__select-all";cb.setAttribute("aria-label","Select all rows");th.appendChild(cb)}else if(sortable){th.setAttribute("aria-sort",(this._sortCol===i)?(this._sortDir===-1?"descending":"ascending"):"none");const wrapEl=document.createElement("span");wrapEl.className="c-table__sort";wrapEl.textContent=colLabel;const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("aria-hidden","true");svg.innerHTML='<use href="#i-chevron-down" />';wrapEl.appendChild(svg);th.appendChild(wrapEl)}else if(typeof c==="object"&&c!==null&&c.pinned){th.className="c-table__pinned";th.textContent=colLabel}else{th.textContent=colLabel}if(sortable){th.setAttribute("tabindex","0");th.setAttribute("role","columnheader");th.dataset.sortIndex=String(i)}tr.appendChild(th)});thead.appendChild(tr);t.appendChild(thead);t.appendChild(document.createElement("tbody"));return t})();this._tableCols=colsKey;cols.forEach((c,i)=>{if(typeof c==="object"&&c!==null&&c.sort){const th=table.querySelector("thead tr th:nth-child("+(i+1)+")");if(th)th.setAttribute("aria-sort",(this._sortCol===i)?(this._sortDir===-1?"descending":"ascending"):"none")}});const tbody=table.querySelector("tbody");tbody.innerHTML="";if(pageData.length===0){const tr=document.createElement("tr");const td=document.createElement("td");td.colSpan=cols.length;td.textContent=this.getAttribute("empty")||"No data";td.style.textAlign="center";td.style.color="var(--color-text-muted)";tr.appendChild(td);tbody.appendChild(tr)}else{pageData.forEach((row,ri)=>{const tr=document.createElement("tr");cols.forEach((c,ci)=>{const isSelect=(typeof c==="object"&&c!==null&&c.select);const td=document.createElement("td");if(isSelect){const cb=document.createElement("input");cb.type="checkbox";cb.className="c-table__row-select";cb.dataset.rowIndex=String(ri);if(this._selectedRows&&this._selectedRows.has(ri))cb.checked=true;td.appendChild(cb)}else{td.textContent=this._cellValue(row[ci])}tr.appendChild(td)});tbody.appendChild(tr)})}if(table.parentNode!==wrap){wrap.innerHTML="";wrap.appendChild(table)}if(wrap.parentNode!==this)this.appendChild(wrap);if(this.hasAttribute("virtual")){wrap.style.maxHeight=wrap.style.maxHeight||"24rem";wrap.style.overflow="auto";table.classList.add("c-table--virtual");Array.from(tbody.querySelectorAll("tr")).forEach((tr)=>{tr.style.contentVisibility="auto";tr.style.containIntrinsicSize="auto 2rem"})}else{wrap.style.maxHeight="";wrap.style.overflow="";table.classList.remove("c-table--virtual")}if(usePaging){const footer=this.ensure(".c-table__pagination",()=>{const el=document.createElement("div");el.className="c-table__pagination";return el});footer.innerHTML="";const prev=document.createElement("button");prev.className="c-btn c-btn--ghost c-btn--sm";prev.type="button";prev.textContent="Previous";prev.disabled=page<=1;prev.dataset.action="prev";const info=document.createElement("span");info.textContent=`Page ${page} of ${totalPages}`;const next=document.createElement("button");next.className="c-btn c-btn--ghost c-btn--sm";next.type="button";next.textContent="Next";next.disabled=page>=totalPages;next.dataset.action="next";footer.appendChild(prev);footer.appendChild(info);footer.appendChild(next)}else{const footer=this.querySelector(".c-table__pagination");if(footer)footer.remove()}}catch(e){}}}enhance(){if(this._wiredTable)return;this._wiredTable=true;const handleSort=(th)=>{const idx=Number(th.dataset.sortIndex);if(!Number.isFinite(idx))return;if(this._sortCol===idx){this._sortDir=(this._sortDir===1)?-1:1}else{this._sortCol=idx;this._sortDir=1}this.dispatchEvent(new CustomEvent("contour:sort",{bubbles:true,composed:true,detail:{column:idx,direction:this._sortDir===1?"ascending":"descending"}}));this.requestRender()};this.addEventListener("click",(e)=>{const retryBtn=e.target&&e.target.closest?e.target.closest('button[data-action="retry"]'):null;if(retryBtn&&this.contains(retryBtn)){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:retry",{detail:{src:this.getAttribute("src")},bubbles:true,composed:true}));return}const th=e.target&&e.target.closest?e.target.closest("th[aria-sort]"):null;if(th&&this.contains(th)){e.preventDefault();handleSort(th);return}const btn=e.target&&e.target.closest?e.target.closest(".c-table__pagination button"):null;if(btn&&this.contains(btn)){e.preventDefault();const action=btn.dataset.action;let page=this._page!==null?this._page:(parseInt(this.getAttribute("page")||"1",10));if(!Number.isFinite(page)||page<1)page=1;if(action==="prev"&&page>1)page-=1;if(action==="next")page+=1;this._page=page;this._pageAttrLast=String(page);this._pageInternal=true;this.setAttribute("page",String(page));this.dispatchEvent(new CustomEvent("contour:page",{bubbles:true,composed:true,detail:{page}}));const persist=this.getAttribute("persist");if(persist==="storage"&&this.id){try{localStorage.setItem("contour-table:"+this.id,String(page))}catch(e){}}else if(persist==="url"){try{const url=new URL(window.location.href);url.searchParams.set("c-table",String(page));window.history.replaceState(null,"",url.toString())}catch(e){}}}});this.addEventListener("keydown",(e)=>{if(e.key!=="Enter"&&e.key!==" ")return;const th=e.target&&e.target.closest?e.target.closest("th[aria-sort]"):null;if(th&&this.contains(th)){e.preventDefault();handleSort(th)}});this.addEventListener("input",(e)=>{const inp=e.target&&e.target.closest?e.target.closest(".c-table__filter-input"):null;if(!inp||!this.contains(inp))return;const idx=Number(inp.dataset.filterIndex);if(!Number.isFinite(idx))return;if(!this._filters)this._filters={};this._filters[idx]=inp.value;this.requestRender()});this._selectedRows=this._selectedRows||new Set();this.addEventListener("change",(e)=>{const cb=e.target&&e.target.closest?e.target.closest(".c-table__row-select"):null;if(cb&&this.contains(cb)){const idx=Number(cb.dataset.rowIndex);if(!Number.isFinite(idx))return;if(cb.checked)this._selectedRows.add(idx);else this._selectedRows.delete(idx);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{rows:Array.from(this._selectedRows)}}));return}const all=e.target&&e.target.closest?e.target.closest(".c-table__select-all"):null;if(all&&this.contains(all)){const cbs=Array.from(this.querySelectorAll(".c-table__row-select"));cbs.forEach((c)=>{c.checked=all.checked});this._selectedRows=new Set(all.checked?cbs.map((c)=>Number(c.dataset.rowIndex)):[]);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{rows:Array.from(this._selectedRows)}}))}})}}define("contour-table",ContourTable);class ContourChart extends ContourBase{static get observed(){return["series","axis","empty","loading","error","retry","skeleton","zoomable"]}static get properties(){return{series:{attribute:"series"},axis:{attribute:"axis"},zoomable:{attribute:"zoomable",type:Boolean}}}render(){this.classList.add("c-chart");if(!this.hasAttribute("role"))this.setAttribute("role","img");if(this.getAttribute("axis")&&!this.hasAttribute("aria-label"))this.setAttribute("aria-label",this.getAttribute("axis"));if(this.hasAttribute("loading")){const plot=this.ensure(".c-chart__plot",()=>{const el=document.createElement("div");el.className="c-chart__plot";return el});plot.innerHTML="";const loading=document.createElement("div");loading.className="c-chart__loading";loading.textContent=this.getAttribute("loading")||"Loading…";loading.style.display="grid";loading.style.placeItems="center";loading.style.height="100%";loading.style.color="var(--color-text-muted)";plot.appendChild(loading);const axis=this.getAttribute("axis");if(axis){const ax=this.ensure(".c-chart__axis",()=>{const el=document.createElement("div");el.className="c-chart__axis";return el});ax.textContent=axis}return}if(this.hasAttribute("error")){const plot=this.ensure(".c-chart__plot",()=>{const el=document.createElement("div");el.className="c-chart__plot";return el});plot.innerHTML="";const err=document.createElement("div");err.className="c-chart__error";err.textContent=this.getAttribute("error")||"Error";err.style.display="grid";err.style.placeItems="center";err.style.height="100%";err.style.color="var(--color-danger, var(--color-text))";if(this.hasAttribute("retry")){const btn=document.createElement("button");btn.className="c-btn c-btn--ghost c-btn--sm";btn.type="button";btn.textContent=this.getAttribute("retry")||"Retry";btn.dataset.action="retry";btn.style.marginBlockStart="var(--space-sm)";err.appendChild(btn)}plot.appendChild(err);const axis=this.getAttribute("axis");if(axis){const ax=this.ensure(".c-chart__axis",()=>{const el=document.createElement("div");el.className="c-chart__axis";return el});ax.textContent=axis}return}if(this.hasAttribute("skeleton")){const plot=this.ensure(".c-chart__plot",()=>{const el=document.createElement("div");el.className="c-chart__plot";return el});plot.innerHTML="";const count=Math.min(5,Math.max(1,parseInt(this.getAttribute("skeleton")||"3",10)||3));for(let i=0;i<count;i++){const sk=document.createElement("div");sk.className="c-skeleton";sk.style.display="block";sk.style.inlineSize="100%";sk.style.blockSize="0.6rem";sk.style.marginBlockEnd="var(--space-2xs)";plot.appendChild(sk)}const axis=this.getAttribute("axis");if(axis){const ax=this.ensure(".c-chart__axis",()=>{const el=document.createElement("div");el.className="c-chart__axis";return el});ax.textContent=axis}return}const axis=this.getAttribute("axis");if(axis){const ax=this.ensure(".c-chart__axis",()=>{const el=document.createElement("div");el.className="c-chart__axis";return el});ax.textContent=axis}else{const ax=this.querySelector(".c-chart__axis");if(ax)ax.remove()}const series=this.getAttribute("series");if(series){try{const parsed=JSON.parse(series);const plot=this.ensure(".c-chart__plot",()=>{const el=document.createElement("div");el.className="c-chart__plot";return el});plot.innerHTML="";const hasStructured=parsed.some((s)=>s&&Array.isArray(s.values));if(hasStructured){parsed.forEach((s,i)=>{const color=`var(--chart-${i + 1})`;if(s.type==="donut"){const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 200 200");svg.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";svg.setAttribute("aria-hidden","true");donutSlices(s.values).forEach((sl,si)=>{const path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("class","c-chart__line");path.setAttribute("data-series",String(i+1));path.style.setProperty("--c",color);path.setAttribute("d",sl.path);path.setAttribute("title",String(s.values[si]));svg.appendChild(path)});plot.appendChild(svg)}else if(s.type==="histogram"){const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 300 120");svg.setAttribute("preserveAspectRatio","none");svg.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";barRects(s.values).forEach((r,ri)=>{const rect=document.createElementNS("http://www.w3.org/2000/svg","rect");rect.setAttribute("class","c-chart__bar");rect.setAttribute("data-series",String(i+1));rect.style.setProperty("--c",color);rect.setAttribute("x",r.x);rect.setAttribute("y",r.y);rect.setAttribute("width",r.width);rect.setAttribute("height",r.height);rect.setAttribute("title",String(s.values[ri]));rect.setAttribute("aria-label",String(s.values[ri]));rect.setAttribute("tabindex","0");rect.setAttribute("role","button");rect.dataset.index=String(ri);svg.appendChild(rect)});plot.appendChild(svg)}else{const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 300 120");svg.setAttribute("preserveAspectRatio","none");svg.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";const path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("class","c-chart__line");path.setAttribute("data-series",String(i+1));path.style.setProperty("--c",color);path.setAttribute("d",smoothPath(s.values));svg.appendChild(path);const pts=polylinePoints(s.values).split(" ").map((p)=>p.split(",").map(Number));pts.forEach((pt,pi)=>{const circle=document.createElementNS("http://www.w3.org/2000/svg","circle");circle.setAttribute("class","c-chart__point");circle.setAttribute("data-series",String(i+1));circle.setAttribute("data-index",String(pi));circle.style.setProperty("--c",color);circle.setAttribute("cx",String(pt[0]));circle.setAttribute("cy",String(pt[1]));circle.setAttribute("r","3");circle.setAttribute("tabindex",pi===0?"0":"-1");circle.setAttribute("role","button");circle.setAttribute("title",String(s.values[pi]));circle.setAttribute("aria-label",String(s.values[pi]));svg.appendChild(circle)});plot.appendChild(svg)}})}else{const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 300 120");svg.setAttribute("preserveAspectRatio","none");svg.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";svg.setAttribute("aria-hidden","true");parsed.forEach((s,i)=>{const path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("class","c-chart__line");path.setAttribute("data-series",String(i+1));path.style.setProperty("--c",`var(--chart-${i + 1})`);path.setAttribute("d",s.d||s);svg.appendChild(path)});plot.appendChild(svg)}}catch(e){}const tip=this.ensure(".c-chart__tooltip",()=>{const el=document.createElement("div");el.className="c-chart__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","")}else{const plot=this.ensure(".c-chart__plot",()=>{const el=document.createElement("div");el.className="c-chart__plot";return el});plot.innerHTML="";const empty=document.createElement("div");empty.className="c-chart__empty";empty.textContent=this.getAttribute("empty")||"No data";empty.style.display="grid";empty.style.placeItems="center";empty.style.height="100%";empty.style.color="var(--color-text-muted)";plot.appendChild(empty)}}enhance(){if(this._wiredChart)return;this._wiredChart=true;if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");this.addEventListener("contour:legend-toggle",(e)=>{const key=e&&e.detail&&(e.detail.key||e.detail.label);const pressed=e&&e.detail&&e.detail.pressed;if(key==null)return;const nodes=this.querySelectorAll("[data-series]");nodes.forEach((n)=>{const s=n.getAttribute("data-series");if(String(s)===String(key)||n.getAttribute("data-key")===String(key)){n.style.display=pressed===false?"none":""}})});if(this.hasAttribute("zoomable")){let zoom=1,panX=0,panY=0;const plot=this.querySelector(".c-chart__plot");const apply=()=>{if(!plot)return;plot.style.transform=`translate(${panX}px, ${panY}px) scale(${zoom})`;plot.style.transformOrigin="center center"};this.addEventListener("wheel",(e)=>{e.preventDefault();const factor=e.deltaY<0?1.1:0.9;zoom=Math.min(5,Math.max(0.5,zoom*factor));apply()},{passive:false});let dragging=false,startX=0,startY=0,startPanX=0,startPanY=0;this.addEventListener("mousedown",(e)=>{if(e.button!==0)return;dragging=true;startX=e.clientX;startY=e.clientY;startPanX=panX;startPanY=panY;this.style.cursor="grabbing"});window.addEventListener("mousemove",(e)=>{if(!dragging)return;panX=startPanX+(e.clientX-startX);panY=startPanY+(e.clientY-startY);apply()});window.addEventListener("mouseup",()=>{if(dragging){dragging=false;this.style.cursor=""}});this.addEventListener("dblclick",()=>{zoom=1;panX=0;panY=0;apply()})}let plotRectCache=null;let plotRectObserver=null;const invalidatePlotRect=()=>{plotRectCache=null};const showTip=(e)=>{const plot=this.querySelector(".c-chart__plot");const tip=this.querySelector(".c-chart__tooltip");if(!plot||!tip)return;const mark=e.target&&e.target.closest?e.target.closest(".c-chart__bar, .c-chart__point, .c-chart__line"):null;if(!mark||!plot.contains(mark)){tip.setAttribute("hidden","");return}const title=mark.getAttribute("title");if(title)tip.textContent=title;if(!plotRectCache){plotRectCache=plot.getBoundingClientRect();if(!plotRectObserver&&typeof ResizeObserver==="function"){plotRectObserver=new ResizeObserver(invalidatePlotRect);plotRectObserver.observe(plot)}}const rect=plotRectCache;const mr=mark.getBoundingClientRect();const x=mr.left-rect.left+mr.width/2;const y=mr.top-rect.top;plot.style.setProperty("--chart-tip-inline-start",x+"px");plot.style.setProperty("--chart-tip-block-start",y+"px");tip.removeAttribute("hidden")};const hideTip=()=>{const tip=this.querySelector(".c-chart__tooltip");if(tip)tip.setAttribute("hidden","")};this.addEventListener("mousemove",showTip);this.addEventListener("mouseleave",hideTip);onDispose(this,()=>{if(plotRectObserver){plotRectObserver.disconnect();plotRectObserver=null}});this.addEventListener("focusin",(e)=>{const mark=e.target&&e.target.closest?e.target.closest(".c-chart__bar, .c-chart__point, .c-chart__line"):null;if(mark&&this.contains(mark))showTip({target:mark})});this.addEventListener("focusout",(e)=>{if(!this.contains(e.relatedTarget))hideTip()});this.addEventListener("click",(e)=>{const plot2=this.querySelector(".c-chart__plot");if(!plot2)return;const bar=e.target&&e.target.closest?e.target.closest(".c-chart__bar"):null;if(bar&&plot2.contains(bar)){const series=parseInt(bar.getAttribute("data-series")||"1",10);const index=parseInt(bar.dataset.index||"0",10);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series,index}}));return}const point=e.target&&e.target.closest?e.target.closest(".c-chart__point"):null;if(point&&plot2.contains(point)){const series=parseInt(point.getAttribute("data-series")||"1",10);const index=parseInt(point.dataset.index||"0",10);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series,index}}))}});this.addEventListener("keydown",(e)=>{const plot2=this.querySelector(".c-chart__plot");if(!plot2)return;const bar=e.target&&e.target.closest?e.target.closest(".c-chart__bar"):null;if(bar&&plot2.contains(bar)){if(e.key==="Enter"||e.key===" "){e.preventDefault();const series=parseInt(bar.getAttribute("data-series")||"1",10);const index=parseInt(bar.dataset.index||"0",10);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series,index}}))}return}const point=e.target&&e.target.closest?e.target.closest(".c-chart__point"):null;if(point&&plot2.contains(point)){if(e.key==="Enter"||e.key===" "){e.preventDefault();const series=parseInt(point.getAttribute("data-series")||"1",10);const index=parseInt(point.dataset.index||"0",10);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series,index}}))}else if(e.key==="ArrowRight"||e.key==="ArrowLeft"){e.preventDefault();const points=Array.from(plot2.querySelectorAll('.c-chart__point[data-series="'+point.getAttribute("data-series")+'"]'));const idx=points.indexOf(point);const next=e.key==="ArrowRight"?Math.min(idx+1,points.length-1):Math.max(idx-1,0);if(next!==idx&&points[next]){points.forEach((p,i)=>p.setAttribute("tabindex",i===next?"0":"-1"));try{points[next].focus()}catch(err){}}}}});this.addEventListener("keydown",(e)=>{if(e.target!==this)return;let seriesCount=0;try{seriesCount=JSON.parse(this.getAttribute("series")||"[]").length}catch(e){seriesCount=0}if(seriesCount===0)return;if(this._activeSeries===undefined)this._activeSeries=0;let next=this._activeSeries;const rtl=(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl";if(e.key==="ArrowRight")next=rtl?Math.max(this._activeSeries-1,0):Math.min(this._activeSeries+1,seriesCount-1);else if(e.key==="ArrowLeft")next=rtl?Math.min(this._activeSeries+1,seriesCount-1):Math.max(this._activeSeries-1,0);else if(e.key==="ArrowDown")next=Math.min(this._activeSeries+1,seriesCount-1);else if(e.key==="ArrowUp")next=Math.max(this._activeSeries-1,0);else if(e.key==="Home")next=0;else if(e.key==="End")next=seriesCount-1;else if(e.key==="Enter"||e.key===" "){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series:this._activeSeries}}));return}else return;if(next!==this._activeSeries){e.preventDefault();this._activeSeries=next;this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series:next}}))}})}}define("contour-chart",ContourChart);class ContourComparison extends ContourBase{static get observed(){return["divider","value"]}static get properties(){return{divider:{attribute:"divider"},value:{attribute:"value"}}}render(){this.classList.add("c-comparison");this.style.blockSize="12rem";this.style.setProperty("--comparison-pos",(this.getAttribute("value")||"50")+"%");if(!this.querySelector(".c-comparison__pane--before")){const p=document.createElement("div");p.className="c-comparison__pane c-comparison__pane--before";p.textContent="Before";this.appendChild(p)}if(!this.querySelector(".c-comparison__pane:not(.c-comparison__pane--before)")){const p=document.createElement("div");p.className="c-comparison__pane";p.textContent="After";this.appendChild(p)}const divider=this.getAttribute("divider");if(divider!==null){const d=this.ensure(".c-comparison__divider",()=>{const el=document.createElement("div");el.className="c-comparison__divider";el.setAttribute("role","separator");el.setAttribute("aria-orientation","vertical");el.setAttribute("tabindex","0");return el});if(divider)d.textContent=divider}else{const d=this.querySelector(".c-comparison__divider");if(d)d.remove()}}enhance(){if(this._wiredComparison)return;this._wiredComparison=true;const divider=()=>this.querySelector(".c-comparison__divider");const setPos=(pct)=>{const clamped=Math.max(0,Math.min(100,pct));this.style.setProperty("--comparison-pos",clamped+"%");this.setAttribute("value",String(Math.round(clamped)));this.dispatchEvent(new CustomEvent("contour:drag",{bubbles:true,composed:true,detail:{value:clamped}}))};let dragging=false;const onMove=(e)=>{if(!dragging)return;const rect=this.getBoundingClientRect();const pct=((e.clientX-rect.left)/rect.width)*100;setPos(pct)};const onUp=()=>{dragging=false;window.removeEventListener("mousemove",onMove);window.removeEventListener("mouseup",onUp)};this.addEventListener("mousedown",(e)=>{const d=divider();if(!d||!d.contains(e.target))return;dragging=true;window.addEventListener("mousemove",onMove);window.addEventListener("mouseup",onUp);e.preventDefault()});this.addEventListener("keydown",(e)=>{const d=divider();if(!d||document.activeElement!==d)return;const cur=parseFloat(this.style.getPropertyValue("--comparison-pos"))||50;if(e.key==="ArrowLeft"){e.preventDefault();setPos(cur-5)}else if(e.key==="ArrowRight"){e.preventDefault();setPos(cur+5)}})}}define("contour-comparison",ContourComparison);class ContourStreamingChart extends ContourBase{static get observed(){return["line","dot","interval","pause","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{line:{attribute:"line"},dot:{attribute:"dot"},interval:{attribute:"interval",type:Number},pause:{attribute:"pause",type:Boolean},src:{attribute:"src"}}}render(){this.classList.add("c-streaming-chart");wireStates(this);loadRemote(this,"line");if(renderStates(this,"streaming-chart"))return;const line=remoteData(this,"line");const dot=remoteData(this,"dot");if(!line){const svg=this.querySelector("svg");if(svg)svg.remove();renderEmpty(this,"streaming-chart");return}if(line){let svg=this.querySelector("svg");if(!svg){svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 300 192");svg.setAttribute("aria-hidden","true");this.appendChild(svg)}let path=svg.querySelector(".c-streaming-chart__line");if(!path){path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("class","c-streaming-chart__line");svg.appendChild(path)}path.setAttribute("d",line);if(dot){let circle=svg.querySelector(".c-streaming-chart__live-dot");if(!circle){circle=document.createElementNS("http://www.w3.org/2000/svg","circle");circle.setAttribute("class","c-streaming-chart__live-dot");circle.setAttribute("r","4");svg.appendChild(circle)}const parts=dot.split(/[ ,]+/);if(parts.length>=2){circle.setAttribute("cx",parts[0]);circle.setAttribute("cy",parts[1])}}}}enhance(){const sync=()=>{const seconds=parseFloat(this.getAttribute("interval")||"");const want=Number.isFinite(seconds)&&seconds>0&&!this.hasAttribute("pause")&&this._viewVisible!==false;if(want===this._streamRunning)return;this._streamRunning=want;if(this._streamTimer!==undefined){clearInterval(this._streamTimer);this._streamTimer=undefined}this.dispatchEvent(new CustomEvent("contour:stream-state",{detail:{running:want},bubbles:true,composed:true}));if(!want)return;this._streamTimer=setInterval(()=>{if(!this.isConnected||this.hasAttribute("pause"))return;this._streamFrame+=1;this.dispatchEvent(new CustomEvent("contour:tick",{detail:{frame:this._streamFrame},bubbles:true,composed:true}));const src=this.getAttribute("src");if(src){remoteInvalidate(src);this.requestRender()}},Math.max(1000,seconds*1000))};sync();if(!this._wiredStreamView){this._wiredStreamView=true;this._viewVisible=true;watchViewport(this);this.addEventListener("contour:view-enter",()=>{this._viewVisible=true;sync()});this.addEventListener("contour:view-leave",()=>{this._viewVisible=false;sync()})}if(this._wiredStream)return;this._wiredStream=true;this._streamFrame=0;onDispose(this,()=>{if(this._streamTimer!==undefined){clearInterval(this._streamTimer);this._streamTimer=undefined}})}}define("contour-streaming-chart",ContourStreamingChart);class ContourMeter extends ContourBase{static get observed(){return["value","label","variant","min","max","low","high","optimum","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"},variant:{attribute:"variant"},min:{attribute:"min"},max:{attribute:"max"},low:{attribute:"low"},high:{attribute:"high"},optimum:{attribute:"optimum"},src:{attribute:"src"}}}render(){this.classList.add("c-meter");wireStates(this);loadRemote(this,["value","label"]);if(renderStates(this,"meter"))return;const rValue=remoteData(this,"value")||(this._remoteData&&this._remoteData.value);const label=remoteData(this,"label")||(this._remoteData&&this._remoteData.label)||"";const variant=this.getAttribute("variant");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-meter--"))this.classList.remove(c)});if(variant)this.classList.add("c-meter--"+variant);if(!rValue&&!label){renderEmpty(this,"meter");return}if(rValue===null){this.style.removeProperty("--meter-value")}else{this.style.setProperty("--meter-value",rValue)}const core=this.ensure(".c-meter__core",()=>{const el=document.createElement("span");el.className="c-meter__core";return el});let val=core.querySelector(".c-meter__value");if(!val){val=document.createElement("span");val.className="c-meter__value";core.appendChild(val)}const num=parseFloat(rValue);val.textContent=(Number.isFinite(num)?Math.round(num*100):0)+"%";if(label){const lbl=core.querySelector(".c-meter__label")||(()=>{const el=document.createElement("span");el.className="c-meter__label";core.appendChild(el);return el})();lbl.textContent=label}if(!this.hasAttribute("role"))this.setAttribute("role","meter");if(label&&!this.hasAttribute("aria-label"))this.setAttribute("aria-label",label);const ariaValue=rValue===null?"0":rValue;const prevVal=this._meterAriaValue;if(!this.hasAttribute("aria-valuenow")||this.getAttribute("aria-valuenow")===prevVal){this.setAttribute("aria-valuenow",ariaValue);this._meterAriaValue=ariaValue}const min=this.getAttribute("min");const max=this.getAttribute("max");if(min!==null)this.setAttribute("aria-valuemin",min);else if(!this.hasAttribute("aria-valuemin"))this.setAttribute("aria-valuemin","0");if(max!==null)this.setAttribute("aria-valuemax",max);else if(!this.hasAttribute("aria-valuemax"))this.setAttribute("aria-valuemax","1");for(const a of["low","high","optimum"]){const v=this.getAttribute(a);if(v!==null)this.setAttribute("data-"+a,v);else this.removeAttribute("data-"+a)}}}define("contour-meter",ContourMeter);class ContourDelta extends ContourBase{static get observed(){return["value","direction","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{value:{attribute:"value"},direction:{attribute:"direction"},src:{attribute:"src"}}}render(){this.classList.add("c-delta");wireStates(this);loadRemote(this,"value");if(renderStates(this,"delta"))return;const value=remoteData(this,"value")||"";Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-delta--"))this.classList.remove(c)});const direction=this.getAttribute("direction")||(this._remoteData&&this._remoteData.direction)||"up";if(!value){renderEmpty(this,"delta");return}this.classList.add("c-delta--"+direction);const icon={up:"#i-arrow-up",down:"#i-arrow-down",flat:"#i-minus"}[direction]||"#i-arrow-up";this.querySelectorAll("svg").forEach((s)=>s.remove());const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("aria-hidden","true");const use=document.createElementNS("http://www.w3.org/2000/svg","use");use.setAttribute("href",icon);svg.appendChild(use);this.appendChild(svg);this.appendChild(document.createTextNode(" "+value))}}define("contour-delta",ContourDelta);class ContourStat extends ContourBase{static get observed(){return["value","label","delta","unit","format","locale","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"},delta:{attribute:"delta"},unit:{attribute:"unit"},format:{attribute:"format"},locale:{attribute:"locale"},src:{attribute:"src"}}}render(){this.classList.add("c-stat");wireStates(this);loadRemote(this,["value","label"]);if(renderStates(this,"stat"))return;const value=remoteData(this,"value");const label=remoteData(this,"label");const delta=this.getAttribute("delta");if(value){const v=this.ensure(".c-stat__value",()=>{const el=document.createElement("div");el.className="c-stat__value";el.setAttribute("aria-live","polite");return el});v.textContent=formatValue(value,this.getAttribute("format"),this.getAttribute("locale"))}else{const v=this.querySelector(".c-stat__value");if(v)v.remove()}if(label){const l=this.ensure(".c-stat__label",()=>{const el=document.createElement("div");el.className="c-stat__label";return el});l.textContent=label}else{const l=this.querySelector(".c-stat__label");if(l)l.remove()}if(delta){const d=this.ensure(".c-stat__delta",()=>{const el=document.createElement("div");el.className="c-stat__delta";return el});d.textContent=delta}else{const d=this.querySelector(".c-stat__delta");if(d)d.remove()}const unit=this.getAttribute("unit");const v=this.querySelector(".c-stat__value");if(v){if(unit){let u=v.querySelector(".c-stat__unit");if(!u){u=document.createElement("span");u.className="c-stat__unit";v.appendChild(u)}u.textContent=unit}else{const u=v.querySelector(".c-stat__unit");if(u)u.remove()}}if(!value&&!label){renderEmpty(this,"stat")}}}define("contour-stat",ContourStat);class ContourInstrument extends ContourBase{static get observed(){return["rows","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{rows:{attribute:"rows"},src:{attribute:"src"}}}render(){this.classList.add("c-instrument");wireStates(this);loadRemote(this,"rows");if(renderStates(this,"instrument"))return;const rows=remoteData(this,"rows");Array.from(this.querySelectorAll(".c-instrument__item")).forEach((n)=>n.remove());if(rows){try{const parsed=JSON.parse(rows);parsed.forEach((r)=>{const item=document.createElement("span");item.className="c-instrument__item";item.appendChild(document.createTextNode(String(r.key||r[0]||"")));const val=document.createElement("span");val.className="c-instrument__value";val.textContent=r.value||r[1]||"";item.appendChild(val);this.appendChild(item)})}catch(e){}}else{renderEmpty(this,"instrument")}}}define("contour-instrument",ContourInstrument);class ContourBivariate extends ContourBase{static get observed(){return["size","axis-x","axis-y"]}static get properties(){return{size:{attribute:"size"},axisX:{attribute:"axis-x"},axisY:{attribute:"axis-y"}}}render(){this.classList.add("c-bivariate");const size=Math.min(12,Math.max(1,parseInt(this.getAttribute("size")||"3",10)||3));const matrix=this.ensure(".c-bivariate__matrix",()=>{const el=document.createElement("div");el.className="c-bivariate__matrix";return el});matrix.style.gridTemplateColumns=`repeat(${size}, 1fr)`;const authored=Array.from(matrix.children).filter((n)=>n.classList&&n.classList.contains("c-bivariate__cell"));if(!authored.length){matrix.innerHTML="";for(let i=0;i<size*size;i++){const cell=document.createElement("div");cell.className="c-bivariate__cell";matrix.appendChild(cell)}}const axisX=this.getAttribute("axis-x");if(axisX){const ax=this.ensure(".c-bivariate__axis--x",()=>{const el=document.createElement("div");el.className="c-bivariate__axis c-bivariate__axis--x";return el});ax.textContent=axisX}else{const ax=this.querySelector(".c-bivariate__axis--x");if(ax)ax.remove()}const axisY=this.getAttribute("axis-y");if(axisY){const ay=this.ensure(".c-bivariate__axis--y",()=>{const el=document.createElement("div");el.className="c-bivariate__axis c-bivariate__axis--y";return el});ay.textContent=axisY}else{const ay=this.querySelector(".c-bivariate__axis--y");if(ay)ay.remove()}}}define("contour-bivariate",ContourBivariate);class ContourSurvey extends ContourBase{static get observed(){return["date","instrument","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{date:{attribute:"date"},instrument:{attribute:"instrument"},src:{attribute:"src"}}}render(){this.classList.add("c-survey");wireStates(this);loadRemote(this,"date");if(renderStates(this,"survey"))return;const date=remoteData(this,"date");Array.from(this.childNodes).forEach((n)=>{if(n.nodeType===Node.TEXT_NODE){if(n.textContent.trim()==="Surveyed"||n.textContent.trim()==="·")n.remove()}else if(n.classList&&(n.classList.contains("c-survey__value")||n.classList.contains("c-survey__sep")))n.remove()});const rDate=date||(this._remoteData&&this._remoteData.date);const instrument=this.getAttribute("instrument")||(this._remoteData&&this._remoteData.instrument);if(!rDate){renderEmpty(this,"survey");return}const v=document.createElement("span");v.className="c-survey__value";v.textContent=rDate;this.appendChild(document.createTextNode("Surveyed "));this.appendChild(v);if(instrument){const sep=document.createElement("span");sep.className="c-survey__sep";sep.textContent="·";this.appendChild(sep);const v2=document.createElement("span");v2.className="c-survey__value";v2.textContent=instrument;this.appendChild(v2)}}}define("contour-survey",ContourSurvey);class ContourThreshold extends ContourBase{static get observed(){return["label","norm","state","value","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},norm:{attribute:"norm"},state:{attribute:"state"},value:{attribute:"value"},src:{attribute:"src"}}}render(){this.classList.add("c-threshold");wireStates(this);loadRemote(this,"value");if(renderStates(this,"threshold"))return;const pct=(v)=>{const n=Number(v);if(!Number.isFinite(n))return String(v);return(n<=1?n*100:n)+"%"};const rValue=remoteData(this,"value")||(this._remoteData&&this._remoteData.value);const target=this.getAttribute("norm")||(this._remoteData&&this._remoteData.norm);const state=this.getAttribute("state")||(this._remoteData&&this._remoteData.state);const label=this.getAttribute("label")||(this._remoteData&&this._remoteData.label);if(!rValue&&!target&&!label){renderEmpty(this,"threshold");return}if(rValue){const v=this.ensure(".c-threshold__fill",()=>{const el=document.createElement("span");el.className="c-threshold__fill";return el});v.style.setProperty("--value",pct(rValue))}else{const v=this.querySelector(".c-threshold__fill");if(v)v.remove()}if(target){const t=this.ensure(".c-threshold__target",()=>{const el=document.createElement("span");el.className="c-threshold__target";return el});t.style.setProperty("--target",pct(target))}else{const t=this.querySelector(".c-threshold__target");if(t)t.remove()}if(state)this.setAttribute("data-state",state);else this.removeAttribute("data-state");if(label)this.setAttribute("aria-label",label)}}define("contour-threshold",ContourThreshold);class ContourMetricsFull extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-metrics");wireStates(this);loadRemote(this,"items");if(renderStates(this,"metrics"))return;const items=remoteData(this,"items");Array.from(this.querySelectorAll(".c-metrics__item")).forEach((n)=>n.remove());let parsed=null;if(items){try{parsed=JSON.parse(items)}catch(e){parsed=null}}if(Array.isArray(parsed)&&parsed.length){parsed.forEach((it)=>{const item=document.createElement("div");item.className="c-metrics__item";const v=document.createElement("div");v.className="c-metrics__value";v.textContent=(typeof it==="object"&&it!==null)?(it.value??it.v??""):String(it);const l=document.createElement("div");l.className="c-metrics__label";l.textContent=(typeof it==="object"&&it!==null)?(it.label??it.l??""):"";item.appendChild(v);item.appendChild(l);this.appendChild(item)})}else if(!items){renderEmpty(this,"metrics")}}enhance(){wireStates(this)}}define("contour-metrics",ContourMetricsFull);class ContourLegend extends ContourBase{static get observed(){return["title","ramp","scale","items","method","norm","selectable","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{title:{attribute:"title"},ramp:{attribute:"ramp"},scale:{attribute:"scale"},items:{attribute:"items"},method:{attribute:"method"},norm:{attribute:"norm"},selectable:{attribute:"selectable",type:Boolean},src:{attribute:"src"}}}render(){this.classList.add("c-legend");wireStates(this);loadRemote(this,"items");if(renderStates(this,"legend"))return;const selectable=this.hasAttribute("selectable");const items=remoteData(this,"items");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-legend__title",()=>{const el=document.createElement("div");el.className="c-legend__title";return el});t.textContent=title}else{const t=this.querySelector(".c-legend__title");if(t)t.remove()}if(items){try{const parsed=JSON.parse(items);const list=this.ensure(".c-legend__items",()=>{const el=document.createElement("div");el.className="c-legend__items";return el});list.innerHTML="";parsed.forEach((it)=>{const label=typeof it==="string"?it:(it.label||String(it));const key=typeof it==="string"?it:(it.key||it.label||String(it));const item=document.createElement(selectable?"button":"div");item.className="c-legend__item";if(selectable){item.type="button";item.setAttribute("aria-pressed","true");item.dataset.key=key}const sw=document.createElement("span");sw.className="c-legend__swatch";if(it&&it.color)sw.style.background=it.color;item.appendChild(sw);const lbl=document.createElement("span");lbl.textContent=label;item.appendChild(lbl);list.appendChild(item)})}catch(e){}}else{const list=this.querySelector(".c-legend__items");if(list)list.remove();const hasOther=this.getAttribute("title")||this.getAttribute("ramp")||this.getAttribute("scale")||this.getAttribute("method")||this.getAttribute("norm");if(!hasOther){renderEmpty(this,"legend")}}const method=this.getAttribute("method");if(method){const m=this.ensure(".c-legend__method",()=>{const el=document.createElement("div");el.className="c-legend__method";return el});m.textContent=method}else{const m=this.querySelector(".c-legend__method");if(m)m.remove()}const norm=this.getAttribute("norm");if(norm){const n=this.ensure(".c-legend__norm",()=>{const el=document.createElement("span");el.className="c-legend__norm";return el});n.textContent=norm}else{const n=this.querySelector(".c-legend__norm");if(n)n.remove()}const ramp=this.getAttribute("ramp");if(ramp){const r=this.ensure(".c-legend__ramp",()=>{const el=document.createElement("div");el.className="c-legend__ramp";return el});r.style.background=ramp}else{const r=this.querySelector(".c-legend__ramp");if(r)r.remove()}const scale=this.getAttribute("scale");if(scale){const sc=this.ensure(".c-legend__scale",()=>{const el=document.createElement("div");el.className="c-legend__scale";return el});sc.textContent=scale}else{const sc=this.querySelector(".c-legend__scale");if(sc)sc.remove()}}enhance(){if(this._wiredLegend)return;this._wiredLegend=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-legend__item"):null;if(!btn||!this.contains(btn))return;const pressed=btn.getAttribute("aria-pressed")!=="true";btn.setAttribute("aria-pressed",String(pressed));this.dispatchEvent(new CustomEvent("contour:legend-toggle",{detail:{label:btn.textContent.trim(),key:btn.dataset.key||btn.textContent.trim(),pressed},bubbles:true,composed:true,}))})}}define("contour-legend",ContourLegend);class ContourMeasure extends ContourBase{static get observed(){return["label","value","point","line","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},point:{attribute:"point"},line:{attribute:"line"},src:{attribute:"src"}}}render(){this.classList.add("c-measure");wireStates(this);loadRemote(this,["label","value","point","line"]);if(renderStates(this,"measure"))return;const rLabel=remoteData(this,"label");const rValue=remoteData(this,"value");const rPoint=remoteData(this,"point");const rLine=remoteData(this,"line");if(!rLabel&&!rValue&&!rPoint&&!rLine){renderEmpty(this,"measure");return}if(rLabel){const l=this.ensure(".c-measure__label",()=>{const el=document.createElement("span");el.className="c-measure__label";return el});l.textContent=rLabel}else{const l=this.querySelector(".c-measure__label");if(l)l.remove()}if(rValue){const r=this.ensure(".c-measure__readout",()=>{const el=document.createElement("span");el.className="c-measure__readout";return el});r.textContent=rValue}else{const r=this.querySelector(".c-measure__readout");if(r)r.remove()}if(rPoint){const p=this.ensure(".c-measure__point",()=>{const el=document.createElement("span");el.className="c-measure__point";return el});p.textContent=rPoint}else{const p=this.querySelector(".c-measure__point");if(p)p.remove()}if(!rLine){const svg=this.querySelector("svg");if(svg)svg.remove();return}if(rLine){const ln=this.ensure(".c-measure__line",()=>{const el=document.createElement("span");el.className="c-measure__line";return el});ln.style.inlineSize=rLine}else{const ln=this.querySelector(".c-measure__line");if(ln)ln.remove()}}}define("contour-measure",ContourMeasure);class ContourTimeline extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-timeline");wireStates(this);loadRemote(this,"items");if(renderStates(this,"timeline"))return;const authored=Array.from(this.children).filter((n)=>n.classList&&n.classList.contains("c-timeline__item"));const items=remoteData(this,"items");if(items&&!authored.length){Array.from(this.querySelectorAll(".c-timeline__item")).forEach((n)=>n.remove());try{const parsed=JSON.parse(items);parsed.forEach((it)=>{const item=document.createElement("div");item.className="c-timeline__item";if(it.time){const t=document.createElement("time");t.className="c-timeline__time";t.textContent=it.time;item.appendChild(t)}if(it.title){const ti=document.createElement("div");ti.className="c-timeline__title";ti.textContent=it.title;item.appendChild(ti)}if(it.text){const tx=document.createElement("div");tx.className="c-timeline__text";tx.textContent=it.text;item.appendChild(tx)}this.appendChild(item)})}catch(e){}}else if(!authored.length){renderEmpty(this,"timeline")}}enhance(){if(this._wiredTimeline)return;this._wiredTimeline=true}}define("contour-timeline",ContourTimeline);class ContourHeatmap extends ContourBase{static get observed(){return["cells","count","legend","empty","loading","values","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{cells:{attribute:"cells"},count:{attribute:"count"},legend:{attribute:"legend"},src:{attribute:"src"}}}render(){this.classList.add("c-heatmap");if(!this.hasAttribute("role"))this.setAttribute("role","grid");wireStates(this);loadRemote(this,"cells");if(renderStates(this,"heatmap"))return;Array.from(this.querySelectorAll(".c-heatmap__cell")).forEach((n)=>n.remove());const count=Math.min(200,Math.max(0,parseInt(this.getAttribute("cells")||this.getAttribute("count")||"0",10)||0));const cols=count>0?Math.ceil(Math.sqrt(count)):1;this.style.gridTemplateColumns="repeat("+cols+", 1fr)";this.style.inlineSize="16rem";if(count>0){let values=[];try{values=JSON.parse(this.getAttribute("values")||"[]")}catch(e){values=[]}for(let i=0;i<count;i++){const cell=document.createElement("div");cell.className="c-heatmap__cell";cell.setAttribute("role","gridcell");cell.setAttribute("tabindex",i===0?"0":"-1");cell.dataset.index=String(i);if(values[i]!==undefined)cell.setAttribute("title",String(values[i]));this.appendChild(cell)}const tip=this.ensure(".c-heatmap__tooltip",()=>{const el=document.createElement("div");el.className="c-heatmap__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","")}else{renderEmpty(this,"heatmap")}if(this.hasAttribute("legend")){const leg=this.ensure(".c-heatmap__legend",()=>{const el=document.createElement("div");el.className="c-heatmap__legend";const bar=document.createElement("div");bar.className="c-heatmap__legend-bar";el.appendChild(bar);return el})}else{const leg=this.querySelector(".c-heatmap__legend");if(leg)leg.remove()}}enhance(){if(this._wiredHeatmap)return;this._wiredHeatmap=true;const cells=()=>Array.from(this.querySelectorAll(".c-heatmap__cell"));const showTip=(e)=>{const tip=this.querySelector(".c-heatmap__tooltip");if(!tip)return;const cell=e.target&&e.target.closest?e.target.closest(".c-heatmap__cell"):null;if(!cell||!this.contains(cell)){tip.setAttribute("hidden","");return}const title=cell.getAttribute("title");if(title)tip.textContent=title;else tip.textContent="Cell "+(cell.dataset.index||"");const rect=this.getBoundingClientRect();const cr=cell.getBoundingClientRect();this.style.position=this.style.position||"relative";tip.style.setProperty("--chart-tip-inline-start",(cr.left-rect.left+cr.width/2)+"px");tip.style.setProperty("--chart-tip-block-start",(cr.top-rect.top)+"px");tip.removeAttribute("hidden")};const hideTip=()=>{const tip=this.querySelector(".c-heatmap__tooltip");if(tip)tip.setAttribute("hidden","")};this.addEventListener("mouseover",showTip);this.addEventListener("mouseout",(e)=>{if(!e.relatedTarget||!this.contains(e.relatedTarget))hideTip()});this.addEventListener("focusin",(e)=>{const cell=e.target&&e.target.closest?e.target.closest(".c-heatmap__cell"):null;if(cell&&this.contains(cell))showTip({target:cell})});this.addEventListener("focusout",(e)=>{if(!this.contains(e.relatedTarget))hideTip()});this.addEventListener("keydown",(e)=>{const cell=e.target&&e.target.closest?e.target.closest(".c-heatmap__cell"):null;if(!cell||!this.contains(cell))return;const list=cells();const idx=list.indexOf(cell);let next=-1;const rtl=(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl";if(e.key==="ArrowRight")next=rtl?Math.max(idx-1,0):Math.min(idx+1,list.length-1);else if(e.key==="ArrowLeft")next=rtl?Math.min(idx+1,list.length-1):Math.max(idx-1,0);else if(e.key==="ArrowDown")next=Math.min(idx+Math.ceil(Math.sqrt(list.length)),list.length-1);else if(e.key==="ArrowUp")next=Math.max(idx-Math.ceil(Math.sqrt(list.length)),0);else if(e.key==="Home")next=0;else if(e.key==="End")next=list.length-1;else if(e.key==="Enter"||e.key===" "){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series:1,index:idx}}));return}if(next>=0&&next!==idx){e.preventDefault();list.forEach((c,i)=>c.setAttribute("tabindex",i===next?"0":"-1"));try{list[next].focus()}catch(e){}}});this.addEventListener("click",(e)=>{const cell=e.target&&e.target.closest?e.target.closest(".c-heatmap__cell"):null;if(!cell||!this.contains(cell))return;const idx=cells().indexOf(cell);if(idx>=0)this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series:1,index:idx}}))})}}define("contour-heatmap",ContourHeatmap);class ContourCompare extends ContourBase{static get observed(){return["no","text","yes","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{no:{attribute:"no"},text:{attribute:"text"},yes:{attribute:"yes"},src:{attribute:"src"}}}render(){this.classList.add("c-compare");this.style.padding="var(--space-md)";wireStates(this);loadRemote(this,["no","text","yes"]);if(renderStates(this,"compare"))return;const rYes=remoteData(this,"yes")||(this._remoteData&&this._remoteData.yes);const rNo=remoteData(this,"no")||(this._remoteData&&this._remoteData.no);const rText=remoteData(this,"text")||(this._remoteData&&this._remoteData.text);Array.from(this.querySelectorAll(".c-compare__yes, .c-compare__no, .c-compare__text")).forEach((n)=>n.remove());if(rYes){const y=document.createElement("span");y.className="c-compare__yes";y.innerHTML='<svg aria-hidden="true"><use href="#i-check" /></svg>';this.appendChild(y)}if(rNo){const n=document.createElement("div");n.className="c-compare__no";n.textContent=rNo;this.appendChild(n)}if(rText){const t=document.createElement("p");t.className="c-compare__text";t.textContent=rText;this.appendChild(t)}if(!rYes&&!rNo&&!rText){renderEmpty(this,"compare")}}}define("contour-compare",ContourCompare);class ContourSparkline extends ContourBase{static get observed(){return["points","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{points:{attribute:"points"},src:{attribute:"src"}}}render(){this.classList.add("c-sparkline");if(!this.hasAttribute("role"))this.setAttribute("role","img");if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label","Sparkline");wireStates(this);loadRemote(this,"points");if(renderStates(this,"sparkline"))return;const points=remoteData(this,"points");if(points){try{const parsed=JSON.parse(points);if(!Array.isArray(parsed)||parsed.length===0)throw new Error("empty");Array.from(this.querySelectorAll(".c-sparkline__dot, .c-sparkline__line, .c-sparkline__area")).forEach((n)=>n.remove());const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("class","c-sparkline__line");svg.setAttribute("viewBox","0 0 100 30");svg.setAttribute("preserveAspectRatio","none");svg.style.inlineSize="100%";svg.style.blockSize="100%";svg.setAttribute("width","100%");svg.setAttribute("height","100%");svg.setAttribute("title",this.getAttribute("aria-label")||"Sparkline");const path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("d",parsed.map((p,i)=>(i===0?"M":"L")+" "+(i*100/(parsed.length-1))+" "+(30-p*30)).join(" "));svg.appendChild(path);const dot=document.createElementNS("http://www.w3.org/2000/svg","circle");dot.setAttribute("class","c-sparkline__dot");dot.setAttribute("r","2");dot.setAttribute("cx","0");dot.setAttribute("cy","15");dot.setAttribute("hidden","");svg.appendChild(dot);this.appendChild(svg);this._sparkPoints=parsed;const tip=this.ensure(".c-sparkline__tooltip",()=>{const el=document.createElement("div");el.className="c-sparkline__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","")}catch(e){Array.from(this.querySelectorAll("svg")).forEach((n)=>n.remove());renderEmpty(this,"sparkline")}}else{renderEmpty(this,"sparkline")}}enhance(){if(this._wiredSparkline)return;this._wiredSparkline=true;if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");const showTip=(e)=>{const svg=this.querySelector("svg");const tip=this.querySelector(".c-sparkline__tooltip");const dot=this.querySelector(".c-sparkline__dot");if(!tip||!svg)return;const rect=svg.getBoundingClientRect();const x=e.clientX-rect.left;const pct=Math.max(0,Math.min(1,x/rect.width));const pts=this._sparkPoints||[];if(pts.length===0)return;const idx=Math.round(pct*(pts.length-1));const val=pts[idx];const cx=(idx*100/(pts.length-1));const cy=30-val*30;if(dot){dot.setAttribute("cx",String(cx));dot.setAttribute("cy",String(cy));dot.removeAttribute("hidden")}tip.textContent=String(val);const tipX=(cx/100)*rect.width;tip.style.setProperty("--chart-tip-inline-start",tipX+"px");tip.style.setProperty("--chart-tip-block-start","0px");tip.removeAttribute("hidden")};const hideTip=()=>{const tip=this.querySelector(".c-sparkline__tooltip");const dot=this.querySelector(".c-sparkline__dot");if(tip)tip.setAttribute("hidden","");if(dot)dot.setAttribute("hidden","")};this.addEventListener("mousemove",showTip);this.addEventListener("mouseleave",hideTip);this.addEventListener("focusin",()=>{const pts=this._sparkPoints||[];if(!pts.length)return;const svg=this.querySelector("svg");if(!svg)return;const r=svg.getBoundingClientRect();showTip({clientX:r.left+r.width-1})});this.addEventListener("focusout",hideTip);this.addEventListener("keydown",(e)=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series:1}}))}})}}define("contour-sparkline",ContourSparkline);class ContourChartGrid extends ContourBase{static get observed(){return["title","series","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{title:{attribute:"title"},series:{attribute:"series"},src:{attribute:"src"}}}render(){this.classList.add("c-chart-grid");wireStates(this);loadRemote(this,"series");if(renderStates(this,"chart-grid"))return;const title=this.getAttribute("title");if(title){const t=this.ensure(".c-chart-grid__title",()=>{const el=document.createElement("div");el.className="c-chart-grid__title";return el});t.textContent=title}const series=remoteData(this,"series");if(!series&&!title)renderEmpty(this,"chart-grid")}}define("contour-chart-grid",ContourChartGrid);class ContourContourPlot extends ContourBase{static get observed(){return["axis","label"]}static get properties(){return{axis:{attribute:"axis"},label:{attribute:"label"}}}render(){this.classList.add("c-contour-plot");const axis=this.getAttribute("axis");if(axis){let svg=this.querySelector("svg");if(!svg){svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 100 100");svg.setAttribute("aria-hidden","true");this.appendChild(svg)}let ax=svg.querySelector(".c-contour-plot__axis");if(!ax){ax=document.createElementNS("http://www.w3.org/2000/svg","line");ax.setAttribute("class","c-contour-plot__axis");svg.appendChild(ax)}}const label=this.getAttribute("label");if(label){let svg=this.querySelector("svg");if(!svg){svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 100 100");svg.setAttribute("aria-hidden","true");this.appendChild(svg)}let lbl=svg.querySelector(".c-contour-plot__label");if(!lbl){lbl=document.createElementNS("http://www.w3.org/2000/svg","text");lbl.setAttribute("class","c-contour-plot__label");svg.appendChild(lbl)}lbl.textContent=label}}}define("contour-contour-plot",ContourContourPlot);class ContourDocsNav extends ContourBase{static get observed(){return["items","title","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},title:{attribute:"title"},src:{attribute:"src"}}}render(){this.classList.add("c-docs-nav");this.setAttribute("role","navigation");const title=this.getAttribute("title");if(title)this.setAttribute("aria-label",title);else this.setAttribute("aria-label","Documentation navigation");wireStates(this);loadRemote(this,"items");if(renderStates(this,"docs-nav"))return;const _remote=remoteData(this,"items");const items=this.hasAttribute("src")?_remote:(_remote||(this.hasAttribute("items")?this.getAttribute("items"):null));const list=this.querySelector(".c-docs-nav__list");const authored=list?Array.from(list.children).filter((n)=>n.classList&&n.classList.contains("c-docs-nav__group")):[];if(items&&!authored.length){try{const parsed=JSON.parse(items);const list=this.ensure(".c-docs-nav__list",()=>{const el=document.createElement("div");el.className="c-docs-nav__list";return el});list.innerHTML="";parsed.forEach((g)=>{const group=document.createElement("div");group.className="c-docs-nav__group";if(g.title){const gt=document.createElement("div");gt.className="c-docs-nav__group-title";gt.textContent=g.title;group.appendChild(gt)}const ul=document.createElement("div");ul.className="c-docs-nav__list";(g.links||g.items||[]).forEach((l)=>{const a=document.createElement("a");a.className="c-docs-nav__link";a.href=(typeof l==="string"?"#":(l.href||"#"));const label=typeof l==="string"?l:(l.label||l);if(typeof l==="object"&&l!==null&&l.badge){const b=document.createElement("span");b.className="c-docs-nav__badge";b.textContent=l.badge;a.appendChild(b)}a.appendChild(document.createTextNode(label));if(typeof l==="object"&&l!==null&&l.chevron){const ch=document.createElement("span");ch.className="c-docs-nav__chevron";ch.textContent=l.chevron;a.appendChild(ch)}if(typeof l==="object"&&l!==null&&Array.isArray(l.items)){a.classList.add("c-docs-nav__link--nested");const nested=document.createElement("div");nested.className="c-docs-nav__list c-docs-nav__list--nested";l.items.forEach((nl)=>{const na=document.createElement("a");na.className="c-docs-nav__link";na.href=(typeof nl==="string"?"#":(nl.href||"#"));na.textContent=typeof nl==="string"?nl:(nl.label||nl);nested.appendChild(na)});ul.appendChild(a);ul.appendChild(nested)}else{ul.appendChild(a)}});group.appendChild(ul);list.appendChild(group)})}catch(e){}}else if(!items&&list){list.remove();renderEmpty(this,"docs-nav")}else if(!items&&!list){renderEmpty(this,"docs-nav")}}enhance(){if(this._wiredDocsNav)return;this._wiredDocsNav=true;this.addEventListener("click",(e)=>{const link=e.target&&e.target.closest?e.target.closest(".c-docs-nav__link"):null;if(link&&this.contains(link)){const label=link.textContent||"";this.dispatchEvent(new CustomEvent("contour:docs-nav-select",{bubbles:true,composed:true,detail:{label,href:link.getAttribute("href")}}))}})}}define("contour-docs-nav",ContourDocsNav);class ContourDocsShell extends ContourBase{static get observed(){return["title","lede","article","heading"]}static get properties(){return{title:{attribute:"title"},lede:{attribute:"lede"},article:{attribute:"article"}}}render(){this.classList.add("c-docs-shell");this.setAttribute("role","region");const title=this.getAttribute("title");if(title){const h=this.ensure(".c-docs-shell__title",()=>{const el=document.createElement(headingTag(this,"h1"));el.className="c-docs-shell__title";return el});h.textContent=title;this.setAttribute("aria-label",title)}else{const h=this.querySelector(".c-docs-shell__title");if(h)h.remove()}const lede=this.getAttribute("lede");if(lede){const p=this.ensure(".c-docs-shell__lede",()=>{const el=document.createElement("p");el.className="c-docs-shell__lede";return el});p.textContent=lede}else{const p=this.querySelector(".c-docs-shell__lede");if(p)p.remove()}const article=this.getAttribute("article");if(article){const a=this.ensure(".c-docs-shell__article",()=>{const el=document.createElement("article");el.className="c-docs-shell__article";return el});a.innerHTML=sanitizeHtml(article)}else{const a=this.querySelector(".c-docs-shell__article");if(a)a.remove()}}}define("contour-docs-shell",ContourDocsShell);class ContourFileTree extends ContourBase{static get observed(){return["items"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-file-tree");const items=this.getAttribute("items");if(items){try{const parsed=JSON.parse(items);const renderNode=(node,depth)=>{const row=document.createElement("div");row.className="c-file-tree__row"+(node.dir?" c-file-tree__row--dir":"")+(node.active?" c-file-tree__row--active":"");row.style.paddingInlineStart=(depth*1)+"rem";const label=document.createElement("span");label.textContent=node.label||node.name||"";row.appendChild(label);this.appendChild(row);if(Array.isArray(node.children)){node.children.forEach((c)=>renderNode(c,depth+1))}};Array.from(this.querySelectorAll(".c-file-tree__row")).forEach((n)=>n.remove());parsed.forEach((n)=>renderNode(n,0))}catch(e){}}}}define("contour-file-tree",ContourFileTree);class ContourDialog extends ContourBase{static get observed(){return["title","size","heading"]}static get properties(){return{title:{attribute:"title"},size:{attribute:"size"}}}render(){this.classList.add("c-dialog");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-dialog--"))this.classList.remove(c)});const size=this.getAttribute("size");if(size)this.classList.add("c-dialog--"+size);if(!this.hasAttribute("role"))this.setAttribute("role","dialog");const title=this.getAttribute("title");let head=this.querySelector(".c-dialog__head");if(title){if(!head){head=document.createElement("div");head.className="c-dialog__head";const h=document.createElement(headingTag(this,"h2"));h.className="c-dialog__title";head.appendChild(h);const closeBtn=document.createElement("button");closeBtn.className="c-btn c-btn--icon c-btn--ghost c-dialog__close";closeBtn.setAttribute("type","button");closeBtn.setAttribute("aria-label","Close");closeBtn.innerHTML='<svg aria-hidden="true"><use href="#i-close" /></svg>';head.appendChild(closeBtn)}const h=head.querySelector(".c-dialog__title");if(h){h.textContent=title;if(!h.id)h.id="contour-dialog-title-"+(this._dialogTitleId=(this._dialogTitleId||0)+1);this.setAttribute("aria-labelledby",h.id)}}if(head&&head.parentNode!==this)this.prepend(head);const body=this.ensure(".c-dialog__body",()=>{const el=document.createElement("div");el.className="c-dialog__body";return el});Array.from(this.childNodes).forEach((n)=>{if(n===body||n===head)return;if(n.nodeType===1&&n.classList&&n.classList.contains("c-dialog__head"))return;body.appendChild(n)});if(head&&head.parentNode===this){if(body.parentNode!==this)this.insertBefore(body,head.nextSibling);else if(head.compareDocumentPosition(body)&Node.DOCUMENT_POSITION_PRECEDING)this.insertBefore(body,head.nextSibling)}else{if(body.parentNode!==this)this.appendChild(body)}}enhance(){if(this._wiredDialog)return;this._wiredDialog=true;onDispose(this,()=>{if(this.hasAttribute("open"))modalContain(this,false)});this.show=()=>{if(this.hasAttribute("open"))return;this._dialogLastFocus=document.activeElement;this.setAttribute("open","");this.setAttribute("aria-modal","true");const dlg=this.querySelector("dialog")||(this.tagName==="DIALOG"?this:null);if(dlg&&typeof dlg.showModal==="function"){try{dlg.showModal()}catch(e){}}modalContain(this,true);const focusable=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(focusable){try{focusable.focus()}catch(e){}}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:true,composed:true}))};this.close=()=>{const wasOpen=this.hasAttribute("open");const dlg=this.querySelector("dialog")||(this.tagName==="DIALOG"?this:null);if(dlg&&typeof dlg.close==="function")dlg.close();if(this.hasAttribute("open"))this.removeAttribute("open");this.removeAttribute("aria-modal");if(wasOpen){modalContain(this,false);this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));const last=this._dialogLastFocus;if(last&&typeof last.focus==="function"){try{last.focus()}catch(e){}}}};this.focus=()=>{const focusable=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(focusable){try{focusable.focus()}catch(e){}}else{try{HTMLElement.prototype.focus.call(this)}catch(e){}}};this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-dialog__close"):null;if(btn&&this.contains(btn)){this.close();return}if(e.target===this)this.close()});this.addEventListener("keydown",(e)=>{if(e.key==="Escape"&&this.hasAttribute("open"))this.close()})}}define("contour-dialog",ContourDialog);class ContourAlert extends ContourBase{static get observed(){return["title","body","variant","icon","closable","action","actions","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},variant:{attribute:"variant"},icon:{attribute:"icon"},closable:{attribute:"closable",type:Boolean},action:{attribute:"action"},actions:{attribute:"actions"}}}render(){this.classList.add("c-alert");if(!this.hasAttribute("role"))this.setAttribute("role","alert");if(!this.hasAttribute("aria-live"))this.setAttribute("aria-live","assertive");wireStates(this);loadRemote(this,"title");if(renderStates(this,"alert"))return;const variant=this.getAttribute("variant");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-alert--"))this.classList.remove(c)});if(variant)this.classList.add("c-alert--"+variant);const icon=this.getAttribute("icon");if(icon){const ic=this.ensure(".c-alert__icon",()=>{const el=document.createElement("span");el.className="c-alert__icon";return el});if(ic.parentNode===this&&this.firstChild!==ic)this.prepend(ic);ic.innerHTML='<svg aria-hidden="true"><use href="#'+String(icon).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'}else{const ic=this.querySelector(".c-alert__icon");if(ic)ic.remove()}const title=this.getAttribute("title")||(this._remoteData&&this._remoteData.title);if(title){const t=this.ensure(".c-alert__title",()=>{const el=document.createElement("div");el.className="c-alert__title";return el});if(t.parentNode===this&&this.firstChild!==t)this.prepend(t);t.textContent=title}else{const t=this.querySelector(".c-alert__title");if(t)t.remove()}const body=this.getAttribute("body");if(body){const b=this.ensure(".c-alert__body",()=>{const el=document.createElement("div");el.className="c-alert__body";return el});b.textContent=body}else{const b=this.querySelector(".c-alert__body");if(b)b.remove()}Array.from(this.querySelectorAll(".c-alert__action")).forEach((n)=>n.remove());const actionsAttr=this.getAttribute("actions");let actionList=[];if(actionsAttr){try{const parsed=JSON.parse(actionsAttr);if(Array.isArray(parsed))actionList=parsed.map((x)=>String(x))}catch(e){actionList=[actionsAttr]}}else{const single=this.getAttribute("action");if(single)actionList=[single]}actionList.forEach((label)=>{const a=document.createElement("button");a.className="c-btn c-btn--sm c-alert__action";a.type="button";a.setAttribute("data-alert-action","");a.textContent=label;this.appendChild(a)});if(this.hasAttribute("closable")){this.ensure(".c-alert__close",()=>{const btn=document.createElement("button");btn.className="c-alert__close";btn.type="button";btn.setAttribute("aria-label","Close");btn.textContent="×";return btn})}else{const btn=this.querySelector(".c-alert__close");if(btn)btn.remove()}if(!title&&!body&&!icon){renderEmpty(this,"alert")}}}ContourAlert.prototype.enhance=function(){if(this._wiredAlert)return;this._wiredAlert=true;this.addEventListener("click",(e)=>{const actionBtn=e.target&&e.target.closest?e.target.closest(".c-alert__action"):null;if(actionBtn&&this.contains(actionBtn)){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:empty-action",{bubbles:true,composed:true,detail:{state:actionBtn.textContent.trim()}}));return}const btn=e.target&&e.target.closest?e.target.closest(".c-alert__close"):null;if(!btn||!this.contains(btn))return;e.preventDefault();this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));this.remove()})};define("contour-alert",ContourAlert);class ContourDisclosure extends ContourBase{static get observed(){return["summary","icon"]}static get properties(){return{summary:{attribute:"summary"},icon:{attribute:"icon"}}}disconnectedCallback(){this._disclosureContent=null;super.disconnectedCallback()}connectedCallback(){if(this.innerHTML.trim()&&!this._disclosureContent){this._disclosureContent=this.innerHTML}super.connectedCallback()}attributeChangedCallback(name,oldValue,newValue){const details=this.querySelector("details");if(details){const body=details.querySelector(".c-disclosure__body");if(body)this._disclosureContent=body.innerHTML}else if(this.innerHTML.trim()){this._disclosureContent=this.innerHTML}super.attributeChangedCallback(name,oldValue,newValue)}render(){this.classList.add("c-disclosure");const summary=this.getAttribute("summary");const icon=this.getAttribute("icon");if(summary){let captured=this.innerHTML.trim()?this.innerHTML:(this._disclosureContent||"");if(captured.trim())this._disclosureContent=captured;const details=this.ensure("details",()=>{const d=document.createElement("details");const summ=document.createElement("summary");summ.className="c-disclosure__summary";if(icon){const ic=document.createElement("span");ic.className="c-disclosure__icon";ic.innerHTML='<svg aria-hidden="true"><use href="#'+String(icon).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>';summ.appendChild(ic)}summ.appendChild(document.createTextNode(summary));d.appendChild(summ);const content=document.createElement("div");content.className="c-disclosure__body";content.innerHTML=captured;d.appendChild(content);return d});const summ=details.querySelector("summary");if(summ){const ic=summ.querySelector(".c-disclosure__icon");if(icon&&!ic){const newIc=document.createElement("span");newIc.className="c-disclosure__icon";newIc.innerHTML='<svg aria-hidden="true"><use href="#'+String(icon).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>';summ.insertBefore(newIc,summ.firstChild)}else if(!icon&&ic){ic.remove()}const textNodes=Array.from(summ.childNodes).filter(n=>n.nodeType===3);textNodes.forEach(n=>n.remove());summ.appendChild(document.createTextNode(summary))}const body=details.querySelector(".c-disclosure__body");if(body)body.innerHTML=captured;if(details.parentNode!==this){this.innerHTML="";this.appendChild(details)}}else{const details=this.querySelector("details");if(details)details.remove()}}enhance(){if(this._wiredDisclosure)return;this._wiredDisclosure=true;this.addEventListener("toggle",(e)=>{const t=e.target;if(t&&t.tagName==="DETAILS"){this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:t.open},bubbles:true,composed:true}))}},true)}}define("contour-disclosure",ContourDisclosure);class ContourCallout extends ContourBase{static get observed(){return["variant","title","icon","closable"]}static get properties(){return{variant:{attribute:"variant"},title:{attribute:"title"},icon:{attribute:"icon"},closable:{attribute:"closable",type:Boolean}}}render(){this.classList.add("c-callout");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-callout--"))this.classList.remove(c)});const variant=this.getAttribute("variant");if(variant)this.classList.add("c-callout--"+variant);const icon=this.getAttribute("icon");if(icon){const ic=this.ensure(".c-callout__icon",()=>{const el=document.createElement("span");el.className="c-callout__icon";return el});if(ic.parentNode===this&&this.firstChild!==ic)this.prepend(ic);ic.innerHTML='<svg aria-hidden="true"><use href="#'+String(icon).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'}else{const ic=this.querySelector(".c-callout__icon");if(ic)ic.remove()}const title=this.getAttribute("title");if(title){const t=this.ensure(".c-callout__title",()=>{const el=document.createElement("div");el.className="c-callout__title";return el});if(t.parentNode===this&&this.firstChild!==t)this.prepend(t);t.textContent=title}else{const t=this.querySelector(".c-callout__title");if(t)t.remove()}if(this.hasAttribute("closable")){this.ensure(".c-callout__close",()=>{const btn=document.createElement("button");btn.className="c-callout__close";btn.type="button";btn.setAttribute("aria-label","Close");btn.textContent="×";return btn})}else{const btn=this.querySelector(".c-callout__close");if(btn)btn.remove()}}}ContourCallout.prototype.enhance=function(){if(this._wiredCallout)return;this._wiredCallout=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-callout__close"):null;if(!btn||!this.contains(btn))return;e.preventDefault();this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));this.remove()})};define("contour-callout",ContourCallout);class ContourEmpty extends ContourBase{static get observed(){return["state","title","body","action","icon","illustration","heading"]}static get properties(){return{state:{attribute:"state"},title:{attribute:"title"},body:{attribute:"body"},action:{attribute:"action"},icon:{attribute:"icon"},illustration:{attribute:"illustration"}}}render(){this.classList.add("c-empty");const state=this.getAttribute("state")||"empty";const title=this.getAttribute("title")||(state==="filtered"?"Nothing matches":state==="error"?"Could not load":"No data yet");const body=this.getAttribute("body")||(state==="filtered"?"Try clearing some filters.":state==="error"?"Check your connection and try again.":"There is nothing to show here yet.");const action=this.getAttribute("action")||(state==="filtered"?"Clear filters":state==="error"?"Retry":"");const icon=this.getAttribute("icon");if(icon){const ic=this.ensure(".c-empty__icon",()=>{const el=document.createElement("span");el.className="c-empty__icon";return el});ic.innerHTML='<svg aria-hidden="true"><use href="#'+String(icon).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'}else{const ic=this.querySelector(".c-empty__icon");if(ic)ic.remove()}const illustration=this.getAttribute("illustration");if(illustration){const il=this.ensure(".c-empty__illustration",()=>{const el=document.createElement("div");el.className="c-empty__illustration";return el});il.innerHTML=sanitizeHtml(illustration)}else{const il=this.querySelector(".c-empty__illustration");if(il)il.remove()}if(title){const t=this.ensure(".c-empty__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-empty__title";return el});t.textContent=title}else{const t=this.querySelector(".c-empty__title");if(t)t.remove()}if(body){const b=this.ensure(".c-empty__text",()=>{const el=document.createElement("p");el.className="c-empty__text";return el});b.textContent=body}else{const b=this.querySelector(".c-empty__text");if(b)b.remove()}if(action){const a=this.ensure("button.c-btn[data-empty-action]",()=>{const el=document.createElement("button");el.className="c-btn c-btn--primary";el.type="button";el.setAttribute("data-empty-action","");return el});a.textContent=action}else{const a=this.querySelector("[data-empty-action]");if(a)a.remove()}}enhance(){wireRemovable(this)}}define("contour-empty",ContourEmpty);class ContourFaq extends ContourBase{static get observed(){return["question","answer","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{question:{attribute:"question"},answer:{attribute:"answer"},items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-faq");wireStates(this);loadRemote(this,"items");if(renderStates(this,"faq"))return;const items=remoteData(this,"items");const question=this.getAttribute("question");const answer=this.getAttribute("answer");const authored=Array.from(this.children).filter((n)=>n.classList&&n.classList.contains("c-faq__item"));if(items&&!authored.length){try{const parsed=JSON.parse(items);Array.from(this.querySelectorAll(".c-faq__item")).forEach((n)=>n.remove());parsed.forEach((it,i)=>{const item=document.createElement("details");item.className="c-faq__item";if(i===0)item.setAttribute("open","");const q=document.createElement("summary");q.className="c-faq__question";q.textContent=typeof it==="string"?it:(it.question||it.q||"");const sign=document.createElement("span");sign.className="c-faq__sign";sign.setAttribute("aria-hidden","true");sign.innerHTML='<svg aria-hidden="true"><use href="#i-plus" /></svg>';q.appendChild(sign);item.appendChild(q);const a=document.createElement("div");a.className="c-faq__answer";a.textContent=typeof it==="string"?"":(it.answer||it.a||"");item.appendChild(a);this.appendChild(item)})}catch(e){}}else if(!items){if(!question&&!answer){renderEmpty(this,"faq")}else{const item=this.ensure("details.c-faq__item",()=>{const el=document.createElement("details");el.className="c-faq__item";return el});if(!item.hasAttribute("open"))item.setAttribute("open","");const q=this.ensure("summary.c-faq__question",()=>{const el=document.createElement("summary");el.className="c-faq__question";return el},item);q.textContent=question||"";const sign=this.ensure(".c-faq__sign",()=>{const el=document.createElement("span");el.className="c-faq__sign";return el},q);sign.setAttribute("aria-hidden","true");sign.innerHTML='<svg aria-hidden="true"><use href="#i-plus" /></svg>';const a=this.ensure(".c-faq__answer",()=>{const el=document.createElement("div");el.className="c-faq__answer";return el},item);a.textContent=answer||""}}}}define("contour-faq",ContourFaq);class ContourAccordion extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","exclusive"]}static get properties(){return{items:{attribute:"items"},exclusive:{attribute:"exclusive",type:Boolean},src:{attribute:"src"}}}render(){const authored=Array.from(this.children).filter((n)=>n.tagName==="DETAILS");wireStates(this);loadRemote(this,"items");if(renderStates(this,"accordion"))return;const items=remoteData(this,"items");if(items&&!authored.length){Array.from(this.querySelectorAll("details.c-disclosure")).forEach((d)=>d.remove());try{const parsed=JSON.parse(items);parsed.forEach((item)=>{const details=document.createElement("details");details.className="c-disclosure";const summary=document.createElement("summary");summary.className="c-disclosure__summary";summary.textContent=item.title||item.question||item.q||item.label||"";details.appendChild(summary);const body=document.createElement("div");body.className="c-disclosure__body";body.textContent=item.body||item.answer||item.a||item.content||"";details.appendChild(body);this.appendChild(details)})}catch(e){}}else if(!items&&!authored.length){renderEmpty(this,"accordion")}const persist=this.getAttribute("persist");if(persist){let saved=null;if(persist==="storage"&&this.id){try{saved=localStorage.getItem("contour-accordion:"+this.id)}catch(e){}}else if(persist==="url"){try{saved=new URLSearchParams(window.location.search).get("c-accordion")}catch(e){}}if(saved!==null){try{const labels=JSON.parse(saved);if(Array.isArray(labels)){const want=new Set(labels.map((l)=>String(l)));Array.from(this.querySelectorAll("details.c-disclosure")).forEach((d)=>{const summary=d.querySelector("summary");const label=(summary?summary.textContent:"").trim().slice(0,120);if(want.has(label))d.open=true})}}catch(e){}}}}enhance(){if(this._wiredAccordion)return;this._wiredAccordion=true;this.addEventListener("toggle",(e)=>{const t=e.target;if(t&&t.tagName==="DETAILS"){if(t.open&&this.hasAttribute("exclusive")){Array.from(this.querySelectorAll("details.c-disclosure")).forEach((d)=>{if(d!==t)d.open=false})}this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:t.open},bubbles:true,composed:true}));const persist=this.getAttribute("persist");if(persist==="storage"&&this.id){try{const open=[];Array.from(this.querySelectorAll("details.c-disclosure")).forEach((d)=>{if(d.open){const s=d.querySelector("summary");open.push((s?s.textContent:"").trim().slice(0,120))}});localStorage.setItem("contour-accordion:"+this.id,JSON.stringify(open))}catch(e){}}else if(persist==="url"){try{const open=[];Array.from(this.querySelectorAll("details.c-disclosure")).forEach((d)=>{if(d.open){const s=d.querySelector("summary");open.push((s?s.textContent:"").trim().slice(0,120))}});const url=new URL(window.location.href);url.searchParams.set("c-accordion",JSON.stringify(open));window.history.replaceState(null,"",url.toString())}catch(e){}}}},true)}}define("contour-accordion",ContourAccordion);class ContourDrawer extends ContourBase{static get observed(){return["title","body","size"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},size:{attribute:"size"}}}render(){this.classList.add("c-drawer");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-drawer--"))this.classList.remove(c)});const size=this.getAttribute("size");if(size)this.classList.add("c-drawer--"+size);if(!this.hasAttribute("role"))this.setAttribute("role","dialog");const title=this.getAttribute("title");let head=this.querySelector(".c-drawer__head");if(title){if(!head){head=document.createElement("div");head.className="c-drawer__head";const t=document.createElement("div");t.className="c-drawer__title";head.appendChild(t);const closeBtn=document.createElement("button");closeBtn.className="c-btn c-btn--icon c-btn--ghost c-drawer__close";closeBtn.setAttribute("type","button");closeBtn.setAttribute("aria-label","Close");closeBtn.innerHTML='<svg aria-hidden="true"><use href="#i-close" /></svg>';head.appendChild(closeBtn)}const t=head.querySelector(".c-drawer__title");if(t){t.textContent=title;if(!t.id)t.id="contour-drawer-title-"+(this._drawerTitleId=(this._drawerTitleId||0)+1);this.setAttribute("aria-labelledby",t.id)}if(head.parentNode!==this)this.prepend(head)}else if(head){head.remove()}if(this.hasAttribute("open"))this.classList.add("is-open");const body=this.getAttribute("body");const b=this.querySelector(".c-drawer__body");const authored=b?Array.from(b.children):[];if(body&&!authored.length){const el=this.ensure(".c-drawer__body",()=>{const e=document.createElement("div");e.className="c-drawer__body";return e});el.innerHTML=sanitizeHtml(body)}else if(!body&&b&&!authored.length){b.remove()}}enhance(){if(this._wiredDrawer)return;this._wiredDrawer=true;onDispose(this,()=>{if(this.hasAttribute("open"))modalContain(this,false)});this._drawerLastFocus=null;this.show=()=>{if(this.hasAttribute("open"))return;this._drawerLastFocus=document.activeElement;this.setAttribute("open","");this.setAttribute("aria-modal","true");this.classList.add("is-open");modalContain(this,true);const focusable=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(focusable){try{focusable.focus()}catch(e){}}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:true,composed:true}))};this.close=()=>{if(!this.hasAttribute("open"))return;this.removeAttribute("open");this.removeAttribute("aria-modal");this.classList.remove("is-open");modalContain(this,false);this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));const last=this._drawerLastFocus;if(last&&typeof last.focus==="function"){try{last.focus()}catch(e){}}};this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-drawer__close"):null;if(btn&&this.contains(btn)){this.close();return}if(e.target===this)this.close()});this.addEventListener("keydown",(e)=>{if(e.key==="Escape"&&this.hasAttribute("open"))this.close()});let touchStartX=0,touchStartY=0;this.addEventListener("touchstart",(e)=>{if(!this.hasAttribute("open"))return;const t=e.touches&&e.touches[0];if(t){touchStartX=t.clientX;touchStartY=t.clientY}},{passive:true});this.addEventListener("touchend",(e)=>{if(!this.hasAttribute("open"))return;const t=e.changedTouches&&e.changedTouches[0];if(!t)return;const dx=t.clientX-touchStartX;const dy=t.clientY-touchStartY;if(Math.abs(dx)>60&&Math.abs(dx)>Math.abs(dy)*1.5)this.close()},{passive:true})}}define("contour-drawer",ContourDrawer);class ContourSheet extends ContourBase{static get observed(){return["title","body","size"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},size:{attribute:"size"}}}render(){this.classList.add("c-sheet");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-sheet--"))this.classList.remove(c)});const size=this.getAttribute("size");if(size)this.classList.add("c-sheet--"+size);if(!this.hasAttribute("role"))this.setAttribute("role","dialog");const title=this.getAttribute("title");let head=this.querySelector(".c-sheet__head");if(title){if(!head){head=document.createElement("div");head.className="c-sheet__head";const t=document.createElement("div");t.className="c-sheet__title";head.appendChild(t);const closeBtn=document.createElement("button");closeBtn.className="c-btn c-btn--icon c-btn--ghost c-sheet__close";closeBtn.setAttribute("type","button");closeBtn.setAttribute("aria-label","Close");closeBtn.innerHTML='<svg aria-hidden="true"><use href="#i-close" /></svg>';head.appendChild(closeBtn)}const t=head.querySelector(".c-sheet__title");if(t){t.textContent=title;if(!t.id)t.id="contour-sheet-title-"+(this._sheetTitleId=(this._sheetTitleId||0)+1);this.setAttribute("aria-labelledby",t.id)}if(head.parentNode!==this)this.prepend(head)}else if(head){head.remove()}if(this.hasAttribute("open"))this.classList.add("is-open");const body=this.getAttribute("body");const b=this.querySelector(".c-sheet__body");const authored=b?Array.from(b.children):[];if(body&&!authored.length){const el=this.ensure(".c-sheet__body",()=>{const e=document.createElement("div");e.className="c-sheet__body";return e});el.innerHTML=sanitizeHtml(body)}else if(!body&&b&&!authored.length){b.remove()}}enhance(){if(this._wiredSheet)return;this._wiredSheet=true;onDispose(this,()=>{if(this.hasAttribute("open"))modalContain(this,false)});this._sheetLastFocus=null;this.show=()=>{if(this.hasAttribute("open"))return;this._sheetLastFocus=document.activeElement;this.setAttribute("open","");this.setAttribute("aria-modal","true");this.classList.add("is-open");modalContain(this,true);const focusable=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(focusable){try{focusable.focus()}catch(e){}}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:true,composed:true}))};this.close=()=>{if(!this.hasAttribute("open"))return;this.removeAttribute("open");this.removeAttribute("aria-modal");this.classList.remove("is-open");modalContain(this,false);this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));const last=this._sheetLastFocus;if(last&&typeof last.focus==="function"){try{last.focus()}catch(e){}}};this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-sheet__close"):null;if(btn&&this.contains(btn)){this.close();return}if(e.target===this)this.close()});this.addEventListener("keydown",(e)=>{if(e.key==="Escape"&&this.hasAttribute("open"))this.close()});let touchStartY=0,touchStartX=0;this.addEventListener("touchstart",(e)=>{if(!this.hasAttribute("open"))return;const t=e.touches&&e.touches[0];if(t){touchStartX=t.clientX;touchStartY=t.clientY}},{passive:true});this.addEventListener("touchend",(e)=>{if(!this.hasAttribute("open"))return;const t=e.changedTouches&&e.changedTouches[0];if(!t)return;const dy=t.clientY-touchStartY;const dx=t.clientX-touchStartX;if(dy>60&&Math.abs(dy)>Math.abs(dx)*1.5)this.close()},{passive:true})}}define("contour-sheet",ContourSheet);class ContourToast extends ContourBase{static get observed(){return["message","variant","duration"]}static get properties(){return{message:{attribute:"message"},variant:{attribute:"variant"},duration:{attribute:"duration",type:Number}}}render(){this.classList.add("c-toast");if(!this.hasAttribute("role"))this.setAttribute("role","status");if(!this.hasAttribute("aria-live"))this.setAttribute("aria-live","polite");if(!this.hasAttribute("aria-atomic"))this.setAttribute("aria-atomic","true");const message=this.getAttribute("message");if(message&&!this.hasChildNodes()){this.textContent=message}const variant=this.getAttribute("variant");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-toast--"))this.classList.remove(c)});if(variant)this.classList.add("c-toast--"+variant)}enhance(){if(this._wiredToast)return;this._wiredToast=true;const ms=(this.duration&&this.duration>0)?this.duration:1500;const timer=setTimeout(()=>{if(!this.isConnected)return;this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));this.remove()},ms);onDispose(this,()=>clearTimeout(timer))}}define("contour-toast",ContourToast);class ContourExpandable extends ContourBase{static get observed(){return["summary"]}static get properties(){return{summary:{attribute:"summary"}}}disconnectedCallback(){this._expandableContent=null;super.disconnectedCallback()}connectedCallback(){if(this.innerHTML.trim()&&!this._expandableContent){this._expandableContent=this.innerHTML}super.connectedCallback()}attributeChangedCallback(name,oldValue,newValue){const details=this.querySelector("details");if(details){const body=details.querySelector(".c-expandable__body");if(body)this._expandableContent=body.innerHTML}else if(this.innerHTML.trim()){this._expandableContent=this.innerHTML}super.attributeChangedCallback(name,oldValue,newValue)}render(){this.classList.add("c-expandable");const summary=this.getAttribute("summary");if(summary){let captured=this.innerHTML.trim()?this.innerHTML:(this._expandableContent||"");if(captured.trim())this._expandableContent=captured;const details=this.ensure("details",()=>{const d=document.createElement("details");const summ=document.createElement("summary");summ.className="c-expandable__summary";summ.textContent=summary;d.appendChild(summ);const content=document.createElement("div");content.className="c-expandable__body";content.innerHTML=captured;d.appendChild(content);return d});const summ=details.querySelector("summary");if(summ)summ.textContent=summary;const body=details.querySelector(".c-expandable__body");if(body)body.innerHTML=captured;if(details.parentNode!==this){this.innerHTML="";this.appendChild(details)}}else{const details=this.querySelector("details");if(details)details.remove()}}enhance(){if(this._wiredExpandable)return;this._wiredExpandable=true;this.addEventListener("toggle",(e)=>{const t=e.target;if(t&&t.tagName==="DETAILS"){this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:t.open},bubbles:true,composed:true}))}},true)}}define("contour-expandable",ContourExpandable);class ContourToastHost extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-toast-host");if(!this.hasAttribute("role"))this.setAttribute("role","status");if(!this.hasAttribute("aria-live"))this.setAttribute("aria-live","polite");if(!this.hasAttribute("aria-atomic"))this.setAttribute("aria-atomic","true")}enhance(){if(this._wiredToastHost)return;this._wiredToastHost=true;this._toastQueue=[];const showOne=(message,opts)=>{opts=opts||{};const toast=document.createElement("div");toast.className="c-toast";toast.setAttribute("role","status");toast.setAttribute("aria-live","polite");toast.setAttribute("aria-atomic","true");if(opts.variant)toast.classList.add("c-toast--"+opts.variant);toast.textContent=message==null?"":String(message);this.appendChild(toast);const ms=(opts.duration&&opts.duration>0)?opts.duration:3000;const timer=setTimeout(()=>{if(toast.parentNode)toast.parentNode.removeChild(toast);this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}))},ms);toast._timer=timer;return toast};this.show=(message,opts)=>showOne(message,opts);this.hide=()=>{Array.from(this.querySelectorAll(".c-toast")).forEach((t)=>{if(t._timer)clearTimeout(t._timer);if(t.parentNode)t.parentNode.removeChild(t)})}}}define("contour-toast-host",ContourToastHost);class ContourCombobox extends ContourBase{static get observed(){return["options","placeholder","label","value","multiple","loading","error","retry","src","lazy","refresh","timeout","empty","skeleton"]}static get formAssociated(){return true}static get properties(){return{options:{attribute:"options"},placeholder:{attribute:"placeholder"},label:{attribute:"label"},value:{attribute:"value"},multiple:{attribute:"multiple",type:Boolean},src:{attribute:"src"}}}render(){this.classList.add("c-combobox");wireStates(this);loadRemote(this,"options");if(renderStates(this,"combobox"))return;const options=remoteData(this,"options");const authored=Array.from(this.children).filter((n)=>!n.classList||(!n.classList.contains("c-combobox__input")&&!n.classList.contains("c-combobox__list")));if((options)&&!authored.length){try{const parsed=options?JSON.parse(options):[];const input=this.ensure(".c-combobox__input",()=>{const el=document.createElement("input");el.className="c-combobox__input";el.type="text";return el});input.type="text";input.placeholder=this.getAttribute("placeholder")||"Search…";input.setAttribute("aria-label",this.getAttribute("label")||"Search");const val=this.getAttribute("value");if(val!==null)input.value=val;const list=this.ensure(".c-combobox__list",()=>{const el=document.createElement("ul");el.className="c-combobox__list";el.setAttribute("hidden","");return el});list.innerHTML="";list.setAttribute("hidden","");const selectedVals=(this.getAttribute("value")||"").split(",").map((v)=>v.trim()).filter(Boolean);parsed.forEach((opt)=>{const li=document.createElement("li");li.className="c-combobox__option";const v=typeof opt==="string"?opt:opt.value;li.textContent=typeof opt==="string"?opt:opt.label;if(this.hasAttribute("multiple")&&selectedVals.includes(String(v)))li.setAttribute("aria-selected","true");list.appendChild(li)})}catch(e){}}else if(!authored.length&&!options){renderEmpty(this,"combobox")}if(this.getAttribute("value")){this.ensure(".c-combobox__clear",()=>{const btn=document.createElement("button");btn.className="c-combobox__clear";btn.type="button";btn.setAttribute("aria-label","Clear");btn.textContent="×";return btn})}else{const btn=this.querySelector(".c-combobox__clear");if(btn)btn.remove()}}enhance(){wireCombobox(this);if(this._internals&&!this._wiredComboboxForm){this._wiredComboboxForm=true;this._syncFormValue();this.addEventListener("contour:select",(e)=>{const v=e&&e.detail&&(e.detail.value||e.detail.label);if(v!=null)this.setAttribute("value",String(v));this._syncFormValue()})}if(!this._wiredComboboxClear){this._wiredComboboxClear=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-combobox__clear"):null;if(!btn||!this.contains(btn))return;e.preventDefault();this.removeAttribute("value");const input=this.querySelector(".c-combobox__input");if(input)input.value="";this._syncFormValue();this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{name:this.getAttribute("name"),value:null,checked:null}}))})}}}define("contour-combobox",ContourCombobox);class ContourField extends ContourBase{static get observed(){return["label","hint","error","placeholder","type","required"]}static get formAssociated(){return true}static get properties(){return{label:{attribute:"label"},hint:{attribute:"hint"},error:{attribute:"error"},placeholder:{attribute:"placeholder"},type:{attribute:"type"},required:{attribute:"required",type:Boolean}}}render(){this.classList.add("c-field");const label=this.getAttribute("label");const hint=this.getAttribute("hint");const error=this.getAttribute("error");const placeholder=this.getAttribute("placeholder")||"";if(label){const lbl=this.ensure(".c-field__label",()=>{const el=document.createElement("label");el.className="c-field__label";return el});lbl.textContent=label}else{const lbl=this.querySelector(".c-field__label");if(lbl)lbl.remove()}const input=this.ensure("input.c-input, textarea, select",()=>{const el=document.createElement("input");el.className="c-input";return el});input.type=this.getAttribute("type")||"text";input.placeholder=placeholder;if(!input.id)input.id=contourId("contour-field");const lbl=this.querySelector(".c-field__label");if(lbl){if(!input.id)input.id=contourId("contour-field");lbl.setAttribute("for",input.id)}if(hint){const h=this.ensure(".c-field__hint",()=>{const el=document.createElement("span");el.className="c-field__hint";return el});h.textContent=hint}else{const h=this.querySelector(".c-field__hint");if(h)h.remove()}if(error){const e=this.ensure(".c-field__error",()=>{const el=document.createElement("span");el.className="c-field__error";return el});e.textContent=error}else{const e=this.querySelector(".c-field__error");if(e)e.remove()}const hintEl=this.querySelector(".c-field__hint");const errEl=this.querySelector(".c-field__error");const describedBy=[];if(hintEl){if(!hintEl.id)hintEl.id=contourId("hint");describedBy.push(hintEl.id)}if(errEl){if(!errEl.id)errEl.id=contourId("err");describedBy.push(errEl.id)}if(describedBy.length)input.setAttribute("aria-describedby",describedBy.join(" "));if(this.hasAttribute("required"))input.setAttribute("aria-required","true")}}ContourField.prototype.enhance=function(){if(this._wiredField)return;this._wiredField=true;const sync=()=>{const input=this.querySelector("input, textarea, select");if(!input||!this._internals)return;this._internals.setFormValue(input.value)};this.addEventListener("input",(e)=>{const input=this.querySelector("input, textarea, select");if(!input||e.target!==input)return;sync();this._emitForm("contour:input")});this.addEventListener("change",(e)=>{const input=this.querySelector("input, textarea, select");if(!input||e.target!==input)return;sync();this._emitForm("contour:change")});this.addEventListener("blur",(e)=>{const input=this.querySelector("input, textarea, select");if(!input||e.target!==input)return;const valid=input.checkValidity();if(valid){input.setAttribute("aria-invalid","false");this.classList.remove("is-invalid");this.removeAttribute("data-invalid")}else{input.setAttribute("aria-invalid","true");this.classList.add("is-invalid");this.setAttribute("data-invalid","");if(!this.getAttribute("error")){const msg=input.validationMessage||"Invalid value";let errEl=this.querySelector(".c-field__error");if(!errEl){errEl=document.createElement("span");errEl.className="c-field__error";this.appendChild(errEl)}errEl.textContent=msg;if(!errEl.id)errEl.id=contourId("err");input.setAttribute("aria-describedby",(input.getAttribute("aria-describedby")||"").split(" ").filter((x)=>x&&x!==errEl.id).concat(errEl.id).join(" "))}}sync()},true);sync()};define("contour-field",ContourField);class ContourRange extends ContourBase{static get observed(){return["min","max","value","label"]}static get formAssociated(){return true}static get properties(){return{min:{attribute:"min"},max:{attribute:"max"},value:{attribute:"value"},label:{attribute:"label"}}}render(){this.classList.add("c-range");const input=this.ensure("input",()=>{const el=document.createElement("input");el.type="range";return el});input.type="range";input.className="c-range";input.min=this.getAttribute("min")||"0";input.max=this.getAttribute("max")||"100";const attrVal=this.getAttribute("value")||"50";if(this._rangeUserValue!==null&&this._rangeAttrAtDirty===(this.getAttribute("value")||"50")){input.value=this._rangeUserValue}else{input.value=attrVal;this._rangeUserValue=null;this._rangeAttrAtDirty=null}const label=this.getAttribute("label");if(label)input.setAttribute("aria-label",label);else if(!input.hasAttribute("aria-label"))input.setAttribute("aria-label","Range");const updateFill=()=>{const min=Number(input.min)||0;const max=Number(input.max)||100;const val=Number(input.value)||0;const pct=max>min?((val-min)/(max-min))*100:0;input.style.setProperty("--fill",pct+"%")};updateFill();if(!input._fillWired){input._fillWired=true;input.addEventListener("input",updateFill)}}}const _origRangeRender=ContourRange.prototype.render;ContourRange.prototype.attributeChangedCallback=function(name,oldValue,newValue){if(name==="value"){this._rangeUserValue=null;this._rangeAttrAtDirty=null}return ContourBase.prototype.attributeChangedCallback.call(this,name,oldValue,newValue)};ContourRange.prototype.enhance=function(){if(this._wiredRange)return;this._wiredRange=true;const sync=()=>{const input=this.querySelector("input");if(!input||!this._internals)return;this._internals.setFormValue(input.value)};this.addEventListener("input",(e)=>{const input=this.querySelector("input");if(!input||e.target!==input)return;this._rangeUserValue=input.value;this._rangeAttrAtDirty=this.getAttribute("value")||"50";sync();this._emitForm("contour:input")});this.addEventListener("change",(e)=>{const input=this.querySelector("input");if(!input||e.target!==input)return;sync();this._emitForm("contour:change")});sync()};define("contour-range",ContourRange);class ContourSwitch extends ContourBase{static get observed(){return["label","required","checked"]}static get properties(){return{label:{attribute:"label"},required:{attribute:"required",type:Boolean},checked:{attribute:"checked",type:Boolean}}}static get formAssociated(){return true}render(){this.classList.add("c-switch");const label=this.getAttribute("label");const input=this.ensure("input.c-switch__input",()=>{const el=document.createElement("input");el.className="c-switch__input";el.type="checkbox";return el});input.checked=this.hasAttribute("checked");input.setAttribute("role","switch");input.setAttribute("aria-checked",String(input.checked));this._setCustomState("data-checked",input.checked);if(!input.nextElementSibling||!input.nextElementSibling.classList.contains("c-switch__track")){const track=document.createElement("span");track.className="c-switch__track";track.setAttribute("aria-hidden","true");if(input.nextSibling)this.insertBefore(track,input.nextSibling);else this.appendChild(track)}if(label){input.setAttribute("aria-label",label);const txt=this.querySelector(":scope > span:not([class]):not(.c-switch__track)")||(()=>{const el=document.createElement("span");this.appendChild(el);return el})();txt.textContent=label}}enhance(){const input=this.querySelector("input");if(input&&this._internals){input.setAttribute("aria-checked",String(input.checked));this._setCustomState("data-checked",input.checked);this._internals.setFormValue(input.checked?(input.value||"on"):null);this._syncValidity(this.hasAttribute("required")&&!input.checked)}if(this._wiredSwitch)return;this._wiredSwitch=true;this.addEventListener("change",(e)=>{const inp=this.querySelector("input");if(!inp||e.target!==inp||!this._internals)return;inp.setAttribute("aria-checked",String(inp.checked));this._setCustomState("data-checked",inp.checked);this._internals.setFormValue(inp.checked?(inp.value||"on"):null);this._emitForm("contour:change");this._syncValidity(this.hasAttribute("required")&&!inp.checked)})}}define("contour-switch",ContourSwitch);class ContourCheck extends ContourBase{static get observed(){return["label","name","value","required","type","checked"]}static get properties(){return{label:{attribute:"label"},name:{attribute:"name"},value:{attribute:"value"},required:{attribute:"required",type:Boolean},type:{attribute:"type"},checked:{attribute:"checked",type:Boolean}}}static get formAssociated(){return true}render(){this.classList.add("c-check");const label=this.getAttribute("label");const input=this.ensure("input.c-check__input",()=>{const el=document.createElement("input");el.className="c-check__input";el.type=this.getAttribute("type")==="radio"?"radio":"checkbox";return el});input.checked=this.hasAttribute("checked");if(!input.nextElementSibling||!input.nextElementSibling.classList.contains("c-check__box")){const box=document.createElement("span");box.className="c-check__box";box.setAttribute("aria-hidden","true");if(input.nextSibling)this.insertBefore(box,input.nextSibling);else this.appendChild(box)}if(label){input.setAttribute("aria-label",label);const txt=this.querySelector(":scope > span:not([class]):not(.c-check__box)")||(()=>{const el=document.createElement("span");this.appendChild(el);return el})();txt.textContent=label}if(this.hasAttribute("name"))input.name=this.getAttribute("name");if(this.hasAttribute("value"))input.value=this.getAttribute("value")}enhance(){const input=this.querySelector("input");if(input&&this._internals){this._setCustomState("data-checked",input.checked);this._internals.setFormValue(input.checked?(input.value||"on"):null);this._syncValidity(this.hasAttribute("required")&&!input.checked)}if(this._wiredCheck)return;this._wiredCheck=true;this.addEventListener("change",(e)=>{const inp=this.querySelector("input");if(!inp||e.target!==inp||!this._internals)return;this._setCustomState("data-checked",inp.checked);this._internals.setFormValue(inp.checked?(inp.value||"on"):null);this._emitForm("contour:change");this._syncValidity(this.hasAttribute("required")&&!inp.checked)})}}define("contour-check",ContourCheck);class ContourRadio extends ContourBase{static get observed(){return["label","name","value","required","checked"]}static get properties(){return{label:{attribute:"label"},name:{attribute:"name"},value:{attribute:"value"},required:{attribute:"required",type:Boolean},checked:{attribute:"checked",type:Boolean}}}static get formAssociated(){return true}render(){this.classList.add("c-radio");const label=this.getAttribute("label");const input=this.ensure("input.c-radio__input",()=>{const el=document.createElement("input");el.className="c-radio__input";el.type="radio";return el});input.checked=this.hasAttribute("checked");if(this.hasAttribute("name"))input.name=this.getAttribute("name");if(this.hasAttribute("value"))input.value=this.getAttribute("value");if(label){input.setAttribute("aria-label",label);const txt=this.querySelector(":scope > span:not([class])")||(()=>{const el=document.createElement("span");this.appendChild(el);return el})();txt.textContent=label}}enhance(){const input=this.querySelector("input");if(input&&this._internals){this._setCustomState("data-checked",input.checked);this._internals.setFormValue(input.checked?(input.value||"on"):null);this._syncValidity(this.hasAttribute("required")&&!input.checked)}if(this._wiredRadio)return;this._wiredRadio=true;this.addEventListener("change",(e)=>{const inp=this.querySelector("input");if(!inp||e.target!==inp||!this._internals)return;this._setCustomState("data-checked",inp.checked);this._internals.setFormValue(inp.checked?(inp.value||"on"):null);this._emitForm("contour:change");this._syncValidity(this.hasAttribute("required")&&!inp.checked)})}}define("contour-radio",ContourRadio);class ContourSelect extends ContourBase{static get observed(){return["options","required","label","placeholder"]}static get properties(){return{options:{attribute:"options"},required:{attribute:"required",type:Boolean},label:{attribute:"label"},placeholder:{attribute:"placeholder"}}}static get formAssociated(){return true}render(){this.classList.add("c-select");const options=this.getAttribute("options");const generated=new Set(this._contourGenerated||[]);const authored=Array.from(this.children).filter((n)=>!generated.has(n));if(options&&!authored.length){try{const parsed=JSON.parse(options);const select=this.ensure("select.c-select",()=>{const el=document.createElement("select");el.className="c-select";return el});select.innerHTML="";const label=this.getAttribute("label");if(label){select.setAttribute("aria-label",label);let lbl=this.querySelector("label.c-select__label");if(!lbl){lbl=document.createElement("label");lbl.className="c-select__label";lbl.textContent=label;this.insertBefore(lbl,select)}else lbl.textContent=label}const placeholder=this.getAttribute("placeholder");if(placeholder){const ph=document.createElement("option");ph.value="";ph.textContent=placeholder;ph.disabled=true;ph.selected=true;select.appendChild(ph)}const groups={};parsed.forEach((opt)=>{const g=(typeof opt==="object"&&opt!==null)?opt.group:null;if(g){if(!groups[g]){groups[g]=document.createElement("optgroup");groups[g].label=g;select.appendChild(groups[g])}const option=document.createElement("option");option.value=typeof opt==="string"?opt:opt.value;option.textContent=typeof opt==="string"?opt:opt.label;groups[g].appendChild(option)}else{const option=document.createElement("option");option.value=typeof opt==="string"?opt:opt.value;option.textContent=typeof opt==="string"?opt:opt.label;select.appendChild(option)}});if(select.parentNode!==this)this.appendChild(select);this.classList.remove("c-select");select.classList.add("c-select")}catch(e){}}}enhance(){const select=this.querySelector("select");if(select&&this._internals){this._internals.setFormValue(select.value);this._syncValidity(this.hasAttribute("required")&&!select.value)}if(this._wiredSelect)return;this._wiredSelect=true;this.addEventListener("change",(e)=>{const sel=this.querySelector("select");if(!sel||e.target!==sel||!this._internals)return;this._internals.setFormValue(sel.value);this._emitForm("contour:change");this._syncValidity(this.hasAttribute("required")&&!sel.value)})}}define("contour-select",ContourSelect);class ContourVersion extends ContourBase{static get observed(){return["options"]}static get formAssociated(){return true}static get properties(){return{options:{attribute:"options"}}}render(){this.classList.add("c-version");const options=this.getAttribute("options");const generated=new Set(this._contourGenerated||[]);const authored=Array.from(this.children).filter((n)=>!generated.has(n));if(options&&!authored.length){try{const parsed=JSON.parse(options);const select=this.ensure("select.c-version",()=>{const el=document.createElement("select");el.className="c-version";return el});select.innerHTML="";if(!select.hasAttribute("aria-label"))select.setAttribute("aria-label","Version");parsed.forEach((opt)=>{const option=document.createElement("option");if(typeof opt==="string"){option.value=opt;option.textContent=opt}else{option.value=opt.value||opt.label;option.textContent=opt.label||opt.value;if(opt.selected)option.selected=true}select.appendChild(option)});if(select.parentNode!==this)this.appendChild(select);this.classList.remove("c-version");select.classList.add("c-version")}catch(e){}}}enhance(){if(this._wiredVersion)return;this._wiredVersion=true;const sync=()=>{const select=this.querySelector("select");if(!select||!this._internals)return;this._internals.setFormValue(select.value)};this.addEventListener("change",(e)=>{const select=this.querySelector("select");if(!select||e.target!==select)return;sync();this._emitForm("contour:change")});sync()}}define("contour-version",ContourVersion);class ContourTextarea extends ContourBase{static get observed(){return["placeholder","required"]}static get properties(){return{placeholder:{attribute:"placeholder"},required:{attribute:"required",type:Boolean}}}static get formAssociated(){return true}render(){this.classList.add("c-textarea");const ta=this.ensure("textarea",()=>{const el=document.createElement("textarea");el.className="c-textarea";return el});ta.className="c-textarea";ta.placeholder=this.getAttribute("placeholder")||"";if(this.hasAttribute("required"))ta.setAttribute("required","");else ta.removeAttribute("required")}enhance(){const ta=this.querySelector("textarea");if(ta&&this._internals){this._internals.setFormValue(ta.value);this._syncValidity(this.hasAttribute("required")&&!ta.value.trim())}if(this._wiredTextarea)return;this._wiredTextarea=true;this.addEventListener("input",(e)=>{const t=this.querySelector("textarea");if(!t||e.target!==t||!this._internals)return;this._internals.setFormValue(t.value);this._emitForm("contour:input");this._syncValidity(this.hasAttribute("required")&&!t.value.trim())});this.addEventListener("change",(e)=>{const t=this.querySelector("textarea");if(!t||e.target!==t||!this._internals)return;this._internals.setFormValue(t.value);this._emitForm("contour:change");this._syncValidity(this.hasAttribute("required")&&!t.value.trim())})}}define("contour-textarea",ContourTextarea);class ContourInputFull extends ContourBase{static get observed(){return["type","placeholder","required","value"]}static get properties(){return{type:{attribute:"type"},placeholder:{attribute:"placeholder"},required:{attribute:"required",type:Boolean},value:{attribute:"value"}}}static get formAssociated(){return true}render(){this.classList.add("c-input");const input=this.ensure("input",()=>{const el=document.createElement("input");el.className="c-input";return el});input.className="c-input";input.type=this.getAttribute("type")||"text";input.placeholder=this.getAttribute("placeholder")||"";if(this.hasAttribute("value"))input.value=this.getAttribute("value");if(this.hasAttribute("required"))input.setAttribute("required","");else input.removeAttribute("required")}enhance(){const input=this.querySelector("input");if(input&&this._internals){this._internals.setFormValue(input.value);this._syncValidity(this.hasAttribute("required")&&!input.value.trim())}if(this._wiredInput)return;this._wiredInput=true;this.addEventListener("input",(e)=>{const inp=this.querySelector("input");if(!inp||e.target!==inp||!this._internals)return;this._internals.setFormValue(inp.value);this._emitForm("contour:input");this._syncValidity(this.hasAttribute("required")&&!inp.value.trim())});this.addEventListener("change",(e)=>{const inp=this.querySelector("input");if(!inp||e.target!==inp||!this._internals)return;this._internals.setFormValue(inp.value);this._emitForm("contour:change");this._syncValidity(this.hasAttribute("required")&&!inp.value.trim())})}}define("contour-input",ContourInputFull);class ContourInputGroup extends ContourBase{static get observed(){return["label","placeholder","clearable","submit"]}static get properties(){return{label:{attribute:"label"},placeholder:{attribute:"placeholder"},clearable:{attribute:"clearable",type:Boolean},submit:{attribute:"submit",type:Boolean}}}render(){this.classList.add("c-input-group");const icon=this.ensure("svg",()=>{const el=document.createElementNS("http://www.w3.org/2000/svg","svg");el.setAttribute("aria-hidden","true");const use=document.createElementNS("http://www.w3.org/2000/svg","use");use.setAttribute("href","#i-search");el.appendChild(use);return el});const input=this.ensure("input.c-input",()=>{const el=document.createElement("input");el.className="c-input";el.type="text";return el});input.placeholder=this.getAttribute("placeholder")||this.getAttribute("label")||"";const oldClear=this.querySelector(".c-input-group__clear");if(oldClear)oldClear.remove();if(this.hasAttribute("clearable")){const btn=document.createElement("button");btn.className="c-input-group__clear";btn.type="button";btn.setAttribute("aria-label","Clear");btn.textContent="×";this.appendChild(btn)}const oldSubmit=this.querySelector(".c-input-group__submit");if(oldSubmit)oldSubmit.remove();if(this.hasAttribute("submit")){const btn=document.createElement("button");btn.className="c-input-group__submit";btn.type="submit";btn.setAttribute("aria-label","Submit");btn.textContent="→";this.appendChild(btn)}}enhance(){if(this._wiredInputGroup)return;this._wiredInputGroup=true;this.addEventListener("click",(e)=>{const clear=e.target&&e.target.closest?e.target.closest(".c-input-group__clear"):null;if(clear&&this.contains(clear)){e.preventDefault();const input=this.querySelector("input.c-input");if(input){input.value="";input.focus()}this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:""}}))}})}}define("contour-input-group",ContourInputGroup);class ContourRadioList extends ContourBase{static get observed(){return["items","name","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},name:{attribute:"name"},src:{attribute:"src"}}}static get formAssociated(){return true}render(){this.classList.add("c-radio-list");this.setAttribute("role","radiogroup");if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label",this.getAttribute("name")||"Options");wireStates(this);loadRemote(this,"items");if(renderStates(this,"radio-list"))return;const items=remoteData(this,"items");Array.from(this.querySelectorAll("label.c-radio")).forEach((l)=>l.remove());if(items){try{const parsed=JSON.parse(items);const groupName=this.getAttribute("name")||contourId("radio-list");parsed.forEach((it)=>{const lbl=document.createElement("label");lbl.className="c-radio";const input=document.createElement("input");input.type="radio";input.className="c-radio__input";input.name=groupName;input.tabIndex=-1;if(typeof it==="string"){input.value=it;lbl.appendChild(input);lbl.appendChild(document.createTextNode(" "+it))}else{input.value=it.value||it.label;if(it.checked)input.checked=true;lbl.appendChild(input);const span=document.createElement("span");span.textContent=it.label||it.value;lbl.appendChild(span)}this.appendChild(lbl)});const radios=Array.from(this.querySelectorAll("input.c-radio__input"));const checked=radios.find((r)=>r.checked)||radios[0];if(checked)checked.tabIndex=0}catch(e){}}else{renderEmpty(this,"radio-list")}}enhance(){const sync=()=>{if(!this._internals)return;const checked=this.querySelector("input.c-radio__input:checked");this._internals.setFormValue(checked?checked.value:null)};sync();if(this._wiredRadioList)return;this._wiredRadioList=true;this.addEventListener("change",(e)=>{const input=e.target&&e.target.closest?e.target.closest("input.c-radio__input"):null;if(!input||!this.contains(input))return;sync();this._emitForm("contour:change")});this.addEventListener("keydown",(e)=>{const radios=Array.from(this.querySelectorAll("input.c-radio__input"));if(!radios.length)return;const idx=radios.indexOf(e.target);if(idx===-1)return;const rtl=(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl";let next=-1;if(e.key==="ArrowDown")next=(idx+1)%radios.length;else if(e.key==="ArrowUp")next=(idx-1+radios.length)%radios.length;else if(e.key==="ArrowRight")next=rtl?(idx-1+radios.length)%radios.length:(idx+1)%radios.length;else if(e.key==="ArrowLeft")next=rtl?(idx+1)%radios.length:(idx-1+radios.length)%radios.length;else if(e.key==="Home")next=0;else if(e.key==="End")next=radios.length-1;else return;e.preventDefault();const before=radios.find((r)=>r.checked);for(const r of radios)r.tabIndex=-1;radios[next].tabIndex=0;radios[next].checked=true;radios[next].focus();sync();if(before!==radios[next])this._emitForm("contour:change")})}formResetCallback(){if(this._contourAuthored)this.requestRender()}}define("contour-radio-list",ContourRadioList);class ContourPressableFull extends ContourBase{static get observed(){return["disabled"]}static get properties(){return{disabled:{attribute:"disabled",type:Boolean}}}render(){this.classList.add("c-pressable");if(!this.hasAttribute("role"))this.setAttribute("role","button");if(this.hasAttribute("disabled")){this.setAttribute("aria-disabled","true");this.setAttribute("tabindex","-1")}else{this.removeAttribute("aria-disabled");if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0")}}enhance(){if(this._wiredPressable)return;this._wiredPressable=true;this.addEventListener("keydown",(e)=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();this.click();this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:true,composed:true}))}})}}define("contour-pressable",ContourPressableFull);class ContourResizeHandleFull extends ContourBase{render(){this.classList.add("c-resize-handle");if(!this.hasAttribute("role"))this.setAttribute("role","separator")}}define("contour-resize-handle",ContourResizeHandleFull);class ContourSearchTriggerFull extends ContourBase{static get observed(){return["label","shortcut"]}static get properties(){return{label:{attribute:"label"},shortcut:{attribute:"shortcut"}}}render(){this.classList.add("c-search-trigger");const label=this.getAttribute("label")||"Search";if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label",label);const span=this.ensure(".c-search-trigger__text",()=>{const el=document.createElement("span");el.className="c-search-trigger__text";return el});span.className="c-search-trigger__text";if(!span.textContent.trim()||span.textContent.trim()!==label)span.textContent=label;const kbd=this.ensure("kbd.c-search-trigger__kbd",()=>{const el=document.createElement("kbd");el.className="c-search-trigger__kbd";return el});kbd.className="c-search-trigger__kbd";kbd.textContent=this.getAttribute("shortcut")||"⌘K"}}define("contour-search-trigger",ContourSearchTriggerFull);class ContourShortcutListFull extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-shortcut-list");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-shortcut-list__title",()=>{const el=document.createElement("div");el.className="c-shortcut-list__title";el.style.padding="var(--space-sm)";el.style.fontWeight="var(--weight-semibold)";return el});t.textContent=title}}}define("contour-shortcut-list",ContourShortcutListFull);class ContourShortcutRowFull extends ContourBase{static get observed(){return["desc","key"]}static get properties(){return{desc:{attribute:"desc"},key:{attribute:"key"}}}render(){this.classList.add("c-shortcut-row");const key=this.getAttribute("key");const desc=this.getAttribute("desc");if(key){const k=this.ensure(".c-shortcut-row__keys",()=>{const el=document.createElement("kbd");el.className="c-shortcut-row__keys";return el});k.className="c-shortcut-row__keys";k.textContent=key}else{const k=this.querySelector(".c-shortcut-row__keys");if(k)k.remove()}if(desc){const s=this.ensure(".c-shortcut-row__label",()=>{const el=document.createElement("span");el.className="c-shortcut-row__label";return el});s.className="c-shortcut-row__label";s.textContent=desc}else{const s=this.querySelector(".c-shortcut-row__label");if(s)s.remove()}}}define("contour-shortcut-row",ContourShortcutRowFull);class ContourShortcutPanelFull extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-shortcut-panel");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-shortcut-panel__title",()=>{const el=document.createElement("div");el.className="c-shortcut-panel__title";return el});t.textContent=title}else{const t=this.querySelector(".c-shortcut-panel__title");if(t)t.remove()}}}define("contour-shortcut-panel",ContourShortcutPanelFull);class ContourShortcutOverlayFull extends ContourBase{static get observed(){return["title","open"]}static get properties(){return{title:{attribute:"title"},open:{attribute:"open",type:Boolean}}}render(){this.classList.add("c-shortcut-overlay");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-shortcut-overlay__title",()=>{const el=document.createElement("div");el.className="c-shortcut-overlay__title";el.style.padding="var(--space-sm)";return el});t.textContent=title}if(this.hasAttribute("open"))this.removeAttribute("hidden");else if(!this.hasAttribute("hidden"))this.setAttribute("hidden","")}show(){this.setAttribute("open","");this.removeAttribute("hidden");this.dispatchEvent(new CustomEvent("contour:open",{bubbles:true,composed:true}))}hide(){this.removeAttribute("open");this.setAttribute("hidden","");this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}))}toggle(){if(this.hasAttribute("open"))this.hide();else this.show()}enhance(){if(this._wiredShortcutOverlay)return;this._wiredShortcutOverlay=true;document.addEventListener("keydown",(e)=>{if(e.key==="?"&&!e.metaKey&&!e.ctrlKey&&!e.altKey){const tag=(e.target&&e.target.tagName)||"";if(tag==="INPUT"||tag==="TEXTAREA"||(e.target&&e.target.isContentEditable))return;e.preventDefault();this.toggle()}else if(e.key==="Escape"&&this.hasAttribute("open")){this.hide()}});this.addEventListener("click",(e)=>{if(e.target===this)this.hide()})}}define("contour-shortcut-overlay",ContourShortcutOverlayFull);class ContourRowActionFull extends ContourBase{static get observed(){return["label","disabled"]}static get properties(){return{label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean}}}render(){this.classList.add("c-row-action");if(!this.hasAttribute("role"))this.setAttribute("role","button");if(this.hasAttribute("disabled")){this.setAttribute("aria-disabled","true");this.setAttribute("tabindex","-1")}else{this.removeAttribute("aria-disabled");if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0")}const label=this.getAttribute("label");if(label&&!this.hasChildNodes())this.textContent=label}enhance(){if(this._wiredRowAction)return;this._wiredRowAction=true;this.addEventListener("keydown",(e)=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();this.click();this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:true,composed:true}))}})}}define("contour-row-action",ContourRowActionFull);class ContourSegmented extends ContourBase{static get observed(){return["options","selected","label","value"]}static get properties(){return{options:{attribute:"options"},selected:{attribute:"selected"},label:{attribute:"label"},value:{attribute:"value"}}}render(){this.classList.add("c-segmented");const options=this.getAttribute("options");if(options){let parsed=null;try{parsed=JSON.parse(options)}catch(e){parsed=null}if(Array.isArray(parsed)){Array.from(this.querySelectorAll("button.c-segmented__option")).forEach((n)=>n.remove());const selected=this.getAttribute("selected")||this.getAttribute("value");parsed.forEach((opt,i)=>{const label=typeof opt==="string"?opt:(opt.label||opt.value||"");const val=typeof opt==="string"?opt:(opt.value||opt.label||"");const btn=document.createElement("button");btn.className="c-segmented__option";btn.type="button";btn.textContent=label;btn.dataset.value=val;if(selected!==null&&String(val)===String(selected))btn.setAttribute("aria-pressed","true");else if(selected===null&&i===0)btn.setAttribute("aria-pressed","true");else btn.setAttribute("aria-pressed","false");this.appendChild(btn)})}}}enhance(){wireSegmented(this)}}define("contour-segmented",ContourSegmented);class ContourDraggable extends ContourBase{render(){this.classList.add("c-draggable");if(!this.hasAttribute("role"))this.setAttribute("role","button");if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");if(!this.hasAttribute("draggable"))this.setAttribute("draggable","true")}_dragValue(){return this.getAttribute("value")||this.getAttribute("label")||(this.textContent||"").trim()||"draggable"}enhance(){if(this._wiredDraggable)return;this._wiredDraggable=true;this.addEventListener("dragstart",(e)=>{if(!e.dataTransfer)return;const value=this._dragValue();try{e.dataTransfer.effectAllowed="move"}catch(err){}e.dataTransfer.setData("text/plain",value);this.classList.add("c-draggable--dragging");this.dispatchEvent(new CustomEvent("contour:dragstart",{bubbles:true,composed:true,detail:{value}}))});this.addEventListener("dragend",()=>{this.classList.remove("c-draggable--dragging");this.dispatchEvent(new CustomEvent("contour:dragend",{bubbles:true,composed:true,detail:{value:this._dragValue()}}))});this.addEventListener("keydown",(e)=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:true,composed:true}));return}if(e.key==="ArrowUp"||e.key==="ArrowDown"){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:move",{bubbles:true,composed:true,detail:{direction:e.key==="ArrowUp"?"up":"down"}}))}})}}define("contour-draggable",ContourDraggable);class ContourDragHandle extends ContourBase{render(){this.classList.add("c-drag-handle");if(!this.hasAttribute("role"))this.setAttribute("role","separator");if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");if(!this.hasAttribute("aria-orientation"))this.setAttribute("aria-orientation","horizontal")}enhance(){if(this._wiredDragHandle)return;this._wiredDragHandle=true;this.addEventListener("keydown",(e)=>{let delta=0;if(e.key==="ArrowLeft"||e.key==="ArrowDown")delta=-1;else if(e.key==="ArrowRight"||e.key==="ArrowUp")delta=1;else if(e.key==="Home")delta=-Infinity;else if(e.key==="End")delta=Infinity;else return;e.preventDefault();this.dispatchEvent(new CustomEvent("contour:drag",{bubbles:true,composed:true,detail:{key:e.key,delta}}))})}}define("contour-drag-handle",ContourDragHandle);class ContourDropIndicator extends ContourBase{static get observed(){return["label"]}static get properties(){return{label:{attribute:"label"}}}render(){this.classList.add("c-drop-indicator");this.classList.add("c-drop-indicator--visible");Array.from(this.childNodes).forEach((n)=>{if(n.nodeType===Node.TEXT_NODE)n.remove();else if(n.nodeType===Node.ELEMENT_NODE&&n.tagName==="SPAN")n.remove()});const label=this.getAttribute("label");if(label){const t=this.ensure(".c-drop-indicator__label",()=>{const el=document.createElement("span");el.className="c-drop-indicator__label";return el});t.textContent=label}}}define("contour-drop-indicator",ContourDropIndicator);class ContourDropZone extends ContourBase{static get observed(){return["label"]}static get properties(){return{label:{attribute:"label"}}}render(){this.classList.add("c-drop-zone");Array.from(this.childNodes).forEach((n)=>{if(n.nodeType===Node.TEXT_NODE)n.remove();else if(n.nodeType===Node.ELEMENT_NODE&&n.tagName==="SPAN")n.remove()});const label=this.getAttribute("label");if(label){const t=this.ensure(".c-drop-zone__label",()=>{const el=document.createElement("p");el.className="c-drop-zone__label";return el});t.textContent=label}}enhance(){if(this._wiredDropZone)return;this._wiredDropZone=true;const accepts=(e)=>e.dataTransfer&&Array.from(e.dataTransfer.types).includes("text/plain");const clear=()=>{this.classList.remove("c-drop-zone--active","c-drop-zone--reject")};this.addEventListener("dragenter",(e)=>{if(!e.dataTransfer)return;this.classList.toggle("c-drop-zone--reject",!accepts(e));if(accepts(e)){e.preventDefault();this.classList.add("c-drop-zone--active")}});this.addEventListener("dragover",(e)=>{if(!e.dataTransfer)return;this.classList.toggle("c-drop-zone--reject",!accepts(e));if(accepts(e)){e.preventDefault();this.classList.add("c-drop-zone--active")}});this.addEventListener("dragleave",clear);this.addEventListener("drop",(e)=>{if(!accepts(e))return;e.preventDefault();clear();const value=e.dataTransfer.getData("text/plain")||"";this.dispatchEvent(new CustomEvent("contour:drop",{bubbles:true,composed:true,detail:{value,label:this.getAttribute("label")}}))})}}define("contour-drop-zone",ContourDropZone);class ContourResizable extends ContourBase{static get observed(){return["direction","value"]}static get properties(){return{direction:{attribute:"direction"},value:{attribute:"value"}}}render(){this.classList.add("c-resizable");this.classList.remove("c-resizable--vertical","c-resizable--horizontal");const vertical=this.getAttribute("direction")==="vertical";this.classList.add(vertical?"c-resizable--vertical":"c-resizable--horizontal");if(!this.querySelector(".c-resizable__pane")){const p1=document.createElement("div");p1.className="c-resizable__pane";p1.textContent="Pane A";const handle=document.createElement("div");handle.className="c-resize-handle";handle.setAttribute("tabindex","0");handle.setAttribute("role","separator");const p2=document.createElement("div");p2.className="c-resizable__pane";p2.textContent="Pane B";this.appendChild(p1);this.appendChild(handle);this.appendChild(p2)}const v=this.getAttribute("value");if(v){const p1=this.querySelector(".c-resizable__pane");if(p1)p1.style.flex=`0 0 ${v}%`}}enhance(){if(this._wiredResizable)return;this._wiredResizable=true;const setSplit=(clientX,clientY)=>{const rect=this.getBoundingClientRect();const vertical=this.classList.contains("c-resizable--vertical");const span=vertical?rect.height:rect.width;const pos=vertical?clientY-rect.top:clientX-rect.left;const frac=span>0?Math.min(0.9,Math.max(0.1,pos/span)):0.5;const p1=this.querySelector(".c-resizable__pane");if(p1)p1.style.flex=`0 0 ${Math.round(frac * 100)}%`;this.setAttribute("value",String(Math.round(frac*100)))};this.addEventListener("pointerdown",(e)=>{const handle=this.querySelector(".c-resize-handle");if(!handle||e.target!==handle)return;this._resizing=true;handle.classList.add("c-resize-handle--dragging");if(handle.setPointerCapture){try{handle.setPointerCapture(e.pointerId)}catch(err){}}e.preventDefault()});this.addEventListener("pointermove",(e)=>{if(!this._resizing)return;setSplit(e.clientX,e.clientY)});const stopResize=(e)=>{if(!this._resizing)return;this._resizing=false;const handle=this.querySelector(".c-resize-handle");if(handle){handle.classList.remove("c-resize-handle--dragging");if(handle.hasPointerCapture&&handle.hasPointerCapture(e.pointerId)){try{handle.releasePointerCapture(e.pointerId)}catch(err){}}}};this.addEventListener("pointerup",stopResize);this.addEventListener("pointercancel",stopResize);this.addEventListener("keydown",(e)=>{const handle=this.querySelector(".c-resize-handle");if(!handle||document.activeElement!==handle)return;const vertical=this.classList.contains("c-resizable--vertical");const cur=parseFloat(this.getAttribute("value"))||50;if(e.key==="ArrowLeft"||e.key==="ArrowDown"){e.preventDefault();setSplit&&setSplit;const p1=this.querySelector(".c-resizable__pane");if(p1){const nv=Math.max(10,cur-5);p1.style.flex=`0 0 ${nv}%`;this.setAttribute("value",String(nv))}}else if(e.key==="ArrowRight"||e.key==="ArrowUp"){e.preventDefault();const p1=this.querySelector(".c-resizable__pane");if(p1){const nv=Math.min(90,cur+5);p1.style.flex=`0 0 ${nv}%`;this.setAttribute("value",String(nv))}}})}}define("contour-resizable",ContourResizable);class ContourTableWrap extends ContourBase{static get observed(){return[]}static get properties(){return{}}render(){this.classList.add("c-table-wrap");Array.from(this.childNodes).forEach((n)=>{if(n.nodeType===Node.TEXT_NODE)n.remove();else if(n.nodeType===Node.ELEMENT_NODE&&n.tagName==="SPAN")n.remove()});if(!this.querySelector("table")){const t=document.createElement("table");t.className="c-table";const thead=document.createElement("thead");const tr=document.createElement("tr");for(const h of["A","B"]){const th=document.createElement("th");th.textContent=h;tr.appendChild(th)}thead.appendChild(tr);t.appendChild(thead);const tbody=document.createElement("tbody");const tr2=document.createElement("tr");for(const v of["1","2"]){const td=document.createElement("td");td.textContent=v;tr2.appendChild(td)}tbody.appendChild(tr2);t.appendChild(tbody);this.appendChild(t)}}}define("contour-table-wrap",ContourTableWrap);class ContourScrollArea extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-scroll-area");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-scroll-area__title",()=>{const el=document.createElement("div");el.className="c-scroll-area__title";el.style.padding="var(--space-sm)";el.style.fontWeight="var(--weight-semibold)";return el});t.textContent=title}}}define("contour-scroll-area",ContourScrollArea);class ContourBtn extends ContourBase{static get observed(){return["variant","size","color","label","disabled"]}static get properties(){return{variant:{attribute:"variant"},size:{attribute:"size"},color:{attribute:"color"},label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean}}}render(){this.classList.add("c-btn");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-btn--"))this.classList.remove(c)});for(const attr of["variant","size","color"]){const val=this.getAttribute(attr);if(val)this.classList.add("c-btn--"+val)}if(!this.hasAttribute("role"))this.setAttribute("role","button");if(this.hasAttribute("disabled")){this.setAttribute("aria-disabled","true");this.setAttribute("tabindex","-1")}else{this.removeAttribute("aria-disabled");if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0")}const label=this.getAttribute("label");if(label&&!this.hasChildNodes())this.textContent=label;if(label&&!this.hasAttribute("aria-label"))this.setAttribute("aria-label",label)}enhance(){if(this._wiredBtn)return;this._wiredBtn=true;this.addEventListener("keydown",(e)=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();this.click();this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:true,composed:true}))}})}}define("contour-btn",ContourBtn);class ContourApp extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-app");const header=this.ensure(".c-app__header",()=>{const el=document.createElement("header");el.className="c-app__header";return el});const title=this.getAttribute("title");if(title){const t=this.ensure(".c-app__title",()=>{const el=document.createElement("div");el.className="c-app__title";el.style.padding="var(--space-md)";el.style.fontWeight="var(--weight-semibold)";return el});t.textContent=title;if(t.parentNode!==header)header.appendChild(t)}const main=this.ensure(".c-app__main",()=>{const el=document.createElement("main");el.className="c-app__main";return el});if(main.parentNode!==this)this.appendChild(main);if(header.parentNode!==this)this.insertBefore(header,main)}}define("contour-app",ContourApp);class ContourAppBody extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-app-body");const main=this.ensure(".c-app-body__main",()=>{const el=document.createElement("main");el.className="c-app-body__main";return el});const title=this.getAttribute("title");if(title){const t=this.ensure(".c-app-body__title",()=>{const el=document.createElement("div");el.className="c-app-body__title";el.style.padding="var(--space-md)";return el});t.textContent=title;if(t.parentNode!==main)main.appendChild(t)}if(main.parentNode!==this)this.appendChild(main)}}define("contour-app-body",ContourAppBody);class ContourBtnGroup extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-btn-group");this.setAttribute("role","group");if(this.getAttribute("title"))this.setAttribute("aria-label",this.getAttribute("title"));if(!this.querySelector(".c-btn")){for(const lbl of["One","Two","Three"]){const b=document.createElement("button");b.className="c-btn c-btn--sm";b.type="button";b.textContent=lbl;this.appendChild(b)}}}enhance(){if(this._wiredBtnGroup)return;this._wiredBtnGroup=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-btn"):null;if(btn&&this.contains(btn)){const buttons=Array.from(this.querySelectorAll(".c-btn"));const index=buttons.indexOf(btn);this.dispatchEvent(new CustomEvent("contour:btn-group-change",{bubbles:true,composed:true,detail:{index,label:btn.textContent}}))}});this.addEventListener("keydown",(e)=>{const buttons=Array.from(this.querySelectorAll(".c-btn"));if(!buttons.length)return;const active=document.activeElement;const idx=buttons.indexOf(active);let next=-1;const rtl=(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl";if(e.key==="ArrowDown")next=idx<0?0:Math.min(buttons.length-1,idx+1);else if(e.key==="ArrowUp")next=idx<0?0:Math.max(0,idx-1);else if(e.key==="ArrowRight")next=rtl?(idx<0?0:Math.max(0,idx-1)):(idx<0?0:Math.min(buttons.length-1,idx+1));else if(e.key==="ArrowLeft")next=rtl?(idx<0?0:Math.min(buttons.length-1,idx+1)):(idx<0?0:Math.max(0,idx-1));else if(e.key==="Home")next=0;else if(e.key==="End")next=buttons.length-1;if(next>=0&&next!==idx){e.preventDefault();buttons[next].focus()}})}}define("contour-btn-group",ContourBtnGroup);class ContourRangeScale extends ContourBase{static get observed(){return["label","value","ticks"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},ticks:{attribute:"ticks"}}}render(){this.classList.add("c-range-scale");this.setAttribute("role","group");if(this.getAttribute("label"))this.setAttribute("aria-label",this.getAttribute("label"));const label=this.getAttribute("label");if(label){const t=this.ensure(".c-range-scale__label",()=>{const el=document.createElement("span");el.className="c-range-scale__label";return el});t.textContent=label}const ticksAttr=this.getAttribute("ticks");Array.from(this.querySelectorAll(".c-range-scale__tick")).forEach((n)=>n.remove());if(ticksAttr){ticksAttr.split(",").map((s)=>s.trim()).filter(Boolean).forEach((tk)=>{const t=document.createElement("span");t.className="c-range-scale__tick";t.textContent=tk;this.appendChild(t)})}}enhance(){if(this._wiredRangeScale)return;this._wiredRangeScale=true;this.addEventListener("input",(e)=>{const t=e.target;if(t&&t.matches&&t.matches("input")){this.dispatchEvent(new CustomEvent("contour:range-change",{bubbles:true,composed:true,detail:{value:t.value}}))}});this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.matches&&t.matches("input")){this.dispatchEvent(new CustomEvent("contour:range-change",{bubbles:true,composed:true,detail:{value:t.value}}))}})}}define("contour-range-scale",ContourRangeScale);class ContourTimeRange extends ContourBase{static get observed(){return["label","value","ticks"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},ticks:{attribute:"ticks"}}}render(){this.classList.add("c-time-range");this.setAttribute("role","group");if(this.getAttribute("label"))this.setAttribute("aria-label",this.getAttribute("label"));const label=this.getAttribute("label");if(label){const t=this.ensure(".c-time-range__label",()=>{const el=document.createElement("span");el.className="c-time-range__label";return el});t.textContent=label}const ticksAttr=this.getAttribute("ticks");Array.from(this.querySelectorAll(".c-time-range__tick")).forEach((n)=>n.remove());if(ticksAttr){ticksAttr.split(",").map((s)=>s.trim()).filter(Boolean).forEach((tk)=>{const t=document.createElement("span");t.className="c-time-range__tick";t.textContent=tk;this.appendChild(t)})}}enhance(){if(this._wiredTimeRange)return;this._wiredTimeRange=true;this.addEventListener("input",(e)=>{const t=e.target;if(t&&t.matches&&t.matches("input")){this.dispatchEvent(new CustomEvent("contour:time-range-change",{bubbles:true,composed:true,detail:{value:t.value}}))}});this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.matches&&t.matches("input")){this.dispatchEvent(new CustomEvent("contour:time-range-change",{bubbles:true,composed:true,detail:{value:t.value}}))}})}}define("contour-time-range",ContourTimeRange);function wireMapItems(host,itemSelector,tooltipClass){if(host._wiredMapItems)return;host._wiredMapItems=true;const items=()=>Array.from(host.querySelectorAll(itemSelector));const showTip=(e)=>{const tip=host.querySelector(tooltipClass);if(!tip)return;const item=e&&e.target&&typeof e.target.closest==="function"?e.target.closest(itemSelector):null;if(!item||!host.contains(item)){tip.setAttribute("hidden","");return}const title=item.getAttribute("title");if(title)tip.textContent=title;const rect=host.getBoundingClientRect();const ir=item.getBoundingClientRect();tip.style.setProperty("--chart-tip-inline-start",(ir.left-rect.left+ir.width/2)+"px");tip.style.setProperty("--chart-tip-block-start",(ir.top-rect.top)+"px");tip.removeAttribute("hidden")};const hideTip=()=>{const tip=host.querySelector(tooltipClass);if(tip)tip.setAttribute("hidden","")};host.addEventListener("mouseover",showTip);host.addEventListener("mouseout",(e)=>{if(!e.relatedTarget||!host.contains(e.relatedTarget))hideTip()});host.addEventListener("focusin",(e)=>{const item=e&&e.target&&typeof e.target.closest==="function"?e.target.closest(itemSelector):null;if(item&&host.contains(item))showTip({target:item})});host.addEventListener("focusout",(e)=>{if(!host.contains(e.relatedTarget))hideTip()});host.addEventListener("click",(e)=>{const item=e&&e.target&&typeof e.target.closest==="function"?e.target.closest(itemSelector):null;if(!item||!host.contains(item))return;const all=items();const index=all.indexOf(item);if(index<0)return;host.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{index,label:item.getAttribute("title")||item.textContent.trim()}}))});host.addEventListener("keydown",(e)=>{const item=e&&e.target&&typeof e.target.closest==="function"?e.target.closest(itemSelector):null;if(!item||!host.contains(item))return;if(e.key==="Enter"||e.key===" "){e.preventDefault();const all=items();const index=all.indexOf(item);if(index<0)return;host.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{index,label:item.getAttribute("title")||item.textContent.trim()}}))}const all=items();const idx=all.indexOf(item);if(idx<0)return;let next=-1;const rtl=(host.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl";if(e.key==="ArrowDown")next=Math.min(idx+1,all.length-1);else if(e.key==="ArrowUp")next=Math.max(idx-1,0);else if(e.key==="ArrowRight")next=rtl?Math.max(idx-1,0):Math.min(idx+1,all.length-1);else if(e.key==="ArrowLeft")next=rtl?Math.min(idx+1,all.length-1):Math.max(idx-1,0);else if(e.key==="Home")next=0;else if(e.key==="End")next=all.length-1;if(next<0||next===idx)return;e.preventDefault();all.forEach((c,i)=>c.setAttribute("tabindex",i===next?"0":"-1"));try{all[next].focus()}catch(err){}})}class ContourMinimap extends ContourBase{static get observed(){return["label","viewport","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},viewport:{attribute:"viewport"},src:{attribute:"src"}}}render(){this.classList.add("c-minimap");wireStates(this);loadRemote(this,["label","viewport"]);if(renderStates(this,"minimap"))return;const label=remoteData(this,"label")||(this._remoteData&&this._remoteData.label);const viewport=remoteData(this,"viewport")||(this._remoteData&&(this._remoteData.viewport||this._remoteData.value));if(!label&&!viewport){renderEmpty(this,"minimap");return}if(label){const l=this.ensure(".c-minimap__label",()=>{const el=document.createElement("span");el.className="c-minimap__label";return el});l.textContent=label}else{const l=this.querySelector(".c-minimap__label");if(l)l.remove()}if(viewport){const v=this.ensure(".c-minimap__viewport",()=>{const el=document.createElement("div");el.className="c-minimap__viewport";return el});v.textContent=viewport}else{const v=this.querySelector(".c-minimap__viewport");if(v)v.remove()}}}define("contour-minimap",ContourMinimap);class ContourCoordinate extends ContourBase{static get observed(){return["value","format","locale","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{value:{attribute:"value"},format:{attribute:"format"},locale:{attribute:"locale"},src:{attribute:"src"}}}render(){this.classList.add("c-coordinate");wireStates(this);loadRemote(this,"value");if(renderStates(this,"coordinate"))return;const value=remoteData(this,"value")||(this._remoteData&&(this._remoteData.value||this._remoteData.coordinate));if(!value){renderEmpty(this,"coordinate");return}const span=this.ensure(".c-coordinate__value",()=>{const el=document.createElement("span");el.className="c-coordinate__value";return el});span.textContent=formatValue(value,this.getAttribute("format"),this.getAttribute("locale"))}}define("contour-coordinate",ContourCoordinate);class ContourLayerPanel extends ContourBase{static get observed(){return["label","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-layer-panel");wireStates(this);loadRemote(this,"items");if(renderStates(this,"layer-panel"))return;const items=remoteData(this,"items");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-layer-panel__label",()=>{const el=document.createElement("span");el.className="c-layer-panel__label";return el});l.textContent=label}else{const l=this.querySelector(".c-layer-panel__label");if(l)l.remove()}if(items){try{const parsed=JSON.parse(items);const savedVisibility=new Map();this.querySelectorAll(".c-layer-panel__item").forEach((el)=>{const nm=el.querySelector(".c-layer-panel__name");const tg=el.querySelector(".c-layer-panel__toggle");if(nm&&tg)savedVisibility.set(nm.textContent,tg.checked)});Array.from(this.querySelectorAll(".c-layer-panel__item")).forEach((el)=>el.remove());parsed.forEach((it)=>{const name=typeof it==="string"?it:(it.name||it.label||"");const item=document.createElement("div");item.className="c-layer-panel__item"+(it.dragging?" c-layer-panel__item--dragging":"");const toggle=document.createElement("input");toggle.type="checkbox";toggle.className="c-layer-panel__toggle";toggle.setAttribute("aria-label","Toggle "+(name||"layer"));if(savedVisibility.has(name))toggle.checked=savedVisibility.get(name);else if(typeof it==="object"&&it.visible!==false)toggle.checked=true;item.appendChild(toggle);const nm=document.createElement("span");nm.className="c-layer-panel__name";nm.textContent=name;item.appendChild(nm);const opacity=document.createElement("input");opacity.type="range";opacity.className="c-layer-panel__opacity";opacity.min="0";opacity.max="100";opacity.setAttribute("aria-label","Opacity of "+(name||"layer"));opacity.value=(typeof it==="object"&&it.opacity!=null)?it.opacity:"100";item.appendChild(opacity);this.appendChild(item)})}catch(e){}}else{Array.from(this.querySelectorAll(".c-layer-panel__item")).forEach((el)=>el.remove());renderEmpty(this,"layer-panel")}}enhance(){if(this._wiredLayerPanel)return;this._wiredLayerPanel=true;this.addEventListener("change",(e)=>{const item=e.target&&e.target.closest?e.target.closest(".c-layer-panel__item"):null;if(!item||!this.contains(item))return;const name=item.querySelector(".c-layer-panel__name")?.textContent||"";if(e.target.classList.contains("c-layer-panel__toggle")){this.dispatchEvent(new CustomEvent("contour:layer-visibility",{bubbles:true,composed:true,detail:{name,visible:e.target.checked}}))}else if(e.target.classList.contains("c-layer-panel__opacity")){this.dispatchEvent(new CustomEvent("contour:layer-opacity",{bubbles:true,composed:true,detail:{name,opacity:Number(e.target.value)}}))}})}}define("contour-layer-panel",ContourLayerPanel);class ContourTimeSlider extends ContourBase{static get observed(){return["label","value"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},src:{attribute:"src"}}}render(){this.classList.add("c-time-slider");const play=this.ensure(".c-time-slider__play",()=>{const el=document.createElement("button");el.className="c-time-slider__play";el.type="button";el.setAttribute("aria-label","Play");el.setAttribute("data-state","play");const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("aria-hidden","true");const use=document.createElementNS("http://www.w3.org/2000/svg","use");use.setAttribute("href","#i-play");svg.appendChild(use);el.appendChild(svg);return el});const track=this.ensure(".c-time-slider__track",()=>{const el=document.createElement("input");el.className="c-time-slider__track";el.type="range";el.min="0";el.max="100";el.setAttribute("aria-label","Time");return el});const _attrVal=this.getAttribute("value")||"0";if(this._timeSliderAttrLast!==_attrVal){track.value=_attrVal;this._timeSliderAttrLast=_attrVal}track.setAttribute("aria-label",this.getAttribute("label")||"Time");const time=this.ensure(".c-time-slider__time",()=>{const el=document.createElement("span");el.className="c-time-slider__time";return el});time.textContent=this.getAttribute("label")||""}enhance(){if(this._wiredTimeSlider)return;this._wiredTimeSlider=true;let timer=undefined;const stop=()=>{if(timer!==undefined){clearInterval(timer);timer=undefined}};const step=()=>{const track=this.querySelector(".c-time-slider__track");if(!track){stop();return}const max=Number(track.max)||100;const next=Math.min(max,(Number(track.value)||0)+1);track.value=String(next);this.dispatchEvent(new CustomEvent("contour:time-change",{detail:{value:String(next)},bubbles:true,composed:true}));if(next>=max){stop();const btn=this.querySelector(".c-time-slider__play");if(btn){btn.setAttribute("data-state","play");btn.setAttribute("aria-label","Play");const use=btn.querySelector("use");if(use)use.setAttribute("href","#i-play")}}};this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-time-slider__play"):null;if(!btn)return;const playing=btn.getAttribute("data-state")==="play";btn.setAttribute("data-state",playing?"pause":"play");btn.setAttribute("aria-label",playing?"Pause":"Play");const use=btn.querySelector("use");if(use)use.setAttribute("href",playing?"#i-pause":"#i-play");if(playing){stop();timer=setInterval(step,1000)}else{stop()}});onDispose(this,stop)}}define("contour-time-slider",ContourTimeSlider);class ContourHexbin extends ContourBase{static get observed(){return["label","cells","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},cells:{attribute:"cells"},src:{attribute:"src"}}}render(){this.classList.add("c-hexbin");const label=this.getAttribute("label")||(this._remoteData&&this._remoteData.label);if(label){const l=this.ensure(".c-hexbin__label",()=>{const el=document.createElement("span");el.className="c-hexbin__label";return el});l.textContent=label}else{const l=this.querySelector(".c-hexbin__label");if(l)l.remove()}wireStates(this);loadRemote(this,"cells");if(renderStates(this,"hexbin"))return;const cells=remoteData(this,"cells");const effectiveCells=cells||(this._remoteData&&this._remoteData.cells?JSON.stringify(this._remoteData.cells):null);if(effectiveCells){try{const parsed=JSON.parse(effectiveCells);Array.from(this.querySelectorAll(".c-hexbin__cell")).forEach((n)=>n.remove());const cols=Math.ceil(Math.sqrt(parsed.length||1));this.style.gridTemplateColumns="repeat("+cols+", 1fr)";this.style.inlineSize="16rem";parsed.forEach((c,i)=>{const cell=document.createElement("div");cell.className="c-hexbin__cell";cell.setAttribute("tabindex",i===0?"0":"-1");if(typeof c==="object"&&c.value!=null){cell.textContent=c.value;cell.setAttribute("title",String(c.value))}else if(typeof c!=="object"){cell.textContent=c;cell.setAttribute("title",String(c))}this.appendChild(cell)});const tip=this.ensure(".c-hexbin__tooltip",()=>{const el=document.createElement("div");el.className="c-hexbin__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","")}catch(e){}}else{Array.from(this.querySelectorAll(".c-hexbin__cell")).forEach((n)=>n.remove());renderEmpty(this,"hexbin")}}enhance(){if(this._wiredHexbin)return;this._wiredHexbin=true;wireMapItems(this,".c-hexbin__cell",".c-hexbin__tooltip")}}define("contour-hexbin",ContourHexbin);class ContourFlowMap extends ContourBase{static get observed(){return["label","nodes","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},nodes:{attribute:"nodes"},src:{attribute:"src"}}}render(){this.classList.add("c-flow-map");const label=this.getAttribute("label")||(this._remoteData&&this._remoteData.label);if(label){const l=this.ensure(".c-flow-map__label",()=>{const el=document.createElement("span");el.className="c-flow-map__label";return el});l.textContent=label}else{const l=this.querySelector(".c-flow-map__label");if(l)l.remove()}wireStates(this);loadRemote(this,"nodes");if(renderStates(this,"flow-map"))return;const nodes=remoteData(this,"nodes");const effectiveNodes=nodes||(this._remoteData&&this._remoteData.nodes?JSON.stringify(this._remoteData.nodes):null);if(effectiveNodes){try{const parsed=JSON.parse(effectiveNodes);Array.from(this.querySelectorAll(".c-flow-map__node")).forEach((n)=>n.remove());parsed.forEach((n,i)=>{const node=document.createElement("span");node.className="c-flow-map__node"+(n.source?" c-flow-map__node--source":"")+(n.target?" c-flow-map__node--target":"");node.setAttribute("tabindex",i===0?"0":"-1");node.textContent=typeof n==="string"?n:(n.label||n.name||"");if(typeof n==="object"&&(n.label||n.name))node.setAttribute("title",n.label||n.name);this.appendChild(node)});const tip=this.ensure(".c-flow-map__tooltip",()=>{const el=document.createElement("div");el.className="c-flow-map__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","")}catch(e){}}else{Array.from(this.querySelectorAll(".c-flow-map__node")).forEach((n)=>n.remove());renderEmpty(this,"flow-map")}}enhance(){if(this._wiredFlowMap)return;this._wiredFlowMap=true;wireMapItems(this,".c-flow-map__node",".c-flow-map__tooltip")}}define("contour-flow-map",ContourFlowMap);class ContourIsochrone extends ContourBase{static get observed(){return["label","center","rings","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},center:{attribute:"center"},rings:{attribute:"rings"},src:{attribute:"src"}}}render(){this.classList.add("c-isochrone");const label=this.getAttribute("label")||(this._remoteData&&this._remoteData.label);if(label){const l=this.ensure(".c-isochrone__label",()=>{const el=document.createElement("span");el.className="c-isochrone__label";return el});l.textContent=label}else{const l=this.querySelector(".c-isochrone__label");if(l)l.remove()}const center=this.getAttribute("center")||(this._remoteData&&this._remoteData.center);if(center){const c=this.ensure(".c-isochrone__center",()=>{const el=document.createElement("span");el.className="c-isochrone__center";return el});c.textContent=center}else{const c=this.querySelector(".c-isochrone__center");if(c)c.remove()}wireStates(this);loadRemote(this,"rings");if(renderStates(this,"isochrone"))return;const rings=remoteData(this,"rings");const effectiveRings=rings||(this._remoteData&&this._remoteData.rings?JSON.stringify(this._remoteData.rings):null);if(effectiveRings){try{const parsed=JSON.parse(effectiveRings);Array.from(this.querySelectorAll(".c-isochrone__ring")).forEach((n)=>n.remove());parsed.forEach((r,i)=>{const ring=document.createElement("span");ring.className="c-isochrone__ring c-isochrone__ring--"+(r.label||r);ring.setAttribute("tabindex",i===0?"0":"-1");if(r.label)ring.setAttribute("title",r.label||r);this.appendChild(ring)});const tip=this.ensure(".c-isochrone__tooltip",()=>{const el=document.createElement("div");el.className="c-isochrone__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","")}catch(e){}}else{Array.from(this.querySelectorAll(".c-isochrone__ring")).forEach((n)=>n.remove());renderEmpty(this,"isochrone")}}enhance(){if(this._wiredIsochrone)return;this._wiredIsochrone=true;wireMapItems(this,".c-isochrone__ring",".c-isochrone__tooltip")}}define("contour-isochrone",ContourIsochrone);class ContourCatchment extends ContourBase{static get observed(){return["label","area","center","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},area:{attribute:"area"},center:{attribute:"center"},src:{attribute:"src"}}}render(){this.classList.add("c-catchment");const label=this.getAttribute("label")||(this._remoteData&&this._remoteData.label);if(label){const l=this.ensure(".c-catchment__label",()=>{const el=document.createElement("span");el.className="c-catchment__label";return el});l.textContent=label}else{const l=this.querySelector(".c-catchment__label");if(l)l.remove()}const area=this.getAttribute("area")||(this._remoteData&&this._remoteData.area);if(area){const a=this.ensure(".c-catchment__area",()=>{const el=document.createElement("span");el.className="c-catchment__area";return el});a.textContent=area}else{const a=this.querySelector(".c-catchment__area");if(a)a.remove()}const center=this.getAttribute("center")||(this._remoteData&&this._remoteData.center);if(center){const c=this.ensure(".c-catchment__center",()=>{const el=document.createElement("span");el.className="c-catchment__center";return el});c.textContent=center}else{const c=this.querySelector(".c-catchment__center");if(c)c.remove()}wireStates(this);loadRemote(this,["label","area","center"]);if(renderStates(this,"catchment"))return;const rLabel=remoteData(this,"label")||(this._remoteData&&this._remoteData.label);const rArea=remoteData(this,"area")||(this._remoteData&&this._remoteData.area);const rCenter=remoteData(this,"center")||(this._remoteData&&this._remoteData.center);if(!rLabel&&!rArea&&!rCenter){renderEmpty(this,"catchment");return}const tip=this.ensure(".c-catchment__tooltip",()=>{const el=document.createElement("div");el.className="c-catchment__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","");if(rArea)tip.textContent=rArea}enhance(){if(this._wiredCatchment)return;this._wiredCatchment=true;const showTip=()=>{const tip=this.querySelector(".c-catchment__tooltip");if(tip)tip.removeAttribute("hidden")};const hideTip=()=>{const tip=this.querySelector(".c-catchment__tooltip");if(tip)tip.setAttribute("hidden","")};this.addEventListener("mouseenter",showTip);this.addEventListener("mouseleave",hideTip);if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");this.addEventListener("focusin",showTip);this.addEventListener("focusout",hideTip)}}define("contour-catchment",ContourCatchment);class ContourCompassFull extends ContourBase{static get observed(){return["label","needle","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},needle:{attribute:"needle"},src:{attribute:"src"}}}render(){this.classList.add("c-compass");const label=this.getAttribute("label")||(this._remoteData&&this._remoteData.label);wireStates(this);loadRemote(this,"needle");if(renderStates(this,"compass"))return;const needle=remoteData(this,"needle")||(this._remoteData&&(this._remoteData.needle||this._remoteData.value));for(const dir of["n","s","e","w"]){const cls=".c-compass__label--"+dir;let l=this.querySelector(cls);if(!l){l=document.createElement("span");l.className="c-compass__label "+cls.slice(1);l.textContent=dir.toUpperCase();l.setAttribute("role","button");l.setAttribute("tabindex","0");this.appendChild(l)}}if(label&&label.toLowerCase()!=="compass"){const l=this.ensure(".c-compass__label:not([class*='--'])",()=>{const el=document.createElement("span");el.className="c-compass__label";return el});l.textContent=label}if(needle){const deg=Number(needle)||0;const n=this.ensure("svg.c-compass__needle",()=>{const el=document.createElementNS("http://www.w3.org/2000/svg","svg");el.setAttribute("class","c-compass__needle");el.setAttribute("viewBox","0 0 40 40");el.setAttribute("aria-hidden","true");const path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("d",compassNeedle(20,20,16,deg));el.appendChild(path);return el});const path=n.querySelector("path");if(path)path.setAttribute("d",compassNeedle(20,20,16,deg))}else{const n=this.querySelector("svg.c-compass__needle, .c-compass__needle");if(n)n.remove()}if(!needle&&!label){renderEmpty(this,"compass")}}enhance(){if(this._wiredCompass)return;this._wiredCompass=true;const DEGREES={n:0,e:90,s:180,w:270};const setBearing=(dir)=>{const deg=DEGREES[dir];if(deg===undefined)return;const n=this.querySelector(".c-compass__needle");if(n){const path=n.querySelector("path");if(path)path.setAttribute("d",compassNeedle(20,20,16,deg))}this.dispatchEvent(new CustomEvent("contour:bearing",{bubbles:true,composed:true,detail:{direction:dir,degrees:deg}}))};this.addEventListener("click",(e)=>{const label=e.target&&e.target.closest?e.target.closest(".c-compass__label--n, .c-compass__label--e, .c-compass__label--s, .c-compass__label--w"):null;if(!label||!this.contains(label))return;const m=label.className.match(/c-compass__label--([nsew])/);if(m)setBearing(m[1])});this.addEventListener("keydown",(e)=>{if(e.key!=="Enter"&&e.key!==" ")return;const label=e.target&&e.target.closest?e.target.closest(".c-compass__label--n, .c-compass__label--e, .c-compass__label--s, .c-compass__label--w"):null;if(!label||!this.contains(label))return;e.preventDefault();const m=label.className.match(/c-compass__label--([nsew])/);if(m)setBearing(m[1])})}}define("contour-compass",ContourCompassFull);class ContourLayerSwitch extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-layer-switch");wireStates(this);loadRemote(this,"items");if(renderStates(this,"layer-switch"))return;const items=remoteData(this,"items");const authored=Array.from(this.children).filter((n)=>n.classList&&n.classList.contains("c-layer-switch__item"));if(items&&!authored.length){Array.from(this.querySelectorAll(".c-layer-switch__item")).forEach((n)=>n.remove());try{const parsed=JSON.parse(items);const capped=Array.isArray(parsed)?parsed.slice(0,50):parsed;capped.forEach((it)=>{const item=document.createElement("div");item.className="c-layer-switch__item";const sw=document.createElement("span");sw.className="c-layer-switch__swatch";if(it.color)sw.style.background=it.color;item.appendChild(sw);const name=document.createElement("span");name.className="c-layer-switch__name";name.textContent=typeof it==="string"?it:(it.name||it.label||"");item.appendChild(name);if(it.count!=null){const c=document.createElement("span");c.className="c-layer-switch__count";c.textContent=it.count;item.appendChild(c)}const toggle=document.createElement("button");toggle.className="c-layer-switch__toggle";toggle.type="button";toggle.setAttribute("aria-label","Toggle "+(typeof it==="string"?it:(it.name||it.label||"layer")));toggle.innerHTML='<svg aria-hidden="true"><use href="#i-check" /></svg>';item.appendChild(toggle);this.appendChild(item)})}catch(e){}}else if(!items&&!authored.length){Array.from(this.querySelectorAll(".c-layer-switch__item")).forEach((n)=>n.remove());renderEmpty(this,"layer-switch")}}enhance(){if(this._wiredLayerSwitch)return;this._wiredLayerSwitch=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-layer-switch__toggle"):null;if(!btn||!this.contains(btn))return;const item=btn.closest(".c-layer-switch__item");const name=item?(item.querySelector(".c-layer-switch__name")?.textContent||""):"";this.dispatchEvent(new CustomEvent("contour:layer-toggle",{bubbles:true,composed:true,detail:{name}}))})}}define("contour-layer-switch",ContourLayerSwitch);class ContourMapSlot extends ContourBase{static get observed(){return["attribution","scale","chrome"]}static get properties(){return{attribution:{attribute:"attribution"},scale:{attribute:"scale"},chrome:{attribute:"chrome"}}}render(){this.classList.add("c-map-slot");const chrome=this.getAttribute("chrome");if(chrome){const c=this.ensure(".c-map-slot__chrome",()=>{const el=document.createElement("div");el.className="c-map-slot__chrome";return el});c.textContent=chrome}else{const c=this.querySelector(".c-map-slot__chrome");if(c)c.remove()}const attribution=this.getAttribute("attribution");if(attribution){const a=this.ensure(".c-map-slot__attribution",()=>{const el=document.createElement("div");el.className="c-map-slot__attribution";return el});a.textContent=attribution}else{const a=this.querySelector(".c-map-slot__attribution");if(a)a.remove()}const scale=this.getAttribute("scale");if(scale){const sc=this.ensure(".c-map-slot__scale",()=>{const el=document.createElement("div");el.className="c-map-slot__scale";return el});sc.textContent=scale}else{const sc=this.querySelector(".c-map-slot__scale");if(sc)sc.remove()}}}define("contour-map-slot",ContourMapSlot);class ContourMapArea extends ContourBase{static get observed(){return["attribution","attribution-mark","scale","controls"]}static get properties(){return{attribution:{attribute:"attribution"},"attribution-mark":{attribute:"attribution-mark"},scale:{attribute:"scale"},controls:{attribute:"controls"}}}render(){this.classList.add("c-map-area");const attribution=this.getAttribute("attribution");if(attribution){const a=this.ensure(".c-map-slot__attribution",()=>{const el=document.createElement("div");el.className="c-map-slot__attribution";return el});a.textContent=attribution}else{const a=this.querySelector(".c-map-slot__attribution");if(a)a.remove()}const mark=this.getAttribute("attribution-mark");if(mark){const m=this.ensure(".c-map-slot__attribution-mark",()=>{const el=document.createElement("span");el.className="c-map-slot__attribution-mark";return el});m.textContent=mark}else{const m=this.querySelector(".c-map-slot__attribution-mark");if(m)m.remove()}const scale=this.getAttribute("scale");if(scale){const sc=this.ensure(".c-map-slot__scale",()=>{const el=document.createElement("div");el.className="c-map-slot__scale";return el});sc.textContent=scale}else{const sc=this.querySelector(".c-map-slot__scale");if(sc)sc.remove()}const controls=this.getAttribute("controls");if(controls){try{const parsed=JSON.parse(controls);const wrap=this.ensure(".c-map-slot__controls",()=>{const el=document.createElement("div");el.className="c-map-slot__controls";return el});wrap.innerHTML="";parsed.forEach((c)=>{const btn=document.createElement("button");btn.className="c-map-slot__control";btn.type="button";btn.textContent=typeof c==="string"?c:(c.label||c);wrap.appendChild(btn)})}catch(e){}}else{const w=this.querySelector(".c-map-slot__controls");if(w)w.remove()}}enhance(){if(this._wiredMapArea)return;this._wiredMapArea=true;this._map=null;this.attachMap=(map)=>{this._map=map||null;this.dispatchEvent(new CustomEvent("contour:map-attach",{bubbles:true,composed:true}))};this.detachMap=()=>{this._map=null;this.dispatchEvent(new CustomEvent("contour:map-detach",{bubbles:true,composed:true}))};Object.defineProperty(this,"map",{get:()=>this._map,set:(m)=>this.attachMap(m)});this.getViewport=()=>{const m=this._map;if(!m)return null;try{if(typeof m.getBounds==="function"){const b=m.getBounds();return{west:b.getWest(),south:b.getSouth(),east:b.getEast(),north:b.getNorth()}}if(m.transform&&typeof m.transform==="object"){return{zoom:m.transform.zoom,center:m.transform.center}}}catch(e){}return null};this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-map-slot__control"):null;if(!btn||!this.contains(btn))return;this.dispatchEvent(new CustomEvent("contour:map-control",{bubbles:true,composed:true,detail:{control:btn.textContent}}))})}}define("contour-map-area",ContourMapArea);class ContourMapPanel extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-map-panel");if(!this.hasAttribute("role"))this.setAttribute("role","region");const title=this.getAttribute("title");if(title){if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label",title)}else{if(this.getAttribute("aria-label")===this.getAttribute("title"))this.removeAttribute("aria-label")}}}define("contour-map-panel",ContourMapPanel);class ContourMapFooter extends ContourBase{static get observed(){return["brand"]}static get properties(){return{brand:{attribute:"brand"}}}render(){this.classList.add("c-map-footer");if(!this.hasAttribute("role"))this.setAttribute("role","contentinfo");const brand=this.getAttribute("brand");if(brand){const b=this.ensure("[data-map-footer-brand]",()=>{const el=document.createElement("span");el.setAttribute("data-map-footer-brand","");return el});b.textContent=brand}else{const b=this.querySelector("[data-map-footer-brand]");if(b)b.remove()}}}define("contour-map-footer",ContourMapFooter);class ContourScaleBar extends ContourBase{static get observed(){return["label","value","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},src:{attribute:"src"}}}render(){this.classList.add("c-scale-bar");wireStates(this);loadRemote(this,["label","value"]);if(renderStates(this,"scale-bar"))return;const label=remoteData(this,"label")||(this._remoteData&&this._remoteData.label);if(label){const l=this.ensure(".c-scale-bar__label",()=>{const el=document.createElement("span");el.className="c-scale-bar__label";return el});l.textContent=label}else{const l=this.querySelector(".c-scale-bar__label");if(l)l.remove()}const value=remoteData(this,"value")||(this._remoteData&&this._remoteData.value);if(!value){renderEmpty(this,"scale-bar");return}const line=this.ensure(".c-scale-bar__line",()=>{const el=document.createElement("span");el.className="c-scale-bar__line";return el});line.style.inlineSize=/^\d+(\.\d+)?$/.test(String(value))?value+"px":value;const ticks=scaleBarTicks(parseFloat(value)||0,4);const max=ticks[ticks.length-1]||1;Array.from(line.querySelectorAll(".c-scale-bar__tick")).forEach((t)=>t.remove());ticks.forEach((tv)=>{const tick=document.createElement("span");tick.className="c-scale-bar__tick";tick.style.insetInlineStart=((tv/max)*100)+"%";line.appendChild(tick)})}}define("contour-scale-bar",ContourScaleBar);class ContourReservedFull extends ContourBase{static get observed(){return["title"]}render(){this.classList.add("c-reserved");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-reserved__title",()=>{const el=document.createElement("div");el.className="c-reserved__title";return el});t.textContent=title}}}define("contour-reserved",ContourReservedFull);class ContourThemeScopeFull extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-theme-scope");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-theme-scope__title",()=>{const el=document.createElement("div");el.className="c-theme-scope__title";el.style.padding="var(--space-sm)";el.style.fontWeight="var(--weight-semibold)";return el});t.textContent=title}}}define("contour-theme-scope",ContourThemeScopeFull);class ContourActivity extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-activity");this.setAttribute("role","list");wireStates(this);loadRemote(this,"items");if(renderStates(this,"activity"))return;const items=remoteData(this,"items");if(items){try{const parsed=JSON.parse(items);Array.from(this.querySelectorAll(".c-activity__item")).forEach((n)=>n.remove());parsed.forEach((it,i)=>{const item=document.createElement("div");item.className="c-activity__item";item.setAttribute("role","listitem");item.tabIndex=-1;const dot=document.createElement("span");dot.className="c-activity__dot c-activity__dot--"+(it.variant||"primary");dot.setAttribute("aria-hidden","true");item.appendChild(dot);const text=document.createElement("span");text.className="c-activity__text";text.textContent=typeof it==="string"?it:(it.text||it.label||"");item.appendChild(text);if(it.time){const time=document.createElement("span");time.className="c-activity__time";time.textContent=it.time;item.appendChild(time)}this.appendChild(item)})}catch(e){}}else{renderEmpty(this,"activity")}}enhance(){if(this._wiredActivity)return;this._wiredActivity=true;this.addEventListener("click",(e)=>{const item=e.target&&e.target.closest?e.target.closest(".c-activity__item"):null;if(item&&this.contains(item)){const items=Array.from(this.querySelectorAll(".c-activity__item"));const index=items.indexOf(item);const text=item.querySelector(".c-activity__text")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:activity-select",{bubbles:true,composed:true,detail:{index,text}}))}});this.addEventListener("keydown",(e)=>{const items=Array.from(this.querySelectorAll(".c-activity__item"));if(!items.length)return;const active=document.activeElement;const idx=items.indexOf(active);let next=-1;if(e.key==="ArrowDown")next=idx<0?0:Math.min(items.length-1,idx+1);else if(e.key==="ArrowUp")next=idx<0?0:Math.max(0,idx-1);else if(e.key==="Home")next=0;else if(e.key==="End")next=items.length-1;if(next>=0&&next!==idx){e.preventDefault();items[next].focus();items[next].tabIndex=0;if(idx>=0)items[idx].tabIndex=-1}if((e.key==="Enter"||e.key===" ")&&idx>=0){e.preventDefault();const text=items[idx].querySelector(".c-activity__text")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:activity-select",{bubbles:true,composed:true,detail:{index:idx,text}}))}})}}define("contour-activity",ContourActivity);class ContourAdvanced extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-advanced");this.setAttribute("role","region");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-advanced__title",()=>{const el=document.createElement("div");el.className="c-advanced__title";return el});t.textContent=title;this.setAttribute("aria-label",title)}}enhance(){if(this._wiredAdvanced)return;this._wiredAdvanced=true;this.addEventListener("click",(e)=>{const title=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:advanced-toggle",{bubbles:true,composed:true,detail:{title}}))});this.addEventListener("keydown",(e)=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();const title=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:advanced-toggle",{bubbles:true,composed:true,detail:{title}}))}})}}define("contour-advanced",ContourAdvanced);class ContourAffordance extends ContourBase{static get observed(){return["name","note","demo"]}static get properties(){return{name:{attribute:"name"},note:{attribute:"note"},demo:{attribute:"demo"}}}render(){this.classList.add("c-affordance");this.setAttribute("role","group");const name=this.getAttribute("name");if(name){const n=this.ensure(".c-affordance__name",()=>{const el=document.createElement("div");el.className="c-affordance__name";return el});n.textContent=name;this.setAttribute("aria-label",name)}else{const n=this.querySelector(".c-affordance__name");if(n)n.remove()}const note=this.getAttribute("note");if(note){const nt=this.ensure(".c-affordance__note",()=>{const el=document.createElement("div");el.className="c-affordance__note";return el});nt.textContent=note}else{const nt=this.querySelector(".c-affordance__note");if(nt)nt.remove()}const demo=this.getAttribute("demo");if(demo){const d=this.ensure(".c-affordance__demo",()=>{const el=document.createElement("div");el.className="c-affordance__demo";return el});d.textContent=demo}else{const d=this.querySelector(".c-affordance__demo");if(d)d.remove()}}enhance(){if(this._wiredAffordance)return;this._wiredAffordance=true;this.addEventListener("click",(e)=>{const name=this.getAttribute("name")||"";this.dispatchEvent(new CustomEvent("contour:affordance-activate",{bubbles:true,composed:true,detail:{name}}))})}}define("contour-affordance",ContourAffordance);class ContourAffordances extends ContourBase{static get observed(){return["name","title"]}static get properties(){return{name:{attribute:"name"},title:{attribute:"title"}}}render(){this.classList.add("c-affordances");this.setAttribute("role","group");if(!this.querySelector(".c-affordance")){const aff=document.createElement("div");aff.className="c-affordance";const name=this.getAttribute("name")||this.getAttribute("title")||"Affordance";const n=document.createElement("div");n.className="c-affordance__name";n.textContent=name;aff.appendChild(n);const demo=document.createElement("div");demo.className="c-affordance__demo";demo.textContent="Demo";aff.appendChild(demo);this.appendChild(aff)}}}define("contour-affordances",ContourAffordances);class ContourMenu extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-menu");if(!this.hasAttribute("role"))this.setAttribute("role","menu");wireStates(this);loadRemote(this,"items");if(renderStates(this,"menu"))return;const items=remoteData(this,"items");const authored=Array.from(this.children).filter((n)=>!n.classList||!n.classList.contains("c-menu"));if(authored.length){if(this.querySelector("ul.c-menu"))return;const ul=document.createElement("ul");ul.className="c-menu";ul.setAttribute("role","menu");this.appendChild(ul);return}if(items){try{const parsed=JSON.parse(items);const ul=this.ensure("ul.c-menu",()=>{const el=document.createElement("ul");el.className="c-menu";el.setAttribute("role","menu");return el});ul.innerHTML="";ul.setAttribute("role","menu");parsed.forEach((item)=>{if(item==="---"||item==="separator"){const li=document.createElement("li");li.className="c-menu__separator";li.setAttribute("role","separator");ul.appendChild(li)}else if(typeof item==="string"){const li=document.createElement("li");li.className="c-menu__item";li.setAttribute("role","menuitem");li.textContent=item;ul.appendChild(li)}else if(item.group){const li=document.createElement("li");li.className="c-menu__group";li.setAttribute("role","group");if(item.group)li.setAttribute("aria-label",String(item.group));const hdr=document.createElement("div");hdr.className="c-menu__group-label";hdr.textContent=String(item.group);li.appendChild(hdr);if(Array.isArray(item.items)){const sub=document.createElement("ul");sub.className="c-menu";sub.setAttribute("role","menu");item.items.forEach((subItem)=>{const sli=document.createElement("li");sli.className="c-menu__item"+(subItem.danger?" c-menu__item--danger":"")+(subItem.disabled?" c-menu__item--disabled":"");sli.setAttribute("role","menuitem");if(subItem.disabled)sli.setAttribute("aria-disabled","true");if(subItem.label||subItem.title){const lbl=document.createElement("span");lbl.className="c-menu__label";lbl.textContent=subItem.label||subItem.title||"";sli.appendChild(lbl)}sub.appendChild(sli)});li.appendChild(sub)}ul.appendChild(li)}else{const li=document.createElement("li");li.className="c-menu__item"+(item.danger?" c-menu__item--danger":"")+(item.disabled?" c-menu__item--disabled":"");li.setAttribute("role","menuitem");if(item.disabled)li.setAttribute("aria-disabled","true");if(item.items&&Array.isArray(item.items)){li.setAttribute("aria-haspopup","menu");li.setAttribute("aria-expanded","false")}if(item.label||item.title){const lbl=document.createElement("span");lbl.className="c-menu__label";lbl.textContent=item.label||item.title||"";li.appendChild(lbl)}if(item.shortcut){const sc=document.createElement("span");sc.className="c-menu__shortcut";sc.textContent=item.shortcut;li.appendChild(sc)}ul.appendChild(li)}});if(ul.parentNode!==this)this.appendChild(ul);this.classList.remove("c-menu");ul.classList.add("c-menu")}catch(e){}}else{renderEmpty(this,"menu")}}enhance(){wireMenu(this)}}define("contour-menu",ContourMenu);class ContourTabs extends ContourBase{static get observed(){return["tabs","autoplay","pause","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","orientation","closable"]}static get properties(){return{tabs:{attribute:"tabs"},autoplay:{attribute:"autoplay",type:Number},pause:{attribute:"pause",type:Boolean},src:{attribute:"src"},orientation:{attribute:"orientation"},closable:{attribute:"closable",type:Boolean}}}render(){this.classList.add("c-tabs");wireStates(this);loadRemote(this,"tabs");if(renderStates(this,"tabs"))return;const tabs=remoteData(this,"tabs");const authored=Array.from(this.children).filter((n)=>!n.classList||!n.classList.contains("c-tabs__list"));if(tabs&&!authored.length){try{const parsed=JSON.parse(tabs);const list=this.ensure(".c-tabs__list",()=>{const el=document.createElement("div");el.className="c-tabs__list";el.setAttribute("role","tablist");return el});list.setAttribute("role","tablist");const orientation=this.getAttribute("orientation")==="vertical"?"vertical":"horizontal";list.setAttribute("aria-orientation",orientation);if(orientation==="vertical")this.classList.add("c-tabs--vertical");else this.classList.remove("c-tabs--vertical");const _prevTabs=Array.from(list.querySelectorAll("[role='tab']"));const _prevSel=_prevTabs.findIndex((t)=>t.getAttribute("aria-selected")==="true");const _keepIdx=_prevSel>=0?_prevSel:0;list.innerHTML="";Array.from(this.querySelectorAll(".c-tabs__panel")).forEach((n)=>n.remove());parsed.forEach((t,i)=>{const label=typeof t==="string"?t:(t.label||t.title||"");const panelId=contourId("c-tabs-panel");const btn=document.createElement("button");btn.className="c-tabs__tab";btn.setAttribute("role","tab");btn.setAttribute("aria-selected",String(i===_keepIdx));btn.setAttribute("aria-controls",panelId);btn.tabIndex=i===_keepIdx?0:-1;btn.textContent=label;if(this.hasAttribute("closable")){const closeBtn=document.createElement("button");closeBtn.type="button";closeBtn.className="c-tabs__close";closeBtn.setAttribute("aria-label","Close "+label);closeBtn.textContent="×";closeBtn.addEventListener("click",(e)=>{e.stopPropagation();const idx=Array.from(list.querySelectorAll("[role='tab']")).indexOf(btn);const ctrl=btn.getAttribute("aria-controls");const panel=ctrl?document.getElementById(ctrl):null;btn.remove();if(panel)panel.remove();this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true,detail:{index:idx,label}}));const remaining=list.querySelectorAll("[role='tab']");if(remaining.length)remaining[0].click()});btn.appendChild(closeBtn)}list.appendChild(btn);const panel=document.createElement("div");panel.className="c-tabs__panel";panel.id=panelId;panel.setAttribute("role","tabpanel");if(typeof t==="object"&&t!==null&&t.content!==undefined){panel.textContent=String(t.content)}if(i!==_keepIdx)panel.hidden=true;this.appendChild(panel)});if(list.parentNode!==this)this.prepend(list)}catch(e){}}else if(!tabs&&!authored.length){const list=this.querySelector(".c-tabs__list");if(list)list.remove();renderEmpty(this,"tabs")}}enhance(){wireTabs(this);const sync=()=>{const seconds=parseFloat(this.getAttribute("autoplay")||"");const paused=this.hasAttribute("pause")||this._tabsHover||this._tabsFocus;const reduced=typeof matchMedia==="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;const want=Number.isFinite(seconds)&&seconds>0&&!paused&&!reduced;if(want===this._tabsAutoplayRunning)return;this._tabsAutoplayRunning=want;if(this._tabsTimer!==undefined){clearInterval(this._tabsTimer);this._tabsTimer=undefined}if(!want)return;this._tabsTimer=setInterval(()=>{if(!this.isConnected||this.hasAttribute("pause")||this._tabsHover||this._tabsFocus)return;const list=this.querySelector(".c-tabs__list");const tabs=list?Array.from(list.querySelectorAll("[role='tab']")):[];if(!tabs.length)return;const cur=tabs.findIndex((t)=>t.getAttribute("aria-selected")==="true");const next=tabs[(cur+1)%tabs.length];if(next)next.click()},Math.max(1000,seconds*1000))};sync();if(this._wiredTabsAutoplay)return;this._wiredTabsAutoplay=true;this.addEventListener("pointerenter",()=>{this._tabsHover=true;sync()});this.addEventListener("pointerleave",()=>{this._tabsHover=false;sync()});this.addEventListener("focusin",()=>{this._tabsFocus=true;sync()});this.addEventListener("focusout",()=>{this._tabsFocus=false;sync()});onDispose(this,()=>{if(this._tabsTimer!==undefined){clearInterval(this._tabsTimer);this._tabsTimer=undefined}})}}define("contour-tabs",ContourTabs);class ContourHeader extends ContourBase{static get observed(){return["brand","links"]}static get properties(){return{brand:{attribute:"brand"},links:{attribute:"links"}}}render(){this.classList.add("c-header");const brand=this.getAttribute("brand");const links=this.getAttribute("links");const inner=this.ensure(".c-header__inner",()=>{const el=document.createElement("div");el.className="container c-header__inner";return el});inner.className="container c-header__inner";let brandEl=inner.querySelector(".c-brand");if(brand){if(!brandEl){brandEl=document.createElement("a");brandEl.className="c-brand";brandEl.setAttribute("data-contour-generated","");brandEl.href="#";brandEl.innerHTML=`<span class="c-mark"><svg aria-hidden="true"><use href="#i-mark" /></svg></span>`;const brandName=document.createElement("span");brandName.className="c-brand__name";brandEl.appendChild(brandName);inner.insertBefore(brandEl,inner.firstChild)}const brandName=brandEl.querySelector(".c-brand__name");if(brandName)brandName.textContent=brand}else if(brandEl&&brandEl.hasAttribute("data-contour-generated")){brandEl.remove()}let nav=inner.querySelector(".c-header__nav");const authoredNav=nav?Array.from(nav.children).filter((n)=>n.tagName==="A"):[];if(links&&!authoredNav.length){try{const parsed=JSON.parse(links);if(!nav){nav=document.createElement("nav");nav.className="c-header__nav";nav.setAttribute("aria-label","Main");nav.setAttribute("data-contour-generated","");inner.appendChild(nav)}nav.innerHTML="";parsed.forEach((l)=>{const a=document.createElement("a");a.href=l.href||"#";a.textContent=l.label||l;nav.appendChild(a)})}catch(e){}}else if(links&&authoredNav.length){}else if(nav&&!links&&!authoredNav.length&&nav.hasAttribute("data-contour-generated")){nav.remove()}if(!inner.querySelector(".c-header__actions")){const actions=document.createElement("div");actions.className="c-header__actions";inner.appendChild(actions)}const navEl=inner.querySelector(".c-header__nav");if(navEl){if(!navEl.id)navEl.id="contour-header-nav";const actions=inner.querySelector(".c-header__actions");if(actions&&!actions.querySelector(".c-header__toggle")){const toggle=document.createElement("button");toggle.type="button";toggle.className="c-header__toggle";toggle.setAttribute("aria-label","Toggle navigation");toggle.setAttribute("aria-expanded","false");toggle.setAttribute("aria-controls",navEl.id);toggle.innerHTML='<svg aria-hidden="true"><use href="#i-grid" /></svg>';actions.appendChild(toggle)}}if(inner.parentNode!==this)this.appendChild(inner)}enhance(){if(this._wiredHeader)return;this._wiredHeader=true;const update=()=>{const y=window.scrollY||document.documentElement.scrollTop||0;this.classList.toggle("c-header--scrolled",y>8)};update();window.addEventListener("scroll",update,{passive:true});onDispose(this,()=>window.removeEventListener("scroll",update));this.addEventListener("click",(e)=>{const toggle=e.target&&e.target.closest?e.target.closest(".c-header__toggle"):null;if(!toggle||!this.contains(toggle))return;const nav=this.querySelector("#"+CSS.escape(toggle.getAttribute("aria-controls")||""));if(!nav)return;const open=nav.classList.toggle("is-open");toggle.setAttribute("aria-expanded",String(open))});this.addEventListener("keydown",(e)=>{if(e.key!=="Escape")return;const toggle=this.querySelector(".c-header__toggle");const nav=toggle&&this.querySelector("#"+CSS.escape(toggle.getAttribute("aria-controls")||""));if(!toggle||!nav||!nav.classList.contains("is-open"))return;nav.classList.remove("is-open");toggle.setAttribute("aria-expanded","false")})}}define("contour-header",ContourHeader);class ContourTree extends ContourBase{static get observed(){return["items","virtual","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-tree");const authored=Array.from(this.children).filter((n)=>!n.classList||!n.classList.contains("c-tree"));wireStates(this);loadRemote(this,"items");if(renderStates(this,"tree"))return;const items=remoteData(this,"items");if(items&&!authored.length){try{const parsed=JSON.parse(items);const rootUl=this.ensure("div.c-tree",()=>{const el=document.createElement("div");el.className="c-tree";el.setAttribute("role","tree");return el});rootUl.innerHTML="";rootUl.className="c-tree";const render=(nodes,parent)=>{const ul=parent?document.createElement("div"):rootUl;if(parent){ul.className="c-tree__children";ul.setAttribute("role","group");if(supportsUntilFound())ul.setAttribute("hidden","until-found");else ul.setAttribute("hidden","")}nodes.forEach((node)=>{const li=document.createElement("div");li.className="c-tree__node";li.setAttribute("role","treeitem");if(node.children){li.setAttribute("aria-expanded","false");const row=document.createElement("div");row.className="c-tree__row"+(node.active?" c-tree__row--active":"")+(node.dir?" c-tree__row--dir":"");if(node.indent){const ind=document.createElement("span");ind.className="c-tree__indent";ind.style.inlineSize=(node.indent*1)+"rem";row.appendChild(ind)}const toggle=document.createElement("button");toggle.className="c-tree__toggle";toggle.setAttribute("type","button");toggle.setAttribute("aria-expanded","false");toggle.setAttribute("aria-label","Toggle");toggle.innerHTML='<svg aria-hidden="true"><use href="#i-chevron-right" /></svg>';row.appendChild(toggle);const span=document.createElement("span");span.textContent=node.label;row.appendChild(span);li.appendChild(row);render(node.children,li)}else{const leaf=document.createElement("div");leaf.className="c-tree__leaf"+(node.active?" c-tree__row--active":"")+(node.dir?" c-tree__row--dir":"");if(node.indent){const ind=document.createElement("span");ind.className="c-tree__indent";ind.style.inlineSize=(node.indent*1)+"rem";leaf.appendChild(ind)}if(this.hasAttribute("selectable")){const cb=document.createElement("input");cb.type="checkbox";cb.className="c-tree__select";cb.setAttribute("aria-label","Select "+(node.label||node));leaf.insertBefore(cb,leaf.firstChild)}leaf.appendChild(document.createTextNode(node.label||node));li.appendChild(leaf)}ul.appendChild(li)});if(parent)parent.appendChild(ul)};render(parsed,null);this.classList.remove("c-tree");rootUl.classList.add("c-tree");if(this.hasAttribute("virtual")){rootUl.style.maxHeight=rootUl.style.maxHeight||"24rem";rootUl.style.overflow="auto";rootUl.querySelectorAll(".c-tree__node").forEach((n)=>{n.style.contentVisibility="auto";n.style.containIntrinsicSize="auto 1.5rem"})}if(rootUl.parentNode!==this)this.appendChild(rootUl)}catch(e){}}else if(!items&&!authored.length){renderEmpty(this,"tree")}}enhance(){wireTree(this)}}define("contour-tree",ContourTree);class ContourCodeTabs extends ContourBase{static get observed(){return["tabs","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist"]}static get properties(){return{tabs:{attribute:"tabs"},src:{attribute:"src"}}}render(){this.classList.add("c-code-tabs");wireStates(this);loadRemote(this,"tabs");if(renderStates(this,"code-tabs"))return;const tabs=remoteData(this,"tabs");const list=this.querySelector(".c-code-tabs__list");const authored=list?Array.from(list.children).filter((n)=>n.getAttribute&&n.getAttribute("role")==="tab"):[];if(tabs&&!authored.length){try{const parsed=JSON.parse(tabs);const l=this.ensure(".c-code-tabs__list",()=>{const el=document.createElement("div");el.className="c-code-tabs__list";el.setAttribute("role","tablist");return el});l.setAttribute("role","tablist");const _prevCodeTabs=Array.from(l.querySelectorAll("[role='tab']"));const _prevCodeSel=_prevCodeTabs.findIndex((t)=>t.getAttribute("aria-selected")==="true");const _keepCodeIdx=_prevCodeSel>=0?_prevCodeSel:0;l.innerHTML="";Array.from(this.querySelectorAll(".c-code-tabs__panel")).forEach((n)=>n.remove());parsed.forEach((t,i)=>{const label=typeof t==="string"?t:(t.label||t.title||"");const panelId=contourId("c-code-tabs-panel");const btn=document.createElement("button");btn.className="c-code-tabs__tab";btn.setAttribute("role","tab");btn.setAttribute("aria-selected",String(i===_keepCodeIdx));btn.setAttribute("aria-controls",panelId);btn.tabIndex=i===_keepCodeIdx?0:-1;btn.textContent=label;l.appendChild(btn);const panel=document.createElement("div");panel.className="c-code-tabs__panel";panel.id=panelId;panel.setAttribute("role","tabpanel");if(typeof t==="object"&&t!==null&&t.content!==undefined){panel.textContent=String(t.content)}if(i!==_keepCodeIdx)panel.hidden=true;this.appendChild(panel)});if(l.parentNode!==this)this.prepend(l)}catch(e){}}else if(!tabs&&list){list.remove();renderEmpty(this,"code-tabs")}else if(!tabs&&!list){renderEmpty(this,"code-tabs")}}enhance(){wireTabs(this)}}define("contour-code-tabs",ContourCodeTabs);class ContourBreadcrumb extends ContourBase{static get observed(){return["items","separator","max","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},separator:{attribute:"separator"},max:{attribute:"max",type:Number},src:{attribute:"src"}}};render(){this.classList.add("c-breadcrumb");wireStates(this);loadRemote(this,"items");if(renderStates(this,"breadcrumb"))return;const items=remoteData(this,"items");const nav=this.querySelector("nav");const ol=nav?nav.querySelector("ol"):null;const authored=ol?Array.from(ol.children).filter((n)=>n.tagName==="LI"):[];if(items&&!authored.length){try{const parsed=JSON.parse(items);const n=this.ensure("nav",()=>{const el=document.createElement("nav");el.setAttribute("aria-label","Breadcrumb");el.id="contour-breadcrumb-list";return el});n.setAttribute("aria-label","Breadcrumb");n.id="contour-breadcrumb-list";n.innerHTML="";const sep=this.getAttribute("separator")||"/";const max=this._overflowExpanded?null:this.max;const shown=Number.isFinite(max)&&max>1&&parsed.length>max?parsed.slice(-max):parsed;if(Number.isFinite(max)&&max>1&&parsed.length>max){const btn=document.createElement("button");btn.type="button";btn.className="c-breadcrumb__overflow";btn.setAttribute("aria-label",`Show ${parsed.length - shown.length + 1} more items`);btn.setAttribute("aria-expanded","false");btn.setAttribute("aria-controls","contour-breadcrumb-list");btn.textContent="…";btn.addEventListener("click",()=>{this._overflowExpanded=true;this.requestRender()});n.appendChild(btn)}shown.forEach((item,i)=>{if(i<shown.length-1){const a=document.createElement("a");a.href=item.href||"#";a.textContent=item.label||item;n.appendChild(a);const s=document.createElement("span");s.className="c-breadcrumb__sep";s.setAttribute("aria-hidden","true");s.textContent=sep;n.appendChild(s)}else{const span=document.createElement("span");span.textContent=item.label||item;span.setAttribute("aria-current","page");n.appendChild(span)}})}catch(e){}}else if(!items&&nav){nav.remove()}else if(!items&&!nav){renderEmpty(this,"breadcrumb")}}}define("contour-breadcrumb",ContourBreadcrumb);class ContourPagination extends ContourBase{static get observed(){return["pages","current","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist"]}static get properties(){return{pages:{attribute:"pages"},current:{attribute:"current"},src:{attribute:"src"}}}render(){this.classList.add("c-pagination");wireStates(this);loadRemote(this,"pages");if(renderStates(this,"pagination"))return;const pages=remoteData(this,"pages");Array.from(this.querySelectorAll(".c-pagination__link")).forEach((n)=>n.remove());let currentAttr=this.getAttribute("current")||"1";if(this.getAttribute("persist")==="storage"&&this.id){try{const stored=localStorage.getItem("contour-pagination:"+this.id);if(stored!==null)currentAttr=stored}catch(e){}}else if(this.getAttribute("persist")==="url"){try{const v=new URLSearchParams(window.location.search).get("c-pagination");if(v!==null)currentAttr=v}catch(e){}}const current=parseInt(currentAttr,"10")||1;if(pages){let count=parseInt(pages,10);if(!Number.isFinite(count)||count<1){try{const p=JSON.parse(pages);if(Array.isArray(p))count=p.length}catch(e){}}const prev=document.createElement("button");prev.type="button";prev.className="c-pagination__link c-pagination__prev";prev.setAttribute("data-action","prev");prev.textContent="‹";prev.setAttribute("aria-label","Previous page");this.appendChild(prev);for(let i=1;i<=count;i++){const btn=document.createElement("button");btn.type="button";btn.className="c-pagination__link";btn.textContent=String(i);if(i===current){btn.setAttribute("aria-current","page")}this.appendChild(btn)}const next=document.createElement("button");next.type="button";next.className="c-pagination__link c-pagination__next";next.setAttribute("data-action","next");next.textContent="›";next.setAttribute("aria-label","Next page");this.appendChild(next)}else{renderEmpty(this,"pagination")}}enhance(){wirePagination(this)}}define("contour-pagination",ContourPagination);class ContourPagerFull extends ContourBase{static get observed(){return["prev","next"]}static get properties(){return{prev:{attribute:"prev"},next:{attribute:"next"}}}render(){this.classList.add("c-pager");Array.from(this.querySelectorAll(".c-pager__link")).forEach((n)=>n.remove());const prev=this.getAttribute("prev");const next=this.getAttribute("next");if(prev){const a=document.createElement("a");a.className="c-pager__link";a.href=prev.split("|")[1]||"#";const dir=document.createElement("span");dir.className="c-pager__dir";dir.textContent="← Previous";a.appendChild(dir);const title=document.createElement("span");title.className="c-pager__title";title.textContent=prev.split("|")[0];a.appendChild(title);this.appendChild(a)}if(next){const a=document.createElement("a");a.className="c-pager__link c-pager__link--next";a.href=next.split("|")[1]||"#";const dir=document.createElement("span");dir.className="c-pager__dir";dir.textContent="Next →";a.appendChild(dir);const title=document.createElement("span");title.className="c-pager__title";title.textContent=next.split("|")[0];a.appendChild(title);this.appendChild(a)}}}define("contour-pager",ContourPagerFull);class ContourTocFull extends ContourBase{static get observed(){return["title","items","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{title:{attribute:"title"},items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-toc");wireStates(this);loadRemote(this,"items");if(renderStates(this,"toc"))return;const items=remoteData(this,"items");const title=this.getAttribute("title")||"On this page";const titleEl=this.ensure(".c-toc__title",()=>{const el=document.createElement("div");el.className="c-toc__title";return el});titleEl.textContent=title;const list=this.querySelector(".c-toc__list");const authored=list?Array.from(list.children).filter((n)=>n.tagName==="A"):[];if(items&&!authored.length){try{const parsed=JSON.parse(items);const l=this.ensure(".c-toc__list",()=>{const el=document.createElement("nav");el.className="c-toc__list";return el});l.className="c-toc__list";l.setAttribute("aria-label",title);l.innerHTML="";parsed.forEach((item)=>{const a=document.createElement("a");a.className="c-toc__link"+(item.sub?" c-toc__link--sub":"");a.href=item.href||"#";a.textContent=item.label||item;if(item.current)a.setAttribute("aria-current","true");l.appendChild(a)})}catch(e){}}else if(!items&&list){list.remove();renderEmpty(this,"toc")}else if(!items&&!list){renderEmpty(this,"toc")}}enhance(){if(this._wiredTocSpy)return;if(typeof IntersectionObserver!=="function")return;const links=()=>Array.from(this.querySelectorAll(".c-toc__link"));const targets=links().map((a)=>{const href=a.getAttribute("href")||"";if(!href.startsWith("#")||href.length<2)return null;return document.getElementById(href.slice(1))}).filter(Boolean);if(!targets.length)return;this._wiredTocSpy=true;const spy=new IntersectionObserver((entries)=>{const visible=entries.filter((en)=>en.isIntersecting).map((en)=>en.target.id);if(!visible.length)return;const top=visible[0];links().forEach((a)=>{const href=a.getAttribute("href")||"";const isCurrent=href==="#"+top;if(isCurrent&&a.getAttribute("aria-current")!=="true")a.setAttribute("aria-current","true");else if(!isCurrent&&a.hasAttribute("aria-current"))a.removeAttribute("aria-current")})},{rootMargin:"0px 0px -60% 0px",threshold:0});targets.forEach((t)=>spy.observe(t));onDispose(this,()=>spy.disconnect());if(!this._wiredTocScroll){this._wiredTocScroll=true;this.addEventListener("click",(e)=>{const a=e.target&&e.target.closest?e.target.closest(".c-toc__link"):null;if(!a||!this.contains(a))return;const href=a.getAttribute("href")||"";if(!href.startsWith("#")||href.length<2)return;const target=document.getElementById(href.slice(1));if(!target)return;e.preventDefault();try{target.scrollIntoView({behavior:"smooth",block:"start"})}catch(err){target.scrollIntoView()}})}}}define("contour-toc",ContourTocFull);class ContourFilterBar extends ContourBase{static get observed(){return["label","divider","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},divider:{attribute:"divider"},items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-filter-bar");wireStates(this);loadRemote(this,"items");if(renderStates(this,"filter-bar"))return;const label=this.getAttribute("label");if(label){const l=this.ensure(".c-filter-bar__label",()=>{const el=document.createElement("span");el.className="c-filter-bar__label";return el});l.textContent=label}else{const l=this.querySelector(".c-filter-bar__label");if(l)l.remove()}if(this.hasAttribute("divider")){this.ensure(".c-filter-bar__divider",()=>{const el=document.createElement("span");el.className="c-filter-bar__divider";return el})}else{const d=this.querySelector(".c-filter-bar__divider");if(d)d.remove()}Array.from(this.querySelectorAll(".c-filter-pill")).forEach((n)=>n.remove());const items=remoteData(this,"items");let parsed=null;if(items){try{parsed=JSON.parse(items)}catch(e){parsed=null}}if(Array.isArray(parsed)){parsed.forEach((it)=>{const pill=document.createElement("span");pill.className="c-filter-pill";const txt=typeof it==="string"?it:(it.label||it.value||"");pill.textContent=txt;if(typeof it==="object"&&it!==null&&it.removable!==false){const btn=document.createElement("button");btn.className="c-filter-pill__remove";btn.type="button";btn.setAttribute("aria-label","Remove "+txt);btn.textContent="×";pill.appendChild(btn)}this.appendChild(pill)})}if(!parsed&&!label)renderEmpty(this,"filter-bar")}enhance(){wireRemovable(this)}}define("contour-filter-bar",ContourFilterBar);class ContourCommand extends ContourBase{static get observed(){return["placeholder","items","recent","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{placeholder:{attribute:"placeholder"},items:{attribute:"items"},recent:{attribute:"recent"},empty:{attribute:"empty"},src:{attribute:"src"}}}render(){this.classList.add("c-command");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");wireStates(this);loadRemote(this,"items");if(renderStates(this,"command"))return;const placeholder=this.getAttribute("placeholder")||"Search…";const input=this.ensure(".c-command__input",()=>{const el=document.createElement("input");el.className="c-command__input";el.type="text";return el});input.type="text";input.placeholder=placeholder;input.setAttribute("aria-label","Command");input.setAttribute("role","combobox");input.setAttribute("aria-autocomplete","list");input.setAttribute("aria-expanded","true");const list=this.querySelector(".c-command__list");if(list&&!list.id)list.id=contourId("c-command-list");if(list&&list.id)input.setAttribute("aria-controls",list.id);const items=remoteData(this,"items");const list2=this.querySelector(".c-command__list");const authored=list2?Array.from(list2.children).filter((n)=>n.classList&&n.classList.contains("c-command__item")||n.classList&&n.classList.contains("c-command__group")):[];if(items&&!authored.length){try{const parsed=JSON.parse(items);const l=this.ensure(".c-command__list",()=>{const el=document.createElement("div");el.className="c-command__list";el.setAttribute("role","listbox");el.id=contourId("c-command-list");return el});l.setAttribute("role","listbox");l.innerHTML="";const recentRaw=this.getAttribute("recent");if(recentRaw){try{const recentParsed=JSON.parse(recentRaw);const group=document.createElement("div");group.className="c-command__group";const gt=document.createElement("div");gt.className="c-command__group-title";gt.textContent="Recent";group.appendChild(gt);recentParsed.forEach((it)=>{const item=document.createElement("div");item.className="c-command__item";item.setAttribute("role","option");const body=document.createElement("div");body.className="c-command__item-body";const t=document.createElement("div");t.className="c-command__item-title";t.textContent=typeof it==="string"?it:(it.title||it.label||"");body.appendChild(t);item.appendChild(body);group.appendChild(item)});l.appendChild(group)}catch(e){}}parsed.forEach((it)=>{if(it.group){const group=document.createElement("div");group.className="c-command__group";const gt=document.createElement("div");gt.className="c-command__group-title";gt.textContent=it.group;group.appendChild(gt);const item=document.createElement("div");item.className="c-command__item";item.setAttribute("role","option");if(it.icon){const ic=document.createElement("span");ic.className="c-command__item-icon";ic.textContent=it.icon;item.appendChild(ic)}const body=document.createElement("div");body.className="c-command__item-body";if(it.title||it.label){const t=document.createElement("div");t.className="c-command__item-title";t.textContent=it.title||it.label;body.appendChild(t)}if(it.hint){const h=document.createElement("span");h.className="c-command__item-hint";h.textContent=it.hint;body.appendChild(h)}if(it.shortcut){const sc=document.createElement("kbd");sc.className="c-command__item-shortcut";sc.textContent=it.shortcut;item.appendChild(sc)}item.appendChild(body);group.appendChild(item);l.appendChild(group)}else{const item=document.createElement("div");item.className="c-command__item";item.setAttribute("role","option");if(it.icon){const ic=document.createElement("span");ic.className="c-command__item-icon";ic.textContent=it.icon;item.appendChild(ic)}const body=document.createElement("div");body.className="c-command__item-body";if(it.title||it.label){const t=document.createElement("div");t.className="c-command__item-title";t.textContent=it.title||it.label;body.appendChild(t)}if(it.hint){const h=document.createElement("span");h.className="c-command__item-hint";h.textContent=it.hint;body.appendChild(h)}if(it.shortcut){const sc=document.createElement("kbd");sc.className="c-command__item-shortcut";sc.textContent=it.shortcut;item.appendChild(sc)}item.appendChild(body);l.appendChild(item)}})}catch(e){}}else if(!items&&list){list.remove()}const empty=this.getAttribute("empty");if(empty){const e=this.ensure(".c-command__empty",()=>{const el=document.createElement("div");el.className="c-command__empty";return el});e.textContent=empty}else{const e=this.querySelector(".c-command__empty");if(e)e.remove()}const status=this.ensure(".c-command__status",()=>{const el=document.createElement("div");el.className="c-command__status";el.setAttribute("role","status");return el});status.textContent="";if(!items&&!list){renderEmpty(this,"command")}}enhance(){if(this._wiredCommand)return;this._wiredCommand=true;const input=()=>this.querySelector(".c-command__input");const items=()=>Array.from(this.querySelectorAll(".c-command__item"));let cursor=-1;const mark=()=>{items().forEach((it,i)=>{it.classList.toggle("c-command__item--active",i===cursor);it.setAttribute("aria-selected",String(i===cursor));if(i===cursor){if(!it.id)it.id="contour-command-option-"+i;const inp=input();if(inp)inp.setAttribute("aria-activedescendant",it.id)}});if(cursor<0){const inp=input();if(inp)inp.removeAttribute("aria-activedescendant")}};this.addEventListener("keydown",(e)=>{const inp=input();if(!inp||e.target!==inp)return;const its=items();if(!its.length)return;if(e.key==="ArrowDown"){e.preventDefault();cursor=Math.min(cursor+1,its.length-1);mark()}else if(e.key==="ArrowUp"){e.preventDefault();cursor=Math.max(cursor-1,0);mark()}else if(e.key==="Home"){e.preventDefault();cursor=0;mark()}else if(e.key==="End"){e.preventDefault();cursor=its.length-1;mark()}else if(e.key==="Enter"){e.preventDefault();if(cursor>=0&&its[cursor]){const item=its[cursor];const idx=items().indexOf(item);this.dispatchEvent(new CustomEvent("contour:select",{detail:{index:idx,label:item.textContent.trim()},bubbles:true,composed:true}))}}else if(e.key==="Escape"){if(typeof this.hidePopover==="function")this.hidePopover()}});this.addEventListener("click",(e)=>{const item=e.target&&e.target.closest?e.target.closest(".c-command__item"):null;if(item&&this.contains(item)){const idx=items().indexOf(item);this.dispatchEvent(new CustomEvent("contour:select",{detail:{index:idx,label:item.textContent.trim()},bubbles:true,composed:true}))}});this.addEventListener("input",(e)=>{const inp=input();if(!inp||e.target!==inp)return;const q=inp.value.trim().toLowerCase();const all=items();let visible=0;all.forEach((it)=>{const match=!q||(it.textContent||"").toLowerCase().includes(q);it.hidden=!match;if(match)visible+=1});this.querySelectorAll(".c-command__group").forEach((g)=>{const hasVisible=Array.from(g.querySelectorAll(".c-command__item")).some((it)=>!it.hidden);g.hidden=!hasVisible});cursor=-1;mark();const status=this.querySelector(".c-command__status");if(status)status.textContent=q?`${visible} of ${all.length}`:""})}}define("contour-command",ContourCommand);class ContourFooter extends ContourBase{static get observed(){return["brand","note","links","cols","heading"]}static get properties(){return{brand:{attribute:"brand"},note:{attribute:"note"},links:{attribute:"links"},cols:{attribute:"cols"}}}render(){this.classList.add("c-footer");const brand=this.getAttribute("brand");if(brand){const b=this.ensure(".c-footer__brand",()=>{const el=document.createElement("div");el.className="c-footer__brand";return el});b.textContent=brand}else{const b=this.querySelector(".c-footer__brand");if(b)b.remove()}const note=this.getAttribute("note");if(note){const n=this.ensure(".c-footer__note",()=>{const el=document.createElement("p");el.className="c-footer__note";return el});n.textContent=note}else{const n=this.querySelector(".c-footer__note");if(n)n.remove()}const links=this.getAttribute("links");if(links){try{const parsed=JSON.parse(links);const wrap=this.ensure(".c-footer__links",()=>{const el=document.createElement("div");el.className="c-footer__links";return el});wrap.innerHTML="";parsed.forEach((l)=>{const a=document.createElement("a");a.href=typeof l==="string"?"#":(l.href||"#");a.textContent=typeof l==="string"?l:(l.label||l);wrap.appendChild(a)})}catch(e){}}else{const w=this.querySelector(".c-footer__links");if(w)w.remove()}const cols=this.getAttribute("cols");if(cols){try{const parsed=JSON.parse(cols);this.querySelectorAll(".c-footer__col").forEach((c)=>c.remove());parsed.forEach((col)=>{const c=document.createElement("div");c.className="c-footer__col";if(col.title){const h=document.createElement(headingTag(this,"h3"));h.textContent=col.title;c.appendChild(h)}(col.links||[]).forEach((l)=>{const a=document.createElement("a");a.href=typeof l==="string"?"#":(l.href||"#");a.textContent=typeof l==="string"?l:(l.label||l);c.appendChild(a)});this.appendChild(c)})}catch(e){}}else{this.querySelectorAll(".c-footer__col").forEach((c)=>c.remove())}}}define("contour-footer",ContourFooter);class ContourSchemeToggle extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-scheme-toggle")}enhance(){if(this._wiredScheme)return;this._wiredScheme=true;this.addEventListener("click",()=>{const root=document.documentElement;root.classList.add("is-theme-switching");const current=root.getAttribute("data-theme")||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");const next=current==="dark"?"light":"dark";root.setAttribute("data-theme",next);try{localStorage.setItem("contour-theme",next)}catch(e){}requestAnimationFrame(()=>requestAnimationFrame(()=>root.classList.remove("is-theme-switching")));this.dispatchEvent(new CustomEvent("contour:theme-change",{detail:{theme:next},bubbles:true,composed:true}))});try{const stored=localStorage.getItem("contour-theme");if(stored)document.documentElement.setAttribute("data-theme",stored)}catch(e){}}}define("contour-scheme-toggle",ContourSchemeToggle);class ContourSidebar extends ContourBase{static get observed(){return["title","items","collapsed"]}static get properties(){return{title:{attribute:"title"},items:{attribute:"items"},collapsed:{attribute:"collapsed",type:Boolean}}}render(){this.classList.add("c-sidebar");if(this.hasAttribute("collapsed"))this.classList.add("c-sidebar--collapsed");else Array.from(this.classList).forEach((c)=>{if(c==="c-sidebar--collapsed")this.classList.remove(c)});const title=this.getAttribute("title");if(title){const t=this.ensure(".c-sidebar__title",()=>{const el=document.createElement("div");el.className="c-sidebar__title";return el});t.textContent=title}else{const t=this.querySelector(".c-sidebar__title");if(t)t.remove()}const items=this.getAttribute("items");if(items){try{const parsed=JSON.parse(items);const nav=this.ensure("nav.c-sidebar__nav",()=>{const el=document.createElement("nav");el.className="c-sidebar__nav";return el});nav.innerHTML="";parsed.forEach((it)=>{const a=document.createElement("a");a.className="c-sidebar__link";a.href=(it&&it.href)||"#";a.textContent=(it&&(it.label||it))||"";nav.appendChild(a)})}catch(e){}}}enhance(){if(this._wiredSidebar)return;this._wiredSidebar=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-sidebar__toggle"):null;if(!btn||!this.contains(btn))return;if(this.hasAttribute("collapsed"))this.removeAttribute("collapsed");else this.setAttribute("collapsed","")})}}define("contour-sidebar",ContourSidebar);class ContourToolbar extends ContourBase{static get observed(){return["title","actions","overflow"]}static get properties(){return{title:{attribute:"title"},actions:{attribute:"actions"},overflow:{attribute:"overflow",type:Number}}}render(){this.classList.add("c-toolbar");const title=this.getAttribute("title");this.setAttribute("role","toolbar");if(title)this.setAttribute("aria-label",title);const actions=this.getAttribute("actions");if(actions){try{const parsed=JSON.parse(actions);const limit=this.overflow&&this.overflow>0?this.overflow:parsed.length;const visible=parsed.slice(0,limit);const excess=parsed.slice(limit);visible.forEach((a)=>{const btn=document.createElement("button");btn.className="c-toolbar__btn";btn.type="button";btn.textContent=typeof a==="string"?a:(a.label||a);this.appendChild(btn)});if(excess.length){const wrap=document.createElement("div");wrap.className="c-toolbar__overflow";const btn=document.createElement("button");btn.className="c-toolbar__btn c-toolbar__overflow-btn";btn.type="button";btn.setAttribute("aria-haspopup","menu");btn.setAttribute("aria-expanded","false");btn.textContent="…";wrap.appendChild(btn);const menu=document.createElement("div");menu.className="c-toolbar__overflow-menu";menu.setAttribute("role","menu");menu.setAttribute("hidden","");excess.forEach((a)=>{const mbtn=document.createElement("button");mbtn.className="c-toolbar__btn";mbtn.type="button";mbtn.setAttribute("role","menuitem");mbtn.textContent=typeof a==="string"?a:(a.label||a);menu.appendChild(mbtn)});wrap.appendChild(menu);this.appendChild(wrap)}}catch(e){}}}enhance(){if(this._wiredToolbar)return;this._wiredToolbar=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-toolbar__overflow-btn"):null;if(!btn||!this.contains(btn))return;const menu=btn.parentElement&&btn.parentElement.querySelector(".c-toolbar__overflow-menu");if(!menu)return;const open=menu.hasAttribute("hidden");if(open)menu.removeAttribute("hidden");else menu.setAttribute("hidden","");btn.setAttribute("aria-expanded",String(open))})}}define("contour-toolbar",ContourToolbar);class ContourAvatar extends ContourBase{static get observed(){return["name","size","variant","src","status"]}static get properties(){return{name:{attribute:"name"},size:{attribute:"size"},variant:{attribute:"variant"},src:{attribute:"src"},status:{attribute:"status"}}}render(){this.classList.add("c-avatar");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-avatar--"))this.classList.remove(c)});const name=this.getAttribute("name");const size=this.getAttribute("size");if(size)this.classList.add("c-avatar--"+size);const variant=this.getAttribute("variant");if(variant)this.classList.add("c-avatar--"+variant);const oldImg=this.querySelector("img.c-avatar__img");if(oldImg)oldImg.remove();const oldDot=this.querySelector(".c-avatar__status");if(oldDot)oldDot.remove();const src=this.getAttribute("src");if(src){this.textContent="";const img=document.createElement("img");img.className="c-avatar__img";img.src=src;img.alt=name||"";this.appendChild(img)}else if(name){const initials=name.split(" ").map((w)=>w[0]).join("").toUpperCase().slice(0,2);if(!this.querySelector("img.c-avatar__img")){}this.textContent=initials}const status=this.getAttribute("status");if(status){const dot=document.createElement("span");dot.className="c-avatar__status c-avatar__status--"+status;dot.setAttribute("aria-hidden","true");this.appendChild(dot)}}}define("contour-avatar",ContourAvatar);class ContourBadgeFull extends ContourBase{static get observed(){return["variant","label","size","removable"]}static get properties(){return{variant:{attribute:"variant"},label:{attribute:"label"},size:{attribute:"size"},removable:{attribute:"removable",type:Boolean}}}render(){this.classList.add("c-badge");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-badge--"))this.classList.remove(c)});const variant=this.getAttribute("variant");if(variant)this.classList.add("c-badge--"+variant);const size=this.getAttribute("size");if(size)this.classList.add("c-badge--"+size);const label=this.getAttribute("label");if(label){let textNode=null;for(const n of this.childNodes){if(n.nodeType===3){textNode=n;break}}if(textNode)textNode.nodeValue=label;else this.insertBefore(document.createTextNode(label),this.firstChild)}if(this.hasAttribute("removable")){this.ensure(".c-badge__remove",()=>{const btn=document.createElement("button");btn.className="c-badge__remove";btn.type="button";btn.setAttribute("aria-label","Remove");btn.textContent="×";return btn})}else{const btn=this.querySelector(".c-badge__remove");if(btn)btn.remove()}}enhance(){wireRemovable(this)}}define("contour-badge",ContourBadgeFull);class ContourChipFull extends ContourBase{static get observed(){return["variant","key","value"]}static get properties(){return{variant:{attribute:"variant"},key:{attribute:"key"},value:{attribute:"value"}}}render(){this.classList.add("c-chip");if(!this.hasAttribute("role"))this.setAttribute("role","status");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-chip--"))this.classList.remove(c)});const variant=this.getAttribute("variant");if(variant)this.classList.add("c-chip--"+variant);const key=this.getAttribute("key");const value=this.getAttribute("value");if(key){const k=this.ensure(".c-chip__key",()=>{const el=document.createElement("span");el.className="c-chip__key";return el});k.textContent=key}else{const k=this.querySelector(".c-chip__key");if(k)k.remove()}if(value){const v=this.ensure(".c-chip__value",()=>{const el=document.createElement("span");el.className="c-chip__value";return el});v.textContent=value}else{const v=this.querySelector(".c-chip__value");if(v)v.remove()}}}define("contour-chip",ContourChipFull);class ContourTag extends ContourBase{static get observed(){return["label","removable","variant"]}static get properties(){return{label:{attribute:"label"},removable:{attribute:"removable",type:Boolean},variant:{attribute:"variant"}}}render(){this.classList.add("c-tag");if(!this.hasAttribute("role"))this.setAttribute("role","status");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-tag--"))this.classList.remove(c)});const variant=this.getAttribute("variant");if(variant)this.classList.add("c-tag--"+variant);const label=this.getAttribute("label");if(label){let textNode=null;for(const n of this.childNodes){if(n.nodeType===3){textNode=n;break}}if(textNode)textNode.nodeValue=label+" ";else this.insertBefore(document.createTextNode(label+" "),this.firstChild)}if(this.hasAttribute("removable")){this.ensure(".c-tag__remove",()=>{const btn=document.createElement("button");btn.className="c-tag__remove";btn.type="button";btn.setAttribute("aria-label","Remove");btn.textContent="×";return btn})}else{const btn=this.querySelector(".c-tag__remove");if(btn)btn.remove()}}enhance(){wireRemovable(this)}}define("contour-tag",ContourTag);class ContourDot extends ContourBase{static get observed(){return["variant","live"]}static get properties(){return{variant:{attribute:"variant"},live:{attribute:"live",type:Boolean}}}render(){this.classList.add("c-dot");if(!this.hasAttribute("role"))this.setAttribute("role","img");if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label","status indicator");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-dot--"))this.classList.remove(c)});const variant=this.getAttribute("variant");if(variant)this.classList.add("c-dot--"+variant);if(this.hasAttribute("live"))this.classList.add("c-dot--live")}}define("contour-dot",ContourDot);class ContourPill extends ContourBase{static get observed(){return["label","live","variant"]}static get properties(){return{label:{attribute:"label"},live:{attribute:"live",type:Boolean},variant:{attribute:"variant"}}}render(){this.classList.add("c-pill");if(!this.hasAttribute("role"))this.setAttribute("role","status");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-pill--"))this.classList.remove(c)});const variant=this.getAttribute("variant");if(variant)this.classList.add("c-pill--"+variant);const label=this.getAttribute("label");if(label){this.textContent=label}if(this.hasAttribute("live"))this.classList.add("c-pill--live")}}define("contour-pill",ContourPill);class ContourKbd extends ContourBase{static get observed(){return["key"]}static get properties(){return{key:{attribute:"key"}}}render(){this.classList.add("c-kbd");const key=this.getAttribute("key");if(key){this.textContent=key}}}define("contour-kbd",ContourKbd);class ContourSpinner extends ContourBase{static get observed(){return["size"]}static get properties(){return{size:{attribute:"size"}}}render(){this.classList.add("c-spinner");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-spinner--"))this.classList.remove(c)});const size=this.getAttribute("size");if(size)this.classList.add("c-spinner--"+size);if(!this.hasAttribute("role"))this.setAttribute("role","status");if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label","Loading")}}define("contour-spinner",ContourSpinner);class ContourSkeleton extends ContourBase{static get observed(){return["size"]}static get properties(){return{size:{attribute:"size"}}}render(){this.classList.add("c-skeleton");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-skeleton--"))this.classList.remove(c)});const size=this.getAttribute("size");if(size)this.classList.add("c-skeleton--"+size)}}define("contour-skeleton",ContourSkeleton);class ContourTooltip extends ContourBase{static get observed(){return["text","anchor","delay","trigger"]}static get properties(){return{text:{attribute:"text"},anchor:{attribute:"anchor"},delay:{attribute:"delay",type:Number},trigger:{attribute:"trigger"}}}render(){this.classList.add("c-tooltip");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");if(!this.hasAttribute("role"))this.setAttribute("role","tooltip");if(!this.id)this.id=contourId("tip");const text=this.getAttribute("text");if(text!==null&&!this.hasChildNodes()){this.textContent=text}}enhance(){if(this._wiredTooltip)return;this._wiredTooltip=true;const anchorSel=this.getAttribute("anchor");if(anchorSel){let trigger=null;if(anchorSel.startsWith("#")){trigger=document.getElementById(anchorSel.slice(1))}else{trigger=document.querySelector(anchorSel)}if(trigger){trigger.setAttribute("popovertarget",this.id||(this.id=contourId("tip")));trigger.setAttribute("aria-describedby",this.id)}}const delayMs=(this.delay&&this.delay>0)?this.delay:0;let showTimer=null;const show=()=>{if(showTimer)clearTimeout(showTimer);if(delayMs>0)showTimer=setTimeout(()=>{try{this.showPopover()}catch(e){}},delayMs);else{try{this.showPopover()}catch(e){}}};const hide=()=>{if(showTimer){clearTimeout(showTimer);showTimer=null}try{this.hidePopover()}catch(e){}};const triggerMode=this.getAttribute("trigger")||"hover";const trigger=anchorSel?(anchorSel.startsWith("#")?document.getElementById(anchorSel.slice(1)):document.querySelector(anchorSel)):null;const target=trigger||this;const onEnter=()=>{if(triggerMode!=="click")show()};const onLeave=()=>{if(triggerMode!=="click")hide()};const onFocus=()=>{if(triggerMode!=="click")show()};const onBlur=()=>{if(triggerMode!=="click")hide()};const onClick=()=>{if(triggerMode==="click"||triggerMode==="hover"){if(this.matches(":popover-open"))hide();else show()}};target.addEventListener("mouseenter",onEnter);target.addEventListener("mouseleave",onLeave);target.addEventListener("focus",onFocus);target.addEventListener("blur",onBlur);target.addEventListener("click",onClick);onDispose(this,()=>{target.removeEventListener("mouseenter",onEnter);target.removeEventListener("mouseleave",onLeave);target.removeEventListener("focus",onFocus);target.removeEventListener("blur",onBlur);target.removeEventListener("click",onClick);if(showTimer)clearTimeout(showTimer)});this.addEventListener("toggle",(e)=>{const t=e.target;if(t&&t===this){this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:this.matches(":popover-open")},bubbles:true,composed:true}))}});this.addEventListener("beforetoggle",(e)=>{this.dispatchEvent(new CustomEvent(e.newState==="open"?"contour:show":"contour:hide",{bubbles:true,composed:true}))})}}define("contour-tooltip",ContourTooltip);class ContourProgress extends ContourBase{static get observed(){return["value","label","min","max","paused","pausable"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"},min:{attribute:"min"},max:{attribute:"max"},paused:{attribute:"paused",type:Boolean},pausable:{attribute:"pausable",type:Boolean}}}render(){this.classList.add("c-progress");const value=this.getAttribute("value");if(value===null){this.style.removeProperty("--progress");if(this.getAttribute("aria-valuenow")===this._progressAriaValue){this.removeAttribute("aria-valuenow")}this._progressAriaValue=null}else{const num=Number(value);const pct=Number.isFinite(num)?(num<=1&&value.includes(".")?num*100:num):0;const pctStr=Math.max(0,Math.min(100,pct))+"%";this.style.setProperty("--progress",pctStr);const prevVal=this._progressAriaValue;if(!this.hasAttribute("aria-valuenow")||this.getAttribute("aria-valuenow")===prevVal){this.setAttribute("aria-valuenow",String(pct));this._progressAriaValue=String(pct)}}this.ensure(".c-progress__bar",()=>{const el=document.createElement("span");el.className="c-progress__bar";return el});if(!this.hasAttribute("role"))this.setAttribute("role","progressbar");const label=this.getAttribute("label");if(label&&!this.hasAttribute("aria-label"))this.setAttribute("aria-label",label);const min=this.getAttribute("min");const max=this.getAttribute("max");if(min!==null)this.setAttribute("aria-valuemin",min);else if(!this.hasAttribute("aria-valuemin"))this.setAttribute("aria-valuemin","0");if(max!==null)this.setAttribute("aria-valuemax",max);else if(!this.hasAttribute("aria-valuemax"))this.setAttribute("aria-valuemax","100");if(this.hasAttribute("paused"))this.classList.add("c-progress--paused");else Array.from(this.classList).forEach((c)=>{if(c==="c-progress--paused")this.classList.remove(c)});if(this.hasAttribute("pausable")){this.ensure(".c-progress__pause",()=>{const btn=document.createElement("button");btn.className="c-progress__pause";btn.type="button";btn.setAttribute("aria-label","Pause");btn.textContent="⏸";return btn})}else{const btn=this.querySelector(".c-progress__pause");if(btn)btn.remove()}}}define("contour-progress",ContourProgress);class ContourMark extends ContourBase{render(){this.classList.add("c-mark")}}define("contour-mark",ContourMark);class ContourLoading extends ContourBase{render(){this.classList.add("c-loading");this.ensure(".c-spinner",()=>{const el=document.createElement("span");el.className="c-spinner";return el})}}define("contour-loading",ContourLoading);class ContourElevation extends ContourBase{render(){this.classList.add("c-elevation")}}define("contour-elevation",ContourElevation);class ContourVersionBannerFull extends ContourBase{static get observed(){return["message","link","href","dismissible"]}static get properties(){return{message:{attribute:"message"},link:{attribute:"link"},href:{attribute:"href"},dismissible:{attribute:"dismissible",type:Boolean}}}render(){this.classList.add("c-version-banner");Array.from(this.children).forEach((n)=>n.remove());const message=this.getAttribute("message");if(message){const icon=document.createElement("svg");icon.setAttribute("aria-hidden","true");icon.innerHTML='<use href="#i-info" />';this.appendChild(icon);const span=document.createElement("span");span.textContent=message;this.appendChild(span)}const link=this.getAttribute("link");const href=this.getAttribute("href");if(link&&href){const a=document.createElement("a");a.className="c-version-banner__link";a.href=href;a.textContent=link;this.appendChild(a)}if(this.hasAttribute("dismissible")){const btn=document.createElement("button");btn.className="c-version-banner__dismiss";btn.type="button";btn.setAttribute("aria-label","Dismiss");btn.textContent="×";this.appendChild(btn)}}enhance(){if(this._wiredVersionBanner)return;this._wiredVersionBanner=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-version-banner__dismiss"):null;if(btn&&this.contains(btn)){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));this.remove()}})}}define("contour-version-banner",ContourVersionBannerFull);class ContourBanner extends ContourBase{static get observed(){return["message","variant"]}static get properties(){return{message:{attribute:"message"},variant:{attribute:"variant"}}}render(){this.classList.add("c-banner");const variant=this.getAttribute("variant");if(variant)this.classList.add("c-banner--"+variant);const message=this.getAttribute("message");if(message){const span=this.ensure(".c-banner__message",()=>{const el=document.createElement("span");el.className="c-banner__message";return el});span.textContent=message}}}define("contour-banner",ContourBanner);class ContourFilterPill extends ContourBase{static get observed(){return["key","value","removable"]}static get properties(){return{key:{attribute:"key"},value:{attribute:"value"},removable:{attribute:"removable",type:Boolean}}}render(){this.classList.add("c-filter-pill");const key=this.getAttribute("key");const value=this.getAttribute("value");if(key){const k=this.ensure(".c-filter-pill__key",()=>{const el=document.createElement("span");el.className="c-filter-pill__key";return el});k.textContent=key}else{const k=this.querySelector(".c-filter-pill__key");if(k)k.remove()}if(value){const v=this.ensure(".c-filter-pill__value",()=>{const el=document.createElement("span");el.className="c-filter-pill__value";return el});v.textContent=value}else{const v=this.querySelector(".c-filter-pill__value");if(v)v.remove()}if(this.hasAttribute("removable")){this.ensure(".c-filter-pill__remove",()=>{const btn=document.createElement("button");btn.className="c-filter-pill__remove";btn.type="button";btn.setAttribute("aria-label","Remove filter");btn.textContent="×";return btn})}else{const btn=this.querySelector(".c-filter-pill__remove");if(btn)btn.remove()}}enhance(){wireRemovable(this)}}define("contour-filter-pill",ContourFilterPill);class ContourDatamark extends ContourBase{static get observed(){return["value","unit","label"]}static get properties(){return{value:{attribute:"value"},unit:{attribute:"unit"},label:{attribute:"label"}}}render(){this.classList.add("c-datamark");const value=this.getAttribute("value");const unit=this.getAttribute("unit");const label=this.getAttribute("label");const text=value||label;if(text){this.textContent=text;if(unit){const u=document.createElement("span");u.className="u-subtle";u.textContent=" "+unit;this.appendChild(u)}}}}define("contour-datamark",ContourDatamark);class ContourDestructiveHint extends ContourBase{static get observed(){return["text"]}static get properties(){return{text:{attribute:"text"}}}render(){this.classList.add("c-destructive-hint");const text=this.getAttribute("text");if(text)this.textContent=text}}define("contour-destructive-hint",ContourDestructiveHint);class ContourIconBadge extends ContourBase{static get observed(){return["icon"]}static get properties(){return{icon:{attribute:"icon"}}}render(){this.classList.add("c-icon-badge");const icon=this.getAttribute("icon");if(icon){const sanitized=String(icon).replace(/[^a-zA-Z0-9_-]/g,"");if(sanitized&&!sanitized.startsWith("i-")){if(typeof console!=="undefined"&&console.warn){console.warn("ContourIconBadge: icon '"+icon+"' may not exist in the sprite (expected i-* name).")}}const existing=this.querySelector("svg");const svg=existing||document.createElementNS("http://www.w3.org/2000/svg","svg");if(!existing){svg.setAttribute("aria-hidden","true");const use=document.createElementNS("http://www.w3.org/2000/svg","use");use.setAttribute("href","#"+sanitized);svg.appendChild(use);this.appendChild(svg)}else{const use=svg.querySelector("use");if(use)use.setAttribute("href","#"+sanitized)}}else{const svg=this.querySelector("svg");if(svg)svg.remove()}}}define("contour-icon-badge",ContourIconBadge);class ContourLiveBadge extends ContourBase{static get observed(){return["label","state","live"]}static get properties(){return{label:{attribute:"label"},state:{attribute:"state"},live:{attribute:"live",type:Boolean}}}render(){this.classList.add("c-live-badge");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-live-badge--"))this.classList.remove(c)});const state=this.getAttribute("state");if(state){this.classList.add("c-live-badge--"+state)}else if(this.hasAttribute("live")){this.classList.add("c-live-badge--connected")}const label=this.getAttribute("label");if(label&&!this.hasChildNodes())this.textContent=label}}define("contour-live-badge",ContourLiveBadge);class ContourSkeletonGroup extends ContourBase{static get observed(){return["count"]}static get properties(){return{count:{attribute:"count",type:Number}}}render(){this.classList.add("c-skeleton-group");const count=Math.max(1,parseInt(this.getAttribute("count")||"3",10)||3);Array.from(this.querySelectorAll(".c-skeleton")).forEach((n)=>n.remove());for(let i=0;i<count;i++){const sk=document.createElement("div");sk.className="c-skeleton";this.appendChild(sk)}}}define("contour-skeleton-group",ContourSkeletonGroup);class ContourMapPopup extends ContourBase{static get observed(){return["title","content"]}static get properties(){return{title:{attribute:"title"},content:{attribute:"content"}}}render(){this.classList.add("c-map-popup");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");if(!this.id)this.id=contourId("map-popup");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-map-popup__title",()=>{const el=document.createElement("div");el.className="c-map-popup__title";return el});t.textContent=title}const content=this.getAttribute("content");if(content){const c=this.ensure(".c-map-popup__body",()=>{const el=document.createElement("div");el.className="c-map-popup__body";return el});c.textContent=content}}}define("contour-map-popup",ContourMapPopup);class ContourAnimationControls extends ContourBase{static get observed(){return["playing","speed"]}static get properties(){return{playing:{attribute:"playing",type:Boolean},speed:{attribute:"speed"}}}render(){this.classList.add("c-animation-controls");const playBtn=this.ensure(".c-animation-controls__play",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-animation-controls__play";el.type="button";return el});playBtn.textContent=this.hasAttribute("playing")?"Pause":"Play";playBtn.setAttribute("aria-label",this.hasAttribute("playing")?"Pause":"Play");const speed=this.getAttribute("speed")||"1x";const speedBtn=this.ensure(".c-animation-controls__speed",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-animation-controls__speed";el.type="button";return el});speedBtn.textContent=speed}enhance(){if(this._wiredAnimControls)return;this._wiredAnimControls=true;this.addEventListener("click",(e)=>{const play=e.target&&e.target.closest?e.target.closest(".c-animation-controls__play"):null;const speed=e.target&&e.target.closest?e.target.closest(".c-animation-controls__speed"):null;if(play&&this.contains(play)){this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:true,composed:true,detail:{playing:!this.hasAttribute("playing")}}))}if(speed&&this.contains(speed)){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{speed:speed.textContent}}))}})}}define("contour-animation-controls",ContourAnimationControls);class ContourDropdown extends ContourBase{static get observed(){return["label","items"]}static get properties(){return{label:{attribute:"label"},items:{attribute:"items"}}}render(){this.classList.add("c-dropdown");const btn=this.ensure(".c-dropdown__trigger",()=>{const el=document.createElement("button");el.className="c-dropdown__trigger c-btn c-btn--sm";el.type="button";return el});btn.textContent=this.getAttribute("label")||"Menu";const menu=this.ensure(".c-dropdown__menu",()=>{const el=document.createElement("div");el.className="c-dropdown__menu c-menu";el.setAttribute("role","menu");el.hidden=true;return el});const items=this.getAttribute("items");if(items){try{const parsed=JSON.parse(items);menu.innerHTML="";parsed.forEach((it)=>{const li=document.createElement("button");li.className="c-menu__item";li.setAttribute("role","menuitem");li.textContent=typeof it==="string"?it:(it.label||it.title||"");menu.appendChild(li)})}catch(e){}}if(menu.parentNode!==this)this.appendChild(menu);if(btn.parentNode!==this)this.insertBefore(btn,menu)}enhance(){if(this._wiredDropdown)return;this._wiredDropdown=true;const btn=()=>this.querySelector(".c-dropdown__trigger");const menu=()=>this.querySelector(".c-dropdown__menu");this.addEventListener("click",(e)=>{const b=btn();if(e.target===b||(b&&b.contains(e.target))){const m=menu();if(m){m.hidden=!m.hidden;b.setAttribute("aria-expanded",String(!m.hidden))}}});document.addEventListener("click",(e)=>{const m=menu();const b=btn();if(m&&!m.hidden&&!this.contains(e.target)){m.hidden=true;if(b)b.setAttribute("aria-expanded","false")}})}}define("contour-dropdown",ContourDropdown);class ContourAnnotation extends ContourBase{static get observed(){return["label","x","y"]}static get properties(){return{label:{attribute:"label"},x:{attribute:"x"},y:{attribute:"y"}}}render(){this.classList.add("c-annotation");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-annotation__label",()=>{const el=document.createElement("span");el.className="c-annotation__label";return el});l.textContent=label}const x=this.getAttribute("x");const y=this.getAttribute("y");if(x!==null)this.style.setProperty("--annotation-x",x);if(y!==null)this.style.setProperty("--annotation-y",y)}}define("contour-annotation",ContourAnnotation);class ContourStyleSwitcher extends ContourBase{static get observed(){return["items","value"]}static get properties(){return{items:{attribute:"items"},value:{attribute:"value"}}}render(){this.classList.add("c-style-switcher");const items=this.getAttribute("items");const value=this.getAttribute("value");Array.from(this.querySelectorAll(".c-style-switcher__option")).forEach((n)=>n.remove());if(items){try{const parsed=JSON.parse(items);parsed.forEach((it)=>{const name=typeof it==="string"?it:(it.name||it.label||"");const btn=document.createElement("button");btn.className="c-style-switcher__option c-btn c-btn--sm";btn.type="button";btn.textContent=name;if(name===value)btn.classList.add("c-style-switcher__option--active");btn.dataset.value=name;this.appendChild(btn)})}catch(e){}}}enhance(){if(this._wiredStyleSwitcher)return;this._wiredStyleSwitcher=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-style-switcher__option"):null;if(btn&&this.contains(btn)){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:btn.dataset.value}}))}})}}define("contour-style-switcher",ContourStyleSwitcher);class ContourStylePanel extends ContourBase{static get observed(){return["title","layers"]}static get properties(){return{title:{attribute:"title"},layers:{attribute:"layers"}}}render(){this.classList.add("c-style-panel");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-style-panel__title",()=>{const el=document.createElement("div");el.className="c-style-panel__title";return el});t.textContent=title}const layers=this.getAttribute("layers");const body=this.ensure(".c-style-panel__body",()=>{const el=document.createElement("div");el.className="c-style-panel__body";return el});if(layers){try{const parsed=JSON.parse(layers);body.innerHTML="";parsed.forEach((l)=>{const row=document.createElement("div");row.className="c-style-panel__row";const name=document.createElement("span");name.className="c-style-panel__name";name.textContent=typeof l==="string"?l:(l.name||l.label||"");row.appendChild(name);const input=document.createElement("input");input.type="color";input.className="c-style-panel__color";if(typeof l==="object"&&l.color)input.value=l.color;row.appendChild(input);body.appendChild(row)})}catch(e){}}}}define("contour-style-panel",ContourStylePanel);class ContourResponsiveContent extends ContourBase{static get observed(){return["breakpoint"]}static get properties(){return{breakpoint:{attribute:"breakpoint"}}}render(){this.classList.add("c-responsive-content");const bp=this.getAttribute("breakpoint")||"md";this.dataset.breakpoint=bp}}define("contour-responsive-content",ContourResponsiveContent);class ContourAvatarGroup extends ContourBase{static get observed(){return["items","max"]}static get properties(){return{items:{attribute:"items"},max:{attribute:"max",type:Number}}}render(){this.classList.add("c-avatar-group");const items=this.getAttribute("items");const max=parseInt(this.getAttribute("max")||"4",10)||4;Array.from(this.querySelectorAll(".c-avatar, .c-avatar-group__overflow")).forEach((n)=>n.remove());if(items){try{const parsed=JSON.parse(items);const shown=parsed.slice(0,max);shown.forEach((it)=>{const av=document.createElement("span");av.className="c-avatar";const name=typeof it==="string"?it:(it.name||it.label||"");av.textContent=name.slice(0,2).toUpperCase();if(typeof it==="object"&&it.color)av.style.background=it.color;this.appendChild(av)});if(parsed.length>max){const overflow=document.createElement("span");overflow.className="c-avatar c-avatar-group__overflow";overflow.textContent="+"+(parsed.length-max);this.appendChild(overflow)}}catch(e){}}}}define("contour-avatar-group",ContourAvatarGroup);class ContourDivider extends ContourBase{static get observed(){return["label","orientation"]}static get properties(){return{label:{attribute:"label"},orientation:{attribute:"orientation"}}}render(){this.classList.add("c-divider");const orientation=this.getAttribute("orientation")||"horizontal";this.classList.add("c-divider--"+orientation);const label=this.getAttribute("label");if(label){const l=this.ensure(".c-divider__label",()=>{const el=document.createElement("span");el.className="c-divider__label";return el});l.textContent=label}}}define("contour-divider",ContourDivider);class ContourStatusLight extends ContourBase{static get observed(){return["status","label"]}static get properties(){return{status:{attribute:"status"},label:{attribute:"label"}}}render(){this.classList.add("c-status-light");const status=this.getAttribute("status")||"neutral";this.classList.add("c-status-light--"+status);const label=this.getAttribute("label");if(label){const l=this.ensure(".c-status-light__label",()=>{const el=document.createElement("span");el.className="c-status-light__label";return el});l.textContent=label}}}define("contour-status-light",ContourStatusLight);class ContourSplitButton extends ContourBase{static get observed(){return["label","menu"]}static get properties(){return{label:{attribute:"label"},menu:{attribute:"menu"}}}render(){this.classList.add("c-split-button");const main=this.ensure(".c-split-button__main",()=>{const el=document.createElement("button");el.className="c-btn c-split-button__main";el.type="button";return el});main.textContent=this.getAttribute("label")||"Action";const toggle=this.ensure(".c-split-button__toggle",()=>{const el=document.createElement("button");el.className="c-btn c-btn--icon c-split-button__toggle";el.type="button";el.setAttribute("aria-label","More options");el.textContent="▾";return el});const menu=this.ensure(".c-split-button__menu",()=>{const el=document.createElement("div");el.className="c-menu c-split-button__menu";el.setAttribute("role","menu");el.hidden=true;return el});const items=this.getAttribute("menu");if(items){try{const parsed=JSON.parse(items);menu.innerHTML="";parsed.forEach((it)=>{const li=document.createElement("button");li.className="c-menu__item";li.setAttribute("role","menuitem");li.textContent=typeof it==="string"?it:(it.label||it.title||"");menu.appendChild(li)})}catch(e){}}if(main.parentNode!==this)this.appendChild(main);if(toggle.parentNode!==this)this.appendChild(toggle);if(menu.parentNode!==this)this.appendChild(menu)}enhance(){if(this._wiredSplitButton)return;this._wiredSplitButton=true;const toggle=()=>this.querySelector(".c-split-button__toggle");const menu=()=>this.querySelector(".c-split-button__menu");this.addEventListener("click",(e)=>{const t=toggle();if(e.target===t||(t&&t.contains(e.target))){const m=menu();if(m){m.hidden=!m.hidden;t.setAttribute("aria-expanded",String(!m.hidden))}}});document.addEventListener("click",(e)=>{const m=menu();const t=toggle();if(m&&!m.hidden&&!this.contains(e.target)){m.hidden=true;if(t)t.setAttribute("aria-expanded","false")}})}}define("contour-split-button",ContourSplitButton);class ContourPaletteEditor extends ContourBase{static get observed(){return["colors"]}static get properties(){return{colors:{attribute:"colors"}}}render(){this.classList.add("c-palette-editor");const colors=this.getAttribute("colors");Array.from(this.querySelectorAll(".c-palette-editor__swatch")).forEach((n)=>n.remove());if(colors){try{const parsed=JSON.parse(colors);parsed.forEach((c)=>{const sw=document.createElement("button");sw.className="c-palette-editor__swatch c-swatch";sw.type="button";sw.style.background=typeof c==="string"?c:(c.color||c.value||"");sw.setAttribute("aria-label",typeof c==="string"?c:(c.name||c.label||"color"));this.appendChild(sw)})}catch(e){}}}enhance(){if(this._wiredPaletteEditor)return;this._wiredPaletteEditor=true;this.addEventListener("click",(e)=>{const sw=e.target&&e.target.closest?e.target.closest(".c-palette-editor__swatch"):null;if(sw&&this.contains(sw)){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{color:sw.style.background}}))}})}}define("contour-palette-editor",ContourPaletteEditor);class ContourDateRange extends ContourBase{static get observed(){return["start","end","label"]}static get properties(){return{start:{attribute:"start"},end:{attribute:"end"},label:{attribute:"label"}}}render(){this.classList.add("c-date-range");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-date-range__label",()=>{const el=document.createElement("span");el.className="c-date-range__label";return el});l.textContent=label}const start=this.ensure(".c-date-range__start",()=>{const el=document.createElement("input");el.className="c-input c-date-range__start";el.type="date";return el});start.value=this.getAttribute("start")||"";const end=this.ensure(".c-date-range__end",()=>{const el=document.createElement("input");el.className="c-input c-date-range__end";el.type="date";return el});end.value=this.getAttribute("end")||""}enhance(){if(this._wiredDateRange)return;this._wiredDateRange=true;this.addEventListener("change",(e)=>{const t=e.target;if(t&&(t.classList.contains("c-date-range__start")||t.classList.contains("c-date-range__end"))){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{start:this.querySelector(".c-date-range__start")?.value,end:this.querySelector(".c-date-range__end")?.value}}))}})}}define("contour-date-range",ContourDateRange);class ContourShortcut extends ContourBase{static get observed(){return["key","label"]}static get properties(){return{key:{attribute:"key"},label:{attribute:"label"}}}render(){this.classList.add("c-shortcut");const key=this.getAttribute("key")||"";const label=this.getAttribute("label")||"";if(key){const k=this.ensure(".c-shortcut__key",()=>{const el=document.createElement("kbd");el.className="c-shortcut__key";return el});k.textContent=key}if(label){const l=this.ensure(".c-shortcut__label",()=>{const el=document.createElement("span");el.className="c-shortcut__label";return el});l.textContent=label}}enhance(){if(this._wiredShortcut)return;this._wiredShortcut=true;const key=this.getAttribute("key");if(key){document.addEventListener("keydown",(e)=>{if(e.key===key&&(e.metaKey||e.ctrlKey)){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:true,composed:true}))}})}}}define("contour-shortcut",ContourShortcut);class ContourPopover extends ContourBase{static get observed(){return["title","content"]}static get properties(){return{title:{attribute:"title"},content:{attribute:"content"}}}render(){this.classList.add("c-popover");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");if(!this.id)this.id=contourId("popover");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-popover__title",()=>{const el=document.createElement("div");el.className="c-popover__title";return el});t.textContent=title}const content=this.getAttribute("content");if(content){const c=this.ensure(".c-popover__body",()=>{const el=document.createElement("div");el.className="c-popover__body";return el});c.textContent=content}}}define("contour-popover",ContourPopover);class ContourDatePicker extends ContourBase{static get observed(){return["value","label"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"}}}render(){this.classList.add("c-date-picker");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-date-picker__label",()=>{const el=document.createElement("label");el.className="c-date-picker__label";return el});l.textContent=label}const input=this.ensure(".c-date-picker__input",()=>{const el=document.createElement("input");el.className="c-input c-date-picker__input";el.type="date";return el});input.value=this.getAttribute("value")||""}enhance(){if(this._wiredDatePicker)return;this._wiredDatePicker=true;this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.classList.contains("c-date-picker__input")){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:t.value}}))}})}}define("contour-date-picker",ContourDatePicker);class ContourRating extends ContourBase{static get observed(){return["value","max"]}static get properties(){return{value:{attribute:"value",type:Number},max:{attribute:"max",type:Number}}}render(){this.classList.add("c-rating");const max=parseInt(this.getAttribute("max")||"5",10)||5;const value=parseInt(this.getAttribute("value")||"0",10)||0;Array.from(this.querySelectorAll(".c-rating__star")).forEach((n)=>n.remove());for(let i=1;i<=max;i++){const star=document.createElement("button");star.className="c-rating__star"+(i<=value?" c-rating__star--filled":"");star.type="button";star.textContent="★";star.dataset.value=String(i);star.setAttribute("aria-label",i+" star"+(i>1?"s":""));this.appendChild(star)}}enhance(){if(this._wiredRating)return;this._wiredRating=true;this.addEventListener("click",(e)=>{const star=e.target&&e.target.closest?e.target.closest(".c-rating__star"):null;if(star&&this.contains(star)){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:parseInt(star.dataset.value,10)}}))}})}}define("contour-rating",ContourRating);class ContourTimePicker extends ContourBase{static get observed(){return["value","label"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"}}}render(){this.classList.add("c-time-picker");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-time-picker__label",()=>{const el=document.createElement("label");el.className="c-time-picker__label";return el});l.textContent=label}const input=this.ensure(".c-time-picker__input",()=>{const el=document.createElement("input");el.className="c-input c-time-picker__input";el.type="time";return el});input.value=this.getAttribute("value")||""}enhance(){if(this._wiredTimePicker)return;this._wiredTimePicker=true;this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.classList.contains("c-time-picker__input")){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:t.value}}))}})}}define("contour-time-picker",ContourTimePicker);class ContourColorPicker extends ContourBase{static get observed(){return["value","label"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"}}}render(){this.classList.add("c-color-picker");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-color-picker__label",()=>{const el=document.createElement("label");el.className="c-color-picker__label";return el});l.textContent=label}const input=this.ensure(".c-color-picker__input",()=>{const el=document.createElement("input");el.className="c-color-picker__input";el.type="color";return el});input.value=this.getAttribute("value")||"#000000"}enhance(){if(this._wiredColorPicker)return;this._wiredColorPicker=true;this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.classList.contains("c-color-picker__input")){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:t.value}}))}})}}define("contour-color-picker",ContourColorPicker);class ContourNumberField extends ContourBase{static get observed(){return["value","min","max","step","label"]}static get properties(){return{value:{attribute:"value"},min:{attribute:"min"},max:{attribute:"max"},step:{attribute:"step"},label:{attribute:"label"}}}render(){this.classList.add("c-number-field");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-number-field__label",()=>{const el=document.createElement("label");el.className="c-number-field__label";return el});l.textContent=label}const input=this.ensure(".c-number-field__input",()=>{const el=document.createElement("input");el.className="c-input c-number-field__input";el.type="number";return el});if(this.getAttribute("value")!==null)input.value=this.getAttribute("value");if(this.getAttribute("min")!==null)input.min=this.getAttribute("min");if(this.getAttribute("max")!==null)input.max=this.getAttribute("max");if(this.getAttribute("step")!==null)input.step=this.getAttribute("step")}enhance(){if(this._wiredNumberField)return;this._wiredNumberField=true;this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.classList.contains("c-number-field__input")){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:t.value}}))}})}}define("contour-number-field",ContourNumberField);class ContourHoverCard extends ContourBase{static get observed(){return["title","content","anchor"]}static get properties(){return{title:{attribute:"title"},content:{attribute:"content"},anchor:{attribute:"anchor"}}}render(){this.classList.add("c-hover-card");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");if(!this.id)this.id=contourId("hover-card");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-hover-card__title",()=>{const el=document.createElement("div");el.className="c-hover-card__title";return el});t.textContent=title}const content=this.getAttribute("content");if(content){const c=this.ensure(".c-hover-card__body",()=>{const el=document.createElement("div");el.className="c-hover-card__body";return el});c.textContent=content}}enhance(){if(this._wiredHoverCard)return;this._wiredHoverCard=true;const anchorSel=this.getAttribute("anchor");if(anchorSel){const trigger=anchorSel.startsWith("#")?document.getElementById(anchorSel.slice(1)):document.querySelector(anchorSel);if(trigger){trigger.setAttribute("popovertarget",this.id);let showTimer=null;trigger.addEventListener("mouseenter",()=>{showTimer=setTimeout(()=>{try{this.showPopover()}catch(e){}},300)});trigger.addEventListener("mouseleave",()=>{if(showTimer)clearTimeout(showTimer);try{this.hidePopover()}catch(e){}})}}}}define("contour-hover-card",ContourHoverCard);class ContourContextMenu extends ContourBase{static get observed(){return["items"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-context-menu");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");if(!this.id)this.id=contourId("context-menu");const items=this.getAttribute("items");if(items){try{const parsed=JSON.parse(items);this.innerHTML="";parsed.forEach((it)=>{const btn=document.createElement("button");btn.className="c-menu__item";btn.setAttribute("role","menuitem");btn.textContent=typeof it==="string"?it:(it.label||it.title||"");this.appendChild(btn)})}catch(e){}}}enhance(){if(this._wiredContextMenu)return;this._wiredContextMenu=true;this.addEventListener("contextmenu",(e)=>{e.preventDefault();try{this.showPopover()}catch(err){}});this.addEventListener("click",(e)=>{const item=e.target&&e.target.closest?e.target.closest(".c-menu__item"):null;if(item&&this.contains(item)){this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{label:item.textContent.trim()}}));try{this.hidePopover()}catch(err){}}})}}define("contour-context-menu",ContourContextMenu);class ContourFab extends ContourBase{static get observed(){return["label","icon"]}static get properties(){return{label:{attribute:"label"},icon:{attribute:"icon"}}}render(){this.classList.add("c-fab");const label=this.getAttribute("label");if(label)this.setAttribute("aria-label",label);const icon=this.getAttribute("icon");if(icon&&!this.hasChildNodes())this.textContent=icon}enhance(){if(this._wiredFab)return;this._wiredFab=true;this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:true,composed:true}))})}}define("contour-fab",ContourFab);class ContourFileUpload extends ContourBase{static get observed(){return["label","accept","multiple","progress"]}static get properties(){return{label:{attribute:"label"},accept:{attribute:"accept"},multiple:{attribute:"multiple",type:Boolean},progress:{attribute:"progress"}}}render(){this.classList.add("c-file-upload");const label=this.getAttribute("label")||"Drop files here or click to browse";const dz=this.ensure(".c-file-upload__dropzone",()=>{const el=document.createElement("div");el.className="c-file-upload__dropzone";el.setAttribute("role","button");el.tabIndex=0;return el});dz.textContent=label;const input=this.ensure(".c-file-upload__input",()=>{const el=document.createElement("input");el.className="c-file-upload__input";el.type="file";el.hidden=true;return el});input.accept=this.getAttribute("accept")||"";input.multiple=this.hasAttribute("multiple");const p=this.getAttribute("progress");if(p!==null){const bar=this.ensure(".c-file-upload__progress",()=>{const el=document.createElement("progress");el.className="c-file-upload__progress";return el});bar.value=Number(p)||0;bar.max=100}}enhance(){if(this._wiredFileUpload)return;this._wiredFileUpload=true;const dz=()=>this.querySelector(".c-file-upload__dropzone");const input=()=>this.querySelector(".c-file-upload__input");this.addEventListener("click",(e)=>{const d=dz();if(e.target===d||(d&&d.contains(e.target))){const i=input();if(i)i.click()}});this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.classList.contains("c-file-upload__input")){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{files:t.files}}))}});this.addEventListener("dragover",(e)=>{e.preventDefault();this.classList.add("is-dragover")});this.addEventListener("dragleave",()=>this.classList.remove("is-dragover"));this.addEventListener("drop",(e)=>{e.preventDefault();this.classList.remove("is-dragover");const i=input();if(i&&e.dataTransfer&&e.dataTransfer.files){i.files=e.dataTransfer.files;this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{files:e.dataTransfer.files}}))}})}}define("contour-file-upload",ContourFileUpload);class ContourNotificationCenter extends ContourBase{static get observed(){return["count","items"]}static get properties(){return{count:{attribute:"count"},items:{attribute:"items"}}}render(){this.classList.add("c-notification-center");const btn=this.ensure(".c-notification-center__trigger",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-notification-center__trigger";el.type="button";el.textContent="🔔";return el});const count=this.getAttribute("count");let badge=this.querySelector(".c-notification-center__badge");if(count&&Number(count)>0){if(!badge){badge=document.createElement("span");badge.className="c-notification-center__badge c-badge c-badge--dot";this.appendChild(badge)}badge.textContent=count}else if(badge){badge.remove()}const panel=this.ensure(".c-notification-center__panel",()=>{const el=document.createElement("div");el.className="c-notification-center__panel";el.hidden=true;return el});const items=this.getAttribute("items");if(items){try{const parsed=JSON.parse(items);panel.innerHTML="";parsed.forEach((it)=>{const row=document.createElement("div");row.className="c-notification-center__item";row.textContent=typeof it==="string"?it:(it.text||it.title||"");panel.appendChild(row)})}catch(e){}}}enhance(){if(this._wiredNotifCenter)return;this._wiredNotifCenter=true;this.addEventListener("click",(e)=>{const btn=this.querySelector(".c-notification-center__trigger");const panel=this.querySelector(".c-notification-center__panel");if(btn&&(e.target===btn||btn.contains(e.target))){if(panel){panel.hidden=!panel.hidden;btn.setAttribute("aria-expanded",String(!panel.hidden))}}});document.addEventListener("click",(e)=>{const panel=this.querySelector(".c-notification-center__panel");const btn=this.querySelector(".c-notification-center__trigger");if(panel&&!panel.hidden&&!this.contains(e.target)){panel.hidden=true;if(btn)btn.setAttribute("aria-expanded","false")}})}}define("contour-notification-center",ContourNotificationCenter);class ContourStepper extends ContourBase{static get observed(){return["steps","current"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current"}}}render(){this.classList.add("c-stepper");const steps=this.getAttribute("steps");const current=Number(this.getAttribute("current")||0);const list=this.ensure(".c-stepper__list",()=>{const el=document.createElement("ol");el.className="c-stepper__list";return el});list.innerHTML="";let parsed=[];try{parsed=steps?JSON.parse(steps):[]}catch(e){parsed=[]}parsed.forEach((s,i)=>{const li=document.createElement("li");li.className="c-stepper__step"+(i===current?" is-current":"")+(i<current?" is-done":"");li.textContent=typeof s==="string"?s:(s.title||s.label||"");list.appendChild(li)});const nav=this.ensure(".c-stepper__nav",()=>{const el=document.createElement("div");el.className="c-stepper__nav";return el});const prev=this.ensure(".c-stepper__prev",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-stepper__prev";el.type="button";el.textContent="Back";return el});const next=this.ensure(".c-stepper__next",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-stepper__next";el.type="button";el.textContent="Next";return el});if(!nav.contains(prev))nav.appendChild(prev);if(!nav.contains(next))nav.appendChild(next);if(nav.parentNode!==this)this.appendChild(nav)}enhance(){if(this._wiredStepper)return;this._wiredStepper=true;this.addEventListener("click",(e)=>{const prev=e.target&&e.target.closest?e.target.closest(".c-stepper__prev"):null;const next=e.target&&e.target.closest?e.target.closest(".c-stepper__next"):null;if(prev&&this.contains(prev))this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:true,composed:true,detail:{direction:"prev"}}));if(next&&this.contains(next))this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:true,composed:true,detail:{direction:"next"}}))})}}define("contour-stepper",ContourStepper);class ContourVirtualList extends ContourBase{static get observed(){return["items","item-height"]}static get properties(){return{items:{attribute:"items"},"item-height":{attribute:"item-height"}}}render(){this.classList.add("c-virtual-list");const scroller=this.ensure(".c-virtual-list__scroller",()=>{const el=document.createElement("div");el.className="c-virtual-list__scroller";return el});const items=this.getAttribute("items");let parsed=[];try{parsed=items?JSON.parse(items):[]}catch(e){parsed=[]}scroller.innerHTML="";parsed.forEach((it,i)=>{const row=document.createElement("div");row.className="c-virtual-list__item";row.textContent=typeof it==="string"?it:(it.label||it.text||JSON.stringify(it));row.dataset.index=String(i);scroller.appendChild(row)})}}define("contour-virtual-list",ContourVirtualList);class ContourCommandPalette extends ContourBase{static get observed(){return["open","items"]}static get properties(){return{open:{attribute:"open",type:Boolean},items:{attribute:"items"}}}render(){this.classList.add("c-command-palette");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");const search=this.ensure(".c-command-palette__search",()=>{const el=document.createElement("input");el.className="c-input c-command-palette__search";el.type="search";el.placeholder="Search…";return el});const list=this.ensure(".c-command-palette__list",()=>{const el=document.createElement("div");el.className="c-command-palette__list";el.setAttribute("role","listbox");return el});const items=this.getAttribute("items");if(items){try{const parsed=JSON.parse(items);list.innerHTML="";parsed.forEach((it,i)=>{const row=document.createElement("div");row.className="c-command-palette__item";row.setAttribute("role","option");row.textContent=typeof it==="string"?it:(it.label||it.title||"");row.dataset.index=String(i);list.appendChild(row)})}catch(e){}}}enhance(){if(this._wiredCmdPalette)return;this._wiredCmdPalette=true;this.addEventListener("keydown",(e)=>{const items=Array.from(this.querySelectorAll(".c-command-palette__item"));const active=this.querySelector(".c-command-palette__item.is-active");let idx=active?items.indexOf(active):-1;if(e.key==="ArrowDown"){e.preventDefault();idx=Math.min(items.length-1,idx+1)}else if(e.key==="ArrowUp"){e.preventDefault();idx=Math.max(0,idx-1)}else if(e.key==="Home"){e.preventDefault();idx=0}else if(e.key==="End"){e.preventDefault();idx=items.length-1}else if(e.key==="Enter"){e.preventDefault();if(active)this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{index:items.indexOf(active)}}));return}else return;items.forEach((it,i)=>it.classList.toggle("is-active",i===idx))})}}define("contour-command-palette",ContourCommandPalette);class ContourBadgeOverflow extends ContourBase{static get observed(){return["count","max"]}static get properties(){return{count:{attribute:"count"},max:{attribute:"max"}}}render(){this.classList.add("c-badge-overflow");const count=Number(this.getAttribute("count")||0);const max=Number(this.getAttribute("max")||3);const extra=Math.max(0,count-max);this.textContent="";if(extra>0){const b=document.createElement("span");b.className="c-badge c-badge-overflow__more";b.textContent="+"+extra;this.appendChild(b)}}}define("contour-badge-overflow",ContourBadgeOverflow);class ContourSideSheet extends ContourBase{static get observed(){return["open","side","title"]}static get properties(){return{open:{attribute:"open",type:Boolean},side:{attribute:"side"},title:{attribute:"title"}}}render(){this.classList.add("c-side-sheet");const side=this.getAttribute("side")||"end";this.classList.add("c-side-sheet--"+side);if(this.hasAttribute("open"))this.classList.add("is-open");else this.classList.remove("is-open");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-side-sheet__title",()=>{const el=document.createElement("div");el.className="c-side-sheet__title";return el});t.textContent=title}}}define("contour-side-sheet",ContourSideSheet);class ContourTour extends ContourBase{static get observed(){return["steps","current"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current"}}}render(){this.classList.add("c-tour");const steps=this.getAttribute("steps");const current=Number(this.getAttribute("current")||0);let parsed=[];try{parsed=steps?JSON.parse(steps):[]}catch(e){parsed=[]}const step=parsed[current]||{};const tip=this.ensure(".c-tour__tip",()=>{const el=document.createElement("div");el.className="c-tour__tip";return el});tip.textContent=typeof step==="string"?step:(step.text||step.title||"");const nav=this.ensure(".c-tour__nav",()=>{const el=document.createElement("div");el.className="c-tour__nav";return el});const next=this.ensure(".c-tour__next",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-tour__next";el.type="button";el.textContent="Next";return el});if(!nav.contains(next))nav.appendChild(next)}enhance(){if(this._wiredTour)return;this._wiredTour=true;this.addEventListener("click",(e)=>{const next=e.target&&e.target.closest?e.target.closest(".c-tour__next"):null;if(next&&this.contains(next))this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:true,composed:true,detail:{direction:"next"}}))})}}define("contour-tour",ContourTour);class ContourTagsInput extends ContourBase{static get observed(){return["value","placeholder"]}static get properties(){return{value:{attribute:"value"},placeholder:{attribute:"placeholder"}}}render(){this.classList.add("c-tags-input");const input=this.ensure(".c-tags-input__input",()=>{const el=document.createElement("input");el.className="c-input c-tags-input__input";el.type="text";return el});input.placeholder=this.getAttribute("placeholder")||"Add tag…";const tags=this.getAttribute("value");let parsed=[];try{parsed=tags?JSON.parse(tags):[]}catch(e){parsed=tags?tags.split(",").map((s)=>s.trim()).filter(Boolean):[]}Array.from(this.querySelectorAll(".c-tags-input__tag")).forEach((n)=>n.remove());parsed.forEach((t)=>{const chip=document.createElement("span");chip.className="c-tag c-tags-input__tag";chip.textContent=t;const rm=document.createElement("button");rm.className="c-tags-input__remove";rm.type="button";rm.textContent="×";rm.dataset.value=t;chip.appendChild(rm);this.insertBefore(chip,input)})}enhance(){if(this._wiredTagsInput)return;this._wiredTagsInput=true;this.addEventListener("keydown",(e)=>{const input=this.querySelector(".c-tags-input__input");if(e.key==="Enter"&&e.target===input){e.preventDefault();const v=input.value.trim();if(v){this.dispatchEvent(new CustomEvent("contour:add",{bubbles:true,composed:true,detail:{value:v}}));input.value=""}}});this.addEventListener("click",(e)=>{const rm=e.target&&e.target.closest?e.target.closest(".c-tags-input__remove"):null;if(rm&&this.contains(rm))this.dispatchEvent(new CustomEvent("contour:remove",{bubbles:true,composed:true,detail:{value:rm.dataset.value}}))})}}define("contour-tags-input",ContourTagsInput);class ContourSortableList extends ContourBase{static get observed(){return["items"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-sortable-list");const list=this.ensure(".c-sortable-list__list",()=>{const el=document.createElement("ul");el.className="c-sortable-list__list";return el});const items=this.getAttribute("items");let parsed=[];try{parsed=items?JSON.parse(items):[]}catch(e){parsed=[]}list.innerHTML="";parsed.forEach((it,i)=>{const li=document.createElement("li");li.className="c-sortable-list__item";li.setAttribute("draggable","true");li.dataset.index=String(i);const handle=document.createElement("span");handle.className="c-sortable-list__handle";handle.textContent="⋮⋮";handle.setAttribute("role","button");handle.tabIndex=0;li.appendChild(handle);const label=document.createElement("span");label.className="c-sortable-list__label";label.textContent=typeof it==="string"?it:(it.label||it.text||"");li.appendChild(label);list.appendChild(li)})}enhance(){if(this._wiredSortableList)return;this._wiredSortableList=true;this.addEventListener("keydown",(e)=>{const handle=e.target&&e.target.closest?e.target.closest(".c-sortable-list__handle"):null;if(!handle)return;const li=handle.closest(".c-sortable-list__item");if(!li)return;const list=this.querySelector(".c-sortable-list__list");if(e.key==="ArrowUp"&&li.previousElementSibling){e.preventDefault();list.insertBefore(li,li.previousElementSibling);this.dispatchEvent(new CustomEvent("contour:move",{bubbles:true,composed:true,detail:{direction:"up"}}))}if(e.key==="ArrowDown"&&li.nextElementSibling){e.preventDefault();list.insertBefore(li.nextElementSibling,li);this.dispatchEvent(new CustomEvent("contour:move",{bubbles:true,composed:true,detail:{direction:"down"}}))}})}}define("contour-sortable-list",ContourSortableList);class ContourSwatch extends ContourBase{static get observed(){return["color","selected","label"]}static get properties(){return{color:{attribute:"color"},selected:{attribute:"selected",type:Boolean},label:{attribute:"label"}}}render(){this.classList.add("c-swatch");const color=this.getAttribute("color")||"#000";this.style.setProperty("--swatch-color",color);if(this.hasAttribute("selected"))this.classList.add("is-selected");else this.classList.remove("is-selected");if(!this.hasAttribute("aria-label")){const label=this.getAttribute("label")||color;this.setAttribute("aria-label",label)}if(!this.querySelector("button")&&!this.querySelector("span")){const btn=document.createElement("button");btn.className="c-swatch__btn";btn.type="button";this.appendChild(btn)}}enhance(){if(this._wiredSwatch)return;this._wiredSwatch=true;this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{value:this.getAttribute("color")}}))})}}define("contour-swatch",ContourSwatch);class ContourCalendar extends ContourBase{static get observed(){return["value","month"]}static get properties(){return{value:{attribute:"value"},month:{attribute:"month"}}}render(){this.classList.add("c-calendar");const grid=this.ensure(".c-calendar__grid",()=>{const el=document.createElement("div");el.className="c-calendar__grid";el.setAttribute("role","grid");return el});grid.innerHTML="";const now=new Date();const year=now.getFullYear();const month=Number(this.getAttribute("month"))||now.getMonth();const first=new Date(year,month,1);const startDay=first.getDay();const daysInMonth=new Date(year,month+1,0).getDate();const selected=this.getAttribute("value");for(let i=0;i<startDay;i++){const empty=document.createElement("div");empty.className="c-calendar__day c-calendar__day--empty";grid.appendChild(empty)}for(let d=1;d<=daysInMonth;d++){const cell=document.createElement("button");cell.className="c-calendar__day";cell.type="button";cell.textContent=String(d);const iso=year+"-"+String(month+1).padStart(2,"0")+"-"+String(d).padStart(2,"0");if(iso===selected)cell.classList.add("is-selected");cell.dataset.value=iso;grid.appendChild(cell)}}enhance(){if(this._wiredCalendar)return;this._wiredCalendar=true;this.addEventListener("click",(e)=>{const cell=e.target&&e.target.closest?e.target.closest(".c-calendar__day"):null;if(cell&&this.contains(cell)&&cell.dataset.value){this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{value:cell.dataset.value}}))}})}}define("contour-calendar",ContourCalendar);class ContourCarousel extends ContourBase{static get observed(){return["items","index"]}static get properties(){return{items:{attribute:"items"},index:{attribute:"index"}}}render(){this.classList.add("c-carousel");const track=this.ensure(".c-carousel__track",()=>{const el=document.createElement("div");el.className="c-carousel__track";return el});const items=this.getAttribute("items");let parsed=[];try{parsed=items?JSON.parse(items):[]}catch(e){parsed=[]}track.innerHTML="";parsed.forEach((it,i)=>{const slide=document.createElement("div");slide.className="c-carousel__slide";slide.textContent=typeof it==="string"?it:(it.label||it.text||"");slide.dataset.index=String(i);track.appendChild(slide)});const prev=this.ensure(".c-carousel__prev",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-carousel__prev";el.type="button";el.textContent="‹";return el});const next=this.ensure(".c-carousel__next",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-carousel__next";el.type="button";el.textContent="›";return el})}enhance(){if(this._wiredCarousel)return;this._wiredCarousel=true;this.addEventListener("click",(e)=>{const prev=e.target&&e.target.closest?e.target.closest(".c-carousel__prev"):null;const next=e.target&&e.target.closest?e.target.closest(".c-carousel__next"):null;if(prev&&this.contains(prev))this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{direction:"prev"}}));if(next&&this.contains(next))this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{direction:"next"}}))})}}define("contour-carousel",ContourCarousel);class ContourDataGrid extends ContourBase{static get observed(){return["columns","rows","page"]}static get properties(){return{columns:{attribute:"columns"},rows:{attribute:"rows"},page:{attribute:"page"}}}render(){this.classList.add("c-data-grid");const table=this.ensure(".c-data-grid__table",()=>{const el=document.createElement("table");el.className="c-table c-data-grid__table";return el});const thead=this.ensure("thead",()=>{const el=document.createElement("thead");return el});const tbody=this.ensure("tbody",()=>{const el=document.createElement("tbody");return el});if(thead.parentNode!==table)table.appendChild(thead);if(tbody.parentNode!==table)table.appendChild(tbody);const cols=this.getAttribute("columns");let parsedCols=[];try{parsedCols=cols?JSON.parse(cols):[]}catch(e){parsedCols=[]}if(parsedCols.length&&!thead.querySelector("tr")){const tr=document.createElement("tr");parsedCols.forEach((c)=>{const th=document.createElement("th");th.textContent=typeof c==="string"?c:(c.label||c.key||"");tr.appendChild(th)});thead.appendChild(tr)}const rows=this.getAttribute("rows");let parsedRows=[];try{parsedRows=rows?JSON.parse(rows):[]}catch(e){parsedRows=[]}tbody.innerHTML="";parsedRows.forEach((r)=>{const tr=document.createElement("tr");parsedCols.forEach((c)=>{const key=typeof c==="string"?c:(c.key||c.label||"");const td=document.createElement("td");td.textContent=r&&r[key]!=null?r[key]:"";tr.appendChild(td)});tbody.appendChild(tr)});if(table.parentNode!==this)this.appendChild(table)}}define("contour-data-grid",ContourDataGrid);class ContourTreeGrid extends ContourBase{static get observed(){return["items"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-tree-grid");const table=this.ensure(".c-tree-grid__table",()=>{const el=document.createElement("table");el.className="c-table c-tree-grid__table";return el});const tbody=this.ensure("tbody",()=>{const el=document.createElement("tbody");return el});if(tbody.parentNode!==table)table.appendChild(tbody);const items=this.getAttribute("items");let parsed=[];try{parsed=items?JSON.parse(items):[]}catch(e){parsed=[]}tbody.innerHTML="";const renderNode=(node,depth)=>{const tr=document.createElement("tr");const td=document.createElement("td");td.style.paddingInlineStart=(depth*1.25)+"rem";td.textContent=(node&&(node.label||node.text||node.name))||"";tr.appendChild(td);tbody.appendChild(tr);if(node&&Array.isArray(node.children))node.children.forEach((c)=>renderNode(c,depth+1))};parsed.forEach((n)=>renderNode(n,0));if(table.parentNode!==this)this.appendChild(table)}}define("contour-tree-grid",ContourTreeGrid);for(const block of CLASS_ONLY){define("contour-"+block,simple(["c-"+block]))}let ADOPTED=null;let ADOPTED_KEY="";const adoptedSheets=()=>{let key=document.styleSheets.length+":";for(const sheet of document.styleSheets){let rules=-1;try{rules=sheet.cssRules.length}catch(e){}key+=(sheet.href||"")+"~"+rules+"|"}if(ADOPTED&&key===ADOPTED_KEY)return ADOPTED;ADOPTED_KEY=key;ADOPTED=[];for(const sheet of document.styleSheets){try{if(sheet.href&&new URL(sheet.href).origin===location.origin){const built=new CSSStyleSheet();built.replaceSync(Array.from(sheet.cssRules,(r)=>r.cssText).join("\n"));ADOPTED.push(built)}}catch(e){}}return ADOPTED};class ContourShadow extends HTMLElement{static get observedAttributes(){return MODS}constructor(){super();const root=this.attachShadow({mode:"open"});const sheets=adoptedSheets();if(sheets.length)root.adoptedStyleSheets=sheets;root.appendChild(this.constructor.contourTemplate.content.cloneNode(true));this._shadowBase=root.firstElementChild?root.firstElementChild.className:""}enhance(root){if(!root)root=this.shadowRoot;if(!root)return;root.querySelectorAll("details").forEach((d)=>{const summary=d.querySelector("summary");if(summary&&!summary.hasAttribute("aria-expanded")){summary.setAttribute("aria-expanded",String(d.open));d.addEventListener("toggle",()=>{summary.setAttribute("aria-expanded",String(d.open))})}});root.querySelectorAll("[data-live]").forEach((el)=>{if(!el.hasAttribute("role"))el.setAttribute("role","status");if(!el.hasAttribute("aria-live"))el.setAttribute("aria-live","polite")});root.querySelectorAll(".c-spinner").forEach((el)=>{if(!el.hasAttribute("role"))el.setAttribute("role","status");if(!el.hasAttribute("aria-live"))el.setAttribute("aria-live","polite")});root.querySelectorAll(".c-toast, .c-toast-host").forEach((el)=>{if(!el.hasAttribute("role"))el.setAttribute("role","status");if(!el.hasAttribute("aria-live"))el.setAttribute("aria-live","polite");if(!el.hasAttribute("aria-atomic"))el.setAttribute("aria-atomic","true")});root.querySelectorAll("[role='tab']").forEach((tab)=>{const ctrl=tab.getAttribute("aria-controls");if(ctrl){const panel=root.querySelector("#"+CSS.escape(ctrl))||document.getElementById(ctrl);if(panel&&!panel.hasAttribute("aria-labelledby")){if(!tab.id)tab.id=contourId("tab");panel.setAttribute("aria-labelledby",tab.id)}}});root.querySelectorAll("input, textarea, select").forEach((input)=>{if(input.hasAttribute("aria-describedby"))return;const field=input.closest(".c-field");if(field){const hint=field.querySelector(".c-field__hint");if(hint){if(!hint.id)hint.id=contourId("hint");input.setAttribute("aria-describedby",hint.id)}const err=field.querySelector(".c-field__error");if(err){if(!err.id)err.id=contourId("err");const existing=input.getAttribute("aria-describedby")||"";input.setAttribute("aria-describedby",(existing+" "+err.id).trim())}}});root.querySelectorAll(".c-alert").forEach((el)=>{if(!el.hasAttribute("role"))el.setAttribute("role","alert");if(!el.hasAttribute("aria-live"))el.setAttribute("aria-live","assertive")});root.querySelectorAll("input[required], textarea[required], select[required]").forEach((el)=>{if(!el.hasAttribute("aria-required"))el.setAttribute("aria-required","true")})}connectedCallback(){this.applyMods();try{this.enhance(this.shadowRoot)}catch(e){}try{wcReset(this);wireTabs(this);wireSegmented(this);wireCombobox(this);wireTree(this);wireMenu(this);wirePagination(this);wireCopy(this);wireRemovable(this)}catch(e){}if(this.shadowRoot&&!this._wiredSlotchange){this._wiredSlotchange=true;this.shadowRoot.addEventListener("slotchange",()=>{try{this.enhance(this.shadowRoot);wireTabs(this);wireSegmented(this);wireCombobox(this);wireTree(this);wireMenu(this);wirePagination(this);wireCopy(this);wireRemovable(this)}catch(e){}})}}attributeChangedCallback(){this.applyMods()}applyMods(){const el=this.shadowRoot.firstElementChild;if(!el||!this._shadowBase)return;const mods=[];for(const attr of MODS){const val=this.getAttribute(attr);if(!val)continue;for(const cls of this._shadowBase.split(/\s+/)){if(cls)mods.push("c-"+cls.replace(/^c-/,"")+"--"+val)}}el.className=(this._shadowBase+" "+mods.join(" ")).trim()}}const shadow=(name,markup)=>{const tpl=document.createElement("template");tpl.innerHTML=markup;const cls=class extends ContourShadow{};cls.contourTemplate=tpl;define(name,cls)};const slotWrapper=(tag,block,part)=>"<"+tag+' class="c-'+block+'" part="'+(part||block)+'"'+(tag==="button"?' type="button"':"")+"><slot></slot></"+tag+">";const SHADOW_SLOTS={div:["accordion","activity","advanced","affordance","affordances","anchor","app","app-body","box","btn-group","chart-grid","catchment","cluster","command","compare","comparison","compass","contour-plot","cta","dash-freshness","dash-kpi-row","dash-shell","dash-toolbar","datamark","delta","draggable","drag-handle","drop-indicator","drop-zone","destructive-hint","docs-shell","drawer","elevation","filter-bar","flow-map","heatmap","hexbin","icon-badge","input-group","instrument","range-scale","resizable","table-wrap","time-range","toast-host","scroll-area","isochrone","landing-features","landing-hero","layer-panel","layer-switch","legend","logos","map-area","map-footer","map-panel","map-slot","measure","metrics","minimap","pager","pagination","panel","plate","price","pricing","progress","prose","pullquote","radio-list","range","readout","recipe","reserved","resize-handle","row","row-action","scale-bar","scrim","segmented","sheet","shortcut-list","shortcut-overlay","shortcut-panel","shortcut-row","showcase","sidebar","skeleton","sparkline","stack","steps","streaming-chart","survey","theme-scope","time-slider","timeline","toast","toolbar","tooltip","tree","version","version-banner"],button:["btn","pressable","scheme-toggle"],span:["avatar","badge","chip","dot","flag","live-badge","mark","pill"],a:["link","linkish"],kbd:["kbd"],label:["check","radio","switch"],select:["select"],nav:["docs-nav"],};const SHADOW_PARTS={"version-banner":"banner","contour-plot":"plot",};for(const[tag,blocks]of Object.entries(SHADOW_SLOTS)){for(const block of blocks){const part=SHADOW_PARTS[block]||block;shadow("contour-shadow-"+block,slotWrapper(tag,block,part))}}shadow("contour-shadow-callout",`<div class="c-callout" part="callout"><div class="c-callout__title" part="title"><slot name="title"></slot></div><div class="c-callout__body" part="body"><slot></slot></div><button class="c-callout__close" part="close" type="button" aria-label="Close">×</button></div>`);shadow("contour-shadow-empty",`<div class="c-empty" part="empty"><div class="c-empty__illustration" part="illustration"><slot name="illustration"></slot></div><div class="c-empty__title" part="title"><slot name="title"></slot></div><div class="c-empty__text" part="body"><slot></slot></div><div><slot name="action"></slot></div></div>`);shadow("contour-shadow-feature",`<div class="c-feature" part="feature"><span class="c-feature__index" part="index"><slot name="index"></slot></span><div class="c-feature__title" part="title"><slot name="title"></slot></div><div class="c-feature__body" part="body"><slot></slot></div></div>`);shadow("contour-shadow-kpi",`<div class="c-kpi" part="kpi"><div class="c-kpi__value" part="value"><slot name="value"></slot></div><div class="c-kpi__label" part="label"><slot name="label"></slot></div><div class="c-kpi__foot" part="foot"><slot name="delta"></slot><slot name="note"></slot></div></div>`);shadow("contour-shadow-stat",`<div class="c-stat" part="stat"><div class="c-stat__value" part="value"><slot name="value"></slot></div><div class="c-stat__label" part="label"><slot name="label"></slot></div><div class="c-stat__delta" part="delta"><slot name="delta"></slot></div></div>`);shadow("contour-shadow-meter",`<div class="c-meter" part="meter"><span class="c-meter__core" part="core"><span class="c-meter__value" part="value"><slot name="value"></slot></span><span class="c-meter__label" part="label"><slot name="label"></slot></span></span></div>`);shadow("contour-shadow-diff",`<div class="c-diff" part="diff"><div class="c-diff__line c-diff__line--del" part="before"><span class="c-diff__sign">−</span><span><slot name="before"></slot></span></div><div class="c-diff__line c-diff__line--add" part="after"><span class="c-diff__sign">+</span><span><slot name="after"></slot></span></div></div>`);shadow("contour-shadow-do-dont",`<div class="c-do-dont" part="do-dont"><div class="c-do-dont__item c-do-dont__item--do" part="do"><slot name="do"></slot></div><div class="c-do-dont__item c-do-dont__item--dont" part="dont"><slot name="dont"></slot></div></div>`);shadow("contour-shadow-threshold",`<div class="c-threshold" part="threshold"><span class="c-threshold__fill" part="value"></span><span class="c-threshold__target" part="target"></span></div>`);shadow("contour-shadow-coordinate",`<div class="c-coordinate" part="coordinate"><span class="c-coordinate__value" part="value"><slot name="value"></slot></span></div>`);shadow("contour-shadow-install",`<div class="c-install" part="install"><span class="c-install__prompt" part="prompt"><slot name="prompt"></slot></span><span class="c-install__command" part="command"><slot name="command"></slot></span><button class="c-btn c-btn--ghost c-btn--sm c-install__copy" part="copy" type="button" aria-label="Copy command">Copy</button></div>`);shadow("contour-shadow-toc",`<div class="c-toc" part="toc"><div class="c-toc__title" part="title"><slot name="title"></slot></div><nav class="c-toc__list" part="list"><slot></slot></nav></div>`);shadow("contour-shadow-testimonial",`<div class="c-testimonial" part="testimonial"><blockquote class="c-testimonial__quote" part="quote"><slot name="quote"></slot></blockquote><div class="c-testimonial__byline" part="byline"><span class="c-testimonial__name" part="name"><slot name="name"></slot></span><span class="c-testimonial__role" part="role"><slot name="role"></slot></span></div></div>`);shadow("contour-shadow-search-trigger",`<button class="c-search-trigger" part="trigger"><span><slot name="label"></slot></span><kbd class="c-search-trigger__kbd"><slot name="shortcut"></slot></kbd></button>`);shadow("contour-shadow-brand",`<a class="c-brand" part="brand"><span class="c-mark" part="mark"><slot name="mark"></slot></span><span class="c-brand__name" part="name"><slot name="name"></slot></span></a>`);shadow("contour-shadow-section-head",`<div class="c-section-head" part="head"><h2 class="c-section-head__title" part="title"><slot name="title"></slot></h2><p class="c-section-head__desc" part="desc"><slot name="desc"></slot></p></div>`);shadow("contour-shadow-loading",`<div class="c-loading" part="loading"><span class="c-spinner" part="spinner"></span><slot></slot></div>`);shadow("contour-shadow-tabs",`<div class="c-tabs" part="tabs"><div class="c-tabs__list" part="list" role="tablist"><slot name="tabs"></slot></div><div class="c-tabs__panels" role="presentation"><slot></slot></div></div>`);shadow("contour-shadow-breadcrumb",`<nav class="c-breadcrumb" part="breadcrumb" aria-label="Breadcrumb"><ol><slot></slot></ol></nav>`);shadow("contour-shadow-menu",`<div class="c-menu" part="menu" role="menu"><slot></slot></div>`);shadow("contour-shadow-combobox",`<div class="c-combobox" part="combobox"><input class="c-combobox__input" part="input" type="text" /><ul class="c-combobox__list" part="list" hidden><slot></slot></ul></div>`);shadow("contour-shadow-table",`<div class="c-table-wrap" part="wrap"><table class="c-table" part="table"><thead><slot name="head"></slot></thead><tbody><slot></slot></tbody></table></div>`);shadow("contour-shadow-chart",`<div class="c-chart" part="chart"><div class="c-chart__plot" part="plot"><slot></slot></div></div>`);shadow("contour-shadow-bivariate",`<div class="c-bivariate" part="bivariate"><div class="c-bivariate__matrix" part="matrix"><slot></slot></div></div>`);shadow("contour-shadow-expandable",`<details class="c-expandable" part="expandable"><summary class="c-expandable__summary"><slot name="summary"></slot></summary><div class="c-expandable__body" part="body"><slot></slot></div></details>`);shadow("contour-shadow-disclosure",`<details class="c-disclosure" part="disclosure"><summary><slot name="summary"></slot></summary><div class="c-disclosure__body" part="body"><slot></slot></div></details>`);shadow("contour-shadow-faq",`<div class="c-faq" part="faq"><div class="c-faq__question" part="question"><slot name="question"></slot></div><div class="c-faq__answer" part="answer"><slot name="answer"></slot></div></div>`);shadow("contour-shadow-code-tabs",`<div class="c-code-tabs" part="code-tabs"><div class="c-code-tabs__list" part="list" role="tablist"><slot name="tabs"></slot></div><div class="c-code-tabs__panels"><slot></slot></div></div>`);shadow("contour-shadow-header",`<header class="c-header" part="header"><div class="container c-header__inner" part="inner"><a class="c-brand" part="brand"><slot name="brand"></slot></a><nav class="c-header__nav" part="nav"><slot name="nav"></slot></nav><div class="c-header__actions" part="actions"><slot name="actions"></slot></div></div></header>`);shadow("contour-shadow-footer",`<footer class="c-footer" part="footer"><div class="container c-footer__grid" part="grid"><div class="c-footer__brand" part="brand"><slot name="brand"></slot></div><div class="c-footer__links" part="links"><slot name="links"></slot></div></div></footer>`);shadow("contour-shadow-container",`<div class="container" part="container"><slot></slot></div>`);shadow("contour-shadow-input",`<input class="c-input" part="input" />`);shadow("contour-shadow-spinner",`<span class="c-spinner" part="spinner" aria-label="Loading"></span>`);shadow("contour-shadow-textarea",`<textarea class="c-textarea" part="textarea"></textarea>`);shadow("contour-shadow-code",`<pre class="c-code" part="code"><code><slot></slot></code><button class="c-code__copy" part="copy" type="button">Copy</button></pre>`);shadow("contour-shadow-card",`<div class="c-card" part="card"> <div class="c-card__title" part="head"><slot name="title">Untitled</slot></div> <div class="c-card__body" part="body"><slot></slot></div> <div class="c-card__foot" part="foot"><slot name="foot"></slot></div> </div>`);shadow("contour-shadow-field",`<div class="c-field" part="field"> <label class="c-field__label" part="label"><slot name="label">Label</slot></label> <slot name="input"></slot> <span class="c-field__hint" part="hint"><slot name="hint"></slot></span> </div>`);shadow("contour-shadow-alert",`<div class="c-alert" part="alert"> <div class="c-alert__title" part="title"><slot name="title"></slot></div> <div class="c-alert__body" part="body"><slot></slot></div> <div class="c-alert__actions" part="actions"><slot name="action"></slot></div> <button class="c-alert__close" part="close" type="button" aria-label="Close">×</button> </div>`);shadow("contour-shadow-tag",`<span class="c-tag" part="tag"><slot></slot><button class="c-tag__remove" part="remove" type="button" aria-label="Remove">×</button></span>`);shadow("contour-shadow-filter-pill",`<span class="c-filter-pill" part="filter-pill"><slot></slot><button class="c-filter-pill__remove" part="remove" type="button" aria-label="Remove filter">×</button></span>`);class ContourShadowDialog extends ContourShadow{static contourTemplate=(()=>{const tpl=document.createElement("template");tpl.innerHTML="<dialog class=\"c-dialog\" part=\"dialog\"> <div class=\"c-dialog__head\" part=\"head\"> <slot name=\"title\"></slot> <button class=\"c-btn c-btn--icon c-btn--ghost\" part=\"close\" type=\"button\" aria-label=\"Close\"> <svg aria-hidden=\"true\"><use href=\"#i-close\" /></svg> </button> </div> <div class=\"c-dialog__body\" part=\"body\"><slot></slot></div> <div class=\"c-dialog__foot\" part=\"foot\"><slot name=\"foot\"></slot></div> </dialog>";return tpl})();enhance(root){super.enhance(root);if(this._wiredShadowDialog)return;this._wiredShadowDialog=true;const dlg=root.querySelector("dialog");const close=root.querySelector('[part="close"]');if(close)close.addEventListener("click",()=>dlg?.close());if(dlg){let lastFocus=null;dlg.addEventListener("beforetoggle",(e)=>{if(e.newState==="open"){lastFocus=document.activeElement;this.dispatchEvent(new CustomEvent("contour:open",{bubbles:true,composed:true}));const focusable=dlg.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(focusable)try{focusable.focus()}catch(e){}}else if(e.newState==="closed"){this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));if(lastFocus&&typeof lastFocus.focus==="function"){try{lastFocus.focus()}catch(e){}}}});dlg.addEventListener("keydown",(e)=>{if(e.key!=="Tab")return;const focusables=Array.from(dlg.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])"));if(!focusables.length)return;const first=focusables[0];const last=focusables[focusables.length-1];if(e.shiftKey&&document.activeElement===first){e.preventDefault();last.focus()}else if(!e.shiftKey&&document.activeElement===last){e.preventDefault();first.focus()}})}}show(){this.shadowRoot?.querySelector("dialog")?.showModal()}close(){this.shadowRoot?.querySelector("dialog")?.close()}}define("contour-shadow-dialog",ContourShadowDialog);window.ContourElements=Object.freeze(REGISTERED.slice());window.ContourEvents=Object.freeze(CONTOUR_EVENTS);
1
+ "use strict";export const REGISTERED=[];const DISPOSERS=new WeakMap();export const onDispose=(host,fn)=>{let list=DISPOSERS.get(host);if(!list){list=[];DISPOSERS.set(host,list)}list.push(fn)};const runDisposers=(host)=>{const list=DISPOSERS.get(host);if(!list)return;DISPOSERS.delete(host);for(const fn of list){try{fn()}catch(e){}}};let _contourIdCounter=0;export const contourId=(prefix)=>prefix+"-"+(++_contourIdCounter).toString(36);export const define=(name,cls)=>{if(customElements.get(name))return;customElements.define(name,cls);REGISTERED.push(name)};export const MODS=["variant","size","color"];export const CONTOUR_EVENTS=Object.freeze({"contour:activate":{payload:[],composed:true},"contour:add":{payload:["value"],composed:true},"contour:activity-select":{payload:["index","text"],composed:true},"contour:break-change":{payload:["value"],composed:true},"contour:style-resolved":{payload:["value"],composed:true},"contour:advanced-toggle":{payload:["title"],composed:true},"contour:affordance-activate":{payload:["name"],composed:true},"contour:bearing":{payload:["direction","degrees"],composed:true},"contour:btn-group-change":{payload:["index","label"],composed:true},"contour:brush-start":{payload:["value"],composed:true},"contour:brush-end":{payload:["value"],composed:true},"contour:change":{payload:["name","value","checked"],composed:true},"contour:close":{payload:[],composed:true},"contour:copy":{payload:["text"],composed:true},"contour:dash-action":{payload:["label"],composed:true},"contour:diff-activate":{payload:["kind","text"],composed:true},"contour:drag":{payload:["value"],composed:true},"contour:do-dont-activate":{payload:["kind","text"],composed:true},"contour:docs-nav-select":{payload:["label","href"],composed:true},"contour:dragend":{payload:["value"],composed:true},"contour:dragstart":{payload:["value"],composed:true},"contour:drop":{payload:["value","label"],composed:true},"contour:empty-action":{payload:["state"],composed:true},"contour:error":{payload:["src","message","name","status"],composed:true},"contour:hide":{payload:[],composed:true},"contour:input":{payload:["name","value","checked"],composed:true},"contour:layer-opacity":{payload:["name","opacity"],composed:true},"contour:layer-rename":{payload:["name","newName"],composed:true},"contour:layer-duplicate":{payload:["name"],composed:true},"contour:layer-zoom":{payload:["name"],composed:true},"contour:layer-projection":{payload:["name","projection"],composed:true},"contour:layer-toggle":{payload:["name"],composed:true},"contour:layer-visibility":{payload:["name","visible"],composed:true},"contour:legend-toggle":{payload:["label","key","layers","pressed"],composed:true},"contour:load":{payload:["src","count"],composed:true},"contour:map-control":{payload:["control"],composed:true},"contour:map-attach":{payload:[],composed:true},"contour:map-detach":{payload:[],composed:true},"contour:move":{payload:["direction"],composed:true},"contour:open":{payload:[],composed:true},"contour:page":{payload:["page"],composed:true},"contour:ready":{payload:["version","count"],composed:true},"contour:remove":{payload:["label","key","layers","value"],composed:true},"contour:range-change":{payload:["value"],composed:true},"contour:retry":{payload:["src"],composed:true},"contour:select":{payload:["series","index","label","value"],composed:true},"contour:showcase-activate":{payload:["title"],composed:true},"contour:step-activate":{payload:["index","title"],composed:true},"contour:step-change":{payload:["index","title"],composed:true},"contour:show":{payload:[],composed:true},"contour:sort":{payload:["column","direction"],composed:true},"contour:stream-state":{payload:["running"],composed:true},"contour:tab-change":{payload:["index","label"],composed:true},"contour:theme-change":{payload:["theme"],composed:true},"contour:tick":{payload:["frame"],composed:true},"contour:time-change":{payload:["value"],composed:true},"contour:time-range-change":{payload:["value"],composed:true},"contour:toggle":{payload:["open","label"],composed:true},"contour:view-enter":{payload:[],composed:true},"contour:view-leave":{payload:[],composed:true},});export function sanitizeHtml(input){const str=String(input==null?"":input);if(typeof DOMParser==="undefined")return str;const doc=new DOMParser().parseFromString(str,"text/html");const drop=new Set(["script","iframe","object","embed","style","link","meta","base","form","input","button"]);const walk=(node)=>{const children=Array.from(node.childNodes);for(const c of children){if(c.nodeType===1){const tag=c.tagName.toLowerCase();if(drop.has(tag)){c.remove();continue}for(const attr of Array.from(c.attributes)){const name=attr.name.toLowerCase();if(name.startsWith("on")){c.removeAttribute(attr.name);continue}const val=String(attr.value||"").trim().toLowerCase();if((name==="href"||name==="src"||name==="xlink:href")&&(val.startsWith("javascript:")||val.startsWith("data:text/html"))){c.removeAttribute(attr.name)}}walk(c)}}};walk(doc.body);return doc.body.innerHTML}export const OBSERVED=["accept","action","actions","after","anchor","answer","area","article","attribution","attribution-mark","autoplay","axis","axis-x","axis-y","brownout","brownout-level","before","body","brand","breakpoint","cache-key","canvas","center","clearable","cols","columns","color","command","cells","checked","chrome","closable","colors","content","controls","copyable","count","current","data","date","delta","description","glyphs","demo","density","desc","dir","direction","disabled","dismissible","divider","do","dont","dot","empty","error","exclusive","format","heading","hint","href","icon","illustration","index","instrument","interval","items","key","layers","level","label","lazy","lede","legend","line","link","links","live","loading","locale","loop","max","media","message","method","month","menu","min","multiple","name","needle","next","no","no-cache","no-data-message","nodes","note","norm","normalize","options","orientation","page-size","pages","pause","paused","pausable","persist","placeholder","playing","point","points","prev","progress","prompt","question","recent","required","quote","ramp","refresh","removable","reverse","rings","retry","rows","scale","selectable","segments","show-header","sparkline","start","end","threshold","thresholds","selected","separator","series","shortcut","side","size","skeleton","sort","sort-dir","speed","status","step","submit","timeout","trigger","virtual","state","steps","subtitle","summary","src","tabs","tag","text","ticks","title","type","unit","variant","values","viewport","yes","zoomable","x","y",];export function headingTag(host,fallback="h3"){const v=host&&host.getAttribute?host.getAttribute("heading"):null;return/^h[1-6]$/.test(v||"")?v:fallback}export class ContourBase extends HTMLElement{static formAssociated=false;constructor(){super();if(this.constructor.formAssociated&&typeof this.attachInternals==="function"){this._internals=this.attachInternals()}}static get observed(){return OBSERVED}static get observedAttributes(){return this.observed}static get properties(){return{}}get renderCount(){return this._contourRenderCount||0}_countRender(){this._contourRenderCount=(this._contourRenderCount||0)+1}static _propsInstalled=false;_installProperties(){const ctor=this.constructor;if(ctor._propsInstalled)return;ctor._propsInstalled=true;const props=ctor.properties||{};for(const[name,spec]of Object.entries(props)){const attr=(spec&&spec.attribute)||name;const type=(spec&&spec.type)||String;Object.defineProperty(ctor.prototype,name,{get(){const raw=this.getAttribute(attr);if(raw===null)return spec&&spec.default!==undefined?spec.default:null;if(type===Boolean)return true;if(type===Number){const n=Number(raw);return Number.isNaN(n)?null:n}return raw},set(v){if(v===null||v===undefined||v===false)this.removeAttribute(attr);else if(type===Boolean){if(v)this.setAttribute(attr,"");else this.removeAttribute(attr)}else this.setAttribute(attr,String(v))},configurable:true,})}}connectedCallback(){if(this._contourAuthored){this._wireFormData();return}this._installProperties();this._contourAuthored={nodes:Array.from(this.childNodes),cls:this.getAttribute("class"),};const before=Array.from(this.childNodes);this._contourRenderGen=(this._contourRenderGen||0)+1;this._ensureCache=new Map();this._ensureCacheGen=this._contourRenderGen;this._countRender();try{this.render()}catch(e){console.error("Contour render error:",e);this.textContent="Component failed to render."}this._contourGenerated=Array.from(this.childNodes).filter((n)=>!before.includes(n));this._applyParts(this);this._applyDensity();this.enhance();this._detachInnerFormControls();this._wireFormData()}attributeChangedCallback(name,oldValue,newValue){if(oldValue===newValue)return;if(!this.isConnected||!this._contourAuthored)return;if(this._batchDepth>0){this._batchDirty=true;return}if(this._contourRendering){if(!this._pendingRerender){this._pendingRerender=true;queueMicrotask(()=>{this._pendingRerender=false;if(!this.isConnected||!this._contourAuthored)return;this.attributeChangedCallback("__rerender__",null,"")})}return}if(name==="checked")this._checkedAttrChanged=true;this._contourRendering=true;try{const savedControls=Array.from(this.querySelectorAll("input, textarea, select"));const savedValues=savedControls.map((el)=>({key:el.name||el.id||null,value:el.value,checked:el.checked,type:el.type}));const hadFocus=this.contains(document.activeElement)?document.activeElement:null;const _focusableSelector="button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])";const _focusablesBefore=Array.from(this.querySelectorAll(_focusableSelector));const hadFocusIndex=hadFocus?_focusablesBefore.indexOf(hadFocus):-1;const hadFocusName=hadFocus?(hadFocus.getAttribute("name")||null):null;const savedScrolls=Array.from(this.querySelectorAll("*")).filter((el)=>el.scrollHeight>el.clientHeight||el.scrollWidth>el.clientWidth).map((el)=>({el,top:el.scrollTop,left:el.scrollLeft}));const savedDetails=Array.from(this.querySelectorAll("details")).map((d)=>({id:d.id||null,open:d.open}));for(const g of(this._contourGenerated||[])){if(!g||g.parentNode!==this)continue;let wrapper=null;if(g.classList&&(g.classList.contains("c-panel__body")||g.classList.contains("c-dialog__body")))wrapper=g;else if(g.tagName==="PRE")wrapper=g.querySelector("code")||g;if(wrapper){while(wrapper.firstChild)this.insertBefore(wrapper.firstChild,g)}}for(const g of(this._contourGenerated||[])){if(g.parentNode===this)this.removeChild(g)}const generated=new Set(this._contourGenerated||[]);const authoredNow=Array.from(this.childNodes).filter((n)=>!generated.has(n));this._contourAuthored.nodes=authoredNow;while(this.firstChild)this.removeChild(this.firstChild);for(const node of this._contourAuthored.nodes)this.appendChild(node);if(this._contourAuthored.cls===null)this.removeAttribute("class");else this.setAttribute("class",this._contourAuthored.cls);const before=Array.from(this.childNodes);this._contourRenderGen=(this._contourRenderGen||0)+1;this._ensureCache=new Map();this._ensureCacheGen=this._contourRenderGen;this._countRender();try{this.render()}catch(e){console.error("Contour render error:",e);this.textContent="Component failed to render."}this._contourGenerated=Array.from(this.childNodes).filter((n)=>!before.includes(n));this._applyParts(this);this._applyDensity();const newControls=Array.from(this.querySelectorAll("input, textarea, select"));const keyed=savedValues.filter((sv)=>sv.key);const unkeyed=savedValues.filter((sv)=>!sv.key);const used=new Set();for(const el of newControls){const key=el.name||el.id||null;if(!key)continue;const match=keyed.find((sv)=>sv.key===key&&!used.has(sv));if(!match)continue;used.add(match);if(el.value===""&&el.getAttribute("value")===null){el.value=match.value}if((el.type==="checkbox"||el.type==="radio")&&typeof match.checked==="boolean"&&!this._checkedAttrChanged){el.checked=match.checked}}let u=0;for(const el of newControls){if(el.name||el.id)continue;const saved=unkeyed[u];u+=1;if(!saved)continue;if(el.value===""&&el.getAttribute("value")===null){el.value=saved.value}if((el.type==="checkbox"||el.type==="radio")&&typeof saved.checked==="boolean"&&!this._checkedAttrChanged){el.checked=saved.checked}}const newDetails=Array.from(this.querySelectorAll("details"));const keyedDetails=savedDetails.filter((sd)=>sd.id);const usedIds=new Set();for(const d of newDetails){const id=d.id||null;if(!id)continue;const match=keyedDetails.find((sd)=>sd.id===id&&!usedIds.has(sd.id));if(!match)continue;usedIds.add(match.id);d.open=match.open}let di=0;const plainSaved=savedDetails.filter((sd)=>!sd.id);for(const d of newDetails){if(d.id)continue;const sd=plainSaved[di];di+=1;if(!sd)break;d.open=sd.open}const newScrolls=Array.from(this.querySelectorAll("*")).filter((el)=>el.scrollHeight>el.clientHeight||el.scrollWidth>el.clientWidth);const keyedScrolls=savedScrolls.filter((s)=>s.el.id);const usedScrolls=new Set();for(const el of newScrolls){const id=el.id||null;if(!id)continue;const match=keyedScrolls.find((s)=>s.el.id===id&&!usedScrolls.has(s.el));if(!match)continue;usedScrolls.add(match.el);el.scrollTop=match.top;el.scrollLeft=match.left}let si=0;const plainScrolls=savedScrolls.filter((s)=>!s.el.id);for(const el of newScrolls){if(el.id)continue;const s=plainScrolls[si];si+=1;if(!s)break;el.scrollTop=s.top;el.scrollLeft=s.left}if(hadFocus){let target=null;if(hadFocus.id){try{target=this.querySelector("#"+CSS.escape(hadFocus.id))}catch(e){target=null}}if(!target&&hadFocusName){try{target=this.querySelector('[name="'+CSS.escape(hadFocusName)+'"]')}catch(e){target=null}}if(!target&&hadFocusIndex>=0){const after=Array.from(this.querySelectorAll(_focusableSelector));if(after.length){target=after[Math.min(hadFocusIndex,after.length-1)]}}if(target&&typeof target.focus==="function"){try{target.focus()}catch(e){}}else if(document.contains(hadFocus)){try{hadFocus.focus()}catch(e){}}else{const first=this.querySelector(_focusableSelector);if(first)try{first.focus()}catch(e){}else try{this.focus()}catch(e){}}}this.enhance();this._detachInnerFormControls();this._checkedAttrChanged=false}finally{this._contourRendering=false}}disconnectedCallback(){this._pendingRerender=false;this._ensureCache=null;this._batchDepth=0;this._batchDirty=false;this._wiredFormData=false;runDisposers(this)}adoptedCallback(){if(this._contourAuthored){this._applyParts(this);this._applyDensity()}}enhance(){}_syncFormValue(){if(!this._internals)return;const ctl=this.querySelector("input:checked, textarea, select")||this.querySelector("input, textarea, select");if(!ctl)return;const boolean=ctl.type==="checkbox"||ctl.type==="radio";const value=boolean?(ctl.checked?(ctl.value||"on"):null):ctl.value;this._internals.setFormValue(value);this._syncValidity(this.hasAttribute("required")&&!value)}_syncValidity(valueMissing){if(!this._internals)return;if(valueMissing)this._internals.setValidity({valueMissing:true},"This field is required.");else this._internals.setValidity({});this._setCustomState("data-invalid",!!valueMissing)}_setCustomState(name,on){let internals=this._internals;if(!internals){if(this._stateInternals)internals=this._stateInternals;else if(typeof this.attachInternals==="function"){try{internals=this._stateInternals=this.attachInternals()}catch(e){return}}}const states=internals&&internals.states;if(!states)return;if(on){if(!states.has(name))states.add(name)}else if(states.has(name))states.delete(name)}_emitForm(type){if(!this._internals)return;const ctl=this.querySelector("input:checked, textarea, select")||this.querySelector("input, textarea, select");if(!ctl)return;const boolean=ctl.type==="checkbox"||ctl.type==="radio";this.dispatchEvent(new CustomEvent(type,{bubbles:true,composed:true,detail:{name:this.getAttribute("name"),value:boolean?(ctl.checked?(ctl.value||"on"):null):ctl.value,checked:boolean?ctl.checked:null,},}))}formResetCallback(){for(const ctl of this.querySelectorAll("input, textarea, select")){if(ctl.type==="checkbox"||ctl.type==="radio"){ctl.checked=this.hasAttribute("checked")}else if(ctl.tagName==="SELECT"){const chosen=ctl.querySelector("option[selected], option:first-of-type");ctl.value=chosen?chosen.value:""}else{ctl.value=this.hasAttribute("value")?this.getAttribute("value"):(ctl.getAttribute("value")||"")}}this._syncFormValue()}formDisabledCallback(disabled){for(const ctl of this.querySelectorAll("input, textarea, select, button")){if(disabled)ctl.setAttribute("disabled","");else ctl.removeAttribute("disabled")}}formStateRestoreCallback(state){if(!this._internals||state===null||state===undefined)return;const controls=Array.from(this.querySelectorAll("input, textarea, select"));const str=String(state);const match=controls.find((c)=>(c.type==="checkbox"||c.type==="radio")&&c.value===str);if(match){match.checked=true;for(const other of controls){if(other!==match&&other.type==="radio"&&other.name===match.name)other.checked=false}}else if(controls.length){controls[0].value=str}this._syncFormValue()}checkValidity(){return this._internals?this._internals.checkValidity():true}reportValidity(){return this._internals?this._internals.reportValidity():true}_wireFormData(){if(!this._internals||this._wiredFormData)return;const form=this._internals.form;if(!form)return;this._wiredFormData=true;const myName=this.getAttribute("name");const onFormChange=(e)=>{const t=e.target;if(t&&t.type==="radio"&&t.name&&t.name===myName)this._syncFormValue()};form.addEventListener("change",onFormChange);const onFormData=()=>this._syncFormValue();form.addEventListener("formdata",onFormData);onDispose(this,()=>{form.removeEventListener("change",onFormChange);form.removeEventListener("formdata",onFormData)})}_detachInnerFormControls(){if(!this._internals)return;for(const ctl of this.querySelectorAll("input, textarea, select")){if(ctl.hasAttribute("name")&&ctl.getAttribute("form")!=="")ctl.setAttribute("form","")}}batch(fn){if(typeof fn!=="function")return;this._batchDepth=(this._batchDepth||0)+1;this._batchDirty=this._batchDirty||false;try{fn()}finally{this._batchDepth-=1;if(this._batchDepth===0&&this._batchDirty){this._batchDirty=false;if(this.isConnected&&this._contourAuthored){this.attributeChangedCallback("__rerender__",null,"")}}}}requestRender(){if(this._contourRerenderQueued)return;this._contourRerenderQueued=true;queueMicrotask(()=>{this._contourRerenderQueued=false;if(!this.isConnected||!this._contourAuthored)return;this.attributeChangedCallback("__rerender__",null,"")})}_applyParts(root){const scope=root||this;const nodes=scope.querySelectorAll?Array.from(scope.querySelectorAll("[class]")):[];for(const node of nodes){if(node.hasAttribute("part"))continue;if(typeof node.className!=="string")continue;for(const c of node.className.split(/\s+/)){const m=c.match(/^c-[a-z0-9-]+__([a-z0-9-]+)$/);if(m){node.setAttribute("part",m[1]);break}}}}_applyDensity(){const density=this.getAttribute("density");if(density!==null)this.setAttribute("data-density",density);else if(this.hasAttribute("data-density"))this.removeAttribute("data-density")}_ownerBetween(node,root){for(let p=node.parentElement;p&&p!==root;p=p.parentElement){if(p instanceof ContourBase)return p}return null}ensure(selector,factory,parent){const root=parent||this;if(!root._ensureCache||root._ensureCacheGen!==this._contourRenderGen){root._ensureCache=new Map();root._ensureCacheGen=this._contourRenderGen}const cache=root._ensureCache;const key=root===this?selector:"\u0000"+root+"\u0000"+selector;let node=cache.get(key);if(node===undefined){node=null;for(const candidate of root.querySelectorAll(selector)){if(!this._ownerBetween(candidate,root)){node=candidate;break}}cache.set(key,node)}if(!node){node=factory();if(node&&node.setAttribute&&!node.hasAttribute("part")){const m=String(selector).match(/\.c-[a-z0-9-]+__([a-z0-9-]+)/);if(m)node.setAttribute("part",m[1])}root.appendChild(node);cache.set(key,node)}return node}}export const simple=(classes)=>class extends ContourBase{render(){classes.forEach((c)=>this.classList.add(c));for(const c of Array.from(this.classList)){if(classes.some((base)=>c.startsWith(base+"--")))this.classList.remove(c)}MODS.forEach((attr)=>{if(this.hasAttribute(attr)){const val=this.getAttribute(attr);classes.forEach((c)=>{const prefix=c.replace("c-","");this.classList.add(`c-${prefix}--${val}`)})}})}};export const CLASS_ONLY=["box","cluster","container","row","scrim","stack"];export function supportsUntilFound(){try{const t=document.createElement("div");t.setAttribute("hidden","until-found");return t.getAttribute("hidden")==="until-found"}catch(e){return false}}export function formatValue(value,format,locale){if(!format)return value;const loc=locale||(typeof navigator!=="undefined"&&navigator.language)||"en";if(format==="date"||format==="time"){try{const opts=format==="time"?{timeStyle:"short"}:undefined;return new Intl.DateTimeFormat(loc,opts).format(new Date(value))}catch(e){return value}}let opts={};if(format==="currency")opts={style:"currency",currency:"USD"};else if(format==="percent")opts={style:"percent"};else if(format==="compact")opts={notation:"compact"};else if(format!=="number"){try{opts=JSON.parse(format)}catch(e){return value}}try{return new Intl.NumberFormat(loc,opts).format(Number(value))}catch(e){return value}}"use strict";export function arcPath(cx,cy,r,inner,startAngle,endAngle){cx=Number.isFinite(cx)?cx:0;cy=Number.isFinite(cy)?cy:0;r=Number.isFinite(r)&&r>0?r:0;inner=Number.isFinite(inner)&&inner>=0?inner:0;startAngle=Number.isFinite(startAngle)?startAngle:0;endAngle=Number.isFinite(endAngle)?endAngle:0;const largeArc=endAngle-startAngle>Math.PI?1:0;const x1=cx+r*Math.cos(startAngle);const y1=cy+r*Math.sin(startAngle);const x2=cx+r*Math.cos(endAngle);const y2=cy+r*Math.sin(endAngle);if(inner<=0){return`M ${cx} ${cy} L ${x1} ${y1} A ${r} ${r} 0 ${largeArc} 1 ${x2} ${y2} Z`}const ix1=cx+inner*Math.cos(endAngle);const iy1=cy+inner*Math.sin(endAngle);const ix2=cx+inner*Math.cos(startAngle);const iy2=cy+inner*Math.sin(startAngle);return`M ${x1} ${y1} A ${r} ${r} 0 ${largeArc} 1 ${x2} ${y2} L ${ix1} ${iy1} A ${inner} ${inner} 0 ${largeArc} 0 ${ix2} ${iy2} Z`}export function donutSlices(values,opts){opts=opts||{};const cx=opts.cx!=null?opts.cx:100;const cy=opts.cy!=null?opts.cy:100;const r=opts.r!=null?opts.r:90;const inner=opts.inner!=null?opts.inner:55;const gap=opts.gap!=null?opts.gap:0.02;const total=values.reduce((a,b)=>a+(Number(b)||0),0)||1;let angle=-Math.PI/2;const out=[];values.forEach((v,i)=>{const num=Number(v)||0;const frac=num/total;if(!(num>0)){angle+=frac*Math.PI*2;return}const sweep=frac*Math.PI*2-gap;const start=angle+gap/2;const end=start+Math.max(0,sweep);out.push({path:arcPath(cx,cy,r,inner,start,end),value:num,index:i});angle+=frac*Math.PI*2});return out}export function barRects(values,opts){opts=opts||{};const width=opts.width!=null?opts.width:300;const height=opts.height!=null?opts.height:120;const gap=opts.gap!=null?opts.gap:2;const max=opts.max!=null?opts.max:(Math.max.apply(null,values.map((v)=>Number(v)||0))||1);if(!Number.isFinite(max)||max<=0)return values.map(()=>({x:0,y:height,width:0,height:0}));const n=values.length||1;const slot=width/n;const barW=Math.max(1,slot-gap);return values.map((v,i)=>{const h=((Number(v)||0)/max)*height;return{x:i*slot+gap/2,y:height-h,width:barW,height:h}})}export function polylinePoints(values,opts){opts=opts||{};const width=opts.width!=null?opts.width:300;const height=opts.height!=null?opts.height:120;const nums=values.map((v)=>Number(v)||0);if(!nums.length)return"";const max=opts.max!=null?opts.max:Math.max.apply(null,nums);const min=opts.min!=null?opts.min:Math.min.apply(null,nums);const range=(Number.isFinite(max-min)&&(max-min)!==0)?(max-min):1;const n=nums.length||1;return nums.map((v,i)=>{const x=(i/Math.max(1,n-1))*width;const y=height-((v-min)/range)*height;return x.toFixed(2)+","+y.toFixed(2)}).join(" ")}export function smoothPath(values,opts){const pts=polylinePoints(values,opts).split(" ").map((p)=>p.split(",").map(Number));if(!pts.length)return"";let d=`M ${pts[0][0]} ${pts[0][1]}`;for(let i=1;i<pts.length;i++){const prev=pts[i-1];const cur=pts[i];const cpx=(prev[0]+cur[0])/2;d+=` C ${cpx} ${prev[1]}, ${cpx} ${cur[1]}, ${cur[0]} ${cur[1]}`}return d}export function compassNeedle(cx,cy,length,angleDeg,width){angleDeg=angleDeg==null?0:angleDeg;width=width==null?3:width;const a=(angleDeg-90)*Math.PI/180;const tipX=cx+length*Math.cos(a);const tipY=cy+length*Math.sin(a);const tail=length*0.25;const tailX=cx-tail*Math.cos(a);const tailY=cy-tail*Math.sin(a);const perpX=Math.cos(a+Math.PI/2);const perpY=Math.sin(a+Math.PI/2);const b1x=cx+width*perpX;const b1y=cy+width*perpY;const b2x=cx-width*perpX;const b2y=cy-width*perpY;return`M ${tipX.toFixed(2)} ${tipY.toFixed(2)} L ${b1x.toFixed(2)} ${b1y.toFixed(2)} L ${tailX.toFixed(2)} ${tailY.toFixed(2)} L ${b2x.toFixed(2)} ${b2y.toFixed(2)} Z`}export function scaleBarTicks(value,segments){value=Number(value)||0;segments=Math.max(1,Math.round(segments||4));const out=[];for(let i=0;i<=segments;i++){out.push((value/segments)*i)}return out}export const MARKER_SHAPES=["circle","square","triangle","diamond","star"];export function markerStyles(shape){const map={circle:"border-radius:50%",square:"border-radius:0",triangle:"clip-path:polygon(50% 0%,0% 100%,100% 100%)",diamond:"transform:rotate(45deg)",star:"clip-path:polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%)",};return map[shape]||""}export function assignMarkers(items){return(items||[]).map((it,i)=>({...it,marker:MARKER_SHAPES[i%MARKER_SHAPES.length]}))}const WIRED_HOSTS=new WeakMap();export const wcReset=(host)=>{WIRED_HOSTS.delete(host)};const wcClaim=(host,name)=>{let set=WIRED_HOSTS.get(host);if(!set){set=new Set();WIRED_HOSTS.set(host,set)}if(set.has(name))return false;set.add(name);return true};const wcScopes=(host)=>(host.shadowRoot?[host,host.shadowRoot]:[host]);const wcAll=(host,sel)=>{const found=[];for(const scope of wcScopes(host)){for(const el of scope.querySelectorAll(sel))if(!found.includes(el))found.push(el)}return found};const wcOne=(host,sel)=>wcAll(host,sel)[0]||null;const wcSelfOrAll=(host,sel)=>{const found=typeof host.matches==="function"&&host.matches(sel)?[host]:[];for(const el of wcAll(host,sel))if(!found.includes(el))found.push(el);return found};const wcShadowOf=(node)=>{const root=node&&node.getRootNode?node.getRootNode():null;return root&&root.host?root:null};const wcGroup=(host,group,sel)=>{const found=Array.from(group.querySelectorAll(sel));if(wcShadowOf(group)&&wcShadowOf(group).host===host){for(const el of host.querySelectorAll(sel))if(!found.includes(el))found.push(el)}return found};const HEARD=new WeakMap();const wcListen=(host,type,handler)=>{const scoped=(e)=>{let seen=HEARD.get(e);if(!seen){seen=new Set();HEARD.set(e,seen)}if(seen.has(scoped))return;seen.add(scoped);handler(e)};for(const scope of wcScopes(host))scope.addEventListener(type,scoped)};const wcOwned=(host,node)=>!!node&&wcScopes(host).some((scope)=>scope.contains(node));const wcClosest=(host,target,sel)=>(typeof target?.closest==="function"&&wcOwned(host,target))?target.closest(sel):null;const wcEmit=(host,name,detail)=>{host.dispatchEvent(new CustomEvent(name,{detail,bubbles:true,composed:true}))};function isRtl(host){let el=host;while(el&&el.nodeType===1){const d=el.getAttribute&&el.getAttribute("dir");if(d)return d.toLowerCase()==="rtl";el=el.parentElement}try{return(document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl"}catch(e){return false}}export function wireTabs(host){if(!wcClaim(host,"tabs"))return;for(const list of wcSelfOrAll(host,".c-tabs__list, .c-code-tabs__list")){const isCode=list.classList.contains("c-code-tabs__list");const panelSel=isCode?".c-code-tabs__panel":".c-tabs__panel";const tabsOf=()=>wcGroup(host,list,"[role='tab']");const activate=(tab,focus)=>{const tabs=tabsOf();tabs.forEach((t)=>{const selected=t===tab;t.setAttribute("aria-selected",String(selected));t.tabIndex=selected?0:-1;const ctrl=t.getAttribute("aria-controls");if(!ctrl)return;const panel=wcOne(host,"#"+CSS.escape(ctrl))||document.getElementById(ctrl);if(panel)panel.hidden=!selected});const panels=wcAll(host,panelSel);if(panels.length){const index=tabs.indexOf(tab);panels.forEach((p,i)=>{p.hidden=i!==index})}if(focus)try{tab.focus()}catch(e){}const name=tab.getAttribute("aria-controls")||tab.textContent||"";host.dispatchEvent(new CustomEvent("contour:tab-change",{bubbles:true,composed:true,detail:{index:tabs.indexOf(tab),label:name}}))};const runActivation=(tab,focus)=>{const can=!focus&&typeof document.startViewTransition==="function"&&!(typeof matchMedia==="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches);if(can){try{document.startViewTransition(()=>activate(tab,focus));return}catch(e){}}activate(tab,focus)};wcListen(host,"click",(e)=>{const tab=wcClosest(host,e.target,"[role='tab']");if(tab&&tabsOf().includes(tab))runActivation(tab,false)});wcListen(host,"keydown",(e)=>{let tab=wcClosest(host,e.target,"[role='tab']");if(!tab&&e.target&&e.target.getAttribute&&e.target.getAttribute("role")==="tab"&&wcOwned(host,e.target))tab=e.target;const tabs=tabsOf();const index=tabs.indexOf(tab);if(index<0)return;const vertical=host.getAttribute("orientation")==="vertical";const rtl=isRtl(host);const move=vertical?(rtl?{ArrowDown:index-1,ArrowUp:index+1,Home:tabs.length-1,End:0}:{ArrowDown:index+1,ArrowUp:index-1,Home:0,End:tabs.length-1}):(rtl?{ArrowRight:index-1,ArrowLeft:index+1,Home:tabs.length-1,End:0}:{ArrowRight:index+1,ArrowLeft:index-1,Home:0,End:tabs.length-1});if(!(e.key in move))return;e.preventDefault();const next=tabs[(move[e.key]+tabs.length)%tabs.length];if(next)runActivation(next,true)});const tabs=tabsOf();const persist=host.getAttribute("persist");let restored=null;if(persist==="storage"&&host.id){try{restored=localStorage.getItem("contour-tabs:"+host.id)}catch(e){restored=null}}else if(persist==="url"){try{const params=new URLSearchParams(window.location.search);const v=params.get("c-tabs");if(v!==null)restored=v}catch(e){restored=null}}const marked=tabs.find((t)=>t.getAttribute("aria-selected")==="true");let first=marked||tabs[0];if(restored!==null){const idx=parseInt(restored,10);if(Number.isFinite(idx)&&tabs[idx])first=tabs[idx]}if(first)activate(first,false);if(persist==="storage"&&host.id){host.addEventListener("contour:tab-change",(e)=>{try{localStorage.setItem("contour-tabs:"+host.id,String(e.detail&&e.detail.index))}catch(err){}})}else if(persist==="url"){host.addEventListener("contour:tab-change",(e)=>{try{const url=new URL(window.location.href);url.searchParams.set("c-tabs",String(e.detail&&e.detail.index));window.history.replaceState(null,"",url.toString())}catch(err){}})}}}export function wireSegmented(host){const groups=wcSelfOrAll(host,".c-segmented");const normalize=()=>{const authored=host.getAttribute("value");const chosen=authored!==host._segAuthorValue?authored:null;if(chosen!==null)host._segAuthorValue=authored;let seen=0;for(const g of groups){if(!g.hasAttribute("role"))g.setAttribute("role","group");const label=host.getAttribute("label");if(label&&!g.hasAttribute("aria-label"))g.setAttribute("aria-label",label);const opts=wcGroup(host,g,"button");seen+=opts.length;opts.forEach((b)=>{b.classList.add("c-segmented__option");b.setAttribute("aria-pressed",chosen!==null&&chosen!==undefined?String(b.dataset.value===chosen):(b.getAttribute("aria-pressed")==="true"?"true":"false"))});const chosenOpt=opts.find((b)=>b.getAttribute("aria-pressed")==="true")||opts[0];opts.forEach((b)=>{b.tabIndex=b===chosenOpt?0:-1})}return seen};if(!normalize()){if(!host._segRetryScheduled){host._segRetryScheduled=true;setTimeout(()=>{host._segRetryScheduled=false;normalize()},0)}}if(!wcClaim(host,"segmented"))return;const activate=(btn)=>{const seg=groups.find((g)=>wcGroup(host,g,"button").includes(btn));if(!seg)return;wcGroup(host,seg,"button").forEach((o)=>{const on=o===btn;o.setAttribute("aria-pressed",String(on));o.tabIndex=on?0:-1});wcEmit(host,"contour:change",{value:btn.dataset.value||btn.textContent.trim()})};wcListen(host,"click",(e)=>{const btn=wcClosest(host,e.target,"button");if(!btn)return;activate(btn)});wcListen(host,"keydown",(e)=>{const btn=wcClosest(host,e.target,"button");if(!btn)return;const seg=groups.find((g)=>wcGroup(host,g,"button").includes(btn));if(!seg)return;const opts=wcGroup(host,seg,"button");const idx=opts.indexOf(btn);let next=-1;const rtl=isRtl(host);if(e.key==="ArrowRight"||e.key==="ArrowDown")next=rtl?Math.max(idx-1,0):Math.min(idx+1,opts.length-1);else if(e.key==="ArrowLeft"||e.key==="ArrowUp")next=rtl?Math.min(idx+1,opts.length-1):Math.max(idx-1,0);else if(e.key==="Home")next=0;else if(e.key==="End")next=opts.length-1;else if(e.key==="Enter"||e.key===" "){e.preventDefault();activate(btn);return}if(next>=0&&next!==idx){e.preventDefault();opts[next].focus()}})}export function wireCombobox(host){wireComboboxDocDismiss();const input=wcOne(host,".c-combobox__input");const list=wcOne(host,".c-combobox__list");if(!input||!list)return;const optionList=()=>wcAll(host,".c-combobox__option");if(!list.id)list.id=contourId("c-combobox-list");list.setAttribute("role","listbox");input.setAttribute("role","combobox");input.setAttribute("aria-haspopup","listbox");input.setAttribute("aria-controls",list.id);input.setAttribute("aria-expanded",list.hasAttribute("hidden")?"false":"true");if(!input.hasAttribute("aria-autocomplete"))input.setAttribute("aria-autocomplete","list");optionList().forEach((opt,i)=>{if(!opt.id)opt.id=contourId("c-combobox-option");opt.setAttribute("role","option");if(!opt.hasAttribute("aria-selected"))opt.setAttribute("aria-selected","false")});if(!wcClaim(host,"combobox"))return;const liveInput=()=>wcOne(host,".c-combobox__input");const liveList=()=>wcOne(host,".c-combobox__list");let cursor=-1;const mark=(visible)=>{const field=liveInput();visible.forEach((o,i)=>{const on=i===cursor;o.classList.toggle("c-combobox__option--active",on);o.setAttribute("aria-selected",String(on))});if(field){const active=cursor>=0?visible[cursor]:null;if(active)field.setAttribute("aria-activedescendant",active.id);else field.removeAttribute("aria-activedescendant")}};const filter=(query)=>{const q=(query||"").toLowerCase();optionList().forEach((o)=>{o.hidden=!!(q&&!o.textContent.toLowerCase().includes(q))});cursor=-1};const open=()=>{const l=liveList();if(!l)return;l.removeAttribute("hidden");const field=liveInput();if(field)field.setAttribute("aria-expanded","true")};const close=()=>{const l=liveList();if(l)l.setAttribute("hidden","");const field=liveInput();if(field){field.setAttribute("aria-expanded","false");field.removeAttribute("aria-activedescendant")}cursor=-1;optionList().forEach((o)=>{o.classList.remove("c-combobox__option--active");o.setAttribute("aria-selected","false")})};const commit=(opt)=>{const field=liveInput();if(!field)return;if(host.hasAttribute("multiple")){const now=opt.getAttribute("aria-selected")==="true";opt.setAttribute("aria-selected",String(!now));opt.classList.toggle("c-combobox__option--selected",!now);const selected=optionList().filter((o)=>o.getAttribute("aria-selected")==="true").map((o)=>o.textContent.trim());host.setAttribute("value",selected.join(","));if(typeof host._syncFormValue==="function")host._syncFormValue();wcEmit(host,"contour:select",{value:selected});field.focus();return}field.value=opt.textContent;wcEmit(host,"contour:select",{value:field.value});close();field.focus()};const isField=(target)=>wcClosest(host,target,".c-combobox__input")!==null;wcListen(host,"input",(e)=>{if(!isField(e.target))return;filter(e.target.value);open();if(typeof host._emitForm==="function")host._emitForm("contour:input")});wcListen(host,"focusin",(e)=>{if(!isField(e.target))return;filter(e.target.value);open()});wcListen(host,"keydown",(e)=>{if(!isField(e.target))return;const visible=optionList().filter((o)=>!o.hidden);if(e.key==="ArrowDown"){e.preventDefault();cursor=Math.min(cursor+1,visible.length-1);mark(visible)}else if(e.key==="ArrowUp"){e.preventDefault();cursor=Math.max(cursor-1,0);mark(visible)}else if(e.key==="Enter"){e.preventDefault();if(cursor>=0&&visible[cursor])commit(visible[cursor])}else if(e.key==="Escape")close()});wcListen(host,"click",(e)=>{const opt=wcClosest(host,e.target,".c-combobox__option");if(opt){commit(opt);return}if(!wcOwned(host,e.target)||!host.contains(e.target))close()})}let _comboboxDocWired=false;function wireComboboxDocDismiss(){if(_comboboxDocWired)return;_comboboxDocWired=true;document.addEventListener("click",(e)=>{for(const host of document.querySelectorAll("contour-combobox, contour-shadow-combobox")){const list=host.shadowRoot?host.shadowRoot.querySelector(".c-combobox__list"):host.querySelector(".c-combobox__list");const input=host.shadowRoot?host.shadowRoot.querySelector(".c-combobox__input"):host.querySelector(".c-combobox__input");if(!list||list.hasAttribute("hidden"))continue;const root=host.shadowRoot||host;if(root.contains(e.target))continue;list.setAttribute("hidden","")}})}const visibleStops=(host)=>wcAll(host,".c-tree__toggle, .c-tree__leaf").filter((el)=>!el.closest(".c-tree__children[hidden]"));export function wireTree(host){const nodes=()=>wcAll(host,".c-tree__node");const rootList=wcSelfOrAll(host,"ul.c-tree")[0];if(rootList&&!rootList.hasAttribute("role"))rootList.setAttribute("role","tree");wcAll(host,".c-tree__children").forEach((ul)=>{if(!ul.hasAttribute("role"))ul.setAttribute("role","group")});const levelOf=(node)=>{let level=1;for(let p=node.parentElement;p;p=p.parentElement)if(p.classList&&p.classList.contains("c-tree__children"))level++;return level};nodes().forEach((node)=>{if(node.getAttribute("role")!=="treeitem")node.setAttribute("role","treeitem");node.setAttribute("aria-level",String(levelOf(node)));const row=node.querySelector(":scope > .c-tree__row");if(row)node.setAttribute("aria-expanded",row.getAttribute("aria-expanded")||"false");else if(node.hasAttribute("aria-expanded"))node.removeAttribute("aria-expanded")});const stops=visibleStops(host);const authored=stops.find((el)=>el.getAttribute("tabindex")==="0");const active=authored||stops.find((el)=>el===document.activeElement)||stops[0];stops.forEach((el)=>el.setAttribute("tabindex",el===active?"0":"-1"));wcAll(host,".c-tree__toggle, .c-tree__leaf").forEach((el)=>{if(!stops.includes(el))el.setAttribute("tabindex","-1")});if(!wcClaim(host,"tree"))return;host._selectedTree=host._selectedTree||new Set();let lastTreeIndex=-1;wcListen(host,"change",(e)=>{const cb=e.target&&e.target.closest?e.target.closest(".c-tree__select"):null;if(!cb||!host.contains(cb))return;const cbs=Array.from(host.querySelectorAll(".c-tree__select"));const idx=cbs.indexOf(cb);const label=(cb.parentElement&&cb.parentElement.textContent||"").trim().slice(0,120);if(e.shiftKey&&lastTreeIndex>=0){const from=Math.min(lastTreeIndex,idx);const to=Math.max(lastTreeIndex,idx);for(let i=from;i<=to;i++){cbs[i].checked=cb.checked;const lbl=(cbs[i].parentElement&&cbs[i].parentElement.textContent||"").trim().slice(0,120);if(cb.checked)host._selectedTree.add(lbl);else host._selectedTree.delete(lbl)}}else if(!e.ctrlKey&&!e.metaKey){if(cb.checked){cbs.forEach((c,i)=>{if(i!==idx&&c.checked){c.checked=false;const lbl=(c.parentElement&&c.parentElement.textContent||"").trim().slice(0,120);host._selectedTree.delete(lbl)}})}if(cb.checked)host._selectedTree.add(label);else host._selectedTree.delete(label)}else{if(cb.checked)host._selectedTree.add(label);else host._selectedTree.delete(label)}lastTreeIndex=idx;wcEmit(host,"contour:select",{labels:Array.from(host._selectedTree)})});wcAll(host,".c-tree__node, .c-tree__leaf").forEach((n)=>{if(!n.hasAttribute("draggable"))n.setAttribute("draggable","true")});let dragLabel=null;wcListen(host,"dragstart",(e)=>{const node=wcClosest(host,e.target,".c-tree__node, .c-tree__leaf");if(!node)return;dragLabel=(node.textContent||"").trim().slice(0,120);if(e.dataTransfer){e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",dragLabel)}catch(err){}}});wcListen(host,"dragover",(e)=>{const node=wcClosest(host,e.target,".c-tree__node, .c-tree__leaf");if(!node)return;e.preventDefault();if(e.dataTransfer)e.dataTransfer.dropEffect="move"});wcListen(host,"drop",(e)=>{const node=wcClosest(host,e.target,".c-tree__node, .c-tree__leaf");if(!node||!dragLabel)return;e.preventDefault();const toLabel=(node.textContent||"").trim().slice(0,120);if(toLabel&&toLabel!==dragLabel){wcEmit(host,"contour:move",{from:dragLabel,to:toLabel})}dragLabel=null});const persist=host.getAttribute("persist");if(persist==="storage"&&host.id){try{const saved=localStorage.getItem("contour-tree:"+host.id);if(saved!==null){const labels=JSON.parse(saved);if(Array.isArray(labels)){const want=new Set(labels.map((l)=>String(l)));wcAll(host,".c-tree__row").forEach((row)=>{if(row.getAttribute("aria-expanded")==="true")return;const label=(row.textContent||"").trim().slice(0,120);if(!want.has(label))return;const toggle=row.querySelector(":scope > .c-tree__toggle");if(!toggle)return;const node=row.closest(".c-tree__node");const children=node?node.querySelector(":scope > .c-tree__children"):null;toggle.setAttribute("aria-expanded","true");row.setAttribute("aria-expanded","true");if(node)node.setAttribute("aria-expanded","true");if(children)children.removeAttribute("hidden")})}}}catch(e){}}else if(persist==="url"){try{const v=new URLSearchParams(window.location.search).get("c-tree");if(v!==null){const labels=JSON.parse(v);if(Array.isArray(labels)){const want=new Set(labels.map((l)=>String(l)));wcAll(host,".c-tree__row").forEach((row)=>{if(row.getAttribute("aria-expanded")==="true")return;const label=(row.textContent||"").trim().slice(0,120);if(!want.has(label))return;const toggle=row.querySelector(":scope > .c-tree__toggle");if(!toggle)return;const node=row.closest(".c-tree__node");const children=node?node.querySelector(":scope > .c-tree__children"):null;toggle.setAttribute("aria-expanded","true");row.setAttribute("aria-expanded","true");if(node)node.setAttribute("aria-expanded","true");if(children)children.removeAttribute("hidden")})}}}catch(e){}}const toggleNode=(toggle)=>{const wasOpen=toggle.getAttribute("aria-expanded")==="true";toggle.setAttribute("aria-expanded",String(!wasOpen));const row=toggle.closest(".c-tree__row")||toggle.parentElement;if(row)row.setAttribute("aria-expanded",String(!wasOpen));const node=toggle.closest(".c-tree__node");const children=node?node.querySelector(":scope > .c-tree__children"):null;if(children){if(wasOpen){if(supportsUntilFound())children.setAttribute("hidden","until-found");else children.hidden=true}else{children.removeAttribute("hidden")}}if(node)node.setAttribute("aria-expanded",String(!wasOpen));wcEmit(host,"contour:toggle",{open:!wasOpen,label:(row?row.textContent:"").trim().slice(0,120)});if(persist==="storage"&&host.id){try{const open=[];wcAll(host,".c-tree__row").forEach((r)=>{if(r.getAttribute("aria-expanded")==="true")open.push((r.textContent||"").trim().slice(0,120))});localStorage.setItem("contour-tree:"+host.id,JSON.stringify(open))}catch(e){}}else if(persist==="url"){try{const open=[];wcAll(host,".c-tree__row").forEach((r)=>{if(r.getAttribute("aria-expanded")==="true")open.push((r.textContent||"").trim().slice(0,120))});const url=new URL(window.location.href);url.searchParams.set("c-tree",JSON.stringify(open));window.history.replaceState(null,"",url.toString())}catch(e){}}};const branchOf=(el)=>(el.classList&&el.classList.contains("c-tree__toggle")?el:null);const stopsOf=()=>visibleStops(host);const rove=(keep)=>{wcAll(host,".c-tree__toggle, .c-tree__leaf").forEach((el)=>el.setAttribute("tabindex",el===keep?"0":"-1"))};wcListen(host,"click",(e)=>{let toggle=wcClosest(host,e.target,".c-tree__toggle");if(!toggle){const row=wcClosest(host,e.target,".c-tree__row");if(row)toggle=row.querySelector(":scope > .c-tree__toggle")}if(!toggle)return;e.preventDefault();e.stopPropagation();toggleNode(toggle)});wcListen(host,"focusin",(e)=>{if(!wcClosest(host,e.target,".c-tree__toggle, .c-tree__leaf"))return;rove(e.target)});wcListen(host,"keydown",(e)=>{const toggle=wcClosest(host,e.target,".c-tree__toggle, .c-tree__leaf");if(!toggle)return;const items=stopsOf();const idx=items.indexOf(toggle);if(e.key==="Enter"||e.key===" "){if(branchOf(toggle)){e.preventDefault();toggleNode(toggle)}return}if(e.key==="ArrowRight"){const branch=branchOf(toggle);const closed=branch&&branch.getAttribute("aria-expanded")==="false";e.preventDefault();if(closed){toggleNode(branch);rove(toggle)}else{const next=items[idx+1];if(next){next.focus();rove(next)}}return}if(e.key==="ArrowLeft"){const branch=branchOf(toggle);if(branch&&branch.getAttribute("aria-expanded")==="true"){e.preventDefault();toggleNode(branch);rove(toggle)}else{const parent=toggle.closest(".c-tree__children");const owner=parent?parent.closest(".c-tree__node"):null;const up=owner?owner.querySelector(":scope > .c-tree__row > .c-tree__toggle"):null;if(up){e.preventDefault();up.focus();rove(up)}}return}let next=-1;if(e.key==="ArrowDown")next=Math.min(idx+1,items.length-1);else if(e.key==="ArrowUp")next=Math.max(idx-1,0);else if(e.key==="Home")next=0;else if(e.key==="End")next=items.length-1;if(next>=0&&next!==idx){e.preventDefault();items[next].focus();rove(items[next])}})}export function wireMenu(host){wcAll(host,"[role='menuitem']").forEach((it)=>{if(!it.hasAttribute("tabindex"))it.setAttribute("tabindex",it.getAttribute("aria-disabled")==="true"?"-1":"-1")});const all=()=>wcAll(host,"[role='menuitem']");if(!all().some((it)=>it.getAttribute("tabindex")==="0")&&all().length){const first=all().find((it)=>it.getAttribute("aria-disabled")!=="true");if(first)first.setAttribute("tabindex","0")}if(!wcClaim(host,"menu"))return;const submenusOf=(item)=>item.querySelector(":scope > ul.c-menu, :scope > .c-menu");const closeAllSubmenus=()=>{wcAll(host,"[aria-haspopup='menu']").forEach((it)=>it.setAttribute("aria-expanded","false"))};wcListen(host,"keydown",(e)=>{const its=all().filter((it)=>it.getAttribute("aria-disabled")!=="true");if(!its.length)return;const index=its.indexOf(e.target);const target=index>=0?its[index]:null;const sub=target?submenusOf(target):null;if(target&&target.getAttribute("aria-haspopup")==="menu"&&(e.key==="ArrowRight"||e.key==="Enter"||e.key===" ")){if(sub){e.preventDefault();closeAllSubmenus();target.setAttribute("aria-expanded","true");const firstSub=sub.querySelector("[role='menuitem']");if(firstSub){firstSub.setAttribute("tabindex","0");try{firstSub.focus()}catch(err){}}return}}if(e.key==="ArrowLeft"||e.key==="Escape"){const parent=target?target.closest("ul.c-menu"):null;let ancestor=null;if(target){const ul=target.parentElement&&target.parentElement.tagName==="UL"?target.parentElement:null;let node=target.parentElement;while(node&&node!==host){if(node.getAttribute&&node.getAttribute("aria-haspopup")==="menu"&&node.contains(target)&&node!==target){ancestor=node;break}node=node.parentElement}}if(ancestor){e.preventDefault();ancestor.setAttribute("aria-expanded","false");try{ancestor.focus()}catch(err){}return}if(e.key==="Escape"){closeAllSubmenus()}}let next=-1;if(e.key==="ArrowDown")next=index<0?0:Math.min(index+1,its.length-1);else if(e.key==="ArrowUp")next=index<0?its.length-1:Math.max(index-1,0);else if(e.key==="Home")next=0;else if(e.key==="End")next=its.length-1;if(next>=0){e.preventDefault();its[next].focus();return}if((e.key==="Enter"||e.key===" ")&&index>=0&&!(target&&target.getAttribute("aria-haspopup")==="menu")){e.preventDefault();wcEmit(host,"contour:select",{index,label:its[index].textContent.trim()});closeAllSubmenus()}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){const ch=e.key.toLowerCase();const match=its.findIndex((it)=>(it.textContent||"").trim().toLowerCase().startsWith(ch));if(match>=0){e.preventDefault();its[match].focus()}}});wcListen(host,"click",(e)=>{const item=wcClosest(host,e.target,"[role='menuitem']");if(!item)return;if(item.getAttribute("aria-disabled")==="true")return;if(item.getAttribute("aria-haspopup")==="menu"){const sub=submenusOf(item);if(sub){const open=item.getAttribute("aria-expanded")==="true";closeAllSubmenus();item.setAttribute("aria-expanded",open?"false":"true");return}}const index=all().indexOf(item);if(index>=0){wcEmit(host,"contour:select",{index,label:item.textContent.trim()});closeAllSubmenus();if(typeof host.hidePopover==="function"){try{host.hidePopover()}catch(e){}}}})}export function wirePagination(host){wcAll(host,".c-pagination__link").forEach((b)=>{if(!b.hasAttribute("tabindex"))b.setAttribute("tabindex","0")});if(!wcClaim(host,"pagination"))return;const activate=(btn)=>{const page=parseInt(btn.textContent,10);if(!Number.isFinite(page))return;wcAll(host,".c-pagination__link").forEach((b)=>{if(parseInt(b.textContent,10)===page)b.setAttribute("aria-current","page");else b.removeAttribute("aria-current")});host.setAttribute("page",String(page));wcEmit(host,"contour:page",{page});if(host.getAttribute("persist")==="storage"&&host.id){try{localStorage.setItem("contour-pagination:"+host.id,String(page))}catch(e){}}else if(host.getAttribute("persist")==="url"){try{const url=new URL(window.location.href);url.searchParams.set("c-pagination",String(page));window.history.replaceState(null,"",url.toString())}catch(e){}}};wcListen(host,"click",(e)=>{const btn=wcClosest(host,e.target,".c-pagination__link");if(!btn)return;e.preventDefault();const action=btn.getAttribute("data-action");if(action==="prev"||action==="next"){const links=wcAll(host,".c-pagination__link").filter((b)=>!b.getAttribute("data-action"));const cur=links.find((b)=>b.getAttribute("aria-current")==="page");const curPage=cur?(parseInt(cur.textContent,10)||1):1;const page=action==="prev"?Math.max(1,curPage-1):Math.min(links.length,curPage+1);const target=links.find((b)=>parseInt(b.textContent,10)===page);if(target){activate(target);return}}activate(btn)});wcListen(host,"keydown",(e)=>{const btn=wcClosest(host,e.target,".c-pagination__link");if(!btn)return;const links=wcAll(host,".c-pagination__link");const idx=links.indexOf(btn);let next=-1;const rtl=isRtl(host);if(e.key==="ArrowRight")next=rtl?Math.max(idx-1,0):Math.min(idx+1,links.length-1);else if(e.key==="ArrowLeft")next=rtl?Math.min(idx+1,links.length-1):Math.max(idx-1,0);else if(e.key==="Home")next=0;else if(e.key==="End")next=links.length-1;else if(e.key==="Enter"||e.key===" "){e.preventDefault();activate(btn);return}if(next>=0&&next!==idx){e.preventDefault();links[next].focus()}})}export function wireCopy(host){if(!wcClaim(host,"copy"))return;wcListen(host,"click",(e)=>{const btn=wcClosest(host,e.target,".c-code__copy, .c-install__copy");if(!btn)return;const owner=wcClosest(host,btn,".c-code")||wcClosest(host,btn,".c-install")||host;const src=owner.querySelector("code, .c-install__command");const text=(src?src.textContent:owner.textContent)||"";const confirm=(ok)=>{const icon=btn.querySelector("use");const originalHref=icon&&icon.getAttribute("href");const originalLabel=btn.getAttribute("aria-label")||btn.title||"";if(ok&&icon)icon.setAttribute("href","#i-check");btn.setAttribute("aria-label",ok?"Copied":"Copy failed");btn.dataset.copied=String(ok);const timer=setTimeout(()=>{if(!btn.isConnected)return;if(icon&&originalHref)icon.setAttribute("href",originalHref);btn.setAttribute("aria-label",originalLabel);delete btn.dataset.copied},1600);onDispose(host,()=>clearTimeout(timer))};if(navigator.clipboard)navigator.clipboard.writeText(text).then(()=>confirm(true)).catch(()=>confirm(false));wcEmit(host,"contour:copy",{text})})}export function wireRemovable(host){if(!wcClaim(host,"removable"))return;wcListen(host,"click",(e)=>{const drop=(node)=>{if(node&&node.parentNode)node.parentNode.removeChild(node)};const tagBtn=wcClosest(host,e.target,".c-tag__remove");if(tagBtn){e.preventDefault();const tag=wcClosest(host,tagBtn,".c-tag");wcEmit(host,"contour:remove",{label:(tag&&tag.getAttribute("label"))||(tag?tag.textContent.trim():"")});drop(tag);return}const pillBtn=wcClosest(host,e.target,".c-filter-pill__remove");if(pillBtn){e.preventDefault();const pill=wcClosest(host,pillBtn,".c-filter-pill");wcEmit(host,"contour:remove",{key:pill&&pill.getAttribute("key"),value:pill&&pill.getAttribute("value")});drop(pill);return}if(wcClosest(host,e.target,"[data-empty-action]")){wcEmit(host,"contour:empty-action",{state:host.getAttribute("state")||"empty"})}const alertClose=wcClosest(host,e.target,".c-alert__close");if(alertClose){e.preventDefault();wcEmit(host,"contour:close",{});if(host.shadowRoot?host.shadowRoot.contains(alertClose):true){try{host.remove()}catch(err){}}return}const calloutClose=wcClosest(host,e.target,".c-callout__close");if(calloutClose){e.preventDefault();wcEmit(host,"contour:close",{});try{host.remove()}catch(err){}return}})}const modalDepth={n:0};let modalSavedOverflow=null;let modalSavedX=0;let modalSavedY=0;const modalInerted=new Set();const modalStack=[];let modalTrapWired=false;function modalFocusables(host){return Array.from(host.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])")).filter((el)=>!el.hasAttribute("disabled")&&el.getAttribute("aria-hidden")!=="true")}function modalTrapHandler(e){if(e.key!=="Tab")return;const host=modalStack[modalStack.length-1];if(!host)return;const f=modalFocusables(host);if(!f.length){e.preventDefault();return}const first=f[0];const last=f[f.length-1];const active=document.activeElement;if(e.shiftKey){if(active===first||!host.contains(active)){e.preventDefault();last.focus()}}else{if(active===last){e.preventDefault();first.focus()}}}export function modalContain(host,open){if(open){if(modalDepth.n===0){modalSavedX=window.scrollX;modalSavedY=window.scrollY;modalSavedOverflow=document.documentElement.style.overflow;document.documentElement.style.overflow="hidden"}modalDepth.n+=1;modalStack.push(host);if(modalDepth.n===1&&!modalTrapWired){modalTrapWired=true;document.addEventListener("keydown",modalTrapHandler)}for(let el=host;el&&el!==document.body;el=el.parentElement){for(const sib of el.parentElement.children){if(sib===el||sib.inert||modalInerted.has(sib))continue;sib.inert=true;modalInerted.add(sib)}}}else{const idx=modalStack.lastIndexOf(host);if(idx>=0)modalStack.splice(idx,1);modalDepth.n=Math.max(0,modalDepth.n-1);if(modalDepth.n===0){for(const el of modalInerted)el.inert=false;modalInerted.clear();document.documentElement.style.overflow=modalSavedOverflow||"";window.scrollTo(modalSavedX,modalSavedY)}}}export const STATE_FALLBACK={empty:"No data",loading:"Loading…",error:"Could not load.",};const remoteInflight=new Map();const REMOTE_CACHE_MAX=64;const remoteCache=new Map();function cacheResult(src,data){if(remoteCache.size>=REMOTE_CACHE_MAX)remoteCache.delete(remoteCache.keys().next().value);remoteCache.set(src,data)}function setStatus(host,status){host._remoteStatus=status;if(status!=="error")host._remoteError=null;if(status==="loading")host.setAttribute("aria-busy","true");else host.removeAttribute("aria-busy");if(typeof host._setCustomState==="function")host._setCustomState("data-loading",status==="loading")}function emitState(host,name,detail){host.dispatchEvent(new CustomEvent(name,{detail,bubbles:true,composed:true}))}function countOf(data){if(Array.isArray(data))return data.length;if(data&&typeof data==="object")return Object.keys(data).length;return data===null||data===undefined?0:1}function leaveRequest(host){const entry=host._remoteEntry;host._remoteEntry=null;if(!entry)return;entry.hosts.delete(host);if(entry.hosts.size===0&&entry.controller)entry.controller.abort()}export function loadRemote(host,fields){const src=host.getAttribute("src");if(!src){leaveRequest(host);setStatus(host,host._remoteData!==undefined?"ready":"idle");return}remoteRefresh(host);const wanted=typeof fields==="string"?[fields]:fields;if(wanted.every((f)=>host.getAttribute(f)!==null)){leaveRequest(host);setStatus(host,"ready");return}if(!remoteVisible(host)){setStatus(host,"loading");return}const noCache=host.hasAttribute("no-cache");const cacheKey=host.getAttribute("cache-key")||src;if(noCache){if(host._remoteSrc===src&&host._remoteData!==undefined){setStatus(host,"ready");return}}else{const cached=remoteCache.get(cacheKey);if(cached!==undefined){host._remoteSrc=src;host._remoteData=cached;setStatus(host,"ready");return}}if(host._remoteSrc===src&&(host._remoteStatus==="loading"||host._remoteStatus==="error"))return;leaveRequest(host);host._remoteSrc=src;setStatus(host,"loading");let entry=remoteInflight.get(src);if(!entry){entry={hosts:new Set(),controller:new AbortController(),cacheKey};remoteInflight.set(src,entry);entry.promise=startFetch(host,src,entry).then((data)=>{if(remoteInflight.get(src)===entry)remoteInflight.delete(src);cacheResult(src,data);const namedKey=entry.cacheKey;if(namedKey&&namedKey!==src)cacheResult(namedKey,data);for(const h of entry.hosts){h._remoteData=data;h._remoteEntry=null;setStatus(h,"ready");emitState(h,"contour:load",{src,count:countOf(data)})}},(err)=>{if(remoteInflight.get(src)===entry)remoteInflight.delete(src);for(const h of entry.hosts){h._remoteEntry=null;setStatus(h,"error");h._remoteError=err&&err.name==="HttpError"?`Could not load (${err.status})`:STATE_FALLBACK.error;emitState(h,"contour:error",{src,message:h._remoteError,name:err&&err.name,status:err&&err.status,})}}).finally(()=>{for(const h of entry.hosts)if(h.isConnected)h.requestRender();entry.hosts.clear()})}entry.hosts.add(host);host._remoteEntry=entry;if(!host._remoteDisposeRegistered){host._remoteDisposeRegistered=true;onDispose(host,()=>{host._remoteDisposeRegistered=false;leaveRequest(host)})}}export function remoteInvalidate(srcOrKey){remoteCache.delete(srcOrKey)}function startFetch(host,src,entry){const ms=parseInt(host.getAttribute("timeout")||"",10);let timer=null;let signal=entry.controller.signal;if(Number.isFinite(ms)&&ms>0){if(typeof AbortSignal!=="undefined"&&AbortSignal.timeout){signal=AbortSignal.any([signal,AbortSignal.timeout(ms)])}else{timer=setTimeout(()=>entry.controller.abort(),ms)}}onDispose(host,()=>{if(timer)clearTimeout(timer)});return fetch(src,{signal}).then((res)=>{if(timer)clearTimeout(timer);if(!res.ok){const e=new Error(`Could not load (${res.status})`);e.name="HttpError";e.status=res.status;throw e}return res.text()}).then((text)=>{try{return JSON.parse(text)}catch(err){const e=new Error(STATE_FALLBACK.error);e.name="ParseError";e.cause=err;throw e}})}export function remoteData(host,field){const authored=host.getAttribute(field);if(authored!==null)return authored;const data=host._remoteData;if(data===undefined||data===null)return null;if(Array.isArray(data))return JSON.stringify(data);if(typeof data==="object"){const keys=typeof field==="string"?[field]:field;for(const k of keys){if(data[k]===undefined)continue;return typeof data[k]==="string"?data[k]:JSON.stringify(data[k])}return null}return String(data)}export function remoteRefresh(host){const seconds=parseFloat(host.getAttribute("refresh")||"");const want=host.hasAttribute("src")&&Number.isFinite(seconds)&&seconds>0;if(!want){if(host._remoteTimer!==undefined){clearTimeout(host._remoteTimer);host._remoteTimer=undefined}return}if(host._remoteLoop)return;host._remoteLoop=true;const tick=()=>{host._remoteTimer=undefined;if(!host.isConnected||!host.hasAttribute("refresh")){host._remoteLoop=false;return}if(document.hidden){host._remoteTimer=setTimeout(tick,1000);return}const src=host.getAttribute("src");const namedKey=host.getAttribute("cache-key");if(namedKey)remoteCache.delete(namedKey);remoteCache.delete(src);host._remoteSrc=null;host._remoteLoop=false;host.requestRender()};host._remoteTimer=setTimeout(tick,Math.max(1000,seconds*1000));onDispose(host,()=>{clearTimeout(host._remoteTimer);host._remoteTimer=undefined;host._remoteLoop=false})}let _sharedLazyIO=null;const _sharedLazyTargets=new Map();export function remoteVisible(host){if(!host.hasAttribute("lazy"))return true;if(typeof IntersectionObserver!=="function")return true;if(host._remoteVisible)return true;if(!_sharedLazyIO){_sharedLazyIO=new IntersectionObserver((records)=>{for(const r of records){const activate=_sharedLazyTargets.get(r.target);if(!activate||!r.isIntersecting)continue;_sharedLazyTargets.delete(r.target);_sharedLazyIO.unobserve(r.target);activate()}},{rootMargin:"200px"})}const activate=()=>{host._remoteVisible=true;host.requestRender()};_sharedLazyTargets.set(host,activate);_sharedLazyIO.observe(host);onDispose(host,()=>{_sharedLazyIO.unobserve(host);_sharedLazyTargets.delete(host)});return false}export function watchViewport(host){if(host._contourViewWired)return()=>{};host._contourViewWired=true;const emit=(type)=>host.dispatchEvent(new CustomEvent(type,{bubbles:true,composed:true}));if(typeof IntersectionObserver!=="function"){emit("contour:view-enter");return()=>{}}const io=new IntersectionObserver((records)=>{for(const r of records){if(r.isIntersecting)emit("contour:view-enter");else emit("contour:view-leave")}});io.observe(host);onDispose(host,()=>io.disconnect());return()=>io.disconnect()}function stateNode(block,kind,text){const node=document.createElement("div");node.className="c-"+block+"__"+kind;node.dataset.contourState=kind;node.textContent=text;return node}function skeletonRow(i,total){const node=document.createElement("div");node.className="c-skeleton "+(i===0&&total>1?"c-skeleton--title":"c-skeleton--text");node.dataset.contourState="skeleton";return node}export function renderStates(host,block,opts){const options=opts||{};const loading=host.getAttribute("loading");if(loading!==null||host._remoteStatus==="loading"){host.appendChild(stateNode(block,"loading",loading||STATE_FALLBACK.loading));return true}const error=host.getAttribute("error");if(error!==null||host._remoteStatus==="error"){const message=(error!==null&&error!=="")?error:(host._remoteError||STATE_FALLBACK.error);const node=stateNode(block,"error",message);if(host.hasAttribute("retry")){const btn=document.createElement("button");btn.type="button";btn.className="c-btn c-btn--ghost c-btn--sm";btn.textContent=host.getAttribute("retry")||"Retry";btn.dataset.action="retry";node.appendChild(btn)}host.appendChild(node);return true}if(host.hasAttribute("skeleton")){const asked=parseInt(host.getAttribute("skeleton")||"3",10);const count=Math.min(options.max||6,Math.max(1,Number.isFinite(asked)?asked:3));for(let i=0;i<count;i++)host.appendChild(skeletonRow(i,count));return true}return false}export function renderEmpty(host,block){host.appendChild(stateNode(block,"empty",host.getAttribute("empty")||STATE_FALLBACK.empty))}export function wireStates(host){if(host._contourStatesWired)return;host._contourStatesWired=true;host.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest('[data-action="retry"]'):null;if(!btn||!host.contains(btn))return;e.preventDefault();const src=host.getAttribute("src");const namedKey=host.getAttribute("cache-key");if(namedKey)remoteCache.delete(namedKey);if(src)remoteCache.delete(src);leaveRequest(host);host._remoteSrc=null;host._remoteData=undefined;setStatus(host,"idle");emitState(host,"contour:retry",{src});host.requestRender()})}class ContourCard extends ContourBase{static get observed(){return["title","variant","heading"]}static get properties(){return{title:{attribute:"title"},variant:{attribute:"variant"}}}render(){this.classList.add("c-card");const variant=this.getAttribute("variant");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-card--"))this.classList.remove(c)});if(variant)this.classList.add("c-card--"+variant);const title=this.getAttribute("title");if(title){const h=this.ensure(".c-card__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-card__title";return el});if(h.parentNode===this&&this.firstChild!==h)this.prepend(h);h.textContent=title}else{const h=this.querySelector(".c-card__title");if(h)h.remove()}}}define("contour-card",ContourCard);class ContourFeature extends ContourBase{static get observed(){return["index","title","body","heading"]}static get properties(){return{index:{attribute:"index"},title:{attribute:"title"},body:{attribute:"body"}}}render(){this.classList.add("c-feature");const index=this.getAttribute("index");const title=this.getAttribute("title");const body=this.getAttribute("body");if(index){const x=this.ensure(".c-feature__index",()=>{const el=document.createElement("span");el.className="c-feature__index";return el});x.textContent=index}else{const x=this.querySelector(".c-feature__index");if(x)x.remove()}if(title){const t=this.ensure(".c-feature__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-feature__title";return el});t.textContent=title}else{const t=this.querySelector(".c-feature__title");if(t)t.remove()}if(body){const b=this.ensure(".c-feature__body",()=>{const el=document.createElement("p");el.className="c-feature__body";return el});b.textContent=body}else{const b=this.querySelector(".c-feature__body");if(b)b.remove()}}}define("contour-feature",ContourFeature);class ContourSteps extends ContourBase{static get observed(){return["steps","current","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","heading"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current",type:Number},src:{attribute:"src"}}}render(){this.classList.add("c-steps");this.setAttribute("role","list");wireStates(this);loadRemote(this,"steps");if(renderStates(this,"steps"))return;const steps=remoteData(this,"steps");const authored=Array.from(this.children).filter((n)=>n.classList&&n.classList.contains("c-steps__item"));if(steps&&!authored.length){Array.from(this.querySelectorAll(".c-steps__item")).forEach((n)=>n.remove());try{const parsed=JSON.parse(steps);parsed.forEach((st,i)=>{const item=document.createElement("div");item.className="c-steps__item";item.setAttribute("role","listitem");item.tabIndex=-1;const title=typeof st==="string"?st:st.title;const body=typeof st==="string"?"":st.body;if(title){const h=document.createElement(headingTag(this,"h3"));h.className="c-steps__title";h.textContent=title;item.appendChild(h)}if(body){const p=document.createElement("p");p.className="c-steps__body";p.textContent=body;item.appendChild(p)}this.appendChild(item)})}catch(e){}}else if(!steps&&!authored.length){renderEmpty(this,"steps")}const attrCurrent=this.getAttribute("current");const current=(this._current!=null)?this._current:(attrCurrent!=null?parseInt(attrCurrent,10):NaN);const items=Array.from(this.querySelectorAll(".c-steps__item"));items.forEach((it,i)=>{if(Number.isFinite(current)&&i===current)it.setAttribute("aria-current","step");else it.removeAttribute("aria-current");it.tabIndex=(Number.isFinite(current)&&i===current)?0:-1});if(items.length&&!Number.isFinite(current)){items[0].tabIndex=0}}enhance(){if(!this._wiredSteps){this._wiredSteps=true;this.addEventListener("keydown",(e)=>{const items=Array.from(this.querySelectorAll(".c-steps__item"));if(!items.length)return;const active=document.activeElement;const idx=items.indexOf(active);let next=-1;const rtl=(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl";if(e.key==="ArrowDown")next=idx<0?0:Math.min(items.length-1,idx+1);else if(e.key==="ArrowUp")next=idx<0?0:Math.max(0,idx-1);else if(e.key==="ArrowRight")next=rtl?(idx<0?0:Math.max(0,idx-1)):(idx<0?0:Math.min(items.length-1,idx+1));else if(e.key==="ArrowLeft")next=rtl?(idx<0?0:Math.min(items.length-1,idx+1)):(idx<0?0:Math.max(0,idx-1));else if(e.key==="Home")next=0;else if(e.key==="End")next=items.length-1;if(next>=0&&next!==idx){e.preventDefault();items[next].focus();this._current=next;items.forEach((it,i)=>{if(i===next)it.setAttribute("aria-current","step");else it.removeAttribute("aria-current");it.tabIndex=i===next?0:-1});if(idx>=0)items[idx].tabIndex=-1;const title=items[next].querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:true,composed:true,detail:{index:next,title}}))}if((e.key==="Enter"||e.key===" ")&&idx>=0){e.preventDefault();const title=items[idx].querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-activate",{bubbles:true,composed:true,detail:{index:idx,title}}))}});this.addEventListener("click",(e)=>{const item=e.target&&e.target.closest?e.target.closest(".c-steps__item"):null;if(!item||!this.contains(item))return;const items=Array.from(this.querySelectorAll(".c-steps__item"));const idx=items.indexOf(item);if(idx<0)return;this._current=idx;items.forEach((it,i)=>{if(i===idx)it.setAttribute("aria-current","step");else it.removeAttribute("aria-current");it.tabIndex=i===idx?0:-1});const title=item.querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-activate",{bubbles:true,composed:true,detail:{index:idx,title}}))})}}}define("contour-steps",ContourSteps);class ContourLink extends ContourBase{static get observed(){return["href","label"]}static get properties(){return{href:{attribute:"href"},label:{attribute:"label"}}}render(){this.classList.add("c-link");const href=this.getAttribute("href");const label=this.getAttribute("label");const prevLink=this.querySelector("a");if(prevLink)prevLink.remove();if(href&&label){const a=document.createElement("a");a.href=href;a.textContent=label;this.appendChild(a)}}}define("contour-link",ContourLink);class ContourBrand extends ContourBase{static get observed(){return["name","tag"]}static get properties(){return{name:{attribute:"name"},tag:{attribute:"tag"}}}render(){this.classList.add("c-brand");const name=this.getAttribute("name");const tag=this.getAttribute("tag");if(name){const n=this.ensure(".c-brand__name",()=>{const el=document.createElement("span");el.className="c-brand__name";return el});n.textContent=name}else{const n=this.querySelector(".c-brand__name");if(n)n.remove()}if(tag){const t=this.ensure(".c-brand__tag",()=>{const el=document.createElement("span");el.className="c-brand__tag";return el});t.textContent=tag}else{const t=this.querySelector(".c-brand__tag");if(t)t.remove()}}}define("contour-brand",ContourBrand);class ContourSectionHead extends ContourBase{static get observed(){return["title","desc","heading"]}static get properties(){return{title:{attribute:"title"},desc:{attribute:"desc"}}}render(){this.classList.add("c-section-head");const title=this.getAttribute("title");const desc=this.getAttribute("desc");if(!this.querySelector(".c-icon-badge")){const badge=document.createElement("div");badge.className="c-icon-badge";badge.innerHTML='<svg aria-hidden="true"><use href="#i-crosshair" /></svg>';this.prepend(badge)}let content=this.querySelector(":scope > div:not(.c-icon-badge)");if(!content){content=document.createElement("div");this.appendChild(content)}if(title){const t=this.ensure(".c-section-head__title",()=>{const el=document.createElement(headingTag(this,"h2"));el.className="c-section-head__title";return el});t.textContent=title;if(t.parentNode!==content)content.appendChild(t)}else{const t=this.querySelector(".c-section-head__title");if(t)t.remove()}if(desc){const d=this.ensure(".c-section-head__desc",()=>{const el=document.createElement("p");el.className="c-section-head__desc";return el});d.textContent=desc;if(d.parentNode!==content)content.appendChild(d)}else{const d=this.querySelector(".c-section-head__desc");if(d)d.remove()}}}define("contour-section-head",ContourSectionHead);class ContourDiff extends ContourBase{static get observed(){return["before","after"]}static get properties(){return{before:{attribute:"before"},after:{attribute:"after"}}}render(){this.classList.add("c-diff");this.setAttribute("role","group");this.setAttribute("aria-label","Diff");Array.from(this.querySelectorAll(".c-diff__line")).forEach((n)=>n.remove());const line=(kind,sign,text)=>{const el=document.createElement("div");el.className=kind?`c-diff__line c-diff__line--${kind}`:"c-diff__line";el.setAttribute("role","listitem");const s=document.createElement("span");s.className="c-diff__sign";s.textContent=sign;const code=document.createElement("span");code.textContent=text;el.append(s,code);return el};const before=this.getAttribute("before");const after=this.getAttribute("after");if(before)this.appendChild(line("del","−",before));if(after)this.appendChild(line("add","+",after))}enhance(){if(this._wiredDiff)return;this._wiredDiff=true;this.addEventListener("click",(e)=>{const line=e.target&&e.target.closest?e.target.closest(".c-diff__line"):null;if(line&&this.contains(line)){const kind=line.classList.contains("c-diff__line--add")?"add":line.classList.contains("c-diff__line--del")?"del":"context";const text=line.querySelector("span:last-child")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:diff-activate",{bubbles:true,composed:true,detail:{kind,text}}))}})}}define("contour-diff",ContourDiff);class ContourDoDont extends ContourBase{static get observed(){return["do","dont"]}static get properties(){return{do:{attribute:"do"},dont:{attribute:"dont"}}}render(){this.classList.add("c-do-dont");this.setAttribute("role","group");this.setAttribute("aria-label","Do and don't");Array.from(this.querySelectorAll(".c-do-dont__item")).forEach((n)=>n.remove());const item=(kind,word,text)=>{const el=document.createElement("div");el.className=`c-do-dont__item c-do-dont__item--${kind}`;el.setAttribute("role","listitem");const label=document.createElement("p");label.className="c-do-dont__label";label.textContent=word;const body=document.createElement("p");body.className="u-muted";body.textContent=text;el.append(label,body);return el};const doText=this.getAttribute("do");const dontText=this.getAttribute("dont");if(doText)this.appendChild(item("do","Do",doText));if(dontText)this.appendChild(item("dont","Don't",dontText))}enhance(){if(this._wiredDoDont)return;this._wiredDoDont=true;this.addEventListener("click",(e)=>{const item=e.target&&e.target.closest?e.target.closest(".c-do-dont__item"):null;if(item&&this.contains(item)){const kind=item.classList.contains("c-do-dont__item--do")?"do":"dont";const text=item.querySelector(".u-muted")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:do-dont-activate",{bubbles:true,composed:true,detail:{kind,text}}))}})}}define("contour-do-dont",ContourDoDont);class ContourFlag extends ContourBase{static get observed(){return["variant","label"]}static get properties(){return{variant:{attribute:"variant"},label:{attribute:"label"}}}render(){this.classList.add("c-flag");const variant=this.getAttribute("variant");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-flag--"))this.classList.remove(c)});if(variant)this.classList.add("c-flag--"+variant);const label=this.getAttribute("label");if(label){this.textContent=label}}}define("contour-flag",ContourFlag);class ContourInstallFull extends ContourBase{static get observed(){return["command","prompt","copyable"]}static get properties(){return{command:{attribute:"command"},prompt:{attribute:"prompt"},copyable:{attribute:"copyable"}}}render(){this.classList.add("c-install");const prompt=this.getAttribute("prompt")||"$";const command=this.getAttribute("command")||"";if(command){const p=this.ensure(".c-install__prompt",()=>{const el=document.createElement("span");el.className="c-install__prompt";return el});p.textContent=prompt;const c=this.ensure(".c-install__command",()=>{const el=document.createElement("span");el.className="c-install__command";return el});c.textContent=command;if(this.hasAttribute("copyable")){this.ensure(".c-install__copy",()=>{const btn=document.createElement("button");btn.className="c-btn c-btn--ghost c-btn--sm c-install__copy";btn.type="button";btn.setAttribute("aria-label","Copy command");btn.textContent="Copy";return btn})}else{const btn=this.querySelector(".c-install__copy");if(btn)btn.remove()}}}enhance(){wireCopy(this)}}define("contour-install",ContourInstallFull);class ContourTestimonialFull extends ContourBase{static get observed(){return["quote","name","role"]}static get properties(){return{quote:{attribute:"quote"},name:{attribute:"name"},role:{attribute:"role"}}}render(){this.classList.add("c-testimonial");const quote=this.getAttribute("quote");if(quote){const q=this.ensure(".c-testimonial__quote",()=>{const el=document.createElement("blockquote");el.className="c-testimonial__quote";return el});q.textContent=quote}else{const q=this.querySelector(".c-testimonial__quote");if(q)q.remove()}const name=this.getAttribute("name");const role=this.getAttribute("role");if(name){const by=this.ensure(".c-testimonial__byline",()=>{const el=document.createElement("div");el.className="c-testimonial__byline";return el});const n=by.querySelector(".c-testimonial__name")||(()=>{const el=document.createElement("span");el.className="c-testimonial__name";by.appendChild(el);return el})();n.className="c-testimonial__name";n.textContent=name;if(role){const r=by.querySelector(".c-testimonial__role")||(()=>{const el=document.createElement("span");el.className="c-testimonial__role";by.appendChild(el);return el})();r.className="c-testimonial__role";r.textContent=role}else{const r=by.querySelector(".c-testimonial__role");if(r)r.remove()}}else{const by=this.querySelector(".c-testimonial__byline");if(by)by.remove()}}}define("contour-testimonial",ContourTestimonialFull);class ContourShowcaseFull extends ContourBase{static get observed(){return["title","text","media","reverse","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","heading"]}static get properties(){return{title:{attribute:"title"},text:{attribute:"text"},media:{attribute:"media"},reverse:{attribute:"reverse"},items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-showcase");if(this.hasAttribute("reverse"))this.classList.add("c-showcase--reverse");else this.classList.remove("c-showcase--reverse");const title=this.getAttribute("title");if(title)this.setAttribute("aria-label",title);else this.removeAttribute("aria-label");this.setAttribute("role","region");wireStates(this);loadRemote(this,"items");if(renderStates(this,"showcase"))return;const items=remoteData(this,"items");const text=this.getAttribute("text");const media=this.getAttribute("media");if(media){const m=this.ensure(".c-showcase__media",()=>{const el=document.createElement("div");el.className="c-showcase__media";el.setAttribute("role","img");return el});m.innerHTML=sanitizeHtml(media);if(title)m.setAttribute("aria-label",title)}else{const m=this.querySelector(".c-showcase__media");if(m)m.remove()}if(title){const t=this.ensure(".c-showcase__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-showcase__title";return el});t.textContent=title}else{const t=this.querySelector(".c-showcase__title");if(t)t.remove()}if(text){const p=this.ensure(".c-showcase__text",()=>{const el=document.createElement("p");el.className="c-showcase__text";return el});p.textContent=text}else{const p=this.querySelector(".c-showcase__text");if(p)p.remove()}const ul=this.querySelector(".c-showcase__list");const authored=ul?Array.from(ul.children).filter((n)=>n.tagName==="LI"):[];if(items&&!authored.length){try{const parsed=JSON.parse(items);const l=this.ensure(".c-showcase__list",()=>{const el=document.createElement("ul");el.className="c-showcase__list";return el});l.innerHTML="";parsed.forEach((it)=>{const li=document.createElement("li");li.textContent=typeof it==="string"?it:it.label;l.appendChild(li)})}catch(e){}}else if(!items&&!authored.length&&!title&&!text&&!media){renderEmpty(this,"showcase")}else if(!items&&ul){ul.remove()}}enhance(){if(this._wiredShowcase)return;this._wiredShowcase=true;this.addEventListener("click",(e)=>{const media=e.target&&e.target.closest?e.target.closest(".c-showcase__media"):null;if(media&&this.contains(media)){const title=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:showcase-activate",{bubbles:true,composed:true,detail:{title}}))}})}}define("contour-showcase",ContourShowcaseFull);class ContourPricingFull extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-pricing")}}define("contour-pricing",ContourPricingFull);class ContourRecipeFull extends ContourBase{static get observed(){return["title","body","canvas","heading"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},canvas:{attribute:"canvas"}}}render(){this.classList.add("c-recipe");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-recipe__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-recipe__title";return el});t.textContent=title}else{const t=this.querySelector(".c-recipe__title");if(t)t.remove()}const body=this.getAttribute("body");if(body){const b=this.ensure(".c-recipe__desc",()=>{const el=document.createElement("p");el.className="c-recipe__desc";return el});b.textContent=body}else{const b=this.querySelector(".c-recipe__desc");if(b)b.remove()}const canvas=this.getAttribute("canvas");if(canvas){const c=this.ensure(".c-recipe__canvas",()=>{const el=document.createElement("div");el.className="c-recipe__canvas";return el});c.innerHTML=sanitizeHtml(canvas)}else{const c=this.querySelector(".c-recipe__canvas");if(c)c.remove()}}}define("contour-recipe",ContourRecipeFull);class ContourLogosFull extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-logos");if(!this.querySelector(".c-logos__item")){for(const name of["Cartolab","Nordwand"]){const span=document.createElement("span");span.className="c-logos__item";span.textContent=name;this.appendChild(span)}}}}define("contour-logos",ContourLogosFull);class ContourLandingFeaturesFull extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-landing-features");wireStates(this);loadRemote(this,"items");if(renderStates(this,"landing-features"))return;const items=remoteData(this,"items");const authored=Array.from(this.children).filter((n)=>n.classList&&n.classList.contains("c-landing-features__item"));if(items&&!authored.length){try{const parsed=JSON.parse(items);this.querySelectorAll(".c-landing-features__item").forEach((el)=>el.remove());parsed.forEach((it)=>{const item=document.createElement("div");item.className="c-landing-features__item";if(it.icon){const ic=document.createElement("span");ic.className="c-landing-features__icon";ic.innerHTML='<svg aria-hidden="true"><use href="#'+String(it.icon).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>';item.appendChild(ic)}if(it.title){const t=document.createElement("span");t.className="c-landing-features__title";t.textContent=it.title;item.appendChild(t)}if(it.text){const tx=document.createElement("p");tx.className="c-landing-features__text";tx.textContent=it.text;item.appendChild(tx)}this.appendChild(item)})}catch(e){}}else if(!items&&!authored.length){this.querySelectorAll(".c-landing-features__item").forEach((el)=>el.remove());renderEmpty(this,"landing-features")}}}define("contour-landing-features",ContourLandingFeaturesFull);class ContourLandingHeroFull extends ContourBase{static get observed(){return["actions","title","text","heading"]}static get properties(){return{actions:{attribute:"actions"},title:{attribute:"title"},text:{attribute:"text"}}}render(){this.classList.add("c-landing-hero");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-landing-hero__title",()=>{const el=document.createElement(headingTag(this,"h1"));el.className="c-landing-hero__title";return el});t.textContent=title}const text=this.getAttribute("text");if(text){const t=this.ensure(".c-landing-hero__text",()=>{const el=document.createElement("p");el.className="c-landing-hero__text";return el});t.textContent=text}const actions=this.getAttribute("actions");const a=this.querySelector(".c-landing-hero__actions");const authored=a?Array.from(a.children):[];if(actions&&!authored.length){const el=this.ensure(".c-landing-hero__actions",()=>{const e=document.createElement("div");e.className="c-landing-hero__actions";return e});el.innerHTML=sanitizeHtml(actions)}else if(!actions&&a&&!authored.length){a.remove()}}}define("contour-landing-hero",ContourLandingHeroFull);class ContourLinkishFull extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-linkish")}}define("contour-linkish",ContourLinkishFull);class ContourPriceFull extends ContourBase{static get observed(){return["value"]}static get properties(){return{value:{attribute:"value"}}}render(){this.classList.add("c-price");const value=this.getAttribute("value");if(value)this.textContent=value}}define("contour-price",ContourPriceFull);class ContourProseFull extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-prose")}}define("contour-prose",ContourProseFull);class ContourPanel extends ContourBase{static get observed(){return["title","subtitle","status","heading"]}static get properties(){return{title:{attribute:"title"},subtitle:{attribute:"subtitle"},status:{attribute:"status"}}}render(){this.classList.add("c-panel");const title=this.getAttribute("title");const subtitle=this.getAttribute("subtitle");const status=this.getAttribute("status");if(title){const h=this.ensure(".c-panel__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-panel__title";return el});if(h.parentNode===this&&this.firstChild!==h)this.prepend(h);h.textContent=title}else{const h=this.querySelector(".c-panel__title");if(h)h.remove()}if(subtitle){const sub=this.ensure(".c-panel__subtitle",()=>{const el=document.createElement("p");el.className="c-panel__subtitle";return el});sub.textContent=subtitle}else{const sub=this.querySelector(".c-panel__subtitle");if(sub)sub.remove()}if(status){const st=this.ensure(".c-panel__status",()=>{const el=document.createElement("span");el.className="c-panel__status";return el});st.textContent=status}else{const st=this.querySelector(".c-panel__status");if(st)st.remove()}const body=this.ensure(".c-panel__body",()=>{const el=document.createElement("div");el.className="c-panel__body";return el});const head=this.querySelector(".c-panel__head");Array.from(this.childNodes).forEach((n)=>{if(n===body||n===head)return;if(n.nodeType===1&&(n.classList.contains("c-panel__title")||n.classList.contains("c-panel__subtitle")||n.classList.contains("c-panel__status")))return;body.appendChild(n)});if(!body.parentNode)this.appendChild(body);if(head&&head.parentNode===this&&body.parentNode===this&&head.compareDocumentPosition(body)&Node.DOCUMENT_POSITION_PRECEDING){this.insertBefore(body,head.nextSibling)}}}define("contour-panel",ContourPanel);class ContourCta extends ContourBase{static get observed(){return["title","text","actions","heading"]}static get properties(){return{title:{attribute:"title"},text:{attribute:"text"},actions:{attribute:"actions"}}}render(){this.classList.add("c-cta");const title=this.getAttribute("title");const text=this.getAttribute("text");if(title){const t=this.ensure(".c-cta__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-cta__title";return el});t.textContent=title}else{const t=this.querySelector(".c-cta__title");if(t)t.remove()}if(text){const p=this.ensure(".c-cta__text",()=>{const el=document.createElement("p");el.className="c-cta__text";return el});p.textContent=text}else{const p=this.querySelector(".c-cta__text");if(p)p.remove()}const actions=this.getAttribute("actions");const prevWrap=this.querySelector(".c-cta__actions");if(prevWrap)prevWrap.remove();if(actions){try{const parsed=JSON.parse(actions);const wrap=document.createElement("div");wrap.className="c-cta__actions";parsed.forEach((a)=>{const btn=document.createElement("button");btn.className="c-btn c-btn--primary";btn.type="button";btn.textContent=typeof a==="string"?a:(a.label||a);wrap.appendChild(btn)});this.appendChild(wrap)}catch(e){}}}}define("contour-cta",ContourCta);class ContourCode extends ContourBase{static get observed(){return["title","copyable"]}static get properties(){return{title:{attribute:"title"},copyable:{attribute:"copyable",type:Boolean}}}render(){this.classList.add("c-code");const title=this.getAttribute("title");if(title){const head=this.ensure(".c-code__head",()=>{const el=document.createElement("div");el.className="c-code__head";return el});if(head.parentNode===this&&this.firstChild!==head)this.prepend(head);const t=head.querySelector(".c-code__title")||(()=>{const el=document.createElement("div");el.className="c-code__title";head.appendChild(el);return el})();t.textContent=title}else{const head=this.querySelector(".c-code__head");if(head)head.remove();const t=this.querySelector(".c-code__title");if(t)t.remove()}if(this.hasAttribute("copyable")){this.ensure(".c-code__copy",()=>{const btn=document.createElement("button");btn.className="c-code__copy";btn.type="button";btn.textContent="Copy";return btn})}else{const btn=this.querySelector(".c-code__copy");if(btn)btn.remove()}const pre=this.ensure("pre",()=>{const el=document.createElement("pre");return el});Array.from(this.childNodes).forEach((n)=>{if(n===pre||(n.nodeType===1&&(n.classList.contains("c-code__head")||n.classList.contains("c-code__copy"))))return;pre.appendChild(n)});if(!pre.querySelector("code")){const code=document.createElement("code");while(pre.firstChild)code.appendChild(pre.firstChild);pre.appendChild(code)}if(pre.parentNode!==this)this.appendChild(pre);const head=this.querySelector(".c-code__head");if(head&&head.parentNode===this&&pre.parentNode===this&&head.compareDocumentPosition(pre)&Node.DOCUMENT_POSITION_PRECEDING){this.insertBefore(pre,head.nextSibling)}}enhance(){wireCopy(this)}}define("contour-code",ContourCode);class ContourPlate extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-plate")}}define("contour-plate",ContourPlate);class ContourPullquote extends ContourBase{static get observed(){return["quote","name"]}static get properties(){return{quote:{attribute:"quote"},name:{attribute:"name"}}}render(){this.classList.add("c-pullquote");const quote=this.getAttribute("quote");if(quote){Array.from(this.childNodes).forEach((n)=>{if(n.nodeType===3)n.remove()});const cite=this.querySelector("cite");this.insertBefore(document.createTextNode(quote),cite)}const name=this.getAttribute("name");if(name){const by=this.ensure("cite",()=>{const el=document.createElement("cite");this.appendChild(el);return el});by.textContent=name}else{const by=this.querySelector("cite");if(by)by.remove()}}}define("contour-pullquote",ContourPullquote);class ContourAnchor extends ContourBase{static get observed(){return["href","label"]}static get properties(){return{href:{attribute:"href"},label:{attribute:"label"}}}render(){this.classList.add("c-anchor");const href=this.getAttribute("href");const label=this.getAttribute("label");const prevAnchor=this.querySelector("a");if(prevAnchor)prevAnchor.remove();if(href&&label){const a=document.createElement("a");a.href=href;a.textContent=label;this.appendChild(a)}}}define("contour-anchor",ContourAnchor);class ContourDashShell extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-dash-shell");this.setAttribute("role","region");const title=this.getAttribute("title");if(title){const bar=this.ensure(".c-dash-toolbar",()=>{const el=document.createElement("div");el.className="c-dash-toolbar";return el});const h=bar.querySelector(".c-dash-toolbar__title")||(()=>{const el=document.createElement("span");el.className="c-dash-toolbar__title";bar.appendChild(el);return el})();h.textContent=title;this.setAttribute("aria-label",title)}}}define("contour-dash-shell",ContourDashShell);class ContourDashToolbar extends ContourBase{static get observed(){return["title","actions"]}static get properties(){return{title:{attribute:"title"},actions:{attribute:"actions"}}}render(){this.classList.add("c-dash-toolbar");this.setAttribute("role","toolbar");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-dash-toolbar__title",()=>{const el=document.createElement("span");el.className="c-dash-toolbar__title";return el});t.textContent=title;this.setAttribute("aria-label",title)}else{const t=this.querySelector(".c-dash-toolbar__title");if(t)t.remove()}const actions=this.getAttribute("actions");if(actions){try{const parsed=JSON.parse(actions);const wrap=this.ensure(".c-dash-toolbar__actions",()=>{const el=document.createElement("div");el.className="c-dash-toolbar__actions";return el});wrap.innerHTML="";parsed.forEach((a)=>{const btn=document.createElement("button");btn.className="c-btn c-btn--ghost c-btn--sm";btn.type="button";btn.textContent=typeof a==="string"?a:(a.label||a);wrap.appendChild(btn)})}catch(e){}}else{const w=this.querySelector(".c-dash-toolbar__actions");if(w)w.remove()}}enhance(){if(this._wiredDashToolbar)return;this._wiredDashToolbar=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-btn"):null;if(btn&&this.contains(btn)){const label=btn.textContent||"";this.dispatchEvent(new CustomEvent("contour:dash-action",{bubbles:true,composed:true,detail:{label}}))}})}}define("contour-dash-toolbar",ContourDashToolbar);class ContourDashKpiRow extends ContourBase{static get observed(){return["items"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-dash-kpi-row");this.setAttribute("role","group");Array.from(this.querySelectorAll("contour-kpi")).forEach((n)=>n.remove());const items=this.getAttribute("items");let parsed=null;if(items){try{parsed=JSON.parse(items)}catch(e){parsed=null}}if(Array.isArray(parsed)&&parsed.length){parsed.forEach((it)=>{const k=document.createElement("contour-kpi");if(typeof it==="object"&&it!==null){if(it.value!==undefined)k.setAttribute("value",String(it.value));if(it.label!==undefined)k.setAttribute("label",String(it.label))}else{k.setAttribute("value",String(it))}this.appendChild(k)})}else if(!this.querySelector("contour-kpi")){const k=document.createElement("contour-kpi");k.setAttribute("value","0");k.setAttribute("label","KPI");this.appendChild(k)}}}define("contour-dash-kpi-row",ContourDashKpiRow);class ContourDashFreshness extends ContourBase{static get observed(){return["label","value"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"}}}render(){this.classList.add("c-dash-freshness");this.setAttribute("role","status");this.setAttribute("aria-live","polite");const label=this.getAttribute("label");const value=this.getAttribute("value");const dot=this.ensure(".c-dot",()=>{const el=document.createElement("span");el.className="c-dot c-dot--live c-dot--accent";el.setAttribute("aria-hidden","true");return el});if(dot.parentNode!==this)this.appendChild(dot);if(!this._freshnessText||!this._freshnessText.parentNode){this._freshnessText=document.createTextNode("");this.appendChild(this._freshnessText)}this._freshnessText.nodeValue=[label,value].filter(Boolean).join(" ")}}define("contour-dash-freshness",ContourDashFreshness);class ContourReadout extends ContourBase{static get observed(){return["rows","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","format","locale"]}static get properties(){return{rows:{attribute:"rows"},format:{attribute:"format"},locale:{attribute:"locale"},src:{attribute:"src"}}}render(){this.classList.add("c-readout");wireStates(this);loadRemote(this,"rows");if(renderStates(this,"readout"))return;const rows=remoteData(this,"rows");Array.from(this.querySelectorAll(".c-readout__row")).forEach((n)=>n.remove());const authored=Array.from(this.children).filter((n)=>!n.classList||!n.classList.contains("c-readout__row"));if(rows&&!authored.length){try{const parsed=JSON.parse(rows);parsed.forEach((r)=>{const row=document.createElement("div");row.className="c-readout__row";const key=document.createElement("span");key.className="c-readout__key";key.textContent=r.key||r[0];const val=document.createElement("span");val.className="c-readout__value"+(r.primary?" c-readout__value--primary":"")+(r.accent?" c-readout__value--accent":"")+(r.coord?" c-readout__value--coord":"");val.setAttribute("aria-live","polite");val.textContent=formatValue(r.value||r[1],this.getAttribute("format"),this.getAttribute("locale"));row.appendChild(key);row.appendChild(val);if(r.order){const ord=document.createElement("span");ord.className="c-readout__order";ord.textContent=r.order;row.appendChild(ord)}this.appendChild(row)})}catch(e){}}else if(!rows&&!authored.length){renderEmpty(this,"readout")}}}define("contour-readout",ContourReadout);class ContourKpi extends ContourBase{static get observed(){return["value","label","delta","direction","note","variant","unit","format","locale","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","thresholds","threshold","sparkline","polarity"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"},delta:{attribute:"delta"},direction:{attribute:"direction"},note:{attribute:"note"},variant:{attribute:"variant"},unit:{attribute:"unit"},format:{attribute:"format"},locale:{attribute:"locale"},thresholds:{attribute:"thresholds"},threshold:{attribute:"threshold"},sparkline:{attribute:"sparkline"},polarity:{attribute:"polarity"}}}render(){this.classList.add("c-kpi");wireStates(this);loadRemote(this,["value","label"]);if(renderStates(this,"kpi"))return;const value=remoteData(this,"value");const label=remoteData(this,"label");const delta=this.getAttribute("delta");const variant=this.getAttribute("variant");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-kpi--"))this.classList.remove(c)});if(variant)this.classList.add("c-kpi--"+variant);if(value){const v=this.ensure(".c-kpi__value",()=>{const el=document.createElement("div");el.className="c-kpi__value";el.setAttribute("aria-live","polite");return el});v.textContent=formatValue(value,this.getAttribute("format"),this.getAttribute("locale"))}else{const v=this.querySelector(".c-kpi__value");if(v)v.remove()}if(label){const h=this.ensure(".c-kpi__head",()=>{const el=document.createElement("div");el.className="c-kpi__head";return el});let l=h.querySelector(".c-kpi__label");if(!l){l=document.createElement("div");l.className="c-kpi__label";h.appendChild(l)}l.textContent=label;if(h.parentNode!==this)this.insertBefore(h,this.firstChild)}else{const h=this.querySelector(".c-kpi__head");if(h)h.remove()}if(delta){const f=this.ensure(".c-kpi__foot",()=>{const el=document.createElement("div");el.className="c-kpi__foot";return el});const d=f.querySelector(".c-delta")||document.createElement("span");if(!d.parentNode)f.insertBefore(d,f.firstChild);d.className="c-delta c-delta--"+(this.getAttribute("direction")||"up");d.textContent=delta}else{const d=this.querySelector(".c-kpi__foot .c-delta");if(d)d.remove()}const note=this.getAttribute("note");if(note){const f=this.ensure(".c-kpi__foot",()=>{const el=document.createElement("div");el.className="c-kpi__foot";return el});const n=f.querySelector(".c-kpi__note")||(()=>{const el=document.createElement("span");el.className="c-kpi__note";f.appendChild(el);return el})();n.textContent=note}else{const n=this.querySelector(".c-kpi__note");if(n)n.remove()}const unit=this.getAttribute("unit");const v=this.querySelector(".c-kpi__value");if(v){if(unit){let u=v.querySelector(".c-kpi__unit");if(!u){u=document.createElement("span");u.className="c-kpi__unit";v.appendChild(u)}u.textContent=unit}else{const u=v.querySelector(".c-kpi__unit");if(u)u.remove()}}const threshold=this.getAttribute("threshold")||this.getAttribute("thresholds");if(threshold){const f=this.ensure(".c-kpi__foot",()=>{const el=document.createElement("div");el.className="c-kpi__foot";return el});let badge=f.querySelector(".c-kpi__threshold-badge");if(!badge){badge=document.createElement("span");badge.className="c-kpi__threshold-badge";f.appendChild(badge)}badge.textContent=threshold;badge.setAttribute("part","threshold-badge")}else{const b=this.querySelector(".c-kpi__threshold-badge");if(b)b.remove()}const foot=this.querySelector(".c-kpi__foot");if(foot&&!foot.querySelector(".c-delta, .c-kpi__note, .c-kpi__threshold-badge"))foot.remove();const spark=this.getAttribute("sparkline");if(spark){let canvas=this.querySelector(".c-kpi__sparkline-canvas");if(!canvas){canvas=document.createElement("canvas");canvas.className="c-kpi__sparkline-canvas";canvas.setAttribute("part","sparkline-canvas");this.appendChild(canvas)}}else{const c=this.querySelector(".c-kpi__sparkline-canvas");if(c)c.remove()}if(!value&&!label){renderEmpty(this,"kpi")}}}define("contour-kpi",ContourKpi);class ContourTable extends ContourBase{static get observed(){return["columns","rows","page","page-size","sort","sort-dir","virtual","empty","loading","error","retry","skeleton","persist"]}static get properties(){return{columns:{attribute:"columns"},rows:{attribute:"rows"},page:{attribute:"page",type:Number},pageSize:{attribute:"page-size",type:Number}}}_cellValue(cell){if(cell===null||cell===undefined)return"";if(typeof cell==="object")return cell.value!==undefined?cell.value:(cell.label!==undefined?cell.label:JSON.stringify(cell));return cell}_compare(a,b,type){const av=this._cellValue(a);const bv=this._cellValue(b);if(type==="number"||type==="numeric"){return(parseFloat(av)||0)-(parseFloat(bv)||0)}return String(av).localeCompare(String(bv),undefined,{numeric:true})}render(){const columns=this.getAttribute("columns");const rows=this.getAttribute("rows");const authored=Array.from(this.children).filter((n)=>!n.classList||!n.classList.contains("c-table-wrap"));if(columns&&rows&&!authored.length){try{const cols=JSON.parse(columns);const data=JSON.parse(rows);if(this.hasAttribute("loading")){const wrap=this.ensure(".c-table-wrap",()=>{const el=document.createElement("div");el.className="c-table-wrap";return el});const colsKey=JSON.stringify(cols);const table=(wrap.querySelector("table.c-table")&&this._tableCols===colsKey)?wrap.querySelector("table.c-table"):(()=>{const t=document.createElement("table");t.className="c-table";const thead=document.createElement("thead");const tr=document.createElement("tr");cols.forEach((c)=>{const colLabel=typeof c==="string"?c:(c.label||c.title||c);const th=document.createElement("th");th.textContent=colLabel;tr.appendChild(th)});thead.appendChild(tr);t.appendChild(thead);t.appendChild(document.createElement("tbody"));return t})();this._tableCols=colsKey;const tbody=table.querySelector("tbody");tbody.innerHTML="";const tr=document.createElement("tr");const td=document.createElement("td");td.colSpan=cols.length;td.style.textAlign="center";td.style.color="var(--color-text-muted)";td.textContent=this.getAttribute("loading")||"Loading…";tr.appendChild(td);tbody.appendChild(tr);if(table.parentNode!==wrap){wrap.innerHTML="";wrap.appendChild(table)}if(wrap.parentNode!==this)this.appendChild(wrap);const footer=this.querySelector(".c-table__pagination");if(footer)footer.remove();return}if(this.hasAttribute("error")){const wrap=this.ensure(".c-table-wrap",()=>{const el=document.createElement("div");el.className="c-table-wrap";return el});const colsKey=JSON.stringify(cols);const table=(wrap.querySelector("table.c-table")&&this._tableCols===colsKey)?wrap.querySelector("table.c-table"):(()=>{const t=document.createElement("table");t.className="c-table";const thead=document.createElement("thead");const tr=document.createElement("tr");cols.forEach((c)=>{const colLabel=typeof c==="string"?c:(c.label||c.title||c);const th=document.createElement("th");th.textContent=colLabel;tr.appendChild(th)});thead.appendChild(tr);t.appendChild(thead);t.appendChild(document.createElement("tbody"));return t})();this._tableCols=colsKey;const tbody=table.querySelector("tbody");tbody.innerHTML="";const tr=document.createElement("tr");const td=document.createElement("td");td.colSpan=cols.length;td.textContent=this.getAttribute("error")||"Error";td.style.textAlign="center";td.style.color="var(--color-danger, var(--color-text))";if(this.hasAttribute("retry")){const btn=document.createElement("button");btn.className="c-btn c-btn--ghost c-btn--sm";btn.type="button";btn.textContent=this.getAttribute("retry")||"Retry";btn.style.marginInlineStart="var(--space-sm)";btn.dataset.action="retry";td.appendChild(btn)}tr.appendChild(td);tbody.appendChild(tr);if(table.parentNode!==wrap){wrap.innerHTML="";wrap.appendChild(table)}if(wrap.parentNode!==this)this.appendChild(wrap);const footer=this.querySelector(".c-table__pagination");if(footer)footer.remove();return}if(this.hasAttribute("skeleton")){const wrap=this.ensure(".c-table-wrap",()=>{const el=document.createElement("div");el.className="c-table-wrap";return el});const colsKey=JSON.stringify(cols);const table=(wrap.querySelector("table.c-table")&&this._tableCols===colsKey)?wrap.querySelector("table.c-table"):(()=>{const t=document.createElement("table");t.className="c-table";const thead=document.createElement("thead");const tr=document.createElement("tr");cols.forEach((c)=>{const colLabel=typeof c==="string"?c:(c.label||c.title||c);const th=document.createElement("th");th.textContent=colLabel;tr.appendChild(th)});thead.appendChild(tr);t.appendChild(thead);t.appendChild(document.createElement("tbody"));return t})();this._tableCols=colsKey;const tbody=table.querySelector("tbody");tbody.innerHTML="";const count=Math.min(5,Math.max(1,parseInt(this.getAttribute("skeleton")||"3",10)||3));for(let i=0;i<count;i++){const tr=document.createElement("tr");cols.forEach(()=>{const td=document.createElement("td");const sk=document.createElement("span");sk.className="c-skeleton";sk.style.display="inline-block";sk.style.inlineSize="60%";sk.style.blockSize="0.8rem";td.appendChild(sk);tr.appendChild(td)});tbody.appendChild(tr)}if(table.parentNode!==wrap){wrap.innerHTML="";wrap.appendChild(table)}if(wrap.parentNode!==this)this.appendChild(wrap);const footer=this.querySelector(".c-table__pagination");if(footer)footer.remove();return}if(this._sortCol===undefined){const sortAttr=this.getAttribute("sort");if(sortAttr!==null){const idx=Number(sortAttr);this._sortCol=Number.isFinite(idx)?idx:cols.findIndex((c)=>(typeof c==="object"&&c&&(c.label||c.title||c)===sortAttr));if(this._sortCol<0)this._sortCol=null}else{this._sortCol=null}const dirAttr=this.getAttribute("sort-dir");this._sortDir=dirAttr==="descending"||dirAttr==="desc"?-1:1}let working=Array.isArray(data)?data.slice():[];if(this._sortCol!==null&&this._sortCol!==undefined&&this._sortCol>=0&&this._sortCol<cols.length){const col=this._sortCol;const dir=this._sortDir||1;const colSpec=cols[col];const type=(typeof colSpec==="object"&&colSpec&&colSpec.sortType)?colSpec.sortType:"text";working.sort((a,b)=>this._compare(a&&a[col],b&&b[col],type)*dir)}if(!this._filters)this._filters={};const activeFilters=Object.keys(this._filters).filter((k)=>this._filters[k]);if(activeFilters.length){working=working.filter((row)=>activeFilters.every((k)=>{const ci=Number(k);const q=String(this._filters[ci]||"").toLowerCase();if(!q)return true;return String(this._cellValue(row[ci])).toLowerCase().includes(q)}))}const pageSizeRaw=this.getAttribute("page-size");const pageSize=pageSizeRaw!==null?parseInt(pageSizeRaw,10):NaN;const usePaging=Number.isFinite(pageSize)&&pageSize>0;let pageAttr=this.getAttribute("page");if(this.getAttribute("persist")&&this.id){const mode=this.getAttribute("persist");let stored=null;if(mode==="storage"){try{stored=localStorage.getItem("contour-table:"+this.id)}catch(e){}}else if(mode==="url"){try{stored=new URLSearchParams(window.location.search).get("c-table")}catch(e){}}if(stored!==null)pageAttr=stored}if(this._pageInternal){this._pageInternal=false;this._pageAttrLast=pageAttr}else if(pageAttr!==this._pageAttrLast){this._page=null;this._pageAttrLast=pageAttr}let page=this._page!==null?this._page:(parseInt(pageAttr||"1",10));if(!Number.isFinite(page)||page<1)page=1;let totalPages=1;let pageData=working;if(usePaging){totalPages=Math.max(1,Math.ceil(working.length/pageSize));if(page>totalPages)page=totalPages;const start=(page-1)*pageSize;pageData=working.slice(start,start+pageSize)}this._page=page;this._totalPages=totalPages;this._pageSize=pageSize;const wrap=this.ensure(".c-table-wrap",()=>{const el=document.createElement("div");el.className="c-table-wrap";return el});const colsKey=JSON.stringify(cols);const table=(wrap.querySelector("table.c-table")&&this._tableCols===colsKey)?wrap.querySelector("table.c-table"):(()=>{const t=document.createElement("table");t.className="c-table";const thead=document.createElement("thead");const tr=document.createElement("tr");cols.forEach((c,i)=>{const colLabel=typeof c==="string"?c:(c.label||c.title||c);const th=document.createElement("th");const sortable=(typeof c==="object"&&c!==null&&c.sort);const isSelect=(typeof c==="object"&&c!==null&&c.select);const isFilter=(typeof c==="object"&&c!==null&&c.filter);if(isFilter){th.className=(th.className+" c-table__filter").trim();const inp=document.createElement("input");inp.type="search";inp.className="c-table__filter-input";inp.placeholder=colLabel;inp.dataset.filterIndex=String(i);if(this._filters&&this._filters[i])inp.value=this._filters[i];th.appendChild(inp)}else if(isSelect){th.className=(th.className+" c-table__select").trim();const cb=document.createElement("input");cb.type="checkbox";cb.className="c-table__select-all";cb.setAttribute("aria-label","Select all rows");th.appendChild(cb)}else if(sortable){th.setAttribute("aria-sort",(this._sortCol===i)?(this._sortDir===-1?"descending":"ascending"):"none");const wrapEl=document.createElement("span");wrapEl.className="c-table__sort";wrapEl.textContent=colLabel;const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("aria-hidden","true");svg.innerHTML='<use href="#i-chevron-down" />';wrapEl.appendChild(svg);th.appendChild(wrapEl)}else if(typeof c==="object"&&c!==null&&c.pinned){th.className="c-table__pinned";th.textContent=colLabel}else{th.textContent=colLabel}if(sortable){th.setAttribute("tabindex","0");th.setAttribute("role","columnheader");th.dataset.sortIndex=String(i)}tr.appendChild(th)});thead.appendChild(tr);t.appendChild(thead);t.appendChild(document.createElement("tbody"));return t})();this._tableCols=colsKey;cols.forEach((c,i)=>{if(typeof c==="object"&&c!==null&&c.sort){const th=table.querySelector("thead tr th:nth-child("+(i+1)+")");if(th)th.setAttribute("aria-sort",(this._sortCol===i)?(this._sortDir===-1?"descending":"ascending"):"none")}});const tbody=table.querySelector("tbody");tbody.innerHTML="";if(pageData.length===0){const tr=document.createElement("tr");const td=document.createElement("td");td.colSpan=cols.length;td.textContent=this.getAttribute("empty")||"No data";td.style.textAlign="center";td.style.color="var(--color-text-muted)";tr.appendChild(td);tbody.appendChild(tr)}else{pageData.forEach((row,ri)=>{const tr=document.createElement("tr");cols.forEach((c,ci)=>{const isSelect=(typeof c==="object"&&c!==null&&c.select);const td=document.createElement("td");if(isSelect){const cb=document.createElement("input");cb.type="checkbox";cb.className="c-table__row-select";cb.dataset.rowIndex=String(ri);if(this._selectedRows&&this._selectedRows.has(ri))cb.checked=true;td.appendChild(cb)}else{td.textContent=this._cellValue(row[ci])}tr.appendChild(td)});tbody.appendChild(tr)})}if(table.parentNode!==wrap){wrap.innerHTML="";wrap.appendChild(table)}if(wrap.parentNode!==this)this.appendChild(wrap);if(this.hasAttribute("virtual")){wrap.style.maxHeight=wrap.style.maxHeight||"24rem";wrap.style.overflow="auto";table.classList.add("c-table--virtual");Array.from(tbody.querySelectorAll("tr")).forEach((tr)=>{tr.style.contentVisibility="auto";tr.style.containIntrinsicSize="auto 2rem"})}else{wrap.style.maxHeight="";wrap.style.overflow="";table.classList.remove("c-table--virtual")}if(usePaging){const footer=this.ensure(".c-table__pagination",()=>{const el=document.createElement("div");el.className="c-table__pagination";return el});footer.innerHTML="";const prev=document.createElement("button");prev.className="c-btn c-btn--ghost c-btn--sm";prev.type="button";prev.textContent="Previous";prev.disabled=page<=1;prev.dataset.action="prev";const info=document.createElement("span");info.textContent=`Page ${page} of ${totalPages}`;const next=document.createElement("button");next.className="c-btn c-btn--ghost c-btn--sm";next.type="button";next.textContent="Next";next.disabled=page>=totalPages;next.dataset.action="next";footer.appendChild(prev);footer.appendChild(info);footer.appendChild(next)}else{const footer=this.querySelector(".c-table__pagination");if(footer)footer.remove()}}catch(e){}}}enhance(){if(this._wiredTable)return;this._wiredTable=true;const handleSort=(th)=>{const idx=Number(th.dataset.sortIndex);if(!Number.isFinite(idx))return;if(this._sortCol===idx){this._sortDir=(this._sortDir===1)?-1:1}else{this._sortCol=idx;this._sortDir=1}this.dispatchEvent(new CustomEvent("contour:sort",{bubbles:true,composed:true,detail:{column:idx,direction:this._sortDir===1?"ascending":"descending"}}));this.requestRender()};this.addEventListener("click",(e)=>{const retryBtn=e.target&&e.target.closest?e.target.closest('button[data-action="retry"]'):null;if(retryBtn&&this.contains(retryBtn)){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:retry",{detail:{src:this.getAttribute("src")},bubbles:true,composed:true}));return}const th=e.target&&e.target.closest?e.target.closest("th[aria-sort]"):null;if(th&&this.contains(th)){e.preventDefault();handleSort(th);return}const btn=e.target&&e.target.closest?e.target.closest(".c-table__pagination button"):null;if(btn&&this.contains(btn)){e.preventDefault();const action=btn.dataset.action;let page=this._page!==null?this._page:(parseInt(this.getAttribute("page")||"1",10));if(!Number.isFinite(page)||page<1)page=1;if(action==="prev"&&page>1)page-=1;if(action==="next")page+=1;this._page=page;this._pageAttrLast=String(page);this._pageInternal=true;this.setAttribute("page",String(page));this.dispatchEvent(new CustomEvent("contour:page",{bubbles:true,composed:true,detail:{page}}));const persist=this.getAttribute("persist");if(persist==="storage"&&this.id){try{localStorage.setItem("contour-table:"+this.id,String(page))}catch(e){}}else if(persist==="url"){try{const url=new URL(window.location.href);url.searchParams.set("c-table",String(page));window.history.replaceState(null,"",url.toString())}catch(e){}}}});this.addEventListener("keydown",(e)=>{if(e.key!=="Enter"&&e.key!==" ")return;const th=e.target&&e.target.closest?e.target.closest("th[aria-sort]"):null;if(th&&this.contains(th)){e.preventDefault();handleSort(th)}});this.addEventListener("input",(e)=>{const inp=e.target&&e.target.closest?e.target.closest(".c-table__filter-input"):null;if(!inp||!this.contains(inp))return;const idx=Number(inp.dataset.filterIndex);if(!Number.isFinite(idx))return;if(!this._filters)this._filters={};this._filters[idx]=inp.value;this.requestRender()});this._selectedRows=this._selectedRows||new Set();this.addEventListener("change",(e)=>{const cb=e.target&&e.target.closest?e.target.closest(".c-table__row-select"):null;if(cb&&this.contains(cb)){const idx=Number(cb.dataset.rowIndex);if(!Number.isFinite(idx))return;if(cb.checked)this._selectedRows.add(idx);else this._selectedRows.delete(idx);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{rows:Array.from(this._selectedRows)}}));return}const all=e.target&&e.target.closest?e.target.closest(".c-table__select-all"):null;if(all&&this.contains(all)){const cbs=Array.from(this.querySelectorAll(".c-table__row-select"));cbs.forEach((c)=>{c.checked=all.checked});this._selectedRows=new Set(all.checked?cbs.map((c)=>Number(c.dataset.rowIndex)):[]);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{rows:Array.from(this._selectedRows)}}))}})}}define("contour-table",ContourTable);class ContourChart extends ContourBase{static get observed(){return["series","axis","empty","loading","error","retry","skeleton","zoomable"]}static get properties(){return{series:{attribute:"series"},axis:{attribute:"axis"},zoomable:{attribute:"zoomable",type:Boolean}}}render(){this.classList.add("c-chart");if(!this.hasAttribute("role"))this.setAttribute("role","img");if(this.getAttribute("axis")&&!this.hasAttribute("aria-label"))this.setAttribute("aria-label",this.getAttribute("axis"));if(this.hasAttribute("loading")){const plot=this.ensure(".c-chart__plot",()=>{const el=document.createElement("div");el.className="c-chart__plot";return el});plot.innerHTML="";const loading=document.createElement("div");loading.className="c-chart__loading";loading.textContent=this.getAttribute("loading")||"Loading…";loading.style.display="grid";loading.style.placeItems="center";loading.style.height="100%";loading.style.color="var(--color-text-muted)";plot.appendChild(loading);const axis=this.getAttribute("axis");if(axis){const ax=this.ensure(".c-chart__axis",()=>{const el=document.createElement("div");el.className="c-chart__axis";return el});ax.textContent=axis}return}if(this.hasAttribute("error")){const plot=this.ensure(".c-chart__plot",()=>{const el=document.createElement("div");el.className="c-chart__plot";return el});plot.innerHTML="";const err=document.createElement("div");err.className="c-chart__error";err.textContent=this.getAttribute("error")||"Error";err.style.display="grid";err.style.placeItems="center";err.style.height="100%";err.style.color="var(--color-danger, var(--color-text))";if(this.hasAttribute("retry")){const btn=document.createElement("button");btn.className="c-btn c-btn--ghost c-btn--sm";btn.type="button";btn.textContent=this.getAttribute("retry")||"Retry";btn.dataset.action="retry";btn.style.marginBlockStart="var(--space-sm)";err.appendChild(btn)}plot.appendChild(err);const axis=this.getAttribute("axis");if(axis){const ax=this.ensure(".c-chart__axis",()=>{const el=document.createElement("div");el.className="c-chart__axis";return el});ax.textContent=axis}return}if(this.hasAttribute("skeleton")){const plot=this.ensure(".c-chart__plot",()=>{const el=document.createElement("div");el.className="c-chart__plot";return el});plot.innerHTML="";const count=Math.min(5,Math.max(1,parseInt(this.getAttribute("skeleton")||"3",10)||3));for(let i=0;i<count;i++){const sk=document.createElement("div");sk.className="c-skeleton";sk.style.display="block";sk.style.inlineSize="100%";sk.style.blockSize="0.6rem";sk.style.marginBlockEnd="var(--space-2xs)";plot.appendChild(sk)}const axis=this.getAttribute("axis");if(axis){const ax=this.ensure(".c-chart__axis",()=>{const el=document.createElement("div");el.className="c-chart__axis";return el});ax.textContent=axis}return}const axis=this.getAttribute("axis");if(axis){const ax=this.ensure(".c-chart__axis",()=>{const el=document.createElement("div");el.className="c-chart__axis";return el});ax.textContent=axis}else{const ax=this.querySelector(".c-chart__axis");if(ax)ax.remove()}const series=this.getAttribute("series");if(series){try{const parsed=JSON.parse(series);const plot=this.ensure(".c-chart__plot",()=>{const el=document.createElement("div");el.className="c-chart__plot";return el});plot.innerHTML="";const hasStructured=parsed.some((s)=>s&&Array.isArray(s.values));if(hasStructured){parsed.forEach((s,i)=>{const color=`var(--chart-${i + 1})`;if(s.type==="donut"){const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 200 200");svg.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";svg.setAttribute("aria-hidden","true");donutSlices(s.values).forEach((sl,si)=>{const path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("class","c-chart__line");path.setAttribute("data-series",String(i+1));path.style.setProperty("--c",color);path.setAttribute("d",sl.path);path.setAttribute("title",String(s.values[si]));svg.appendChild(path)});plot.appendChild(svg)}else if(s.type==="histogram"){const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 300 120");svg.setAttribute("preserveAspectRatio","none");svg.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";barRects(s.values).forEach((r,ri)=>{const rect=document.createElementNS("http://www.w3.org/2000/svg","rect");rect.setAttribute("class","c-chart__bar");rect.setAttribute("data-series",String(i+1));rect.style.setProperty("--c",color);rect.setAttribute("x",r.x);rect.setAttribute("y",r.y);rect.setAttribute("width",r.width);rect.setAttribute("height",r.height);rect.setAttribute("title",String(s.values[ri]));rect.setAttribute("aria-label",String(s.values[ri]));rect.setAttribute("tabindex","0");rect.setAttribute("role","button");rect.dataset.index=String(ri);svg.appendChild(rect)});plot.appendChild(svg)}else{const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 300 120");svg.setAttribute("preserveAspectRatio","none");svg.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";const path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("class","c-chart__line");path.setAttribute("data-series",String(i+1));path.style.setProperty("--c",color);path.setAttribute("d",smoothPath(s.values));svg.appendChild(path);const pts=polylinePoints(s.values).split(" ").map((p)=>p.split(",").map(Number));pts.forEach((pt,pi)=>{const circle=document.createElementNS("http://www.w3.org/2000/svg","circle");circle.setAttribute("class","c-chart__point");circle.setAttribute("data-series",String(i+1));circle.setAttribute("data-index",String(pi));circle.style.setProperty("--c",color);circle.setAttribute("cx",String(pt[0]));circle.setAttribute("cy",String(pt[1]));circle.setAttribute("r","3");circle.setAttribute("tabindex",pi===0?"0":"-1");circle.setAttribute("role","button");circle.setAttribute("title",String(s.values[pi]));circle.setAttribute("aria-label",String(s.values[pi]));svg.appendChild(circle)});plot.appendChild(svg)}})}else{const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 300 120");svg.setAttribute("preserveAspectRatio","none");svg.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";svg.setAttribute("aria-hidden","true");parsed.forEach((s,i)=>{const path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("class","c-chart__line");path.setAttribute("data-series",String(i+1));path.style.setProperty("--c",`var(--chart-${i + 1})`);path.setAttribute("d",s.d||s);svg.appendChild(path)});plot.appendChild(svg)}}catch(e){}const tip=this.ensure(".c-chart__tooltip",()=>{const el=document.createElement("div");el.className="c-chart__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","")}else{const plot=this.ensure(".c-chart__plot",()=>{const el=document.createElement("div");el.className="c-chart__plot";return el});plot.innerHTML="";const empty=document.createElement("div");empty.className="c-chart__empty";empty.textContent=this.getAttribute("empty")||"No data";empty.style.display="grid";empty.style.placeItems="center";empty.style.height="100%";empty.style.color="var(--color-text-muted)";plot.appendChild(empty)}}enhance(){if(this._wiredChart)return;this._wiredChart=true;if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");this.addEventListener("contour:legend-toggle",(e)=>{const key=e&&e.detail&&(e.detail.key||e.detail.label);const pressed=e&&e.detail&&e.detail.pressed;if(key==null)return;const nodes=this.querySelectorAll("[data-series]");nodes.forEach((n)=>{const s=n.getAttribute("data-series");if(String(s)===String(key)||n.getAttribute("data-key")===String(key)){n.style.display=pressed===false?"none":""}})});if(this.hasAttribute("zoomable")){let zoom=1,panX=0,panY=0;const plot=this.querySelector(".c-chart__plot");const apply=()=>{if(!plot)return;plot.style.transform=`translate(${panX}px, ${panY}px) scale(${zoom})`;plot.style.transformOrigin="center center"};this.addEventListener("wheel",(e)=>{e.preventDefault();const factor=e.deltaY<0?1.1:0.9;zoom=Math.min(5,Math.max(0.5,zoom*factor));apply()},{passive:false});let dragging=false,startX=0,startY=0,startPanX=0,startPanY=0;this.addEventListener("mousedown",(e)=>{if(e.button!==0)return;dragging=true;startX=e.clientX;startY=e.clientY;startPanX=panX;startPanY=panY;this.style.cursor="grabbing"});window.addEventListener("mousemove",(e)=>{if(!dragging)return;panX=startPanX+(e.clientX-startX);panY=startPanY+(e.clientY-startY);apply()});window.addEventListener("mouseup",()=>{if(dragging){dragging=false;this.style.cursor=""}});this.addEventListener("dblclick",()=>{zoom=1;panX=0;panY=0;apply()})}let plotRectCache=null;let plotRectObserver=null;const invalidatePlotRect=()=>{plotRectCache=null};const showTip=(e)=>{const plot=this.querySelector(".c-chart__plot");const tip=this.querySelector(".c-chart__tooltip");if(!plot||!tip)return;const mark=e.target&&e.target.closest?e.target.closest(".c-chart__bar, .c-chart__point, .c-chart__line"):null;if(!mark||!plot.contains(mark)){tip.setAttribute("hidden","");return}const title=mark.getAttribute("title");if(title)tip.textContent=title;if(!plotRectCache){plotRectCache=plot.getBoundingClientRect();if(!plotRectObserver&&typeof ResizeObserver==="function"){plotRectObserver=new ResizeObserver(invalidatePlotRect);plotRectObserver.observe(plot)}}const rect=plotRectCache;const mr=mark.getBoundingClientRect();const x=mr.left-rect.left+mr.width/2;const y=mr.top-rect.top;plot.style.setProperty("--chart-tip-inline-start",x+"px");plot.style.setProperty("--chart-tip-block-start",y+"px");tip.removeAttribute("hidden")};const hideTip=()=>{const tip=this.querySelector(".c-chart__tooltip");if(tip)tip.setAttribute("hidden","")};this.addEventListener("mousemove",showTip);this.addEventListener("mouseleave",hideTip);onDispose(this,()=>{if(plotRectObserver){plotRectObserver.disconnect();plotRectObserver=null}});this.addEventListener("focusin",(e)=>{const mark=e.target&&e.target.closest?e.target.closest(".c-chart__bar, .c-chart__point, .c-chart__line"):null;if(mark&&this.contains(mark))showTip({target:mark})});this.addEventListener("focusout",(e)=>{if(!this.contains(e.relatedTarget))hideTip()});this.addEventListener("click",(e)=>{const plot2=this.querySelector(".c-chart__plot");if(!plot2)return;const bar=e.target&&e.target.closest?e.target.closest(".c-chart__bar"):null;if(bar&&plot2.contains(bar)){const series=parseInt(bar.getAttribute("data-series")||"1",10);const index=parseInt(bar.dataset.index||"0",10);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series,index}}));return}const point=e.target&&e.target.closest?e.target.closest(".c-chart__point"):null;if(point&&plot2.contains(point)){const series=parseInt(point.getAttribute("data-series")||"1",10);const index=parseInt(point.dataset.index||"0",10);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series,index}}))}});this.addEventListener("keydown",(e)=>{const plot2=this.querySelector(".c-chart__plot");if(!plot2)return;const bar=e.target&&e.target.closest?e.target.closest(".c-chart__bar"):null;if(bar&&plot2.contains(bar)){if(e.key==="Enter"||e.key===" "){e.preventDefault();const series=parseInt(bar.getAttribute("data-series")||"1",10);const index=parseInt(bar.dataset.index||"0",10);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series,index}}))}return}const point=e.target&&e.target.closest?e.target.closest(".c-chart__point"):null;if(point&&plot2.contains(point)){if(e.key==="Enter"||e.key===" "){e.preventDefault();const series=parseInt(point.getAttribute("data-series")||"1",10);const index=parseInt(point.dataset.index||"0",10);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series,index}}))}else if(e.key==="ArrowRight"||e.key==="ArrowLeft"){e.preventDefault();const points=Array.from(plot2.querySelectorAll('.c-chart__point[data-series="'+point.getAttribute("data-series")+'"]'));const idx=points.indexOf(point);const next=e.key==="ArrowRight"?Math.min(idx+1,points.length-1):Math.max(idx-1,0);if(next!==idx&&points[next]){points.forEach((p,i)=>p.setAttribute("tabindex",i===next?"0":"-1"));try{points[next].focus()}catch(err){}}}}});this.addEventListener("keydown",(e)=>{if(e.target!==this)return;let seriesCount=0;try{seriesCount=JSON.parse(this.getAttribute("series")||"[]").length}catch(e){seriesCount=0}if(seriesCount===0)return;if(this._activeSeries===undefined)this._activeSeries=0;let next=this._activeSeries;const rtl=(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl";if(e.key==="ArrowRight")next=rtl?Math.max(this._activeSeries-1,0):Math.min(this._activeSeries+1,seriesCount-1);else if(e.key==="ArrowLeft")next=rtl?Math.min(this._activeSeries+1,seriesCount-1):Math.max(this._activeSeries-1,0);else if(e.key==="ArrowDown")next=Math.min(this._activeSeries+1,seriesCount-1);else if(e.key==="ArrowUp")next=Math.max(this._activeSeries-1,0);else if(e.key==="Home")next=0;else if(e.key==="End")next=seriesCount-1;else if(e.key==="Enter"||e.key===" "){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series:this._activeSeries}}));return}else return;if(next!==this._activeSeries){e.preventDefault();this._activeSeries=next;this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series:next}}))}})}}define("contour-chart",ContourChart);class ContourComparison extends ContourBase{static get observed(){return["divider","value","before","after"]}static get properties(){return{divider:{attribute:"divider"},value:{attribute:"value"},before:{attribute:"before"},after:{attribute:"after"}}}render(){this.classList.add("c-comparison");if(!this.style.blockSize)this.style.blockSize="12rem";this.style.setProperty("--comparison-pos",(this.getAttribute("value")||"50")+"%");const beforeLabel=this.getAttribute("before")||"Before";const afterLabel=this.getAttribute("after")||"After";if(!this.querySelector(".c-comparison__pane--before")){const p=document.createElement("div");p.className="c-comparison__pane c-comparison__pane--before";p.textContent=beforeLabel;this.appendChild(p)}else{const p=this.querySelector(".c-comparison__pane--before");if(p)p.textContent=beforeLabel}if(!this.querySelector(".c-comparison__pane:not(.c-comparison__pane--before)")){const p=document.createElement("div");p.className="c-comparison__pane";p.textContent=afterLabel;this.appendChild(p)}else{const p=this.querySelector(".c-comparison__pane:not(.c-comparison__pane--before)");if(p)p.textContent=afterLabel}const divider=this.getAttribute("divider");if(divider!==null){const d=this.ensure(".c-comparison__divider",()=>{const el=document.createElement("div");el.className="c-comparison__divider";el.setAttribute("role","separator");el.setAttribute("aria-orientation","vertical");el.setAttribute("tabindex","0");return el});if(divider)d.textContent=divider}else{const d=this.querySelector(".c-comparison__divider");if(d)d.remove()}}enhance(){if(this._wiredComparison)return;this._wiredComparison=true;const divider=()=>this.querySelector(".c-comparison__divider");const setPos=(pct)=>{const clamped=Math.max(0,Math.min(100,pct));this.style.setProperty("--comparison-pos",clamped+"%");this.setAttribute("value",String(Math.round(clamped)));this.dispatchEvent(new CustomEvent("contour:drag",{bubbles:true,composed:true,detail:{value:clamped}}))};let dragging=false;const onMove=(e)=>{if(!dragging)return;const rect=this.getBoundingClientRect();const pct=((e.clientX-rect.left)/rect.width)*100;setPos(pct)};const onUp=()=>{dragging=false;window.removeEventListener("mousemove",onMove);window.removeEventListener("mouseup",onUp)};this.addEventListener("mousedown",(e)=>{const d=divider();if(!d||!d.contains(e.target))return;dragging=true;window.addEventListener("mousemove",onMove);window.addEventListener("mouseup",onUp);e.preventDefault()});this.addEventListener("keydown",(e)=>{const d=divider();if(!d||document.activeElement!==d)return;const cur=parseFloat(this.style.getPropertyValue("--comparison-pos"))||50;if(e.key==="ArrowLeft"){e.preventDefault();setPos(cur-5)}else if(e.key==="ArrowRight"){e.preventDefault();setPos(cur+5)}})}}define("contour-comparison",ContourComparison);class ContourStreamingChart extends ContourBase{static get observed(){return["line","dot","interval","pause","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{line:{attribute:"line"},dot:{attribute:"dot"},interval:{attribute:"interval",type:Number},pause:{attribute:"pause",type:Boolean},src:{attribute:"src"}}}render(){this.classList.add("c-streaming-chart");wireStates(this);loadRemote(this,"line");if(renderStates(this,"streaming-chart"))return;const line=remoteData(this,"line");const dot=remoteData(this,"dot");if(!line){const svg=this.querySelector("svg");if(svg)svg.remove();renderEmpty(this,"streaming-chart");return}if(line){let svg=this.querySelector("svg");if(!svg){svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 300 192");svg.setAttribute("aria-hidden","true");this.appendChild(svg)}let path=svg.querySelector(".c-streaming-chart__line");if(!path){path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("class","c-streaming-chart__line");svg.appendChild(path)}path.setAttribute("d",line);if(dot){let circle=svg.querySelector(".c-streaming-chart__live-dot");if(!circle){circle=document.createElementNS("http://www.w3.org/2000/svg","circle");circle.setAttribute("class","c-streaming-chart__live-dot");circle.setAttribute("r","4");svg.appendChild(circle)}const parts=dot.split(/[ ,]+/);if(parts.length>=2){circle.setAttribute("cx",parts[0]);circle.setAttribute("cy",parts[1])}}}}enhance(){const sync=()=>{const seconds=parseFloat(this.getAttribute("interval")||"");const want=Number.isFinite(seconds)&&seconds>0&&!this.hasAttribute("pause")&&this._viewVisible!==false;if(want===this._streamRunning)return;this._streamRunning=want;if(this._streamTimer!==undefined){clearInterval(this._streamTimer);this._streamTimer=undefined}this.dispatchEvent(new CustomEvent("contour:stream-state",{detail:{running:want},bubbles:true,composed:true}));if(!want)return;this._streamTimer=setInterval(()=>{if(!this.isConnected||this.hasAttribute("pause"))return;this._streamFrame+=1;this.dispatchEvent(new CustomEvent("contour:tick",{detail:{frame:this._streamFrame},bubbles:true,composed:true}));const src=this.getAttribute("src");if(src){remoteInvalidate(src);this.requestRender()}},Math.max(1000,seconds*1000))};sync();if(!this._wiredStreamView){this._wiredStreamView=true;this._viewVisible=true;watchViewport(this);this.addEventListener("contour:view-enter",()=>{this._viewVisible=true;sync()});this.addEventListener("contour:view-leave",()=>{this._viewVisible=false;sync()})}if(this._wiredStream)return;this._wiredStream=true;this._streamFrame=0;onDispose(this,()=>{if(this._streamTimer!==undefined){clearInterval(this._streamTimer);this._streamTimer=undefined}})}}define("contour-streaming-chart",ContourStreamingChart);class ContourMeter extends ContourBase{static get observed(){return["value","label","variant","min","max","low","high","optimum","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"},variant:{attribute:"variant"},min:{attribute:"min"},max:{attribute:"max"},low:{attribute:"low"},high:{attribute:"high"},optimum:{attribute:"optimum"},src:{attribute:"src"}}}render(){this.classList.add("c-meter");wireStates(this);loadRemote(this,["value","label"]);if(renderStates(this,"meter"))return;const rValue=remoteData(this,"value")||(this._remoteData&&this._remoteData.value);const label=remoteData(this,"label")||(this._remoteData&&this._remoteData.label)||"";const variant=this.getAttribute("variant");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-meter--"))this.classList.remove(c)});if(variant)this.classList.add("c-meter--"+variant);if(!rValue&&!label){renderEmpty(this,"meter");return}if(rValue===null){this.style.removeProperty("--meter-value")}else{this.style.setProperty("--meter-value",rValue)}const core=this.ensure(".c-meter__core",()=>{const el=document.createElement("span");el.className="c-meter__core";return el});let val=core.querySelector(".c-meter__value");if(!val){val=document.createElement("span");val.className="c-meter__value";core.appendChild(val)}const num=parseFloat(rValue);val.textContent=(Number.isFinite(num)?Math.round(num*100):0)+"%";if(label){const lbl=core.querySelector(".c-meter__label")||(()=>{const el=document.createElement("span");el.className="c-meter__label";core.appendChild(el);return el})();lbl.textContent=label}if(!this.hasAttribute("role"))this.setAttribute("role","meter");if(label&&!this.hasAttribute("aria-label"))this.setAttribute("aria-label",label);const ariaValue=rValue===null?"0":rValue;const prevVal=this._meterAriaValue;if(!this.hasAttribute("aria-valuenow")||this.getAttribute("aria-valuenow")===prevVal){this.setAttribute("aria-valuenow",ariaValue);this._meterAriaValue=ariaValue}const min=this.getAttribute("min");const max=this.getAttribute("max");if(min!==null)this.setAttribute("aria-valuemin",min);else if(!this.hasAttribute("aria-valuemin"))this.setAttribute("aria-valuemin","0");if(max!==null)this.setAttribute("aria-valuemax",max);else if(!this.hasAttribute("aria-valuemax"))this.setAttribute("aria-valuemax","1");for(const a of["low","high","optimum"]){const v=this.getAttribute(a);if(v!==null)this.setAttribute("data-"+a,v);else this.removeAttribute("data-"+a)}}}define("contour-meter",ContourMeter);class ContourDelta extends ContourBase{static get observed(){return["value","direction","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{value:{attribute:"value"},direction:{attribute:"direction"},src:{attribute:"src"}}}render(){this.classList.add("c-delta");wireStates(this);loadRemote(this,"value");if(renderStates(this,"delta"))return;const value=remoteData(this,"value")||"";Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-delta--"))this.classList.remove(c)});const direction=this.getAttribute("direction")||(this._remoteData&&this._remoteData.direction)||"up";if(!value){renderEmpty(this,"delta");return}this.classList.add("c-delta--"+direction);const icon={up:"#i-arrow-up",down:"#i-arrow-down",flat:"#i-minus"}[direction]||"#i-arrow-up";this.querySelectorAll("svg").forEach((s)=>s.remove());const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("aria-hidden","true");const use=document.createElementNS("http://www.w3.org/2000/svg","use");use.setAttribute("href",icon);svg.appendChild(use);this.appendChild(svg);this.appendChild(document.createTextNode(" "+value))}}define("contour-delta",ContourDelta);class ContourStat extends ContourBase{static get observed(){return["value","label","delta","unit","format","locale","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"},delta:{attribute:"delta"},unit:{attribute:"unit"},format:{attribute:"format"},locale:{attribute:"locale"},src:{attribute:"src"}}}render(){this.classList.add("c-stat");wireStates(this);loadRemote(this,["value","label"]);if(renderStates(this,"stat"))return;const value=remoteData(this,"value");const label=remoteData(this,"label");const delta=this.getAttribute("delta");if(value){const v=this.ensure(".c-stat__value",()=>{const el=document.createElement("div");el.className="c-stat__value";el.setAttribute("aria-live","polite");return el});v.textContent=formatValue(value,this.getAttribute("format"),this.getAttribute("locale"))}else{const v=this.querySelector(".c-stat__value");if(v)v.remove()}if(label){const l=this.ensure(".c-stat__label",()=>{const el=document.createElement("div");el.className="c-stat__label";return el});l.textContent=label}else{const l=this.querySelector(".c-stat__label");if(l)l.remove()}if(delta){const d=this.ensure(".c-stat__delta",()=>{const el=document.createElement("div");el.className="c-stat__delta";return el});d.textContent=delta}else{const d=this.querySelector(".c-stat__delta");if(d)d.remove()}const unit=this.getAttribute("unit");const v=this.querySelector(".c-stat__value");if(v){if(unit){let u=v.querySelector(".c-stat__unit");if(!u){u=document.createElement("span");u.className="c-stat__unit";v.appendChild(u)}u.textContent=unit}else{const u=v.querySelector(".c-stat__unit");if(u)u.remove()}}if(!value&&!label){renderEmpty(this,"stat")}}}define("contour-stat",ContourStat);class ContourGauge extends ContourBase{static get observed(){return["value","min","max","heading","thresholds","format","locale","unit","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","brownout","brownout-level","no-data-message","show-header","description"]}static get properties(){return{value:{attribute:"value"},min:{attribute:"min"},max:{attribute:"max"},heading:{attribute:"heading"},thresholds:{attribute:"thresholds"},format:{attribute:"format"},locale:{attribute:"locale"},unit:{attribute:"unit"},src:{attribute:"src"},brownout:{attribute:"brownout"}}}render(){this.classList.add("c-gauge");wireStates(this);loadRemote(this,["value"]);if(renderStates(this,"gauge"))return;const rawValue=this.getAttribute("value");const num=parseFloat(rawValue);const hasValue=rawValue!==null&&rawValue!==""&&Number.isFinite(num);const min=parseFloat(this.getAttribute("min")||"0");const max=parseFloat(this.getAttribute("max")||"100");const heading=this.getAttribute("heading");const showHeader=this.getAttribute("show-header")!=="false";const description=this.getAttribute("description");const noDataMessage=this.getAttribute("no-data-message")||"No readings in view";const brownoutLevel=parseInt(this.getAttribute("brownout-level")||this.getAttribute("brownout")||"0",10)||0;if(!hasValue){if(heading&&showHeader){const t=this.ensure(".c-gauge__title",()=>{const el=document.createElement("div");el.className="c-gauge__title";return el});t.textContent=heading}const empty=this.ensure(".c-gauge__empty",()=>{const el=document.createElement("div");el.className="c-gauge__empty";el.setAttribute("part","empty");return el});empty.textContent=noDataMessage;[".c-gauge__dial",".c-gauge__value",".c-gauge__band"].forEach((sel)=>{const n=this.querySelector(sel);if(n)n.remove()});return}if(heading&&showHeader){const t=this.ensure(".c-gauge__title",()=>{const el=document.createElement("div");el.className="c-gauge__title";el.setAttribute("part","title");return el});t.textContent=heading}else{const t=this.querySelector(".c-gauge__title");if(t)t.remove()}let thresholds=[];const tAttr=this.getAttribute("thresholds");if(tAttr){try{thresholds=JSON.parse(tAttr)}catch(e){thresholds=[]}}let band=null;if(thresholds&&thresholds.length){const sorted=[...thresholds].sort((a,b)=>(a.value||0)-(b.value||0));for(let i=sorted.length-1;i>=0;i--){if(num>=(sorted[i].value||0)){band=sorted[i];break}}}const shedDial=brownoutLevel>=3;let dial=this.querySelector(".c-gauge__dial");if(shedDial){if(dial)dial.remove()}else{if(!dial){dial=document.createElementNS("http://www.w3.org/2000/svg","svg");dial.setAttribute("class","c-gauge__dial");dial.setAttribute("part","dial");dial.setAttribute("aria-hidden","true");dial.setAttribute("viewBox","0 0 100 100");this.appendChild(dial)}dial.innerHTML="";const track=document.createElementNS("http://www.w3.org/2000/svg","path");track.setAttribute("class","c-gauge__track");track.setAttribute("d","M 10 90 A 40 40 0 0 1 90 90");dial.appendChild(track);if(thresholds&&thresholds.length){const sorted=[...thresholds].sort((a,b)=>(a.value||0)-(b.value||0));const toPoint=(v)=>{const pos=(1-(v-min)/(max-min||1))*Math.PI;return{x:50+40*Math.cos(pos),y:90-40*Math.sin(pos)}};for(let i=0;i<sorted.length;i++){const v1=sorted[i].value||0;const v2=(i+1<sorted.length)?(sorted[i+1].value||max):max;const p1=toPoint(v1);const p2=toPoint(v2);const z=document.createElementNS("http://www.w3.org/2000/svg","path");z.setAttribute("class","c-gauge__zone");z.setAttribute("stroke",sorted[i].color||"var(--color-primary)");z.setAttribute("d","M "+p1.x.toFixed(2)+" "+p1.y.toFixed(2)+" A 40 40 0 0 1 "+p2.x.toFixed(2)+" "+p2.y.toFixed(2));dial.appendChild(z)}}const angle=((num-min)/(max-min||1))*180-90;const needle=document.createElementNS("http://www.w3.org/2000/svg","line");needle.setAttribute("class","c-gauge__needle needle");needle.setAttribute("x1","50");needle.setAttribute("y1","50");needle.setAttribute("x2",String(50+35*Math.cos(angle*Math.PI/180)));needle.setAttribute("y2",String(50+35*Math.sin(angle*Math.PI/180)));dial.appendChild(needle);const hub=document.createElementNS("http://www.w3.org/2000/svg","circle");hub.setAttribute("class","c-gauge__hub hub");hub.setAttribute("cx","50");hub.setAttribute("cy","50");hub.setAttribute("r","4");dial.appendChild(hub)}const valueEl=this.ensure(".c-gauge__value",()=>{const el=document.createElement("div");el.className="c-gauge__value";el.setAttribute("part","value");return el});valueEl.textContent=formatValue(String(num),this.getAttribute("format"),this.getAttribute("locale"))+(this.getAttribute("unit")?" "+this.getAttribute("unit"):"");valueEl.setAttribute("role","meter");valueEl.setAttribute("aria-valuenow",String(num));valueEl.setAttribute("aria-valuemin",String(min));valueEl.setAttribute("aria-valuemax",String(max));if(heading){if(!valueEl.id)valueEl.id=contourId("gauge-value")}if(band){valueEl.setAttribute("aria-valuetext",num+", "+(band.label||(">= "+band.value)))}else{valueEl.setAttribute("aria-valuetext",String(num))}const titleEl=this.querySelector(".c-gauge__title");if(titleEl){if(!titleEl.id)titleEl.id=contourId("gauge-title");valueEl.setAttribute("aria-labelledby",titleEl.id);valueEl.removeAttribute("aria-label")}else{valueEl.removeAttribute("aria-labelledby");if(heading)valueEl.setAttribute("aria-label",heading)}const bandEl=this.querySelector(".c-gauge__band");if(band){const b=this.ensure(".c-gauge__band",()=>{const el=document.createElement("div");el.className="c-gauge__band";el.setAttribute("part","band");return el});b.textContent=band.label||(">= "+band.value)}else{if(bandEl)bandEl.remove()}if(description){let d=this.querySelector(".c-gauge__desc");if(!d){d=document.createElement("div");d.className="c-gauge__desc";this.appendChild(d)}d.textContent=description}}enhance(){}}define("contour-gauge",ContourGauge);class ContourAxis extends ContourBase{static get observed(){return["orientation","values","ticks","format","locale","padding","min","max","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{orientation:{attribute:"orientation"},values:{attribute:"values"},ticks:{attribute:"ticks"},format:{attribute:"format"},locale:{attribute:"locale"},padding:{attribute:"padding"},min:{attribute:"min"},max:{attribute:"max"},src:{attribute:"src"}}}render(){this.classList.add("c-axis");const orientation=this.getAttribute("orientation")||"horizontal";this.classList.toggle("c-axis--horizontal",orientation==="horizontal");this.classList.toggle("c-axis--vertical",orientation==="vertical");if(orientation==="horizontal")this.setAttribute("part","axis-x");else this.setAttribute("part","axis-y");wireStates(this);loadRemote(this,["values"]);if(renderStates(this,"axis"))return;let values=[];const vAttr=this.getAttribute("values");if(vAttr){try{values=JSON.parse(vAttr)}catch(e){values=vAttr.split(",").map((x)=>x.trim())}}const ticks=parseInt(this.getAttribute("ticks")||"0",10)||values.length;const authoredTicks=Array.from(this.querySelectorAll(":scope > .c-axis__tick"));if(authoredTicks.length){authoredTicks.forEach((tick)=>{const label=tick.querySelector(".c-axis__label");if(label&&!label.textContent)label.textContent=tick.textContent})}else{Array.from(this.querySelectorAll(".c-axis__tick")).forEach((n)=>n.remove());const list=values.length?values:Array.from({length:ticks},(_,i)=>i);list.forEach((v)=>{const tick=document.createElement("span");tick.className="c-axis__tick";const label=document.createElement("span");label.className="c-axis__label";label.textContent=formatValue(String(v),this.getAttribute("format"),this.getAttribute("locale"));tick.appendChild(label);this.appendChild(tick)})}}enhance(){}}define("contour-axis",ContourAxis);class ContourBrush extends ContourBase{static get observed(){return["start","end","min","max","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{start:{attribute:"start"},end:{attribute:"end"},min:{attribute:"min"},max:{attribute:"max"},src:{attribute:"src"}}}render(){this.classList.add("c-brush");wireStates(this);loadRemote(this,[]);if(renderStates(this,"brush"))return;let sel=this.querySelector(".c-brush__selection");if(!sel){sel=document.createElement("div");sel.className="c-brush__selection";this.appendChild(sel)}const start=parseFloat(this.getAttribute("start")||"0");const end=parseFloat(this.getAttribute("end")||"100");const min=parseFloat(this.getAttribute("min")||"0");const max=parseFloat(this.getAttribute("max")||"100");const range=max-min||1;const left=((start-min)/range)*100;const width=((end-start)/range)*100;sel.style.insetInlineStart=left+"%";sel.style.inlineSize=width+"%";["start","end"].forEach((h)=>{let handle=this.querySelector(".c-brush__handle--"+h);if(!handle){handle=document.createElement("div");handle.className="c-brush__handle c-brush__handle--"+h;this.appendChild(handle)}const val=h==="start"?start:end;handle.style.insetInlineStart=(((val-min)/range)*100)+"%"})}enhance(){if(this._wiredBrush)return;this._wiredBrush=true;this.addEventListener("pointerdown",(e)=>{this.dispatchEvent(new CustomEvent("contour:brush-start",{bubbles:true,composed:true,detail:{value:this.getAttribute("start"),start:this.getAttribute("start"),end:this.getAttribute("end")}}))});this.addEventListener("pointerup",(e)=>{this.dispatchEvent(new CustomEvent("contour:brush-end",{bubbles:true,composed:true,detail:{value:this.getAttribute("end"),start:this.getAttribute("start"),end:this.getAttribute("end")}}))})}}define("contour-brush",ContourBrush);class ContourStackedBar extends ContourBase{static get observed(){return["segments","values","colors","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","normalize"]}static get properties(){return{segments:{attribute:"segments"},values:{attribute:"values"},colors:{attribute:"colors"},src:{attribute:"src"},normalize:{attribute:"normalize"}}}render(){this.classList.add("c-stacked-bar");wireStates(this);loadRemote(this,["segments","values"]);if(renderStates(this,"stacked-bar"))return;Array.from(this.querySelectorAll(".c-stacked-bar__segment")).forEach((n)=>n.remove());const authoredSegments=Array.from(this.querySelectorAll(":scope > .c-stacked-bar__segment"));let segments=[];if(authoredSegments.length){segments=authoredSegments.map((el)=>({label:el.getAttribute("title")||el.textContent||"",value:parseFloat(el.style.inlineSize)||0,color:el.style.background||undefined,}));authoredSegments.forEach((el)=>el.remove())}else{const sAttr=this.getAttribute("segments");if(sAttr){try{segments=JSON.parse(sAttr)}catch(e){segments=[]}}}const values=segments.map((seg)=>(typeof seg==="object"?(seg.value||0):Number(seg)||0));const total=values.reduce((a,b)=>a+b,0)||1;const normalize=this.hasAttribute("normalize");const denom=normalize?total:(parseFloat(this.getAttribute("max")||String(total))||total);segments.forEach((seg,i)=>{const v=values[i];const el=document.createElement("div");el.className="c-stacked-bar__segment";el.style.inlineSize=((v/denom)*100)+"%";el.style.background=(typeof seg==="object"&&seg.color)?seg.color:"var(--chart-"+((i%8)+1)+")";el.setAttribute("title",(typeof seg==="object"?(seg.label||""):"")+" "+v);this.appendChild(el)});if(!segments.length)renderEmpty(this,"stacked-bar")}enhance(){}}define("contour-stacked-bar",ContourStackedBar);class ContourCategory extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","search"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"},search:{attribute:"search"}}}render(){this.classList.add("c-category");this.setAttribute("role","listbox");wireStates(this);loadRemote(this,["items"]);if(renderStates(this,"category"))return;Array.from(this.querySelectorAll(".c-category__item")).forEach((n)=>n.remove());const authoredItems=Array.from(this.querySelectorAll(":scope > .c-category__item"));let items=[];if(authoredItems.length){authoredItems.forEach((el)=>{const lbl=el.querySelector(".c-category__label");items.push({label:lbl?lbl.textContent:el.textContent,value:0})});authoredItems.forEach((el)=>el.remove())}else{const iAttr=this.getAttribute("items");if(iAttr){try{items=JSON.parse(iAttr)}catch(e){items=[]}}}const max=items.reduce((m,it)=>Math.max(m,(typeof it==="object"?(it.value||0):Number(it)||0)),0)||1;items.forEach((it,idx)=>{const value=(typeof it==="object")?(it.value||0):(Number(it)||0);const label=(typeof it==="object")?(it.label||it.name||""):String(it);const item=document.createElement("div");item.className="c-category__item";item.setAttribute("role","option");item.setAttribute("aria-selected","false");const lbl=document.createElement("span");lbl.className="c-category__label";lbl.textContent=label;const barWrap=document.createElement("div");barWrap.style.flex="1";const bar=document.createElement("div");bar.className="c-category__bar";bar.style.inlineSize=((value/max)*100)+"%";barWrap.appendChild(bar);const val=document.createElement("span");val.className="c-category__value";val.textContent=String(value);item.appendChild(lbl);item.appendChild(barWrap);item.appendChild(val);this.appendChild(item)});if(!items.length)renderEmpty(this,"category")}enhance(){}}define("contour-category",ContourCategory);class ContourDonut extends ContourBase{static get observed(){return["value","values","items","label","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","brownout","brownout-level"]}static get properties(){return{value:{attribute:"value"},values:{attribute:"values"},items:{attribute:"items"},label:{attribute:"label"},src:{attribute:"src"}}}render(){this.classList.add("c-donut");wireStates(this);loadRemote(this,["items","values"]);if(renderStates(this,"donut"))return;Array.from(this.querySelectorAll(".c-donut__ring, .c-donut__center, .c-donut__list, .c-donut__empty")).forEach((n)=>n.remove());const authoredItems=Array.from(this.querySelectorAll(":scope > .c-donut__item"));let items=[];if(authoredItems.length){authoredItems.forEach((el)=>{const sw=el.querySelector(".c-donut__swatch");const lbl=el.querySelector("span:last-child");const text=lbl?lbl.textContent:el.textContent;const match=text.match(/—\s*(\d+(?:\.\d+)?)$/);items.push({label:text.replace(/—\s*\d+(?:\.\d+)?$/,"").trim(),value:match?Number(match[1]):0,color:sw?sw.style.background:undefined})});authoredItems.forEach((el)=>el.remove())}else{const iAttr=this.getAttribute("items");if(iAttr){try{items=JSON.parse(iAttr)}catch(e){items=[]}}}const values=items.map((it)=>(typeof it==="object"?(it.value||0):Number(it)||0));const total=values.reduce((a,b)=>a+b,0)||1;const brownoutLevel=parseInt(this.getAttribute("brownout-level")||this.getAttribute("brownout")||"0",10)||0;const shedRing=brownoutLevel>=3;if(!shedRing){const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("class","c-donut__ring");svg.setAttribute("viewBox","0 0 32 32");let offset=0;items.forEach((it,i)=>{const v=values[i];const pct=v/total;const circle=document.createElementNS("http://www.w3.org/2000/svg","circle");circle.setAttribute("cx","16");circle.setAttribute("cy","16");circle.setAttribute("r","12");circle.setAttribute("fill","none");circle.setAttribute("stroke",(typeof it==="object"&&it.color)?it.color:"var(--chart-"+((i%8)+1)+")");circle.setAttribute("stroke-width","6");const circ=2*Math.PI*12;circle.setAttribute("stroke-dasharray",(pct*circ)+" "+(circ-pct*circ));circle.setAttribute("stroke-dashoffset",String(-offset*circ));circle.setAttribute("transform","rotate(-90 16 16)");svg.appendChild(circle);offset+=pct});const hole=document.createElementNS("http://www.w3.org/2000/svg","circle");hole.setAttribute("cx","16");hole.setAttribute("cy","16");hole.setAttribute("r","9");hole.setAttribute("fill","var(--color-surface-0)");svg.appendChild(hole);this.appendChild(svg)}const center=document.createElement("div");center.className="c-donut__center";center.textContent=this.getAttribute("value")||String(total);this.appendChild(center);const list=document.createElement("div");list.className="c-donut__list";items.forEach((it,i)=>{const row=document.createElement("div");row.className="c-donut__item";const sw=document.createElement("span");sw.className="c-donut__swatch";sw.style.background=(typeof it==="object"&&it.color)?it.color:"var(--chart-"+((i%8)+1)+")";row.appendChild(sw);const lbl=document.createElement("span");lbl.textContent=(typeof it==="object"?(it.label||""):String(it))+" — "+values[i];row.appendChild(lbl);list.appendChild(row)});this.appendChild(list);if(!items.length)renderEmpty(this,"donut")}enhance(){}}define("contour-donut",ContourDonut);class ContourTimeSeries extends ContourBase{static get observed(){return["values","points","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","annotations"]}static get properties(){return{values:{attribute:"values"},points:{attribute:"points"},src:{attribute:"src"},annotations:{attribute:"annotations"}}}render(){this.classList.add("c-time-series");wireStates(this);loadRemote(this,["values","points"]);if(renderStates(this,"time-series"))return;Array.from(this.querySelectorAll(".c-time-series__plot, .c-time-series__axis")).forEach((n)=>n.remove());let values=[];const vAttr=this.getAttribute("values");if(vAttr){try{values=JSON.parse(vAttr)}catch(e){values=vAttr.split(",").map(Number)}}const max=Math.max(...values,1);const plot=document.createElement("div");plot.className="c-time-series__plot";plot.setAttribute("part","plot");values.forEach((v)=>{const bar=document.createElement("div");bar.className="c-time-series__bar";bar.style.blockSize=((v/max)*100)+"%";bar.setAttribute("title",String(v));plot.appendChild(bar)});this.appendChild(plot);if(!values.length)renderEmpty(this,"time-series")}enhance(){}}define("contour-time-series",ContourTimeSeries);class ContourPivot extends ContourBase{static get observed(){return["rows","columns","values","data","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{rows:{attribute:"rows"},columns:{attribute:"columns"},values:{attribute:"values"},data:{attribute:"data"},src:{attribute:"src"}}}render(){this.classList.add("c-pivot");wireStates(this);loadRemote(this,["data"]);if(renderStates(this,"pivot"))return;Array.from(this.querySelectorAll("table")).forEach((n)=>n.remove());let data=[];const dAttr=this.getAttribute("data");if(dAttr){try{data=JSON.parse(dAttr)}catch(e){data=[]}}const rows=this.getAttribute("rows")?this.getAttribute("rows").split(","):[];const cols=this.getAttribute("columns")?this.getAttribute("columns").split(","):[];const table=document.createElement("table");const thead=document.createElement("thead");const hr=document.createElement("tr");const corner=document.createElement("th");corner.textContent="";hr.appendChild(corner);cols.forEach((c)=>{const th=document.createElement("th");th.textContent=c.trim();hr.appendChild(th)});thead.appendChild(hr);table.appendChild(thead);const tbody=document.createElement("tbody");rows.forEach((r)=>{const tr=document.createElement("tr");const th=document.createElement("th");th.textContent=r.trim();tr.appendChild(th);cols.forEach((c)=>{const td=document.createElement("td");const cell=data.find((d)=>d.row===r.trim()&&d.col===c.trim());td.textContent=cell?String(cell.value):"";tr.appendChild(td)});tbody.appendChild(tr)});table.appendChild(tbody);this.appendChild(table);if(!data.length&&!rows.length)renderEmpty(this,"pivot")}enhance(){}}define("contour-pivot",ContourPivot);class ContourWidgetState extends ContourBase{static get observed(){return["loading","error","empty","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{loading:{attribute:"loading"},error:{attribute:"error"},empty:{attribute:"empty"},retry:{attribute:"retry"},src:{attribute:"src"}}}render(){this.classList.add("c-widget-state");wireStates(this);loadRemote(this,[]);if(renderStates(this,"widget-state"))return}enhance(){}}define("contour-widget-state",ContourWidgetState);class ContourBrownout extends ContourBase{static get observed(){return["level"]}static get properties(){return{level:{attribute:"level"}}}render(){this.classList.add("c-brownout");const level=this.getAttribute("level")||"0";this.dataset.level=level;this.setAttribute("data-level",level)}enhance(){}}define("contour-brownout",ContourBrownout);class ContourInstrument extends ContourBase{static get observed(){return["rows","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{rows:{attribute:"rows"},src:{attribute:"src"}}}render(){this.classList.add("c-instrument");wireStates(this);loadRemote(this,"rows");if(renderStates(this,"instrument"))return;const rows=remoteData(this,"rows");Array.from(this.querySelectorAll(".c-instrument__item")).forEach((n)=>n.remove());if(rows){try{const parsed=JSON.parse(rows);parsed.forEach((r)=>{const item=document.createElement("span");item.className="c-instrument__item";item.appendChild(document.createTextNode(String(r.key||r[0]||"")));const val=document.createElement("span");val.className="c-instrument__value";val.textContent=r.value||r[1]||"";item.appendChild(val);this.appendChild(item)})}catch(e){}}else{renderEmpty(this,"instrument")}}}define("contour-instrument",ContourInstrument);class ContourBivariate extends ContourBase{static get observed(){return["size","axis-x","axis-y","colors"]}static get properties(){return{size:{attribute:"size"},axisX:{attribute:"axis-x"},axisY:{attribute:"axis-y"},colors:{attribute:"colors"}}}render(){this.classList.add("c-bivariate");const size=Math.min(12,Math.max(1,parseInt(this.getAttribute("size")||"3",10)||3));const matrix=this.ensure(".c-bivariate__matrix",()=>{const el=document.createElement("div");el.className="c-bivariate__matrix";return el});matrix.style.gridTemplateColumns=`repeat(${size}, 1fr)`;matrix.style.gridTemplateRows=`repeat(${size}, 1fr)`;const authored=Array.from(matrix.children).filter((n)=>n.classList&&n.classList.contains("c-bivariate__cell"));if(!authored.length){matrix.innerHTML="";let colors=[];const cAttr=this.getAttribute("colors");if(cAttr){try{colors=JSON.parse(cAttr)}catch(e){colors=[]}}for(let r=0;r<size;r++){for(let c=0;c<size;c++){const cell=document.createElement("div");cell.className="c-bivariate__cell";const srcIndex=(size-1-r)*size+c;if(colors[srcIndex])cell.style.background=colors[srcIndex];matrix.appendChild(cell)}}}const axisX=this.getAttribute("axis-x");if(axisX){const ax=this.ensure(".c-bivariate__axis--x",()=>{const el=document.createElement("div");el.className="c-bivariate__axis c-bivariate__axis--x";return el});ax.textContent=axisX}else{const ax=this.querySelector(".c-bivariate__axis--x");if(ax)ax.remove()}const axisY=this.getAttribute("axis-y");if(axisY){const ay=this.ensure(".c-bivariate__axis--y",()=>{const el=document.createElement("div");el.className="c-bivariate__axis c-bivariate__axis--y";return el});ay.textContent=axisY}else{const ay=this.querySelector(".c-bivariate__axis--y");if(ay)ay.remove()}}}define("contour-bivariate",ContourBivariate);class ContourBivariateLegend extends ContourBase{static get observed(){return["size","axis-x","axis-y","colors"]}static get properties(){return{size:{attribute:"size"},axisX:{attribute:"axis-x"},axisY:{attribute:"axis-y"},colors:{attribute:"colors"}}}render(){this.classList.add("c-bivariate-legend");const size=Math.min(8,Math.max(1,parseInt(this.getAttribute("size")||"3",10)||3));const matrix=this.ensure(".c-bivariate-legend__matrix",()=>{const el=document.createElement("div");el.className="c-bivariate-legend__matrix";return el});matrix.style.gridTemplateColumns=`repeat(${size}, 1fr)`;const authored=Array.from(matrix.children).filter((n)=>n.classList&&n.classList.contains("c-bivariate-legend__cell"));if(!authored.length){matrix.innerHTML="";let colors=[];const cAttr=this.getAttribute("colors");if(cAttr){try{colors=JSON.parse(cAttr)}catch(e){colors=[]}}for(let i=0;i<size*size;i++){const cell=document.createElement("div");cell.className="c-bivariate-legend__cell";if(colors[i])cell.style.background=colors[i];else cell.style.background="var(--chart-"+((i%8)+1)+")";matrix.appendChild(cell)}}const axisX=this.getAttribute("axis-x");const ax=this.querySelector(".c-bivariate-legend__axis--x");if(axisX){const el=ax||this.ensure(".c-bivariate-legend__axis--x",()=>{const e=document.createElement("div");e.className="c-bivariate-legend__axis c-bivariate-legend__axis--x";return e});el.textContent=axisX}else if(ax){ax.remove()}const axisY=this.getAttribute("axis-y");const ay=this.querySelector(".c-bivariate-legend__axis--y");if(axisY){const el=ay||this.ensure(".c-bivariate-legend__axis--y",()=>{const e=document.createElement("div");e.className="c-bivariate-legend__axis c-bivariate-legend__axis--y";return e});el.textContent=axisY}else if(ay){ay.remove()}}enhance(){}}define("contour-bivariate-legend",ContourBivariateLegend);class ContourSurvey extends ContourBase{static get observed(){return["date","instrument","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{date:{attribute:"date"},instrument:{attribute:"instrument"},src:{attribute:"src"}}}render(){this.classList.add("c-survey");wireStates(this);loadRemote(this,"date");if(renderStates(this,"survey"))return;const date=remoteData(this,"date");Array.from(this.childNodes).forEach((n)=>{if(n.nodeType===Node.TEXT_NODE){if(n.textContent.trim()==="Surveyed"||n.textContent.trim()==="·")n.remove()}else if(n.classList&&(n.classList.contains("c-survey__value")||n.classList.contains("c-survey__sep")))n.remove()});const rDate=date||(this._remoteData&&this._remoteData.date);const instrument=this.getAttribute("instrument")||(this._remoteData&&this._remoteData.instrument);if(!rDate){renderEmpty(this,"survey");return}const v=document.createElement("span");v.className="c-survey__value";v.textContent=rDate;this.appendChild(document.createTextNode("Surveyed "));this.appendChild(v);if(instrument){const sep=document.createElement("span");sep.className="c-survey__sep";sep.textContent="·";this.appendChild(sep);const v2=document.createElement("span");v2.className="c-survey__value";v2.textContent=instrument;this.appendChild(v2)}}}define("contour-survey",ContourSurvey);class ContourThreshold extends ContourBase{static get observed(){return["label","norm","state","value","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},norm:{attribute:"norm"},state:{attribute:"state"},value:{attribute:"value"},src:{attribute:"src"}}}render(){this.classList.add("c-threshold");wireStates(this);loadRemote(this,"value");if(renderStates(this,"threshold"))return;const pct=(v)=>{const n=Number(v);if(!Number.isFinite(n))return String(v);return(n<=1?n*100:n)+"%"};const rValue=remoteData(this,"value")||(this._remoteData&&this._remoteData.value);const target=this.getAttribute("norm")||(this._remoteData&&this._remoteData.norm);const state=this.getAttribute("state")||(this._remoteData&&this._remoteData.state);const label=this.getAttribute("label")||(this._remoteData&&this._remoteData.label);if(!rValue&&!target&&!label){renderEmpty(this,"threshold");return}if(rValue){const v=this.ensure(".c-threshold__fill",()=>{const el=document.createElement("span");el.className="c-threshold__fill";return el});v.style.setProperty("--value",pct(rValue))}else{const v=this.querySelector(".c-threshold__fill");if(v)v.remove()}if(target){const t=this.ensure(".c-threshold__target",()=>{const el=document.createElement("span");el.className="c-threshold__target";return el});t.style.setProperty("--target",pct(target))}else{const t=this.querySelector(".c-threshold__target");if(t)t.remove()}if(state)this.setAttribute("data-state",state);else this.removeAttribute("data-state");if(label)this.setAttribute("aria-label",label)}}define("contour-threshold",ContourThreshold);class ContourMetricsFull extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-metrics");wireStates(this);loadRemote(this,"items");if(renderStates(this,"metrics"))return;const items=remoteData(this,"items");Array.from(this.querySelectorAll(".c-metrics__item")).forEach((n)=>n.remove());let parsed=null;if(items){try{parsed=JSON.parse(items)}catch(e){parsed=null}}if(Array.isArray(parsed)&&parsed.length){parsed.forEach((it)=>{const item=document.createElement("div");item.className="c-metrics__item";const v=document.createElement("div");v.className="c-metrics__value";v.textContent=(typeof it==="object"&&it!==null)?(it.value??it.v??""):String(it);const l=document.createElement("div");l.className="c-metrics__label";l.textContent=(typeof it==="object"&&it!==null)?(it.label??it.l??""):"";item.appendChild(v);item.appendChild(l);this.appendChild(item)})}else if(!items){renderEmpty(this,"metrics")}}enhance(){wireStates(this)}}define("contour-metrics",ContourMetricsFull);class ContourLegend extends ContourBase{static get observed(){return["title","ramp","scale","items","method","norm","selectable","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","glyphs","thresholds","breaks","no-data-color"]}static get properties(){return{title:{attribute:"title"},ramp:{attribute:"ramp"},scale:{attribute:"scale"},items:{attribute:"items"},method:{attribute:"method"},norm:{attribute:"norm"},selectable:{attribute:"selectable",type:Boolean},src:{attribute:"src"}}}render(){this.classList.add("c-legend");wireStates(this);loadRemote(this,"items");if(renderStates(this,"legend"))return;const selectable=this.hasAttribute("selectable");const items=remoteData(this,"items");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-legend__title",()=>{const el=document.createElement("div");el.className="c-legend__title";return el});t.textContent=title}else{const t=this.querySelector(".c-legend__title");if(t)t.remove()}if(items){try{const parsed=JSON.parse(items);const list=this.ensure(".c-legend__items",()=>{const el=document.createElement("div");el.className="c-legend__items";return el});list.innerHTML="";parsed.forEach((it)=>{const label=typeof it==="string"?it:(it.label||String(it));const key=typeof it==="string"?it:(it.key||it.label||String(it));const item=document.createElement(selectable?"button":"div");item.className="c-legend__item";if(selectable){item.type="button";item.setAttribute("aria-pressed","true");item.dataset.key=key}const sw=document.createElement("span");sw.className="c-legend__swatch";if(it&&it.color)sw.style.background=it.color;item.appendChild(sw);const glyphShape=(it&&(it.shape||it.marker||it.glyph))||this.getAttribute("glyphs");if(glyphShape){const g=document.createElement("span");g.className="c-legend__glyph";g.setAttribute("part","glyph");g.textContent=glyphShape==="circle"?"●":glyphShape==="square"?"■":glyphShape==="triangle"?"▲":glyphShape==="diamond"?"◆":glyphShape==="star"?"★":String(glyphShape);item.appendChild(g)}if(it&&it.break!=null){const b=document.createElement("span");b.className="c-legend__break";b.textContent=String(it.break);item.appendChild(b)}const lbl=document.createElement("span");lbl.textContent=label;item.appendChild(lbl);list.appendChild(item)})}catch(e){}}else{const list=this.querySelector(".c-legend__items");if(list)list.remove();const hasOther=this.getAttribute("title")||this.getAttribute("ramp")||this.getAttribute("scale")||this.getAttribute("method")||this.getAttribute("norm");if(!hasOther){renderEmpty(this,"legend")}}const method=this.getAttribute("method");if(method){const m=this.ensure(".c-legend__method",()=>{const el=document.createElement("div");el.className="c-legend__method";return el});m.textContent=method}else{const m=this.querySelector(".c-legend__method");if(m)m.remove()}const norm=this.getAttribute("norm");if(norm){const n=this.ensure(".c-legend__norm",()=>{const el=document.createElement("span");el.className="c-legend__norm";return el});n.textContent=norm}else{const n=this.querySelector(".c-legend__norm");if(n)n.remove()}const ramp=this.getAttribute("ramp");if(ramp){const r=this.ensure(".c-legend__ramp",()=>{const el=document.createElement("div");el.className="c-legend__ramp";return el});r.style.background=ramp}else{const r=this.querySelector(".c-legend__ramp");if(r)r.remove()}const scale=this.getAttribute("scale");if(scale){const sc=this.ensure(".c-legend__scale",()=>{const el=document.createElement("div");el.className="c-legend__scale";return el});sc.textContent=scale}else{const sc=this.querySelector(".c-legend__scale");if(sc)sc.remove()}}enhance(){if(this._wiredLegend)return;this._wiredLegend=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-legend__item"):null;if(!btn||!this.contains(btn))return;const pressed=btn.getAttribute("aria-pressed")!=="true";btn.setAttribute("aria-pressed",String(pressed));this.dispatchEvent(new CustomEvent("contour:legend-toggle",{detail:{label:btn.textContent.trim(),key:btn.dataset.key||btn.textContent.trim(),pressed},bubbles:true,composed:true,}));this.dispatchEvent(new CustomEvent("contour:select",{detail:{label:btn.textContent.trim(),key:btn.dataset.key||btn.textContent.trim(),value:btn.dataset.key||btn.textContent.trim()},bubbles:true,composed:true,}))});try{let parsed=null;try{parsed=JSON.parse(this.getAttribute("items")||"null")}catch(e){parsed=this.getAttribute("items")}this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:this.getAttribute("items"),items:parsed},bubbles:true,composed:true}))}catch(e){}this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.classList&&t.classList.contains("c-legend__break-input")){this.dispatchEvent(new CustomEvent("contour:break-change",{detail:{value:t.value},bubbles:true,composed:true}))}});this.addEventListener("keydown",(e)=>{const items=Array.from(this.querySelectorAll(".c-legend__item"));if(!items.length)return;const idx=items.indexOf(document.activeElement);if(e.key==="ArrowDown"||e.key==="ArrowRight"){e.preventDefault();const next=items[(idx+1)%items.length];if(next)next.focus()}else if(e.key==="ArrowUp"||e.key==="ArrowLeft"){e.preventDefault();const prev=items[(idx-1+items.length)%items.length];if(prev)prev.focus()}else if(e.key==="Enter"||e.key===" "){e.preventDefault();if(document.activeElement&&document.activeElement.classList.contains("c-legend__item")){document.activeElement.click()}}})}}define("contour-legend",ContourLegend);class ContourMeasure extends ContourBase{static get observed(){return["label","value","point","line","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},point:{attribute:"point"},line:{attribute:"line"},src:{attribute:"src"}}}render(){this.classList.add("c-measure");wireStates(this);loadRemote(this,["label","value","point","line"]);if(renderStates(this,"measure"))return;const rLabel=remoteData(this,"label");const rValue=remoteData(this,"value");const rPoint=remoteData(this,"point");const rLine=remoteData(this,"line");if(!rLabel&&!rValue&&!rPoint&&!rLine){renderEmpty(this,"measure");return}if(rLabel){const l=this.ensure(".c-measure__label",()=>{const el=document.createElement("span");el.className="c-measure__label";return el});l.textContent=rLabel}else{const l=this.querySelector(".c-measure__label");if(l)l.remove()}if(rValue){const r=this.ensure(".c-measure__readout",()=>{const el=document.createElement("span");el.className="c-measure__readout";return el});r.textContent=rValue}else{const r=this.querySelector(".c-measure__readout");if(r)r.remove()}let sel=this.querySelector(".c-measure__unit-select");if(!sel){sel=document.createElement("select");sel.className="c-measure__unit-select";this.appendChild(sel)}["m","km","mi","ft"].forEach((u)=>{if(!sel.querySelector('option[value="'+u+'"]')){const o=document.createElement("option");o.value=u;o.textContent=u;sel.appendChild(o)}});if(rPoint){const p=this.ensure(".c-measure__point",()=>{const el=document.createElement("span");el.className="c-measure__point";return el});p.textContent=rPoint}else{const p=this.querySelector(".c-measure__point");if(p)p.remove()}if(!rLine){const svg=this.querySelector("svg");if(svg)svg.remove();return}if(rLine){const ln=this.ensure(".c-measure__line",()=>{const el=document.createElement("span");el.className="c-measure__line";return el});ln.style.inlineSize=rLine}else{const ln=this.querySelector(".c-measure__line");if(ln)ln.remove()}}}define("contour-measure",ContourMeasure);class ContourTimeline extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-timeline");wireStates(this);loadRemote(this,"items");if(renderStates(this,"timeline"))return;const authored=Array.from(this.children).filter((n)=>n.classList&&n.classList.contains("c-timeline__item"));const items=remoteData(this,"items");if(items&&!authored.length){Array.from(this.querySelectorAll(".c-timeline__item")).forEach((n)=>n.remove());try{const parsed=JSON.parse(items);parsed.forEach((it)=>{const item=document.createElement("div");item.className="c-timeline__item";if(it.time){const t=document.createElement("time");t.className="c-timeline__time";t.textContent=it.time;item.appendChild(t)}if(it.title){const ti=document.createElement("div");ti.className="c-timeline__title";ti.textContent=it.title;item.appendChild(ti)}if(it.text){const tx=document.createElement("div");tx.className="c-timeline__text";tx.textContent=it.text;item.appendChild(tx)}this.appendChild(item)})}catch(e){}}else if(!authored.length){renderEmpty(this,"timeline")}}enhance(){if(this._wiredTimeline)return;this._wiredTimeline=true}}define("contour-timeline",ContourTimeline);class ContourHeatmap extends ContourBase{static get observed(){return["cells","count","legend","empty","loading","values","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{cells:{attribute:"cells"},count:{attribute:"count"},legend:{attribute:"legend"},src:{attribute:"src"}}}render(){this.classList.add("c-heatmap");if(!this.hasAttribute("role"))this.setAttribute("role","grid");wireStates(this);loadRemote(this,"cells");if(renderStates(this,"heatmap"))return;const authoredCells=Array.from(this.querySelectorAll(":scope > .c-heatmap__cell"));if(authoredCells.length){const cols=Math.ceil(Math.sqrt(authoredCells.length));this.style.gridTemplateColumns="repeat("+cols+", 1fr)";this.style.inlineSize="16rem"}else{Array.from(this.querySelectorAll(".c-heatmap__cell")).forEach((n)=>n.remove());const count=Math.min(200,Math.max(0,parseInt(this.getAttribute("cells")||this.getAttribute("count")||"0",10)||0));const cols=count>0?Math.ceil(Math.sqrt(count)):1;this.style.gridTemplateColumns="repeat("+cols+", 1fr)";this.style.inlineSize="16rem";if(count>0){let values=[];try{values=JSON.parse(this.getAttribute("values")||"[]")}catch(e){values=[]}for(let i=0;i<count;i++){const cell=document.createElement("div");cell.className="c-heatmap__cell";cell.setAttribute("role","gridcell");cell.setAttribute("tabindex",i===0?"0":"-1");cell.dataset.index=String(i);if(values[i]!==undefined)cell.setAttribute("title",String(values[i]));this.appendChild(cell)}const tip=this.ensure(".c-heatmap__tooltip",()=>{const el=document.createElement("div");el.className="c-heatmap__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","")}else if(!authoredCells.length){renderEmpty(this,"heatmap")}}if(this.hasAttribute("legend")){const leg=this.ensure(".c-heatmap__legend",()=>{const el=document.createElement("div");el.className="c-heatmap__legend";const bar=document.createElement("div");bar.className="c-heatmap__legend-bar";el.appendChild(bar);return el})}else{const leg=this.querySelector(".c-heatmap__legend");if(leg)leg.remove()}}enhance(){if(this._wiredHeatmap)return;this._wiredHeatmap=true;const cells=()=>Array.from(this.querySelectorAll(".c-heatmap__cell"));const showTip=(e)=>{const tip=this.querySelector(".c-heatmap__tooltip");if(!tip)return;const cell=e.target&&e.target.closest?e.target.closest(".c-heatmap__cell"):null;if(!cell||!this.contains(cell)){tip.setAttribute("hidden","");return}const title=cell.getAttribute("title");if(title)tip.textContent=title;else tip.textContent="Cell "+(cell.dataset.index||"");const rect=this.getBoundingClientRect();const cr=cell.getBoundingClientRect();this.style.position=this.style.position||"relative";tip.style.setProperty("--chart-tip-inline-start",(cr.left-rect.left+cr.width/2)+"px");tip.style.setProperty("--chart-tip-block-start",(cr.top-rect.top)+"px");tip.removeAttribute("hidden")};const hideTip=()=>{const tip=this.querySelector(".c-heatmap__tooltip");if(tip)tip.setAttribute("hidden","")};this.addEventListener("mouseover",showTip);this.addEventListener("mouseout",(e)=>{if(!e.relatedTarget||!this.contains(e.relatedTarget))hideTip()});this.addEventListener("focusin",(e)=>{const cell=e.target&&e.target.closest?e.target.closest(".c-heatmap__cell"):null;if(cell&&this.contains(cell))showTip({target:cell})});this.addEventListener("focusout",(e)=>{if(!this.contains(e.relatedTarget))hideTip()});this.addEventListener("keydown",(e)=>{const cell=e.target&&e.target.closest?e.target.closest(".c-heatmap__cell"):null;if(!cell||!this.contains(cell))return;const list=cells();const idx=list.indexOf(cell);let next=-1;const rtl=(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl";if(e.key==="ArrowRight")next=rtl?Math.max(idx-1,0):Math.min(idx+1,list.length-1);else if(e.key==="ArrowLeft")next=rtl?Math.min(idx+1,list.length-1):Math.max(idx-1,0);else if(e.key==="ArrowDown")next=Math.min(idx+Math.ceil(Math.sqrt(list.length)),list.length-1);else if(e.key==="ArrowUp")next=Math.max(idx-Math.ceil(Math.sqrt(list.length)),0);else if(e.key==="Home")next=0;else if(e.key==="End")next=list.length-1;else if(e.key==="Enter"||e.key===" "){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series:1,index:idx}}));return}if(next>=0&&next!==idx){e.preventDefault();list.forEach((c,i)=>c.setAttribute("tabindex",i===next?"0":"-1"));try{list[next].focus()}catch(e){}}});this.addEventListener("click",(e)=>{const cell=e.target&&e.target.closest?e.target.closest(".c-heatmap__cell"):null;if(!cell||!this.contains(cell))return;const idx=cells().indexOf(cell);if(idx>=0)this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series:1,index:idx}}))})}}define("contour-heatmap",ContourHeatmap);class ContourCompare extends ContourBase{static get observed(){return["no","text","yes","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{no:{attribute:"no"},text:{attribute:"text"},yes:{attribute:"yes"},src:{attribute:"src"}}}render(){this.classList.add("c-compare");this.style.padding="var(--space-md)";wireStates(this);loadRemote(this,["no","text","yes"]);if(renderStates(this,"compare"))return;const rYes=remoteData(this,"yes")||(this._remoteData&&this._remoteData.yes);const rNo=remoteData(this,"no")||(this._remoteData&&this._remoteData.no);const rText=remoteData(this,"text")||(this._remoteData&&this._remoteData.text);Array.from(this.querySelectorAll(".c-compare__yes, .c-compare__no, .c-compare__text")).forEach((n)=>n.remove());if(rYes){const y=document.createElement("span");y.className="c-compare__yes";y.innerHTML='<svg aria-hidden="true"><use href="#i-check" /></svg>';this.appendChild(y)}if(rNo){const n=document.createElement("div");n.className="c-compare__no";n.textContent=rNo;this.appendChild(n)}if(rText){const t=document.createElement("p");t.className="c-compare__text";t.textContent=rText;this.appendChild(t)}if(!rYes&&!rNo&&!rText){renderEmpty(this,"compare")}}}define("contour-compare",ContourCompare);class ContourSparkline extends ContourBase{static get observed(){return["points","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{points:{attribute:"points"},src:{attribute:"src"}}}render(){this.classList.add("c-sparkline");if(!this.hasAttribute("role"))this.setAttribute("role","img");if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label","Sparkline");wireStates(this);loadRemote(this,"points");if(renderStates(this,"sparkline"))return;const points=remoteData(this,"points");if(points){try{const parsed=JSON.parse(points);if(!Array.isArray(parsed)||parsed.length===0)throw new Error("empty");Array.from(this.querySelectorAll(".c-sparkline__dot, .c-sparkline__line, .c-sparkline__area")).forEach((n)=>n.remove());const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("class","c-sparkline__line");svg.setAttribute("viewBox","0 0 100 30");svg.setAttribute("preserveAspectRatio","none");svg.style.inlineSize="100%";svg.style.blockSize="100%";svg.setAttribute("width","100%");svg.setAttribute("height","100%");svg.setAttribute("title",this.getAttribute("aria-label")||"Sparkline");const path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("d",parsed.map((p,i)=>(i===0?"M":"L")+" "+(i*100/(parsed.length-1))+" "+(30-p*30)).join(" "));svg.appendChild(path);const dot=document.createElementNS("http://www.w3.org/2000/svg","circle");dot.setAttribute("class","c-sparkline__dot");dot.setAttribute("r","2");dot.setAttribute("cx","0");dot.setAttribute("cy","15");dot.setAttribute("hidden","");svg.appendChild(dot);this.appendChild(svg);this._sparkPoints=parsed;const tip=this.ensure(".c-sparkline__tooltip",()=>{const el=document.createElement("div");el.className="c-sparkline__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","")}catch(e){Array.from(this.querySelectorAll("svg")).forEach((n)=>n.remove());renderEmpty(this,"sparkline")}}else{renderEmpty(this,"sparkline")}}enhance(){if(this._wiredSparkline)return;this._wiredSparkline=true;if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");const showTip=(e)=>{const svg=this.querySelector("svg");const tip=this.querySelector(".c-sparkline__tooltip");const dot=this.querySelector(".c-sparkline__dot");if(!tip||!svg)return;const rect=svg.getBoundingClientRect();const x=e.clientX-rect.left;const pct=Math.max(0,Math.min(1,x/rect.width));const pts=this._sparkPoints||[];if(pts.length===0)return;const idx=Math.round(pct*(pts.length-1));const val=pts[idx];const cx=(idx*100/(pts.length-1));const cy=30-val*30;if(dot){dot.setAttribute("cx",String(cx));dot.setAttribute("cy",String(cy));dot.removeAttribute("hidden")}tip.textContent=String(val);const tipX=(cx/100)*rect.width;tip.style.setProperty("--chart-tip-inline-start",tipX+"px");tip.style.setProperty("--chart-tip-block-start","0px");tip.removeAttribute("hidden")};const hideTip=()=>{const tip=this.querySelector(".c-sparkline__tooltip");const dot=this.querySelector(".c-sparkline__dot");if(tip)tip.setAttribute("hidden","");if(dot)dot.setAttribute("hidden","")};this.addEventListener("mousemove",showTip);this.addEventListener("mouseleave",hideTip);this.addEventListener("focusin",()=>{const pts=this._sparkPoints||[];if(!pts.length)return;const svg=this.querySelector("svg");if(!svg)return;const r=svg.getBoundingClientRect();showTip({clientX:r.left+r.width-1})});this.addEventListener("focusout",hideTip);this.addEventListener("keydown",(e)=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{series:1}}))}})}}define("contour-sparkline",ContourSparkline);class ContourChartGrid extends ContourBase{static get observed(){return["title","series","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{title:{attribute:"title"},series:{attribute:"series"},src:{attribute:"src"}}}render(){this.classList.add("c-chart-grid");wireStates(this);loadRemote(this,"series");if(renderStates(this,"chart-grid"))return;const title=this.getAttribute("title");if(title){const t=this.ensure(".c-chart-grid__title",()=>{const el=document.createElement("div");el.className="c-chart-grid__title";return el});t.textContent=title}const series=remoteData(this,"series");if(!series&&!title)renderEmpty(this,"chart-grid")}}define("contour-chart-grid",ContourChartGrid);class ContourContourPlot extends ContourBase{static get observed(){return["axis","label"]}static get properties(){return{axis:{attribute:"axis"},label:{attribute:"label"}}}render(){this.classList.add("c-contour-plot");const axis=this.getAttribute("axis");if(axis){let svg=this.querySelector("svg");if(!svg){svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 100 100");svg.setAttribute("aria-hidden","true");this.appendChild(svg)}let ax=svg.querySelector(".c-contour-plot__axis");if(!ax){ax=document.createElementNS("http://www.w3.org/2000/svg","line");ax.setAttribute("class","c-contour-plot__axis");svg.appendChild(ax)}}const label=this.getAttribute("label");if(label){let svg=this.querySelector("svg");if(!svg){svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 100 100");svg.setAttribute("aria-hidden","true");this.appendChild(svg)}let lbl=svg.querySelector(".c-contour-plot__label");if(!lbl){lbl=document.createElementNS("http://www.w3.org/2000/svg","text");lbl.setAttribute("class","c-contour-plot__label");svg.appendChild(lbl)}lbl.textContent=label}}}define("contour-contour-plot",ContourContourPlot);class ContourDocsNav extends ContourBase{static get observed(){return["items","title","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},title:{attribute:"title"},src:{attribute:"src"}}}render(){this.classList.add("c-docs-nav");this.setAttribute("role","navigation");const title=this.getAttribute("title");if(title)this.setAttribute("aria-label",title);else this.setAttribute("aria-label","Documentation navigation");wireStates(this);loadRemote(this,"items");if(renderStates(this,"docs-nav"))return;const _remote=remoteData(this,"items");const items=this.hasAttribute("src")?_remote:(_remote||(this.hasAttribute("items")?this.getAttribute("items"):null));const list=this.querySelector(".c-docs-nav__list");const authored=list?Array.from(list.children).filter((n)=>n.classList&&n.classList.contains("c-docs-nav__group")):[];if(items&&!authored.length){try{const parsed=JSON.parse(items);const list=this.ensure(".c-docs-nav__list",()=>{const el=document.createElement("div");el.className="c-docs-nav__list";return el});list.innerHTML="";parsed.forEach((g)=>{const group=document.createElement("div");group.className="c-docs-nav__group";if(g.title){const gt=document.createElement("div");gt.className="c-docs-nav__group-title";gt.textContent=g.title;group.appendChild(gt)}const ul=document.createElement("div");ul.className="c-docs-nav__list";(g.links||g.items||[]).forEach((l)=>{const a=document.createElement("a");a.className="c-docs-nav__link";a.href=(typeof l==="string"?"#":(l.href||"#"));const label=typeof l==="string"?l:(l.label||l);if(typeof l==="object"&&l!==null&&l.badge){const b=document.createElement("span");b.className="c-docs-nav__badge";b.textContent=l.badge;a.appendChild(b)}a.appendChild(document.createTextNode(label));if(typeof l==="object"&&l!==null&&l.chevron){const ch=document.createElement("span");ch.className="c-docs-nav__chevron";ch.textContent=l.chevron;a.appendChild(ch)}if(typeof l==="object"&&l!==null&&Array.isArray(l.items)){a.classList.add("c-docs-nav__link--nested");const nested=document.createElement("div");nested.className="c-docs-nav__list c-docs-nav__list--nested";l.items.forEach((nl)=>{const na=document.createElement("a");na.className="c-docs-nav__link";na.href=(typeof nl==="string"?"#":(nl.href||"#"));na.textContent=typeof nl==="string"?nl:(nl.label||nl);nested.appendChild(na)});ul.appendChild(a);ul.appendChild(nested)}else{ul.appendChild(a)}});group.appendChild(ul);list.appendChild(group)})}catch(e){}}else if(!items&&list){list.remove();renderEmpty(this,"docs-nav")}else if(!items&&!list){renderEmpty(this,"docs-nav")}}enhance(){if(this._wiredDocsNav)return;this._wiredDocsNav=true;this.addEventListener("click",(e)=>{const link=e.target&&e.target.closest?e.target.closest(".c-docs-nav__link"):null;if(link&&this.contains(link)){const label=link.textContent||"";this.dispatchEvent(new CustomEvent("contour:docs-nav-select",{bubbles:true,composed:true,detail:{label,href:link.getAttribute("href")}}))}})}}define("contour-docs-nav",ContourDocsNav);class ContourDocsShell extends ContourBase{static get observed(){return["title","lede","article","heading"]}static get properties(){return{title:{attribute:"title"},lede:{attribute:"lede"},article:{attribute:"article"}}}render(){this.classList.add("c-docs-shell");this.setAttribute("role","region");const title=this.getAttribute("title");if(title){const h=this.ensure(".c-docs-shell__title",()=>{const el=document.createElement(headingTag(this,"h1"));el.className="c-docs-shell__title";return el});h.textContent=title;this.setAttribute("aria-label",title)}else{const h=this.querySelector(".c-docs-shell__title");if(h)h.remove()}const lede=this.getAttribute("lede");if(lede){const p=this.ensure(".c-docs-shell__lede",()=>{const el=document.createElement("p");el.className="c-docs-shell__lede";return el});p.textContent=lede}else{const p=this.querySelector(".c-docs-shell__lede");if(p)p.remove()}const article=this.getAttribute("article");if(article){const a=this.ensure(".c-docs-shell__article",()=>{const el=document.createElement("article");el.className="c-docs-shell__article";return el});a.innerHTML=sanitizeHtml(article)}else{const a=this.querySelector(".c-docs-shell__article");if(a)a.remove()}}}define("contour-docs-shell",ContourDocsShell);class ContourFileTree extends ContourBase{static get observed(){return["items"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-file-tree");const items=this.getAttribute("items");if(items){try{const parsed=JSON.parse(items);const renderNode=(node,depth)=>{const row=document.createElement("div");row.className="c-file-tree__row"+(node.dir?" c-file-tree__row--dir":"")+(node.active?" c-file-tree__row--active":"");row.style.paddingInlineStart=(depth*1)+"rem";const label=document.createElement("span");label.textContent=node.label||node.name||"";row.appendChild(label);this.appendChild(row);if(Array.isArray(node.children)){node.children.forEach((c)=>renderNode(c,depth+1))}};Array.from(this.querySelectorAll(".c-file-tree__row")).forEach((n)=>n.remove());parsed.forEach((n)=>renderNode(n,0))}catch(e){}}}}define("contour-file-tree",ContourFileTree);class ContourDialog extends ContourBase{static get observed(){return["title","size","heading"]}static get properties(){return{title:{attribute:"title"},size:{attribute:"size"}}}render(){this.classList.add("c-dialog");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-dialog--"))this.classList.remove(c)});const size=this.getAttribute("size");if(size)this.classList.add("c-dialog--"+size);if(!this.hasAttribute("role"))this.setAttribute("role","dialog");const title=this.getAttribute("title");let head=this.querySelector(".c-dialog__head");if(title){if(!head){head=document.createElement("div");head.className="c-dialog__head";const h=document.createElement(headingTag(this,"h2"));h.className="c-dialog__title";head.appendChild(h);const closeBtn=document.createElement("button");closeBtn.className="c-btn c-btn--icon c-btn--ghost c-dialog__close";closeBtn.setAttribute("type","button");closeBtn.setAttribute("aria-label","Close");closeBtn.innerHTML='<svg aria-hidden="true"><use href="#i-close" /></svg>';head.appendChild(closeBtn)}const h=head.querySelector(".c-dialog__title");if(h){h.textContent=title;if(!h.id)h.id="contour-dialog-title-"+(this._dialogTitleId=(this._dialogTitleId||0)+1);this.setAttribute("aria-labelledby",h.id)}}if(head&&head.parentNode!==this)this.prepend(head);const body=this.ensure(".c-dialog__body",()=>{const el=document.createElement("div");el.className="c-dialog__body";return el});Array.from(this.childNodes).forEach((n)=>{if(n===body||n===head)return;if(n.nodeType===1&&n.classList&&n.classList.contains("c-dialog__head"))return;body.appendChild(n)});if(head&&head.parentNode===this){if(body.parentNode!==this)this.insertBefore(body,head.nextSibling);else if(head.compareDocumentPosition(body)&Node.DOCUMENT_POSITION_PRECEDING)this.insertBefore(body,head.nextSibling)}else{if(body.parentNode!==this)this.appendChild(body)}}enhance(){if(this._wiredDialog)return;this._wiredDialog=true;onDispose(this,()=>{if(this.hasAttribute("open"))modalContain(this,false)});this.show=()=>{if(this.hasAttribute("open"))return;this._dialogLastFocus=document.activeElement;this.setAttribute("open","");this.setAttribute("aria-modal","true");const dlg=this.querySelector("dialog")||(this.tagName==="DIALOG"?this:null);if(dlg&&typeof dlg.showModal==="function"){try{dlg.showModal()}catch(e){}}modalContain(this,true);const focusable=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(focusable){try{focusable.focus()}catch(e){}}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:true,composed:true}))};this.close=()=>{const wasOpen=this.hasAttribute("open");const dlg=this.querySelector("dialog")||(this.tagName==="DIALOG"?this:null);if(dlg&&typeof dlg.close==="function")dlg.close();if(this.hasAttribute("open"))this.removeAttribute("open");this.removeAttribute("aria-modal");if(wasOpen){modalContain(this,false);this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));const last=this._dialogLastFocus;if(last&&typeof last.focus==="function"){try{last.focus()}catch(e){}}}};this.focus=()=>{const focusable=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(focusable){try{focusable.focus()}catch(e){}}else{try{HTMLElement.prototype.focus.call(this)}catch(e){}}};this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-dialog__close"):null;if(btn&&this.contains(btn)){this.close();return}if(e.target===this)this.close()});this.addEventListener("keydown",(e)=>{if(e.key==="Escape"&&this.hasAttribute("open"))this.close()})}}define("contour-dialog",ContourDialog);class ContourAlert extends ContourBase{static get observed(){return["title","body","variant","icon","closable","action","actions","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},variant:{attribute:"variant"},icon:{attribute:"icon"},closable:{attribute:"closable",type:Boolean},action:{attribute:"action"},actions:{attribute:"actions"}}}render(){this.classList.add("c-alert");if(!this.hasAttribute("role"))this.setAttribute("role","alert");if(!this.hasAttribute("aria-live"))this.setAttribute("aria-live","assertive");wireStates(this);loadRemote(this,"title");if(renderStates(this,"alert"))return;const variant=this.getAttribute("variant");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-alert--"))this.classList.remove(c)});if(variant)this.classList.add("c-alert--"+variant);const icon=this.getAttribute("icon");if(icon){const ic=this.ensure(".c-alert__icon",()=>{const el=document.createElement("span");el.className="c-alert__icon";return el});if(ic.parentNode===this&&this.firstChild!==ic)this.prepend(ic);ic.innerHTML='<svg aria-hidden="true"><use href="#'+String(icon).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'}else{const ic=this.querySelector(".c-alert__icon");if(ic)ic.remove()}const title=this.getAttribute("title")||(this._remoteData&&this._remoteData.title);if(title){const t=this.ensure(".c-alert__title",()=>{const el=document.createElement("div");el.className="c-alert__title";return el});if(t.parentNode===this&&this.firstChild!==t)this.prepend(t);t.textContent=title}else{const t=this.querySelector(".c-alert__title");if(t)t.remove()}const body=this.getAttribute("body");if(body){const b=this.ensure(".c-alert__body",()=>{const el=document.createElement("div");el.className="c-alert__body";return el});b.textContent=body}else{const b=this.querySelector(".c-alert__body");if(b)b.remove()}Array.from(this.querySelectorAll(".c-alert__action")).forEach((n)=>n.remove());const actionsAttr=this.getAttribute("actions");let actionList=[];if(actionsAttr){try{const parsed=JSON.parse(actionsAttr);if(Array.isArray(parsed))actionList=parsed.map((x)=>String(x))}catch(e){actionList=[actionsAttr]}}else{const single=this.getAttribute("action");if(single)actionList=[single]}actionList.forEach((label)=>{const a=document.createElement("button");a.className="c-btn c-btn--sm c-alert__action";a.type="button";a.setAttribute("data-alert-action","");a.textContent=label;this.appendChild(a)});if(this.hasAttribute("closable")){this.ensure(".c-alert__close",()=>{const btn=document.createElement("button");btn.className="c-alert__close";btn.type="button";btn.setAttribute("aria-label","Close");btn.textContent="×";return btn})}else{const btn=this.querySelector(".c-alert__close");if(btn)btn.remove()}if(!title&&!body&&!icon){renderEmpty(this,"alert")}}}ContourAlert.prototype.enhance=function(){if(this._wiredAlert)return;this._wiredAlert=true;this.addEventListener("click",(e)=>{const actionBtn=e.target&&e.target.closest?e.target.closest(".c-alert__action"):null;if(actionBtn&&this.contains(actionBtn)){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:empty-action",{bubbles:true,composed:true,detail:{state:actionBtn.textContent.trim()}}));return}const btn=e.target&&e.target.closest?e.target.closest(".c-alert__close"):null;if(!btn||!this.contains(btn))return;e.preventDefault();this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));this.remove()})};define("contour-alert",ContourAlert);class ContourDisclosure extends ContourBase{static get observed(){return["summary","icon"]}static get properties(){return{summary:{attribute:"summary"},icon:{attribute:"icon"}}}disconnectedCallback(){this._disclosureContent=null;super.disconnectedCallback()}connectedCallback(){if(this.innerHTML.trim()&&!this._disclosureContent){this._disclosureContent=this.innerHTML}super.connectedCallback()}attributeChangedCallback(name,oldValue,newValue){const details=this.querySelector("details");if(details){const body=details.querySelector(".c-disclosure__body");if(body)this._disclosureContent=body.innerHTML}else if(this.innerHTML.trim()){this._disclosureContent=this.innerHTML}super.attributeChangedCallback(name,oldValue,newValue)}render(){this.classList.add("c-disclosure");const summary=this.getAttribute("summary");const icon=this.getAttribute("icon");if(summary){let captured=this.innerHTML.trim()?this.innerHTML:(this._disclosureContent||"");if(captured.trim())this._disclosureContent=captured;const details=this.ensure("details",()=>{const d=document.createElement("details");const summ=document.createElement("summary");summ.className="c-disclosure__summary";if(icon){const ic=document.createElement("span");ic.className="c-disclosure__icon";ic.innerHTML='<svg aria-hidden="true"><use href="#'+String(icon).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>';summ.appendChild(ic)}summ.appendChild(document.createTextNode(summary));d.appendChild(summ);const content=document.createElement("div");content.className="c-disclosure__body";content.innerHTML=captured;d.appendChild(content);return d});const summ=details.querySelector("summary");if(summ){const ic=summ.querySelector(".c-disclosure__icon");if(icon&&!ic){const newIc=document.createElement("span");newIc.className="c-disclosure__icon";newIc.innerHTML='<svg aria-hidden="true"><use href="#'+String(icon).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>';summ.insertBefore(newIc,summ.firstChild)}else if(!icon&&ic){ic.remove()}const textNodes=Array.from(summ.childNodes).filter(n=>n.nodeType===3);textNodes.forEach(n=>n.remove());summ.appendChild(document.createTextNode(summary))}const body=details.querySelector(".c-disclosure__body");if(body)body.innerHTML=captured;if(details.parentNode!==this){this.innerHTML="";this.appendChild(details)}}else{const details=this.querySelector("details");if(details)details.remove()}}enhance(){if(this._wiredDisclosure)return;this._wiredDisclosure=true;this.addEventListener("toggle",(e)=>{const t=e.target;if(t&&t.tagName==="DETAILS"){this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:t.open},bubbles:true,composed:true}))}},true)}}define("contour-disclosure",ContourDisclosure);class ContourCallout extends ContourBase{static get observed(){return["variant","title","icon","closable"]}static get properties(){return{variant:{attribute:"variant"},title:{attribute:"title"},icon:{attribute:"icon"},closable:{attribute:"closable",type:Boolean}}}render(){this.classList.add("c-callout");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-callout--"))this.classList.remove(c)});const variant=this.getAttribute("variant");if(variant)this.classList.add("c-callout--"+variant);const icon=this.getAttribute("icon");if(icon){const ic=this.ensure(".c-callout__icon",()=>{const el=document.createElement("span");el.className="c-callout__icon";return el});if(ic.parentNode===this&&this.firstChild!==ic)this.prepend(ic);ic.innerHTML='<svg aria-hidden="true"><use href="#'+String(icon).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'}else{const ic=this.querySelector(".c-callout__icon");if(ic)ic.remove()}const title=this.getAttribute("title");if(title){const t=this.ensure(".c-callout__title",()=>{const el=document.createElement("div");el.className="c-callout__title";return el});if(t.parentNode===this&&this.firstChild!==t)this.prepend(t);t.textContent=title}else{const t=this.querySelector(".c-callout__title");if(t)t.remove()}if(this.hasAttribute("closable")){this.ensure(".c-callout__close",()=>{const btn=document.createElement("button");btn.className="c-callout__close";btn.type="button";btn.setAttribute("aria-label","Close");btn.textContent="×";return btn})}else{const btn=this.querySelector(".c-callout__close");if(btn)btn.remove()}}}ContourCallout.prototype.enhance=function(){if(this._wiredCallout)return;this._wiredCallout=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-callout__close"):null;if(!btn||!this.contains(btn))return;e.preventDefault();this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));this.remove()})};define("contour-callout",ContourCallout);class ContourEmpty extends ContourBase{static get observed(){return["state","title","body","action","icon","illustration","heading"]}static get properties(){return{state:{attribute:"state"},title:{attribute:"title"},body:{attribute:"body"},action:{attribute:"action"},icon:{attribute:"icon"},illustration:{attribute:"illustration"}}}render(){this.classList.add("c-empty");const state=this.getAttribute("state")||"empty";const title=this.getAttribute("title")||(state==="filtered"?"Nothing matches":state==="error"?"Could not load":"No data yet");const body=this.getAttribute("body")||(state==="filtered"?"Try clearing some filters.":state==="error"?"Check your connection and try again.":"There is nothing to show here yet.");const action=this.getAttribute("action")||(state==="filtered"?"Clear filters":state==="error"?"Retry":"");const icon=this.getAttribute("icon");if(icon){const ic=this.ensure(".c-empty__icon",()=>{const el=document.createElement("span");el.className="c-empty__icon";return el});ic.innerHTML='<svg aria-hidden="true"><use href="#'+String(icon).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'}else{const ic=this.querySelector(".c-empty__icon");if(ic)ic.remove()}const illustration=this.getAttribute("illustration");if(illustration){const il=this.ensure(".c-empty__illustration",()=>{const el=document.createElement("div");el.className="c-empty__illustration";return el});il.innerHTML=sanitizeHtml(illustration)}else{const il=this.querySelector(".c-empty__illustration");if(il)il.remove()}if(title){const t=this.ensure(".c-empty__title",()=>{const el=document.createElement(headingTag(this,"h3"));el.className="c-empty__title";return el});t.textContent=title}else{const t=this.querySelector(".c-empty__title");if(t)t.remove()}if(body){const b=this.ensure(".c-empty__text",()=>{const el=document.createElement("p");el.className="c-empty__text";return el});b.textContent=body}else{const b=this.querySelector(".c-empty__text");if(b)b.remove()}if(action){const a=this.ensure("button.c-btn[data-empty-action]",()=>{const el=document.createElement("button");el.className="c-btn c-btn--primary";el.type="button";el.setAttribute("data-empty-action","");return el});a.textContent=action}else{const a=this.querySelector("[data-empty-action]");if(a)a.remove()}}enhance(){wireRemovable(this)}}define("contour-empty",ContourEmpty);class ContourFaq extends ContourBase{static get observed(){return["question","answer","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{question:{attribute:"question"},answer:{attribute:"answer"},items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-faq");wireStates(this);loadRemote(this,"items");if(renderStates(this,"faq"))return;const items=remoteData(this,"items");const question=this.getAttribute("question");const answer=this.getAttribute("answer");const authored=Array.from(this.children).filter((n)=>n.classList&&n.classList.contains("c-faq__item"));if(items&&!authored.length){try{const parsed=JSON.parse(items);Array.from(this.querySelectorAll(".c-faq__item")).forEach((n)=>n.remove());parsed.forEach((it,i)=>{const item=document.createElement("details");item.className="c-faq__item";if(i===0)item.setAttribute("open","");const q=document.createElement("summary");q.className="c-faq__question";q.textContent=typeof it==="string"?it:(it.question||it.q||"");const sign=document.createElement("span");sign.className="c-faq__sign";sign.setAttribute("aria-hidden","true");sign.innerHTML='<svg aria-hidden="true"><use href="#i-plus" /></svg>';q.appendChild(sign);item.appendChild(q);const a=document.createElement("div");a.className="c-faq__answer";a.textContent=typeof it==="string"?"":(it.answer||it.a||"");item.appendChild(a);this.appendChild(item)})}catch(e){}}else if(!items){if(!question&&!answer){renderEmpty(this,"faq")}else{const item=this.ensure("details.c-faq__item",()=>{const el=document.createElement("details");el.className="c-faq__item";return el});if(!item.hasAttribute("open"))item.setAttribute("open","");const q=this.ensure("summary.c-faq__question",()=>{const el=document.createElement("summary");el.className="c-faq__question";return el},item);q.textContent=question||"";const sign=this.ensure(".c-faq__sign",()=>{const el=document.createElement("span");el.className="c-faq__sign";return el},q);sign.setAttribute("aria-hidden","true");sign.innerHTML='<svg aria-hidden="true"><use href="#i-plus" /></svg>';const a=this.ensure(".c-faq__answer",()=>{const el=document.createElement("div");el.className="c-faq__answer";return el},item);a.textContent=answer||""}}}}define("contour-faq",ContourFaq);class ContourAccordion extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","exclusive"]}static get properties(){return{items:{attribute:"items"},exclusive:{attribute:"exclusive",type:Boolean},src:{attribute:"src"}}}render(){const authored=Array.from(this.children).filter((n)=>n.tagName==="DETAILS");wireStates(this);loadRemote(this,"items");if(renderStates(this,"accordion"))return;const items=remoteData(this,"items");if(items&&!authored.length){Array.from(this.querySelectorAll("details.c-disclosure")).forEach((d)=>d.remove());try{const parsed=JSON.parse(items);parsed.forEach((item)=>{const details=document.createElement("details");details.className="c-disclosure";const summary=document.createElement("summary");summary.className="c-disclosure__summary";summary.textContent=item.title||item.question||item.q||item.label||"";details.appendChild(summary);const body=document.createElement("div");body.className="c-disclosure__body";body.textContent=item.body||item.answer||item.a||item.content||"";details.appendChild(body);this.appendChild(details)})}catch(e){}}else if(!items&&!authored.length){renderEmpty(this,"accordion")}const persist=this.getAttribute("persist");if(persist){let saved=null;if(persist==="storage"&&this.id){try{saved=localStorage.getItem("contour-accordion:"+this.id)}catch(e){}}else if(persist==="url"){try{saved=new URLSearchParams(window.location.search).get("c-accordion")}catch(e){}}if(saved!==null){try{const labels=JSON.parse(saved);if(Array.isArray(labels)){const want=new Set(labels.map((l)=>String(l)));Array.from(this.querySelectorAll("details.c-disclosure")).forEach((d)=>{const summary=d.querySelector("summary");const label=(summary?summary.textContent:"").trim().slice(0,120);if(want.has(label))d.open=true})}}catch(e){}}}}enhance(){if(this._wiredAccordion)return;this._wiredAccordion=true;this.addEventListener("toggle",(e)=>{const t=e.target;if(t&&t.tagName==="DETAILS"){if(t.open&&this.hasAttribute("exclusive")){Array.from(this.querySelectorAll("details.c-disclosure")).forEach((d)=>{if(d!==t)d.open=false})}this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:t.open},bubbles:true,composed:true}));const persist=this.getAttribute("persist");if(persist==="storage"&&this.id){try{const open=[];Array.from(this.querySelectorAll("details.c-disclosure")).forEach((d)=>{if(d.open){const s=d.querySelector("summary");open.push((s?s.textContent:"").trim().slice(0,120))}});localStorage.setItem("contour-accordion:"+this.id,JSON.stringify(open))}catch(e){}}else if(persist==="url"){try{const open=[];Array.from(this.querySelectorAll("details.c-disclosure")).forEach((d)=>{if(d.open){const s=d.querySelector("summary");open.push((s?s.textContent:"").trim().slice(0,120))}});const url=new URL(window.location.href);url.searchParams.set("c-accordion",JSON.stringify(open));window.history.replaceState(null,"",url.toString())}catch(e){}}}},true)}}define("contour-accordion",ContourAccordion);class ContourDrawer extends ContourBase{static get observed(){return["title","body","size"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},size:{attribute:"size"}}}render(){this.classList.add("c-drawer");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-drawer--"))this.classList.remove(c)});const size=this.getAttribute("size");if(size)this.classList.add("c-drawer--"+size);if(!this.hasAttribute("role"))this.setAttribute("role","dialog");const title=this.getAttribute("title");let head=this.querySelector(".c-drawer__head");if(title){if(!head){head=document.createElement("div");head.className="c-drawer__head";const t=document.createElement("div");t.className="c-drawer__title";head.appendChild(t);const closeBtn=document.createElement("button");closeBtn.className="c-btn c-btn--icon c-btn--ghost c-drawer__close";closeBtn.setAttribute("type","button");closeBtn.setAttribute("aria-label","Close");closeBtn.innerHTML='<svg aria-hidden="true"><use href="#i-close" /></svg>';head.appendChild(closeBtn)}const t=head.querySelector(".c-drawer__title");if(t){t.textContent=title;if(!t.id)t.id="contour-drawer-title-"+(this._drawerTitleId=(this._drawerTitleId||0)+1);this.setAttribute("aria-labelledby",t.id)}if(head.parentNode!==this)this.prepend(head)}else if(head){head.remove()}if(this.hasAttribute("open"))this.classList.add("is-open");const body=this.getAttribute("body");const b=this.querySelector(".c-drawer__body");const authored=b?Array.from(b.children):[];if(body&&!authored.length){const el=this.ensure(".c-drawer__body",()=>{const e=document.createElement("div");e.className="c-drawer__body";return e});el.innerHTML=sanitizeHtml(body)}else if(!body&&b&&!authored.length){b.remove()}}enhance(){if(this._wiredDrawer)return;this._wiredDrawer=true;onDispose(this,()=>{if(this.hasAttribute("open"))modalContain(this,false)});this._drawerLastFocus=null;this.show=()=>{if(this.hasAttribute("open"))return;this._drawerLastFocus=document.activeElement;this.setAttribute("open","");this.setAttribute("aria-modal","true");this.classList.add("is-open");modalContain(this,true);const focusable=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(focusable){try{focusable.focus()}catch(e){}}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:true,composed:true}))};this.close=()=>{if(!this.hasAttribute("open"))return;this.removeAttribute("open");this.removeAttribute("aria-modal");this.classList.remove("is-open");modalContain(this,false);this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));const last=this._drawerLastFocus;if(last&&typeof last.focus==="function"){try{last.focus()}catch(e){}}};this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-drawer__close"):null;if(btn&&this.contains(btn)){this.close();return}if(e.target===this)this.close()});this.addEventListener("keydown",(e)=>{if(e.key==="Escape"&&this.hasAttribute("open"))this.close()});let touchStartX=0,touchStartY=0;this.addEventListener("touchstart",(e)=>{if(!this.hasAttribute("open"))return;const t=e.touches&&e.touches[0];if(t){touchStartX=t.clientX;touchStartY=t.clientY}},{passive:true});this.addEventListener("touchend",(e)=>{if(!this.hasAttribute("open"))return;const t=e.changedTouches&&e.changedTouches[0];if(!t)return;const dx=t.clientX-touchStartX;const dy=t.clientY-touchStartY;if(Math.abs(dx)>60&&Math.abs(dx)>Math.abs(dy)*1.5)this.close()},{passive:true})}}define("contour-drawer",ContourDrawer);class ContourSheet extends ContourBase{static get observed(){return["title","body","size"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},size:{attribute:"size"}}}render(){this.classList.add("c-sheet");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-sheet--"))this.classList.remove(c)});const size=this.getAttribute("size");if(size)this.classList.add("c-sheet--"+size);if(!this.hasAttribute("role"))this.setAttribute("role","dialog");const title=this.getAttribute("title");let head=this.querySelector(".c-sheet__head");if(title){if(!head){head=document.createElement("div");head.className="c-sheet__head";const t=document.createElement("div");t.className="c-sheet__title";head.appendChild(t);const closeBtn=document.createElement("button");closeBtn.className="c-btn c-btn--icon c-btn--ghost c-sheet__close";closeBtn.setAttribute("type","button");closeBtn.setAttribute("aria-label","Close");closeBtn.innerHTML='<svg aria-hidden="true"><use href="#i-close" /></svg>';head.appendChild(closeBtn)}const t=head.querySelector(".c-sheet__title");if(t){t.textContent=title;if(!t.id)t.id="contour-sheet-title-"+(this._sheetTitleId=(this._sheetTitleId||0)+1);this.setAttribute("aria-labelledby",t.id)}if(head.parentNode!==this)this.prepend(head)}else if(head){head.remove()}if(this.hasAttribute("open"))this.classList.add("is-open");const body=this.getAttribute("body");const b=this.querySelector(".c-sheet__body");const authored=b?Array.from(b.children):[];if(body&&!authored.length){const el=this.ensure(".c-sheet__body",()=>{const e=document.createElement("div");e.className="c-sheet__body";return e});el.innerHTML=sanitizeHtml(body)}else if(!body&&b&&!authored.length){b.remove()}}enhance(){if(this._wiredSheet)return;this._wiredSheet=true;onDispose(this,()=>{if(this.hasAttribute("open"))modalContain(this,false)});this._sheetLastFocus=null;this.show=()=>{if(this.hasAttribute("open"))return;this._sheetLastFocus=document.activeElement;this.setAttribute("open","");this.setAttribute("aria-modal","true");this.classList.add("is-open");modalContain(this,true);const focusable=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(focusable){try{focusable.focus()}catch(e){}}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:true,composed:true}))};this.close=()=>{if(!this.hasAttribute("open"))return;this.removeAttribute("open");this.removeAttribute("aria-modal");this.classList.remove("is-open");modalContain(this,false);this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));const last=this._sheetLastFocus;if(last&&typeof last.focus==="function"){try{last.focus()}catch(e){}}};this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-sheet__close"):null;if(btn&&this.contains(btn)){this.close();return}if(e.target===this)this.close()});this.addEventListener("keydown",(e)=>{if(e.key==="Escape"&&this.hasAttribute("open"))this.close()});let touchStartY=0,touchStartX=0;this.addEventListener("touchstart",(e)=>{if(!this.hasAttribute("open"))return;const t=e.touches&&e.touches[0];if(t){touchStartX=t.clientX;touchStartY=t.clientY}},{passive:true});this.addEventListener("touchend",(e)=>{if(!this.hasAttribute("open"))return;const t=e.changedTouches&&e.changedTouches[0];if(!t)return;const dy=t.clientY-touchStartY;const dx=t.clientX-touchStartX;if(dy>60&&Math.abs(dy)>Math.abs(dx)*1.5)this.close()},{passive:true})}}define("contour-sheet",ContourSheet);class ContourToast extends ContourBase{static get observed(){return["message","variant","duration"]}static get properties(){return{message:{attribute:"message"},variant:{attribute:"variant"},duration:{attribute:"duration",type:Number}}}render(){this.classList.add("c-toast");if(!this.hasAttribute("role"))this.setAttribute("role","status");if(!this.hasAttribute("aria-live"))this.setAttribute("aria-live","polite");if(!this.hasAttribute("aria-atomic"))this.setAttribute("aria-atomic","true");const message=this.getAttribute("message");if(message&&!this.hasChildNodes()){this.textContent=message}const variant=this.getAttribute("variant");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-toast--"))this.classList.remove(c)});if(variant)this.classList.add("c-toast--"+variant)}enhance(){if(this._wiredToast)return;this._wiredToast=true;const ms=(this.duration&&this.duration>0)?this.duration:1500;const timer=setTimeout(()=>{if(!this.isConnected)return;this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));this.remove()},ms);onDispose(this,()=>clearTimeout(timer))}}define("contour-toast",ContourToast);class ContourExpandable extends ContourBase{static get observed(){return["summary"]}static get properties(){return{summary:{attribute:"summary"}}}disconnectedCallback(){this._expandableContent=null;super.disconnectedCallback()}connectedCallback(){if(this.innerHTML.trim()&&!this._expandableContent){this._expandableContent=this.innerHTML}super.connectedCallback()}attributeChangedCallback(name,oldValue,newValue){const details=this.querySelector("details");if(details){const body=details.querySelector(".c-expandable__body");if(body)this._expandableContent=body.innerHTML}else if(this.innerHTML.trim()){this._expandableContent=this.innerHTML}super.attributeChangedCallback(name,oldValue,newValue)}render(){this.classList.add("c-expandable");const summary=this.getAttribute("summary");if(summary){let captured=this.innerHTML.trim()?this.innerHTML:(this._expandableContent||"");if(captured.trim())this._expandableContent=captured;const details=this.ensure("details",()=>{const d=document.createElement("details");const summ=document.createElement("summary");summ.className="c-expandable__summary";summ.textContent=summary;d.appendChild(summ);const content=document.createElement("div");content.className="c-expandable__body";content.innerHTML=captured;d.appendChild(content);return d});const summ=details.querySelector("summary");if(summ)summ.textContent=summary;const body=details.querySelector(".c-expandable__body");if(body)body.innerHTML=captured;if(details.parentNode!==this){this.innerHTML="";this.appendChild(details)}}else{const details=this.querySelector("details");if(details)details.remove()}}enhance(){if(this._wiredExpandable)return;this._wiredExpandable=true;this.addEventListener("toggle",(e)=>{const t=e.target;if(t&&t.tagName==="DETAILS"){this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:t.open},bubbles:true,composed:true}))}},true)}}define("contour-expandable",ContourExpandable);class ContourToastHost extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-toast-host");if(!this.hasAttribute("role"))this.setAttribute("role","status");if(!this.hasAttribute("aria-live"))this.setAttribute("aria-live","polite");if(!this.hasAttribute("aria-atomic"))this.setAttribute("aria-atomic","true")}enhance(){if(this._wiredToastHost)return;this._wiredToastHost=true;this._toastQueue=[];const showOne=(message,opts)=>{opts=opts||{};const toast=document.createElement("div");toast.className="c-toast";toast.setAttribute("role","status");toast.setAttribute("aria-live","polite");toast.setAttribute("aria-atomic","true");if(opts.variant)toast.classList.add("c-toast--"+opts.variant);toast.textContent=message==null?"":String(message);this.appendChild(toast);const ms=(opts.duration&&opts.duration>0)?opts.duration:3000;const timer=setTimeout(()=>{if(toast.parentNode)toast.parentNode.removeChild(toast);this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}))},ms);toast._timer=timer;return toast};this.show=(message,opts)=>showOne(message,opts);this.hide=()=>{Array.from(this.querySelectorAll(".c-toast")).forEach((t)=>{if(t._timer)clearTimeout(t._timer);if(t.parentNode)t.parentNode.removeChild(t)})}}}define("contour-toast-host",ContourToastHost);class ContourCombobox extends ContourBase{static get observed(){return["options","placeholder","label","value","multiple","loading","error","retry","src","lazy","refresh","timeout","empty","skeleton"]}static get formAssociated(){return true}static get properties(){return{options:{attribute:"options"},placeholder:{attribute:"placeholder"},label:{attribute:"label"},value:{attribute:"value"},multiple:{attribute:"multiple",type:Boolean},src:{attribute:"src"}}}render(){this.classList.add("c-combobox");wireStates(this);loadRemote(this,"options");if(renderStates(this,"combobox"))return;const options=remoteData(this,"options");const authored=Array.from(this.children).filter((n)=>!n.classList||(!n.classList.contains("c-combobox__input")&&!n.classList.contains("c-combobox__list")));if((options)&&!authored.length){try{const parsed=options?JSON.parse(options):[];const input=this.ensure(".c-combobox__input",()=>{const el=document.createElement("input");el.className="c-combobox__input";el.type="text";return el});input.type="text";input.placeholder=this.getAttribute("placeholder")||"Search…";input.setAttribute("aria-label",this.getAttribute("label")||"Search");const val=this.getAttribute("value");if(val!==null)input.value=val;const list=this.ensure(".c-combobox__list",()=>{const el=document.createElement("ul");el.className="c-combobox__list";el.setAttribute("hidden","");return el});list.innerHTML="";list.setAttribute("hidden","");const selectedVals=(this.getAttribute("value")||"").split(",").map((v)=>v.trim()).filter(Boolean);parsed.forEach((opt)=>{const li=document.createElement("li");li.className="c-combobox__option";const v=typeof opt==="string"?opt:opt.value;li.textContent=typeof opt==="string"?opt:opt.label;if(this.hasAttribute("multiple")&&selectedVals.includes(String(v)))li.setAttribute("aria-selected","true");list.appendChild(li)})}catch(e){}}else if(!authored.length&&!options){renderEmpty(this,"combobox")}if(this.getAttribute("value")){this.ensure(".c-combobox__clear",()=>{const btn=document.createElement("button");btn.className="c-combobox__clear";btn.type="button";btn.setAttribute("aria-label","Clear");btn.textContent="×";return btn})}else{const btn=this.querySelector(".c-combobox__clear");if(btn)btn.remove()}}enhance(){wireCombobox(this);if(this._internals&&!this._wiredComboboxForm){this._wiredComboboxForm=true;this._syncFormValue();this.addEventListener("contour:select",(e)=>{const v=e&&e.detail&&(e.detail.value||e.detail.label);if(v!=null)this.setAttribute("value",String(v));this._syncFormValue()})}if(!this._wiredComboboxClear){this._wiredComboboxClear=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-combobox__clear"):null;if(!btn||!this.contains(btn))return;e.preventDefault();this.removeAttribute("value");const input=this.querySelector(".c-combobox__input");if(input)input.value="";this._syncFormValue();this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{name:this.getAttribute("name"),value:null,checked:null}}))})}}}define("contour-combobox",ContourCombobox);class ContourField extends ContourBase{static get observed(){return["label","hint","error","placeholder","type","required"]}static get formAssociated(){return true}static get properties(){return{label:{attribute:"label"},hint:{attribute:"hint"},error:{attribute:"error"},placeholder:{attribute:"placeholder"},type:{attribute:"type"},required:{attribute:"required",type:Boolean}}}render(){this.classList.add("c-field");const label=this.getAttribute("label");const hint=this.getAttribute("hint");const error=this.getAttribute("error");const placeholder=this.getAttribute("placeholder")||"";if(label){const lbl=this.ensure(".c-field__label",()=>{const el=document.createElement("label");el.className="c-field__label";return el});lbl.textContent=label}else{const lbl=this.querySelector(".c-field__label");if(lbl)lbl.remove()}const input=this.ensure("input.c-input, textarea, select",()=>{const el=document.createElement("input");el.className="c-input";return el});input.type=this.getAttribute("type")||"text";input.placeholder=placeholder;if(!input.id)input.id=contourId("contour-field");const lbl=this.querySelector(".c-field__label");if(lbl){if(!input.id)input.id=contourId("contour-field");lbl.setAttribute("for",input.id)}if(hint){const h=this.ensure(".c-field__hint",()=>{const el=document.createElement("span");el.className="c-field__hint";return el});h.textContent=hint}else{const h=this.querySelector(".c-field__hint");if(h)h.remove()}if(error){const e=this.ensure(".c-field__error",()=>{const el=document.createElement("span");el.className="c-field__error";return el});e.textContent=error}else{const e=this.querySelector(".c-field__error");if(e)e.remove()}const hintEl=this.querySelector(".c-field__hint");const errEl=this.querySelector(".c-field__error");const describedBy=[];if(hintEl){if(!hintEl.id)hintEl.id=contourId("hint");describedBy.push(hintEl.id)}if(errEl){if(!errEl.id)errEl.id=contourId("err");describedBy.push(errEl.id)}if(describedBy.length)input.setAttribute("aria-describedby",describedBy.join(" "));if(this.hasAttribute("required"))input.setAttribute("aria-required","true")}}ContourField.prototype.enhance=function(){if(this._wiredField)return;this._wiredField=true;const sync=()=>{const input=this.querySelector("input, textarea, select");if(!input||!this._internals)return;this._internals.setFormValue(input.value)};this.addEventListener("input",(e)=>{const input=this.querySelector("input, textarea, select");if(!input||e.target!==input)return;sync();this._emitForm("contour:input")});this.addEventListener("change",(e)=>{const input=this.querySelector("input, textarea, select");if(!input||e.target!==input)return;sync();this._emitForm("contour:change")});this.addEventListener("blur",(e)=>{const input=this.querySelector("input, textarea, select");if(!input||e.target!==input)return;const valid=input.checkValidity();if(valid){input.setAttribute("aria-invalid","false");this.classList.remove("is-invalid");this.removeAttribute("data-invalid")}else{input.setAttribute("aria-invalid","true");this.classList.add("is-invalid");this.setAttribute("data-invalid","");if(!this.getAttribute("error")){const msg=input.validationMessage||"Invalid value";let errEl=this.querySelector(".c-field__error");if(!errEl){errEl=document.createElement("span");errEl.className="c-field__error";this.appendChild(errEl)}errEl.textContent=msg;if(!errEl.id)errEl.id=contourId("err");input.setAttribute("aria-describedby",(input.getAttribute("aria-describedby")||"").split(" ").filter((x)=>x&&x!==errEl.id).concat(errEl.id).join(" "))}}sync()},true);sync()};define("contour-field",ContourField);class ContourRange extends ContourBase{static get observed(){return["min","max","value","label"]}static get formAssociated(){return true}static get properties(){return{min:{attribute:"min"},max:{attribute:"max"},value:{attribute:"value"},label:{attribute:"label"}}}render(){this.classList.add("c-range");const input=this.ensure("input",()=>{const el=document.createElement("input");el.type="range";return el});input.type="range";input.className="c-range";input.min=this.getAttribute("min")||"0";input.max=this.getAttribute("max")||"100";const attrVal=this.getAttribute("value")||"50";if(this._rangeUserValue!==null&&this._rangeAttrAtDirty===(this.getAttribute("value")||"50")){input.value=this._rangeUserValue}else{input.value=attrVal;this._rangeUserValue=null;this._rangeAttrAtDirty=null}const label=this.getAttribute("label");if(label)input.setAttribute("aria-label",label);else if(!input.hasAttribute("aria-label"))input.setAttribute("aria-label","Range");const updateFill=()=>{const min=Number(input.min)||0;const max=Number(input.max)||100;const val=Number(input.value)||0;const pct=max>min?((val-min)/(max-min))*100:0;input.style.setProperty("--fill",pct+"%")};updateFill();if(!input._fillWired){input._fillWired=true;input.addEventListener("input",updateFill)}}}const _origRangeRender=ContourRange.prototype.render;ContourRange.prototype.attributeChangedCallback=function(name,oldValue,newValue){if(name==="value"){this._rangeUserValue=null;this._rangeAttrAtDirty=null}return ContourBase.prototype.attributeChangedCallback.call(this,name,oldValue,newValue)};ContourRange.prototype.enhance=function(){if(this._wiredRange)return;this._wiredRange=true;const sync=()=>{const input=this.querySelector("input");if(!input||!this._internals)return;this._internals.setFormValue(input.value)};this.addEventListener("input",(e)=>{const input=this.querySelector("input");if(!input||e.target!==input)return;this._rangeUserValue=input.value;this._rangeAttrAtDirty=this.getAttribute("value")||"50";sync();this._emitForm("contour:input")});this.addEventListener("change",(e)=>{const input=this.querySelector("input");if(!input||e.target!==input)return;sync();this._emitForm("contour:change")});sync()};define("contour-range",ContourRange);class ContourSwitch extends ContourBase{static get observed(){return["label","required","checked"]}static get properties(){return{label:{attribute:"label"},required:{attribute:"required",type:Boolean},checked:{attribute:"checked",type:Boolean}}}static get formAssociated(){return true}render(){this.classList.add("c-switch");const label=this.getAttribute("label");const input=this.ensure("input.c-switch__input",()=>{const el=document.createElement("input");el.className="c-switch__input";el.type="checkbox";return el});input.checked=this.hasAttribute("checked");input.setAttribute("role","switch");input.setAttribute("aria-checked",String(input.checked));this._setCustomState("data-checked",input.checked);if(!input.nextElementSibling||!input.nextElementSibling.classList.contains("c-switch__track")){const track=document.createElement("span");track.className="c-switch__track";track.setAttribute("aria-hidden","true");if(input.nextSibling)this.insertBefore(track,input.nextSibling);else this.appendChild(track)}if(label){input.setAttribute("aria-label",label);const txt=this.querySelector(":scope > span:not([class]):not(.c-switch__track)")||(()=>{const el=document.createElement("span");this.appendChild(el);return el})();txt.textContent=label}}enhance(){const input=this.querySelector("input");if(input&&this._internals){input.setAttribute("aria-checked",String(input.checked));this._setCustomState("data-checked",input.checked);this._internals.setFormValue(input.checked?(input.value||"on"):null);this._syncValidity(this.hasAttribute("required")&&!input.checked)}if(this._wiredSwitch)return;this._wiredSwitch=true;this.addEventListener("change",(e)=>{const inp=this.querySelector("input");if(!inp||e.target!==inp||!this._internals)return;inp.setAttribute("aria-checked",String(inp.checked));this._setCustomState("data-checked",inp.checked);this._internals.setFormValue(inp.checked?(inp.value||"on"):null);this._emitForm("contour:change");this._syncValidity(this.hasAttribute("required")&&!inp.checked)})}}define("contour-switch",ContourSwitch);class ContourCheck extends ContourBase{static get observed(){return["label","name","value","required","type","checked"]}static get properties(){return{label:{attribute:"label"},name:{attribute:"name"},value:{attribute:"value"},required:{attribute:"required",type:Boolean},type:{attribute:"type"},checked:{attribute:"checked",type:Boolean}}}static get formAssociated(){return true}render(){this.classList.add("c-check");const label=this.getAttribute("label");const input=this.ensure("input.c-check__input",()=>{const el=document.createElement("input");el.className="c-check__input";el.type=this.getAttribute("type")==="radio"?"radio":"checkbox";return el});input.checked=this.hasAttribute("checked");if(!input.nextElementSibling||!input.nextElementSibling.classList.contains("c-check__box")){const box=document.createElement("span");box.className="c-check__box";box.setAttribute("aria-hidden","true");if(input.nextSibling)this.insertBefore(box,input.nextSibling);else this.appendChild(box)}if(label){input.setAttribute("aria-label",label);const txt=this.querySelector(":scope > span:not([class]):not(.c-check__box)")||(()=>{const el=document.createElement("span");this.appendChild(el);return el})();txt.textContent=label}if(this.hasAttribute("name"))input.name=this.getAttribute("name");if(this.hasAttribute("value"))input.value=this.getAttribute("value")}enhance(){const input=this.querySelector("input");if(input&&this._internals){this._setCustomState("data-checked",input.checked);this._internals.setFormValue(input.checked?(input.value||"on"):null);this._syncValidity(this.hasAttribute("required")&&!input.checked)}if(this._wiredCheck)return;this._wiredCheck=true;this.addEventListener("change",(e)=>{const inp=this.querySelector("input");if(!inp||e.target!==inp||!this._internals)return;this._setCustomState("data-checked",inp.checked);this._internals.setFormValue(inp.checked?(inp.value||"on"):null);this._emitForm("contour:change");this._syncValidity(this.hasAttribute("required")&&!inp.checked)})}}define("contour-check",ContourCheck);class ContourRadio extends ContourBase{static get observed(){return["label","name","value","required","checked"]}static get properties(){return{label:{attribute:"label"},name:{attribute:"name"},value:{attribute:"value"},required:{attribute:"required",type:Boolean},checked:{attribute:"checked",type:Boolean}}}static get formAssociated(){return true}render(){this.classList.add("c-radio");const label=this.getAttribute("label");const input=this.ensure("input.c-radio__input",()=>{const el=document.createElement("input");el.className="c-radio__input";el.type="radio";return el});input.checked=this.hasAttribute("checked");if(this.hasAttribute("name"))input.name=this.getAttribute("name");if(this.hasAttribute("value"))input.value=this.getAttribute("value");if(label){input.setAttribute("aria-label",label);const txt=this.querySelector(":scope > span:not([class])")||(()=>{const el=document.createElement("span");this.appendChild(el);return el})();txt.textContent=label}}enhance(){const input=this.querySelector("input");if(input&&this._internals){this._setCustomState("data-checked",input.checked);this._internals.setFormValue(input.checked?(input.value||"on"):null);this._syncValidity(this.hasAttribute("required")&&!input.checked)}if(this._wiredRadio)return;this._wiredRadio=true;this.addEventListener("change",(e)=>{const inp=this.querySelector("input");if(!inp||e.target!==inp||!this._internals)return;this._setCustomState("data-checked",inp.checked);this._internals.setFormValue(inp.checked?(inp.value||"on"):null);this._emitForm("contour:change");this._syncValidity(this.hasAttribute("required")&&!inp.checked)})}}define("contour-radio",ContourRadio);class ContourSelect extends ContourBase{static get observed(){return["options","required","label","placeholder"]}static get properties(){return{options:{attribute:"options"},required:{attribute:"required",type:Boolean},label:{attribute:"label"},placeholder:{attribute:"placeholder"}}}static get formAssociated(){return true}render(){this.classList.add("c-select");const options=this.getAttribute("options");const generated=new Set(this._contourGenerated||[]);const authored=Array.from(this.children).filter((n)=>!generated.has(n));if(options&&!authored.length){try{const parsed=JSON.parse(options);const select=this.ensure("select.c-select",()=>{const el=document.createElement("select");el.className="c-select";return el});select.innerHTML="";const label=this.getAttribute("label");if(label){select.setAttribute("aria-label",label);let lbl=this.querySelector("label.c-select__label");if(!lbl){lbl=document.createElement("label");lbl.className="c-select__label";lbl.textContent=label;this.insertBefore(lbl,select)}else lbl.textContent=label}const placeholder=this.getAttribute("placeholder");if(placeholder){const ph=document.createElement("option");ph.value="";ph.textContent=placeholder;ph.disabled=true;ph.selected=true;select.appendChild(ph)}const groups={};parsed.forEach((opt)=>{const g=(typeof opt==="object"&&opt!==null)?opt.group:null;if(g){if(!groups[g]){groups[g]=document.createElement("optgroup");groups[g].label=g;select.appendChild(groups[g])}const option=document.createElement("option");option.value=typeof opt==="string"?opt:opt.value;option.textContent=typeof opt==="string"?opt:opt.label;groups[g].appendChild(option)}else{const option=document.createElement("option");option.value=typeof opt==="string"?opt:opt.value;option.textContent=typeof opt==="string"?opt:opt.label;select.appendChild(option)}});if(select.parentNode!==this)this.appendChild(select);this.classList.remove("c-select");select.classList.add("c-select")}catch(e){}}}enhance(){const select=this.querySelector("select");if(select&&this._internals){this._internals.setFormValue(select.value);this._syncValidity(this.hasAttribute("required")&&!select.value)}if(this._wiredSelect)return;this._wiredSelect=true;this.addEventListener("change",(e)=>{const sel=this.querySelector("select");if(!sel||e.target!==sel||!this._internals)return;this._internals.setFormValue(sel.value);this._emitForm("contour:change");this._syncValidity(this.hasAttribute("required")&&!sel.value)})}}define("contour-select",ContourSelect);class ContourVersion extends ContourBase{static get observed(){return["options"]}static get formAssociated(){return true}static get properties(){return{options:{attribute:"options"}}}render(){this.classList.add("c-version");const options=this.getAttribute("options");const generated=new Set(this._contourGenerated||[]);const authored=Array.from(this.children).filter((n)=>!generated.has(n));if(options&&!authored.length){try{const parsed=JSON.parse(options);const select=this.ensure("select.c-version",()=>{const el=document.createElement("select");el.className="c-version";return el});select.innerHTML="";if(!select.hasAttribute("aria-label"))select.setAttribute("aria-label","Version");parsed.forEach((opt)=>{const option=document.createElement("option");if(typeof opt==="string"){option.value=opt;option.textContent=opt}else{option.value=opt.value||opt.label;option.textContent=opt.label||opt.value;if(opt.selected)option.selected=true}select.appendChild(option)});if(select.parentNode!==this)this.appendChild(select);this.classList.remove("c-version");select.classList.add("c-version")}catch(e){}}}enhance(){if(this._wiredVersion)return;this._wiredVersion=true;const sync=()=>{const select=this.querySelector("select");if(!select||!this._internals)return;this._internals.setFormValue(select.value)};this.addEventListener("change",(e)=>{const select=this.querySelector("select");if(!select||e.target!==select)return;sync();this._emitForm("contour:change")});sync()}}define("contour-version",ContourVersion);class ContourTextarea extends ContourBase{static get observed(){return["placeholder","required"]}static get properties(){return{placeholder:{attribute:"placeholder"},required:{attribute:"required",type:Boolean}}}static get formAssociated(){return true}render(){this.classList.add("c-textarea");const ta=this.ensure("textarea",()=>{const el=document.createElement("textarea");el.className="c-textarea";return el});ta.className="c-textarea";ta.placeholder=this.getAttribute("placeholder")||"";if(this.hasAttribute("required"))ta.setAttribute("required","");else ta.removeAttribute("required")}enhance(){const ta=this.querySelector("textarea");if(ta&&this._internals){this._internals.setFormValue(ta.value);this._syncValidity(this.hasAttribute("required")&&!ta.value.trim())}if(this._wiredTextarea)return;this._wiredTextarea=true;this.addEventListener("input",(e)=>{const t=this.querySelector("textarea");if(!t||e.target!==t||!this._internals)return;this._internals.setFormValue(t.value);this._emitForm("contour:input");this._syncValidity(this.hasAttribute("required")&&!t.value.trim())});this.addEventListener("change",(e)=>{const t=this.querySelector("textarea");if(!t||e.target!==t||!this._internals)return;this._internals.setFormValue(t.value);this._emitForm("contour:change");this._syncValidity(this.hasAttribute("required")&&!t.value.trim())})}}define("contour-textarea",ContourTextarea);class ContourInputFull extends ContourBase{static get observed(){return["type","placeholder","required","value"]}static get properties(){return{type:{attribute:"type"},placeholder:{attribute:"placeholder"},required:{attribute:"required",type:Boolean},value:{attribute:"value"}}}static get formAssociated(){return true}render(){this.classList.add("c-input");const input=this.ensure("input",()=>{const el=document.createElement("input");el.className="c-input";return el});input.className="c-input";input.type=this.getAttribute("type")||"text";input.placeholder=this.getAttribute("placeholder")||"";if(this.hasAttribute("value"))input.value=this.getAttribute("value");if(this.hasAttribute("required"))input.setAttribute("required","");else input.removeAttribute("required")}enhance(){const input=this.querySelector("input");if(input&&this._internals){this._internals.setFormValue(input.value);this._syncValidity(this.hasAttribute("required")&&!input.value.trim())}if(this._wiredInput)return;this._wiredInput=true;this.addEventListener("input",(e)=>{const inp=this.querySelector("input");if(!inp||e.target!==inp||!this._internals)return;this._internals.setFormValue(inp.value);this._emitForm("contour:input");this._syncValidity(this.hasAttribute("required")&&!inp.value.trim())});this.addEventListener("change",(e)=>{const inp=this.querySelector("input");if(!inp||e.target!==inp||!this._internals)return;this._internals.setFormValue(inp.value);this._emitForm("contour:change");this._syncValidity(this.hasAttribute("required")&&!inp.value.trim())})}}define("contour-input",ContourInputFull);class ContourInputGroup extends ContourBase{static get observed(){return["label","placeholder","clearable","submit"]}static get properties(){return{label:{attribute:"label"},placeholder:{attribute:"placeholder"},clearable:{attribute:"clearable",type:Boolean},submit:{attribute:"submit",type:Boolean}}}render(){this.classList.add("c-input-group");const icon=this.ensure("svg",()=>{const el=document.createElementNS("http://www.w3.org/2000/svg","svg");el.setAttribute("aria-hidden","true");const use=document.createElementNS("http://www.w3.org/2000/svg","use");use.setAttribute("href","#i-search");el.appendChild(use);return el});const input=this.ensure("input.c-input",()=>{const el=document.createElement("input");el.className="c-input";el.type="text";return el});input.placeholder=this.getAttribute("placeholder")||this.getAttribute("label")||"";const oldClear=this.querySelector(".c-input-group__clear");if(oldClear)oldClear.remove();if(this.hasAttribute("clearable")){const btn=document.createElement("button");btn.className="c-input-group__clear";btn.type="button";btn.setAttribute("aria-label","Clear");btn.textContent="×";this.appendChild(btn)}const oldSubmit=this.querySelector(".c-input-group__submit");if(oldSubmit)oldSubmit.remove();if(this.hasAttribute("submit")){const btn=document.createElement("button");btn.className="c-input-group__submit";btn.type="submit";btn.setAttribute("aria-label","Submit");btn.textContent="→";this.appendChild(btn)}}enhance(){if(this._wiredInputGroup)return;this._wiredInputGroup=true;this.addEventListener("click",(e)=>{const clear=e.target&&e.target.closest?e.target.closest(".c-input-group__clear"):null;if(clear&&this.contains(clear)){e.preventDefault();const input=this.querySelector("input.c-input");if(input){input.value="";input.focus()}this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:""}}))}})}}define("contour-input-group",ContourInputGroup);class ContourRadioList extends ContourBase{static get observed(){return["items","name","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},name:{attribute:"name"},src:{attribute:"src"}}}static get formAssociated(){return true}render(){this.classList.add("c-radio-list");this.setAttribute("role","radiogroup");if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label",this.getAttribute("name")||"Options");wireStates(this);loadRemote(this,"items");if(renderStates(this,"radio-list"))return;const items=remoteData(this,"items");Array.from(this.querySelectorAll("label.c-radio")).forEach((l)=>l.remove());if(items){try{const parsed=JSON.parse(items);const groupName=this.getAttribute("name")||contourId("radio-list");parsed.forEach((it)=>{const lbl=document.createElement("label");lbl.className="c-radio";const input=document.createElement("input");input.type="radio";input.className="c-radio__input";input.name=groupName;input.tabIndex=-1;if(typeof it==="string"){input.value=it;lbl.appendChild(input);lbl.appendChild(document.createTextNode(" "+it))}else{input.value=it.value||it.label;if(it.checked)input.checked=true;lbl.appendChild(input);const span=document.createElement("span");span.textContent=it.label||it.value;lbl.appendChild(span)}this.appendChild(lbl)});const radios=Array.from(this.querySelectorAll("input.c-radio__input"));const checked=radios.find((r)=>r.checked)||radios[0];if(checked)checked.tabIndex=0}catch(e){}}else{renderEmpty(this,"radio-list")}}enhance(){const sync=()=>{if(!this._internals)return;const checked=this.querySelector("input.c-radio__input:checked");this._internals.setFormValue(checked?checked.value:null)};sync();if(this._wiredRadioList)return;this._wiredRadioList=true;this.addEventListener("change",(e)=>{const input=e.target&&e.target.closest?e.target.closest("input.c-radio__input"):null;if(!input||!this.contains(input))return;sync();this._emitForm("contour:change")});this.addEventListener("keydown",(e)=>{const radios=Array.from(this.querySelectorAll("input.c-radio__input"));if(!radios.length)return;const idx=radios.indexOf(e.target);if(idx===-1)return;const rtl=(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl";let next=-1;if(e.key==="ArrowDown")next=(idx+1)%radios.length;else if(e.key==="ArrowUp")next=(idx-1+radios.length)%radios.length;else if(e.key==="ArrowRight")next=rtl?(idx-1+radios.length)%radios.length:(idx+1)%radios.length;else if(e.key==="ArrowLeft")next=rtl?(idx+1)%radios.length:(idx-1+radios.length)%radios.length;else if(e.key==="Home")next=0;else if(e.key==="End")next=radios.length-1;else return;e.preventDefault();const before=radios.find((r)=>r.checked);for(const r of radios)r.tabIndex=-1;radios[next].tabIndex=0;radios[next].checked=true;radios[next].focus();sync();if(before!==radios[next])this._emitForm("contour:change")})}formResetCallback(){if(this._contourAuthored)this.requestRender()}}define("contour-radio-list",ContourRadioList);class ContourPressableFull extends ContourBase{static get observed(){return["disabled"]}static get properties(){return{disabled:{attribute:"disabled",type:Boolean}}}render(){this.classList.add("c-pressable");if(!this.hasAttribute("role"))this.setAttribute("role","button");if(this.hasAttribute("disabled")){this.setAttribute("aria-disabled","true");this.setAttribute("tabindex","-1")}else{this.removeAttribute("aria-disabled");if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0")}}enhance(){if(this._wiredPressable)return;this._wiredPressable=true;this.addEventListener("keydown",(e)=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();this.click();this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:true,composed:true}))}})}}define("contour-pressable",ContourPressableFull);class ContourResizeHandleFull extends ContourBase{render(){this.classList.add("c-resize-handle");if(!this.hasAttribute("role"))this.setAttribute("role","separator")}}define("contour-resize-handle",ContourResizeHandleFull);class ContourSearchTriggerFull extends ContourBase{static get observed(){return["label","shortcut"]}static get properties(){return{label:{attribute:"label"},shortcut:{attribute:"shortcut"}}}render(){this.classList.add("c-search-trigger");const label=this.getAttribute("label")||"Search";if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label",label);const span=this.ensure(".c-search-trigger__text",()=>{const el=document.createElement("span");el.className="c-search-trigger__text";return el});span.className="c-search-trigger__text";if(!span.textContent.trim()||span.textContent.trim()!==label)span.textContent=label;const kbd=this.ensure("kbd.c-search-trigger__kbd",()=>{const el=document.createElement("kbd");el.className="c-search-trigger__kbd";return el});kbd.className="c-search-trigger__kbd";kbd.textContent=this.getAttribute("shortcut")||"⌘K"}}define("contour-search-trigger",ContourSearchTriggerFull);class ContourShortcutListFull extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-shortcut-list");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-shortcut-list__title",()=>{const el=document.createElement("div");el.className="c-shortcut-list__title";el.style.padding="var(--space-sm)";el.style.fontWeight="var(--weight-semibold)";return el});t.textContent=title}}}define("contour-shortcut-list",ContourShortcutListFull);class ContourShortcutRowFull extends ContourBase{static get observed(){return["desc","key"]}static get properties(){return{desc:{attribute:"desc"},key:{attribute:"key"}}}render(){this.classList.add("c-shortcut-row");const key=this.getAttribute("key");const desc=this.getAttribute("desc");if(key){const k=this.ensure(".c-shortcut-row__keys",()=>{const el=document.createElement("kbd");el.className="c-shortcut-row__keys";return el});k.className="c-shortcut-row__keys";k.textContent=key}else{const k=this.querySelector(".c-shortcut-row__keys");if(k)k.remove()}if(desc){const s=this.ensure(".c-shortcut-row__label",()=>{const el=document.createElement("span");el.className="c-shortcut-row__label";return el});s.className="c-shortcut-row__label";s.textContent=desc}else{const s=this.querySelector(".c-shortcut-row__label");if(s)s.remove()}}}define("contour-shortcut-row",ContourShortcutRowFull);class ContourShortcutPanelFull extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-shortcut-panel");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-shortcut-panel__title",()=>{const el=document.createElement("div");el.className="c-shortcut-panel__title";return el});t.textContent=title}else{const t=this.querySelector(".c-shortcut-panel__title");if(t)t.remove()}}}define("contour-shortcut-panel",ContourShortcutPanelFull);class ContourShortcutOverlayFull extends ContourBase{static get observed(){return["title","open"]}static get properties(){return{title:{attribute:"title"},open:{attribute:"open",type:Boolean}}}render(){this.classList.add("c-shortcut-overlay");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-shortcut-overlay__title",()=>{const el=document.createElement("div");el.className="c-shortcut-overlay__title";el.style.padding="var(--space-sm)";return el});t.textContent=title}if(this.hasAttribute("open"))this.removeAttribute("hidden");else if(!this.hasAttribute("hidden"))this.setAttribute("hidden","")}show(){this.setAttribute("open","");this.removeAttribute("hidden");this.dispatchEvent(new CustomEvent("contour:open",{bubbles:true,composed:true}))}hide(){this.removeAttribute("open");this.setAttribute("hidden","");this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}))}toggle(){if(this.hasAttribute("open"))this.hide();else this.show()}enhance(){if(this._wiredShortcutOverlay)return;this._wiredShortcutOverlay=true;document.addEventListener("keydown",(e)=>{if(e.key==="?"&&!e.metaKey&&!e.ctrlKey&&!e.altKey){const tag=(e.target&&e.target.tagName)||"";if(tag==="INPUT"||tag==="TEXTAREA"||(e.target&&e.target.isContentEditable))return;e.preventDefault();this.toggle()}else if(e.key==="Escape"&&this.hasAttribute("open")){this.hide()}});this.addEventListener("click",(e)=>{if(e.target===this)this.hide()})}}define("contour-shortcut-overlay",ContourShortcutOverlayFull);class ContourRowActionFull extends ContourBase{static get observed(){return["label","disabled"]}static get properties(){return{label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean}}}render(){this.classList.add("c-row-action");if(!this.hasAttribute("role"))this.setAttribute("role","button");if(this.hasAttribute("disabled")){this.setAttribute("aria-disabled","true");this.setAttribute("tabindex","-1")}else{this.removeAttribute("aria-disabled");if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0")}const label=this.getAttribute("label");if(label&&!this.hasChildNodes())this.textContent=label}enhance(){if(this._wiredRowAction)return;this._wiredRowAction=true;this.addEventListener("keydown",(e)=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();this.click();this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:true,composed:true}))}})}}define("contour-row-action",ContourRowActionFull);class ContourSegmented extends ContourBase{static get observed(){return["options","selected","label","value"]}static get properties(){return{options:{attribute:"options"},selected:{attribute:"selected"},label:{attribute:"label"},value:{attribute:"value"}}}render(){this.classList.add("c-segmented");const options=this.getAttribute("options");if(options){let parsed=null;try{parsed=JSON.parse(options)}catch(e){parsed=null}if(Array.isArray(parsed)){Array.from(this.querySelectorAll("button.c-segmented__option")).forEach((n)=>n.remove());const selected=this.getAttribute("selected")||this.getAttribute("value");parsed.forEach((opt,i)=>{const label=typeof opt==="string"?opt:(opt.label||opt.value||"");const val=typeof opt==="string"?opt:(opt.value||opt.label||"");const btn=document.createElement("button");btn.className="c-segmented__option";btn.type="button";btn.textContent=label;btn.dataset.value=val;if(selected!==null&&String(val)===String(selected))btn.setAttribute("aria-pressed","true");else if(selected===null&&i===0)btn.setAttribute("aria-pressed","true");else btn.setAttribute("aria-pressed","false");this.appendChild(btn)})}}}enhance(){wireSegmented(this)}}define("contour-segmented",ContourSegmented);class ContourDraggable extends ContourBase{render(){this.classList.add("c-draggable");if(!this.hasAttribute("role"))this.setAttribute("role","button");if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");if(!this.hasAttribute("draggable"))this.setAttribute("draggable","true")}_dragValue(){return this.getAttribute("value")||this.getAttribute("label")||(this.textContent||"").trim()||"draggable"}enhance(){if(this._wiredDraggable)return;this._wiredDraggable=true;this.addEventListener("dragstart",(e)=>{if(!e.dataTransfer)return;const value=this._dragValue();try{e.dataTransfer.effectAllowed="move"}catch(err){}e.dataTransfer.setData("text/plain",value);this.classList.add("c-draggable--dragging");this.dispatchEvent(new CustomEvent("contour:dragstart",{bubbles:true,composed:true,detail:{value}}))});this.addEventListener("dragend",()=>{this.classList.remove("c-draggable--dragging");this.dispatchEvent(new CustomEvent("contour:dragend",{bubbles:true,composed:true,detail:{value:this._dragValue()}}))});this.addEventListener("keydown",(e)=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:true,composed:true}));return}if(e.key==="ArrowUp"||e.key==="ArrowDown"){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:move",{bubbles:true,composed:true,detail:{direction:e.key==="ArrowUp"?"up":"down"}}))}})}}define("contour-draggable",ContourDraggable);class ContourDragHandle extends ContourBase{render(){this.classList.add("c-drag-handle");if(!this.hasAttribute("role"))this.setAttribute("role","separator");if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");if(!this.hasAttribute("aria-orientation"))this.setAttribute("aria-orientation","horizontal")}enhance(){if(this._wiredDragHandle)return;this._wiredDragHandle=true;this.addEventListener("keydown",(e)=>{let delta=0;if(e.key==="ArrowLeft"||e.key==="ArrowDown")delta=-1;else if(e.key==="ArrowRight"||e.key==="ArrowUp")delta=1;else if(e.key==="Home")delta=-Infinity;else if(e.key==="End")delta=Infinity;else return;e.preventDefault();this.dispatchEvent(new CustomEvent("contour:drag",{bubbles:true,composed:true,detail:{key:e.key,delta}}))})}}define("contour-drag-handle",ContourDragHandle);class ContourDropIndicator extends ContourBase{static get observed(){return["label"]}static get properties(){return{label:{attribute:"label"}}}render(){this.classList.add("c-drop-indicator");this.classList.add("c-drop-indicator--visible");Array.from(this.childNodes).forEach((n)=>{if(n.nodeType===Node.TEXT_NODE)n.remove();else if(n.nodeType===Node.ELEMENT_NODE&&n.tagName==="SPAN")n.remove()});const label=this.getAttribute("label");if(label){const t=this.ensure(".c-drop-indicator__label",()=>{const el=document.createElement("span");el.className="c-drop-indicator__label";return el});t.textContent=label}}}define("contour-drop-indicator",ContourDropIndicator);class ContourDropZone extends ContourBase{static get observed(){return["label"]}static get properties(){return{label:{attribute:"label"}}}render(){this.classList.add("c-drop-zone");Array.from(this.childNodes).forEach((n)=>{if(n.nodeType===Node.TEXT_NODE)n.remove();else if(n.nodeType===Node.ELEMENT_NODE&&n.tagName==="SPAN")n.remove()});const label=this.getAttribute("label");if(label){const t=this.ensure(".c-drop-zone__label",()=>{const el=document.createElement("p");el.className="c-drop-zone__label";return el});t.textContent=label}}enhance(){if(this._wiredDropZone)return;this._wiredDropZone=true;const accepts=(e)=>e.dataTransfer&&Array.from(e.dataTransfer.types).includes("text/plain");const clear=()=>{this.classList.remove("c-drop-zone--active","c-drop-zone--reject")};this.addEventListener("dragenter",(e)=>{if(!e.dataTransfer)return;this.classList.toggle("c-drop-zone--reject",!accepts(e));if(accepts(e)){e.preventDefault();this.classList.add("c-drop-zone--active")}});this.addEventListener("dragover",(e)=>{if(!e.dataTransfer)return;this.classList.toggle("c-drop-zone--reject",!accepts(e));if(accepts(e)){e.preventDefault();this.classList.add("c-drop-zone--active")}});this.addEventListener("dragleave",clear);this.addEventListener("drop",(e)=>{if(!accepts(e))return;e.preventDefault();clear();const value=e.dataTransfer.getData("text/plain")||"";this.dispatchEvent(new CustomEvent("contour:drop",{bubbles:true,composed:true,detail:{value,label:this.getAttribute("label")}}))})}}define("contour-drop-zone",ContourDropZone);class ContourResizable extends ContourBase{static get observed(){return["direction","value"]}static get properties(){return{direction:{attribute:"direction"},value:{attribute:"value"}}}render(){this.classList.add("c-resizable");this.classList.remove("c-resizable--vertical","c-resizable--horizontal");const vertical=this.getAttribute("direction")==="vertical";this.classList.add(vertical?"c-resizable--vertical":"c-resizable--horizontal");if(!this.querySelector(".c-resizable__pane")){const p1=document.createElement("div");p1.className="c-resizable__pane";p1.textContent="Pane A";const handle=document.createElement("div");handle.className="c-resize-handle";handle.setAttribute("tabindex","0");handle.setAttribute("role","separator");const p2=document.createElement("div");p2.className="c-resizable__pane";p2.textContent="Pane B";this.appendChild(p1);this.appendChild(handle);this.appendChild(p2)}const v=this._splitValue||this.getAttribute("value");if(v){const p1=this.querySelector(".c-resizable__pane");if(p1)p1.style.flex=`0 0 ${v}%`}}enhance(){if(this._wiredResizable)return;this._wiredResizable=true;const setSplit=(clientX,clientY)=>{const rect=this.getBoundingClientRect();const vertical=this.classList.contains("c-resizable--vertical");const span=vertical?rect.height:rect.width;const pos=vertical?clientY-rect.top:clientX-rect.left;const frac=span>0?Math.min(0.9,Math.max(0.1,pos/span)):0.5;const p1=this.querySelector(".c-resizable__pane");if(p1)p1.style.flex=`0 0 ${Math.round(frac * 100)}%`;this._splitValue=String(Math.round(frac*100))};this.addEventListener("pointerdown",(e)=>{const handle=this.querySelector(".c-resize-handle");if(!handle||e.target!==handle)return;this._resizing=true;handle.classList.add("c-resize-handle--dragging");if(handle.setPointerCapture){try{handle.setPointerCapture(e.pointerId)}catch(err){}}e.preventDefault()});this.addEventListener("pointermove",(e)=>{if(!this._resizing)return;setSplit(e.clientX,e.clientY)});const stopResize=(e)=>{if(!this._resizing)return;this._resizing=false;if(this._splitValue){this.setAttribute("value",this._splitValue);this._splitValue=null}const handle=this.querySelector(".c-resize-handle");if(handle){handle.classList.remove("c-resize-handle--dragging");if(handle.hasPointerCapture&&handle.hasPointerCapture(e.pointerId)){try{handle.releasePointerCapture(e.pointerId)}catch(err){}}}};this.addEventListener("pointerup",stopResize);this.addEventListener("pointercancel",stopResize);this.addEventListener("keydown",(e)=>{const handle=this.querySelector(".c-resize-handle");if(!handle||document.activeElement!==handle)return;const vertical=this.classList.contains("c-resizable--vertical");const cur=parseFloat(this.getAttribute("value"))||50;if(e.key==="ArrowLeft"||e.key==="ArrowDown"){e.preventDefault();setSplit&&setSplit;const p1=this.querySelector(".c-resizable__pane");if(p1){const nv=Math.max(10,cur-5);p1.style.flex=`0 0 ${nv}%`;this.setAttribute("value",String(nv))}}else if(e.key==="ArrowRight"||e.key==="ArrowUp"){e.preventDefault();const p1=this.querySelector(".c-resizable__pane");if(p1){const nv=Math.min(90,cur+5);p1.style.flex=`0 0 ${nv}%`;this.setAttribute("value",String(nv))}}})}}define("contour-resizable",ContourResizable);class ContourTableWrap extends ContourBase{static get observed(){return[]}static get properties(){return{}}render(){this.classList.add("c-table-wrap");Array.from(this.childNodes).forEach((n)=>{if(n.nodeType===Node.TEXT_NODE)n.remove();else if(n.nodeType===Node.ELEMENT_NODE&&n.tagName==="SPAN")n.remove()});if(!this.querySelector("table")){const t=document.createElement("table");t.className="c-table";const thead=document.createElement("thead");const tr=document.createElement("tr");for(const h of["A","B"]){const th=document.createElement("th");th.textContent=h;tr.appendChild(th)}thead.appendChild(tr);t.appendChild(thead);const tbody=document.createElement("tbody");const tr2=document.createElement("tr");for(const v of["1","2"]){const td=document.createElement("td");td.textContent=v;tr2.appendChild(td)}tbody.appendChild(tr2);t.appendChild(tbody);this.appendChild(t)}}}define("contour-table-wrap",ContourTableWrap);class ContourScrollArea extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-scroll-area");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-scroll-area__title",()=>{const el=document.createElement("div");el.className="c-scroll-area__title";el.style.padding="var(--space-sm)";el.style.fontWeight="var(--weight-semibold)";return el});t.textContent=title}}}define("contour-scroll-area",ContourScrollArea);class ContourBtn extends ContourBase{static get observed(){return["variant","size","color","label","disabled"]}static get properties(){return{variant:{attribute:"variant"},size:{attribute:"size"},color:{attribute:"color"},label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean}}}render(){this.classList.add("c-btn");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-btn--"))this.classList.remove(c)});for(const attr of["variant","size","color"]){const val=this.getAttribute(attr);if(val)this.classList.add("c-btn--"+val)}if(!this.hasAttribute("role"))this.setAttribute("role","button");if(this.hasAttribute("disabled")){this.setAttribute("aria-disabled","true");this.setAttribute("tabindex","-1")}else{this.removeAttribute("aria-disabled");if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0")}const label=this.getAttribute("label");if(label&&!this.hasChildNodes())this.textContent=label;if(label&&!this.hasAttribute("aria-label"))this.setAttribute("aria-label",label)}enhance(){if(this._wiredBtn)return;this._wiredBtn=true;this.addEventListener("keydown",(e)=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();this.click();this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:true,composed:true}))}})}}define("contour-btn",ContourBtn);class ContourApp extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-app");const header=this.ensure(".c-app__header",()=>{const el=document.createElement("header");el.className="c-app__header";return el});const title=this.getAttribute("title");if(title){const t=this.ensure(".c-app__title",()=>{const el=document.createElement("div");el.className="c-app__title";el.style.padding="var(--space-md)";el.style.fontWeight="var(--weight-semibold)";return el});t.textContent=title;if(t.parentNode!==header)header.appendChild(t)}const main=this.ensure(".c-app__main",()=>{const el=document.createElement("main");el.className="c-app__main";return el});if(main.parentNode!==this)this.appendChild(main);if(header.parentNode!==this)this.insertBefore(header,main)}}define("contour-app",ContourApp);class ContourAppBody extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-app-body");const main=this.ensure(".c-app-body__main",()=>{const el=document.createElement("main");el.className="c-app-body__main";return el});const title=this.getAttribute("title");if(title){const t=this.ensure(".c-app-body__title",()=>{const el=document.createElement("div");el.className="c-app-body__title";el.style.padding="var(--space-md)";return el});t.textContent=title;if(t.parentNode!==main)main.appendChild(t)}if(main.parentNode!==this)this.appendChild(main)}}define("contour-app-body",ContourAppBody);class ContourBtnGroup extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-btn-group");this.setAttribute("role","group");if(this.getAttribute("title"))this.setAttribute("aria-label",this.getAttribute("title"));if(!this.querySelector(".c-btn")){for(const lbl of["One","Two","Three"]){const b=document.createElement("button");b.className="c-btn c-btn--sm";b.type="button";b.textContent=lbl;this.appendChild(b)}}}enhance(){if(this._wiredBtnGroup)return;this._wiredBtnGroup=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-btn"):null;if(btn&&this.contains(btn)){const buttons=Array.from(this.querySelectorAll(".c-btn"));const index=buttons.indexOf(btn);this.dispatchEvent(new CustomEvent("contour:btn-group-change",{bubbles:true,composed:true,detail:{index,label:btn.textContent}}))}});this.addEventListener("keydown",(e)=>{const buttons=Array.from(this.querySelectorAll(".c-btn"));if(!buttons.length)return;const active=document.activeElement;const idx=buttons.indexOf(active);let next=-1;const rtl=(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl";if(e.key==="ArrowDown")next=idx<0?0:Math.min(buttons.length-1,idx+1);else if(e.key==="ArrowUp")next=idx<0?0:Math.max(0,idx-1);else if(e.key==="ArrowRight")next=rtl?(idx<0?0:Math.max(0,idx-1)):(idx<0?0:Math.min(buttons.length-1,idx+1));else if(e.key==="ArrowLeft")next=rtl?(idx<0?0:Math.min(buttons.length-1,idx+1)):(idx<0?0:Math.max(0,idx-1));else if(e.key==="Home")next=0;else if(e.key==="End")next=buttons.length-1;if(next>=0&&next!==idx){e.preventDefault();buttons[next].focus()}})}}define("contour-btn-group",ContourBtnGroup);class ContourRangeScale extends ContourBase{static get observed(){return["label","value","ticks"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},ticks:{attribute:"ticks"}}}render(){this.classList.add("c-range-scale");this.setAttribute("role","group");if(this.getAttribute("label"))this.setAttribute("aria-label",this.getAttribute("label"));const label=this.getAttribute("label");if(label){const t=this.ensure(".c-range-scale__label",()=>{const el=document.createElement("span");el.className="c-range-scale__label";return el});t.textContent=label}const ticksAttr=this.getAttribute("ticks");Array.from(this.querySelectorAll(".c-range-scale__tick")).forEach((n)=>n.remove());if(ticksAttr){ticksAttr.split(",").map((s)=>s.trim()).filter(Boolean).forEach((tk)=>{const t=document.createElement("span");t.className="c-range-scale__tick";t.textContent=tk;this.appendChild(t)})}}enhance(){if(this._wiredRangeScale)return;this._wiredRangeScale=true;this.addEventListener("input",(e)=>{const t=e.target;if(t&&t.matches&&t.matches("input")){this.dispatchEvent(new CustomEvent("contour:range-change",{bubbles:true,composed:true,detail:{value:t.value}}))}});this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.matches&&t.matches("input")){this.dispatchEvent(new CustomEvent("contour:range-change",{bubbles:true,composed:true,detail:{value:t.value}}))}})}}define("contour-range-scale",ContourRangeScale);class ContourTimeRange extends ContourBase{static get observed(){return["label","value","ticks"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},ticks:{attribute:"ticks"}}}render(){this.classList.add("c-time-range");this.setAttribute("role","group");if(this.getAttribute("label"))this.setAttribute("aria-label",this.getAttribute("label"));const label=this.getAttribute("label");if(label){const t=this.ensure(".c-time-range__label",()=>{const el=document.createElement("span");el.className="c-time-range__label";return el});t.textContent=label}const ticksAttr=this.getAttribute("ticks");Array.from(this.querySelectorAll(".c-time-range__tick")).forEach((n)=>n.remove());if(ticksAttr){ticksAttr.split(",").map((s)=>s.trim()).filter(Boolean).forEach((tk)=>{const t=document.createElement("span");t.className="c-time-range__tick";t.textContent=tk;this.appendChild(t)})}}enhance(){if(this._wiredTimeRange)return;this._wiredTimeRange=true;this.addEventListener("input",(e)=>{const t=e.target;if(t&&t.matches&&t.matches("input")){this.dispatchEvent(new CustomEvent("contour:time-range-change",{bubbles:true,composed:true,detail:{value:t.value}}))}});this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.matches&&t.matches("input")){this.dispatchEvent(new CustomEvent("contour:time-range-change",{bubbles:true,composed:true,detail:{value:t.value}}))}})}}define("contour-time-range",ContourTimeRange);function wireMapItems(host,itemSelector,tooltipClass){if(host._wiredMapItems)return;host._wiredMapItems=true;const items=()=>Array.from(host.querySelectorAll(itemSelector));const showTip=(e)=>{const tip=host.querySelector(tooltipClass);if(!tip)return;const item=e&&e.target&&typeof e.target.closest==="function"?e.target.closest(itemSelector):null;if(!item||!host.contains(item)){tip.setAttribute("hidden","");return}const title=item.getAttribute("title");if(title)tip.textContent=title;const rect=host.getBoundingClientRect();const ir=item.getBoundingClientRect();tip.style.setProperty("--chart-tip-inline-start",(ir.left-rect.left+ir.width/2)+"px");tip.style.setProperty("--chart-tip-block-start",(ir.top-rect.top)+"px");tip.removeAttribute("hidden")};const hideTip=()=>{const tip=host.querySelector(tooltipClass);if(tip)tip.setAttribute("hidden","")};host.addEventListener("mouseover",showTip);host.addEventListener("mouseout",(e)=>{if(!e.relatedTarget||!host.contains(e.relatedTarget))hideTip()});host.addEventListener("focusin",(e)=>{const item=e&&e.target&&typeof e.target.closest==="function"?e.target.closest(itemSelector):null;if(item&&host.contains(item))showTip({target:item})});host.addEventListener("focusout",(e)=>{if(!host.contains(e.relatedTarget))hideTip()});host.addEventListener("click",(e)=>{const item=e&&e.target&&typeof e.target.closest==="function"?e.target.closest(itemSelector):null;if(!item||!host.contains(item))return;const all=items();const index=all.indexOf(item);if(index<0)return;host.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{index,label:item.getAttribute("title")||item.textContent.trim()}}))});host.addEventListener("keydown",(e)=>{const item=e&&e.target&&typeof e.target.closest==="function"?e.target.closest(itemSelector):null;if(!item||!host.contains(item))return;if(e.key==="Enter"||e.key===" "){e.preventDefault();const all=items();const index=all.indexOf(item);if(index<0)return;host.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{index,label:item.getAttribute("title")||item.textContent.trim()}}))}const all=items();const idx=all.indexOf(item);if(idx<0)return;let next=-1;const rtl=(host.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase()==="rtl";if(e.key==="ArrowDown")next=Math.min(idx+1,all.length-1);else if(e.key==="ArrowUp")next=Math.max(idx-1,0);else if(e.key==="ArrowRight")next=rtl?Math.max(idx-1,0):Math.min(idx+1,all.length-1);else if(e.key==="ArrowLeft")next=rtl?Math.min(idx+1,all.length-1):Math.max(idx-1,0);else if(e.key==="Home")next=0;else if(e.key==="End")next=all.length-1;if(next<0||next===idx)return;e.preventDefault();all.forEach((c,i)=>c.setAttribute("tabindex",i===next?"0":"-1"));try{all[next].focus()}catch(err){}})}class ContourMinimap extends ContourBase{static get observed(){return["label","viewport","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},viewport:{attribute:"viewport"},src:{attribute:"src"}}}render(){this.classList.add("c-minimap");wireStates(this);loadRemote(this,["label","viewport"]);if(renderStates(this,"minimap"))return;const label=remoteData(this,"label")||(this._remoteData&&this._remoteData.label);const viewport=remoteData(this,"viewport")||(this._remoteData&&(this._remoteData.viewport||this._remoteData.value));if(!label&&!viewport){renderEmpty(this,"minimap");return}if(label){const l=this.ensure(".c-minimap__label",()=>{const el=document.createElement("span");el.className="c-minimap__label";return el});l.textContent=label}else{const l=this.querySelector(".c-minimap__label");if(l)l.remove()}if(viewport){const v=this.ensure(".c-minimap__viewport",()=>{const el=document.createElement("div");el.className="c-minimap__viewport";return el});v.textContent=viewport}else{const v=this.querySelector(".c-minimap__viewport");if(v)v.remove()}}enhance(){if(this._wiredMinimap)return;this._wiredMinimap=true;let dragging=false;this.addEventListener("pointerdown",(e)=>{const vp=this.querySelector(".c-minimap__viewport");if(!vp||!vp.contains(e.target))return;dragging=true;try{vp.setPointerCapture(e.pointerId)}catch(err){}});this.addEventListener("pointermove",(e)=>{if(!dragging)return;this.dispatchEvent(new CustomEvent("contour:move",{detail:{direction:"drag"},bubbles:true,composed:true}))});this.addEventListener("pointerup",()=>{dragging=false})}}define("contour-minimap",ContourMinimap);class ContourCoordinate extends ContourBase{static get observed(){return["value","format","locale","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{value:{attribute:"value"},format:{attribute:"format"},locale:{attribute:"locale"},src:{attribute:"src"}}}render(){this.classList.add("c-coordinate");wireStates(this);loadRemote(this,"value");if(renderStates(this,"coordinate"))return;const value=remoteData(this,"value")||(this._remoteData&&(this._remoteData.value||this._remoteData.coordinate));if(!value){renderEmpty(this,"coordinate");return}const format=this.getAttribute("format")||"decimal";let text=String(value);if(format==="dms"){const parts=String(value).split(/[,\s]+/).map(Number);if(parts.length>=2&&Number.isFinite(parts[0])&&Number.isFinite(parts[1])){const toDMS=(d)=>{const deg=Math.floor(Math.abs(d));const min=Math.floor((Math.abs(d)-deg)*60);const sec=(((Math.abs(d)-deg)*60)-min)*60;return deg+"°"+min+"'"+sec.toFixed(1)+'"'+(d<0?"S":"N")};text=toDMS(parts[0])+" "+toDMS(parts[1])}}else if(format==="web-mercator"){const parts=String(value).split(/[,\s]+/).map(Number);if(parts.length>=2&&Number.isFinite(parts[0])&&Number.isFinite(parts[1])){const x=parts[1]*20037508.34/180;const y=Math.log(Math.tan((90+parts[0])*Math.PI/360))/(Math.PI/180)*20037508.34/180;text=x.toFixed(2)+", "+y.toFixed(2)}}else{text=formatValue(value,this.getAttribute("format"),this.getAttribute("locale"))}const span=this.ensure(".c-coordinate__value",()=>{const el=document.createElement("span");el.className="c-coordinate__value";return el});span.textContent=text;let btn=this.querySelector(".c-coordinate__copy");if(!btn){btn=document.createElement("button");btn.type="button";btn.className="c-coordinate__copy";btn.textContent="Copy";btn.setAttribute("aria-label","Copy coordinate");this.appendChild(btn)}btn.onclick=()=>{try{if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(text).catch(()=>{fallbackCopy(text)})}else{fallbackCopy(text)}}catch(e){fallbackCopy(text)}this.dispatchEvent(new CustomEvent("contour:copy",{detail:{text},bubbles:true,composed:true}))};function fallbackCopy(t){try{const ta=document.createElement("textarea");ta.value=t;ta.style.position="fixed";ta.style.opacity="0";document.body.appendChild(ta);ta.select();document.execCommand("copy");document.body.removeChild(ta)}catch(e){}}}}define("contour-coordinate",ContourCoordinate);class ContourLayerPanel extends ContourBase{static get observed(){return["label","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-layer-panel");wireStates(this);loadRemote(this,"items");if(renderStates(this,"layer-panel"))return;const items=remoteData(this,"items");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-layer-panel__label",()=>{const el=document.createElement("span");el.className="c-layer-panel__label";return el});l.textContent=label}else{const l=this.querySelector(".c-layer-panel__label");if(l)l.remove()}const authoredLayerItems=Array.from(this.querySelectorAll(":scope > .c-layer-panel__item"));const savedVisibility=new Map();this.querySelectorAll(".c-layer-panel__item").forEach((el)=>{const nm=el.querySelector(".c-layer-panel__name");const tg=el.querySelector(".c-layer-panel__toggle");if(nm&&tg)savedVisibility.set(nm.textContent,tg.checked)});let parsed=null;if(authoredLayerItems.length){parsed=authoredLayerItems.map((el)=>{const nm=el.querySelector(".c-layer-panel__name");const tg=el.querySelector(".c-layer-panel__toggle");return{name:nm?nm.textContent:"",visible:tg?tg.checked:true}});authoredLayerItems.forEach((el)=>el.remove())}else if(items){try{parsed=JSON.parse(items);Array.from(this.querySelectorAll(".c-layer-panel__item")).forEach((el)=>el.remove())}catch(e){}}if(parsed){parsed.forEach((it)=>{const name=typeof it==="string"?it:(it.name||it.label||"");const item=document.createElement("div");item.className="c-layer-panel__item"+(it.dragging?" c-layer-panel__item--dragging":"");const toggle=document.createElement("input");toggle.type="checkbox";toggle.className="c-layer-panel__toggle";toggle.setAttribute("aria-label","Toggle "+(name||"layer"));if(savedVisibility.has(name))toggle.checked=savedVisibility.get(name);else if(typeof it==="object"&&it.visible!==false)toggle.checked=true;item.appendChild(toggle);const nm=document.createElement("span");nm.className="c-layer-panel__name";nm.textContent=name;item.appendChild(nm);const opacity=document.createElement("input");opacity.type="range";opacity.className="c-layer-panel__opacity";opacity.min="0";opacity.max="100";opacity.setAttribute("aria-label","Opacity of "+(name||"layer"));opacity.value=(typeof it==="object"&&it.opacity!=null)?it.opacity:"100";item.appendChild(opacity);const renameBtn=document.createElement("button");renameBtn.type="button";renameBtn.className="c-layer-panel__rename";renameBtn.textContent="Rename";renameBtn.setAttribute("aria-label","Rename "+(name||"layer"));item.appendChild(renameBtn);const dupBtn=document.createElement("button");dupBtn.type="button";dupBtn.className="c-layer-panel__duplicate";dupBtn.textContent="Duplicate";dupBtn.setAttribute("aria-label","Duplicate "+(name||"layer"));item.appendChild(dupBtn);const zoomBtn=document.createElement("button");zoomBtn.type="button";zoomBtn.className="c-layer-panel__zoom";zoomBtn.textContent="Zoom";zoomBtn.setAttribute("aria-label","Zoom to "+(name||"layer"));item.appendChild(zoomBtn);const projSel=document.createElement("select");projSel.className="c-layer-panel__projection";projSel.setAttribute("aria-label","Projection of "+(name||"layer"));["EPSG:4326","EPSG:3857"].forEach((p)=>{const o=document.createElement("option");o.value=p;o.textContent=p;projSel.appendChild(o)});item.appendChild(projSel);this.appendChild(item)})}if(!parsed&&!authoredLayerItems.length&&!items){Array.from(this.querySelectorAll(".c-layer-panel__item")).forEach((el)=>el.remove());renderEmpty(this,"layer-panel")}}enhance(){if(this._wiredLayerPanel)return;this._wiredLayerPanel=true;this.addEventListener("change",(e)=>{const item=e.target&&e.target.closest?e.target.closest(".c-layer-panel__item"):null;if(!item||!this.contains(item))return;const name=item.querySelector(".c-layer-panel__name")?.textContent||"";if(e.target.classList.contains("c-layer-panel__toggle")){this.dispatchEvent(new CustomEvent("contour:layer-visibility",{bubbles:true,composed:true,detail:{name,visible:e.target.checked}}))}else if(e.target.classList.contains("c-layer-panel__opacity")){this.dispatchEvent(new CustomEvent("contour:layer-opacity",{bubbles:true,composed:true,detail:{name,opacity:Number(e.target.value)}}))}else if(e.target.classList.contains("c-layer-panel__projection")){this.dispatchEvent(new CustomEvent("contour:layer-projection",{bubbles:true,composed:true,detail:{name,projection:e.target.value}}))}});this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest("button"):null;if(!btn||!this.contains(btn))return;const item=btn.closest(".c-layer-panel__item");if(!item)return;const name=item.querySelector(".c-layer-panel__name")?.textContent||"";if(btn.classList.contains("c-layer-panel__rename")){const newName=prompt("Rename layer",name);const trimmed=newName?newName.trim():"";if(trimmed&&trimmed!==name){const nm=item.querySelector(".c-layer-panel__name");if(nm)nm.textContent=trimmed;this.dispatchEvent(new CustomEvent("contour:layer-rename",{bubbles:true,composed:true,detail:{name,newName:trimmed}}))}}else if(btn.classList.contains("c-layer-panel__duplicate")){this.dispatchEvent(new CustomEvent("contour:layer-duplicate",{bubbles:true,composed:true,detail:{name}}))}else if(btn.classList.contains("c-layer-panel__zoom")){this.dispatchEvent(new CustomEvent("contour:layer-zoom",{bubbles:true,composed:true,detail:{name}}))}})}}define("contour-layer-panel",ContourLayerPanel);class ContourTimeSlider extends ContourBase{static get observed(){return["label","value","loop","speed"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},src:{attribute:"src"}}}render(){this.classList.add("c-time-slider");const play=this.ensure(".c-time-slider__play",()=>{const el=document.createElement("button");el.className="c-time-slider__play";el.type="button";el.setAttribute("aria-label","Play");el.setAttribute("data-state","play");const svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("aria-hidden","true");const use=document.createElementNS("http://www.w3.org/2000/svg","use");use.setAttribute("href","#i-play");svg.appendChild(use);el.appendChild(svg);return el});const track=this.ensure(".c-time-slider__track",()=>{const el=document.createElement("input");el.className="c-time-slider__track";el.type="range";el.min="0";el.max="100";el.setAttribute("aria-label","Time");return el});const _attrVal=this.getAttribute("value")||"0";if(this._timeSliderAttrLast!==_attrVal){track.value=_attrVal;this._timeSliderAttrLast=_attrVal}track.setAttribute("aria-label",this.getAttribute("label")||"Time");const time=this.ensure(".c-time-slider__time",()=>{const el=document.createElement("span");el.className="c-time-slider__time";return el});time.textContent=this.getAttribute("label")||""}enhance(){if(this._wiredTimeSlider)return;this._wiredTimeSlider=true;let timer=undefined;const stop=()=>{if(timer!==undefined){clearInterval(timer);timer=undefined}};const step=()=>{const track=this.querySelector(".c-time-slider__track");if(!track){stop();return}const max=Number(track.max)||100;const loop=this.hasAttribute("loop");let next=(Number(track.value)||0)+1;if(next>max){if(loop)next=0;else next=max}track.value=String(next);this.dispatchEvent(new CustomEvent("contour:time-change",{detail:{value:String(next)},bubbles:true,composed:true}));if(!loop&&next>=max){stop();const btn=this.querySelector(".c-time-slider__play");if(btn){btn.setAttribute("data-state","play");btn.setAttribute("aria-label","Play");const use=btn.querySelector("use");if(use)use.setAttribute("href","#i-play")}}};this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-time-slider__play"):null;if(!btn)return;const playing=btn.getAttribute("data-state")==="play";btn.setAttribute("data-state",playing?"pause":"play");btn.setAttribute("aria-label",playing?"Pause":"Play");const use=btn.querySelector("use");if(use)use.setAttribute("href",playing?"#i-pause":"#i-play");if(playing){stop();const speed=parseFloat(this.getAttribute("speed")||"1")||1;const delay=Math.max(100,1000/speed);timer=setInterval(step,delay)}else{stop()}});onDispose(this,stop)}disconnectedCallback(){super.disconnectedCallback();this._wiredTimeSlider=false}}define("contour-time-slider",ContourTimeSlider);class ContourHexbin extends ContourBase{static get observed(){return["label","cells","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},cells:{attribute:"cells"},src:{attribute:"src"}}}render(){this.classList.add("c-hexbin");const label=this.getAttribute("label")||(this._remoteData&&this._remoteData.label);if(label){const l=this.ensure(".c-hexbin__label",()=>{const el=document.createElement("span");el.className="c-hexbin__label";return el});l.textContent=label}else{const l=this.querySelector(".c-hexbin__label");if(l)l.remove()}wireStates(this);loadRemote(this,"cells");if(renderStates(this,"hexbin"))return;const cells=remoteData(this,"cells");const effectiveCells=cells||(this._remoteData&&this._remoteData.cells?JSON.stringify(this._remoteData.cells):null);const authoredCells=Array.from(this.querySelectorAll(":scope > .c-hexbin__cell"));let parsed=null;if(authoredCells.length){parsed=authoredCells.map((el)=>el.textContent||el.getAttribute("title")||"");authoredCells.forEach((el)=>el.remove())}else if(effectiveCells){try{parsed=JSON.parse(effectiveCells)}catch(e){parsed=null}}if(parsed){try{Array.from(this.querySelectorAll(".c-hexbin__cell")).forEach((n)=>n.remove());const cols=Math.ceil(Math.sqrt(parsed.length||1));this.style.gridTemplateColumns="repeat("+cols+", 1fr)";this.style.inlineSize="16rem";parsed.forEach((c,i)=>{const cell=document.createElement("div");cell.className="c-hexbin__cell";cell.setAttribute("tabindex",i===0?"0":"-1");if(typeof c==="object"&&c.value!=null){cell.textContent=c.value;cell.setAttribute("title",String(c.value))}else if(typeof c!=="object"){cell.textContent=c;cell.setAttribute("title",String(c))}this.appendChild(cell)});const tip=this.ensure(".c-hexbin__tooltip",()=>{const el=document.createElement("div");el.className="c-hexbin__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","")}catch(e){}}else if(!parsed){Array.from(this.querySelectorAll(".c-hexbin__cell")).forEach((n)=>n.remove());renderEmpty(this,"hexbin")}}enhance(){if(this._wiredHexbin)return;this._wiredHexbin=true;wireMapItems(this,".c-hexbin__cell",".c-hexbin__tooltip")}}define("contour-hexbin",ContourHexbin);class ContourFlowMap extends ContourBase{static get observed(){return["label","nodes","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},nodes:{attribute:"nodes"},src:{attribute:"src"}}}render(){this.classList.add("c-flow-map");const label=this.getAttribute("label")||(this._remoteData&&this._remoteData.label);if(label){const l=this.ensure(".c-flow-map__label",()=>{const el=document.createElement("span");el.className="c-flow-map__label";return el});l.textContent=label}else{const l=this.querySelector(".c-flow-map__label");if(l)l.remove()}wireStates(this);loadRemote(this,"nodes");if(renderStates(this,"flow-map"))return;const nodes=remoteData(this,"nodes");const effectiveNodes=nodes||(this._remoteData&&this._remoteData.nodes?JSON.stringify(this._remoteData.nodes):null);const authoredNodes=Array.from(this.querySelectorAll(":scope > .c-flow-map__node"));let parsed=null;if(authoredNodes.length){parsed=authoredNodes.map((el)=>el.textContent||el.getAttribute("title")||"");authoredNodes.forEach((el)=>el.remove())}else if(effectiveNodes){try{parsed=JSON.parse(effectiveNodes)}catch(e){parsed=null}}if(parsed){try{Array.from(this.querySelectorAll(".c-flow-map__node")).forEach((n)=>n.remove());parsed.forEach((n,i)=>{const node=document.createElement("span");node.className="c-flow-map__node"+(n.source?" c-flow-map__node--source":"")+(n.target?" c-flow-map__node--target":"");node.setAttribute("tabindex",i===0?"0":"-1");node.textContent=typeof n==="string"?n:(n.label||n.name||"");if(typeof n==="object"&&(n.label||n.name))node.setAttribute("title",n.label||n.name);this.appendChild(node)});const tip=this.ensure(".c-flow-map__tooltip",()=>{const el=document.createElement("div");el.className="c-flow-map__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","")}catch(e){}}else if(!parsed){Array.from(this.querySelectorAll(".c-flow-map__node")).forEach((n)=>n.remove());renderEmpty(this,"flow-map")}}enhance(){if(this._wiredFlowMap)return;this._wiredFlowMap=true;wireMapItems(this,".c-flow-map__node",".c-flow-map__tooltip")}}define("contour-flow-map",ContourFlowMap);class ContourIsochrone extends ContourBase{static get observed(){return["label","center","rings","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},center:{attribute:"center"},rings:{attribute:"rings"},src:{attribute:"src"}}}render(){this.classList.add("c-isochrone");const label=this.getAttribute("label")||(this._remoteData&&this._remoteData.label);if(label){const l=this.ensure(".c-isochrone__label",()=>{const el=document.createElement("span");el.className="c-isochrone__label";return el});l.textContent=label}else{const l=this.querySelector(".c-isochrone__label");if(l)l.remove()}const center=this.getAttribute("center")||(this._remoteData&&this._remoteData.center);if(center){const c=this.ensure(".c-isochrone__center",()=>{const el=document.createElement("span");el.className="c-isochrone__center";return el});c.textContent=center}else{const c=this.querySelector(".c-isochrone__center");if(c)c.remove()}wireStates(this);loadRemote(this,"rings");if(renderStates(this,"isochrone"))return;const rings=remoteData(this,"rings");const effectiveRings=rings||(this._remoteData&&this._remoteData.rings?JSON.stringify(this._remoteData.rings):null);const authoredRings=Array.from(this.querySelectorAll(":scope > .c-isochrone__ring"));let parsed=null;if(authoredRings.length){parsed=authoredRings.map((el)=>el.textContent||el.getAttribute("title")||"");authoredRings.forEach((el)=>el.remove())}else if(effectiveRings){try{parsed=JSON.parse(effectiveRings)}catch(e){parsed=null}}if(parsed){try{Array.from(this.querySelectorAll(".c-isochrone__ring")).forEach((n)=>n.remove());parsed.forEach((r,i)=>{const ring=document.createElement("span");ring.className="c-isochrone__ring c-isochrone__ring--"+(r.label||r);ring.setAttribute("tabindex",i===0?"0":"-1");if(r.label)ring.setAttribute("title",r.label||r);this.appendChild(ring)});const tip=this.ensure(".c-isochrone__tooltip",()=>{const el=document.createElement("div");el.className="c-isochrone__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","")}catch(e){}}else if(!parsed){Array.from(this.querySelectorAll(".c-isochrone__ring")).forEach((n)=>n.remove());renderEmpty(this,"isochrone")}}enhance(){if(this._wiredIsochrone)return;this._wiredIsochrone=true;wireMapItems(this,".c-isochrone__ring",".c-isochrone__tooltip")}}define("contour-isochrone",ContourIsochrone);class ContourCatchment extends ContourBase{static get observed(){return["label","area","center","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},area:{attribute:"area"},center:{attribute:"center"},src:{attribute:"src"}}}render(){this.classList.add("c-catchment");const label=this.getAttribute("label")||(this._remoteData&&this._remoteData.label);if(label){const l=this.ensure(".c-catchment__label",()=>{const el=document.createElement("span");el.className="c-catchment__label";return el});l.textContent=label}else{const l=this.querySelector(".c-catchment__label");if(l)l.remove()}const area=this.getAttribute("area")||(this._remoteData&&this._remoteData.area);if(area){const a=this.ensure(".c-catchment__area",()=>{const el=document.createElement("span");el.className="c-catchment__area";return el});a.textContent=area}else{const a=this.querySelector(".c-catchment__area");if(a)a.remove()}const center=this.getAttribute("center")||(this._remoteData&&this._remoteData.center);if(center){const c=this.ensure(".c-catchment__center",()=>{const el=document.createElement("span");el.className="c-catchment__center";return el});c.textContent=center}else{const c=this.querySelector(".c-catchment__center");if(c)c.remove()}wireStates(this);loadRemote(this,["label","area","center"]);if(renderStates(this,"catchment"))return;const rLabel=remoteData(this,"label")||(this._remoteData&&this._remoteData.label);const rArea=remoteData(this,"area")||(this._remoteData&&this._remoteData.area);const rCenter=remoteData(this,"center")||(this._remoteData&&this._remoteData.center);if(!rLabel&&!rArea&&!rCenter){renderEmpty(this,"catchment");return}const tip=this.ensure(".c-catchment__tooltip",()=>{const el=document.createElement("div");el.className="c-catchment__tooltip";el.setAttribute("role","tooltip");el.setAttribute("hidden","");return el});tip.setAttribute("hidden","");if(rArea)tip.textContent=rArea}enhance(){if(this._wiredCatchment)return;this._wiredCatchment=true;const showTip=()=>{const tip=this.querySelector(".c-catchment__tooltip");if(tip)tip.removeAttribute("hidden")};const hideTip=()=>{const tip=this.querySelector(".c-catchment__tooltip");if(tip)tip.setAttribute("hidden","")};this.addEventListener("mouseenter",showTip);this.addEventListener("mouseleave",hideTip);if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");this.addEventListener("focusin",showTip);this.addEventListener("focusout",hideTip)}}define("contour-catchment",ContourCatchment);class ContourCompassFull extends ContourBase{static get observed(){return["label","needle","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},needle:{attribute:"needle"},src:{attribute:"src"}}}render(){this.classList.add("c-compass");const label=this.getAttribute("label")||(this._remoteData&&this._remoteData.label);wireStates(this);loadRemote(this,"needle");if(renderStates(this,"compass"))return;const needle=remoteData(this,"needle")||(this._remoteData&&(this._remoteData.needle||this._remoteData.value));for(const dir of["n","s","e","w"]){const cls=".c-compass__label--"+dir;let l=this.querySelector(cls);if(!l){l=document.createElement("span");l.className="c-compass__label "+cls.slice(1);l.textContent=dir.toUpperCase();l.setAttribute("role","button");l.setAttribute("tabindex","0");this.appendChild(l)}}if(label&&label.toLowerCase()!=="compass"){const l=this.ensure(".c-compass__label:not([class*='--'])",()=>{const el=document.createElement("span");el.className="c-compass__label";return el});l.textContent=label}if(needle){const deg=Number(needle)||0;const n=this.ensure("svg.c-compass__needle",()=>{const el=document.createElementNS("http://www.w3.org/2000/svg","svg");el.setAttribute("class","c-compass__needle");el.setAttribute("viewBox","0 0 40 40");el.setAttribute("aria-hidden","true");const path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("d",compassNeedle(20,20,16,deg));el.appendChild(path);return el});const path=n.querySelector("path");if(path)path.setAttribute("d",compassNeedle(20,20,16,deg))}else{const n=this.querySelector("svg.c-compass__needle, .c-compass__needle");if(n)n.remove()}if(!needle&&!label){renderEmpty(this,"compass")}}enhance(){if(this._wiredCompass)return;this._wiredCompass=true;const DEGREES={n:0,e:90,s:180,w:270};const setBearing=(dir)=>{const deg=DEGREES[dir];if(deg===undefined)return;const n=this.querySelector(".c-compass__needle");if(n){const path=n.querySelector("path");if(path)path.setAttribute("d",compassNeedle(20,20,16,deg))}this.dispatchEvent(new CustomEvent("contour:bearing",{bubbles:true,composed:true,detail:{direction:dir,degrees:deg}}))};this.addEventListener("click",(e)=>{const label=e.target&&e.target.closest?e.target.closest(".c-compass__label--n, .c-compass__label--e, .c-compass__label--s, .c-compass__label--w"):null;if(!label||!this.contains(label))return;const m=label.className.match(/c-compass__label--([nsew])/);if(m)setBearing(m[1])});this.addEventListener("keydown",(e)=>{if(e.key!=="Enter"&&e.key!==" ")return;const label=e.target&&e.target.closest?e.target.closest(".c-compass__label--n, .c-compass__label--e, .c-compass__label--s, .c-compass__label--w"):null;if(!label||!this.contains(label))return;e.preventDefault();const m=label.className.match(/c-compass__label--([nsew])/);if(m)setBearing(m[1])})}}define("contour-compass",ContourCompassFull);class ContourLayerSwitch extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-layer-switch");wireStates(this);loadRemote(this,"items");if(renderStates(this,"layer-switch"))return;const items=remoteData(this,"items");const authored=Array.from(this.children).filter((n)=>n.classList&&n.classList.contains("c-layer-switch__item"));if(items&&!authored.length){Array.from(this.querySelectorAll(".c-layer-switch__item")).forEach((n)=>n.remove());try{const parsed=JSON.parse(items);const capped=Array.isArray(parsed)?parsed.slice(0,50):parsed;capped.forEach((it)=>{const item=document.createElement("div");item.className="c-layer-switch__item";const sw=document.createElement("span");sw.className="c-layer-switch__swatch";if(it.color)sw.style.background=it.color;item.appendChild(sw);const name=document.createElement("span");name.className="c-layer-switch__name";name.textContent=typeof it==="string"?it:(it.name||it.label||"");item.appendChild(name);if(it.count!=null){const c=document.createElement("span");c.className="c-layer-switch__count";c.textContent=it.count;item.appendChild(c)}const toggle=document.createElement("button");toggle.className="c-layer-switch__toggle";toggle.type="button";toggle.setAttribute("aria-label","Toggle "+(typeof it==="string"?it:(it.name||it.label||"layer")));toggle.innerHTML='<svg aria-hidden="true"><use href="#i-check" /></svg>';item.appendChild(toggle);this.appendChild(item)})}catch(e){}}else if(!items&&!authored.length){Array.from(this.querySelectorAll(".c-layer-switch__item")).forEach((n)=>n.remove());renderEmpty(this,"layer-switch")}}enhance(){if(this._wiredLayerSwitch)return;this._wiredLayerSwitch=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-layer-switch__toggle"):null;if(!btn||!this.contains(btn))return;const item=btn.closest(".c-layer-switch__item");const name=item?(item.querySelector(".c-layer-switch__name")?.textContent||""):"";this.dispatchEvent(new CustomEvent("contour:layer-toggle",{bubbles:true,composed:true,detail:{name}}))})}}define("contour-layer-switch",ContourLayerSwitch);class ContourMapSlot extends ContourBase{static get observed(){return["attribution","scale","chrome"]}static get properties(){return{attribution:{attribute:"attribution"},scale:{attribute:"scale"},chrome:{attribute:"chrome"}}}render(){this.classList.add("c-map-slot");const chrome=this.getAttribute("chrome");if(chrome){const c=this.ensure(".c-map-slot__chrome",()=>{const el=document.createElement("div");el.className="c-map-slot__chrome";return el});c.textContent=chrome}else{const c=this.querySelector(".c-map-slot__chrome");if(c)c.remove()}const attribution=this.getAttribute("attribution");if(attribution){const a=this.ensure(".c-map-slot__attribution",()=>{const el=document.createElement("div");el.className="c-map-slot__attribution";return el});a.textContent=attribution}else{const a=this.querySelector(".c-map-slot__attribution");if(a)a.remove()}const scale=this.getAttribute("scale");if(scale){const sc=this.ensure(".c-map-slot__scale",()=>{const el=document.createElement("div");el.className="c-map-slot__scale";return el});sc.textContent=scale}else{const sc=this.querySelector(".c-map-slot__scale");if(sc)sc.remove()}}}define("contour-map-slot",ContourMapSlot);class ContourMapArea extends ContourBase{static get observed(){return["attribution","attribution-mark","scale","controls"]}static get properties(){return{attribution:{attribute:"attribution"},"attribution-mark":{attribute:"attribution-mark"},scale:{attribute:"scale"},controls:{attribute:"controls"}}}render(){this.classList.add("c-map-area");const attribution=this.getAttribute("attribution");if(attribution){const a=this.ensure(".c-map-slot__attribution",()=>{const el=document.createElement("div");el.className="c-map-slot__attribution";return el});a.textContent=attribution}else{const a=this.querySelector(".c-map-slot__attribution");if(a)a.remove()}const mark=this.getAttribute("attribution-mark");if(mark){const m=this.ensure(".c-map-slot__attribution-mark",()=>{const el=document.createElement("span");el.className="c-map-slot__attribution-mark";return el});m.textContent=mark}else{const m=this.querySelector(".c-map-slot__attribution-mark");if(m)m.remove()}const scale=this.getAttribute("scale");if(scale){const sc=this.ensure(".c-map-slot__scale",()=>{const el=document.createElement("div");el.className="c-map-slot__scale";return el});sc.textContent=scale}else{const sc=this.querySelector(".c-map-slot__scale");if(sc)sc.remove()}const controls=this.getAttribute("controls");if(controls){try{const parsed=JSON.parse(controls);const wrap=this.ensure(".c-map-slot__controls",()=>{const el=document.createElement("div");el.className="c-map-slot__controls";return el});wrap.innerHTML="";parsed.forEach((c)=>{const btn=document.createElement("button");btn.className="c-map-slot__control";btn.type="button";btn.textContent=typeof c==="string"?c:(c.label||c);wrap.appendChild(btn)})}catch(e){}}else{const w=this.querySelector(".c-map-slot__controls");if(w)w.remove()}}enhance(){if(this._wiredMapArea)return;this._wiredMapArea=true;this._map=null;this.attachMap=(map)=>{this._map=map||null;this.dispatchEvent(new CustomEvent("contour:map-attach",{bubbles:true,composed:true}))};this.detachMap=()=>{this._map=null;this.dispatchEvent(new CustomEvent("contour:map-detach",{bubbles:true,composed:true}))};Object.defineProperty(this,"map",{get:()=>this._map,set:(m)=>this.attachMap(m)});this.getViewport=()=>{const m=this._map;if(!m)return null;try{if(typeof m.getBounds==="function"){const b=m.getBounds();return{west:b.getWest(),south:b.getSouth(),east:b.getEast(),north:b.getNorth()}}if(m.transform&&typeof m.transform==="object"){return{zoom:m.transform.zoom,center:m.transform.center}}}catch(e){}return null};this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-map-slot__control"):null;if(!btn||!this.contains(btn))return;this.dispatchEvent(new CustomEvent("contour:map-control",{bubbles:true,composed:true,detail:{control:btn.textContent}}))})}}define("contour-map-area",ContourMapArea);class ContourMapPanel extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-map-panel");if(!this.hasAttribute("role"))this.setAttribute("role","region");const title=this.getAttribute("title");if(title){if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label",title)}else{if(this.getAttribute("aria-label")===this.getAttribute("title"))this.removeAttribute("aria-label")}}}define("contour-map-panel",ContourMapPanel);class ContourMapFooter extends ContourBase{static get observed(){return["brand"]}static get properties(){return{brand:{attribute:"brand"}}}render(){this.classList.add("c-map-footer");if(!this.hasAttribute("role"))this.setAttribute("role","contentinfo");const brand=this.getAttribute("brand");if(brand){const b=this.ensure("[data-map-footer-brand]",()=>{const el=document.createElement("span");el.setAttribute("data-map-footer-brand","");return el});b.textContent=brand}else{const b=this.querySelector("[data-map-footer-brand]");if(b)b.remove()}}}define("contour-map-footer",ContourMapFooter);class ContourScaleBar extends ContourBase{static get observed(){return["label","value","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},src:{attribute:"src"}}}render(){this.classList.add("c-scale-bar");wireStates(this);loadRemote(this,["label","value"]);if(renderStates(this,"scale-bar"))return;const label=remoteData(this,"label")||(this._remoteData&&this._remoteData.label);if(label){const l=this.ensure(".c-scale-bar__label",()=>{const el=document.createElement("span");el.className="c-scale-bar__label";return el});l.textContent=label}else{const l=this.querySelector(".c-scale-bar__label");if(l)l.remove()}const value=remoteData(this,"value")||(this._remoteData&&this._remoteData.value);if(!value){renderEmpty(this,"scale-bar");return}const line=this.ensure(".c-scale-bar__line",()=>{const el=document.createElement("span");el.className="c-scale-bar__line";return el});line.style.inlineSize=/^\d+(\.\d+)?$/.test(String(value))?value+"px":value;const ticks=scaleBarTicks(parseFloat(value)||0,4);const max=ticks[ticks.length-1]||1;Array.from(line.querySelectorAll(".c-scale-bar__tick")).forEach((t)=>t.remove());ticks.forEach((tv)=>{const tick=document.createElement("span");tick.className="c-scale-bar__tick";tick.style.insetInlineStart=((tv/max)*100)+"%";line.appendChild(tick)})}}define("contour-scale-bar",ContourScaleBar);class ContourReservedFull extends ContourBase{static get observed(){return["title"]}render(){this.classList.add("c-reserved");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-reserved__title",()=>{const el=document.createElement("div");el.className="c-reserved__title";return el});t.textContent=title}}}define("contour-reserved",ContourReservedFull);class ContourThemeScopeFull extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-theme-scope");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-theme-scope__title",()=>{const el=document.createElement("div");el.className="c-theme-scope__title";el.style.padding="var(--space-sm)";el.style.fontWeight="var(--weight-semibold)";return el});t.textContent=title}}}define("contour-theme-scope",ContourThemeScopeFull);class ContourActivity extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-activity");this.setAttribute("role","list");wireStates(this);loadRemote(this,"items");if(renderStates(this,"activity"))return;const items=remoteData(this,"items");if(items){try{const parsed=JSON.parse(items);Array.from(this.querySelectorAll(".c-activity__item")).forEach((n)=>n.remove());parsed.forEach((it,i)=>{const item=document.createElement("div");item.className="c-activity__item";item.setAttribute("role","listitem");item.tabIndex=-1;const dot=document.createElement("span");dot.className="c-activity__dot c-activity__dot--"+(it.variant||"primary");dot.setAttribute("aria-hidden","true");item.appendChild(dot);const text=document.createElement("span");text.className="c-activity__text";text.textContent=typeof it==="string"?it:(it.text||it.label||"");item.appendChild(text);if(it.time){const time=document.createElement("span");time.className="c-activity__time";time.textContent=it.time;item.appendChild(time)}this.appendChild(item)})}catch(e){}}else{renderEmpty(this,"activity")}}enhance(){if(this._wiredActivity)return;this._wiredActivity=true;this.addEventListener("click",(e)=>{const item=e.target&&e.target.closest?e.target.closest(".c-activity__item"):null;if(item&&this.contains(item)){const items=Array.from(this.querySelectorAll(".c-activity__item"));const index=items.indexOf(item);const text=item.querySelector(".c-activity__text")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:activity-select",{bubbles:true,composed:true,detail:{index,text}}))}});this.addEventListener("keydown",(e)=>{const items=Array.from(this.querySelectorAll(".c-activity__item"));if(!items.length)return;const active=document.activeElement;const idx=items.indexOf(active);let next=-1;if(e.key==="ArrowDown")next=idx<0?0:Math.min(items.length-1,idx+1);else if(e.key==="ArrowUp")next=idx<0?0:Math.max(0,idx-1);else if(e.key==="Home")next=0;else if(e.key==="End")next=items.length-1;if(next>=0&&next!==idx){e.preventDefault();items[next].focus();items[next].tabIndex=0;if(idx>=0)items[idx].tabIndex=-1}if((e.key==="Enter"||e.key===" ")&&idx>=0){e.preventDefault();const text=items[idx].querySelector(".c-activity__text")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:activity-select",{bubbles:true,composed:true,detail:{index:idx,text}}))}})}}define("contour-activity",ContourActivity);class ContourAdvanced extends ContourBase{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-advanced");this.setAttribute("role","region");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-advanced__title",()=>{const el=document.createElement("div");el.className="c-advanced__title";return el});t.textContent=title;this.setAttribute("aria-label",title)}}enhance(){if(this._wiredAdvanced)return;this._wiredAdvanced=true;this.addEventListener("click",(e)=>{const title=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:advanced-toggle",{bubbles:true,composed:true,detail:{title}}))});this.addEventListener("keydown",(e)=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();const title=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:advanced-toggle",{bubbles:true,composed:true,detail:{title}}))}})}}define("contour-advanced",ContourAdvanced);class ContourAffordance extends ContourBase{static get observed(){return["name","note","demo"]}static get properties(){return{name:{attribute:"name"},note:{attribute:"note"},demo:{attribute:"demo"}}}render(){this.classList.add("c-affordance");this.setAttribute("role","group");const name=this.getAttribute("name");if(name){const n=this.ensure(".c-affordance__name",()=>{const el=document.createElement("div");el.className="c-affordance__name";return el});n.textContent=name;this.setAttribute("aria-label",name)}else{const n=this.querySelector(".c-affordance__name");if(n)n.remove()}const note=this.getAttribute("note");if(note){const nt=this.ensure(".c-affordance__note",()=>{const el=document.createElement("div");el.className="c-affordance__note";return el});nt.textContent=note}else{const nt=this.querySelector(".c-affordance__note");if(nt)nt.remove()}const demo=this.getAttribute("demo");if(demo){const d=this.ensure(".c-affordance__demo",()=>{const el=document.createElement("div");el.className="c-affordance__demo";return el});d.textContent=demo}else{const d=this.querySelector(".c-affordance__demo");if(d)d.remove()}}enhance(){if(this._wiredAffordance)return;this._wiredAffordance=true;this.addEventListener("click",(e)=>{const name=this.getAttribute("name")||"";this.dispatchEvent(new CustomEvent("contour:affordance-activate",{bubbles:true,composed:true,detail:{name}}))})}}define("contour-affordance",ContourAffordance);class ContourAffordances extends ContourBase{static get observed(){return["name","title"]}static get properties(){return{name:{attribute:"name"},title:{attribute:"title"}}}render(){this.classList.add("c-affordances");this.setAttribute("role","group");if(!this.querySelector(".c-affordance")){const aff=document.createElement("div");aff.className="c-affordance";const name=this.getAttribute("name")||this.getAttribute("title")||"Affordance";const n=document.createElement("div");n.className="c-affordance__name";n.textContent=name;aff.appendChild(n);const demo=document.createElement("div");demo.className="c-affordance__demo";demo.textContent="Demo";aff.appendChild(demo);this.appendChild(aff)}}}define("contour-affordances",ContourAffordances);class ContourMenu extends ContourBase{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-menu");if(!this.hasAttribute("role"))this.setAttribute("role","menu");wireStates(this);loadRemote(this,"items");if(renderStates(this,"menu"))return;const items=remoteData(this,"items");const authored=Array.from(this.children).filter((n)=>!n.classList||!n.classList.contains("c-menu"));if(authored.length){if(this.querySelector("ul.c-menu"))return;const ul=document.createElement("ul");ul.className="c-menu";ul.setAttribute("role","menu");this.appendChild(ul);return}if(items){try{const parsed=JSON.parse(items);const ul=this.ensure("ul.c-menu",()=>{const el=document.createElement("ul");el.className="c-menu";el.setAttribute("role","menu");return el});ul.innerHTML="";ul.setAttribute("role","menu");parsed.forEach((item)=>{if(item==="---"||item==="separator"){const li=document.createElement("li");li.className="c-menu__separator";li.setAttribute("role","separator");ul.appendChild(li)}else if(typeof item==="string"){const li=document.createElement("li");li.className="c-menu__item";li.setAttribute("role","menuitem");li.textContent=item;ul.appendChild(li)}else if(item.group){const li=document.createElement("li");li.className="c-menu__group";li.setAttribute("role","group");if(item.group)li.setAttribute("aria-label",String(item.group));const hdr=document.createElement("div");hdr.className="c-menu__group-label";hdr.textContent=String(item.group);li.appendChild(hdr);if(Array.isArray(item.items)){const sub=document.createElement("ul");sub.className="c-menu";sub.setAttribute("role","menu");item.items.forEach((subItem)=>{const sli=document.createElement("li");sli.className="c-menu__item"+(subItem.danger?" c-menu__item--danger":"")+(subItem.disabled?" c-menu__item--disabled":"");sli.setAttribute("role","menuitem");if(subItem.disabled)sli.setAttribute("aria-disabled","true");if(subItem.label||subItem.title){const lbl=document.createElement("span");lbl.className="c-menu__label";lbl.textContent=subItem.label||subItem.title||"";sli.appendChild(lbl)}sub.appendChild(sli)});li.appendChild(sub)}ul.appendChild(li)}else{const li=document.createElement("li");li.className="c-menu__item"+(item.danger?" c-menu__item--danger":"")+(item.disabled?" c-menu__item--disabled":"");li.setAttribute("role","menuitem");if(item.disabled)li.setAttribute("aria-disabled","true");if(item.items&&Array.isArray(item.items)){li.setAttribute("aria-haspopup","menu");li.setAttribute("aria-expanded","false")}if(item.label||item.title){const lbl=document.createElement("span");lbl.className="c-menu__label";lbl.textContent=item.label||item.title||"";li.appendChild(lbl)}if(item.shortcut){const sc=document.createElement("span");sc.className="c-menu__shortcut";sc.textContent=item.shortcut;li.appendChild(sc)}ul.appendChild(li)}});if(ul.parentNode!==this)this.appendChild(ul);this.classList.remove("c-menu");ul.classList.add("c-menu")}catch(e){}}else{renderEmpty(this,"menu")}}enhance(){wireMenu(this)}}define("contour-menu",ContourMenu);class ContourTabs extends ContourBase{static get observed(){return["tabs","autoplay","pause","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","orientation","closable"]}static get properties(){return{tabs:{attribute:"tabs"},autoplay:{attribute:"autoplay",type:Number},pause:{attribute:"pause",type:Boolean},src:{attribute:"src"},orientation:{attribute:"orientation"},closable:{attribute:"closable",type:Boolean}}}render(){this.classList.add("c-tabs");wireStates(this);loadRemote(this,"tabs");if(renderStates(this,"tabs"))return;const tabs=remoteData(this,"tabs");const authored=Array.from(this.children).filter((n)=>!n.classList||!n.classList.contains("c-tabs__list"));if(tabs&&!authored.length){try{const parsed=JSON.parse(tabs);const list=this.ensure(".c-tabs__list",()=>{const el=document.createElement("div");el.className="c-tabs__list";el.setAttribute("role","tablist");return el});list.setAttribute("role","tablist");const orientation=this.getAttribute("orientation")==="vertical"?"vertical":"horizontal";list.setAttribute("aria-orientation",orientation);if(orientation==="vertical")this.classList.add("c-tabs--vertical");else this.classList.remove("c-tabs--vertical");const _prevTabs=Array.from(list.querySelectorAll("[role='tab']"));const _prevSel=_prevTabs.findIndex((t)=>t.getAttribute("aria-selected")==="true");const _keepIdx=_prevSel>=0?_prevSel:0;list.innerHTML="";Array.from(this.querySelectorAll(".c-tabs__panel")).forEach((n)=>n.remove());parsed.forEach((t,i)=>{const label=typeof t==="string"?t:(t.label||t.title||"");const panelId=contourId("c-tabs-panel");const btn=document.createElement("button");btn.className="c-tabs__tab";btn.setAttribute("role","tab");btn.setAttribute("aria-selected",String(i===_keepIdx));btn.setAttribute("aria-controls",panelId);btn.tabIndex=i===_keepIdx?0:-1;btn.textContent=label;if(this.hasAttribute("closable")){const closeBtn=document.createElement("button");closeBtn.type="button";closeBtn.className="c-tabs__close";closeBtn.setAttribute("aria-label","Close "+label);closeBtn.textContent="×";closeBtn.addEventListener("click",(e)=>{e.stopPropagation();const idx=Array.from(list.querySelectorAll("[role='tab']")).indexOf(btn);const ctrl=btn.getAttribute("aria-controls");const panel=ctrl?document.getElementById(ctrl):null;btn.remove();if(panel)panel.remove();this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true,detail:{index:idx,label}}));const remaining=list.querySelectorAll("[role='tab']");if(remaining.length)remaining[0].click()});btn.appendChild(closeBtn)}list.appendChild(btn);const panel=document.createElement("div");panel.className="c-tabs__panel";panel.id=panelId;panel.setAttribute("role","tabpanel");if(typeof t==="object"&&t!==null&&t.content!==undefined){panel.textContent=String(t.content)}if(i!==_keepIdx)panel.hidden=true;this.appendChild(panel)});if(list.parentNode!==this)this.prepend(list)}catch(e){}}else if(!tabs&&!authored.length){const list=this.querySelector(".c-tabs__list");if(list)list.remove();renderEmpty(this,"tabs")}}enhance(){wireTabs(this);const sync=()=>{const seconds=parseFloat(this.getAttribute("autoplay")||"");const paused=this.hasAttribute("pause")||this._tabsHover||this._tabsFocus;const reduced=typeof matchMedia==="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;const want=Number.isFinite(seconds)&&seconds>0&&!paused&&!reduced;if(want===this._tabsAutoplayRunning)return;this._tabsAutoplayRunning=want;if(this._tabsTimer!==undefined){clearInterval(this._tabsTimer);this._tabsTimer=undefined}if(!want)return;this._tabsTimer=setInterval(()=>{if(!this.isConnected||this.hasAttribute("pause")||this._tabsHover||this._tabsFocus)return;const list=this.querySelector(".c-tabs__list");const tabs=list?Array.from(list.querySelectorAll("[role='tab']")):[];if(!tabs.length)return;const cur=tabs.findIndex((t)=>t.getAttribute("aria-selected")==="true");const next=tabs[(cur+1)%tabs.length];if(next)next.click()},Math.max(1000,seconds*1000))};sync();if(this._wiredTabsAutoplay)return;this._wiredTabsAutoplay=true;this.addEventListener("pointerenter",()=>{this._tabsHover=true;sync()});this.addEventListener("pointerleave",()=>{this._tabsHover=false;sync()});this.addEventListener("focusin",()=>{this._tabsFocus=true;sync()});this.addEventListener("focusout",()=>{this._tabsFocus=false;sync()});onDispose(this,()=>{if(this._tabsTimer!==undefined){clearInterval(this._tabsTimer);this._tabsTimer=undefined}})}}define("contour-tabs",ContourTabs);class ContourHeader extends ContourBase{static get observed(){return["brand","links"]}static get properties(){return{brand:{attribute:"brand"},links:{attribute:"links"}}}render(){this.classList.add("c-header");const brand=this.getAttribute("brand");const links=this.getAttribute("links");const inner=this.ensure(".c-header__inner",()=>{const el=document.createElement("div");el.className="container c-header__inner";return el});inner.className="container c-header__inner";let brandEl=inner.querySelector(".c-brand");if(brand){if(!brandEl){brandEl=document.createElement("a");brandEl.className="c-brand";brandEl.setAttribute("data-contour-generated","");brandEl.href="#";brandEl.innerHTML=`<span class="c-mark"><svg aria-hidden="true"><use href="#i-mark" /></svg></span>`;const brandName=document.createElement("span");brandName.className="c-brand__name";brandEl.appendChild(brandName);inner.insertBefore(brandEl,inner.firstChild)}const brandName=brandEl.querySelector(".c-brand__name");if(brandName)brandName.textContent=brand}else if(brandEl&&brandEl.hasAttribute("data-contour-generated")){brandEl.remove()}let nav=inner.querySelector(".c-header__nav");const authoredNav=nav?Array.from(nav.children).filter((n)=>n.tagName==="A"):[];if(links&&!authoredNav.length){try{const parsed=JSON.parse(links);if(!nav){nav=document.createElement("nav");nav.className="c-header__nav";nav.setAttribute("aria-label","Main");nav.setAttribute("data-contour-generated","");inner.appendChild(nav)}nav.innerHTML="";parsed.forEach((l)=>{const a=document.createElement("a");a.href=l.href||"#";a.textContent=l.label||l;nav.appendChild(a)})}catch(e){}}else if(links&&authoredNav.length){}else if(nav&&!links&&!authoredNav.length&&nav.hasAttribute("data-contour-generated")){nav.remove()}if(!inner.querySelector(".c-header__actions")){const actions=document.createElement("div");actions.className="c-header__actions";inner.appendChild(actions)}const navEl=inner.querySelector(".c-header__nav");if(navEl){if(!navEl.id)navEl.id="contour-header-nav";const actions=inner.querySelector(".c-header__actions");if(actions&&!actions.querySelector(".c-header__toggle")){const toggle=document.createElement("button");toggle.type="button";toggle.className="c-header__toggle";toggle.setAttribute("aria-label","Toggle navigation");toggle.setAttribute("aria-expanded","false");toggle.setAttribute("aria-controls",navEl.id);toggle.innerHTML='<svg aria-hidden="true"><use href="#i-grid" /></svg>';actions.appendChild(toggle)}}if(inner.parentNode!==this)this.appendChild(inner)}enhance(){if(this._wiredHeader)return;this._wiredHeader=true;const update=()=>{const y=window.scrollY||document.documentElement.scrollTop||0;this.classList.toggle("c-header--scrolled",y>8)};update();window.addEventListener("scroll",update,{passive:true});onDispose(this,()=>window.removeEventListener("scroll",update));this.addEventListener("click",(e)=>{const toggle=e.target&&e.target.closest?e.target.closest(".c-header__toggle"):null;if(!toggle||!this.contains(toggle))return;const nav=this.querySelector("#"+CSS.escape(toggle.getAttribute("aria-controls")||""));if(!nav)return;const open=nav.classList.toggle("is-open");toggle.setAttribute("aria-expanded",String(open))});this.addEventListener("keydown",(e)=>{if(e.key!=="Escape")return;const toggle=this.querySelector(".c-header__toggle");const nav=toggle&&this.querySelector("#"+CSS.escape(toggle.getAttribute("aria-controls")||""));if(!toggle||!nav||!nav.classList.contains("is-open"))return;nav.classList.remove("is-open");toggle.setAttribute("aria-expanded","false")})}}define("contour-header",ContourHeader);class ContourTree extends ContourBase{static get observed(){return["items","virtual","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-tree");const authored=Array.from(this.children).filter((n)=>!n.classList||!n.classList.contains("c-tree"));wireStates(this);loadRemote(this,"items");if(renderStates(this,"tree"))return;const items=remoteData(this,"items");if(items&&!authored.length){try{const parsed=JSON.parse(items);const rootUl=this.ensure("div.c-tree",()=>{const el=document.createElement("div");el.className="c-tree";el.setAttribute("role","tree");return el});rootUl.innerHTML="";rootUl.className="c-tree";const render=(nodes,parent)=>{const ul=parent?document.createElement("div"):rootUl;if(parent){ul.className="c-tree__children";ul.setAttribute("role","group");if(supportsUntilFound())ul.setAttribute("hidden","until-found");else ul.setAttribute("hidden","")}nodes.forEach((node)=>{const li=document.createElement("div");li.className="c-tree__node";li.setAttribute("role","treeitem");if(node.children){li.setAttribute("aria-expanded","false");const row=document.createElement("div");row.className="c-tree__row"+(node.active?" c-tree__row--active":"")+(node.dir?" c-tree__row--dir":"");if(node.indent){const ind=document.createElement("span");ind.className="c-tree__indent";ind.style.inlineSize=(node.indent*1)+"rem";row.appendChild(ind)}const toggle=document.createElement("button");toggle.className="c-tree__toggle";toggle.setAttribute("type","button");toggle.setAttribute("aria-expanded","false");toggle.setAttribute("aria-label","Toggle");toggle.innerHTML='<svg aria-hidden="true"><use href="#i-chevron-right" /></svg>';row.appendChild(toggle);const span=document.createElement("span");span.textContent=node.label;row.appendChild(span);li.appendChild(row);render(node.children,li)}else{const leaf=document.createElement("div");leaf.className="c-tree__leaf"+(node.active?" c-tree__row--active":"")+(node.dir?" c-tree__row--dir":"");if(node.indent){const ind=document.createElement("span");ind.className="c-tree__indent";ind.style.inlineSize=(node.indent*1)+"rem";leaf.appendChild(ind)}if(this.hasAttribute("selectable")){const cb=document.createElement("input");cb.type="checkbox";cb.className="c-tree__select";cb.setAttribute("aria-label","Select "+(node.label||node));leaf.insertBefore(cb,leaf.firstChild)}leaf.appendChild(document.createTextNode(node.label||node));li.appendChild(leaf)}ul.appendChild(li)});if(parent)parent.appendChild(ul)};render(parsed,null);this.classList.remove("c-tree");rootUl.classList.add("c-tree");if(this.hasAttribute("virtual")){rootUl.style.maxHeight=rootUl.style.maxHeight||"24rem";rootUl.style.overflow="auto";rootUl.querySelectorAll(".c-tree__node").forEach((n)=>{n.style.contentVisibility="auto";n.style.containIntrinsicSize="auto 1.5rem"})}if(rootUl.parentNode!==this)this.appendChild(rootUl)}catch(e){}}else if(!items&&!authored.length){renderEmpty(this,"tree")}}enhance(){wireTree(this)}}define("contour-tree",ContourTree);class ContourCodeTabs extends ContourBase{static get observed(){return["tabs","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist"]}static get properties(){return{tabs:{attribute:"tabs"},src:{attribute:"src"}}}render(){this.classList.add("c-code-tabs");wireStates(this);loadRemote(this,"tabs");if(renderStates(this,"code-tabs"))return;const tabs=remoteData(this,"tabs");const list=this.querySelector(".c-code-tabs__list");const authored=list?Array.from(list.children).filter((n)=>n.getAttribute&&n.getAttribute("role")==="tab"):[];if(tabs&&!authored.length){try{const parsed=JSON.parse(tabs);const l=this.ensure(".c-code-tabs__list",()=>{const el=document.createElement("div");el.className="c-code-tabs__list";el.setAttribute("role","tablist");return el});l.setAttribute("role","tablist");const _prevCodeTabs=Array.from(l.querySelectorAll("[role='tab']"));const _prevCodeSel=_prevCodeTabs.findIndex((t)=>t.getAttribute("aria-selected")==="true");const _keepCodeIdx=_prevCodeSel>=0?_prevCodeSel:0;l.innerHTML="";Array.from(this.querySelectorAll(".c-code-tabs__panel")).forEach((n)=>n.remove());parsed.forEach((t,i)=>{const label=typeof t==="string"?t:(t.label||t.title||"");const panelId=contourId("c-code-tabs-panel");const btn=document.createElement("button");btn.className="c-code-tabs__tab";btn.setAttribute("role","tab");btn.setAttribute("aria-selected",String(i===_keepCodeIdx));btn.setAttribute("aria-controls",panelId);btn.tabIndex=i===_keepCodeIdx?0:-1;btn.textContent=label;l.appendChild(btn);const panel=document.createElement("div");panel.className="c-code-tabs__panel";panel.id=panelId;panel.setAttribute("role","tabpanel");if(typeof t==="object"&&t!==null&&t.content!==undefined){panel.textContent=String(t.content)}if(i!==_keepCodeIdx)panel.hidden=true;this.appendChild(panel)});if(l.parentNode!==this)this.prepend(l)}catch(e){}}else if(!tabs&&list){list.remove();renderEmpty(this,"code-tabs")}else if(!tabs&&!list){renderEmpty(this,"code-tabs")}}enhance(){wireTabs(this)}}define("contour-code-tabs",ContourCodeTabs);class ContourBreadcrumb extends ContourBase{static get observed(){return["items","separator","max","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{items:{attribute:"items"},separator:{attribute:"separator"},max:{attribute:"max",type:Number},src:{attribute:"src"}}};render(){this.classList.add("c-breadcrumb");wireStates(this);loadRemote(this,"items");if(renderStates(this,"breadcrumb"))return;const items=remoteData(this,"items");const nav=this.querySelector("nav");const ol=nav?nav.querySelector("ol"):null;const authored=ol?Array.from(ol.children).filter((n)=>n.tagName==="LI"):[];if(items&&!authored.length){try{const parsed=JSON.parse(items);const n=this.ensure("nav",()=>{const el=document.createElement("nav");el.setAttribute("aria-label","Breadcrumb");el.id="contour-breadcrumb-list";return el});n.setAttribute("aria-label","Breadcrumb");n.id="contour-breadcrumb-list";n.innerHTML="";const sep=this.getAttribute("separator")||"/";const max=this._overflowExpanded?null:this.max;const shown=Number.isFinite(max)&&max>1&&parsed.length>max?parsed.slice(-max):parsed;if(Number.isFinite(max)&&max>1&&parsed.length>max){const btn=document.createElement("button");btn.type="button";btn.className="c-breadcrumb__overflow";btn.setAttribute("aria-label",`Show ${parsed.length - shown.length + 1} more items`);btn.setAttribute("aria-expanded","false");btn.setAttribute("aria-controls","contour-breadcrumb-list");btn.textContent="…";btn.addEventListener("click",()=>{this._overflowExpanded=true;this.requestRender()});n.appendChild(btn)}shown.forEach((item,i)=>{if(i<shown.length-1){const a=document.createElement("a");a.href=item.href||"#";a.textContent=item.label||item;n.appendChild(a);const s=document.createElement("span");s.className="c-breadcrumb__sep";s.setAttribute("aria-hidden","true");s.textContent=sep;n.appendChild(s)}else{const span=document.createElement("span");span.textContent=item.label||item;span.setAttribute("aria-current","page");n.appendChild(span)}})}catch(e){}}else if(!items&&nav){nav.remove()}else if(!items&&!nav){renderEmpty(this,"breadcrumb")}}}define("contour-breadcrumb",ContourBreadcrumb);class ContourPagination extends ContourBase{static get observed(){return["pages","current","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist"]}static get properties(){return{pages:{attribute:"pages"},current:{attribute:"current"},src:{attribute:"src"}}}render(){this.classList.add("c-pagination");wireStates(this);loadRemote(this,"pages");if(renderStates(this,"pagination"))return;const pages=remoteData(this,"pages");Array.from(this.querySelectorAll(".c-pagination__link")).forEach((n)=>n.remove());let currentAttr=this.getAttribute("current")||"1";if(this.getAttribute("persist")==="storage"&&this.id){try{const stored=localStorage.getItem("contour-pagination:"+this.id);if(stored!==null)currentAttr=stored}catch(e){}}else if(this.getAttribute("persist")==="url"){try{const v=new URLSearchParams(window.location.search).get("c-pagination");if(v!==null)currentAttr=v}catch(e){}}const current=parseInt(currentAttr,"10")||1;if(pages){let count=parseInt(pages,10);if(!Number.isFinite(count)||count<1){try{const p=JSON.parse(pages);if(Array.isArray(p))count=p.length}catch(e){}}const prev=document.createElement("button");prev.type="button";prev.className="c-pagination__link c-pagination__prev";prev.setAttribute("data-action","prev");prev.textContent="‹";prev.setAttribute("aria-label","Previous page");this.appendChild(prev);for(let i=1;i<=count;i++){const btn=document.createElement("button");btn.type="button";btn.className="c-pagination__link";btn.textContent=String(i);if(i===current){btn.setAttribute("aria-current","page")}this.appendChild(btn)}const next=document.createElement("button");next.type="button";next.className="c-pagination__link c-pagination__next";next.setAttribute("data-action","next");next.textContent="›";next.setAttribute("aria-label","Next page");this.appendChild(next)}else{renderEmpty(this,"pagination")}}enhance(){wirePagination(this)}}define("contour-pagination",ContourPagination);class ContourPagerFull extends ContourBase{static get observed(){return["prev","next"]}static get properties(){return{prev:{attribute:"prev"},next:{attribute:"next"}}}render(){this.classList.add("c-pager");Array.from(this.querySelectorAll(".c-pager__link")).forEach((n)=>n.remove());const prev=this.getAttribute("prev");const next=this.getAttribute("next");if(prev){const a=document.createElement("a");a.className="c-pager__link";a.href=prev.split("|")[1]||"#";const dir=document.createElement("span");dir.className="c-pager__dir";dir.textContent="← Previous";a.appendChild(dir);const title=document.createElement("span");title.className="c-pager__title";title.textContent=prev.split("|")[0];a.appendChild(title);this.appendChild(a)}if(next){const a=document.createElement("a");a.className="c-pager__link c-pager__link--next";a.href=next.split("|")[1]||"#";const dir=document.createElement("span");dir.className="c-pager__dir";dir.textContent="Next →";a.appendChild(dir);const title=document.createElement("span");title.className="c-pager__title";title.textContent=next.split("|")[0];a.appendChild(title);this.appendChild(a)}}}define("contour-pager",ContourPagerFull);class ContourTocFull extends ContourBase{static get observed(){return["title","items","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{title:{attribute:"title"},items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-toc");wireStates(this);loadRemote(this,"items");if(renderStates(this,"toc"))return;const items=remoteData(this,"items");const title=this.getAttribute("title")||"On this page";const titleEl=this.ensure(".c-toc__title",()=>{const el=document.createElement("div");el.className="c-toc__title";return el});titleEl.textContent=title;const list=this.querySelector(".c-toc__list");const authored=list?Array.from(list.children).filter((n)=>n.tagName==="A"):[];if(items&&!authored.length){try{const parsed=JSON.parse(items);const l=this.ensure(".c-toc__list",()=>{const el=document.createElement("nav");el.className="c-toc__list";return el});l.className="c-toc__list";l.setAttribute("aria-label",title);l.innerHTML="";parsed.forEach((item)=>{const a=document.createElement("a");a.className="c-toc__link"+(item.sub?" c-toc__link--sub":"");a.href=item.href||"#";a.textContent=item.label||item;if(item.current)a.setAttribute("aria-current","true");l.appendChild(a)})}catch(e){}}else if(!items&&list){list.remove();renderEmpty(this,"toc")}else if(!items&&!list){renderEmpty(this,"toc")}}enhance(){if(this._wiredTocSpy)return;if(typeof IntersectionObserver!=="function")return;const links=()=>Array.from(this.querySelectorAll(".c-toc__link"));const targets=links().map((a)=>{const href=a.getAttribute("href")||"";if(!href.startsWith("#")||href.length<2)return null;return document.getElementById(href.slice(1))}).filter(Boolean);if(!targets.length)return;this._wiredTocSpy=true;const spy=new IntersectionObserver((entries)=>{const visible=entries.filter((en)=>en.isIntersecting).map((en)=>en.target.id);if(!visible.length)return;const top=visible[0];links().forEach((a)=>{const href=a.getAttribute("href")||"";const isCurrent=href==="#"+top;if(isCurrent&&a.getAttribute("aria-current")!=="true")a.setAttribute("aria-current","true");else if(!isCurrent&&a.hasAttribute("aria-current"))a.removeAttribute("aria-current")})},{rootMargin:"0px 0px -60% 0px",threshold:0});targets.forEach((t)=>spy.observe(t));onDispose(this,()=>spy.disconnect());if(!this._wiredTocScroll){this._wiredTocScroll=true;this.addEventListener("click",(e)=>{const a=e.target&&e.target.closest?e.target.closest(".c-toc__link"):null;if(!a||!this.contains(a))return;const href=a.getAttribute("href")||"";if(!href.startsWith("#")||href.length<2)return;const target=document.getElementById(href.slice(1));if(!target)return;e.preventDefault();try{target.scrollIntoView({behavior:"smooth",block:"start"})}catch(err){target.scrollIntoView()}})}}}define("contour-toc",ContourTocFull);class ContourFilterBar extends ContourBase{static get observed(){return["label","divider","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{label:{attribute:"label"},divider:{attribute:"divider"},items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-filter-bar");wireStates(this);loadRemote(this,"items");if(renderStates(this,"filter-bar"))return;const label=this.getAttribute("label");if(label){const l=this.ensure(".c-filter-bar__label",()=>{const el=document.createElement("span");el.className="c-filter-bar__label";return el});l.textContent=label}else{const l=this.querySelector(".c-filter-bar__label");if(l)l.remove()}if(this.hasAttribute("divider")){this.ensure(".c-filter-bar__divider",()=>{const el=document.createElement("span");el.className="c-filter-bar__divider";return el})}else{const d=this.querySelector(".c-filter-bar__divider");if(d)d.remove()}Array.from(this.querySelectorAll(".c-filter-pill")).forEach((n)=>n.remove());const items=remoteData(this,"items");let parsed=null;if(items){try{parsed=JSON.parse(items)}catch(e){parsed=null}}if(Array.isArray(parsed)){parsed.forEach((it)=>{const pill=document.createElement("span");pill.className="c-filter-pill";const txt=typeof it==="string"?it:(it.label||it.value||"");pill.textContent=txt;if(typeof it==="object"&&it!==null&&it.removable!==false){const btn=document.createElement("button");btn.className="c-filter-pill__remove";btn.type="button";btn.setAttribute("aria-label","Remove "+txt);btn.textContent="×";pill.appendChild(btn)}this.appendChild(pill)})}if(!parsed&&!label)renderEmpty(this,"filter-bar")}enhance(){wireRemovable(this)}}define("contour-filter-bar",ContourFilterBar);class ContourCommand extends ContourBase{static get observed(){return["placeholder","items","recent","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton"]}static get properties(){return{placeholder:{attribute:"placeholder"},items:{attribute:"items"},recent:{attribute:"recent"},empty:{attribute:"empty"},src:{attribute:"src"}}}render(){this.classList.add("c-command");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");wireStates(this);loadRemote(this,"items");if(renderStates(this,"command"))return;const placeholder=this.getAttribute("placeholder")||"Search…";const input=this.ensure(".c-command__input",()=>{const el=document.createElement("input");el.className="c-command__input";el.type="text";return el});input.type="text";input.placeholder=placeholder;input.setAttribute("aria-label","Command");input.setAttribute("role","combobox");input.setAttribute("aria-autocomplete","list");input.setAttribute("aria-expanded","true");const list=this.querySelector(".c-command__list");if(list&&!list.id)list.id=contourId("c-command-list");if(list&&list.id)input.setAttribute("aria-controls",list.id);const items=remoteData(this,"items");const list2=this.querySelector(".c-command__list");const authored=list2?Array.from(list2.children).filter((n)=>n.classList&&n.classList.contains("c-command__item")||n.classList&&n.classList.contains("c-command__group")):[];if(items&&!authored.length){try{const parsed=JSON.parse(items);const l=this.ensure(".c-command__list",()=>{const el=document.createElement("div");el.className="c-command__list";el.setAttribute("role","listbox");el.id=contourId("c-command-list");return el});l.setAttribute("role","listbox");l.innerHTML="";const recentRaw=this.getAttribute("recent");if(recentRaw){try{const recentParsed=JSON.parse(recentRaw);const group=document.createElement("div");group.className="c-command__group";const gt=document.createElement("div");gt.className="c-command__group-title";gt.textContent="Recent";group.appendChild(gt);recentParsed.forEach((it)=>{const item=document.createElement("div");item.className="c-command__item";item.setAttribute("role","option");const body=document.createElement("div");body.className="c-command__item-body";const t=document.createElement("div");t.className="c-command__item-title";t.textContent=typeof it==="string"?it:(it.title||it.label||"");body.appendChild(t);item.appendChild(body);group.appendChild(item)});l.appendChild(group)}catch(e){}}parsed.forEach((it)=>{if(it.group){const group=document.createElement("div");group.className="c-command__group";const gt=document.createElement("div");gt.className="c-command__group-title";gt.textContent=it.group;group.appendChild(gt);const item=document.createElement("div");item.className="c-command__item";item.setAttribute("role","option");if(it.icon){const ic=document.createElement("span");ic.className="c-command__item-icon";ic.textContent=it.icon;item.appendChild(ic)}const body=document.createElement("div");body.className="c-command__item-body";if(it.title||it.label){const t=document.createElement("div");t.className="c-command__item-title";t.textContent=it.title||it.label;body.appendChild(t)}if(it.hint){const h=document.createElement("span");h.className="c-command__item-hint";h.textContent=it.hint;body.appendChild(h)}if(it.shortcut){const sc=document.createElement("kbd");sc.className="c-command__item-shortcut";sc.textContent=it.shortcut;item.appendChild(sc)}item.appendChild(body);group.appendChild(item);l.appendChild(group)}else{const item=document.createElement("div");item.className="c-command__item";item.setAttribute("role","option");if(it.icon){const ic=document.createElement("span");ic.className="c-command__item-icon";ic.textContent=it.icon;item.appendChild(ic)}const body=document.createElement("div");body.className="c-command__item-body";if(it.title||it.label){const t=document.createElement("div");t.className="c-command__item-title";t.textContent=it.title||it.label;body.appendChild(t)}if(it.hint){const h=document.createElement("span");h.className="c-command__item-hint";h.textContent=it.hint;body.appendChild(h)}if(it.shortcut){const sc=document.createElement("kbd");sc.className="c-command__item-shortcut";sc.textContent=it.shortcut;item.appendChild(sc)}item.appendChild(body);l.appendChild(item)}})}catch(e){}}else if(!items&&list){list.remove()}const empty=this.getAttribute("empty");if(empty){const e=this.ensure(".c-command__empty",()=>{const el=document.createElement("div");el.className="c-command__empty";return el});e.textContent=empty}else{const e=this.querySelector(".c-command__empty");if(e)e.remove()}const status=this.ensure(".c-command__status",()=>{const el=document.createElement("div");el.className="c-command__status";el.setAttribute("role","status");return el});status.textContent="";if(!items&&!list){renderEmpty(this,"command")}}enhance(){if(this._wiredCommand)return;this._wiredCommand=true;const input=()=>this.querySelector(".c-command__input");const items=()=>Array.from(this.querySelectorAll(".c-command__item"));let cursor=-1;const mark=()=>{items().forEach((it,i)=>{it.classList.toggle("c-command__item--active",i===cursor);it.setAttribute("aria-selected",String(i===cursor));if(i===cursor){if(!it.id)it.id="contour-command-option-"+i;const inp=input();if(inp)inp.setAttribute("aria-activedescendant",it.id)}});if(cursor<0){const inp=input();if(inp)inp.removeAttribute("aria-activedescendant")}};this.addEventListener("keydown",(e)=>{const inp=input();if(!inp||e.target!==inp)return;const its=items();if(!its.length)return;if(e.key==="ArrowDown"){e.preventDefault();cursor=Math.min(cursor+1,its.length-1);mark()}else if(e.key==="ArrowUp"){e.preventDefault();cursor=Math.max(cursor-1,0);mark()}else if(e.key==="Home"){e.preventDefault();cursor=0;mark()}else if(e.key==="End"){e.preventDefault();cursor=its.length-1;mark()}else if(e.key==="Enter"){e.preventDefault();if(cursor>=0&&its[cursor]){const item=its[cursor];const idx=items().indexOf(item);this.dispatchEvent(new CustomEvent("contour:select",{detail:{index:idx,label:item.textContent.trim()},bubbles:true,composed:true}))}}else if(e.key==="Escape"){if(typeof this.hidePopover==="function")this.hidePopover()}});this.addEventListener("click",(e)=>{const item=e.target&&e.target.closest?e.target.closest(".c-command__item"):null;if(item&&this.contains(item)){const idx=items().indexOf(item);this.dispatchEvent(new CustomEvent("contour:select",{detail:{index:idx,label:item.textContent.trim()},bubbles:true,composed:true}))}});this.addEventListener("input",(e)=>{const inp=input();if(!inp||e.target!==inp)return;const q=inp.value.trim().toLowerCase();const all=items();let visible=0;all.forEach((it)=>{const match=!q||(it.textContent||"").toLowerCase().includes(q);it.hidden=!match;if(match)visible+=1});this.querySelectorAll(".c-command__group").forEach((g)=>{const hasVisible=Array.from(g.querySelectorAll(".c-command__item")).some((it)=>!it.hidden);g.hidden=!hasVisible});cursor=-1;mark();const status=this.querySelector(".c-command__status");if(status)status.textContent=q?`${visible} of ${all.length}`:""})}}define("contour-command",ContourCommand);class ContourFooter extends ContourBase{static get observed(){return["brand","note","links","cols","heading"]}static get properties(){return{brand:{attribute:"brand"},note:{attribute:"note"},links:{attribute:"links"},cols:{attribute:"cols"}}}render(){this.classList.add("c-footer");const brand=this.getAttribute("brand");if(brand){const b=this.ensure(".c-footer__brand",()=>{const el=document.createElement("div");el.className="c-footer__brand";return el});b.textContent=brand}else{const b=this.querySelector(".c-footer__brand");if(b)b.remove()}const note=this.getAttribute("note");if(note){const n=this.ensure(".c-footer__note",()=>{const el=document.createElement("p");el.className="c-footer__note";return el});n.textContent=note}else{const n=this.querySelector(".c-footer__note");if(n)n.remove()}const links=this.getAttribute("links");if(links){try{const parsed=JSON.parse(links);const wrap=this.ensure(".c-footer__links",()=>{const el=document.createElement("div");el.className="c-footer__links";return el});wrap.innerHTML="";parsed.forEach((l)=>{const a=document.createElement("a");a.href=typeof l==="string"?"#":(l.href||"#");a.textContent=typeof l==="string"?l:(l.label||l);wrap.appendChild(a)})}catch(e){}}else{const w=this.querySelector(".c-footer__links");if(w)w.remove()}const cols=this.getAttribute("cols");if(cols){try{const parsed=JSON.parse(cols);this.querySelectorAll(".c-footer__col").forEach((c)=>c.remove());parsed.forEach((col)=>{const c=document.createElement("div");c.className="c-footer__col";if(col.title){const h=document.createElement(headingTag(this,"h3"));h.textContent=col.title;c.appendChild(h)}(col.links||[]).forEach((l)=>{const a=document.createElement("a");a.href=typeof l==="string"?"#":(l.href||"#");a.textContent=typeof l==="string"?l:(l.label||l);c.appendChild(a)});this.appendChild(c)})}catch(e){}}else{this.querySelectorAll(".c-footer__col").forEach((c)=>c.remove())}}}define("contour-footer",ContourFooter);class ContourSchemeToggle extends ContourBase{static get observed(){return[]}render(){this.classList.add("c-scheme-toggle")}enhance(){if(this._wiredScheme)return;this._wiredScheme=true;this.addEventListener("click",()=>{const root=document.documentElement;root.classList.add("is-theme-switching");const current=root.getAttribute("data-theme")||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");const next=current==="dark"?"light":"dark";root.setAttribute("data-theme",next);try{localStorage.setItem("contour-theme",next)}catch(e){}requestAnimationFrame(()=>requestAnimationFrame(()=>root.classList.remove("is-theme-switching")));this.dispatchEvent(new CustomEvent("contour:theme-change",{detail:{theme:next},bubbles:true,composed:true}))});try{const stored=localStorage.getItem("contour-theme");if(stored)document.documentElement.setAttribute("data-theme",stored)}catch(e){}}}define("contour-scheme-toggle",ContourSchemeToggle);class ContourSidebar extends ContourBase{static get observed(){return["title","items","collapsed"]}static get properties(){return{title:{attribute:"title"},items:{attribute:"items"},collapsed:{attribute:"collapsed",type:Boolean}}}render(){this.classList.add("c-sidebar");if(this.hasAttribute("collapsed"))this.classList.add("c-sidebar--collapsed");else Array.from(this.classList).forEach((c)=>{if(c==="c-sidebar--collapsed")this.classList.remove(c)});const title=this.getAttribute("title");if(title){const t=this.ensure(".c-sidebar__title",()=>{const el=document.createElement("div");el.className="c-sidebar__title";return el});t.textContent=title}else{const t=this.querySelector(".c-sidebar__title");if(t)t.remove()}const items=this.getAttribute("items");if(items){try{const parsed=JSON.parse(items);const nav=this.ensure("nav.c-sidebar__nav",()=>{const el=document.createElement("nav");el.className="c-sidebar__nav";return el});nav.innerHTML="";parsed.forEach((it)=>{const a=document.createElement("a");a.className="c-sidebar__link";a.href=(it&&it.href)||"#";a.textContent=(it&&(it.label||it))||"";nav.appendChild(a)})}catch(e){}}}enhance(){if(this._wiredSidebar)return;this._wiredSidebar=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-sidebar__toggle"):null;if(!btn||!this.contains(btn))return;if(this.hasAttribute("collapsed"))this.removeAttribute("collapsed");else this.setAttribute("collapsed","")})}}define("contour-sidebar",ContourSidebar);class ContourToolbar extends ContourBase{static get observed(){return["title","actions","overflow"]}static get properties(){return{title:{attribute:"title"},actions:{attribute:"actions"},overflow:{attribute:"overflow",type:Number}}}render(){this.classList.add("c-toolbar");const title=this.getAttribute("title");this.setAttribute("role","toolbar");if(title)this.setAttribute("aria-label",title);const actions=this.getAttribute("actions");if(actions){try{const parsed=JSON.parse(actions);const limit=this.overflow&&this.overflow>0?this.overflow:parsed.length;const visible=parsed.slice(0,limit);const excess=parsed.slice(limit);visible.forEach((a)=>{const btn=document.createElement("button");btn.className="c-toolbar__btn";btn.type="button";btn.textContent=typeof a==="string"?a:(a.label||a);this.appendChild(btn)});if(excess.length){const wrap=document.createElement("div");wrap.className="c-toolbar__overflow";const btn=document.createElement("button");btn.className="c-toolbar__btn c-toolbar__overflow-btn";btn.type="button";btn.setAttribute("aria-haspopup","menu");btn.setAttribute("aria-expanded","false");btn.textContent="…";wrap.appendChild(btn);const menu=document.createElement("div");menu.className="c-toolbar__overflow-menu";menu.setAttribute("role","menu");menu.setAttribute("hidden","");excess.forEach((a)=>{const mbtn=document.createElement("button");mbtn.className="c-toolbar__btn";mbtn.type="button";mbtn.setAttribute("role","menuitem");mbtn.textContent=typeof a==="string"?a:(a.label||a);menu.appendChild(mbtn)});wrap.appendChild(menu);this.appendChild(wrap)}}catch(e){}}}enhance(){if(this._wiredToolbar)return;this._wiredToolbar=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-toolbar__overflow-btn"):null;if(!btn||!this.contains(btn))return;const menu=btn.parentElement&&btn.parentElement.querySelector(".c-toolbar__overflow-menu");if(!menu)return;const open=menu.hasAttribute("hidden");if(open)menu.removeAttribute("hidden");else menu.setAttribute("hidden","");btn.setAttribute("aria-expanded",String(open))})}}define("contour-toolbar",ContourToolbar);class ContourAvatar extends ContourBase{static get observed(){return["name","size","variant","src","status"]}static get properties(){return{name:{attribute:"name"},size:{attribute:"size"},variant:{attribute:"variant"},src:{attribute:"src"},status:{attribute:"status"}}}render(){this.classList.add("c-avatar");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-avatar--"))this.classList.remove(c)});const name=this.getAttribute("name");const size=this.getAttribute("size");if(size)this.classList.add("c-avatar--"+size);const variant=this.getAttribute("variant");if(variant)this.classList.add("c-avatar--"+variant);const oldImg=this.querySelector("img.c-avatar__img");if(oldImg)oldImg.remove();const oldDot=this.querySelector(".c-avatar__status");if(oldDot)oldDot.remove();const src=this.getAttribute("src");if(src){this.textContent="";const img=document.createElement("img");img.className="c-avatar__img";img.src=src;img.alt=name||"";this.appendChild(img)}else if(name){const initials=name.split(" ").map((w)=>w[0]).join("").toUpperCase().slice(0,2);if(!this.querySelector("img.c-avatar__img")){}this.textContent=initials}const status=this.getAttribute("status");if(status){const dot=document.createElement("span");dot.className="c-avatar__status c-avatar__status--"+status;dot.setAttribute("aria-hidden","true");this.appendChild(dot)}}}define("contour-avatar",ContourAvatar);class ContourBadgeFull extends ContourBase{static get observed(){return["variant","label","size","removable"]}static get properties(){return{variant:{attribute:"variant"},label:{attribute:"label"},size:{attribute:"size"},removable:{attribute:"removable",type:Boolean}}}render(){this.classList.add("c-badge");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-badge--"))this.classList.remove(c)});const variant=this.getAttribute("variant");if(variant)this.classList.add("c-badge--"+variant);const size=this.getAttribute("size");if(size)this.classList.add("c-badge--"+size);const label=this.getAttribute("label");if(label){let textNode=null;for(const n of this.childNodes){if(n.nodeType===3){textNode=n;break}}if(textNode)textNode.nodeValue=label;else this.insertBefore(document.createTextNode(label),this.firstChild)}if(this.hasAttribute("removable")){this.ensure(".c-badge__remove",()=>{const btn=document.createElement("button");btn.className="c-badge__remove";btn.type="button";btn.setAttribute("aria-label","Remove");btn.textContent="×";return btn})}else{const btn=this.querySelector(".c-badge__remove");if(btn)btn.remove()}}enhance(){wireRemovable(this)}}define("contour-badge",ContourBadgeFull);class ContourChipFull extends ContourBase{static get observed(){return["variant","key","value"]}static get properties(){return{variant:{attribute:"variant"},key:{attribute:"key"},value:{attribute:"value"}}}render(){this.classList.add("c-chip");if(!this.hasAttribute("role"))this.setAttribute("role","status");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-chip--"))this.classList.remove(c)});const variant=this.getAttribute("variant");if(variant)this.classList.add("c-chip--"+variant);const key=this.getAttribute("key");const value=this.getAttribute("value");if(key){const k=this.ensure(".c-chip__key",()=>{const el=document.createElement("span");el.className="c-chip__key";return el});k.textContent=key}else{const k=this.querySelector(".c-chip__key");if(k)k.remove()}if(value){const v=this.ensure(".c-chip__value",()=>{const el=document.createElement("span");el.className="c-chip__value";return el});v.textContent=value}else{const v=this.querySelector(".c-chip__value");if(v)v.remove()}}}define("contour-chip",ContourChipFull);class ContourTag extends ContourBase{static get observed(){return["label","removable","variant"]}static get properties(){return{label:{attribute:"label"},removable:{attribute:"removable",type:Boolean},variant:{attribute:"variant"}}}render(){this.classList.add("c-tag");if(!this.hasAttribute("role"))this.setAttribute("role","status");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-tag--"))this.classList.remove(c)});const variant=this.getAttribute("variant");if(variant)this.classList.add("c-tag--"+variant);const label=this.getAttribute("label");if(label){let textNode=null;for(const n of this.childNodes){if(n.nodeType===3){textNode=n;break}}if(textNode)textNode.nodeValue=label+" ";else this.insertBefore(document.createTextNode(label+" "),this.firstChild)}if(this.hasAttribute("removable")){this.ensure(".c-tag__remove",()=>{const btn=document.createElement("button");btn.className="c-tag__remove";btn.type="button";btn.setAttribute("aria-label","Remove");btn.textContent="×";return btn})}else{const btn=this.querySelector(".c-tag__remove");if(btn)btn.remove()}}enhance(){wireRemovable(this)}}define("contour-tag",ContourTag);class ContourDot extends ContourBase{static get observed(){return["variant","live"]}static get properties(){return{variant:{attribute:"variant"},live:{attribute:"live",type:Boolean}}}render(){this.classList.add("c-dot");if(!this.hasAttribute("role"))this.setAttribute("role","img");if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label","status indicator");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-dot--"))this.classList.remove(c)});const variant=this.getAttribute("variant");if(variant)this.classList.add("c-dot--"+variant);if(this.hasAttribute("live"))this.classList.add("c-dot--live")}}define("contour-dot",ContourDot);class ContourPill extends ContourBase{static get observed(){return["label","live","variant"]}static get properties(){return{label:{attribute:"label"},live:{attribute:"live",type:Boolean},variant:{attribute:"variant"}}}render(){this.classList.add("c-pill");if(!this.hasAttribute("role"))this.setAttribute("role","status");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-pill--"))this.classList.remove(c)});const variant=this.getAttribute("variant");if(variant)this.classList.add("c-pill--"+variant);const label=this.getAttribute("label");if(label){this.textContent=label}if(this.hasAttribute("live"))this.classList.add("c-pill--live")}}define("contour-pill",ContourPill);class ContourKbd extends ContourBase{static get observed(){return["key"]}static get properties(){return{key:{attribute:"key"}}}render(){this.classList.add("c-kbd");const key=this.getAttribute("key");if(key){this.textContent=key}}}define("contour-kbd",ContourKbd);class ContourSpinner extends ContourBase{static get observed(){return["size"]}static get properties(){return{size:{attribute:"size"}}}render(){this.classList.add("c-spinner");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-spinner--"))this.classList.remove(c)});const size=this.getAttribute("size");if(size)this.classList.add("c-spinner--"+size);if(!this.hasAttribute("role"))this.setAttribute("role","status");if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label","Loading")}}define("contour-spinner",ContourSpinner);class ContourSkeleton extends ContourBase{static get observed(){return["size"]}static get properties(){return{size:{attribute:"size"}}}render(){this.classList.add("c-skeleton");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-skeleton--"))this.classList.remove(c)});const size=this.getAttribute("size");if(size)this.classList.add("c-skeleton--"+size)}}define("contour-skeleton",ContourSkeleton);class ContourTooltip extends ContourBase{static get observed(){return["text","anchor","delay","trigger"]}static get properties(){return{text:{attribute:"text"},anchor:{attribute:"anchor"},delay:{attribute:"delay",type:Number},trigger:{attribute:"trigger"}}}render(){this.classList.add("c-tooltip");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");if(!this.hasAttribute("role"))this.setAttribute("role","tooltip");if(!this.id)this.id=contourId("tip");const text=this.getAttribute("text");if(text!==null&&!this.hasChildNodes()){this.textContent=text}}enhance(){if(this._wiredTooltip)return;this._wiredTooltip=true;const anchorSel=this.getAttribute("anchor");if(anchorSel){let trigger=null;if(anchorSel.startsWith("#")){trigger=document.getElementById(anchorSel.slice(1))}else{trigger=document.querySelector(anchorSel)}if(trigger){trigger.setAttribute("popovertarget",this.id||(this.id=contourId("tip")));trigger.setAttribute("aria-describedby",this.id)}}const delayMs=(this.delay&&this.delay>0)?this.delay:0;let showTimer=null;const show=()=>{if(showTimer)clearTimeout(showTimer);if(delayMs>0)showTimer=setTimeout(()=>{try{this.showPopover()}catch(e){}},delayMs);else{try{this.showPopover()}catch(e){}}};const hide=()=>{if(showTimer){clearTimeout(showTimer);showTimer=null}try{this.hidePopover()}catch(e){}};const triggerMode=this.getAttribute("trigger")||"hover";const trigger=anchorSel?(anchorSel.startsWith("#")?document.getElementById(anchorSel.slice(1)):document.querySelector(anchorSel)):null;const target=trigger||this;const onEnter=()=>{if(triggerMode!=="click")show()};const onLeave=()=>{if(triggerMode!=="click")hide()};const onFocus=()=>{if(triggerMode!=="click")show()};const onBlur=()=>{if(triggerMode!=="click")hide()};const onClick=()=>{if(triggerMode==="click"||triggerMode==="hover"){if(this.matches(":popover-open"))hide();else show()}};target.addEventListener("mouseenter",onEnter);target.addEventListener("mouseleave",onLeave);target.addEventListener("focus",onFocus);target.addEventListener("blur",onBlur);target.addEventListener("click",onClick);onDispose(this,()=>{target.removeEventListener("mouseenter",onEnter);target.removeEventListener("mouseleave",onLeave);target.removeEventListener("focus",onFocus);target.removeEventListener("blur",onBlur);target.removeEventListener("click",onClick);if(showTimer)clearTimeout(showTimer)});this.addEventListener("toggle",(e)=>{const t=e.target;if(t&&t===this){this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:this.matches(":popover-open")},bubbles:true,composed:true}))}});this.addEventListener("beforetoggle",(e)=>{this.dispatchEvent(new CustomEvent(e.newState==="open"?"contour:show":"contour:hide",{bubbles:true,composed:true}))})}}define("contour-tooltip",ContourTooltip);class ContourProgress extends ContourBase{static get observed(){return["value","label","min","max","paused","pausable"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"},min:{attribute:"min"},max:{attribute:"max"},paused:{attribute:"paused",type:Boolean},pausable:{attribute:"pausable",type:Boolean}}}render(){this.classList.add("c-progress");const value=this.getAttribute("value");if(value===null){this.style.removeProperty("--progress");if(this.getAttribute("aria-valuenow")===this._progressAriaValue){this.removeAttribute("aria-valuenow")}this._progressAriaValue=null}else{const num=Number(value);const pct=Number.isFinite(num)?(num<=1&&value.includes(".")?num*100:num):0;const pctStr=Math.max(0,Math.min(100,pct))+"%";this.style.setProperty("--progress",pctStr);const prevVal=this._progressAriaValue;if(!this.hasAttribute("aria-valuenow")||this.getAttribute("aria-valuenow")===prevVal){this.setAttribute("aria-valuenow",String(pct));this._progressAriaValue=String(pct)}}this.ensure(".c-progress__bar",()=>{const el=document.createElement("span");el.className="c-progress__bar";return el});if(!this.hasAttribute("role"))this.setAttribute("role","progressbar");const label=this.getAttribute("label");if(label&&!this.hasAttribute("aria-label"))this.setAttribute("aria-label",label);const min=this.getAttribute("min");const max=this.getAttribute("max");if(min!==null)this.setAttribute("aria-valuemin",min);else if(!this.hasAttribute("aria-valuemin"))this.setAttribute("aria-valuemin","0");if(max!==null)this.setAttribute("aria-valuemax",max);else if(!this.hasAttribute("aria-valuemax"))this.setAttribute("aria-valuemax","100");if(this.hasAttribute("paused"))this.classList.add("c-progress--paused");else Array.from(this.classList).forEach((c)=>{if(c==="c-progress--paused")this.classList.remove(c)});if(this.hasAttribute("pausable")){this.ensure(".c-progress__pause",()=>{const btn=document.createElement("button");btn.className="c-progress__pause";btn.type="button";btn.setAttribute("aria-label","Pause");btn.textContent="⏸";return btn})}else{const btn=this.querySelector(".c-progress__pause");if(btn)btn.remove()}}}define("contour-progress",ContourProgress);class ContourMark extends ContourBase{render(){this.classList.add("c-mark")}}define("contour-mark",ContourMark);class ContourLoading extends ContourBase{render(){this.classList.add("c-loading");this.ensure(".c-spinner",()=>{const el=document.createElement("span");el.className="c-spinner";return el})}}define("contour-loading",ContourLoading);class ContourElevation extends ContourBase{render(){this.classList.add("c-elevation")}}define("contour-elevation",ContourElevation);class ContourVersionBannerFull extends ContourBase{static get observed(){return["message","link","href","dismissible"]}static get properties(){return{message:{attribute:"message"},link:{attribute:"link"},href:{attribute:"href"},dismissible:{attribute:"dismissible",type:Boolean}}}render(){this.classList.add("c-version-banner");Array.from(this.children).forEach((n)=>n.remove());const message=this.getAttribute("message");if(message){const icon=document.createElement("svg");icon.setAttribute("aria-hidden","true");icon.innerHTML='<use href="#i-info" />';this.appendChild(icon);const span=document.createElement("span");span.textContent=message;this.appendChild(span)}const link=this.getAttribute("link");const href=this.getAttribute("href");if(link&&href){const a=document.createElement("a");a.className="c-version-banner__link";a.href=href;a.textContent=link;this.appendChild(a)}if(this.hasAttribute("dismissible")){const btn=document.createElement("button");btn.className="c-version-banner__dismiss";btn.type="button";btn.setAttribute("aria-label","Dismiss");btn.textContent="×";this.appendChild(btn)}}enhance(){if(this._wiredVersionBanner)return;this._wiredVersionBanner=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-version-banner__dismiss"):null;if(btn&&this.contains(btn)){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));this.remove()}})}}define("contour-version-banner",ContourVersionBannerFull);class ContourBanner extends ContourBase{static get observed(){return["message","variant"]}static get properties(){return{message:{attribute:"message"},variant:{attribute:"variant"}}}render(){this.classList.add("c-banner");const variant=this.getAttribute("variant");if(variant)this.classList.add("c-banner--"+variant);const message=this.getAttribute("message");if(message){const span=this.ensure(".c-banner__message",()=>{const el=document.createElement("span");el.className="c-banner__message";return el});span.textContent=message}}}define("contour-banner",ContourBanner);class ContourFilterPill extends ContourBase{static get observed(){return["key","value","removable"]}static get properties(){return{key:{attribute:"key"},value:{attribute:"value"},removable:{attribute:"removable",type:Boolean}}}render(){this.classList.add("c-filter-pill");const key=this.getAttribute("key");const value=this.getAttribute("value");if(key){const k=this.ensure(".c-filter-pill__key",()=>{const el=document.createElement("span");el.className="c-filter-pill__key";return el});k.textContent=key}else{const k=this.querySelector(".c-filter-pill__key");if(k)k.remove()}if(value){const v=this.ensure(".c-filter-pill__value",()=>{const el=document.createElement("span");el.className="c-filter-pill__value";return el});v.textContent=value}else{const v=this.querySelector(".c-filter-pill__value");if(v)v.remove()}if(this.hasAttribute("removable")){this.ensure(".c-filter-pill__remove",()=>{const btn=document.createElement("button");btn.className="c-filter-pill__remove";btn.type="button";btn.setAttribute("aria-label","Remove filter");btn.textContent="×";return btn})}else{const btn=this.querySelector(".c-filter-pill__remove");if(btn)btn.remove()}}enhance(){wireRemovable(this)}}define("contour-filter-pill",ContourFilterPill);class ContourDatamark extends ContourBase{static get observed(){return["value","unit","label"]}static get properties(){return{value:{attribute:"value"},unit:{attribute:"unit"},label:{attribute:"label"}}}render(){this.classList.add("c-datamark");const value=this.getAttribute("value");const unit=this.getAttribute("unit");const label=this.getAttribute("label");const text=value||label;if(text){this.textContent=text;if(unit){const u=document.createElement("span");u.className="u-subtle";u.textContent=" "+unit;this.appendChild(u)}}}}define("contour-datamark",ContourDatamark);class ContourDestructiveHint extends ContourBase{static get observed(){return["text"]}static get properties(){return{text:{attribute:"text"}}}render(){this.classList.add("c-destructive-hint");const text=this.getAttribute("text");if(text)this.textContent=text}}define("contour-destructive-hint",ContourDestructiveHint);class ContourIconBadge extends ContourBase{static get observed(){return["icon"]}static get properties(){return{icon:{attribute:"icon"}}}render(){this.classList.add("c-icon-badge");const icon=this.getAttribute("icon");if(icon){const sanitized=String(icon).replace(/[^a-zA-Z0-9_-]/g,"");if(sanitized&&!sanitized.startsWith("i-")){if(typeof console!=="undefined"&&console.warn){console.warn("ContourIconBadge: icon '"+icon+"' may not exist in the sprite (expected i-* name).")}}const existing=this.querySelector("svg");const svg=existing||document.createElementNS("http://www.w3.org/2000/svg","svg");if(!existing){svg.setAttribute("aria-hidden","true");const use=document.createElementNS("http://www.w3.org/2000/svg","use");use.setAttribute("href","#"+sanitized);svg.appendChild(use);this.appendChild(svg)}else{const use=svg.querySelector("use");if(use)use.setAttribute("href","#"+sanitized)}}else{const svg=this.querySelector("svg");if(svg)svg.remove()}}}define("contour-icon-badge",ContourIconBadge);class ContourLiveBadge extends ContourBase{static get observed(){return["label","state","live"]}static get properties(){return{label:{attribute:"label"},state:{attribute:"state"},live:{attribute:"live",type:Boolean}}}render(){this.classList.add("c-live-badge");Array.from(this.classList).forEach((c)=>{if(c.startsWith("c-live-badge--"))this.classList.remove(c)});const state=this.getAttribute("state");if(state){this.classList.add("c-live-badge--"+state)}else if(this.hasAttribute("live")){this.classList.add("c-live-badge--connected")}const label=this.getAttribute("label");if(label&&!this.hasChildNodes())this.textContent=label}}define("contour-live-badge",ContourLiveBadge);class ContourSkeletonGroup extends ContourBase{static get observed(){return["count"]}static get properties(){return{count:{attribute:"count",type:Number}}}render(){this.classList.add("c-skeleton-group");const count=Math.max(1,parseInt(this.getAttribute("count")||"3",10)||3);Array.from(this.querySelectorAll(".c-skeleton")).forEach((n)=>n.remove());for(let i=0;i<count;i++){const sk=document.createElement("div");sk.className="c-skeleton";this.appendChild(sk)}}}define("contour-skeleton-group",ContourSkeletonGroup);class ContourMapPopup extends ContourBase{static get observed(){return["title","content"]}static get properties(){return{title:{attribute:"title"},content:{attribute:"content"}}}render(){this.classList.add("c-map-popup");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");if(!this.id)this.id=contourId("map-popup");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-map-popup__title",()=>{const el=document.createElement("div");el.className="c-map-popup__title";return el});t.textContent=title}const content=this.getAttribute("content");if(content){const c=this.ensure(".c-map-popup__body",()=>{const el=document.createElement("div");el.className="c-map-popup__body";return el});c.textContent=content}}}define("contour-map-popup",ContourMapPopup);class ContourAnimationControls extends ContourBase{static get observed(){return["playing","speed"]}static get properties(){return{playing:{attribute:"playing",type:Boolean},speed:{attribute:"speed"}}}render(){this.classList.add("c-animation-controls");const playBtn=this.ensure(".c-animation-controls__play",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-animation-controls__play";el.type="button";return el});playBtn.textContent=this.hasAttribute("playing")?"Pause":"Play";playBtn.setAttribute("aria-label",this.hasAttribute("playing")?"Pause":"Play");const speed=this.getAttribute("speed")||"1x";const speedBtn=this.ensure(".c-animation-controls__speed",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-animation-controls__speed";el.type="button";return el});speedBtn.textContent=speed}enhance(){if(this._wiredAnimControls)return;this._wiredAnimControls=true;this.addEventListener("click",(e)=>{const play=e.target&&e.target.closest?e.target.closest(".c-animation-controls__play"):null;const speed=e.target&&e.target.closest?e.target.closest(".c-animation-controls__speed"):null;if(play&&this.contains(play)){this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:true,composed:true,detail:{playing:!this.hasAttribute("playing")}}))}if(speed&&this.contains(speed)){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{speed:speed.textContent}}))}})}}define("contour-animation-controls",ContourAnimationControls);class ContourDropdown extends ContourBase{static get observed(){return["label","items"]}static get properties(){return{label:{attribute:"label"},items:{attribute:"items"}}}render(){this.classList.add("c-dropdown");const btn=this.ensure(".c-dropdown__trigger",()=>{const el=document.createElement("button");el.className="c-dropdown__trigger c-btn c-btn--sm";el.type="button";return el});btn.textContent=this.getAttribute("label")||"Menu";const menu=this.ensure(".c-dropdown__menu",()=>{const el=document.createElement("div");el.className="c-dropdown__menu c-menu";el.setAttribute("role","menu");el.hidden=true;return el});const items=this.getAttribute("items");if(items){try{const parsed=JSON.parse(items);menu.innerHTML="";parsed.forEach((it)=>{const li=document.createElement("button");li.className="c-menu__item";li.setAttribute("role","menuitem");li.textContent=typeof it==="string"?it:(it.label||it.title||"");menu.appendChild(li)})}catch(e){}}if(menu.parentNode!==this)this.appendChild(menu);if(btn.parentNode!==this)this.insertBefore(btn,menu)}enhance(){if(this._wiredDropdown)return;this._wiredDropdown=true;const btn=()=>this.querySelector(".c-dropdown__trigger");const menu=()=>this.querySelector(".c-dropdown__menu");this.addEventListener("click",(e)=>{const b=btn();if(e.target===b||(b&&b.contains(e.target))){const m=menu();if(m){m.hidden=!m.hidden;b.setAttribute("aria-expanded",String(!m.hidden))}}});document.addEventListener("click",(e)=>{const m=menu();const b=btn();if(m&&!m.hidden&&!this.contains(e.target)){m.hidden=true;if(b)b.setAttribute("aria-expanded","false")}})}}define("contour-dropdown",ContourDropdown);class ContourAnnotation extends ContourBase{static get observed(){return["label","x","y"]}static get properties(){return{label:{attribute:"label"},x:{attribute:"x"},y:{attribute:"y"}}}render(){this.classList.add("c-annotation");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-annotation__label",()=>{const el=document.createElement("span");el.className="c-annotation__label";return el});l.textContent=label}const x=this.getAttribute("x");const y=this.getAttribute("y");if(x!==null)this.style.setProperty("--annotation-x",x);if(y!==null)this.style.setProperty("--annotation-y",y)}}define("contour-annotation",ContourAnnotation);class ContourStyleSwitcher extends ContourBase{static get observed(){return["items","value"]}static get properties(){return{items:{attribute:"items"},value:{attribute:"value"}}}render(){this.classList.add("c-style-switcher");const items=this.getAttribute("items");const value=this.getAttribute("value");Array.from(this.querySelectorAll(".c-style-switcher__option")).forEach((n)=>n.remove());if(items){try{const parsed=JSON.parse(items);parsed.forEach((it)=>{const name=typeof it==="string"?it:(it.name||it.label||"");const btn=document.createElement("button");btn.className="c-style-switcher__option c-btn c-btn--sm";btn.type="button";btn.textContent=name;if(name===value)btn.classList.add("c-style-switcher__option--active");btn.dataset.value=name;this.appendChild(btn)})}catch(e){}}}enhance(){if(this._wiredStyleSwitcher)return;this._wiredStyleSwitcher=true;this.addEventListener("click",(e)=>{const btn=e.target&&e.target.closest?e.target.closest(".c-style-switcher__option"):null;if(btn&&this.contains(btn)){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:btn.dataset.value}}))}})}}define("contour-style-switcher",ContourStyleSwitcher);class ContourStylePanel extends ContourBase{static get observed(){return["title","layers","classification","palette","breaks","opacity"]}static get properties(){return{title:{attribute:"title"},layers:{attribute:"layers"},classification:{attribute:"classification"},palette:{attribute:"palette"},breaks:{attribute:"breaks"},opacity:{attribute:"opacity"}}}render(){this.classList.add("c-style-panel");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-style-panel__title",()=>{const el=document.createElement("div");el.className="c-style-panel__title";return el});t.textContent=title}const layers=this.getAttribute("layers");const body=this.ensure(".c-style-panel__body",()=>{const el=document.createElement("div");el.className="c-style-panel__body";return el});const authoredRows=Array.from(this.querySelectorAll(":scope > .c-style-panel__row"));let parsed=null;if(authoredRows.length){parsed=authoredRows.map((row)=>({name:row.querySelector(".c-style-panel__name")?.textContent||"",color:row.querySelector(".c-style-panel__color")?.value,classification:row.querySelector(".c-style-panel__classification")?.value,palette:row.querySelector(".c-style-panel__palette")?.value,breaks:row.querySelector(".c-style-panel__breaks")?.value,opacity:row.querySelector(".c-style-panel__opacity")?.value,}));authoredRows.forEach((row)=>row.remove())}else if(layers){try{parsed=JSON.parse(layers)}catch(e){parsed=null}}if(parsed){body.innerHTML="";parsed.forEach((l)=>{const row=document.createElement("div");row.className="c-style-panel__row";const name=document.createElement("span");name.className="c-style-panel__name";name.textContent=typeof l==="string"?l:(l.name||l.label||"");row.appendChild(name);const input=document.createElement("input");input.type="color";input.className="c-style-panel__color";if(typeof l==="object"&&l.color)input.value=l.color;row.appendChild(input);const clsSel=document.createElement("select");clsSel.className="c-style-panel__classification";["equal","quantile","jenks","manual"].forEach((m)=>{const o=document.createElement("option");o.value=m;o.textContent=m;clsSel.appendChild(o)});if(typeof l==="object"&&l.classification)clsSel.value=l.classification;row.appendChild(clsSel);const pal=document.createElement("input");pal.type="text";pal.className="c-style-panel__palette";pal.placeholder="palette";if(typeof l==="object"&&l.palette)pal.value=l.palette;row.appendChild(pal);const breaks=document.createElement("input");breaks.type="text";breaks.className="c-style-panel__breaks";breaks.placeholder="breaks";if(typeof l==="object"&&l.breaks)breaks.value=(Array.isArray(l.breaks)?l.breaks.join(","):l.breaks);row.appendChild(breaks);const op=document.createElement("input");op.type="range";op.className="c-style-panel__opacity";op.min="0";op.max="100";op.value=(typeof l==="object"&&l.opacity!=null)?l.opacity:"100";row.appendChild(op);body.appendChild(row)})}}enhance(){if(this._wiredStylePanel)return;this._wiredStylePanel=true;this.addEventListener("change",(e)=>{const t=e.target;if(!t||!this.contains(t))return;const row=t.closest(".c-style-panel__row");const name=row?(row.querySelector(".c-style-panel__name")?.textContent||""):"";if(t.classList.contains("c-style-panel__color")){this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:t.value,layer:name,property:"color"},bubbles:true,composed:true}))}else if(t.classList.contains("c-style-panel__classification")){this.dispatchEvent(new CustomEvent("contour:break-change",{detail:{value:t.value,layer:name},bubbles:true,composed:true}))}else if(t.classList.contains("c-style-panel__opacity")){this.dispatchEvent(new CustomEvent("contour:layer-opacity",{detail:{name,opacity:Number(t.value)},bubbles:true,composed:true}))}});this.addEventListener("input",(e)=>{const t=e.target;if(!t||!this.contains(t))return;if(t.classList.contains("c-style-panel__palette")||t.classList.contains("c-style-panel__breaks")){const row=t.closest(".c-style-panel__row");const name=row?(row.querySelector(".c-style-panel__name")?.textContent||""):"";this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:t.value,layer:name,property:t.classList.contains("c-style-panel__palette")?"palette":"breaks"},bubbles:true,composed:true}))}})}}define("contour-style-panel",ContourStylePanel);class ContourResponsiveContent extends ContourBase{static get observed(){return["breakpoint"]}static get properties(){return{breakpoint:{attribute:"breakpoint"}}}render(){this.classList.add("c-responsive-content");const bp=this.getAttribute("breakpoint")||"md";this.dataset.breakpoint=bp}}define("contour-responsive-content",ContourResponsiveContent);class ContourAvatarGroup extends ContourBase{static get observed(){return["items","max"]}static get properties(){return{items:{attribute:"items"},max:{attribute:"max",type:Number}}}render(){this.classList.add("c-avatar-group");const items=this.getAttribute("items");const max=parseInt(this.getAttribute("max")||"4",10)||4;Array.from(this.querySelectorAll(".c-avatar, .c-avatar-group__overflow")).forEach((n)=>n.remove());if(items){try{const parsed=JSON.parse(items);const shown=parsed.slice(0,max);shown.forEach((it)=>{const av=document.createElement("span");av.className="c-avatar";const name=typeof it==="string"?it:(it.name||it.label||"");av.textContent=name.slice(0,2).toUpperCase();if(typeof it==="object"&&it.color)av.style.background=it.color;this.appendChild(av)});if(parsed.length>max){const overflow=document.createElement("span");overflow.className="c-avatar c-avatar-group__overflow";overflow.textContent="+"+(parsed.length-max);this.appendChild(overflow)}}catch(e){}}}}define("contour-avatar-group",ContourAvatarGroup);class ContourDivider extends ContourBase{static get observed(){return["label","orientation"]}static get properties(){return{label:{attribute:"label"},orientation:{attribute:"orientation"}}}render(){this.classList.add("c-divider");const orientation=this.getAttribute("orientation")||"horizontal";this.classList.add("c-divider--"+orientation);const label=this.getAttribute("label");if(label){const l=this.ensure(".c-divider__label",()=>{const el=document.createElement("span");el.className="c-divider__label";return el});l.textContent=label}}}define("contour-divider",ContourDivider);class ContourStatusLight extends ContourBase{static get observed(){return["status","label"]}static get properties(){return{status:{attribute:"status"},label:{attribute:"label"}}}render(){this.classList.add("c-status-light");const status=this.getAttribute("status")||"neutral";this.classList.add("c-status-light--"+status);const label=this.getAttribute("label");if(label){const l=this.ensure(".c-status-light__label",()=>{const el=document.createElement("span");el.className="c-status-light__label";return el});l.textContent=label}}}define("contour-status-light",ContourStatusLight);class ContourSplitButton extends ContourBase{static get observed(){return["label","menu"]}static get properties(){return{label:{attribute:"label"},menu:{attribute:"menu"}}}render(){this.classList.add("c-split-button");const main=this.ensure(".c-split-button__main",()=>{const el=document.createElement("button");el.className="c-btn c-split-button__main";el.type="button";return el});main.textContent=this.getAttribute("label")||"Action";const toggle=this.ensure(".c-split-button__toggle",()=>{const el=document.createElement("button");el.className="c-btn c-btn--icon c-split-button__toggle";el.type="button";el.setAttribute("aria-label","More options");el.textContent="▾";return el});const menu=this.ensure(".c-split-button__menu",()=>{const el=document.createElement("div");el.className="c-menu c-split-button__menu";el.setAttribute("role","menu");el.hidden=true;return el});const items=this.getAttribute("menu");if(items){try{const parsed=JSON.parse(items);menu.innerHTML="";parsed.forEach((it)=>{const li=document.createElement("button");li.className="c-menu__item";li.setAttribute("role","menuitem");li.textContent=typeof it==="string"?it:(it.label||it.title||"");menu.appendChild(li)})}catch(e){}}if(main.parentNode!==this)this.appendChild(main);if(toggle.parentNode!==this)this.appendChild(toggle);if(menu.parentNode!==this)this.appendChild(menu)}enhance(){if(this._wiredSplitButton)return;this._wiredSplitButton=true;const toggle=()=>this.querySelector(".c-split-button__toggle");const menu=()=>this.querySelector(".c-split-button__menu");this.addEventListener("click",(e)=>{const t=toggle();if(e.target===t||(t&&t.contains(e.target))){const m=menu();if(m){m.hidden=!m.hidden;t.setAttribute("aria-expanded",String(!m.hidden))}}});document.addEventListener("click",(e)=>{const m=menu();const t=toggle();if(m&&!m.hidden&&!this.contains(e.target)){m.hidden=true;if(t)t.setAttribute("aria-expanded","false")}})}}define("contour-split-button",ContourSplitButton);class ContourPaletteEditor extends ContourBase{static get observed(){return["colors"]}static get properties(){return{colors:{attribute:"colors"}}}render(){this.classList.add("c-palette-editor");const colors=this.getAttribute("colors");Array.from(this.querySelectorAll(".c-palette-editor__swatch")).forEach((n)=>n.remove());if(colors){try{const parsed=JSON.parse(colors);parsed.forEach((c)=>{const sw=document.createElement("button");sw.className="c-palette-editor__swatch c-swatch";sw.type="button";sw.style.background=typeof c==="string"?c:(c.color||c.value||"");sw.setAttribute("aria-label",typeof c==="string"?c:(c.name||c.label||"color"));this.appendChild(sw)})}catch(e){}}}enhance(){if(this._wiredPaletteEditor)return;this._wiredPaletteEditor=true;this.addEventListener("click",(e)=>{const sw=e.target&&e.target.closest?e.target.closest(".c-palette-editor__swatch"):null;if(sw&&this.contains(sw)){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{color:sw.style.background}}))}})}}define("contour-palette-editor",ContourPaletteEditor);class ContourDateRange extends ContourBase{static get observed(){return["start","end","label"]}static get properties(){return{start:{attribute:"start"},end:{attribute:"end"},label:{attribute:"label"}}}render(){this.classList.add("c-date-range");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-date-range__label",()=>{const el=document.createElement("span");el.className="c-date-range__label";return el});l.textContent=label}const start=this.ensure(".c-date-range__start",()=>{const el=document.createElement("input");el.className="c-input c-date-range__start";el.type="date";return el});start.value=this.getAttribute("start")||"";const end=this.ensure(".c-date-range__end",()=>{const el=document.createElement("input");el.className="c-input c-date-range__end";el.type="date";return el});end.value=this.getAttribute("end")||""}enhance(){if(this._wiredDateRange)return;this._wiredDateRange=true;this.addEventListener("change",(e)=>{const t=e.target;if(t&&(t.classList.contains("c-date-range__start")||t.classList.contains("c-date-range__end"))){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{start:this.querySelector(".c-date-range__start")?.value,end:this.querySelector(".c-date-range__end")?.value}}))}})}}define("contour-date-range",ContourDateRange);class ContourShortcut extends ContourBase{static get observed(){return["key","label"]}static get properties(){return{key:{attribute:"key"},label:{attribute:"label"}}}render(){this.classList.add("c-shortcut");const key=this.getAttribute("key")||"";const label=this.getAttribute("label")||"";if(key){const k=this.ensure(".c-shortcut__key",()=>{const el=document.createElement("kbd");el.className="c-shortcut__key";return el});k.textContent=key}if(label){const l=this.ensure(".c-shortcut__label",()=>{const el=document.createElement("span");el.className="c-shortcut__label";return el});l.textContent=label}}enhance(){if(this._wiredShortcut)return;this._wiredShortcut=true;const key=this.getAttribute("key");if(key){document.addEventListener("keydown",(e)=>{if(e.key===key&&(e.metaKey||e.ctrlKey)){e.preventDefault();this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:true,composed:true}))}})}}}define("contour-shortcut",ContourShortcut);class ContourPopover extends ContourBase{static get observed(){return["title","content"]}static get properties(){return{title:{attribute:"title"},content:{attribute:"content"}}}render(){this.classList.add("c-popover");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");if(!this.id)this.id=contourId("popover");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-popover__title",()=>{const el=document.createElement("div");el.className="c-popover__title";return el});t.textContent=title}const content=this.getAttribute("content");if(content){const c=this.ensure(".c-popover__body",()=>{const el=document.createElement("div");el.className="c-popover__body";return el});c.textContent=content}}}define("contour-popover",ContourPopover);class ContourDatePicker extends ContourBase{static get observed(){return["value","label"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"}}}render(){this.classList.add("c-date-picker");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-date-picker__label",()=>{const el=document.createElement("label");el.className="c-date-picker__label";return el});l.textContent=label}const input=this.ensure(".c-date-picker__input",()=>{const el=document.createElement("input");el.className="c-input c-date-picker__input";el.type="date";return el});input.value=this.getAttribute("value")||""}enhance(){if(this._wiredDatePicker)return;this._wiredDatePicker=true;this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.classList.contains("c-date-picker__input")){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:t.value}}))}})}}define("contour-date-picker",ContourDatePicker);class ContourRating extends ContourBase{static get observed(){return["value","max"]}static get properties(){return{value:{attribute:"value",type:Number},max:{attribute:"max",type:Number}}}render(){this.classList.add("c-rating");const max=parseInt(this.getAttribute("max")||"5",10)||5;const value=parseInt(this.getAttribute("value")||"0",10)||0;Array.from(this.querySelectorAll(".c-rating__star")).forEach((n)=>n.remove());for(let i=1;i<=max;i++){const star=document.createElement("button");star.className="c-rating__star"+(i<=value?" c-rating__star--filled":"");star.type="button";star.textContent="★";star.dataset.value=String(i);star.setAttribute("aria-label",i+" star"+(i>1?"s":""));this.appendChild(star)}}enhance(){if(this._wiredRating)return;this._wiredRating=true;this.addEventListener("click",(e)=>{const star=e.target&&e.target.closest?e.target.closest(".c-rating__star"):null;if(star&&this.contains(star)){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:parseInt(star.dataset.value,10)}}))}})}}define("contour-rating",ContourRating);class ContourTimePicker extends ContourBase{static get observed(){return["value","label"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"}}}render(){this.classList.add("c-time-picker");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-time-picker__label",()=>{const el=document.createElement("label");el.className="c-time-picker__label";return el});l.textContent=label}const input=this.ensure(".c-time-picker__input",()=>{const el=document.createElement("input");el.className="c-input c-time-picker__input";el.type="time";return el});input.value=this.getAttribute("value")||""}enhance(){if(this._wiredTimePicker)return;this._wiredTimePicker=true;this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.classList.contains("c-time-picker__input")){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:t.value}}))}})}}define("contour-time-picker",ContourTimePicker);class ContourColorPicker extends ContourBase{static get observed(){return["value","label"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"}}}render(){this.classList.add("c-color-picker");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-color-picker__label",()=>{const el=document.createElement("label");el.className="c-color-picker__label";return el});l.textContent=label}const input=this.ensure(".c-color-picker__input",()=>{const el=document.createElement("input");el.className="c-color-picker__input";el.type="color";return el});input.value=this.getAttribute("value")||"#000000"}enhance(){if(this._wiredColorPicker)return;this._wiredColorPicker=true;this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.classList.contains("c-color-picker__input")){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:t.value}}))}})}}define("contour-color-picker",ContourColorPicker);class ContourNumberField extends ContourBase{static get observed(){return["value","min","max","step","label"]}static get properties(){return{value:{attribute:"value"},min:{attribute:"min"},max:{attribute:"max"},step:{attribute:"step"},label:{attribute:"label"}}}render(){this.classList.add("c-number-field");const label=this.getAttribute("label");if(label){const l=this.ensure(".c-number-field__label",()=>{const el=document.createElement("label");el.className="c-number-field__label";return el});l.textContent=label}const input=this.ensure(".c-number-field__input",()=>{const el=document.createElement("input");el.className="c-input c-number-field__input";el.type="number";return el});if(this.getAttribute("value")!==null)input.value=this.getAttribute("value");if(this.getAttribute("min")!==null)input.min=this.getAttribute("min");if(this.getAttribute("max")!==null)input.max=this.getAttribute("max");if(this.getAttribute("step")!==null)input.step=this.getAttribute("step")}enhance(){if(this._wiredNumberField)return;this._wiredNumberField=true;this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.classList.contains("c-number-field__input")){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{value:t.value}}))}})}}define("contour-number-field",ContourNumberField);class ContourHoverCard extends ContourBase{static get observed(){return["title","content","anchor"]}static get properties(){return{title:{attribute:"title"},content:{attribute:"content"},anchor:{attribute:"anchor"}}}render(){this.classList.add("c-hover-card");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");if(!this.id)this.id=contourId("hover-card");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-hover-card__title",()=>{const el=document.createElement("div");el.className="c-hover-card__title";return el});t.textContent=title}const content=this.getAttribute("content");if(content){const c=this.ensure(".c-hover-card__body",()=>{const el=document.createElement("div");el.className="c-hover-card__body";return el});c.textContent=content}}enhance(){if(this._wiredHoverCard)return;this._wiredHoverCard=true;const anchorSel=this.getAttribute("anchor");if(anchorSel){const trigger=anchorSel.startsWith("#")?document.getElementById(anchorSel.slice(1)):document.querySelector(anchorSel);if(trigger){trigger.setAttribute("popovertarget",this.id);let showTimer=null;trigger.addEventListener("mouseenter",()=>{showTimer=setTimeout(()=>{try{this.showPopover()}catch(e){}},300)});trigger.addEventListener("mouseleave",()=>{if(showTimer)clearTimeout(showTimer);try{this.hidePopover()}catch(e){}})}}}}define("contour-hover-card",ContourHoverCard);class ContourContextMenu extends ContourBase{static get observed(){return["items"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-context-menu");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");if(!this.id)this.id=contourId("context-menu");const items=this.getAttribute("items");if(items){try{const parsed=JSON.parse(items);this.innerHTML="";parsed.forEach((it)=>{const btn=document.createElement("button");btn.className="c-menu__item";btn.setAttribute("role","menuitem");btn.textContent=typeof it==="string"?it:(it.label||it.title||"");this.appendChild(btn)})}catch(e){}}}enhance(){if(this._wiredContextMenu)return;this._wiredContextMenu=true;this.addEventListener("contextmenu",(e)=>{e.preventDefault();try{this.showPopover()}catch(err){}});this.addEventListener("click",(e)=>{const item=e.target&&e.target.closest?e.target.closest(".c-menu__item"):null;if(item&&this.contains(item)){this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{label:item.textContent.trim()}}));try{this.hidePopover()}catch(err){}}})}}define("contour-context-menu",ContourContextMenu);class ContourFab extends ContourBase{static get observed(){return["label","icon"]}static get properties(){return{label:{attribute:"label"},icon:{attribute:"icon"}}}render(){this.classList.add("c-fab");const label=this.getAttribute("label");if(label)this.setAttribute("aria-label",label);const icon=this.getAttribute("icon");if(icon&&!this.hasChildNodes())this.textContent=icon}enhance(){if(this._wiredFab)return;this._wiredFab=true;this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:true,composed:true}))})}}define("contour-fab",ContourFab);class ContourFileUpload extends ContourBase{static get observed(){return["label","accept","multiple","progress"]}static get properties(){return{label:{attribute:"label"},accept:{attribute:"accept"},multiple:{attribute:"multiple",type:Boolean},progress:{attribute:"progress"}}}render(){this.classList.add("c-file-upload");const label=this.getAttribute("label")||"Drop files here or click to browse";const dz=this.ensure(".c-file-upload__dropzone",()=>{const el=document.createElement("div");el.className="c-file-upload__dropzone";el.setAttribute("role","button");el.tabIndex=0;return el});dz.textContent=label;const input=this.ensure(".c-file-upload__input",()=>{const el=document.createElement("input");el.className="c-file-upload__input";el.type="file";el.hidden=true;return el});input.accept=this.getAttribute("accept")||"";input.multiple=this.hasAttribute("multiple");const p=this.getAttribute("progress");if(p!==null){const bar=this.ensure(".c-file-upload__progress",()=>{const el=document.createElement("progress");el.className="c-file-upload__progress";return el});bar.value=Number(p)||0;bar.max=100}}enhance(){if(this._wiredFileUpload)return;this._wiredFileUpload=true;const dz=()=>this.querySelector(".c-file-upload__dropzone");const input=()=>this.querySelector(".c-file-upload__input");this.addEventListener("click",(e)=>{const d=dz();if(e.target===d||(d&&d.contains(e.target))){const i=input();if(i)i.click()}});this.addEventListener("change",(e)=>{const t=e.target;if(t&&t.classList.contains("c-file-upload__input")){this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{files:t.files}}))}});this.addEventListener("dragover",(e)=>{e.preventDefault();this.classList.add("is-dragover")});this.addEventListener("dragleave",()=>this.classList.remove("is-dragover"));this.addEventListener("drop",(e)=>{e.preventDefault();this.classList.remove("is-dragover");const i=input();if(i&&e.dataTransfer&&e.dataTransfer.files){i.files=e.dataTransfer.files;this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{files:e.dataTransfer.files}}))}})}}define("contour-file-upload",ContourFileUpload);class ContourNotificationCenter extends ContourBase{static get observed(){return["count","items"]}static get properties(){return{count:{attribute:"count"},items:{attribute:"items"}}}render(){this.classList.add("c-notification-center");const btn=this.ensure(".c-notification-center__trigger",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-notification-center__trigger";el.type="button";el.textContent="🔔";return el});const count=this.getAttribute("count");let badge=this.querySelector(".c-notification-center__badge");if(count&&Number(count)>0){if(!badge){badge=document.createElement("span");badge.className="c-notification-center__badge c-badge c-badge--dot";this.appendChild(badge)}badge.textContent=count}else if(badge){badge.remove()}const panel=this.ensure(".c-notification-center__panel",()=>{const el=document.createElement("div");el.className="c-notification-center__panel";el.hidden=true;return el});const items=this.getAttribute("items");if(items){try{const parsed=JSON.parse(items);panel.innerHTML="";parsed.forEach((it)=>{const row=document.createElement("div");row.className="c-notification-center__item";row.textContent=typeof it==="string"?it:(it.text||it.title||"");panel.appendChild(row)})}catch(e){}}}enhance(){if(this._wiredNotifCenter)return;this._wiredNotifCenter=true;this.addEventListener("click",(e)=>{const btn=this.querySelector(".c-notification-center__trigger");const panel=this.querySelector(".c-notification-center__panel");if(btn&&(e.target===btn||btn.contains(e.target))){if(panel){panel.hidden=!panel.hidden;btn.setAttribute("aria-expanded",String(!panel.hidden))}}});document.addEventListener("click",(e)=>{const panel=this.querySelector(".c-notification-center__panel");const btn=this.querySelector(".c-notification-center__trigger");if(panel&&!panel.hidden&&!this.contains(e.target)){panel.hidden=true;if(btn)btn.setAttribute("aria-expanded","false")}})}}define("contour-notification-center",ContourNotificationCenter);class ContourStepper extends ContourBase{static get observed(){return["steps","current"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current"}}}render(){this.classList.add("c-stepper");const steps=this.getAttribute("steps");const current=Number(this.getAttribute("current")||0);const list=this.ensure(".c-stepper__list",()=>{const el=document.createElement("ol");el.className="c-stepper__list";return el});list.innerHTML="";let parsed=[];try{parsed=steps?JSON.parse(steps):[]}catch(e){parsed=[]}parsed.forEach((s,i)=>{const li=document.createElement("li");li.className="c-stepper__step"+(i===current?" is-current":"")+(i<current?" is-done":"");li.textContent=typeof s==="string"?s:(s.title||s.label||"");list.appendChild(li)});const nav=this.ensure(".c-stepper__nav",()=>{const el=document.createElement("div");el.className="c-stepper__nav";return el});const prev=this.ensure(".c-stepper__prev",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-stepper__prev";el.type="button";el.textContent="Back";return el});const next=this.ensure(".c-stepper__next",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-stepper__next";el.type="button";el.textContent="Next";return el});if(!nav.contains(prev))nav.appendChild(prev);if(!nav.contains(next))nav.appendChild(next);if(nav.parentNode!==this)this.appendChild(nav)}enhance(){if(this._wiredStepper)return;this._wiredStepper=true;this.addEventListener("click",(e)=>{const prev=e.target&&e.target.closest?e.target.closest(".c-stepper__prev"):null;const next=e.target&&e.target.closest?e.target.closest(".c-stepper__next"):null;if(prev&&this.contains(prev))this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:true,composed:true,detail:{direction:"prev"}}));if(next&&this.contains(next))this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:true,composed:true,detail:{direction:"next"}}))})}}define("contour-stepper",ContourStepper);class ContourVirtualList extends ContourBase{static get observed(){return["items","item-height"]}static get properties(){return{items:{attribute:"items"},"item-height":{attribute:"item-height"}}}render(){this.classList.add("c-virtual-list");const scroller=this.ensure(".c-virtual-list__scroller",()=>{const el=document.createElement("div");el.className="c-virtual-list__scroller";return el});const items=this.getAttribute("items");let parsed=[];try{parsed=items?JSON.parse(items):[]}catch(e){parsed=[]}scroller.innerHTML="";parsed.forEach((it,i)=>{const row=document.createElement("div");row.className="c-virtual-list__item";row.textContent=typeof it==="string"?it:(it.label||it.text||JSON.stringify(it));row.dataset.index=String(i);scroller.appendChild(row)})}}define("contour-virtual-list",ContourVirtualList);class ContourCommandPalette extends ContourBase{static get observed(){return["open","items"]}static get properties(){return{open:{attribute:"open",type:Boolean},items:{attribute:"items"}}}render(){this.classList.add("c-command-palette");if(!this.hasAttribute("popover"))this.setAttribute("popover","auto");const search=this.ensure(".c-command-palette__search",()=>{const el=document.createElement("input");el.className="c-input c-command-palette__search";el.type="search";el.placeholder="Search…";return el});const list=this.ensure(".c-command-palette__list",()=>{const el=document.createElement("div");el.className="c-command-palette__list";el.setAttribute("role","listbox");return el});const items=this.getAttribute("items");if(items){try{const parsed=JSON.parse(items);list.innerHTML="";parsed.forEach((it,i)=>{const row=document.createElement("div");row.className="c-command-palette__item";row.setAttribute("role","option");row.textContent=typeof it==="string"?it:(it.label||it.title||"");row.dataset.index=String(i);list.appendChild(row)})}catch(e){}}}enhance(){if(this._wiredCmdPalette)return;this._wiredCmdPalette=true;this.addEventListener("keydown",(e)=>{const items=Array.from(this.querySelectorAll(".c-command-palette__item"));const active=this.querySelector(".c-command-palette__item.is-active");let idx=active?items.indexOf(active):-1;if(e.key==="ArrowDown"){e.preventDefault();idx=Math.min(items.length-1,idx+1)}else if(e.key==="ArrowUp"){e.preventDefault();idx=Math.max(0,idx-1)}else if(e.key==="Home"){e.preventDefault();idx=0}else if(e.key==="End"){e.preventDefault();idx=items.length-1}else if(e.key==="Enter"){e.preventDefault();if(active)this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{index:items.indexOf(active)}}));return}else return;items.forEach((it,i)=>it.classList.toggle("is-active",i===idx))})}}define("contour-command-palette",ContourCommandPalette);class ContourBadgeOverflow extends ContourBase{static get observed(){return["count","max"]}static get properties(){return{count:{attribute:"count"},max:{attribute:"max"}}}render(){this.classList.add("c-badge-overflow");const count=Number(this.getAttribute("count")||0);const max=Number(this.getAttribute("max")||3);const extra=Math.max(0,count-max);this.textContent="";if(extra>0){const b=document.createElement("span");b.className="c-badge c-badge-overflow__more";b.textContent="+"+extra;this.appendChild(b)}}}define("contour-badge-overflow",ContourBadgeOverflow);class ContourSideSheet extends ContourBase{static get observed(){return["open","side","title"]}static get properties(){return{open:{attribute:"open",type:Boolean},side:{attribute:"side"},title:{attribute:"title"}}}render(){this.classList.add("c-side-sheet");const side=this.getAttribute("side")||"end";this.classList.add("c-side-sheet--"+side);if(this.hasAttribute("open"))this.classList.add("is-open");else this.classList.remove("is-open");const title=this.getAttribute("title");if(title){const t=this.ensure(".c-side-sheet__title",()=>{const el=document.createElement("div");el.className="c-side-sheet__title";return el});t.textContent=title}}}define("contour-side-sheet",ContourSideSheet);class ContourTour extends ContourBase{static get observed(){return["steps","current"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current"}}}render(){this.classList.add("c-tour");const steps=this.getAttribute("steps");const current=Number(this.getAttribute("current")||0);let parsed=[];try{parsed=steps?JSON.parse(steps):[]}catch(e){parsed=[]}const step=parsed[current]||{};const tip=this.ensure(".c-tour__tip",()=>{const el=document.createElement("div");el.className="c-tour__tip";return el});tip.textContent=typeof step==="string"?step:(step.text||step.title||"");const nav=this.ensure(".c-tour__nav",()=>{const el=document.createElement("div");el.className="c-tour__nav";return el});const next=this.ensure(".c-tour__next",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-tour__next";el.type="button";el.textContent="Next";return el});if(!nav.contains(next))nav.appendChild(next)}enhance(){if(this._wiredTour)return;this._wiredTour=true;this.addEventListener("click",(e)=>{const next=e.target&&e.target.closest?e.target.closest(".c-tour__next"):null;if(next&&this.contains(next))this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:true,composed:true,detail:{direction:"next"}}))})}}define("contour-tour",ContourTour);class ContourTagsInput extends ContourBase{static get observed(){return["value","placeholder"]}static get properties(){return{value:{attribute:"value"},placeholder:{attribute:"placeholder"}}}render(){this.classList.add("c-tags-input");const input=this.ensure(".c-tags-input__input",()=>{const el=document.createElement("input");el.className="c-input c-tags-input__input";el.type="text";return el});input.placeholder=this.getAttribute("placeholder")||"Add tag…";const tags=this.getAttribute("value");let parsed=[];try{parsed=tags?JSON.parse(tags):[]}catch(e){parsed=tags?tags.split(",").map((s)=>s.trim()).filter(Boolean):[]}Array.from(this.querySelectorAll(".c-tags-input__tag")).forEach((n)=>n.remove());parsed.forEach((t)=>{const chip=document.createElement("span");chip.className="c-tag c-tags-input__tag";chip.textContent=t;const rm=document.createElement("button");rm.className="c-tags-input__remove";rm.type="button";rm.textContent="×";rm.dataset.value=t;chip.appendChild(rm);this.insertBefore(chip,input)})}enhance(){if(this._wiredTagsInput)return;this._wiredTagsInput=true;this.addEventListener("keydown",(e)=>{const input=this.querySelector(".c-tags-input__input");if(e.key==="Enter"&&e.target===input){e.preventDefault();const v=input.value.trim();if(v){this.dispatchEvent(new CustomEvent("contour:add",{bubbles:true,composed:true,detail:{value:v}}));input.value=""}}});this.addEventListener("click",(e)=>{const rm=e.target&&e.target.closest?e.target.closest(".c-tags-input__remove"):null;if(rm&&this.contains(rm))this.dispatchEvent(new CustomEvent("contour:remove",{bubbles:true,composed:true,detail:{value:rm.dataset.value}}))})}}define("contour-tags-input",ContourTagsInput);class ContourSortableList extends ContourBase{static get observed(){return["items"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-sortable-list");const list=this.ensure(".c-sortable-list__list",()=>{const el=document.createElement("ul");el.className="c-sortable-list__list";return el});const items=this.getAttribute("items");let parsed=[];try{parsed=items?JSON.parse(items):[]}catch(e){parsed=[]}list.innerHTML="";parsed.forEach((it,i)=>{const li=document.createElement("li");li.className="c-sortable-list__item";li.setAttribute("draggable","true");li.dataset.index=String(i);const handle=document.createElement("span");handle.className="c-sortable-list__handle";handle.textContent="⋮⋮";handle.setAttribute("role","button");handle.tabIndex=0;li.appendChild(handle);const label=document.createElement("span");label.className="c-sortable-list__label";label.textContent=typeof it==="string"?it:(it.label||it.text||"");li.appendChild(label);list.appendChild(li)})}enhance(){if(this._wiredSortableList)return;this._wiredSortableList=true;this.addEventListener("keydown",(e)=>{const handle=e.target&&e.target.closest?e.target.closest(".c-sortable-list__handle"):null;if(!handle)return;const li=handle.closest(".c-sortable-list__item");if(!li)return;const list=this.querySelector(".c-sortable-list__list");if(e.key==="ArrowUp"&&li.previousElementSibling){e.preventDefault();list.insertBefore(li,li.previousElementSibling);this.dispatchEvent(new CustomEvent("contour:move",{bubbles:true,composed:true,detail:{direction:"up"}}))}if(e.key==="ArrowDown"&&li.nextElementSibling){e.preventDefault();list.insertBefore(li.nextElementSibling,li);this.dispatchEvent(new CustomEvent("contour:move",{bubbles:true,composed:true,detail:{direction:"down"}}))}})}}define("contour-sortable-list",ContourSortableList);class ContourSwatch extends ContourBase{static get observed(){return["color","selected","label"]}static get properties(){return{color:{attribute:"color"},selected:{attribute:"selected",type:Boolean},label:{attribute:"label"}}}render(){this.classList.add("c-swatch");const color=this.getAttribute("color")||"#000";this.style.setProperty("--swatch-color",color);if(this.hasAttribute("selected"))this.classList.add("is-selected");else this.classList.remove("is-selected");if(!this.hasAttribute("aria-label")){const label=this.getAttribute("label")||color;this.setAttribute("aria-label",label)}if(!this.querySelector("button")&&!this.querySelector("span")){const btn=document.createElement("button");btn.className="c-swatch__btn";btn.type="button";this.appendChild(btn)}}enhance(){if(this._wiredSwatch)return;this._wiredSwatch=true;this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{value:this.getAttribute("color")}}))})}}define("contour-swatch",ContourSwatch);class ContourCalendar extends ContourBase{static get observed(){return["value","month"]}static get properties(){return{value:{attribute:"value"},month:{attribute:"month"}}}render(){this.classList.add("c-calendar");const grid=this.ensure(".c-calendar__grid",()=>{const el=document.createElement("div");el.className="c-calendar__grid";el.setAttribute("role","grid");return el});grid.innerHTML="";const now=new Date();const year=now.getFullYear();const month=Number(this.getAttribute("month"))||now.getMonth();const first=new Date(year,month,1);const startDay=first.getDay();const daysInMonth=new Date(year,month+1,0).getDate();const selected=this.getAttribute("value");for(let i=0;i<startDay;i++){const empty=document.createElement("div");empty.className="c-calendar__day c-calendar__day--empty";grid.appendChild(empty)}for(let d=1;d<=daysInMonth;d++){const cell=document.createElement("button");cell.className="c-calendar__day";cell.type="button";cell.textContent=String(d);const iso=year+"-"+String(month+1).padStart(2,"0")+"-"+String(d).padStart(2,"0");if(iso===selected)cell.classList.add("is-selected");cell.dataset.value=iso;grid.appendChild(cell)}}enhance(){if(this._wiredCalendar)return;this._wiredCalendar=true;this.addEventListener("click",(e)=>{const cell=e.target&&e.target.closest?e.target.closest(".c-calendar__day"):null;if(cell&&this.contains(cell)&&cell.dataset.value){this.dispatchEvent(new CustomEvent("contour:select",{bubbles:true,composed:true,detail:{value:cell.dataset.value}}))}})}}define("contour-calendar",ContourCalendar);class ContourCarousel extends ContourBase{static get observed(){return["items","index"]}static get properties(){return{items:{attribute:"items"},index:{attribute:"index"}}}render(){this.classList.add("c-carousel");const track=this.ensure(".c-carousel__track",()=>{const el=document.createElement("div");el.className="c-carousel__track";return el});const items=this.getAttribute("items");let parsed=[];try{parsed=items?JSON.parse(items):[]}catch(e){parsed=[]}track.innerHTML="";parsed.forEach((it,i)=>{const slide=document.createElement("div");slide.className="c-carousel__slide";slide.textContent=typeof it==="string"?it:(it.label||it.text||"");slide.dataset.index=String(i);track.appendChild(slide)});const prev=this.ensure(".c-carousel__prev",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-carousel__prev";el.type="button";el.textContent="‹";return el});const next=this.ensure(".c-carousel__next",()=>{const el=document.createElement("button");el.className="c-btn c-btn--sm c-carousel__next";el.type="button";el.textContent="›";return el})}enhance(){if(this._wiredCarousel)return;this._wiredCarousel=true;this.addEventListener("click",(e)=>{const prev=e.target&&e.target.closest?e.target.closest(".c-carousel__prev"):null;const next=e.target&&e.target.closest?e.target.closest(".c-carousel__next"):null;if(prev&&this.contains(prev))this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{direction:"prev"}}));if(next&&this.contains(next))this.dispatchEvent(new CustomEvent("contour:change",{bubbles:true,composed:true,detail:{direction:"next"}}))})}}define("contour-carousel",ContourCarousel);class ContourDataGrid extends ContourBase{static get observed(){return["columns","rows","page"]}static get properties(){return{columns:{attribute:"columns"},rows:{attribute:"rows"},page:{attribute:"page"}}}render(){this.classList.add("c-data-grid");const table=this.ensure(".c-data-grid__table",()=>{const el=document.createElement("table");el.className="c-table c-data-grid__table";return el});const thead=this.ensure("thead",()=>{const el=document.createElement("thead");return el});const tbody=this.ensure("tbody",()=>{const el=document.createElement("tbody");return el});if(thead.parentNode!==table)table.appendChild(thead);if(tbody.parentNode!==table)table.appendChild(tbody);const cols=this.getAttribute("columns");let parsedCols=[];try{parsedCols=cols?JSON.parse(cols):[]}catch(e){parsedCols=[]}if(parsedCols.length&&!thead.querySelector("tr")){const tr=document.createElement("tr");parsedCols.forEach((c)=>{const th=document.createElement("th");th.textContent=typeof c==="string"?c:(c.label||c.key||"");tr.appendChild(th)});thead.appendChild(tr)}const rows=this.getAttribute("rows");let parsedRows=[];try{parsedRows=rows?JSON.parse(rows):[]}catch(e){parsedRows=[]}tbody.innerHTML="";parsedRows.forEach((r)=>{const tr=document.createElement("tr");parsedCols.forEach((c)=>{const key=typeof c==="string"?c:(c.key||c.label||"");const td=document.createElement("td");td.textContent=r&&r[key]!=null?r[key]:"";tr.appendChild(td)});tbody.appendChild(tr)});if(table.parentNode!==this)this.appendChild(table)}}define("contour-data-grid",ContourDataGrid);class ContourTreeGrid extends ContourBase{static get observed(){return["items"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-tree-grid");const table=this.ensure(".c-tree-grid__table",()=>{const el=document.createElement("table");el.className="c-table c-tree-grid__table";return el});const tbody=this.ensure("tbody",()=>{const el=document.createElement("tbody");return el});if(tbody.parentNode!==table)table.appendChild(tbody);const items=this.getAttribute("items");let parsed=[];try{parsed=items?JSON.parse(items):[]}catch(e){parsed=[]}tbody.innerHTML="";const renderNode=(node,depth)=>{const tr=document.createElement("tr");const td=document.createElement("td");td.style.paddingInlineStart=(depth*1.25)+"rem";td.textContent=(node&&(node.label||node.text||node.name))||"";tr.appendChild(td);tbody.appendChild(tr);if(node&&Array.isArray(node.children))node.children.forEach((c)=>renderNode(c,depth+1))};parsed.forEach((n)=>renderNode(n,0));if(table.parentNode!==this)this.appendChild(table)}}define("contour-tree-grid",ContourTreeGrid);for(const block of CLASS_ONLY){define("contour-"+block,simple(["c-"+block]))}let ADOPTED=null;let ADOPTED_KEY="";const adoptedSheets=()=>{let key=document.styleSheets.length+":";for(const sheet of document.styleSheets){let rules=-1;try{rules=sheet.cssRules.length}catch(e){}key+=(sheet.href||"")+"~"+rules+"|"}if(ADOPTED&&key===ADOPTED_KEY)return ADOPTED;ADOPTED_KEY=key;ADOPTED=[];const collect=(sheet,out)=>{let rules;try{rules=sheet.cssRules}catch(e){return}if(!rules)return;for(const r of rules){if(r instanceof CSSImportRule){if(r.styleSheet)collect(r.styleSheet,out)}else{try{out.push(r.cssText)}catch(e){}}}};for(const sheet of document.styleSheets){try{if(sheet.href&&new URL(sheet.href).origin===location.origin){const collected=[];collect(sheet,collected);const built=new CSSStyleSheet();if(collected.length)built.replaceSync(collected.join("\n"));ADOPTED.push(built)}}catch(e){}}return ADOPTED};class ContourShadow extends HTMLElement{static get observedAttributes(){return MODS}constructor(){super();const root=this.attachShadow({mode:"open"});const sheets=adoptedSheets();if(sheets.length)root.adoptedStyleSheets=sheets;root.appendChild(this.constructor.contourTemplate.content.cloneNode(true));this._shadowBase=root.firstElementChild?root.firstElementChild.className:""}enhance(root){if(!root)root=this.shadowRoot;if(!root)return;root.querySelectorAll("details").forEach((d)=>{const summary=d.querySelector("summary");if(summary&&!summary.hasAttribute("aria-expanded")){summary.setAttribute("aria-expanded",String(d.open));d.addEventListener("toggle",()=>{summary.setAttribute("aria-expanded",String(d.open))})}});root.querySelectorAll("[data-live]").forEach((el)=>{if(!el.hasAttribute("role"))el.setAttribute("role","status");if(!el.hasAttribute("aria-live"))el.setAttribute("aria-live","polite")});root.querySelectorAll(".c-spinner").forEach((el)=>{if(!el.hasAttribute("role"))el.setAttribute("role","status");if(!el.hasAttribute("aria-live"))el.setAttribute("aria-live","polite")});root.querySelectorAll(".c-toast, .c-toast-host").forEach((el)=>{if(!el.hasAttribute("role"))el.setAttribute("role","status");if(!el.hasAttribute("aria-live"))el.setAttribute("aria-live","polite");if(!el.hasAttribute("aria-atomic"))el.setAttribute("aria-atomic","true")});root.querySelectorAll("[role='tab']").forEach((tab)=>{const ctrl=tab.getAttribute("aria-controls");if(ctrl){const panel=root.querySelector("#"+CSS.escape(ctrl))||document.getElementById(ctrl);if(panel&&!panel.hasAttribute("aria-labelledby")){if(!tab.id)tab.id=contourId("tab");panel.setAttribute("aria-labelledby",tab.id)}}});root.querySelectorAll("input, textarea, select").forEach((input)=>{if(input.hasAttribute("aria-describedby"))return;const field=input.closest(".c-field");if(field){const hint=field.querySelector(".c-field__hint");if(hint){if(!hint.id)hint.id=contourId("hint");input.setAttribute("aria-describedby",hint.id)}const err=field.querySelector(".c-field__error");if(err){if(!err.id)err.id=contourId("err");const existing=input.getAttribute("aria-describedby")||"";input.setAttribute("aria-describedby",(existing+" "+err.id).trim())}}});root.querySelectorAll(".c-alert").forEach((el)=>{if(!el.hasAttribute("role"))el.setAttribute("role","alert");if(!el.hasAttribute("aria-live"))el.setAttribute("aria-live","assertive")});root.querySelectorAll("input[required], textarea[required], select[required]").forEach((el)=>{if(!el.hasAttribute("aria-required"))el.setAttribute("aria-required","true")})}connectedCallback(){this.applyMods();try{this.enhance(this.shadowRoot)}catch(e){}try{wcReset(this);wireTabs(this);wireSegmented(this);wireCombobox(this);wireTree(this);wireMenu(this);wirePagination(this);wireCopy(this);wireRemovable(this)}catch(e){}if(this.shadowRoot&&!this._wiredSlotchange){this._wiredSlotchange=true;this.shadowRoot.addEventListener("slotchange",()=>{try{this.enhance(this.shadowRoot);wireTabs(this);wireSegmented(this);wireCombobox(this);wireTree(this);wireMenu(this);wirePagination(this);wireCopy(this);wireRemovable(this)}catch(e){}})}}attributeChangedCallback(){this.applyMods()}applyMods(){const el=this.shadowRoot.firstElementChild;if(!el||!this._shadowBase)return;const mods=[];for(const attr of MODS){const val=this.getAttribute(attr);if(!val)continue;for(const cls of this._shadowBase.split(/\s+/)){if(cls)mods.push("c-"+cls.replace(/^c-/,"")+"--"+val)}}el.className=(this._shadowBase+" "+mods.join(" ")).trim()}}const shadow=(name,markup)=>{const tpl=document.createElement("template");tpl.innerHTML=markup;const cls=class extends ContourShadow{};cls.contourTemplate=tpl;define(name,cls)};const slotWrapper=(tag,block,part)=>"<"+tag+' class="c-'+block+'" part="'+(part||block)+'"'+(tag==="button"?' type="button"':"")+"><slot></slot></"+tag+">";const SHADOW_SLOTS={div:["accordion","activity","advanced","affordance","affordances","anchor","app","app-body","box","btn-group","chart-grid","catchment","cluster","command","compare","comparison","compass","contour-plot","cta","dash-freshness","dash-kpi-row","dash-shell","dash-toolbar","datamark","delta","draggable","drag-handle","drop-indicator","drop-zone","destructive-hint","docs-shell","drawer","elevation","filter-bar","flow-map","heatmap","hexbin","icon-badge","input-group","instrument","range-scale","resizable","table-wrap","time-range","toast-host","scroll-area","isochrone","landing-features","landing-hero","layer-panel","layer-switch","legend","logos","map-area","map-footer","map-panel","map-slot","measure","metrics","minimap","pager","pagination","panel","plate","price","pricing","progress","prose","pullquote","radio-list","range","readout","recipe","reserved","resize-handle","row","row-action","scale-bar","scrim","segmented","sheet","shortcut-list","shortcut-overlay","shortcut-panel","shortcut-row","showcase","sidebar","skeleton","sparkline","stack","steps","streaming-chart","survey","theme-scope","time-slider","timeline","toast","toolbar","tooltip","tree","version","version-banner"],button:["btn","pressable","scheme-toggle"],span:["avatar","badge","chip","dot","flag","live-badge","mark","pill"],a:["link","linkish"],kbd:["kbd"],label:["check","radio","switch"],select:["select"],nav:["docs-nav"],};const SHADOW_PARTS={"version-banner":"banner","contour-plot":"plot",};for(const[tag,blocks]of Object.entries(SHADOW_SLOTS)){for(const block of blocks){const part=SHADOW_PARTS[block]||block;shadow("contour-shadow-"+block,slotWrapper(tag,block,part))}}shadow("contour-shadow-callout",`<div class="c-callout" part="callout"><div class="c-callout__title" part="title"><slot name="title"></slot></div><div class="c-callout__body" part="body"><slot></slot></div><button class="c-callout__close" part="close" type="button" aria-label="Close">×</button></div>`);shadow("contour-shadow-empty",`<div class="c-empty" part="empty"><div class="c-empty__illustration" part="illustration"><slot name="illustration"></slot></div><div class="c-empty__title" part="title"><slot name="title"></slot></div><div class="c-empty__text" part="body"><slot></slot></div><div><slot name="action"></slot></div></div>`);shadow("contour-shadow-feature",`<div class="c-feature" part="feature"><span class="c-feature__index" part="index"><slot name="index"></slot></span><div class="c-feature__title" part="title"><slot name="title"></slot></div><div class="c-feature__body" part="body"><slot></slot></div></div>`);shadow("contour-shadow-kpi",`<div class="c-kpi" part="kpi"><div class="c-kpi__value" part="value"><slot name="value"></slot></div><div class="c-kpi__label" part="label"><slot name="label"></slot></div><div class="c-kpi__foot" part="foot"><slot name="delta"></slot><slot name="note"></slot></div></div>`);shadow("contour-shadow-stat",`<div class="c-stat" part="stat"><div class="c-stat__value" part="value"><slot name="value"></slot></div><div class="c-stat__label" part="label"><slot name="label"></slot></div><div class="c-stat__delta" part="delta"><slot name="delta"></slot></div></div>`);shadow("contour-shadow-meter",`<div class="c-meter" part="meter"><span class="c-meter__core" part="core"><span class="c-meter__value" part="value"><slot name="value"></slot></span><span class="c-meter__label" part="label"><slot name="label"></slot></span></span></div>`);shadow("contour-shadow-brownout",`<div class="c-brownout" part="brownout" data-level="0"><slot></slot></div>`);shadow("contour-shadow-widget-state",`<div class="c-widget-state" part="widget-state"><slot></slot></div>`);shadow("contour-shadow-donut",`<div class="c-donut" part="donut"><svg class="c-donut__ring" part="ring" viewBox="0 0 32 32"></svg><div class="c-donut__center" part="center"><slot name="value"></slot></div><div class="c-donut__list" part="list"><slot></slot></div></div>`);shadow("contour-shadow-axis",`<div class="c-axis" part="axis"><slot></slot></div>`);shadow("contour-shadow-brush",`<div class="c-brush" part="brush"><div class="c-brush__selection" part="selection"></div></div>`);shadow("contour-shadow-stacked-bar",`<div class="c-stacked-bar" part="bar"><slot></slot></div>`);shadow("contour-shadow-category",`<div class="c-category" part="category" role="listbox"><slot></slot></div>`);shadow("contour-shadow-gauge",`<div class="c-gauge" part="gauge"><svg class="c-gauge__dial" part="dial" aria-hidden="true" viewBox="0 0 100 100"><path class="c-gauge__track" part="track" d="M 10 90 A 40 40 0 0 1 90 90"></path><g class="c-gauge__zones"></g><line class="c-gauge__needle" part="needle" x1="50" y1="50" x2="50" y2="15"></line><circle class="c-gauge__hub" part="hub" cx="50" cy="50" r="4"></circle></svg><div class="c-gauge__value" part="value"><slot name="value"></slot></div><div class="c-gauge__band" part="band"><slot name="band"></slot></div></div>`);shadow("contour-shadow-diff",`<div class="c-diff" part="diff"><div class="c-diff__line c-diff__line--del" part="before"><span class="c-diff__sign">−</span><span><slot name="before"></slot></span></div><div class="c-diff__line c-diff__line--add" part="after"><span class="c-diff__sign">+</span><span><slot name="after"></slot></span></div></div>`);shadow("contour-shadow-do-dont",`<div class="c-do-dont" part="do-dont"><div class="c-do-dont__item c-do-dont__item--do" part="do"><slot name="do"></slot></div><div class="c-do-dont__item c-do-dont__item--dont" part="dont"><slot name="dont"></slot></div></div>`);shadow("contour-shadow-threshold",`<div class="c-threshold" part="threshold"><span class="c-threshold__fill" part="value"></span><span class="c-threshold__target" part="target"></span></div>`);shadow("contour-shadow-coordinate",`<div class="c-coordinate" part="coordinate"><span class="c-coordinate__value" part="value"><slot name="value"></slot></span></div>`);shadow("contour-shadow-install",`<div class="c-install" part="install"><span class="c-install__prompt" part="prompt"><slot name="prompt"></slot></span><span class="c-install__command" part="command"><slot name="command"></slot></span><button class="c-btn c-btn--ghost c-btn--sm c-install__copy" part="copy" type="button" aria-label="Copy command">Copy</button></div>`);shadow("contour-shadow-toc",`<div class="c-toc" part="toc"><div class="c-toc__title" part="title"><slot name="title"></slot></div><nav class="c-toc__list" part="list"><slot></slot></nav></div>`);shadow("contour-shadow-testimonial",`<div class="c-testimonial" part="testimonial"><blockquote class="c-testimonial__quote" part="quote"><slot name="quote"></slot></blockquote><div class="c-testimonial__byline" part="byline"><span class="c-testimonial__name" part="name"><slot name="name"></slot></span><span class="c-testimonial__role" part="role"><slot name="role"></slot></span></div></div>`);shadow("contour-shadow-search-trigger",`<button class="c-search-trigger" part="trigger"><span><slot name="label"></slot></span><kbd class="c-search-trigger__kbd"><slot name="shortcut"></slot></kbd></button>`);shadow("contour-shadow-brand",`<a class="c-brand" part="brand"><span class="c-mark" part="mark"><slot name="mark"></slot></span><span class="c-brand__name" part="name"><slot name="name"></slot></span></a>`);shadow("contour-shadow-section-head",`<div class="c-section-head" part="head"><h2 class="c-section-head__title" part="title"><slot name="title"></slot></h2><p class="c-section-head__desc" part="desc"><slot name="desc"></slot></p></div>`);shadow("contour-shadow-loading",`<div class="c-loading" part="loading"><span class="c-spinner" part="spinner"></span><slot></slot></div>`);shadow("contour-shadow-tabs",`<div class="c-tabs" part="tabs"><div class="c-tabs__list" part="list" role="tablist"><slot name="tabs"></slot></div><div class="c-tabs__panels" role="presentation"><slot></slot></div></div>`);shadow("contour-shadow-breadcrumb",`<nav class="c-breadcrumb" part="breadcrumb" aria-label="Breadcrumb"><ol><slot></slot></ol></nav>`);shadow("contour-shadow-menu",`<div class="c-menu" part="menu" role="menu"><slot></slot></div>`);shadow("contour-shadow-combobox",`<div class="c-combobox" part="combobox"><input class="c-combobox__input" part="input" type="text" /><ul class="c-combobox__list" part="list" hidden><slot></slot></ul></div>`);shadow("contour-shadow-table",`<div class="c-table-wrap" part="wrap"><table class="c-table" part="table"><thead><slot name="head"></slot></thead><tbody><slot></slot></tbody></table></div>`);shadow("contour-shadow-chart",`<div class="c-chart" part="chart"><div class="c-chart__plot" part="plot"><slot></slot></div></div>`);shadow("contour-shadow-bivariate",`<div class="c-bivariate" part="bivariate"><div class="c-bivariate__matrix" part="matrix"><slot></slot></div></div>`);shadow("contour-shadow-bivariate-legend",`<div class="c-bivariate-legend" part="legend"><div class="c-bivariate-legend__matrix" part="matrix"><slot></slot></div></div>`);shadow("contour-shadow-expandable",`<details class="c-expandable" part="expandable"><summary class="c-expandable__summary"><slot name="summary"></slot></summary><div class="c-expandable__body" part="body"><slot></slot></div></details>`);shadow("contour-shadow-disclosure",`<details class="c-disclosure" part="disclosure"><summary><slot name="summary"></slot></summary><div class="c-disclosure__body" part="body"><slot></slot></div></details>`);shadow("contour-shadow-faq",`<div class="c-faq" part="faq"><div class="c-faq__question" part="question"><slot name="question"></slot></div><div class="c-faq__answer" part="answer"><slot name="answer"></slot></div></div>`);shadow("contour-shadow-code-tabs",`<div class="c-code-tabs" part="code-tabs"><div class="c-code-tabs__list" part="list" role="tablist"><slot name="tabs"></slot></div><div class="c-code-tabs__panels"><slot></slot></div></div>`);shadow("contour-shadow-header",`<header class="c-header" part="header"><div class="container c-header__inner" part="inner"><a class="c-brand" part="brand"><slot name="brand"></slot></a><nav class="c-header__nav" part="nav"><slot name="nav"></slot></nav><div class="c-header__actions" part="actions"><slot name="actions"></slot></div></div></header>`);shadow("contour-shadow-footer",`<footer class="c-footer" part="footer"><div class="container c-footer__grid" part="grid"><div class="c-footer__brand" part="brand"><slot name="brand"></slot></div><div class="c-footer__links" part="links"><slot name="links"></slot></div></div></footer>`);shadow("contour-shadow-container",`<div class="container" part="container"><slot></slot></div>`);shadow("contour-shadow-input",`<input class="c-input" part="input" />`);shadow("contour-shadow-spinner",`<span class="c-spinner" part="spinner" aria-label="Loading"></span>`);shadow("contour-shadow-textarea",`<textarea class="c-textarea" part="textarea"></textarea>`);shadow("contour-shadow-code",`<pre class="c-code" part="code"><code><slot></slot></code><button class="c-code__copy" part="copy" type="button">Copy</button></pre>`);shadow("contour-shadow-card",`<div class="c-card" part="card"> <div class="c-card__title" part="head"><slot name="title">Untitled</slot></div> <div class="c-card__body" part="body"><slot></slot></div> <div class="c-card__foot" part="foot"><slot name="foot"></slot></div> </div>`);shadow("contour-shadow-field",`<div class="c-field" part="field"> <label class="c-field__label" part="label"><slot name="label">Label</slot></label> <slot name="input"></slot> <span class="c-field__hint" part="hint"><slot name="hint"></slot></span> </div>`);shadow("contour-shadow-alert",`<div class="c-alert" part="alert"> <div class="c-alert__title" part="title"><slot name="title"></slot></div> <div class="c-alert__body" part="body"><slot></slot></div> <div class="c-alert__actions" part="actions"><slot name="action"></slot></div> <button class="c-alert__close" part="close" type="button" aria-label="Close">×</button> </div>`);shadow("contour-shadow-tag",`<span class="c-tag" part="tag"><slot></slot><button class="c-tag__remove" part="remove" type="button" aria-label="Remove">×</button></span>`);shadow("contour-shadow-filter-pill",`<span class="c-filter-pill" part="filter-pill"><slot></slot><button class="c-filter-pill__remove" part="remove" type="button" aria-label="Remove filter">×</button></span>`);class ContourShadowDialog extends ContourShadow{static contourTemplate=(()=>{const tpl=document.createElement("template");tpl.innerHTML="<dialog class=\"c-dialog\" part=\"dialog\"> <div class=\"c-dialog__head\" part=\"head\"> <slot name=\"title\"></slot> <button class=\"c-btn c-btn--icon c-btn--ghost\" part=\"close\" type=\"button\" aria-label=\"Close\"> <svg aria-hidden=\"true\"><use href=\"#i-close\" /></svg> </button> </div> <div class=\"c-dialog__body\" part=\"body\"><slot></slot></div> <div class=\"c-dialog__foot\" part=\"foot\"><slot name=\"foot\"></slot></div> </dialog>";return tpl})();enhance(root){super.enhance(root);if(this._wiredShadowDialog)return;this._wiredShadowDialog=true;const dlg=root.querySelector("dialog");const close=root.querySelector('[part="close"]');if(close)close.addEventListener("click",()=>dlg?.close());if(dlg){let lastFocus=null;dlg.addEventListener("beforetoggle",(e)=>{if(e.newState==="open"){lastFocus=document.activeElement;this.dispatchEvent(new CustomEvent("contour:open",{bubbles:true,composed:true}));const focusable=dlg.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(focusable)try{focusable.focus()}catch(e){}}else if(e.newState==="closed"){this.dispatchEvent(new CustomEvent("contour:close",{bubbles:true,composed:true}));if(lastFocus&&typeof lastFocus.focus==="function"){try{lastFocus.focus()}catch(e){}}}});dlg.addEventListener("keydown",(e)=>{if(e.key!=="Tab")return;const focusables=Array.from(dlg.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])"));if(!focusables.length)return;const first=focusables[0];const last=focusables[focusables.length-1];if(e.shiftKey&&document.activeElement===first){e.preventDefault();last.focus()}else if(!e.shiftKey&&document.activeElement===last){e.preventDefault();first.focus()}})}}show(){this.shadowRoot?.querySelector("dialog")?.showModal()}close(){this.shadowRoot?.querySelector("dialog")?.close()}}define("contour-shadow-dialog",ContourShadowDialog);window.ContourElements=Object.freeze(REGISTERED.slice());window.ContourEvents=Object.freeze(CONTOUR_EVENTS);