contour-ds 1.9.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/build-manifest.json +89 -89
  2. package/dist/contour-wc-core.esm.js +1 -1
  3. package/dist/contour-wc-core.esm.min.js +1 -1
  4. package/dist/contour-wc-dashboard.esm.js +1 -1
  5. package/dist/contour-wc-dashboard.esm.min.js +1 -1
  6. package/dist/contour-wc-data.esm.js +1 -1
  7. package/dist/contour-wc-data.esm.min.js +1 -1
  8. package/dist/contour-wc.esm.js +2 -2
  9. package/dist/contour-wc.esm.min.js +1 -1
  10. package/dist/contour-wc.js +2 -2
  11. package/dist/contour-wc.min.js +1 -1
  12. package/dist/contour.components.json +370 -28
  13. package/dist/contour.css +363 -352
  14. package/dist/contour.min.css +1 -1
  15. package/dist/contour.single.html +1 -1
  16. package/dist/contour.single.min.css +1 -1
  17. package/dist/docs/actions.md +1 -1
  18. package/dist/docs/affordances.md +1 -1
  19. package/dist/docs/apireference.md +1 -1
  20. package/dist/docs/colour.md +1 -1
  21. package/dist/docs/componentindex.md +1 -1
  22. package/dist/docs/data.md +1 -1
  23. package/dist/docs/docs.md +1 -1
  24. package/dist/docs/feedback.md +1 -1
  25. package/dist/docs/field.md +1 -1
  26. package/dist/docs/forms.md +1 -1
  27. package/dist/docs/index.json +3 -3
  28. package/dist/docs/install.md +1 -1
  29. package/dist/docs/landing.md +1 -1
  30. package/dist/docs/mapengine.md +1 -1
  31. package/dist/docs/motion.md +1 -1
  32. package/dist/docs/navigation.md +1 -1
  33. package/dist/docs/overlays.md +1 -1
  34. package/dist/docs/overview.md +1 -1
  35. package/dist/docs/patterns.md +1 -1
  36. package/dist/docs/playground.md +1 -1
  37. package/dist/docs/principles.md +1 -1
  38. package/dist/docs/recipes.md +1 -1
  39. package/dist/docs/space.md +1 -1
  40. package/dist/docs/status.md +1 -1
  41. package/dist/docs/surfaces.md +1 -1
  42. package/dist/docs/theming.md +5 -2
  43. package/dist/docs/type.md +1 -1
  44. package/dist/docs/webcomponents.md +1 -1
  45. package/dist/hljs.css +17 -17
  46. package/dist/registry/items/contour-core.json +2 -2
  47. package/dist/registry/items/contour-data.json +2 -2
  48. package/dist/registry/items/contour-docs.json +2 -2
  49. package/dist/registry/items/contour-landing.json +2 -2
  50. package/dist/registry/registry.json +8 -8
  51. package/dist/surfaces/contour-core.min.css +1 -1
  52. package/dist/surfaces/contour-data.min.css +1 -1
  53. package/dist/surfaces/contour-docs.min.css +1 -1
  54. package/dist/surfaces/contour-landing.min.css +1 -1
  55. package/dist/wc/data-chart.mjs +1 -1
  56. package/dist/wc/index.mjs +1 -1
  57. package/package.json +5 -2
@@ -1 +1 @@
1
- !function(){"use strict";var t="1.9.0";const e=[],s=t=>{if("function"!=typeof getComputedStyle)return!1;const e=getComputedStyle(t);return("auto"===e.overflowY||"scroll"===e.overflowY||"auto"===e.overflowX||"scroll"===e.overflowX)&&(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)},r=new WeakMap,i=(t,e)=>{let s=r.get(t);s||(s=[],r.set(t,s)),s.push(e)};function a(){try{if("undefined"!=typeof window&&(window.ContourDebug||window.__CONTOUR_DEBUG__))return!0}catch(t){}try{if("undefined"!=typeof process&&process.env&&"production"!==process.env.NODE_ENV&&process.env.CONTOUR_DEBUG)return!0}catch(t){}return!1}let n=0;const o=t=>t+"-"+(++n).toString(36),c=(t,s)=>{"undefined"!=typeof customElements&&customElements&&"function"==typeof customElements.define&&(customElements.get(t)||"undefined"!=typeof window&&"function"==typeof window.__contourDefineDefer&&window.__contourDefineDefer(t,s)||(customElements.define(t,s),e.push(t),"undefined"!=typeof window&&(window.ContourElements=Object.freeze(e.slice()))))},l=["variant","size","color"],u=Symbol("JSON"),d=Object.freeze({"contour:activate":{payload:["files","label","row","value"],composed:!0},"contour:add":{payload:["value"],composed:!0},"contour:activity-clear":{payload:[],composed:!0},"contour:activity-filter":{payload:["unread"],composed:!0},"contour:activity-select":{payload:["index","text"],composed:!0},"contour:rendered":{payload:["renderCount"],composed:!0},"contour:cap":{payload:["series","total","shown"],composed:!0},"contour:action":{payload:["label"],composed:!0},"contour:break-change":{payload:["layer","value"],composed:!0},"contour:style-resolved":{payload:["applied","classification","colors","items","layer","n","palette","property","value"],composed:!0},"contour:advanced-toggle":{payload:["title"],composed:!0},"contour:affordance-activate":{payload:["name"],composed:!0},"contour:aggregate":{payload:["aggregate"],composed:!0},"contour:bearing":{payload:["direction","degrees"],composed:!0},"contour:btn-group-change":{payload:["index","label"],composed:!0},"contour:brush-start":{payload:["end","range","start","value"],composed:!0},"contour:brush-end":{payload:["end","range","start","value"],composed:!0},"contour:brush":{payload:["end","range","start","value"],composed:!0},"contour:change":{payload:["checked","color","direction","end","files","high","index","low","month","name","paused","query","speed","start","unit","value","values","year"],composed:!0},"contour:collapse":{payload:["collapsed"],composed:!0},"contour:cluster-toggle":{payload:["count","expanded"],composed:!0},"contour:clear":{payload:[],composed:!0},"contour:clear-all":{payload:[],composed:!0},"contour:close":{payload:["count","index","label","message","open","value"],composed:!0},"contour:copy":{payload:["text"],composed:!0},"contour:apply":{payload:["name"],composed:!0},"contour:dash-action":{payload:["label"],composed:!0},"contour:diff-activate":{payload:["kind","text"],composed:!0},"contour:dismiss":{payload:["label"],composed:!0},"contour:draw-start":{payload:["mode"],composed:!0},"contour:drag":{payload:["delta","key","value"],composed:!0},"contour:do-dont-activate":{payload:["kind","text"],composed:!0},"contour:docs-nav-select":{payload:["label","href"],composed:!0},"contour:dragend":{payload:["value"],composed:!0},"contour:dragstart":{payload:["value"],composed:!0},"contour:drop":{payload:["value","label"],composed:!0},"contour:empty-action":{payload:["state"],composed:!0},"contour:filter":{payload:["query"],composed:!0},"contour:filter-change":{payload:["source","filter"],composed:!0},"contour:error":{payload:["src","message","name","status"],composed:!0},"contour:export":{payload:["format"],composed:!0},"contour:refresh":{payload:[],composed:!0},"contour:hide":{payload:[],composed:!0,deprecated:"use contour:close instead"},"contour:hover":{payload:["row"],composed:!0},"contour:input":{payload:["name","value","checked"],composed:!0},"contour:invalid":{payload:["field","input","message"],composed:!0,cancelable:!0},"contour:inspect-action":{payload:["label","value"],composed:!0},"contour:layer-opacity":{payload:["layerId","name","opacity"],composed:!0},"contour:layer-rename":{payload:["layerId","name","newName"],composed:!0},"contour:layer-duplicate":{payload:["layerId","name"],composed:!0},"contour:layer-zoom":{payload:["layerId","name"],composed:!0},"contour:zoom":{payload:["data","index","row"],composed:!0},"contour:layer-projection":{payload:["layerId","name","projection"],composed:!0},"contour:layer-remove":{payload:["layerId","name"],composed:!0},"contour:layer-reorder":{payload:["layerIds"],composed:!0},"contour:layer-toggle":{payload:["layerId","name","visible"],composed:!0},"contour:layer-visibility":{payload:["layerId","name","visible"],composed:!0},"contour:legend-toggle":{payload:["index","key","label","pressed"],composed:!0},"contour:leave":{payload:[],composed:!0},"contour:load":{payload:["src","count"],composed:!0},"contour:map-control":{payload:["control"],composed:!0},"contour:map-style":{payload:["style","name"],composed:!0},"contour:map-attach":{payload:[],composed:!0},"contour:map-ready":{payload:[],composed:!0},"contour:map-detach":{payload:[],composed:!0},"contour:map-popup-reposition":{payload:["anchor","flippedX","flippedY","left","top"],composed:!0},"contour:map-viewport":{payload:["crossesAntimeridian","west","south","east","north","zoom","center"],composed:!0},"contour:mode-change":{payload:["mode"],composed:!0},"contour:scope-change":{payload:["scope"],composed:!0},"contour:move":{payload:["direction","from","to","dx","dy"],composed:!0},"contour:open":{payload:[],composed:!0},"contour:page":{payload:["page"],composed:!0},"contour:ready":{payload:["version","count"],composed:!0},"contour:read":{payload:["label"],composed:!0},"contour:remove":{payload:["key","label","name","value"],composed:!0},"contour:reorder":{payload:["from","to"],composed:!0},"contour:range-change":{payload:["value"],composed:!0},"contour:resize":{payload:["column","delta","height","value","width"],composed:!0},"contour:retry":{payload:["src"],composed:!0},"contour:loop-change":{payload:["loop"],composed:!0},"contour:pause":{payload:[],composed:!0},"contour:play":{payload:[],composed:!0},"contour:seek":{payload:["progress","value"],composed:!0},"contour:select":{payload:["area","col","expanded","href","index","key","label","labels","level","path","range","result","row","rows","series","value"],composed:!0},"contour:search":{payload:["query"],composed:!0},"contour:spatial-filter":{payload:["action","mode","operator"],composed:!0},"contour:split-change":{payload:["value","width","height"],composed:!0},"contour:speed-change":{payload:["speed"],composed:!0},"contour:showcase-activate":{payload:["title"],composed:!0},"contour:step-activate":{payload:["index","title"],composed:!0},"contour:step-change":{payload:["direction","index","title"],composed:!0},"contour:show":{payload:[],composed:!0,deprecated:"use contour:open instead"},"contour:sort":{payload:["column","direction"],composed:!0},"contour:column-toggle":{payload:["column","visible"],composed:!0},"contour:submit":{payload:["submitting"],composed:!0},"contour:stream-state":{payload:["running"],composed:!0},"contour:tab-change":{payload:["index","label"],composed:!0},"contour:theme-change":{payload:["theme"],composed:!0},"contour:tick":{payload:["frame"],composed:!0},"contour:time-change":{payload:["progress","value"],composed:!0},"contour:time-range-change":{payload:["value"],composed:!0},"contour:toggle":{payload:["collapsed","expanded","label","open","path","playing"],composed:!0},"contour:view-enter":{payload:[],composed:!0},"contour:view-leave":{payload:[],composed:!0}}),h=new Set(["script","iframe","object","embed","style","link","meta","base","form","input","button"]),m=new Set(["animate","animatemotion","animatetransform","set","discard"]),b=new Set(["href","src","xlink:href","from","to","values","by","attributename"]);function p(t){const e=function(t){let e=String(null==t?"":t);e=e.replace(/[\t\n\r]/g,""),e=e.replace(/^[\u0000-\u0020]+/,"").replace(/[\u0000-\u0020]+$/,"");try{e=decodeURIComponent(e)}catch(t){}return e.toLowerCase()}(t),s=e.replace(/[\u0000-\u001f\u007f]/g,"");return s.startsWith("javascript:")||s.startsWith("vbscript:")||s.startsWith("data:text/html")||s.startsWith("data:image/svg+xml")}function g(t){const e=String(null==t?"":t);if("undefined"==typeof DOMParser)return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");const s=(new DOMParser).parseFromString(e,"text/html"),r=t=>{const e=Array.from(t.childNodes);for(const t of e){if(1!==t.nodeType)continue;const e=t.tagName.toLowerCase();if(h.has(e))t.remove();else{if(m.has(e)){const e=Array.from(t.attributes).map(t=>t.name.toLowerCase()),s=String(t.getAttribute("attributename")||"").toLowerCase();if(e.some(t=>b.has(t))||b.has(s)){t.remove();continue}}for(const e of Array.from(t.attributes)){const s=e.name.toLowerCase();s.startsWith("on")?t.removeAttribute(e.name):"style"!==s&&"srcdoc"!==s?b.has(s)&&p(e.value)&&t.removeAttribute(e.name):t.removeAttribute(e.name)}r("template"!==e?t:t.content||t)}}};return r(s.body),s.body.innerHTML}function _(t){const e=String(null==t?"":t).trim();if(!e)return"";if(/[;{}<>"'`\\]/.test(e))return"";if(/url\s*\(/i.test(e)||/expression\s*\(/i.test(e))return"";if(/^#[0-9a-f]{3,8}$/i.test(e))return e;if(/^(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\(/i.test(e))return e;if(/^(var|light-dark|color-mix)\(/i.test(e)){let t=0;for(let s=0;s<e.length;s++){const r=e[s];if("("===r)t++;else if(")"===r&&(t--,t<0))return""}return 0===t?e:""}return/^[a-z]+$/i.test(e)?e:""}function v(t){const e=String(null==t?"":t).trim();if(!e)return"#";if(e.startsWith("#")||e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("?"))return e;if("undefined"==typeof document||!document.baseURI)return"#";try{const t=new URL(e,document.baseURI);return["http:","https:","mailto:","tel:"].includes(t.protocol)?e:"#"}catch(t){return"#"}}function y(t,e){if("undefined"==typeof getComputedStyle||"undefined"==typeof document)return e;const s=parseFloat(getComputedStyle(document.documentElement).getPropertyValue(t));return Number.isFinite(s)&&s>0?s:e}function f(t,e,s){if("undefined"==typeof console||!console.warn)return;const r=t&&t.tagName?t.tagName.toLowerCase():"component",i=s&&s.message||String(s);console.warn(`[contour] ${r}: malformed ${e||"attribute"} — ${i}`)}const A=["accept","action","actions","active","after","allow-duplicate","allow-remove","allow-rename","allow-zoom","alpha","anchor","answer","area","article","attribution","attribution-mark","audit","autoplay","axis","axis-x","axis-y","brownout","brownout-level","before","body","brand","bounds","breakpoint","breaks","brush","brush-end","brush-max","brush-min","brush-start","cache-key","canvas","center","clearable","cols","columns","color","command","cells","checked","chrome","confidence","coverage","debounce","closable","collapsed","collapsible","classification","continuous","content","controls","copyable","count","data","data-table","date","delta","description","glyphs","graduated","demo","density","desc","dir","direction","disabled","distance","dismissible","divider","do","dont","dot","ends","high","input","layer","low","mode","modes","n","opacity","palette","polarity","precision","range","single","empty","exclusive","fallback","filename","format","heading","help","hint","href","icon","illustration","instrument","interval","items","key","layers","level","markers","label","labels","latitude","lazy","lede","legend","left-label","right-label","line","limit","link","links","live","loading","locale","loop","max","media","message","method","methodology","menu","min","multiple","name","needle","next","no","no-cache","no-data-message","nodes","note","norm","options","orientation","page-size","pages","pause","paused","pausable","persist","placeholder","playing","point","points","prev","presets","prompt","question","recent","required","quote","ramp","refresh","removable","resolution","reverse","rings","retry","results","rows","scale","selectable","segments","show-header","sparkline","threshold","thresholds","selected","separator","series","shortcut","side","size","skeleton","sort","sort-dir","status","step","submit","submitting","timeout","trigger","virtual","sticky","cluster-count","cluster-expanded","time","resizable","state","steps","style","subtitle","summary","src","source","table","tabs","tag","text","ticks","title","type","unread-only","unit","updated","row-height","variant","values","viewport","warning","yes","zoom","zoomable","caption","current-time","is-playing","loop-label","no-data-color","no-data-label","property","show-loop","show-thumb","show-thumb-caption","speeds","item-height","pause-label","play-label","speed-label","time-label","shimmer","search","numbered","bucket-count","limit-values","autocomplete","levels","submit-label","fields","gap","flush","head","preview","tags","url","custom-error"];function E(t,e="h3"){const s=t&&t.getAttribute?t.getAttribute("heading"):null;return/^h[1-6]$/.test(s||"")?s:e}function w(t,e){if(!t||!t.getAttribute)return!1;const s=t.getAttribute(e);if(null===s)return!1;const r=s.trim().toLowerCase();return"0"!==r&&"false"!==r&&"no"!==r&&"off"!==r&&"null"!==r&&"undefined"!==r}function x(t){if(null==t||!1===t)return!1;if("string"==typeof t){const e=t.trim().toLowerCase();return"0"!==e&&"false"!==e&&"no"!==e&&"off"!==e&&"null"!==e&&"undefined"!==e}return Boolean(t)}function C(t){switch(String(t||"").toLowerCase()){case"success":return"i-check-circle";case"warning":return"i-alert";case"danger":case"error":return"i-x";case"info":case"note":case"tip":case"accent":return"i-info";default:return""}}function S(t,e,s){if(!t||!t.dispatchEvent)return;const r="contour:open"===e;if(!r&&!("contour:close"===e))return void t.dispatchEvent(new CustomEvent(e,{detail:s,bubbles:!0,composed:!0}));t.dispatchEvent(new CustomEvent(e,{detail:s,bubbles:!0,composed:!0}));const i=r?"contour:show":"contour:hide";console.warn(`[Contour] ${i} is deprecated, use ${e} instead. Will be removed in v2.0. (host: ${t.tagName||t.constructor.name})`),t.dispatchEvent(new CustomEvent(i,{detail:s,bubbles:!0,composed:!0}))}function k(t,e,s){const r=void 0!==s?s:e,i=t&&t.getAttribute?t.getAttribute("labels"):null;if(!i)return r;try{const t=JSON.parse(i);if(t&&"object"==typeof t&&"string"==typeof t[e]&&t[e])return t[e]}catch(t){}return r}let N=null;function L(t,e){if(!t)return;const s=null==e||""===e;if(s||"undefined"==typeof window||!window.trustedTypes||"function"!=typeof window.trustedTypes.createPolicy)t.innerHTML=s?"":e;else{if(!N)try{N=window.trustedTypes.createPolicy("contour-html",{createHTML:t=>t})}catch(t){N=null}t.innerHTML=N?N.createHTML(e):e}}function q(t,e,s,r){t&&(t.dataset&&"true"===t.dataset.contourLabel?t.textContent=k(e,s,r):t.textContent||(t.textContent=k(e,s,r),t.dataset&&(t.dataset.contourLabel="true")))}const D="undefined"!=typeof HTMLElement?HTMLElement:Object,M=new WeakSet;class T extends D{static formAssociated=!1;constructor(){super(),this.constructor.formAssociated&&"function"==typeof this.attachInternals&&(this._internals=this.attachInternals())}static get observed(){return A}static get observedAttributes(){const t=this.observed;return t.includes("labels")?t:[...t,"labels"]}static get properties(){return{}}static get updateMode(){return"scaffold"}brownoutLevel(){const t=this.getAttribute("brownout-level")||this.getAttribute("brownout")||"0",e=parseInt(t,10);return Number.isFinite(e)?e:0}shed(t,e){return this.brownoutLevel()>=(e||1)}get renderCount(){return this._contourRenderCount||0}get updateComplete(){return this._renderTicket||Promise.resolve(this)}_announceRendered(){const t=this.renderCount;this._renderTicket=new Promise(e=>{queueMicrotask(()=>{this._renderTicket=null,e(this),this.isConnected&&this.dispatchEvent(new CustomEvent("contour:rendered",{bubbles:!0,composed:!0,detail:{renderCount:t}}))})})}_countRender(){this._contourRenderCount=(this._contourRenderCount||0)+1}_installProperties(){const t=this.constructor;if(M.has(t))return;M.add(t);const e=t.properties||{},s=new Set,r=t=>"object"==typeof t&&null!==t?JSON.stringify(t):String(t),i=t=>{if(null===t)return null;const e=t.trim();if(e.startsWith("[")||e.startsWith("{"))try{return JSON.parse(e)}catch{}return t};for(const[a,n]of Object.entries(e)){const e=n&&n.attribute||a;s.add(e);const o=n&&n.type||String;Object.defineProperty(t.prototype,a,{get(){const t=this.getAttribute(e);if(o===Boolean)return x(t);if(null===t)return n&&void 0!==n.default?n.default:null;if(o===Number){const e=Number(t);return Number.isNaN(e)?null:e}return o===u?i(t):t},set(t){null==t||!1===t?this.removeAttribute(e):o===Boolean?x(t)?this.setAttribute(e,""):this.removeAttribute(e):this.setAttribute(e,r(t))},configurable:!0})}const a=t.observedAttributes;for(const e of a){if(s.has(e))continue;const a=e.replace(/-([a-z])/g,(t,e)=>e.toUpperCase());if(!/^[a-zA-Z_$][\w$]*$/.test(a))continue;if(a in t.prototype)continue;const n="disabled"===e||"checked"===e||"required"===e||"readonly"===e||"multiple"===e||"selected"===e||"open"===e||"hidden"===e;Object.defineProperty(t.prototype,a,{get(){const t=this.getAttribute(e);return n?x(t):i(t)},set(t){null==t||!1===t?this.removeAttribute(e):n?x(t)?this.setAttribute(e,""):this.removeAttribute(e):this.setAttribute(e,r(t))},configurable:!0})}}connectedCallback(){if(this._contourAuthored){this._wireFormData();for(const t of Object.keys(this))t.startsWith("_wired")&&"_wiredFormData"!==t&&"_wiredValueTracking"!==t&&(this[t]=!1);return void this.attributeChangedCallback("__contour_reconnect__",null,"")}this._installProperties(),this._contourAuthored={nodes:Array.from(this.childNodes)},this._contourOwnedClasses=new Set;for(const t of this._contourAuthored.nodes)1===t.nodeType&&t.setAttribute("data-contour-authored","");const t=Array.from(this.childNodes);this._contourRenderGen=(this._contourRenderGen||0)+1,this._ensureCache=new Map,this._ensureCacheGen=this._contourRenderGen,this._countRender();const e=new Set(Array.from(this.classList));try{this.render()}catch(t){console.error("Contour render error:",t),this.textContent=k(this,"render-error","Component failed to render.")}this._contourGenerated=Array.from(this.childNodes).filter(e=>!t.includes(e)),this._contourOwnedClasses=new Set(Array.from(this.classList).filter(t=>!e.has(t))),this._applyDensity(),this._runEnhance(),this._detachInnerFormControls(),this._wireFormData(),this._wireValueTracking(),this._announceRendered()}attributeChangedCallback(t,e,r){if(e!==r&&this.isConnected&&this._contourAuthored)if(this._batchDepth>0)this._batchDirty=!0;else if(this._contourRendering)this._pendingRerender||(this._pendingRerender=!0,queueMicrotask(()=>{this._pendingRerender=!1,this.isConnected&&this._contourAuthored&&this.attributeChangedCallback("__rerender__",null,"")}));else{"checked"===t&&(this._checkedAttrChanged=!0),this._contourRendering=!0;try{const t=Array.from(this.querySelectorAll("input, textarea, select")).map(t=>({key:t.name||t.id||null,preserveKey:t.getAttribute("data-contour-preserve-key")||null,value:t.value,checked:t.checked,type:t.type,dirty:!!t._contourUserDirty,attrAtDirty:t._contourAttrAtDirty,selected:"SELECT"===t.tagName&&t.multiple?Array.from(t.selectedOptions).map(t=>t.value):null})),e=this.contains(document.activeElement)?document.activeElement:null,r="button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])",i=Array.from(this.querySelectorAll(r)),a=e?i.indexOf(e):-1,n=e&&e.id||null,o=e&&e.getAttribute("data-contour-preserve-key")||null,c=e&&e.getAttribute("name")||null,l=Array.from(this.querySelectorAll("*")).filter(s).map(t=>({el:t,id:t.id||null,preserveKey:t.getAttribute("data-contour-preserve-key")||null,top:t.scrollTop,left:t.scrollLeft})),u=Array.from(this.querySelectorAll("details")).map(t=>({id:t.id||null,preserveKey:t.getAttribute("data-contour-preserve-key")||null,open:t.open}));for(const t of this._contourGenerated||[]){if(!t||t.parentNode!==this)continue;let e=null;if(t.classList&&(t.classList.contains("c-panel__body")||t.classList.contains("c-dialog__body")||t.classList.contains("c-popover__body")||t.classList.contains("c-map-popup__body")||t.classList.contains("c-hover-card__body")||t.classList.contains("c-drawer__body")||t.classList.contains("c-sheet__body")||t.classList.contains("c-alert__body"))?e=t:"PRE"===t.tagName&&(e=t.querySelector("code")||t),e)for(;e.firstChild;)this.insertBefore(e.firstChild,t)}const d=this._contourPersistent,h=t=>!!(d&&d.size&&d.has(t)),m=new Set(this._contourAuthored.nodes||[]);for(const t of this._contourGenerated||[])if(!h(t)){for(const e of Array.from(t.childNodes))m.has(e)&&t.parentNode.insertBefore(e,t);t.parentNode===this&&this.removeChild(t)}const b=new Set(this._contourGenerated||[]),p=Array.from(this.childNodes).filter(t=>!b.has(t)&&!h(t));for(const t of this._contourGenerated||[]){if(h(t))continue;const e=t.querySelectorAll?t.querySelectorAll("[data-contour-authored]"):[];for(const t of e)p.includes(t)||p.push(t)}this._contourAuthored.nodes=p;const g=Array.from(this.childNodes).filter(h);for(const t of g)this.appendChild(t);for(;this.firstChild&&!h(this.firstChild);)this.removeChild(this.firstChild);for(const t of this._contourAuthored.nodes)this.insertBefore(t,this.firstChild&&h(this.firstChild)?this.firstChild:null);for(const t of g)this.appendChild(t);for(const t of this._contourOwnedClasses)this.classList.remove(t);const _=new Set(Array.from(this.classList)),v=Array.from(this.childNodes);this._contourRenderGen=(this._contourRenderGen||0)+1,this._ensureCache=new Map,this._ensureCacheGen=this._contourRenderGen,this._countRender();try{this.render()}catch(t){console.error("Contour render error:",t),this.textContent=k(this,"render-error","Component failed to render.")}this._contourGenerated=Array.from(this.childNodes).filter(t=>!v.includes(t)),this._contourOwnedClasses=new Set(Array.from(this.classList).filter(t=>!_.has(t))),this._applyDensity();const y=Array.from(this.querySelectorAll("input, textarea, select")),f=t.filter(t=>t.key||t.preserveKey),A=t.filter(t=>!t.key&&!t.preserveKey),E=new Set;for(const t of y){const e=t.name||t.id||t.getAttribute("data-contour-preserve-key")||null;if(!e)continue;const s=f.find(t=>(t.key===e||t.preserveKey===e)&&!E.has(t));s&&(E.add(s),this._contourResetting||this._restoreControlValue(t,s),"checkbox"!==t.type&&"radio"!==t.type||"boolean"!=typeof s.checked||this._checkedAttrChanged||this._contourResetting||(t.checked=s.checked))}const w=new Map;for(const t of A){const e=w.get(t.type)||[];e.push(t),w.set(t.type,e)}const x=new Map;for(const t of y){if(t.name||t.id)continue;const e=t.type,s=w.get(e)||[],r=x.get(e)||0;if(r>=s.length)continue;const i=s[r];x.set(e,r+1),this._contourResetting||this._restoreControlValue(t,i),"checkbox"!==t.type&&"radio"!==t.type||"boolean"!=typeof i.checked||this._checkedAttrChanged||this._contourResetting||(t.checked=i.checked)}const C=Array.from(this.querySelectorAll("details")),S=u.filter(t=>t.id||t.preserveKey),N=new Set;for(const t of C){const e=t.id||null,s=t.getAttribute("data-contour-preserve-key")||null;if(!e&&!s)continue;const r=S.find(t=>(t.id===e||t.preserveKey===s)&&!N.has(t.id||t.preserveKey));r&&(N.add(r.id||r.preserveKey),t.open=r.open)}let L=0;const q=u.filter(t=>!t.id);for(const t of C){if(t.id)continue;const e=q[L];if(L+=1,!e)break;t.open=e.open}const D=Array.from(this.querySelectorAll("*")).filter(s),M=l.filter(t=>t.id||t.preserveKey),T=new Set;for(const t of D){const e=t.id||null,s=t.getAttribute("data-contour-preserve-key")||null;if(!e&&!s)continue;const r=M.find(t=>(t.id===e||t.preserveKey===s)&&!T.has(t.el));r&&(T.add(r.el),t.scrollTop=r.top,t.scrollLeft=r.left)}let F=0;const R=l.filter(t=>!t.id&&!t.preserveKey);for(const t of D){if(t.id)continue;const e=R[F];if(F+=1,!e)break;t.scrollTop=e.top,t.scrollLeft=e.left}for(const t of l)t.el&&t.el.isConnected&&d&&d.has(t.el)&&(t.el.scrollTop===t.top&&t.el.scrollLeft===t.left||(t.el.scrollTop=t.top,t.el.scrollLeft=t.left));if(e){let t=null;if(n)try{t=this.querySelector("#"+CSS.escape(n))}catch(e){t=null}if(!t&&o)try{t=this.querySelector('[data-contour-preserve-key="'+CSS.escape(o)+'"]')}catch(e){t=null}if(!t&&c)try{t=this.querySelector('[name="'+CSS.escape(c)+'"]')}catch(e){t=null}if(!t&&a>=0){const e=Array.from(this.querySelectorAll(r));e.length&&(t=e[Math.min(a,e.length-1)])}if(t&&"function"==typeof t.focus)try{t.focus()}catch(t){}else if(document.contains(e))try{e.focus()}catch(t){}else{const t=this.querySelector(r);if(t)try{t.focus()}catch(t){}else try{this.focus()}catch(t){}}}this._runEnhance(),this._detachInnerFormControls(),this._checkedAttrChanged=!1,this._contourResetting=!1}finally{this._contourRendering=!1}this._announceRendered()}}disconnectedCallback(){this._pendingRerender=!1,this._ensureCache=null,this._batchDepth=0,this._batchDirty=!1,this._wiredFormData=!1,this._remoteStatus=null,this._remoteSrc=null,(t=>{const e=r.get(t);if(e){r.delete(t);for(const s of e)try{s()}catch(e){if(a())try{console.warn("Contour disposer failed for",t&&t.tagName,e)}catch(t){}}}})(this);const t=this._contourHostListeners;if(t){for(const{type:e,listener:s,options:r}of t)try{this.removeEventListener(e,s,r)}catch(t){}this._contourHostListeners=null}}adoptedCallback(){this._contourAuthored&&this._applyDensity()}enhance(){}addEventListener(t,e,s){if(this._contourHostWiring&&e&&!e._contourBehaviour){let r=this._contourHostListeners;r||(r=[],this._contourHostListeners=r),r.push({type:t,listener:e,options:s})}return super.addEventListener(t,e,s)}_runEnhance(){this._contourHostWiring=!0;try{this.enhance()}finally{this._contourHostWiring=!1}}_syncFormValue(){if(!this._internals)return;const t=this.querySelector("input:checked, textarea, select")||this.querySelector("input, textarea, select");if(!t)return;const e="checkbox"===t.type||"radio"===t.type?t.checked?t.value||"on":null:t.value;this._internals.setFormValue(e),this._syncValidity(this.hasAttribute("required")&&!e)}_syncValidity(t){if(!this._internals)return;const e=t?{valueMissing:!0}:{};let s=t?"This field is required.":"";const r=this.querySelector("input, textarea, select"),i=r&&r.validity;i&&(i.valueMissing&&(e.valueMissing=!0,s=s||"This field is required."),i.typeMismatch&&(e.typeMismatch=!0,s=s||"Please enter a valid value."),i.patternMismatch&&(e.patternMismatch=!0,s=s||"Please match the requested format."),i.rangeUnderflow&&(e.rangeUnderflow=!0,s=s||"Value is too low."),i.rangeOverflow&&(e.rangeOverflow=!0,s=s||"Value is too high."),i.tooLong&&(e.tooLong=!0,s=s||"Value is too long."),i.tooShort&&(e.tooShort=!0,s=s||"Value is too short."),i.badInput&&(e.badInput=!0,s=s||"Invalid input.")),this._internals.setValidity(e,s),this._setCustomState("data-invalid",Object.keys(e).length>0)}_setCustomState(t,e){let s=this._internals;if(!s)if(this._stateInternals)s=this._stateInternals;else if("function"==typeof this.attachInternals)try{s=this._stateInternals=this.attachInternals()}catch(t){return}const r=s&&s.states;r&&(e?r.has(t)||r.add(t):r.has(t)&&r.delete(t))}_emitForm(t){if(!this._internals)return;const e=this.querySelector("input:checked, textarea, select")||this.querySelector("input, textarea, select");if(!e)return;const s="checkbox"===e.type||"radio"===e.type;this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:{name:this.getAttribute("name"),value:s?e.checked?e.value||"on":null:e.value,checked:s?e.checked:null}}))}formResetCallback(){for(const t of this.querySelectorAll("input, textarea, select"))if(t._contourUserDirty=!1,"checkbox"===t.type||"radio"===t.type)t.checked=this.hasAttribute("checked");else if("SELECT"===t.tagName){const e=t.querySelector("option[selected], option:first-of-type");t.value=e?e.value:""}else t.value=this.hasAttribute("value")?this.getAttribute("value"):t.getAttribute("value")||"";this._syncFormValue()}formDisabledCallback(t){for(const e of this.querySelectorAll("input, textarea, select, button"))t?e.setAttribute("disabled",""):e.removeAttribute("disabled")}formStateRestoreCallback(t){if(!this._internals||null==t)return;const e=Array.from(this.querySelectorAll("input, textarea, select")),s=String(t),r=e.find(t=>("checkbox"===t.type||"radio"===t.type)&&t.value===s);if(r){r.checked=!0;for(const t of e)t!==r&&"radio"===t.type&&t.name===r.name&&(t.checked=!1)}else e.length&&(e[0].value=s);this._syncFormValue()}checkValidity(){return!this._internals||this._internals.checkValidity()}reportValidity(){return!this._internals||this._internals.reportValidity()}_wireFormData(){if(!this._internals||this._wiredFormData)return;const t=this._internals.form;if(!t)return;this._wiredFormData=!0;const e=this.getAttribute("name"),s=t=>{const s=t.target;s&&"radio"===s.type&&s.name&&s.name===e&&this._syncFormValue()};t.addEventListener("change",s);const r=()=>this._syncFormValue();t.addEventListener("formdata",r),i(this,()=>{t.removeEventListener("change",s),t.removeEventListener("formdata",r)})}_wireValueTracking(){if(!this._internals||this._wiredValueTracking)return;this._wiredValueTracking=!0;const t=t=>{const e=t.target;e&&e.matches&&e.matches("input, textarea, select")&&(this._ownerBetween(e,this)||(e._contourUserDirty=!0,e._contourAttrAtDirty=this.getAttribute("value")))};this.addEventListener("input",t),this.addEventListener("change",t)}_restoreControlValue(t,e){if("file"!==t.type){if(e.dirty&&e.attrAtDirty===this.getAttribute("value")){if(e.selected&&"SELECT"===t.tagName&&t.multiple){const s=new Set(e.selected);for(const e of t.options)e.selected=s.has(e.value)}else t.value=e.value;return t._contourUserDirty=!0,void(t._contourAttrAtDirty=e.attrAtDirty)}""===t.value&&null===t.getAttribute("value")&&(t.value=e.value)}}_detachInnerFormControls(){if(this._internals)for(const t of this.querySelectorAll("input, textarea, select"))t.hasAttribute("name")&&""!==t.getAttribute("form")&&t.setAttribute("form","")}batch(t){if("function"==typeof t){this._batchDepth=(this._batchDepth||0)+1,this._batchDirty=this._batchDirty||!1;try{t()}finally{this._batchDepth-=1,0===this._batchDepth&&this._batchDirty&&(this._batchDirty=!1,this.isConnected&&this._contourAuthored&&this.attributeChangedCallback("__rerender__",null,""))}}}requestRender(){this._contourRerenderQueued||(this._contourRerenderQueued=!0,queueMicrotask(()=>{this._contourRerenderQueued=!1,this.isConnected&&this._contourAuthored&&this.attributeChangedCallback("__rerender__",null,"")}))}_applyDensity(){const t=this.getAttribute("density");null!==t?this.setAttribute("data-density",t):this.hasAttribute("data-density")&&this.removeAttribute("data-density")}_ownerBetween(t,e){for(let s=t.parentElement;s&&s!==e;s=s.parentElement)if(s instanceof T)return s;return null}keepNode(t){return t?(this._contourPersistent||(this._contourPersistent=new Set),this._contourPersistent.add(t),t):t}ensure(t,e,s){const r=s||this;r._ensureCache&&r._ensureCacheGen===this._contourRenderGen||(r._ensureCache=new Map,r._ensureCacheGen=this._contourRenderGen);const i=r._ensureCache,a=r===this?t:"\0"+r+"\0"+t;let n=i.get(a);if(void 0===n){n=null;for(const e of r.querySelectorAll(t))if(!this._ownerBetween(e,r)){n=e;break}i.set(a,n)}return n||(n=e(),r.appendChild(n),i.set(a,n)),n}}const F=t=>class extends T{render(){t.forEach(t=>this.classList.add(t));for(const e of Array.from(this.classList))t.some(t=>e.startsWith(t+"--"))&&this.classList.remove(e);l.forEach(e=>{if(this.hasAttribute(e)){const s=this.getAttribute(e);t.forEach(t=>{const e=t.replace("c-","");this.classList.add(`c-${e}--${s}`)})}})}};function R(){try{const t=document.createElement("div");return t.setAttribute("hidden","until-found"),"until-found"===t.getAttribute("hidden")}catch(t){return!1}}function B(t,e,s,r){if(!e)return t;const i=s||"undefined"!=typeof navigator&&navigator.language||"en";if("date"===e||"time"===e)try{const s="time"===e?{timeStyle:"short"}:void 0;return new Intl.DateTimeFormat(i,s).format(new Date(t))}catch(e){return t}if("relative"===e)try{const e=Number(t);let s=e;if(Number.isNaN(e)){const e=new Date(t).getTime();Number.isFinite(e)&&(s=(e-Date.now())/1e3)}const r=new Intl.RelativeTimeFormat(i,{numeric:"auto"});return Math.abs(s)<60?r.format(Math.round(s),"second"):Math.abs(s)<3600?r.format(Math.round(s/60),"minute"):Math.abs(s)<86400?r.format(Math.round(s/3600),"hour"):r.format(Math.round(s/86400),"day")}catch(e){return t}let a={};if("currency"===e)a={style:"currency",currency:"USD"};else if("percent"===e)a={style:"percent"};else if("compact"===e)a={notation:"compact"};else if("unit"===e)a={style:"unit",unit:r||"meter"};else if("number"!==e)try{a=JSON.parse(e)}catch(e){return t}try{return new Intl.NumberFormat(i,a).format(Number(t))}catch(e){return t}}function z(t,e,{wrap:s=!0,enter:r=!0,homeEnd:i=!1,onKey:a,onNavigate:n,rtl:o}={}){const c=e.indexOf(document.activeElement);if(c<0)return;let l=-1;const u=o?"ArrowLeft":"ArrowRight",d=o?"ArrowRight":"ArrowLeft";if(t.key===u||"ArrowDown"===t.key?l=s?(c+1)%e.length:Math.min(c+1,e.length-1):t.key===d||"ArrowUp"===t.key?l=s?(c-1+e.length)%e.length:Math.max(0,c-1):(i||s)&&"Home"===t.key?l=0:(i||s)&&"End"===t.key&&(l=e.length-1),l>=0&&l!==c){t.preventDefault();try{e[l].focus()}catch(t){}n&&n(l),a&&a(t.key,c,e[c])}else!r&&!s||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a&&a(t.key,c,e[c]))}function I(t){let e=t;for(;e&&1===e.nodeType;){const t=e.getAttribute&&e.getAttribute("dir");if(t)return"rtl"===t.toLowerCase();e=e.parentElement}try{return"undefined"!=typeof document&&"rtl"===(document.documentElement.getAttribute("dir")||"").toLowerCase()}catch(t){return!1}}const O=85.05112878;function P(t){const e=Number(t);return Number.isFinite(e)?Math.max(-85.05112878,Math.min(O,e)):NaN}function V(t){const e=Number(t);return Number.isFinite(e)?((e+180)%360+360)%360-180:NaN}function j(t){if(null==t)return!0;if("number"==typeof t)return!Number.isFinite(t);if("string"==typeof t){const e=t.trim();return""===e||"__missing"===e}return!1}function H(t,e,s,r,i,a){t=Number.isFinite(t)?t:0,e=Number.isFinite(e)?e:0,s=Number.isFinite(s)&&s>0?s:0,r=Number.isFinite(r)&&r>=0?r:0,i=Number.isFinite(i)?i:0;const n=(a=Number.isFinite(a)?a:0)-i>Math.PI?1:0,o=t+s*Math.cos(i),c=e+s*Math.sin(i),l=t+s*Math.cos(a),u=e+s*Math.sin(a);if(r<=0)return`M ${t} ${e} L ${o} ${c} A ${s} ${s} 0 ${n} 1 ${l} ${u} Z`;return`M ${o} ${c} A ${s} ${s} 0 ${n} 1 ${l} ${u} L ${t+r*Math.cos(a)} ${e+r*Math.sin(a)} A ${r} ${r} 0 ${n} 0 ${t+r*Math.cos(i)} ${e+r*Math.sin(i)} Z`}function $(t,e){const s=null!=(e=e||{}).cx?e.cx:100,r=null!=e.cy?e.cy:100,i=null!=e.r?e.r:90,a=null!=e.inner?e.inner:55,n=null!=e.gap?e.gap:.02,o=t.reduce((t,e)=>t+(Number(e)>0?Number(e):0),0)||1;let c=-Math.PI/2;const l=[];return t.forEach((t,e)=>{const u=Number(t)||0,d=u/o;if(!(u>0))return void(c+=d*Math.PI*2);const h=d*Math.PI*2-n,m=c+n/2,b=m+Math.max(0,h);l.push({path:H(s,r,i,a,m,b),value:u,index:e}),c+=d*Math.PI*2}),l}function J(t,e){const s=null!=(e=e||{}).width?e.width:300,r=null!=e.height?e.height:120,i=null!=e.gap?e.gap:2,a=t.map(j),n=t.map((t,e)=>a[e]?0:Number(t)||0);let o=Math.min(0,Math.min.apply(null,n.length?n:[0])),c=Math.max(0,Math.max.apply(null,n.length?n:[0]));null!=e.min&&(o=Math.min(o,Number(e.min)||0)),null!=e.max&&(c=Math.max(c,Number(e.max)||0)),Number.isFinite(o)&&Number.isFinite(c)||(o=0,c=1),c===o&&(c=o+1);const l=c-o,u=s/(t.length||1),d=Math.max(1,u-i),h=r-(0-o)/l*r;return n.map((t,e)=>{const s=r-(t-o)/l*r;return{x:e*u+i/2,y:Math.min(s,h),width:d,height:a[e]?0:Math.abs(h-s),zeroY:h,missing:a[e]}})}function W(t,e){const s=null!=(e=e||{}).width?e.width:300,r=null!=e.height?e.height:120,i=t.filter(t=>!j(t)).map(Number).filter(t=>Number.isFinite(t)),a=null!=e.max?e.max:i.length?Math.max.apply(null,i):1,n=null!=e.min?e.min:i.length?Math.min.apply(null,i):0,o=Number.isFinite(a-n)&&a-n!==0?a-n:1,c=t.length||1,l=t.map((t,e)=>{if(j(t))return null;const i=Number(t);if(!Number.isFinite(i))return null;return[e/Math.max(1,c-1)*s,r-(i-n)/o*r]});let u="",d=[];const h=()=>{if(d.length){u+=` M ${d[0][0]} ${d[0][1]}`;for(let t=1;t<d.length;t++){const e=d[t-1],s=d[t],r=(e[0]+s[0])/2;u+=` C ${r} ${e[1]}, ${r} ${s[1]}, ${s[0]} ${s[1]}`}d=[]}};return l.forEach(t=>{t?d.push(t):h()}),h(),u.trim()}function U(t,e,s,r,i){t=Number.isFinite(Number(t))?Number(t):0,e=Number.isFinite(Number(e))?Number(e):0,s=Number.isFinite(Number(s))?Number(s):0,r=null==r?0:Number.isFinite(Number(r))?Number(r):0,i=null==i?3:Number.isFinite(Number(i))?Number(i):3;const a=(r-90)*Math.PI/180,n=t+s*Math.cos(a),o=e+s*Math.sin(a),c=.25*s,l=t-c*Math.cos(a),u=e-c*Math.sin(a),d=Math.cos(a+Math.PI/2),h=Math.sin(a+Math.PI/2),m=t+i*d,b=e+i*h,p=t-i*d,g=e-i*h;return`M ${n.toFixed(2)} ${o.toFixed(2)} L ${m.toFixed(2)} ${b.toFixed(2)} L ${l.toFixed(2)} ${u.toFixed(2)} L ${p.toFixed(2)} ${g.toFixed(2)} Z`}"undefined"!=typeof window&&(window.ContourEvents=Object.freeze(d));const K=["circle","square","triangle","diamond","star"];function G(t,e,s,r){const i=t.length,a=i?t[0].length:0;if(i<2||a<2)return[];const n=s/(a-1),o=r/(i-1);return(e||[]).map(e=>{const s=function(t,e){const s=t.length,r=s?t[0].length:0,i=[];if(!s||!r)return i;const a=(t,s,r,i)=>i===r?.5:(e-r)/(i-r);for(let n=0;n<s-1;n++)for(let s=0;s<r-1;s++){const r=t[n][s],o=t[n][s+1],c=t[n+1][s],l=t[n+1][s+1],u=(r>=e?8:0)|(o>=e?4:0)|(l>=e?2:0)|(c>=e?1:0);if(0===u||15===u)continue;const d={x:s+a(0,0,r,o),y:n},h={x:s+1,y:n+a(0,0,o,l)},m={x:s+a(0,0,c,l),y:n+1},b={x:s,y:n+a(0,0,r,c)};let p;const g=(()=>{const t=r-o-c+l;return Math.abs(t)<1e-12?(r+o+c+l)/4:(r*l-o*c)/t})();switch(5===u?p=g>=e?"top-bottom":"left-right":10===u&&(p=g>=e?"left-right":"top-bottom"),u){case 1:case 14:i.push([b,m]);break;case 2:case 13:i.push([m,h]);break;case 3:case 12:i.push([b,h]);break;case 4:case 11:i.push([d,h]);break;case 6:case 9:i.push([d,m]);break;case 7:case 8:i.push([b,d]);break;case 5:"top-bottom"===p?i.push([d,m],[b,h]):i.push([d,h],[b,m]);break;case 10:"left-right"===p?i.push([b,h],[d,m]):i.push([d,h],[b,m])}}return i}(t,e);let r="";for(const[t,e]of s)r+=`M ${(t.x*n).toFixed(2)} ${(t.y*o).toFixed(2)} L ${(e.x*n).toFixed(2)} ${(e.y*o).toFixed(2)} `;return{level:e,d:r.trim()}})}const X=t=>Math.max(0,Math.min(1,Number(t)||0)),Y=t=>Math.max(1,Math.round((Number(t)||24)/16));function Q(t,{size:e=24,values:s=[],color:r="#1f77b4",strokeWidth:i,bgColor:a="transparent"}={}){const n=Number(e)||24,o=null!=i?Number(i):Y(n),c=Array.isArray(s)?s.filter(t=>Number.isFinite(t)):[],l=c.length;if(a&&"transparent"!==a?(t.fillStyle=a,t.fillRect(0,0,n,n)):t.clearRect(0,0,n,n),l<2)return;const u=o+1,d=n-2*u,h=n-2*u,m=Math.min(...c),b=Math.max(...c)-m||1;t.beginPath(),c.forEach((e,s)=>{const r=u+s/(l-1)*d,i=(t=>u+h-(t-m)/b*h)(e);0===s?t.moveTo(r,i):t.lineTo(r,i)}),t.lineWidth=o,t.strokeStyle=r,t.lineCap="round",t.lineJoin="round",t.stroke()}function Z(t,{size:e=32,hue:s=0,concentration:r=0,color:i,uncertainty:a=0,timeStep:n=0,timeSteps:o=4}={}){const c=Number(e)||32,l=Y(c),u=c/2,d=c/2,h=(c-2*l)/2,m=Math.max(0,Math.min(4,Math.floor(Number(s)||0))),b=i||((t,e)=>["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd"][Math.max(0,Math.min(4,Math.floor(Number(t)||0)))]||e)(m,"#1f77b4"),p=(g=r,_=8,Math.round(X(g)*_)/_);var g,_;if(t.clearRect(0,0,c,c),t.beginPath(),t.arc(u,d,h,0,2*Math.PI),t.lineWidth=l,t.strokeStyle="rgba(0,0,0,0.12)",t.stroke(),p>0&&(t.beginPath(),t.arc(u,d,h,-Math.PI/2,-Math.PI/2+2*p*Math.PI),t.lineWidth=l,t.strokeStyle=b,t.lineCap="round",t.stroke()),a>0){const e=h+l,s=1===a?[l,2*l]:[2*l,l];t.beginPath(),t.arc(u,d,e,0,2*Math.PI),t.lineWidth=l,t.strokeStyle=b,t.setLineDash(s),t.stroke(),t.setLineDash([])}if(o>0&&n>=0){const e=Math.max(0,Math.min(o-1,Math.floor(Number(n)||0))),s=-Math.PI/2+e/o*2*Math.PI,r=u+h*Math.cos(s),i=d+h*Math.sin(s);t.beginPath(),t.arc(r,i,.75*l,0,2*Math.PI),t.fillStyle=b,t.fill()}}const tt=new WeakMap,et=new WeakMap,st=(t,e,s,r,i)=>{let a=et.get(t);a||(a=[],et.set(t,a)),a.push({target:e,type:s,fn:r,options:i});try{r._contourBehaviour=!0}catch(t){}e.addEventListener(s,r,i)},rt=(t,e)=>{let s=tt.get(t);return s||(s=new Set,tt.set(t,s)),!s.has(e)&&(s.add(e),!0)},it=t=>t.shadowRoot?[t,t.shadowRoot]:[t],at=(t,e)=>{const s=[];for(const r of it(t))for(const t of r.querySelectorAll(e))s.includes(t)||s.push(t);return s},nt=(t,e)=>at(t,e)[0]||null,ot=(t,e)=>{const s="function"==typeof t.matches&&t.matches(e)?[t]:[];for(const r of at(t,e))s.includes(r)||s.push(r);return s},ct=t=>{const e=t&&t.getRootNode?t.getRootNode():null;return e&&e.host?e:null},lt=(t,e,s)=>{const r=Array.from(e.querySelectorAll(s));if(ct(e)&&ct(e).host===t)for(const e of t.querySelectorAll(s))r.includes(e)||r.push(e);return r},ut=new WeakMap,dt=(t,e,s)=>{const r=t=>{let e=ut.get(t);e||(e=new Set,ut.set(t,e)),e.has(r)||(e.add(r),s(t))};for(const s of it(t))st(t,s,e,r)},ht=(t,e)=>!!e&&it(t).some(t=>t.contains(e)),mt=(t,e,s)=>"function"==typeof e?.closest&&ht(t,e)?e.closest(s):null,bt=(t,e,s)=>{t.dispatchEvent(new CustomEvent(e,{detail:s,bubbles:!0,composed:!0}))};function pt(t){if(rt(t,"tabs"))for(const e of ot(t,".c-tabs__list, .c-code-tabs__list")){const s=e.classList.contains("c-code-tabs__list")?".c-code-tabs__panel":".c-tabs__panel",r=()=>lt(t,e,"[role='tab']"),i=(e,i)=>{const a=r();e.id||(e.id=o("c-tab")),a.forEach(s=>{const r=s===e;s.setAttribute("aria-selected",String(r)),s.tabIndex=r?0:-1;const i=s.getAttribute("aria-controls");if(!i)return;const a=nt(t,"#"+CSS.escape(i))||document.getElementById(i);a&&(a.hidden=!r,r&&a.setAttribute("aria-labelledby",s.id))});const n=at(t,s);if(n.length){const t=a.indexOf(e);n.forEach((e,s)=>{e.hidden=s!==t})}if(i)try{e.focus()}catch(t){}const c=e.textContent.trim()||e.getAttribute("aria-controls")||"";t.dispatchEvent(new CustomEvent("contour:tab-change",{bubbles:!0,composed:!0,detail:{index:a.indexOf(e),label:c}}))},a=(t,e)=>{if(!(e||"function"!=typeof document.startViewTransition||"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches))try{const s=document.startViewTransition(()=>i(t,e));return s&&s.ready&&s.ready.catch(()=>{}),void(s&&s.finished&&s.finished.catch(()=>{}))}catch(t){}i(t,e)};dt(t,"click",e=>{const s=mt(t,e.target,"[role='tab']");if(s&&r().includes(s)){const t=e.target&&e.target.closest?e.target.closest("button"):null;if(t&&t!==s&&s.contains(t))return;a(s,!1)}}),dt(t,"keydown",e=>{let s=mt(t,e.target,"[role='tab']");!s&&e.target&&e.target.getAttribute&&"tab"===e.target.getAttribute("role")&&ht(t,e.target)&&(s=e.target);const i=r(),n=i.indexOf(s);if(n<0)return;const o="vertical"===t.getAttribute("orientation"),c=I(t),l=o?c?{ArrowDown:n-1,ArrowUp:n+1,Home:i.length-1,End:0}:{ArrowDown:n+1,ArrowUp:n-1,Home:0,End:i.length-1}:c?{ArrowRight:n-1,ArrowLeft:n+1,Home:i.length-1,End:0}:{ArrowRight:n+1,ArrowLeft:n-1,Home:0,End:i.length-1};if(!(e.key in l))return;e.preventDefault();const u=i[(l[e.key]+i.length)%i.length];u&&a(u,!0)});const n=r(),c=t.getAttribute("persist");let l=null;if("storage"===c&&t.id)try{l=localStorage.getItem("contour-tabs:"+t.id)}catch(t){l=null}else if("url"===c)try{const t=new URLSearchParams(window.location.search).get("c-tabs");null!==t&&(l=t)}catch(t){l=null}let u=n.find(t=>"true"===t.getAttribute("aria-selected"))||n[0];if(null!==l){const t=parseInt(l,10);Number.isFinite(t)&&n[t]&&(u=n[t])}u&&i(u,!1),"storage"===c&&t.id?st(t,t,"contour:tab-change",e=>{try{localStorage.setItem("contour-tabs:"+t.id,String(e.detail&&e.detail.index))}catch(t){}}):"url"===c&&st(t,t,"contour:tab-change",t=>{try{const e=new URL(window.location.href);e.searchParams.set("c-tabs",String(t.detail&&t.detail.index)),window.history.replaceState(null,"",e.toString())}catch(t){}})}}function gt(t){const e=ot(t,".c-segmented"),s=()=>{const s=t.getAttribute("value"),r=s!==t._segAuthorValue?s:null;null!==r&&(t._segAuthorValue=s);let i=0;for(const s of e){s.hasAttribute("role")||s.setAttribute("role","group");const e=t.getAttribute("label");e&&!s.hasAttribute("aria-label")&&s.setAttribute("aria-label",e);const a=lt(t,s,"button");i+=a.length,a.forEach(t=>{t.classList.add("c-segmented__option"),t.setAttribute("aria-pressed",null!=r?String(t.dataset.value===r):"true"===t.getAttribute("aria-pressed")?"true":"false")});const n=a.find(t=>"true"===t.getAttribute("aria-pressed"))||a[0];a.forEach(t=>{t.tabIndex=t===n?0:-1})}return i};if(s()||t._segRetryScheduled||(t._segRetryScheduled=!0,setTimeout(()=>{t._segRetryScheduled=!1,s()},0)),!rt(t,"segmented"))return;const r=s=>{const r=e.find(e=>lt(t,e,"button").includes(s));r&&(lt(t,r,"button").forEach(t=>{const e=t===s;t.setAttribute("aria-pressed",String(e)),t.tabIndex=e?0:-1}),bt(t,"contour:change",{value:s.dataset.value||s.textContent.trim()}))};dt(t,"click",e=>{const s=mt(t,e.target,"button");s&&r(s)}),dt(t,"keydown",s=>{const i=mt(t,s.target,"button");if(!i)return;const a=e.find(e=>lt(t,e,"button").includes(i));if(!a)return;const n=lt(t,a,"button");z(s,n,{wrap:!1,homeEnd:!0,rtl:I(t),onNavigate:t=>r(n[t]),onKey:t=>{"Enter"!==t&&" "!==t||r(i)}})})}function _t(t){!function(){if(vt)return;vt=!0,document.addEventListener("click",t=>{for(const e of document.querySelectorAll("contour-combobox, contour-shadow-combobox")){const s=e.shadowRoot?e.shadowRoot.querySelector(".c-combobox__list"):e.querySelector(".c-combobox__list");e.shadowRoot?e.shadowRoot.querySelector(".c-combobox__input"):e.querySelector(".c-combobox__input");if(!s||s.hasAttribute("hidden"))continue;(e.shadowRoot||e).contains(t.target)||s.setAttribute("hidden","")}})}();const e=nt(t,".c-combobox__input"),s=nt(t,".c-combobox__list");if(!e||!s)return;const r=()=>at(t,".c-combobox__option");if(s.id||(s.id=o("c-combobox-list")),s.setAttribute("role","listbox"),e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","listbox"),e.setAttribute("aria-controls",s.id),e.setAttribute("aria-expanded",s.hasAttribute("hidden")?"false":"true"),e.hasAttribute("aria-autocomplete")||e.setAttribute("aria-autocomplete","list"),r().forEach((t,e)=>{t.id||(t.id=o("c-combobox-option")),t.setAttribute("role","option"),t.hasAttribute("aria-selected")||t.setAttribute("aria-selected","false")}),!rt(t,"combobox"))return;const i=()=>nt(t,".c-combobox__input"),a=()=>nt(t,".c-combobox__list");let n=-1;const c=e=>{const s=i(),r=t.hasAttribute("multiple");if(e.forEach((t,e)=>{const s=e===n;t.classList.toggle("c-combobox__option--active",s),r||t.setAttribute("aria-selected",String(s))}),s){const t=n>=0?e[n]:null;t?s.setAttribute("aria-activedescendant",t.id):s.removeAttribute("aria-activedescendant")}},l=e=>{const s=(e||"").toLowerCase();if(t._comboboxVirtual&&"function"==typeof t._renderComboboxWindow)return t._renderComboboxWindow(s,!0),void(n=-1);r().forEach(t=>{t.hidden=!(!s||t.textContent.toLowerCase().includes(s))}),n=-1;const i=a();if(!i)return;const o=r().length,c=r().filter(t=>!t.hidden).length,l=i.querySelector(".c-combobox__empty");if(o>0&&0===c){if(!l){const e=document.createElement("UL"===i.tagName||"OL"===i.tagName?"li":"div");e.className="c-combobox__empty",e.setAttribute("role","option"),e.setAttribute("aria-disabled","true"),e.setAttribute("aria-selected","false"),e.textContent=k(t,"no-matches","No matches"),i.appendChild(e)}}else l&&l.remove()},u=()=>{const t=a();if(!t)return;const e=i();if(e){const s=e.getBoundingClientRect();t.style.position="fixed",t.style.insetBlockStart=`${Math.round(s.bottom+4)}px`,t.style.insetInlineStart=`${Math.round(s.left)}px`,t.style.insetInlineEnd="auto",t.style.inlineSize=`${Math.round(s.width)}px`}t.removeAttribute("hidden"),e&&e.setAttribute("aria-expanded","true")},d=()=>{const e=a();e&&e.setAttribute("hidden","");const s=i();s&&(s.setAttribute("aria-expanded","false"),s.removeAttribute("aria-activedescendant")),n=-1;const o=t.hasAttribute("multiple");r().forEach(t=>{t.classList.remove("c-combobox__option--active"),o||t.setAttribute("aria-selected","false")})};t._comboboxVirtual&&s&&!s._contourVirtualScroll&&(s._contourVirtualScroll=!0,s.addEventListener("scroll",()=>{"function"==typeof t._renderComboboxWindow&&t._renderComboboxWindow(t._comboboxQuery||"")},{passive:!0}));const h=e=>{const s=i();if(!s)return;if(t.hasAttribute("multiple")){const r="true"===e.getAttribute("aria-selected");e.setAttribute("aria-selected",String(!r)),e.classList.toggle("c-combobox__option--selected",!r);const i=(t.getAttribute("value")||"").split(",").map(t=>t.trim()).filter(Boolean),a=t._comboboxVirtual&&t._comboboxFiltered?t._comboboxFiltered.find(t=>t.index===Number(e.dataset.optionIndex))?.value:null!=e.dataset.optionValue?e.dataset.optionValue:e.textContent.trim(),n=i.indexOf(String(a));return r&&n>=0&&i.splice(n,1),!r&&n<0&&i.push(String(a)),t.setAttribute("value",i.join(",")),"function"==typeof t._syncFormValue&&t._syncFormValue(),bt(t,"contour:select",{value:i}),void s.focus()}const r=null!=e.dataset.optionValue?e.dataset.optionValue:e.textContent.trim();s.value=e.textContent,t.setAttribute("value",r),"function"==typeof t._syncFormValue&&t._syncFormValue(),bt(t,"contour:select",{value:r}),d(),s.focus()},m=e=>null!==mt(t,e,".c-combobox__input");dt(t,"input",e=>{m(e.target)&&(t._comboboxQuery=e.target.value,l(e.target.value),u(),"function"==typeof t._emitForm&&t._emitForm("contour:input"))}),dt(t,"focusin",t=>{m(t.target)&&(l(t.target.value),u())}),dt(t,"keydown",t=>{if(!m(t.target))return;const e=r().filter(t=>!t.hidden);"ArrowDown"===t.key?(t.preventDefault(),n=Math.min(n+1,e.length-1),c(e)):"ArrowUp"===t.key?(t.preventDefault(),n=Math.max(n-1,0),c(e)):"Home"===t.key?(t.preventDefault(),n=0,c(e)):"End"===t.key?(t.preventDefault(),n=Math.max(0,e.length-1),c(e)):"Enter"===t.key||" "===t.key?(t.preventDefault(),n>=0&&e[n]&&h(e[n])):"Escape"===t.key&&d()}),dt(t,"click",e=>{const s=mt(t,e.target,".c-combobox__option");s?h(s):ht(t,e.target)&&t.contains(e.target)||d()})}let vt=!1;const yt=t=>at(t,".c-tree__toggle, .c-tree__leaf").filter(t=>!t.closest(".c-tree__children[hidden]"));function ft(t){const e=ot(t,"ul.c-tree")[0];e&&!e.hasAttribute("role")&&e.setAttribute("role","tree"),at(t,".c-tree__children").forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","group")});at(t,".c-tree__node").forEach(t=>{"treeitem"!==t.getAttribute("role")&&t.setAttribute("role","treeitem"),t.setAttribute("aria-level",String((t=>{let e=1;for(let s=t.parentElement;s;s=s.parentElement)s.classList&&s.classList.contains("c-tree__children")&&e++;return e})(t)));const e=t.querySelector(":scope > .c-tree__row");e?t.setAttribute("aria-expanded",e.querySelector(":scope > .c-tree__toggle")?.getAttribute("aria-expanded")||"false"):t.hasAttribute("aria-expanded")&&t.removeAttribute("aria-expanded")});const s=yt(t),r=s.find(t=>"0"===t.getAttribute("tabindex"))||s.find(t=>t===document.activeElement)||s[0];if(s.forEach(t=>t.setAttribute("tabindex",t===r?"0":"-1")),at(t,".c-tree__toggle, .c-tree__leaf").forEach(t=>{s.includes(t)||t.setAttribute("tabindex","-1")}),!rt(t,"tree"))return;t._selectedTree=t._selectedTree||new Set;let i=-1,a=!1,n=!1;dt(t,"pointerdown",t=>{a=Boolean(t.shiftKey),n=Boolean(t.ctrlKey||t.metaKey)}),dt(t,"keydown",t=>{a=Boolean(t.shiftKey),n=Boolean(t.ctrlKey||t.metaKey)}),dt(t,"change",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-tree__select"):null;if(!s||!t.contains(s))return;const r=Array.from(t.querySelectorAll(".c-tree__select")),o=r.indexOf(s),c=t=>{const e=(t=>t&&t.closest?t.closest(".c-tree__node"):null)(t);return e&&e.dataset?e.dataset.path:null},l=c(s),u=Boolean(e.shiftKey||a),d=Boolean(e.ctrlKey||e.metaKey||n);if(a=!1,n=!1,u&&i>=0){const e=Math.min(i,o),a=Math.max(i,o);for(let i=e;i<=a;i++){r[i].checked=s.checked;const e=c(r[i]);e&&(s.checked?t._selectedTree.add(e):t._selectedTree.delete(e))}}else d||s.checked&&r.forEach((e,s)=>{if(s!==o&&e.checked){e.checked=!1;const s=c(e);s&&t._selectedTree.delete(s)}}),l&&(s.checked?t._selectedTree.add(l):t._selectedTree.delete(l));i=o,bt(t,"contour:select",{paths:Array.from(t._selectedTree)})}),at(t,".c-tree__node, .c-tree__leaf").forEach(t=>{t.hasAttribute("draggable")||t.setAttribute("draggable","true")});let o=null;dt(t,"dragstart",e=>{const s=mt(t,e.target,".c-tree__node, .c-tree__leaf");if(s&&(o=(s.textContent||"").trim().slice(0,120),e.dataTransfer)){e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",o)}catch(t){}}}),dt(t,"dragover",e=>{mt(t,e.target,".c-tree__node, .c-tree__leaf")&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"))}),dt(t,"drop",e=>{const s=mt(t,e.target,".c-tree__node, .c-tree__leaf");if(!s||!o)return;e.preventDefault();const r=(s.textContent||"").trim().slice(0,120);r&&r!==o&&bt(t,"contour:move",{from:o,to:r}),o=null});const c=t.getAttribute("persist");if("storage"===c&&t.id)try{const e=localStorage.getItem("contour-tree:"+t.id);if(null!==e){const s=JSON.parse(e);if(Array.isArray(s)){const e=new Set(s.map(t=>String(t)));at(t,".c-tree__row").forEach(t=>{const s=t.querySelector(":scope > .c-tree__toggle");if("true"===s?.getAttribute("aria-expanded"))return;const r=(t.textContent||"").trim().slice(0,120);if(!e.has(r))return;const i=t.querySelector(":scope > .c-tree__toggle");if(!i)return;const a=t.closest(".c-tree__node"),n=a?a.querySelector(":scope > .c-tree__children"):null;i.setAttribute("aria-expanded","true"),a&&a.setAttribute("aria-expanded","true"),n&&n.removeAttribute("hidden")})}}}catch(t){}else if("url"===c)try{const e=new URLSearchParams(window.location.search).get("c-tree");if(null!==e){const s=JSON.parse(e);if(Array.isArray(s)){const e=new Set(s.map(t=>String(t)));at(t,".c-tree__row").forEach(t=>{const s=t.querySelector(":scope > .c-tree__toggle");if("true"===s?.getAttribute("aria-expanded"))return;const r=(t.textContent||"").trim().slice(0,120);if(!e.has(r))return;const i=t.querySelector(":scope > .c-tree__toggle");if(!i)return;const a=t.closest(".c-tree__node"),n=a?a.querySelector(":scope > .c-tree__children"):null;i.setAttribute("aria-expanded","true"),a&&a.setAttribute("aria-expanded","true"),n&&n.removeAttribute("hidden")})}}}catch(t){}const l=e=>{const s="true"===e.getAttribute("aria-expanded");e.setAttribute("aria-expanded",String(!s));const r=e.closest(".c-tree__row")||e.parentElement,i=e.closest(".c-tree__node"),a=i?i.querySelector(":scope > .c-tree__children"):null;if(a&&(s?R()?a.setAttribute("hidden","until-found"):a.hidden=!0:a.removeAttribute("hidden")),i&&i.setAttribute("aria-expanded",String(!s)),bt(t,"contour:toggle",{open:!s,label:(r?r.textContent:"").trim().slice(0,120)}),"storage"===c&&t.id)try{const e=[];at(t,".c-tree__row").forEach(t=>{const s=t.querySelector(":scope > .c-tree__toggle");"true"===s?.getAttribute("aria-expanded")&&e.push((t.textContent||"").trim().slice(0,120))}),localStorage.setItem("contour-tree:"+t.id,JSON.stringify(e))}catch(t){}else if("url"===c)try{const e=[];at(t,".c-tree__row").forEach(t=>{const s=t.querySelector(":scope > .c-tree__toggle");"true"===s?.getAttribute("aria-expanded")&&e.push((t.textContent||"").trim().slice(0,120))});const s=new URL(window.location.href);s.searchParams.set("c-tree",JSON.stringify(e)),window.history.replaceState(null,"",s.toString())}catch(t){}},u=t=>t.classList&&t.classList.contains("c-tree__toggle")?t:null,d=e=>{at(t,".c-tree__toggle, .c-tree__leaf").forEach(t=>t.setAttribute("tabindex",t===e?"0":"-1"))},h=(e,s)=>{const r=e.closest(".c-tree__node"),i=r&&r.dataset?r.dataset.path:null;i&&t._expanded&&(s?t._expanded.add(i):t._expanded.delete(i));const a=t._treeRoot;if(a){t._treeScrollTop=a.scrollTop||0,t._renderWindow(a,t._treeScrollTop);try{a.scrollTop=t._treeScrollTop}catch(t){}const e=i?a.querySelector('.c-tree__node[data-path="'+i+'"] > .c-tree__row > .c-tree__toggle'):null;e&&(e.focus(),d(e))}t._persistExpanded&&t._persistExpanded()};dt(t,"click",e=>{if(t.hasAttribute("virtual"))return;let s=mt(t,e.target,".c-tree__toggle");if(!s){const r=mt(t,e.target,".c-tree__row");r&&(s=r.querySelector(":scope > .c-tree__toggle"))}s&&(e.preventDefault(),e.stopPropagation(),l(s))}),dt(t,"focusin",e=>{mt(t,e.target,".c-tree__toggle, .c-tree__leaf")&&d(e.target)}),dt(t,"keydown",e=>{const s=mt(t,e.target,".c-tree__toggle, .c-tree__leaf");if(!s)return;const r=yt(t),i=r.indexOf(s);if("Enter"===e.key||" "===e.key){const r=u(s);if(r)return e.preventDefault(),void(t.hasAttribute("virtual")?h(r,"true"!==r.getAttribute("aria-expanded")):l(r));if(t.hasAttribute("selectable")){const t=s.classList.contains("c-tree__leaf")?s:s.closest(".c-tree__leaf"),r=t?t.querySelector(".c-tree__select"):null;r&&(e.preventDefault(),r.click())}return}if("ArrowRight"===e.key){const a=u(s),n=a&&"false"===a.getAttribute("aria-expanded");if(e.preventDefault(),n)t.hasAttribute("virtual")?h(a,!0):(l(a),d(s));else{const t=r[i+1];t&&(t.focus(),d(t))}return}if("ArrowLeft"===e.key){const r=u(s);if(r&&"true"===r.getAttribute("aria-expanded"))e.preventDefault(),t.hasAttribute("virtual")?h(r,!1):(l(r),d(s));else{const t=s.closest(".c-tree__children"),r=t?t.closest(".c-tree__node"):null,i=r?r.querySelector(":scope > .c-tree__row > .c-tree__toggle"):null;i&&(e.preventDefault(),i.focus(),d(i))}return}z(e,r,{wrap:!1,homeEnd:!0,onNavigate:t=>d(r[t])})})}function At(t){const e="[role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio']";at(t,e).forEach(t=>{t.hasAttribute("tabindex")||t.setAttribute("tabindex",(t.getAttribute("aria-disabled"),"-1"))});const s=()=>at(t,e);if(!s().some(t=>"0"===t.getAttribute("tabindex"))&&s().length){const t=s().find(t=>"true"!==t.getAttribute("aria-disabled"));t&&t.setAttribute("tabindex","0")}if(!rt(t,"menu"))return;const r=t=>t.querySelector(":scope > ul.c-menu, :scope > .c-menu"),i=()=>{at(t,"[aria-haspopup='menu']").forEach(t=>t.setAttribute("aria-expanded","false"))};dt(t,"keydown",e=>{const a=s().filter(t=>"true"!==t.getAttribute("aria-disabled"));if(!a.length)return;const n=a.indexOf(e.target),o=n>=0?a[n]:null,c=o?r(o):null;if(o&&"menu"===o.getAttribute("aria-haspopup")&&("ArrowRight"===e.key||"Enter"===e.key||" "===e.key)&&c){e.preventDefault(),i(),o.setAttribute("aria-expanded","true");const t=c.querySelector("[role='menuitem']");if(t){t.setAttribute("tabindex","0");try{t.focus()}catch(t){}}return}if("ArrowLeft"===e.key||"Escape"===e.key){o&&o.closest("ul.c-menu");let s=null;if(o){o.parentElement&&"UL"===o.parentElement.tagName&&o.parentElement;let e=o.parentElement;for(;e&&e!==t;){if(e.getAttribute&&"menu"===e.getAttribute("aria-haspopup")&&e.contains(o)&&e!==o){s=e;break}e=e.parentElement}}if(s){e.preventDefault(),s.setAttribute("aria-expanded","false");try{s.focus()}catch(t){}return}"Escape"===e.key&&i()}if(z(e,a,{wrap:!0,homeEnd:!0,onKey:()=>{if("Enter"===e.key||" "===e.key){const e=a.indexOf(document.activeElement);if(e>=0&&(!o||"menu"!==o.getAttribute("aria-haspopup"))){const s=a[e].getAttribute("role");if("menuitemcheckbox"===s||"menuitemradio"===s){const r="true"===a[e].getAttribute("aria-checked");"menuitemradio"===s&&a.forEach(t=>{t!==a[e]&&"menuitemradio"===t.getAttribute("role")&&t.setAttribute("aria-checked","false")}),a[e].setAttribute("aria-checked",String(!r)),bt(t,"contour:select",{index:e,label:a[e].textContent.trim(),checked:!r})}else bt(t,"contour:select",{index:e,label:a[e].textContent.trim()});i()}}}}),1===e.key.length&&!e.ctrlKey&&!e.metaKey&&!e.altKey){const t=e.key.toLowerCase(),s=a.findIndex(e=>(e.textContent||"").trim().toLowerCase().startsWith(t));s>=0&&(e.preventDefault(),a[s].focus())}}),dt(t,"click",a=>{const n=mt(t,a.target,e);if(!n)return;if("true"===n.getAttribute("aria-disabled"))return;const o=n.getAttribute("role");if("menuitemcheckbox"===o||"menuitemradio"===o){const e="true"===n.getAttribute("aria-checked");return"menuitemradio"===o&&s().forEach(t=>{t!==n&&"menuitemradio"===t.getAttribute("role")&&t.setAttribute("aria-checked","false")}),n.setAttribute("aria-checked",String(!e)),void bt(t,"contour:select",{index:s().indexOf(n),label:n.textContent.trim(),checked:!e})}if("menu"===n.getAttribute("aria-haspopup")){if(r(n)){const t="true"===n.getAttribute("aria-expanded");return i(),void n.setAttribute("aria-expanded",t?"false":"true")}}const c=s().indexOf(n);if(c>=0&&(bt(t,"contour:select",{index:c,label:n.textContent.trim()}),i(),"function"==typeof t.hidePopover))try{t.hidePopover()}catch(a){}})}function Et(t){if(at(t,".c-pagination__link").forEach(t=>{t.hasAttribute("tabindex")||t.setAttribute("tabindex","0")}),!rt(t,"pagination"))return;const e=e=>{const s=parseInt(e.textContent,10);if(Number.isFinite(s))if(at(t,".c-pagination__link").forEach(t=>{parseInt(t.textContent,10)===s?t.setAttribute("aria-current","page"):t.removeAttribute("aria-current")}),t.setAttribute("page",String(s)),bt(t,"contour:page",{page:s}),"storage"===t.getAttribute("persist")&&t.id)try{localStorage.setItem("contour-pagination:"+t.id,String(s))}catch(t){}else if("url"===t.getAttribute("persist"))try{const t=new URL(window.location.href);t.searchParams.set("c-pagination",String(s)),window.history.replaceState(null,"",t.toString())}catch(t){}};dt(t,"click",s=>{const r=mt(t,s.target,".c-pagination__link");if(!r)return;s.preventDefault();const i=r.getAttribute("data-action");if("prev"===i||"next"===i){const s=at(t,".c-pagination__link").filter(t=>!t.getAttribute("data-action")),r=s.find(t=>"page"===t.getAttribute("aria-current")),a=r&&parseInt(r.textContent,10)||1,n="prev"===i?Math.max(1,a-1):Math.min(s.length,a+1),o=s.find(t=>parseInt(t.textContent,10)===n);if(o)return void e(o)}e(r)}),dt(t,"keydown",s=>{const r=mt(t,s.target,".c-pagination__link");if(!r)return;const i=at(t,".c-pagination__link"),a=i.indexOf(r);let n=-1;const o=I(t);if("ArrowRight"===s.key)n=o?Math.max(a-1,0):Math.min(a+1,i.length-1);else if("ArrowLeft"===s.key)n=o?Math.min(a+1,i.length-1):Math.max(a-1,0);else if("Home"===s.key)n=0;else if("End"===s.key)n=i.length-1;else if("Enter"===s.key||" "===s.key)return s.preventDefault(),void e(r);n>=0&&n!==a&&(s.preventDefault(),i[n].focus())})}function wt(t){rt(t,"copy")&&dt(t,"click",e=>{const s=mt(t,e.target,".c-code__copy, .c-install__copy");if(!s)return;const r=mt(t,s,".c-code")||mt(t,s,".c-install")||t,i=r.querySelector("code, .c-install__command"),a=(t=>{const e=t&&t.querySelectorAll?t.querySelectorAll(".c-code__line"):null;return e&&e.length?Array.from(e).map(t=>Array.from(t.childNodes).filter(t=>!(t.classList&&t.classList.contains("c-code__line-number"))).map(t=>t.textContent).join("")).join("\n"):t&&t.textContent||""})(i)||(i?"":r.textContent)||"";(async()=>{try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(a),!0}catch(t){}try{const t=document.createElement("textarea");t.value=a,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.append(t),t.select();const e=document.execCommand("copy");return t.remove(),e}catch(t){return!1}})().then(t=>(t=>{const e=s.querySelector("use"),r=e&&e.getAttribute("href"),i=s.getAttribute("aria-label")||s.title||"";t&&e&&e.setAttribute("href","#i-check"),s.setAttribute("aria-label",t?"Copied":"Copy failed"),s.dataset.copied=String(t);const a=setTimeout(()=>{s.isConnected&&(e&&r&&e.setAttribute("href",r),s.setAttribute("aria-label",i),delete s.dataset.copied,s._copyTimer=null)},1600);s._copyTimer&&clearTimeout(s._copyTimer),s._copyTimer=a})(t)),bt(t,"contour:copy",{text:a})})}function xt(t){rt(t,"removable")&&dt(t,"click",e=>{const s=t=>{t&&t.parentNode&&t.parentNode.removeChild(t)},r=mt(t,e.target,".c-tag__remove");if(r){e.preventDefault();const i=mt(t,r,".c-tag");return bt(t,"contour:remove",{label:i&&i.getAttribute("label")||(i?i.textContent.trim():"")}),void s(i)}const i=mt(t,e.target,".c-filter-pill__remove");if(i){e.preventDefault();const r=mt(t,i,".c-filter-pill");return bt(t,"contour:remove",{key:r&&r.getAttribute("key"),value:r&&r.getAttribute("value")}),void s(r)}mt(t,e.target,"[data-empty-action]")&&bt(t,"contour:empty-action",{state:t.getAttribute("state")||"empty"});const a=mt(t,e.target,".c-alert__close");if(a){if(e.preventDefault(),bt(t,"contour:close",{}),!t.shadowRoot||t.shadowRoot.contains(a))try{t.remove()}catch(t){}return}if(mt(t,e.target,".c-callout__close")){e.preventDefault(),bt(t,"contour:close",{});try{t.remove()}catch(t){}}else;})}const Ct={n:0};let St=null,kt=0,Nt=0;const Lt=new Set,qt=[];let Dt=!1;const Mt=new Map;function Tt(t){if("Tab"!==t.key)return;const e=qt[qt.length-1];if(!e)return;const s=function(t){return Array.from(t.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])")).filter(t=>!t.hasAttribute("disabled")&&"true"!==t.getAttribute("aria-hidden"))}(e);if(!s.length)return void t.preventDefault();const r=s[0],i=s[s.length-1],a=document.activeElement;t.shiftKey?a!==r&&e.contains(a)||(t.preventDefault(),i.focus()):a===i&&(t.preventDefault(),r.focus())}function Ft(t,e){if(e){0===Ct.n&&(kt=window.scrollX,Nt=window.scrollY,St=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden"),Ct.n+=1,qt.push(t),1!==Ct.n||Dt||(Dt=!0,document.addEventListener("keydown",Tt));const e=new Set;for(let s=t;s&&s!==document.body;s=s.parentElement)for(const t of s.parentElement.children)t===s||t.inert||(t.inert=!0,e.add(t));Mt.set(t,e)}else{const e=qt.lastIndexOf(t);e>=0&&qt.splice(e,1),Ct.n=Math.max(0,Ct.n-1);const s=Mt.get(t);if(s){for(const t of s)t.inert=!1,Lt.delete(t);Mt.delete(t)}if(0===Ct.n){for(const t of Lt)t.inert=!1;Lt.clear(),document.documentElement.style.overflow=St||"",window.scrollTo(kt,Nt),Dt&&(document.removeEventListener("keydown",Tt),Dt=!1)}}}const Rt={empty:"No data",chart:"No data",contour:"No field",dropdown:"No options",loading:"Loading…",error:"Could not load."};function Bt(t,e){const s=Rt[e]||e,r=t&&t.getAttribute?t.getAttribute("labels"):null;if(!r)return s;try{const t=JSON.parse(r);if(t&&"object"==typeof t&&"string"==typeof t[e]&&t[e])return t[e]}catch(t){}return s}const zt=new Map,It=new Map;function Ot(t,e){It.size>=64&&It.delete(It.keys().next().value),It.set(t,e)}function Pt(t,e){t._remoteStatus=e,"error"!==e&&(t._remoteError=null),"loading"===e?t.setAttribute("aria-busy","true"):t.removeAttribute("aria-busy"),"function"==typeof t._setCustomState&&t._setCustomState("data-loading","loading"===e)}function Vt(t,e,s){t.dispatchEvent(new CustomEvent(e,{detail:s,bubbles:!0,composed:!0}))}function jt(t){return Array.isArray(t)?t.length:t&&"object"==typeof t?Object.keys(t).length:null==t?0:1}function Ht(t){const e=t._remoteEntry;t._remoteEntry=null,e&&(e.hosts.delete(t),0===e.hosts.size&&e.controller&&e.controller.abort())}function $t(t,e){const s=t.getAttribute("src");if(!s)return Ht(t),void Pt(t,void 0!==t._remoteData?"ready":"idle");!function(t){const e=parseFloat(t.getAttribute("refresh")||""),s=t.hasAttribute("src")&&Number.isFinite(e)&&e>0;if(!s)return void 0!==t._remoteTimer&&(clearTimeout(t._remoteTimer),t._remoteTimer=void 0),void(t._remoteLoop=!1);if(t._remoteLoop)return;t._remoteLoop=!0;const r=()=>{if(t._remoteTimer=void 0,!t.isConnected||!t.hasAttribute("refresh"))return void(t._remoteLoop=!1);if(document.hidden)return void(t._remoteTimer=setTimeout(r,1e3));const e=t.getAttribute("src"),s=t.getAttribute("cache-key");s&&It.delete(s),It.delete(e),t._remoteSrc=null,t._remoteLoop=!1,t.requestRender()};t._remoteTimer=setTimeout(r,Math.max(1e3,1e3*e)),i(t,()=>{clearTimeout(t._remoteTimer),t._remoteTimer=void 0,t._remoteLoop=!1})}(t);if(("string"==typeof e?[e]:e).every(e=>null!==t.getAttribute(e)))return Ht(t),void Pt(t,"ready");if(!function(t){if(!t.hasAttribute("lazy"))return!0;if("function"!=typeof IntersectionObserver)return!0;if(t._remoteVisible)return!0;if(t._lazyRegistered)return!1;Wt||(Wt=new IntersectionObserver(t=>{for(const e of t){const t=Ut.get(e.target);t&&e.isIntersecting&&(Ut.delete(e.target),Wt.unobserve(e.target),t())}},{rootMargin:"200px"}));const e=()=>{t._remoteVisible=!0,t._lazyRegistered=!1,t.requestRender()};return t._lazyRegistered=!0,Ut.set(t,e),Wt.observe(t),i(t,()=>{Wt.unobserve(t),Ut.delete(t),t._lazyRegistered=!1}),!1}(t))return void Pt(t,"loading");const r=t.hasAttribute("no-cache"),a=t.getAttribute("cache-key")||s;if(r){if(t._remoteSrc===s&&void 0!==t._remoteData)return void Pt(t,"ready")}else{const e=It.get(a);if(void 0!==e)return t._remoteSrc=s,t._remoteData=e,void Pt(t,"ready");if(t._remoteSrc===s&&"ready"===t._remoteStatus&&void 0!==t._remoteData)return}if(t._remoteSrc===s&&("loading"===t._remoteStatus||"error"===t._remoteStatus))return;Ht(t),t._remoteSrc=s,Pt(t,"loading");let n=zt.get(s);n||(n={hosts:new Set,controller:new AbortController,cacheKey:a,cacheKeys:new Set},zt.set(s,n),n.promise=function(t,e,s){const r=parseInt(t.getAttribute("timeout")||"",10);let a=null,n=s.controller.signal;Number.isFinite(r)&&r>0&&("undefined"!=typeof AbortSignal&&AbortSignal.timeout?n=AbortSignal.any([n,AbortSignal.timeout(r)]):a=setTimeout(()=>s.controller.abort(),r));a&&(t._remoteDeadline=a,t._remoteDeadlineWired||(t._remoteDeadlineWired=!0,i(t,()=>{t._remoteDeadlineWired=!1,clearTimeout(t._remoteDeadline),t._remoteDeadline=null})));const o=()=>{a&&(clearTimeout(a),t._remoteDeadline===a&&(t._remoteDeadline=null))};return fetch(e,{signal:n}).then(t=>{if(o(),!t.ok){const e=new Error(`Could not load (${t.status})`);throw e.name="HttpError",e.status=t.status,e}return t.text()}).then(t=>{try{return JSON.parse(t)}catch(t){const e=new Error(Rt.error);throw e.name="ParseError",e.cause=t,e}})}(t,s,n).then(t=>{zt.get(s)===n&&zt.delete(s),Ot(s,t);for(const e of n.cacheKeys)e&&e!==s&&Ot(e,t);for(const e of n.hosts)e._remoteData=t,e._remoteEntry=null,Pt(e,"ready"),Vt(e,"contour:load",{src:s,count:jt(t)})},t=>{zt.get(s)===n&&zt.delete(s);for(const e of n.hosts)e._remoteEntry=null,Pt(e,"error"),e._remoteError=t&&"HttpError"===t.name?`Could not load (${t.status})`:Rt.error,Vt(e,"contour:error",{src:s,message:e._remoteError,name:t&&t.name,status:t&&t.status})}).finally(()=>{for(const t of n.hosts)t.isConnected&&t.requestRender();n.hosts.clear()})),n.hosts.add(t),!r&&a&&n.cacheKeys.add(a),t._remoteEntry=n,t._remoteDisposeRegistered||(t._remoteDisposeRegistered=!0,i(t,()=>{t._remoteDisposeRegistered=!1,Ht(t)}))}function Jt(t,e){const s=t.getAttribute(e);if(null!==s)return s;const r=t._remoteData;if(null==r)return null;if(Array.isArray(r))return JSON.stringify(r);if("object"==typeof r){const t="string"==typeof e?[e]:e;for(const e of t)if(void 0!==r[e])return"string"==typeof r[e]?r[e]:JSON.stringify(r[e]);return null}return String(r)}let Wt=null;const Ut=new Map;function Kt(t,e,s){const r=document.createElement("div");return r.className="c-"+t+"__"+e,r.dataset.contourState=e,r.textContent=s,r}function Gt(t,e){const s=document.createElement("div");return s.className="c-skeleton "+(0===t&&e>1?"c-skeleton--title":"c-skeleton--text"),s.dataset.contourState="skeleton",s}function Xt(t,e,s){const r=s||{},i=t.getAttribute("loading");if(null!==i||"loading"===t._remoteStatus)return t.appendChild(Kt(e,"loading",i||Bt(t,"loading"))),!0;const a=t.getAttribute("error");if(null!==a||"error"===t._remoteStatus){const s=Kt(e,"error",null!==a&&""!==a?a:t._remoteError||Bt(t,"error"));if(t.hasAttribute("retry")){const e=document.createElement("button");e.type="button",e.className="c-btn c-btn--ghost c-btn--sm",L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-refresh" /></svg>'),e.appendChild(document.createTextNode(" "+(t.getAttribute("retry")||"Retry"))),e.dataset.action="retry",s.appendChild(e)}return t.appendChild(s),!0}if(t.hasAttribute("skeleton")){const e=parseInt(t.getAttribute("skeleton")||"3",10),s=Math.min(r.max||6,Math.max(1,Number.isFinite(e)?e:3));for(let e=0;e<s;e++)t.appendChild(Gt(e,s));return!0}return!1}function Yt(t,e){t.appendChild(Kt(e,"empty",t.getAttribute("empty")||Bt(t,"empty")))}function Qt(t,e,s){const r=t.getAttribute(e);if(!r)return[];try{const i=JSON.parse(r);return Array.isArray(i)?i:(s&&s(t,e,new Error("not an array")),[])}catch(r){return s&&s(t,e,r),[]}}function Zt(t){t._contourStatesWired||(t._contourStatesWired=!0,t.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest('[data-action="retry"]'):null;if(!s||!t.contains(s))return;e.preventDefault();const r=t.getAttribute("src"),i=t.getAttribute("cache-key");i&&It.delete(i),r&&It.delete(r),Ht(t),t._remoteSrc=null,t._remoteData=void 0,Pt(t,"idle"),Vt(t,"contour:retry",{src:r}),t.requestRender()}))}c("contour-card",class extends T{static get observed(){return["title","variant","heading"]}static get properties(){return{title:{attribute:"title"},variant:{attribute:"variant"}}}render(){this.classList.add("c-card");const t=this.getAttribute("variant");Array.from(this.classList).forEach(t=>{t.startsWith("c-card--")&&this.classList.remove(t)}),t&&this.classList.add("c-card--"+t);const e=this.getAttribute("title");if(e){const t=this.ensure(".c-card__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-card__title",t});t.parentNode===this&&this.firstChild!==t&&this.prepend(t),t.textContent=e}else{const t=this.querySelector(".c-card__title");t&&t.remove()}}});c("contour-feature",class extends T{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 t=this.getAttribute("index"),e=this.getAttribute("title"),s=this.getAttribute("body");if(t){this.ensure(".c-feature__index",()=>{const t=document.createElement("span");return t.className="c-feature__index",t}).textContent=t}else{const t=this.querySelector(".c-feature__index");t&&t.remove()}if(e){this.ensure(".c-feature__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-feature__title",t}).textContent=e}else{const t=this.querySelector(".c-feature__title");t&&t.remove()}if(s){this.ensure(".c-feature__body",()=>{const t=document.createElement("p");return t.className="c-feature__body",t}).textContent=s}else{const t=this.querySelector(".c-feature__body");t&&t.remove()}}});c("contour-steps",class extends T{static get observed(){return["steps","current","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","heading","cache-key","no-cache"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current",type:Number},src:{attribute:"src"}}}render(){this.classList.add("c-steps");let t=this.querySelector(".c-steps__list");if(t||(t=document.createElement("ol"),t.className="c-steps__list",t.setAttribute("aria-label",this.getAttribute("aria-label")||"Steps"),this.appendChild(t)),Zt(this),$t(this,"steps"),Xt(this,"steps"))return;const e=Jt(this,"steps"),s=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-steps__item"));if(s.forEach(e=>{e.parentNode!==t&&t.appendChild(e)}),e&&!s.length){Array.from(t.querySelectorAll(".c-steps__item")).forEach(t=>t.remove());try{JSON.parse(e).forEach((e,s)=>{const r=document.createElement("li");r.className="c-steps__item",r.tabIndex=-1;const i="string"==typeof e?e:e.title,a="string"==typeof e?"":e.body;if(i){const t=document.createElement(E(this,"h3"));t.className="c-steps__title",t.textContent=i,r.appendChild(t)}if(a){const t=document.createElement("p");t.className="c-steps__body",t.textContent=a,r.appendChild(t)}t.appendChild(r)})}catch(t){f(this,"attribute",t)}}else e||s.length||Yt(this,"steps");const r=this.getAttribute("current"),i=null!=this._current?this._current:null!=r?parseInt(r,10):NaN,a=Array.from(this.querySelectorAll(".c-steps__item"));a.forEach((t,e)=>{Number.isFinite(i)&&e===i?t.setAttribute("aria-current","step"):t.removeAttribute("aria-current"),t.tabIndex=Number.isFinite(i)&&e===i?0:-1}),a.length&&!Number.isFinite(i)&&(a[0].tabIndex=0)}enhance(){this._wiredSteps||(this._wiredSteps=!0,this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-steps__item"));e.length&&z(t,e,{wrap:!1,homeEnd:!0,rtl:I(this),onNavigate:t=>{this._current=t,e.forEach((e,s)=>{s===t?e.setAttribute("aria-current","step"):e.removeAttribute("aria-current"),e.tabIndex=s===t?0:-1});const s=e[t].querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:!0,composed:!0,detail:{index:t,title:s}}))},onKey:()=>{if("Enter"===t.key||" "===t.key){const t=e.indexOf(document.activeElement),s=document.activeElement.querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-activate",{bubbles:!0,composed:!0,detail:{index:t,title:s}}))}}})}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-steps__item"):null;if(!e||!this.contains(e))return;const s=Array.from(this.querySelectorAll(".c-steps__item")),r=s.indexOf(e);if(r<0)return;this._current=r,s.forEach((t,e)=>{e===r?t.setAttribute("aria-current","step"):t.removeAttribute("aria-current"),t.tabIndex=e===r?0:-1});const i=e.querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-activate",{bubbles:!0,composed:!0,detail:{index:r,title:i}}))}))}});c("contour-link",class extends T{static get observed(){return["href","label"]}static get properties(){return{href:{attribute:"href"},label:{attribute:"label"}}}render(){this.classList.add("c-link");const t=this.getAttribute("href"),e=this.getAttribute("label");if(Array.from(this.querySelectorAll("a[data-contour-generated]")).forEach(t=>t.remove()),t&&e){const s=document.createElement("a");s.dataset.contourGenerated="",s.href=v(t),s.textContent=e;const r=this.getAttribute("aria-label");r&&s.setAttribute("aria-label",r),this.appendChild(s)}}});c("contour-brand",class extends T{static get observed(){return["name","tag"]}static get properties(){return{name:{attribute:"name"},tag:{attribute:"tag"}}}render(){this.classList.add("c-brand");const t=this.getAttribute("name"),e=this.getAttribute("tag");if(t){this.ensure(".c-brand__name",()=>{const t=document.createElement("span");return t.className="c-brand__name",t}).textContent=t}else{const t=this.querySelector(".c-brand__name");t&&t.remove()}if(e){this.ensure(".c-brand__tag",()=>{const t=document.createElement("span");return t.className="c-brand__tag",t}).textContent=e}else{const t=this.querySelector(".c-brand__tag");t&&t.remove()}}});c("contour-section-head",class extends T{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 t=this.getAttribute("title"),e=this.getAttribute("desc");if(!this.querySelector(".c-icon-badge")){const t=document.createElement("div");t.className="c-icon-badge";const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true");const s=document.createElementNS("http://www.w3.org/2000/svg","use");s.setAttribute("href","#i-crosshair"),e.appendChild(s),t.replaceChildren(e),this.prepend(t)}let s=this.querySelector(":scope > div:not(.c-icon-badge)");if(s||(s=document.createElement("div"),this.appendChild(s)),t){const e=this.ensure(".c-section-head__title",()=>{const t=document.createElement(E(this,"h2"));return t.className="c-section-head__title",t});e.textContent=t,e.parentNode!==s&&s.appendChild(e)}else{const t=this.querySelector(".c-section-head__title");t&&t.remove()}if(e){const t=this.ensure(".c-section-head__desc",()=>{const t=document.createElement("p");return t.className="c-section-head__desc",t});t.textContent=e,t.parentNode!==s&&s.appendChild(t)}else{const t=this.querySelector(".c-section-head__desc");t&&t.remove()}}});c("contour-diff",class extends T{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",k(this,"diff","Diff")),Array.from(this.querySelectorAll(".c-diff__line")).forEach(t=>t.remove());const t=(t,e,s,r)=>{const i=document.createElement("div");i.className=t?`c-diff__line c-diff__line--${t}`:"c-diff__line",i.setAttribute("role","listitem"),i.setAttribute("tabindex","0");const a=document.createElement("span");a.className="c-diff__sign",a.textContent=e;const n=document.createElement("span");n.className="c-diff__num",n.setAttribute("aria-hidden","true"),n.textContent=String(r||"");const o=document.createElement("span");return o.textContent=s,i.append(a,n,o),i},e=this.getAttribute("before"),s=this.getAttribute("after");let r=1;e&&String(e).split("\n").forEach(e=>{this.appendChild(t("del","−",e,r++))}),s&&String(s).split("\n").forEach(e=>{this.appendChild(t("add","+",e,r++))})}enhance(){this._wiredDiff||(this._wiredDiff=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-diff__line"):null;if(e&&this.contains(e)){const t=e.classList.contains("c-diff__line--add")?"add":e.classList.contains("c-diff__line--del")?"del":"context",s=e.querySelector("span:last-child")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:diff-activate",{bubbles:!0,composed:!0,detail:{kind:t,text:s}}))}}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-diff__line"):null;e&&this.contains(e)&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click()))}))}});c("contour-do-dont",class extends T{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",k(this,"do-and-dont","Do and don't")),Array.from(this.querySelectorAll(".c-do-dont__item")).forEach(t=>t.remove());const t=(t,e,s)=>{const r=document.createElement("div");r.className=`c-do-dont__item c-do-dont__item--${t}`,r.setAttribute("role","button"),r.setAttribute("tabindex","0");const i=document.createElement("p");i.className="c-do-dont__label",i.textContent=e;const a=document.createElement("p");return a.className="u-muted",a.textContent=s,r.append(i,a),r},e=this.getAttribute("do"),s=this.getAttribute("dont");e&&this.appendChild(t("do","Do",e)),s&&this.appendChild(t("dont","Don't",s))}enhance(){this._wiredDoDont||(this._wiredDoDont=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-do-dont__item"):null;if(e&&this.contains(e)){const t=e.classList.contains("c-do-dont__item--do")?"do":"dont",s=e.querySelector(".u-muted")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:do-dont-activate",{bubbles:!0,composed:!0,detail:{kind:t,text:s}}))}}),Array.from(this.querySelectorAll(".c-do-dont__item")).forEach(t=>{t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.hasAttribute("role")||t.setAttribute("role","button")}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-do-dont__item"):null;e&&this.contains(e)&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click()))}))}});c("contour-flag",class extends T{static get observed(){return["variant","label"]}static get properties(){return{variant:{attribute:"variant"},label:{attribute:"label"}}}render(){this.classList.add("c-flag");const t=this.getAttribute("variant");Array.from(this.classList).forEach(t=>{t.startsWith("c-flag--")&&this.classList.remove(t)}),t&&this.classList.add("c-flag--"+t);const e=this.getAttribute("label");if(e){let t=Array.from(this.childNodes).find(t=>3===t.nodeType);t||(t=document.createTextNode(""),this.appendChild(t)),t.nodeValue=e}}});c("contour-install",class extends T{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 t=this.getAttribute("prompt")||"$",e=this.getAttribute("command")||"";if(e){this.ensure(".c-install__prompt",()=>{const t=document.createElement("span");return t.className="c-install__prompt",t}).textContent=t;if(this.ensure(".c-install__command",()=>{const t=document.createElement("span");return t.className="c-install__command",t}).textContent=e,this.hasAttribute("copyable"))this.ensure(".c-install__copy",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--ghost c-btn--sm c-install__copy",t.type="button",t.setAttribute("aria-label",k(this,"copy-command","Copy command")),t.textContent=k(this,"copy","Copy"),t});else{const t=this.querySelector(".c-install__copy");t&&t.remove()}}}enhance(){wt(this)}});c("contour-testimonial",class extends T{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 t=this.getAttribute("quote");if(t){this.ensure(".c-testimonial__quote",()=>{const t=document.createElement("blockquote");return t.className="c-testimonial__quote",t}).textContent=t}else{const t=this.querySelector(".c-testimonial__quote");t&&t.remove()}const e=this.getAttribute("name"),s=this.getAttribute("role");if(e){const t=this.ensure(".c-testimonial__byline",()=>{const t=document.createElement("figcaption");return t.className="c-testimonial__byline",t}),r=t.querySelector(".c-testimonial__name")||(()=>{const e=document.createElement("cite");return e.className="c-testimonial__name",t.appendChild(e),e})();if(r.className="c-testimonial__name",r.textContent=e,s){const e=t.querySelector(".c-testimonial__role")||(()=>{const e=document.createElement("span");return e.className="c-testimonial__role",t.appendChild(e),e})();e.className="c-testimonial__role",e.textContent=s}else{const e=t.querySelector(".c-testimonial__role");e&&e.remove()}}else{const t=this.querySelector(".c-testimonial__byline");t&&t.remove()}}});c("contour-showcase",class extends T{static get observed(){return["title","text","media","reverse","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","heading","cache-key","no-cache"]}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"),this.setAttribute("role","list"),this.hasAttribute("reverse")?this.classList.add("c-showcase--reverse"):this.classList.remove("c-showcase--reverse");const t=this.getAttribute("title");if(t?this.setAttribute("aria-label",t):this.removeAttribute("aria-label"),this.setAttribute("role","region"),Zt(this),$t(this,"items"),Xt(this,"showcase"))return;const e=Jt(this,"items"),s=this.getAttribute("text"),r=this.getAttribute("media");if(r){const e=this.ensure(".c-showcase__media",()=>{const t=document.createElement("figure");return t.className="c-showcase__media",t});if(/^https?:\/\/|^\/|^\.\/|\.(png|jpg|jpeg|svg|webp|gif|avif)$/i.test(r.trim())){let s=e.querySelector("img");s||(s=document.createElement("img"),e.appendChild(s)),s.src=r.trim(),s.alt=t||""}else L(e,g(r));if(t){let s=e.querySelector(".c-showcase__caption");s||(s=document.createElement("figcaption"),s.className="c-showcase__caption",e.appendChild(s)),s.textContent=t}}else{const t=this.querySelector(".c-showcase__media");t&&t.remove()}if(t){this.ensure(".c-showcase__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-showcase__title",t}).textContent=t}else{const t=this.querySelector(".c-showcase__title");t&&t.remove()}if(s){this.ensure(".c-showcase__text",()=>{const t=document.createElement("p");return t.className="c-showcase__text",t}).textContent=s}else{const t=this.querySelector(".c-showcase__text");t&&t.remove()}const i=this.querySelector(".c-showcase__list"),a=i?Array.from(i.children).filter(t=>"LI"===t.tagName):[];if(e&&!a.length)try{const t=JSON.parse(e),s=this.ensure(".c-showcase__list",()=>{const t=document.createElement("ul");return t.className="c-showcase__list",t});s.replaceChildren(),t.forEach(t=>{const e=document.createElement("li");e.textContent="string"==typeof t?t:t.label||t.title||"",s.appendChild(e)})}catch(t){f(this,"attribute",t)}else e||a.length||t||s||r?!e&&i&&i.remove():Yt(this,"showcase")}enhance(){this._wiredShowcase||(this._wiredShowcase=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-showcase__media"):null;if(e&&this.contains(e)){const t=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:showcase-activate",{bubbles:!0,composed:!0,detail:{title:t}}))}}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest("button, a, input, select, textarea, [role='button'], [role='link'], [role='checkbox'], [role='menuitem'], [role='option'], [role='tab']"):null;if(!(e&&this.contains(e)||"Enter"!==t.key&&" "!==t.key)){if(this.querySelector(".c-showcase__media")){t.preventDefault();const e=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:showcase-activate",{bubbles:!0,composed:!0,detail:{title:e}}))}}}))}});c("contour-pricing",class extends T{static get observed(){return[]}render(){this.classList.add("c-pricing")}});c("contour-recipe",class extends T{static get observed(){return["title","body","canvas","heading","url","tags","head","index"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},canvas:{attribute:"canvas"},url:{attribute:"url"},tags:{attribute:"tags"},head:{attribute:"head"},index:{attribute:"index"}}}render(){this.classList.add("c-recipe");const t=this.getAttribute("url");let e=this.querySelector(".c-recipe__frame");if(t){if(!e){e=document.createElement("div"),e.className="c-recipe__frame";const t=document.createElement("div");t.className="c-recipe__frame-bar";for(let e=0;e<3;e++){const e=document.createElement("span");e.className="c-recipe__frame-dot",t.appendChild(e)}const s=document.createElement("span");s.className="c-recipe__frame-url",t.appendChild(s),e.appendChild(t),this.prepend(e)}const s=e.querySelector(".c-recipe__frame-url");s&&(s.textContent=t)}else e&&e.remove();const s=this.getAttribute("head");if(s){this.ensure(".c-recipe__head",()=>{const t=document.createElement("div");return t.className="c-recipe__head",t}).textContent=s}else{const t=this.querySelector(".c-recipe__head");t&&t.remove()}const r=this.getAttribute("title");if(r){this.ensure(".c-recipe__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-recipe__title",t}).textContent=r}else{const t=this.querySelector(".c-recipe__title");t&&t.remove()}const i=this.getAttribute("index");if(i){this.ensure(".c-recipe__index",()=>{const t=document.createElement("span");return t.className="c-recipe__index",t}).textContent=i}else{const t=this.querySelector(".c-recipe__index");t&&t.remove()}const a=this.getAttribute("body");if(a){this.ensure(".c-recipe__desc",()=>{const t=document.createElement("p");return t.className="c-recipe__desc",t}).textContent=a}else{const t=this.querySelector(".c-recipe__desc");t&&t.remove()}const n=this.getAttribute("tags");if(n){const t=this.ensure(".c-recipe__tags",()=>{const t=document.createElement("div");return t.className="c-recipe__tags",t});t.innerHTML="",n.split(",").map(t=>t.trim()).filter(Boolean).forEach(e=>{const s=document.createElement("span");s.textContent=e,t.appendChild(s)})}else{const t=this.querySelector(".c-recipe__tags");t&&t.remove()}const o=this.getAttribute("canvas");if(o){const t=this.ensure(".c-recipe__canvas",()=>{const t=document.createElement("div");return t.className="c-recipe__canvas",t});if(/^https?:\/\/|^\/|^\.\/|\.(png|jpg|jpeg|svg|webp|gif|avif)$/i.test(o.trim())){let e=t.querySelector("img");e||(e=document.createElement("img"),t.appendChild(e)),e.src=o.trim(),e.alt=""}else L(t,g(o))}else{const t=this.querySelector(".c-recipe__canvas");t&&t.remove()}}});c("contour-logos",class extends T{static get observed(){return[]}render(){this.classList.add("c-logos")}});c("contour-landing-features",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-landing-features"),Zt(this),$t(this,"items"),Xt(this,"landing-features"))return;const t=Jt(this,"items"),e=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-landing-features__item"));if(t&&!e.length)try{const e=JSON.parse(t);this.querySelectorAll(".c-landing-features__item").forEach(t=>t.remove()),e.forEach(t=>{const e=document.createElement("div");if(e.className="c-landing-features__item",t.icon){const s=document.createElement("span");s.className="c-landing-features__icon";const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("aria-hidden","true");const i=document.createElementNS("http://www.w3.org/2000/svg","use");i.setAttribute("href","#"+String(t.icon).replace(/[^a-zA-Z0-9_-]/g,"")),r.appendChild(i),s.appendChild(r),e.appendChild(s)}if(t.title){const s=document.createElement("span");s.className="c-landing-features__title",s.textContent=t.title,e.appendChild(s)}if(t.text){const s=document.createElement("p");s.className="c-landing-features__text",s.textContent=t.text,e.appendChild(s)}this.appendChild(e)})}catch(t){f(this,"attribute",t)}else t||e.length||(this.querySelectorAll(".c-landing-features__item").forEach(t=>t.remove()),Yt(this,"landing-features"))}});c("contour-landing-hero",class extends T{static get observed(){return["actions","title","text","heading","preview"]}static get properties(){return{actions:{attribute:"actions"},title:{attribute:"title"},text:{attribute:"text"},preview:{attribute:"preview"}}}render(){this.classList.add("c-landing-hero");const t=this.getAttribute("preview");let e=this.querySelector(".c-landing-hero__preview");if(t){if(!e){e=document.createElement("div"),e.className="c-landing-hero__preview";const t=document.createElement("div");t.className="c-landing-hero__preview-bar";for(let e=0;e<3;e++){const e=document.createElement("span");e.className="c-landing-hero__preview-dot",t.appendChild(e)}const s=document.createElement("div");s.className="c-landing-hero__preview-body",e.appendChild(t),e.appendChild(s),this.appendChild(e)}const s=e.querySelector(".c-landing-hero__preview-body");if(s)if(/^https?:\/\/|^\/|^\.\/|\.(png|jpg|jpeg|svg|webp|gif|avif)$/i.test(t.trim())){s.innerHTML="";const e=document.createElement("img");e.src=t.trim(),e.alt="",s.appendChild(e)}else L(s,g(t))}else e&&e.remove();const s=this.getAttribute("title");if(s){this.ensure(".c-landing-hero__title",()=>{const t=document.createElement(E(this,"h2"));return t.className="c-landing-hero__title",t}).textContent=s}const r=this.getAttribute("text");if(r){this.ensure(".c-landing-hero__text",()=>{const t=document.createElement("p");return t.className="c-landing-hero__text",t}).textContent=r}const i=this.getAttribute("actions"),a=this.querySelector(".c-landing-hero__actions"),n=a?Array.from(a.children):[];if(i&&!n.length){const t=this.ensure(".c-landing-hero__actions",()=>{const t=document.createElement("div");return t.className="c-landing-hero__actions",t});try{const e=JSON.parse(i);Array.isArray(e)?(t.replaceChildren(),e.forEach(e=>{const s=document.createElement(e.href?"a":"button");s.className="c-btn"+(e.primary?" c-btn--primary":""),e.href?s.href=v(e.href):s.type="button",s.textContent=e.label||e.text||"",t.appendChild(s)})):L(t,g(i))}catch(e){L(t,g(i))}}else i||!a||n.length||a.remove()}});c("contour-linkish",class extends T{static get observed(){return[]}render(){this.classList.add("c-linkish")}});c("contour-price",class extends T{static get observed(){return["value","format","locale"]}static get properties(){return{value:{attribute:"value"},format:{attribute:"format"},locale:{attribute:"locale"}}}render(){this.classList.add("c-price");const t=this.getAttribute("value");let e=this.querySelector(".c-price__amount");t?(e||(e=document.createElement("span"),e.className="c-price__amount",this.appendChild(e)),e.textContent=B(t,this.getAttribute("format"),this.getAttribute("locale"))):e&&e.remove()}});c("contour-prose",class extends T{static get observed(){return[]}render(){this.classList.add("c-prose")}});c("contour-panel",class extends T{static get observed(){return["title","subtitle","status","heading","collapsible","collapsed","flush"]}static get properties(){return{title:{attribute:"title"},subtitle:{attribute:"subtitle"},status:{attribute:"status"},collapsible:{attribute:"collapsible",type:Boolean},collapsed:{attribute:"collapsed",type:Boolean},flush:{attribute:"flush",type:Boolean}}}render(){this.classList.add("c-panel"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Panel");const t=this.getAttribute("title"),e=this.getAttribute("subtitle"),s=this.getAttribute("status");if(t){const e=this.ensure(".c-panel__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-panel__title",t});e.parentNode===this&&this.firstChild!==e&&this.prepend(e),e.textContent=t}else{const t=this.querySelector(".c-panel__title");t&&t.remove()}if(e){this.ensure(".c-panel__subtitle",()=>{const t=document.createElement("p");return t.className="c-panel__subtitle",t}).textContent=e}else{const t=this.querySelector(".c-panel__subtitle");t&&t.remove()}if(s){const t=this.ensure(".c-panel__status",()=>{const t=document.createElement("span");return t.className="c-panel__status",t});Array.from(t.classList).forEach(e=>{e.startsWith("c-panel__status--")&&t.classList.remove(e)}),"error"!==s&&"live"!==s||t.classList.add("c-panel__status--"+s),t.textContent=s}else{const t=this.querySelector(".c-panel__status");t&&t.remove()}if(this.hasAttribute("collapsible")){let t=this.querySelector(".c-panel__collapse");t||(t=document.createElement("button"),t.type="button",t.className="c-panel__collapse c-btn c-btn--ghost c-btn--sm",t.setAttribute("aria-label",k(this,"collapse","Toggle panel")),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24" width="16" height="16"><use href="#i-chevron-down" /></svg>'),this.appendChild(t)),this.hasAttribute("collapsed")?(this.classList.add("c-panel--collapsed"),t.setAttribute("aria-expanded","false"),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24" width="16" height="16"><use href="#i-chevron-right" /></svg>')):(this.classList.remove("c-panel--collapsed"),t.setAttribute("aria-expanded","true"),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24" width="16" height="16"><use href="#i-chevron-down" /></svg>'))}else{const t=this.querySelector(".c-panel__collapse");t&&t.remove(),this.classList.remove("c-panel--collapsed")}const r=this.ensure(".c-panel__body",()=>{const t=document.createElement("div");return t.className="c-panel__body",t});r.classList.toggle("c-panel__body--flush",this.hasAttribute("flush"));const i=this.querySelector(".c-panel__head"),a=this.querySelector(".c-panel__collapse");Array.from(this.childNodes).forEach(t=>{t!==r&&t!==i&&(1===t.nodeType&&(t.classList.contains("c-panel__title")||t.classList.contains("c-panel__subtitle")||t.classList.contains("c-panel__status"))||t!==a&&r.appendChild(t))}),r.parentNode||this.appendChild(r),i&&i.parentNode===this&&r.parentNode===this&&i.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_PRECEDING&&this.insertBefore(r,i.nextSibling)}enhance(){this._wiredPanel||(this._wiredPanel=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-panel__collapse"):null;e&&this.contains(e)&&(t.preventDefault(),this.toggleAttribute("collapsed"),this.dispatchEvent(new CustomEvent("contour:collapse",{bubbles:!0,composed:!0,detail:{collapsed:this.hasAttribute("collapsed")}})))}))}});c("contour-cta",class extends T{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 t=this.getAttribute("title"),e=this.getAttribute("text");if(t){this.ensure(".c-cta__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-cta__title",t}).textContent=t}else{const t=this.querySelector(".c-cta__title");t&&t.remove()}if(e){this.ensure(".c-cta__text",()=>{const t=document.createElement("p");return t.className="c-cta__text",t}).textContent=e}else{const t=this.querySelector(".c-cta__text");t&&t.remove()}const s=this.getAttribute("actions"),r=this.querySelector(".c-cta__actions");if(r&&r.remove(),s)try{const t=JSON.parse(s),e=document.createElement("div");e.className="c-cta__actions";let r=!1;t.forEach(t=>{const s="string"==typeof t?t:t.label||t,i="object"==typeof t&&t?t.href:null,a=!("object"!=typeof t||!t)&&t.primary&&!r;a&&(r=!0);const n=document.createElement(i?"a":"button");n.className=a?"c-btn c-btn--primary":"c-btn c-btn--ghost",i?(n.href=v(i),n.setAttribute("role","button")):n.type="button",n.textContent=s,e.appendChild(n)}),this.appendChild(e)}catch(t){f(this,"attribute",t)}}});c("contour-code",class extends T{static get observed(){return["title","copyable","numbered"]}static get properties(){return{title:{attribute:"title"},copyable:{attribute:"copyable",type:Boolean},numbered:{attribute:"numbered",type:Boolean}}}render(){this.classList.add("c-code");const t=this.getAttribute("title");if(t){const e=this.ensure(".c-code__head",()=>{const t=document.createElement("div");return t.className="c-code__head",t});e.parentNode===this&&this.firstChild!==e&&this.prepend(e);(e.querySelector(".c-code__title")||(()=>{const t=document.createElement("div");return t.className="c-code__title",e.appendChild(t),t})()).textContent=t}else{const t=this.querySelector(".c-code__head");t&&t.remove();const e=this.querySelector(".c-code__title");e&&e.remove()}if(this.hasAttribute("copyable")){const t=this.ensure(".c-code__head",()=>{const t=document.createElement("div");return t.className="c-code__head",t});this.ensure(".c-code__copy",()=>{const e=document.createElement("button");return e.className="c-btn c-btn--ghost c-btn--sm c-code__copy",e.type="button",L(e,'<svg aria-hidden="true" viewBox="0 0 24 24" width="14" height="14"><use href="#i-copy" /></svg>'),e.setAttribute("aria-label",k(this,"copy","Copy")),t.appendChild(e),e})}else{const t=this.querySelector(".c-code__copy");t&&t.remove()}const e=this.ensure("pre",()=>document.createElement("pre"));if(Array.from(this.childNodes).forEach(t=>{t===e||1===t.nodeType&&(t.classList.contains("c-code__head")||t.classList.contains("c-code__copy"))||e.appendChild(t)}),!e.querySelector("code")){const t=document.createElement("code");for(;e.firstChild;)t.appendChild(e.firstChild);e.appendChild(t)}e.parentNode!==this&&this.appendChild(e);const s=this.querySelector(".c-code__head");s&&s.parentNode===this&&e.parentNode===this&&s.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING&&this.insertBefore(e,s.nextSibling);const r=this.hasAttribute("numbered");this.classList.toggle("c-code--numbered",r);const i=e.querySelector("code");if(i){const t="1"===i.dataset.contourLines;r&&!t?((t=>{const e=[[]];let s=e[0];const r=(t,i)=>{if(3===t.nodeType)return void String(t.textContent||"").split("\n").forEach((t,r)=>{r&&(s=[],e.push(s)),t&&s.push({chain:i,text:t})});if(1!==t.nodeType)return;const a=i.concat(t);Array.from(t.childNodes).forEach(t=>r(t,a))};if(Array.from(t.childNodes).forEach(t=>r(t,[])),!e[e.length-1].length&&e.length>1&&e.pop(),!e.length)return;const i=document.createDocumentFragment();e.forEach((t,e)=>{const s=document.createElement("span");s.className="c-code__line",s.setAttribute("data-contour-generated","line");const r=[];for(const e of t){for(let t=0;t<e.chain.length;t++)if(!r[t]||r[t]._contourSrc!==e.chain[t]){const i=e.chain[t].cloneNode(!1);i._contourSrc=e.chain[t],0===t?s.appendChild(i):r[t-1].appendChild(i),r[t]=i,r.length=t+1}(e.chain.length?r[e.chain.length-1]:s).appendChild(document.createTextNode(e.text))}const a=document.createElement("span");a.className="c-code__line-number",a.setAttribute("aria-hidden","true"),a.textContent=String(e+1),s.prepend(a),i.appendChild(s)}),t.textContent="",t.appendChild(i)})(i),i.dataset.contourLines="1"):!r&&t&&((t=>{const e=document.createDocumentFragment();Array.from(t.querySelectorAll(".c-code__line")).forEach(t=>{Array.from(t.childNodes).forEach(t=>{t.classList&&t.classList.contains("c-code__line-number")||e.appendChild(t)}),e.appendChild(document.createTextNode("\n"))}),t.textContent="",t.appendChild(e)})(i),delete i.dataset.contourLines)}}enhance(){wt(this)}});c("contour-plate",class extends T{static get observed(){return[]}render(){this.classList.add("c-plate")}});c("contour-pullquote",class extends T{static get observed(){return["quote","name"]}static get properties(){return{quote:{attribute:"quote"},name:{attribute:"name"}}}render(){this.classList.add("c-pullquote");const t=this.getAttribute("quote");if(t){Array.from(this.childNodes).forEach(t=>{3===t.nodeType&&t.remove()});const e=this.querySelector("cite");this.insertBefore(document.createTextNode(t),e)}const e=this.getAttribute("name");if(e){this.ensure("cite",()=>{const t=document.createElement("cite");return this.appendChild(t),t}).textContent=e}else{const t=this.querySelector("cite");t&&t.remove()}}});c("contour-anchor",class extends T{static get observed(){return["href","label"]}static get properties(){return{href:{attribute:"href"},label:{attribute:"label"}}}render(){this.classList.add("c-anchor");const t=this.getAttribute("href"),e=this.getAttribute("label");if(Array.from(this.querySelectorAll("a[data-contour-generated]")).forEach(t=>t.remove()),t&&e){const s=document.createElement("a");s.dataset.contourGenerated="",s.href=v(t),s.textContent=e;const r=this.getAttribute("aria-label");r&&s.setAttribute("aria-label",r),this.appendChild(s)}}});c("contour-geocoder",class extends T{static get observed(){return["placeholder","value","results","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{placeholder:{attribute:"placeholder"},value:{attribute:"value"},results:{attribute:"results"},src:{attribute:"src"}}}render(){if(this.classList.add("c-geocoder"),Zt(this),$t(this,["results"]),Xt(this,"geocoder"))return;let t=this.querySelector(".c-geocoder__input");t||(t=document.createElement("input"),t.type="search",t.className="c-input c-geocoder__input",t.hasAttribute("aria-label")||t.setAttribute("aria-label",this.getAttribute("placeholder")||"Search location"),t.setAttribute("role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded","false"),this.appendChild(t));const e=this.getAttribute("placeholder");e&&t.setAttribute("placeholder",e);const s=this.getAttribute("value");null!==s&&t.value!==s&&(t.value=s),Array.from(this.querySelectorAll(".c-geocoder__result")).forEach(t=>t.remove()),Array.from(this.querySelectorAll(".c-geocoder__list")).forEach(t=>t.remove());let r=[];const i=this.getAttribute("results");if(i)try{r=JSON.parse(i)}catch(t){r=[]}const a=Jt(this,"results");if("string"==typeof a)try{const t=JSON.parse(a);Array.isArray(t)&&(r=t)}catch(t){}else Array.isArray(a)&&(r=a);if(Array.isArray(r)&&r.length){this._geocoderIndex=-1,this._geocoderListId||(this._geocoderListId=o("geocoder-list"));const e=document.createElement("ul");e.className="c-geocoder__list",e.id=this._geocoderListId,e.setAttribute("role","listbox"),r.forEach((t,s)=>{const r=document.createElement("li");r.className="c-geocoder__result",r.id=this._geocoderListId+"-"+s,r.setAttribute("role","option"),r.setAttribute("aria-selected","false"),r.setAttribute("tabindex","-1"),r.textContent="object"==typeof t?t.label||t.name||"":String(t),"object"==typeof t&&(null!=t.lat&&(r.dataset.lat=String(t.lat)),null!=t.lon&&(r.dataset.lon=String(t.lon))),e.appendChild(r)}),this.appendChild(e),t.setAttribute("aria-controls",this._geocoderListId),t.setAttribute("aria-expanded","true")}else if(t.removeAttribute("aria-controls"),t.setAttribute("aria-expanded","false"),t.removeAttribute("aria-activedescendant"),this._geocoderIndex=-1,!this.hasAttribute("loading")&&!this.hasAttribute("error")){const t=this.querySelector(".c-geocoder__input");t&&t.value&&Yt(this,"geocoder")}}enhance(){if(this._wiredGeocoder)return;this._wiredGeocoder=!0;const t=this.querySelector(".c-geocoder__input");"number"!=typeof this._geocoderIndex&&(this._geocoderIndex=-1);const e=()=>Array.from(this.querySelectorAll(".c-geocoder__result")),s=()=>{const t=e(),s=this._geocoderIndex;return s>=0&&s<t.length?t[s]:null},r=s=>{const r=e();if(!r.length)return;const i=Math.max(0,Math.min(r.length-1,Number.isFinite(s)?s:0));r.forEach((t,e)=>t.setAttribute("aria-selected",e===i?"true":"false")),this._geocoderIndex=i,t&&(i>=0?t.setAttribute("aria-activedescendant",r[i].id):t.removeAttribute("aria-activedescendant"))},i=()=>{this._geocoderIndex=-1,e().forEach(t=>t.setAttribute("aria-selected","false")),t&&t.removeAttribute("aria-activedescendant")},a=t=>{if(!t)return;const e={label:t.textContent.trim(),lat:t.dataset.lat?Number(t.dataset.lat):void 0,lon:t.dataset.lon?Number(t.dataset.lon):void 0};this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{result:e}}))};t&&(this.addEventListener("input",e=>{e.target===t&&(i(),this._geocoderTimer&&clearTimeout(this._geocoderTimer),this._geocoderTimer=setTimeout(()=>{this._geocoderTimer=null,this.isConnected&&this.dispatchEvent(new CustomEvent("contour:search",{bubbles:!0,composed:!0,detail:{query:t.value}}))},200))}),this.addEventListener("keydown",n=>{if(n.target!==t)return;const o=e();if("ArrowDown"===n.key||"ArrowUp"===n.key){if(!o.length)return;n.preventDefault();const t=this._geocoderIndex<0?"ArrowDown"===n.key?-1:o.length:this._geocoderIndex;return void r(t+("ArrowDown"===n.key?1:-1))}if("Enter"===n.key){n.preventDefault();const e=s();return void(e?(a(e),t.setAttribute("aria-expanded","false"),t.removeAttribute("aria-controls"),i()):this.dispatchEvent(new CustomEvent("contour:search",{bubbles:!0,composed:!0,detail:{query:t.value}})))}if("Escape"===n.key&&o.length&&"true"===t.getAttribute("aria-expanded")){n.preventDefault(),i(),t.setAttribute("aria-expanded","false"),t.removeAttribute("aria-controls");const e=this.querySelector(".c-geocoder__list");e&&e.remove()}})),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-geocoder__result"):null;e&&this.contains(e)&&a(e)}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-geocoder__result"):null;e&&this.contains(e)&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a(e)))})}disconnectedCallback(){this._geocoderTimer&&(clearTimeout(this._geocoderTimer),this._geocoderTimer=null),super.disconnectedCallback()}});c("contour-dash-shell",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-dash-shell"),this.setAttribute("role","region");const t=this.getAttribute("title");if(t){const e=this.ensure(".c-dash-toolbar",()=>{const t=document.createElement("div");return t.className="c-dash-toolbar",t});e.parentNode===this&&this.firstChild!==e&&this.prepend(e);(e.querySelector(".c-dash-toolbar__title")||(()=>{const t=document.createElement("span");return t.className="c-dash-toolbar__title",e.appendChild(t),t})()).textContent=t,this.setAttribute("aria-label",t)}}});c("contour-dash-toolbar",class extends T{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 t=this.getAttribute("title");if(t){this.ensure(".c-dash-toolbar__title",()=>{const t=document.createElement("span");return t.className="c-dash-toolbar__title",t}).textContent=t,this.setAttribute("aria-label",t)}else{const t=this.querySelector(".c-dash-toolbar__title");t&&t.remove()}const e=this.getAttribute("actions");if(e)try{const t=JSON.parse(e),s=this.ensure(".c-dash-toolbar__actions",()=>{const t=document.createElement("div");return t.className="c-dash-toolbar__actions",t});s.innerHTML="",t.forEach(t=>{const e=document.createElement("button");e.className="c-btn c-btn--ghost c-btn--sm",e.type="button",e.textContent="string"==typeof t?t:t.label||t,s.appendChild(e)})}catch(t){f(this,"attribute",t)}else{const t=this.querySelector(".c-dash-toolbar__actions");t&&t.remove()}}enhance(){this._wiredDashToolbar||(this._wiredDashToolbar=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-btn"):null;if(e&&this.contains(e)){const t=e.textContent||"";this.dispatchEvent(new CustomEvent("contour:dash-action",{bubbles:!0,composed:!0,detail:{label:t}}))}}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-btn"):null;if(!e||!this.contains(e))return;const s=Array.from(this.querySelectorAll(".c-btn")),r=s.indexOf(e);let i=-1;if("ArrowRight"===t.key?i=Math.min(s.length-1,r+1):"ArrowLeft"===t.key&&(i=Math.max(0,r-1)),i>=0){t.preventDefault();try{s[i].focus()}catch(t){}}else"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())}))}});c("contour-dash-kpi-row",class extends T{static get observed(){return["items","title"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-dash-kpi-row"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"KPI row"),Array.from(this.querySelectorAll("contour-kpi[data-contour-generated]")).forEach(t=>t.remove());const t=this.getAttribute("items");let e=null;if(t)try{e=JSON.parse(t)}catch(t){e=null}if(Array.isArray(e)&&e.length){const t=["value","label","delta","direction","note","unit","format","variant","thresholds","threshold","sparkline","polarity","locale"];e.forEach((e,s)=>{const r=document.createElement("contour-kpi");if("object"==typeof e&&null!==e)for(const s of t){const t=e[s];null!=t&&r.setAttribute(s,"string"==typeof t?t:JSON.stringify(t))}else r.setAttribute("value",String(e));r.setAttribute("tabindex",0===s?"0":"-1"),r.dataset.contourGenerated="",this.appendChild(r)})}}enhance(){this._wiredDashKpiRow||(this._wiredDashKpiRow=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("contour-kpi"):null;if(e&&this.contains(e)){const t=Array.from(this.querySelectorAll("contour-kpi")).indexOf(e);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:t}}))}}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll("contour-kpi"));e.length&&z(t,e,{wrap:!0,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:t}}))},onKey:(t,e)=>{"Enter"!==t&&" "!==t||this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:e}}))}})}))}});c("contour-dash-freshness",class extends T{static get observed(){return["label","value","format","locale"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},format:{attribute:"format"},locale:{attribute:"locale"}}}render(){this.classList.add("c-dash-freshness"),this.setAttribute("role","status"),this.setAttribute("aria-live","polite");const t=this.getAttribute("label"),e=this.getAttribute("value"),s=this.ensure(".c-dot",()=>{const t=document.createElement("span");return t.className="c-dot c-dot--live c-dot--accent",t.setAttribute("aria-hidden","true"),t});s.parentNode!==this&&this.appendChild(s),this._freshnessText&&this._freshnessText.parentNode||(this._freshnessText=document.createTextNode(""),this.appendChild(this._freshnessText));const r=e?B(e,this.getAttribute("format"),this.getAttribute("locale")):e;this._freshnessText.nodeValue=[t,r].filter(Boolean).join(" ")}});c("contour-saved-view",class extends T{static get observed(){return["name","updated","source","active"]}static get properties(){return{name:{attribute:"name"},updated:{attribute:"updated"},source:{attribute:"source"},active:{attribute:"active",type:Boolean}}}render(){this.classList.add("c-saved-view"),this.setAttribute("role","region"),this.getAttribute("name")&&this.setAttribute("aria-label",this.getAttribute("name")),this.hasAttribute("active")?this.classList.add("c-saved-view--active"):this.classList.remove("c-saved-view--active");const t=this.ensure(".c-saved-view__thumb",()=>{const t=document.createElement("div");return t.className="c-saved-view__thumb",t});t.setAttribute("role","img"),t.setAttribute("aria-label",`${k(this,"preview","Preview")} — ${this.getAttribute("name")||k(this,"unnamed","Saved view")}`),t.parentNode!==this&&this.appendChild(t);this.ensure(".c-saved-view__name",()=>{const t=document.createElement("div");return t.className="c-saved-view__name",t}).textContent=this.getAttribute("name")||"Saved view";let e=this.querySelector(".c-saved-view__meta");e||(e=document.createElement("div"),e.className="c-saved-view__meta",this.appendChild(e));const s=this.getAttribute("updated"),r=this.getAttribute("source");if(e.replaceChildren(),s){const t=document.createElement("span");t.textContent=`Updated ${s}`,e.appendChild(t)}if(r){e.childNodes.length&&e.appendChild(document.createTextNode(" · "));const t=document.createElement("span");t.textContent=`${k(this,"source","Source")}: ${r}`,e.appendChild(t)}let i=this.querySelector(".c-saved-view__actions");i||(i=document.createElement("div"),i.className="c-saved-view__actions",this.appendChild(i));q(i.querySelector(".c-saved-view__apply")||(()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--ghost c-btn--sm",t.setAttribute("data-saved-view-apply",""),i.appendChild(t),t})(),this,"apply","Apply");q(i.querySelector(".c-saved-view__remove")||(()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--ghost c-btn--sm",t.setAttribute("data-saved-view-remove",""),i.appendChild(t),t})(),this,"remove","Remove")}enhance(){this._wiredSavedView||(this._wiredSavedView=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("button"):null;e&&this.contains(e)&&(e.hasAttribute("data-saved-view-apply")?this.dispatchEvent(new CustomEvent("contour:apply",{bubbles:!0,composed:!0,detail:{name:this.getAttribute("name")}})):e.hasAttribute("data-saved-view-remove")&&this.dispatchEvent(new CustomEvent("contour:remove",{bubbles:!0,composed:!0,detail:{name:this.getAttribute("name")}})))}))}});c("contour-provenance",class extends T{static get observed(){return["source","confidence","resolution","coverage","warning","methodology"]}static get properties(){return{source:{attribute:"source"},confidence:{attribute:"confidence"},resolution:{attribute:"resolution"},coverage:{attribute:"coverage"},warning:{attribute:"warning"},methodology:{attribute:"methodology"}}}render(){this.classList.add("c-provenance"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"provenance","Data provenance")),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite");const t=this.getAttribute("source");if(t){const e=this.ensure(".c-provenance__source",()=>{const t=document.createElement("span");return t.className="c-provenance__source",t}),s=document.createElement("b");s.textContent=k(this,"source","Source")+":",e.replaceChildren(s,document.createTextNode(" "+t))}else{const t=this.querySelector(".c-provenance__source");t&&t.remove()}const e=this.getAttribute("confidence");if(e){const t=this.ensure(".c-provenance__confidence",()=>{const t=document.createElement("span");return t.className="c-provenance__confidence",t}),s=String(e).toLowerCase(),r="high"===s||"medium"===s||"low"===s;t.className="c-provenance__confidence"+(r?" c-provenance__confidence--"+s:" c-provenance__confidence--unknown"),t.textContent=`Confidence: ${e}`}else{const t=this.querySelector(".c-provenance__confidence");t&&t.remove()}const s=this.getAttribute("resolution");if(s){this.ensure(".c-provenance__resolution",()=>{const t=document.createElement("span");return t.className="c-provenance__resolution",t}).textContent=`Resolution: ${s}`}else{const t=this.querySelector(".c-provenance__resolution");t&&t.remove()}const r=this.getAttribute("coverage");if(r){this.ensure(".c-provenance__coverage",()=>{const t=document.createElement("span");return t.className="c-provenance__coverage",t}).textContent=`Coverage: ${r}`}else{const t=this.querySelector(".c-provenance__coverage");t&&t.remove()}const i=this.getAttribute("methodology");if(i){this.ensure(".c-provenance__methodology",()=>{const t=document.createElement("span");return t.className="c-provenance__methodology",t}).textContent=`Methodology: ${i}`}else{const t=this.querySelector(".c-provenance__methodology");t&&t.remove()}const a=this.getAttribute("warning");if(a){this.ensure(".c-provenance__warning",()=>{const t=document.createElement("span");return t.className="c-provenance__warning",t}).textContent=`Warning: ${a}`}else{const t=this.querySelector(".c-provenance__warning");t&&t.remove()}}});c("contour-feature-inspector",class extends T{static get observed(){return["title","open","data","actions"]}static get properties(){return{title:{attribute:"title"},open:{attribute:"open",type:Boolean},data:{attribute:"data"}}}render(){this.classList.add("c-feature-inspector"),this.hasAttribute("role")||this.setAttribute("role","region"),this.getAttribute("title")&&this.setAttribute("aria-label",this.getAttribute("title"));const t=this.getAttribute("open");null!==t&&"false"!==t?this.setAttribute("open",""):this.removeAttribute("open");this.ensure(".c-feature-inspector__head",()=>{const t=document.createElement("div");return t.className="c-feature-inspector__head",t});this.ensure(".c-feature-inspector__title",()=>{const t=document.createElement("span");return t.className="c-feature-inspector__title",t}).textContent=k(this,"title",this.getAttribute("title")||"Feature inspector");const e=this.ensure(".c-feature-inspector__body",()=>{const t=document.createElement("div");return t.className="c-feature-inspector__body",t});this.querySelectorAll(".c-feature-inspector__field").forEach(t=>t.remove());const s=this.getAttribute("data");if(s)try{const t=JSON.parse(s);if(t&&"object"==typeof t&&!Array.isArray(t))for(const[s,r]of Object.entries(t)){const t=document.createElement("div");t.className="c-feature-inspector__field";const i=document.createElement("span");i.className="c-feature-inspector__label",i.textContent=s;const a=document.createElement("span");a.className="c-feature-inspector__value",a.textContent=String(r),t.appendChild(i),t.appendChild(a),e.appendChild(t)}}catch(t){f(this,"attribute",t)}const r=this.ensure(".c-feature-inspector__actions",()=>{const t=document.createElement("div");return t.className="c-feature-inspector__actions",t});Array.from(r.querySelectorAll("[data-inspect-action]")).forEach(t=>t.remove());const i=this.getAttribute("actions");if(i)try{const t=JSON.parse(i);Array.isArray(t)&&t.forEach(t=>{const e=document.createElement("button");e.type="button",e.className="c-btn c-btn--sm c-feature-inspector__action",e.setAttribute("data-inspect-action",""),e.textContent="string"==typeof t?t:t&&(t.label||t.action)||"",t&&"object"==typeof t&&void 0!==t.value&&e.setAttribute("data-action",String(t.value)),r.appendChild(e)})}catch(t){f(this,"attribute",t)}r.style.display=r.hasChildNodes()?"":"none"}enhance(){this._wiredFeatureInspector||(this._wiredFeatureInspector=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("button"):null;e&&this.contains(e)&&this.dispatchEvent(new CustomEvent("contour:inspect-action",{bubbles:!0,composed:!0,detail:{label:e.textContent||"",value:e.getAttribute("data-action")||""}}))}))}});c("contour-readout",class extends T{static get observed(){return["rows","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","format","locale","unit","precision","cache-key","no-cache"]}static get properties(){return{rows:{attribute:"rows"},format:{attribute:"format"},locale:{attribute:"locale"},precision:{attribute:"precision"},src:{attribute:"src"}}}render(){if(this.classList.add("c-readout"),Zt(this),$t(this,"rows"),Xt(this,"readout"))return;const t=Jt(this,"rows");Array.from(this.querySelectorAll(".c-readout__row")).forEach(t=>t.remove());const e=Array.from(this.children).filter(t=>!t.classList||!t.classList.contains("c-readout__row"));if(t&&!e.length)try{JSON.parse(t).forEach(t=>{const e=document.createElement("div");e.className="c-readout__row";const s=document.createElement("span");s.className="c-readout__key",s.textContent=t.key||t[0];const r=document.createElement("span");r.className="c-readout__value"+(t.primary?" c-readout__value--primary":"")+(t.accent?" c-readout__value--accent":"")+(t.coord?" c-readout__value--coord":""),r.setAttribute("aria-live","polite");const i=void 0!==t.value?t.value:t[1],a=void 0!==t.precision?t.precision:this.getAttribute("precision");null!==a&&""!==a&&(r.dataset.precision=String(a));const n=null!==a&&""!==a&&"number"==typeof i&&Number.isFinite(i)?i.toFixed(Math.max(0,Math.min(20,Number(a)||0))):i;if(r.textContent=B(n,this.getAttribute("format"),this.getAttribute("locale"),void 0!==t.unit?t.unit:this.getAttribute("unit")),e.appendChild(s),e.appendChild(r),t.order){const s=document.createElement("span");s.className="c-readout__order",s.textContent=t.order,e.appendChild(s)}this.appendChild(e)})}catch(t){f(this,"attribute",t)}else t||e.length||Yt(this,"readout")}});c("contour-kpi",class extends T{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","cache-key","no-cache"]}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(){if(this.classList.add("c-kpi"),Zt(this),$t(this,["value","label"]),Xt(this,"kpi"))return;const t=Jt(this,"value"),e=Jt(this,"label"),s=this.getAttribute("delta"),r=this.getAttribute("variant");if(Array.from(this.classList).forEach(t=>{t.startsWith("c-kpi--")&&this.classList.remove(t)}),r&&this.classList.add("c-kpi--"+r),t){this.ensure(".c-kpi__value",()=>{const t=document.createElement("div");return t.className="c-kpi__value",t.setAttribute("aria-live","polite"),t}).textContent=B(t,this.getAttribute("format"),this.getAttribute("locale"),this.getAttribute("unit"))}else{const t=this.querySelector(".c-kpi__value");t&&t.remove()}if(e){const t=this.ensure(".c-kpi__head",()=>{const t=document.createElement("div");return t.className="c-kpi__head",t});let s=t.querySelector(".c-kpi__label");s||(s=document.createElement("div"),s.className="c-kpi__label",t.appendChild(s)),s.textContent=e,t.parentNode!==this&&this.insertBefore(t,this.firstChild)}else{const t=this.querySelector(".c-kpi__head");t&&t.remove()}if(s){const t=this.ensure(".c-kpi__foot",()=>{const t=document.createElement("div");return t.className="c-kpi__foot",t}),e=t.querySelector(".c-delta")||document.createElement("span");e.parentNode||t.insertBefore(e,t.firstChild);const r=this.getAttribute("direction")||"up",i=this.getAttribute("polarity")||"neutral";let a="neutral";"good"===i||"up-good"===i||"auto"===i?a="up"===r?"good":"down"===r?"bad":"neutral":"bad"!==i&&"down-good"!==i||(a="up"===r?"bad":"down"===r?"good":"neutral"),e.className="c-delta c-delta--"+r+" c-delta--"+a,e.textContent="";const n={up:"#i-arrow-up",down:"#i-arrow-down",flat:"#i-minus"}[r]||"#i-arrow-up",o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("aria-hidden","true");const c=document.createElementNS("http://www.w3.org/2000/svg","use");c.setAttribute("href",n),o.appendChild(c),e.appendChild(o),e.appendChild(document.createTextNode(" "+s))}else{const t=this.querySelector(".c-kpi__foot .c-delta");t&&t.remove()}const a=this.getAttribute("note");if(a){const t=this.ensure(".c-kpi__foot",()=>{const t=document.createElement("div");return t.className="c-kpi__foot",t});(t.querySelector(".c-kpi__note")||(()=>{const e=document.createElement("span");return e.className="c-kpi__note",t.appendChild(e),e})()).textContent=a}else{const t=this.querySelector(".c-kpi__note");t&&t.remove()}const n=this.getAttribute("unit"),o=this.querySelector(".c-kpi__value");if(o)if(n){let t=o.querySelector(".c-kpi__unit");t||(t=document.createElement("span"),t.className="c-kpi__unit",o.appendChild(t)),t.textContent=n}else{const t=o.querySelector(".c-kpi__unit");t&&t.remove()}const c=this.getAttribute("threshold")||this.getAttribute("thresholds");if(c){const t=this.ensure(".c-kpi__foot",()=>{const t=document.createElement("div");return t.className="c-kpi__foot",t});let e=t.querySelector(".c-kpi__threshold-badge");e||(e=document.createElement("span"),e.className="c-kpi__threshold-badge",t.appendChild(e)),e.textContent=c,e.setAttribute("part","threshold-badge")}else{const t=this.querySelector(".c-kpi__threshold-badge");t&&t.remove()}const l=this.querySelector(".c-kpi__foot");l&&!l.querySelector(".c-delta, .c-kpi__note, .c-kpi__threshold-badge")&&l.remove();const u=this.getAttribute("sparkline"),d=null!==u&&""!==u&&"0"!==u&&"false"!==u.toLowerCase(),h=this.querySelector(".c-kpi__sparkline-canvas");if(h&&h.remove(),d){let t=null;try{t=JSON.parse(u)}catch(e){t=null}Array.isArray(t)||(t=null);const e=(t||[]).map(t=>Number(t)).filter(t=>Number.isFinite(t));if(e.length>1){const t=document.createElement("canvas");t.className="c-kpi__sparkline-canvas",t.setAttribute("part","sparkline-canvas"),t.setAttribute("aria-hidden","true"),this.appendChild(t),this._sparkSeries=e;const s=()=>{if(!t.isConnected)return;const s=t.clientWidth,r=t.clientHeight;if(!s||!r)return;const i="undefined"!=typeof window&&window.devicePixelRatio||1;t.width=Math.round(s*i),t.height=Math.round(r*i);const a=t.getContext&&t.getContext("2d");if(!a)return;a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,s,r);const n=Math.min.apply(null,e),o=Math.max.apply(null,e)-n||1;let c=getComputedStyle(this).getPropertyValue("--chart-1").trim();if(!c||/^(var|light-dark)\(/.test(c)){const t=document.createElement("span");t.style.display="none",t.style.color=c||"var(--chart-1, #666)",this.appendChild(t),c=getComputedStyle(t).color||"#666",t.remove()}a.beginPath(),a.lineWidth=1.5,a.strokeStyle=c,e.forEach((t,i)=>{const c=(t=>t/(e.length-1)*(s-4)+2)(i),l=(t=>r-2-(t-n)/o*(r-4))(t);0===i?a.moveTo(c,l):a.lineTo(c,l)}),a.stroke()};"function"==typeof requestAnimationFrame?requestAnimationFrame(s):s(),"undefined"==typeof ResizeObserver||this._sparkRO||(this._sparkRO=new ResizeObserver(()=>s()),i(this,()=>{this._sparkRO&&(this._sparkRO.disconnect(),this._sparkRO=null)})),this._sparkRO&&this._sparkRO.observe(t)}}t||e||Yt(this,"kpi")}});class te extends T{static get updateMode(){return"keyed"}static get observed(){return["columns","rows","page","page-size","sort","sort-dir","virtual","title","selected","empty","loading","error","retry","skeleton","persist","density","visible-columns","cache-key","lazy","no-cache","refresh","src","timeout"]}static get properties(){return{columns:{attribute:"columns"},rows:{attribute:"rows"},page:{attribute:"page",type:Number},pageSize:{attribute:"page-size",type:Number}}}get selected(){return this._selectionKeys()}set selected(t){this._pushedSelection=Array.isArray(t)?t.map(String):[],this.requestRender()}_rowKey(t){if(t&&"object"==typeof t&&!Array.isArray(t)){if(void 0!==t.id&&null!==t.id)return String(t.id);if(void 0!==t.key&&null!==t.key)return String(t.key)}const e=this._keyCol;if(null!=e&&e>=0&&t&&void 0!==t[e]&&null!==t[e]){const s=this._cellValue(t[e]);if(""!==s)return String(s)}return JSON.stringify(void 0===t?null:t)}_selectionKeys(){if(this._selectionControlled)return Array.from(this._selectedKeys||[]);const t=this._rowData||[];return Array.from(this._selectedRows||[]).map(e=>this._rowKey(t[e]))}_syncSelectionRows(){const t=this._rowData||[],e=new Set;t.forEach((t,s)=>{this._selectedKeys.has(this._rowKey(t))&&e.add(s)}),this._selectedRows=e}_cellValue(t){return null==t?"":"object"==typeof t?void 0!==t.value?t.value:void 0!==t.label?t.label:JSON.stringify(t):t}_cellFor(t,e,s){if(t&&"object"==typeof t&&!Array.isArray(t)){const r="string"==typeof e?e:e&&(e.key||e.label||e.title)||"";return r&&void 0!==t[r]?t[r]:t[s]}return t?t[s]:void 0}_compare(t,e,s){const r=this._cellValue(t),i=this._cellValue(e);return"number"===s||"numeric"===s?(parseFloat(r)||0)-(parseFloat(i)||0):String(r).localeCompare(String(i),void 0,{numeric:!0})}_applyVisibleColumns(t){const e=this.getAttribute("visible-columns");if(!e)return;let s=null;try{const t=JSON.parse(e);Array.isArray(t)&&(s=new Set(t.map(Number)))}catch(t){}if(!s||!s.size)return;const r=t=>s.has(t);t.querySelectorAll("thead tr th").forEach((t,e)=>{t.hidden=!r(e)}),t.querySelectorAll("tbody tr").forEach(t=>{1===t.children.length&&t.children[0].hasAttribute("colspan")||Array.from(t.children).forEach((t,e)=>{t.hidden=!r(e)})})}render(){if(this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Table"),Zt(this),$t(this,"rows"),Xt(this,"table"))return;const t=this.getAttribute("columns"),e=Jt(this,"rows"),s=Array.from(this.children).filter(t=>!t.classList||!t.classList.contains("c-table-wrap"));if(t&&e&&!s.length)try{const s=JSON.parse(t),r=JSON.parse(e),i=this.getAttribute("sort"),a=this.getAttribute("sort-dir");if(void 0===this._sortCol||i!==this._sortAttrLast||a!==this._sortDirAttrLast){if(this._sortAttrLast=i,this._sortDirAttrLast=a,null!==i){const t=Number(i);this._sortCol=Number.isFinite(t)?t:s.findIndex(t=>"object"==typeof t&&t&&(t.label||t.title||t)===i),this._sortCol<0&&(this._sortCol=null)}else this._sortCol=null;this._sortDir="descending"===a||"desc"===a?-1:1}let n=Array.isArray(r)?r.slice():[];if(null!==this._sortCol&&void 0!==this._sortCol&&this._sortCol>=0&&this._sortCol<s.length){const t=this._sortCol,e=this._sortDir||1,r=s[t],i="object"==typeof r&&r&&r.sortType?r.sortType:"text";n.sort((s,a)=>this._compare(this._cellFor(s,r,t),this._cellFor(a,r,t),i)*e)}this._filters||(this._filters={});const o=Object.keys(this._filters).filter(t=>this._filters[t]);o.length&&(n=n.filter(t=>o.every(e=>{const r=Number(e),i=String(this._filters[r]||"").toLowerCase();return!i||String(this._cellValue(this._cellFor(t,s[r],r))).toLowerCase().includes(i)})));const c=this.getAttribute("page-size"),l=null!==c?parseInt(c,10):NaN,u=Number.isFinite(l)&&l>0;let d=this.getAttribute("page");if(this.getAttribute("persist")&&this.id){const t=this.getAttribute("persist");let e=null;if("storage"===t)try{e=localStorage.getItem("contour-table:"+this.id)}catch(t){}else if("url"===t)try{e=new URLSearchParams(window.location.search).get("c-table-"+this.id)}catch(t){}null!==e&&(d=e)}this._pageInternal?(this._pageInternal=!1,this._pageAttrLast=d):d!==this._pageAttrLast&&(this._page=null,this._pageAttrLast=d);let h=null!==this._page?this._page:parseInt(d||"1",10);(!Number.isFinite(h)||h<1)&&(h=1);let m=1,b=n;if(u){m=Math.max(1,Math.ceil(n.length/l)),h>m&&(h=m);const t=(h-1)*l;b=n.slice(t,t+l)}this._page=h,this._totalPages=m,this._pageSize=l,this._rowData=b,this._keyCol=s.findIndex(t=>"object"==typeof t&&null!==t&&!0===t.key),this._selectedRows=this._selectedRows||new Set,this._selectedKeys=this._selectedKeys||new Set;const p=this.getAttribute("selected");if(p!==this._selectedAttrLast)if(this._selectedAttrLast=p,null!==p)try{const t=JSON.parse(p);Array.isArray(t)?(this._selectedKeys=new Set(t.map(String)),this._selectionControlled=!0):f(this,"selected",new Error("not an array"))}catch(t){f(this,"selected",t)}else void 0===this._pushedSelection&&(this._selectionControlled=!1);void 0!==this._pushedSelection&&(this._selectedKeys=new Set(this._pushedSelection),this._selectionControlled=!0),this._selectionControlled&&this._syncSelectionRows();const g=this._virtualWrap||this.keepNode(this.ensure(".c-table-wrap",()=>{const t=document.createElement("div");return t.className="c-table-wrap",t.setAttribute("tabindex","0"),t.setAttribute("role","region"),t.setAttribute("aria-label",k(this,"table-data","Table data")),t}));this._virtualWrap=g;const _=JSON.stringify(s),v=g.querySelector("table.c-table")&&this._tableCols===_?g.querySelector("table.c-table"):(()=>{const t=document.createElement("table");t.className="c-table";const e=document.createElement("caption");e.className="visually-hidden",e.textContent=this.getAttribute("title")||this.getAttribute("aria-label")||"Table",t.appendChild(e);const r=document.createElement("thead"),i=document.createElement("tr");return s.forEach((t,e)=>{const s="string"==typeof t?t:t.label||t.title||t,r=document.createElement("th"),a="object"==typeof t&&null!==t&&t.sort,n="object"==typeof t&&null!==t&&t.select,o="object"==typeof t&&null!==t&&t.filter;if("object"==typeof t&&null!==t&&("number"===t.type||"numeric"===t.type)&&r.classList.add("c-table__number"),o){r.className=r.className.trim();const t=document.createElement("input");t.type="search",t.className="c-table__filter-input",t.placeholder=s,t.setAttribute("aria-label",k(this,"filter","Filter")+" "+s),t.dataset.filterIndex=String(e),this._filters&&this._filters[e]&&(t.value=this._filters[e]),r.appendChild(t)}else if(n){r.className=(r.className+" c-table__select").trim();const t=document.createElement("input");t.type="checkbox",t.className="c-table__select-all",t.setAttribute("aria-label",k(this,"select-all-rows","Select all rows")),t.dataset.contourPreserveKey="select-all",r.appendChild(t)}else if(a){r.setAttribute("aria-sort",this._sortCol===e?-1===this._sortDir?"descending":"ascending":"none");const t=document.createElement("span");t.className="c-table__sort",t.textContent=s;const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("aria-hidden","true"),L(i,'<use href="#i-chevron-down" />'),t.appendChild(i),r.appendChild(t)}else"object"==typeof t&&null!==t&&t.pinned?(r.className="c-table__pinned",r.textContent=s):r.textContent=s;a&&(r.setAttribute("tabindex","0"),r.setAttribute("role","columnheader"),r.dataset.sortIndex=String(e)),i.appendChild(r)}),r.appendChild(i),t.appendChild(r),t.appendChild(document.createElement("tbody")),t})();this._tableCols=_,this._applyVisibleColumns(v),s.forEach((t,e)=>{if("object"==typeof t&&null!==t&&t.sort){const t=v.querySelector("thead tr th:nth-child("+(e+1)+")");t&&t.setAttribute("aria-sort",this._sortCol===e?-1===this._sortDir?"descending":"ascending":"none")}});const A=v.querySelector("tbody"),E=null!=this._tablePendingScrollTop?this._tablePendingScrollTop:g.scrollTop;this._tablePendingScrollTop=null,A.innerHTML="";const w=this.hasAttribute("virtual")&&!u&&b.length>100,x=this._measuredRowHeight||y("--data-grid-row-height",32),C=30,S=10;let N=0,q=b;if(w){const t=Math.max(0,b.length-C);N=Math.min(t,Math.max(0,Math.floor(E/x)-S)),q=b.slice(N,N+C+2*S),v.setAttribute("aria-rowcount",String(b.length+1)),this._tableWindowStart=N}else v.removeAttribute("aria-rowcount");const D=t=>{const e=document.createElement("tr");e.setAttribute("aria-hidden","true");const r=document.createElement("td");r.colSpan=s.length,r.style.blockSize=`${t}px`,r.style.padding="0",e.appendChild(r),A.appendChild(e)};if(w&&D(N*x),0===q.length){const t=document.createElement("tr"),e=document.createElement("td");e.colSpan=s.length,e.textContent=this.getAttribute("empty")||"No data",e.style.textAlign="center",e.style.color="var(--color-text-muted)",t.appendChild(e),A.appendChild(t)}else q.forEach((t,e)=>{const r=document.createElement("tr");r.dataset.rowIndex=String(N+e);const i=this._rowKey(t);r.dataset.rowKey=i,r.setAttribute("tabindex","-1"),s.forEach((s,a)=>{const n="object"==typeof s&&null!==s&&s.select,o="object"==typeof s&&null!==s&&("number"===s.type||"numeric"===s.type),c=document.createElement("td");if(o&&c.classList.add("c-table__number"),n){const t=document.createElement("input");t.type="checkbox",t.className="c-table__row-select",t.dataset.rowIndex=String(N+e),t.dataset.contourPreserveKey=i,this._selectionControlled?this._selectedKeys.has(i)&&(t.checked=!0):this._selectedRows&&this._selectedRows.has(N+e)&&(t.checked=!0),c.appendChild(t)}else c.textContent=this._cellValue(this._cellFor(t,s,a));r.appendChild(c)}),A.appendChild(r)});if(w&&D(Math.max(0,b.length-N-q.length)*x),!A.querySelector('tr[tabindex="0"]')){const t=A.querySelector("tr[data-row-index]");t&&t.setAttribute("tabindex","0")}if(!this._measuredRowHeight&&!this._measuringRow){const t=A.querySelector("tr[data-row-index]"),e=t?t.getBoundingClientRect().height:0;e>0&&(this._measuredRowHeight=e,Math.abs(e-x)>1&&(this._measuringRow=!0,requestAnimationFrame(()=>{this._measuringRow=!1,this.render()})))}if(v.parentNode!==g){for(;g.firstChild;)g.removeChild(g.firstChild);g.appendChild(v)}if(g.parentNode!==this&&this.appendChild(g),w&&E>0&&g.scrollTop!==E&&(this._tableScrollRestoredAt="undefined"!=typeof performance&&performance.now?performance.now():Date.now(),g.scrollTop=E),this.hasAttribute("virtual")?(g.style.maxHeight=g.style.maxHeight||"24rem",g.style.overflow="auto",g.style.contentVisibility="visible",v.classList.add("c-table--virtual")):(g.style.maxHeight="",g.style.overflow="",g.style.contentVisibility="",v.classList.remove("c-table--virtual")),u){const t=this.ensure(".c-table__pagination",()=>{const t=document.createElement("div");return t.className="c-table__pagination",t});t.innerHTML="";const e=document.createElement("button");e.className="c-btn c-btn--ghost c-btn--sm",e.type="button",e.textContent=k(this,"prev","Previous"),e.disabled=h<=1,e.dataset.action="prev";const s=document.createElement("span");s.textContent=`${k(this,"page","Page")} ${h} ${k(this,"of","of")} ${m}`;const r=document.createElement("button");r.className="c-btn c-btn--ghost c-btn--sm",r.type="button",r.textContent=k(this,"next","Next"),r.disabled=h>=m,r.dataset.action="next",t.appendChild(e),t.appendChild(s),t.appendChild(r)}else{const t=this.querySelector(".c-table__pagination");t&&t.remove()}}catch(t){f(this,"attribute",t)}else e||s.length||Yt(this,"table")}_applySelectionToDom(){this.querySelectorAll(".c-table__row-select").forEach(t=>{const e=Number(t.dataset.rowIndex);if(!Number.isFinite(e))return;const s=this._rowData?this._rowData[e]:void 0,r=this._selectionControlled?this._selectedKeys.has(this._rowKey(s)):!(!this._selectedRows||!this._selectedRows.has(e));t.checked!==r&&(t.checked=r)});const t=this.querySelector(".c-table__select-all");if(t){const e=Array.from(this.querySelectorAll(".c-table__row-select")),s=e.filter(t=>t.checked).length;t.checked=e.length>0&&s===e.length,t.indeterminate=s>0&&s<e.length,t.setAttribute("aria-label",w(this,"virtual")?k(this,"select-visible-rows","Select visible rows"):k(this,"select-all-rows","Select all rows"))}}enhance(){if(this._applySelectionToDom(),this._wiredTable)return;this._wiredTable=!0;const t=t=>{const e=Number(t.dataset.sortIndex);Number.isFinite(e)&&(this._sortCol===e?this._sortDir=1===this._sortDir?-1:1:(this._sortCol=e,this._sortDir=1),this.dispatchEvent(new CustomEvent("contour:sort",{bubbles:!0,composed:!0,detail:{column:e,direction:1===this._sortDir?"ascending":"descending"}})),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"table",filter:{sort:e,sortDir:1===this._sortDir?"ascending":"descending"}}})),this.requestRender())};this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest('button[data-action="retry"]'):null;if(s&&this.contains(s))return e.preventDefault(),void this.dispatchEvent(new CustomEvent("contour:retry",{detail:{src:this.getAttribute("src")},bubbles:!0,composed:!0}));const r=e.target&&e.target.closest?e.target.closest("th[aria-sort]"):null;if(r&&this.contains(r))return e.preventDefault(),void t(r);const i=e.target&&e.target.closest?e.target.closest(".c-table__pagination button"):null;if(i&&this.contains(i)){e.preventDefault();const t=i.dataset.action;let s=null!==this._page?this._page:parseInt(this.getAttribute("page")||"1",10);(!Number.isFinite(s)||s<1)&&(s=1),"prev"===t&&s>1&&(s-=1),"next"===t&&(s+=1),this._page=s,this._pageAttrLast=String(s),this._pageInternal=!0,this.setAttribute("page",String(s)),this.dispatchEvent(new CustomEvent("contour:page",{bubbles:!0,composed:!0,detail:{page:s}})),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"table",filter:{page:s}}}));const r=this.getAttribute("persist");if("storage"===r&&this.id)try{localStorage.setItem("contour-table:"+this.id,String(s))}catch(e){}else if("url"===r&&this.id)try{const t=new URL(window.location.href);t.searchParams.set("c-table-"+this.id,String(s)),window.history.replaceState(null,"",t.toString())}catch(e){}}}),this.addEventListener("keydown",e=>{if("Enter"!==e.key&&" "!==e.key)return;const s=e.target&&e.target.closest?e.target.closest("th[aria-sort]"):null;s&&this.contains(s)&&(e.preventDefault(),t(s))}),this.addEventListener("input",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-table__filter-input"):null;if(!e||!this.contains(e))return;const s=Number(e.dataset.filterIndex);Number.isFinite(s)&&(this._filters||(this._filters={}),this._filters[s]=e.value,this.requestRender(),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"table",filter:{column:s,value:e.value}}})))}),this.addEventListener("scroll",t=>{if(!(this.hasAttribute("virtual")&&t.target&&t.target.classList&&t.target.classList.contains("c-table-wrap")))return;const e=t.target,s=this._measuredRowHeight||y("--data-grid-row-height",32),r=Math.max(0,(this._rowData?this._rowData.length:0)-30),i=Math.min(r,Math.max(0,Math.floor(e.scrollTop/s)-10));if(this._tableWindowStart===i)return;if(this._tableVirtualRaf)return;this._tablePendingScrollTop=e.scrollTop;const a=()=>{this._tableVirtualRaf=0,this.requestRender()};this._tableVirtualRaf="function"==typeof requestAnimationFrame?requestAnimationFrame(a):setTimeout(a,16)},!0),i(this,()=>{this._tableVirtualRaf&&("function"==typeof cancelAnimationFrame?cancelAnimationFrame(this._tableVirtualRaf):clearTimeout(this._tableVirtualRaf),this._tableVirtualRaf=0)}),this._selectedRows=this._selectedRows||new Set,this.addEventListener("change",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-table__row-select"):null;if(e&&this.contains(e)){const t=Number(e.dataset.rowIndex);if(!Number.isFinite(t))return;const s=this._rowKey(this._rowData?this._rowData[t]:void 0);this._selectionControlled?(e.checked?this._selectedKeys.add(s):this._selectedKeys.delete(s),this._syncSelectionRows()):e.checked?this._selectedRows.add(t):this._selectedRows.delete(t),this._applySelectionToDom();const r=Array.from(this._selectedRows),i=this._selectionKeys();return this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{rows:r,key:s,index:t}})),void this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"table",filter:{selectedRows:r,selectedKeys:i}}}))}const s=t.target&&t.target.closest?t.target.closest(".c-table__select-all"):null;if(s&&this.contains(s)){const t=Array.from(this.querySelectorAll(".c-table__row-select"));t.forEach(t=>{t.checked=s.checked}),this._selectionControlled?(t.forEach(t=>{const e=Number(t.dataset.rowIndex),r=this._rowKey(this._rowData?this._rowData[e]:void 0);s.checked?this._selectedKeys.add(r):this._selectedKeys.delete(r)}),this._syncSelectionRows()):this._selectedRows=new Set(s.checked?t.map(t=>Number(t.dataset.rowIndex)):[]),s.indeterminate=!1;const e=Array.from(this._selectedRows),r=this._selectionKeys();this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{rows:e}})),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"table",filter:{selectedRows:e,selectedKeys:r}}}))}}),this.addEventListener("mouseover",t=>{const e=t.target&&t.target.closest?t.target.closest("tbody tr"):null;if(!e||!this.contains(e))return;const s=Number(e.dataset.rowIndex);Number.isFinite(s)&&this._hoveredRow!==s&&(this._hoveredRow=s,this.dispatchEvent(new CustomEvent("contour:hover",{bubbles:!0,composed:!0,detail:{row:s}})))}),this.addEventListener("mouseout",t=>{const e=t.target&&t.target.closest?t.target.closest("tbody tr"):null;if(!e||!this.contains(e))return;(t.relatedTarget&&t.relatedTarget.closest?t.relatedTarget.closest("tbody tr"):null)!==e&&(this._hoveredRow=null,this.dispatchEvent(new CustomEvent("contour:leave",{bubbles:!0,composed:!0,detail:{}})))}),this.addEventListener("click",t=>{if(t.target&&t.target.closest&&t.target.closest("input, button, select, textarea, a[href], label"))return;const e=t.target&&t.target.closest?t.target.closest("tbody tr"):null;if(!e||!this.contains(e))return;const s=void 0!==e.dataset.rowIndex?e.dataset.rowIndex:e.dataset.row,r=Number(s);if(!Number.isFinite(r))return;const i=this._rowData&&this._rowData[r]||null;this.dispatchEvent(new CustomEvent("contour:zoom",{bubbles:!0,composed:!0,detail:{row:r,index:r,data:i}}))}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest("tbody tr"):null;if(!e||!this.contains(e))return;const s=Number(e.dataset.rowIndex);if(Number.isFinite(s)){if("ArrowDown"===t.key||"ArrowUp"===t.key||"Home"===t.key||"End"===t.key){const s=Array.from(this.querySelectorAll("tbody tr[data-row-index]")),r=s.indexOf(e);let i=r;if("ArrowDown"===t.key?i=Math.min(s.length-1,r+1):"ArrowUp"===t.key?i=Math.max(0,r-1):"Home"===t.key?i=0:"End"===t.key&&(i=s.length-1),i!==r&&s[i]){t.preventDefault(),s.forEach(t=>t.setAttribute("tabindex","-1")),s[i].setAttribute("tabindex","0");try{s[i].focus()}catch(t){}}return}"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0,detail:{row:s}})))}}),this.addEventListener("contour:clear-all",()=>{let t=!1;this.hasAttribute("sort")&&(this.removeAttribute("sort"),t=!0),this.hasAttribute("sort-dir")&&(this.removeAttribute("sort-dir"),t=!0),null!==this._sortCol&&void 0!==this._sortCol&&(this._sortCol=null,this._sortDir=1,t=!0),this.hasAttribute("page")&&(this.removeAttribute("page"),t=!0),this._filters&&Object.keys(this._filters).length&&(this._filters={},this.querySelectorAll(".c-table__filter-input").forEach(t=>{t.value=""}),t=!0),this._selectedRows&&this._selectedRows.size&&(this._selectedRows.clear(),t=!0),!this._selectionControlled&&this._selectedKeys&&this._selectedKeys.size&&(this._selectedKeys.clear(),t=!0),t&&(this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"table",filter:{sort:null,sortDir:null,page:null,filters:null}}})),this.requestRender())})}}c("contour-table",te);c("contour-data-table",class extends te{render(){super.render(),this.classList.add("c-data-table"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"data-table","Data table"))}});c("contour-column-picker",class extends T{static get observed(){return["columns","label"]}static get properties(){return{columns:{attribute:"columns"},label:{attribute:"label"}}}render(){this.classList.add("c-column-picker");const t=this.ensure(".c-column-picker__trigger",()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--sm c-column-picker__trigger",t});L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-sliders" /></svg>'),t.appendChild(document.createTextNode(" "+(this.getAttribute("label")||k(this,"columns","Columns"))));const e=this.ensure(".c-column-picker__panel",()=>{const t=document.createElement("div");return t.className="c-column-picker__panel",t});let s=[];try{const t=JSON.parse(this.getAttribute("columns")||"[]");Array.isArray(t)&&(s=t)}catch(t){}e.innerHTML="",s.forEach(t=>{const s="string"==typeof t?t:t.label||t.name||t,r="string"==typeof t?t:t.value||t.name||t,i=document.createElement("label");i.className="c-column-picker__item";const a=document.createElement("input");a.type="checkbox",a.checked=!0,a.dataset.column=r,i.appendChild(a),i.appendChild(document.createTextNode(" "+s)),e.appendChild(i)})}enhance(){this._wiredColPicker||(this._wiredColPicker=!0,this.addEventListener("change",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-column-picker__item input"):null;e&&this.contains(e)&&this.dispatchEvent(new CustomEvent("contour:column-toggle",{bubbles:!0,composed:!0,detail:{column:e.dataset.column,visible:e.checked}}))}))}});const ee=(t,e=600)=>{if(!Array.isArray(t)||t.length<=e)return t;const s=Math.ceil(t.length/e),r=[];for(let e=0;e<t.length;e+=s)r.push(t[e]);const i=t[t.length-1];return r[r.length-1]!==i&&r.push(i),r},se=(t,e)=>{const s=Array.from(e.childNodes),r=Array.from(t.childNodes),i=Math.max(s.length,r.length);for(let e=0;e<i;e++){const i=r[e],a=s[e];if(i)if(a)if(1===i.nodeType&&1===a.nodeType&&i.tagName===a.tagName){for(const t of Array.from(i.attributes))a.hasAttribute(t.name)||i.removeAttribute(t.name);for(const t of Array.from(a.attributes)){const e=a.getAttribute(t.name);i.getAttribute(t.name)!==e&&i.setAttribute(t.name,e)}se(i,a)}else 3===i.nodeType&&3===a.nodeType?i.textContent!==a.textContent&&(i.textContent=a.textContent):t.replaceChild(a,i);else t.removeChild(i);else a&&t.appendChild(a)}},re=t=>{if(!t||"object"!=typeof t)return null;const e=Number(t.x0),s=Number(t.x1),r=Number(t.count);if(!Number.isFinite(e)||!Number.isFinite(s)||!Number.isFinite(r))return null;const i={x0:e,x1:s,count:r},a=Number(t.normalized);return Number.isFinite(a)&&(i.normalized=a),i};c("contour-chart",class extends T{static get updateMode(){return"keyed"}static get observed(){return["series","axis","color","label","legend","brownout","brownout-level","empty","loading","error","retry","skeleton","zoomable","data-table","brush","brush-min","brush-max","brush-start","brush-end","note","bucket-count","limit-values","title","cache-key","dir","src"]}static get properties(){return{series:{attribute:"series"},axis:{attribute:"axis"},color:{attribute:"color"},label:{attribute:"label"},legend:{attribute:"legend"},zoomable:{attribute:"zoomable",type:Boolean},brush:{attribute:"brush",type:Boolean},note:{attribute:"note"},"bucket-count":{attribute:"bucket-count"},"limit-values":{attribute:"limit-values"}}}get bins(){const t=this._pushedBins;return(t&&t.length?t:this._renderedBins||[]).map(t=>({...t}))}set bins(t){this._pushedBins=ee(Array.isArray(t)?t.map(re).filter(Boolean):[]),this.requestRender()}get backgroundData(){const t=this._pushedBackground;return(t&&t.length?t:this._renderedBackground||[]).map(t=>({...t}))}set backgroundData(t){this._pushedBackground=Array.isArray(t)?t.map(re).filter(Boolean):[],this.requestRender()}_showsBrush(){return this.hasAttribute("brush")||void 0!==this._rangeOverride}get range(){const t=this._rangeOverride;if(void 0!==t)return t?t.slice():null;if(!this.hasAttribute("brush"))return null;const e=parseFloat(this.getAttribute("brush-start")),s=parseFloat(this.getAttribute("brush-end"));return Number.isFinite(e)&&Number.isFinite(s)?[e,s]:null}set range(t){if(null==t)return this._rangeOverride=null,void this.requestRender();const e=Array.isArray(t)?t:[t,t],s=Number(e[0]),r=Number(e[1]);Number.isFinite(s)&&Number.isFinite(r)&&(this._rangeOverride=[s,r],this.requestRender())}_axisLabel(){const t=this.getAttribute("axis");if(!t)return"";try{const e=JSON.parse(t);if(e&&"object"==typeof e){const t=e.x;return e.label||e.title||e.name||t&&"object"==typeof t&&(t.label||t.title||t.name)||""}return String(e)}catch(e){return t}}_seriesColor(t,e){const s=_(t&&"object"==typeof t?t.color:"");if(s)return s;const r=_(this.getAttribute("color"));return r||"var(--chart-"+(e%12+1)+")"}_legendOff(){const t=(this.getAttribute("legend")||"").trim().toLowerCase();return"off"===t||"false"===t||"none"===t||"0"===t}_applyBrownout(){const t=this.shed("chrome",2),e=this.shed("marks",3),s=this.querySelector(".c-chart__plot");s&&(s.style.backgroundImage=t?"none":"");const r=this.querySelector(".c-chart__axis");r&&(r.style.display=e?"none":"");const i=this.querySelector(".c-chart__note");i&&(i.style.display=e?"none":"");const a=this.querySelector("contour-brush");a&&(a.style.display=e?"none":"")}_axisConfig(){const t=this.getAttribute("axis");if(!t)return null;try{const e=JSON.parse(t);return e&&"object"==typeof e?e:null}catch(t){return null}}_valueDomain(){const t=this.getAttribute("series");if(!t)return null;try{const e=JSON.parse(t);let s=1/0,r=-1/0,i=!1;return(Array.isArray(e)?e:[]).forEach(t=>{!t||"bar"!==t.type&&"histogram"!==t.type&&"stacked"!==t.type||(i=!0),t&&Array.isArray(t.values)&&t.values.forEach(t=>{const e=Number(t);Number.isFinite(e)&&(e<s&&(s=e),e>r&&(r=e))})}),i&&Number.isFinite(s)&&Number.isFinite(r)&&(s=Math.min(0,s),r=Math.max(0,r)),Number.isFinite(s)&&Number.isFinite(r)?[s,r]:null}catch(t){return null}}_renderValueAxis(){const t=this.querySelector(".c-chart__axis");if(!t)return;const e=this._axisConfig(),s=e&&e.y,r=s&&s.domain||this._valueDomain(),i=this.querySelector(".c-chart__axis-x");if(!r)return this.classList.remove("c-chart--value-axis"),t.className="c-chart__axis",t.textContent=this._axisLabel(),void(i&&i.remove());this.classList.add("c-chart--value-axis"),t.className="c-chart__axis c-chart__axis--y";const a=s&&s.ticks||function(t,e,s){s=s||5;const r=e-t||1;let i=Math.pow(10,Math.floor(Math.log10(r/s)));if(!Number.isFinite(i)||i<=0)return[t,e];const a=s*i/r;a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2);const n=Math.floor(t/i)*i,o=Math.ceil(e/i)*i,c=[];for(let t=n;t<=o+i/2;t+=i)c.push(Math.round(1e9*t)/1e9);return c}(r[0],r[1],5),n=s&&s.format||(t=>String(t));t.textContent="";a.forEach(e=>{const s=document.createElement("span");s.className="c-chart__tick",s.textContent="function"==typeof n?n(e):String(e),t.appendChild(s)}),s&&"object"==typeof s&&(s.label||s.title||s.name)&&t.appendChild(((t,e)=>{const s=document.createElement("span");return s.className="c-chart__tick",s.dataset.axisTitle=e,s.textContent=t,s})(s.label||s.title||s.name,"y"));const o=this._axisLabel();let c=i;o?(c||(c=document.createElement("div"),c.className="c-chart__axis-x",this.appendChild(c)),c.textContent=o):c&&c.remove(),this.style.setProperty("--chart-ticks",String(a.length))}_renderLegend(){const t=this.getAttribute("series");let e=this.querySelector(".c-chart__legend");if(!t||this._legendOff()||this.shed("legend",2))e&&e.remove();else try{const s=JSON.parse(t),r=(Array.isArray(s)?s:[]).map((t,e)=>({s:t,i:e})).filter(t=>t.s&&t.s.label);if(!r.length)return void(e&&e.remove());e||(e=document.createElement("div"),e.className="c-chart__legend",this.appendChild(e)),e.textContent="",r.forEach(({s:t,i:s})=>{const r=document.createElement("span");r.className="c-chart__legend-item";const i=document.createElement("span");i.className="c-chart__legend-swatch",i.style.setProperty("--c",this._seriesColor(t,s)),i.dataset.series=String(s%12+1),i.dataset.style=t.style||"line",r.appendChild(i),r.appendChild(document.createTextNode(t.label)),e.appendChild(r)})}catch(t){}}render(){this.classList.add("c-chart"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-roledescription")||this.setAttribute("aria-roledescription","chart");const t=this.getAttribute("label")||this._axisLabel(),e=this.getAttribute("aria-label");if(!t||null!==e&&e!==this._lastAutoAria||(this.setAttribute("aria-label",t),this._lastAutoAria=t),this.hasAttribute("loading")){this.setAttribute("aria-busy","true");const t=this.ensure(".c-chart__plot",()=>{const t=document.createElement("div");return t.className="c-chart__plot",t});t.innerHTML="";const e=document.createElement("div");e.className="c-chart__loading",e.textContent=this.getAttribute("loading")||"Loading…",e.style.display="grid",e.style.placeItems="center",e.style.height="100%",e.style.color="var(--color-text-muted)",t.appendChild(e);if(this.getAttribute("axis")){this.ensure(".c-chart__axis",()=>{const t=document.createElement("div");return t.className="c-chart__axis",t}).textContent=this._axisLabel()}return}if(this.removeAttribute("aria-busy"),this.hasAttribute("error")){const t=this.ensure(".c-chart__plot",()=>{const t=document.createElement("div");return t.className="c-chart__plot",t});t.innerHTML="";const e=document.createElement("div");if(e.className="c-chart__error",e.textContent=this.getAttribute("error")||"Error",e.style.display="grid",e.style.placeItems="center",e.style.height="100%",e.style.color="var(--color-danger, var(--color-text))",this.hasAttribute("retry")){const t=document.createElement("button");t.className="c-btn c-btn--ghost c-btn--sm",t.type="button",t.textContent=this.getAttribute("retry")||"Retry",t.dataset.action="retry",t.classList.add("u-mbs-sm"),e.appendChild(t)}t.appendChild(e);if(this.getAttribute("axis")){this.ensure(".c-chart__axis",()=>{const t=document.createElement("div");return t.className="c-chart__axis",t}).textContent=this._axisLabel()}return}if(this.hasAttribute("skeleton")){const t=this.ensure(".c-chart__plot",()=>{const t=document.createElement("div");return t.className="c-chart__plot",t});t.innerHTML="";const e=Math.min(5,Math.max(1,parseInt(this.getAttribute("skeleton")||"3",10)||3));for(let s=0;s<e;s++){const e=document.createElement("div");e.className="c-skeleton",e.style.display="block",e.style.inlineSize="100%",e.style.blockSize="0.6rem",e.classList.add("u-mbe-2xs"),t.appendChild(e)}if(this.getAttribute("axis")){this.ensure(".c-chart__axis",()=>{const t=document.createElement("div");return t.className="c-chart__axis",t}).textContent=this._axisLabel()}return}if(this.getAttribute("axis")){this.ensure(".c-chart__axis",()=>{const t=document.createElement("div");return t.className="c-chart__axis",t}).textContent=this._axisLabel()}else{const t=this.querySelector(".c-chart__axis");t&&t.remove()}this._renderValueAxis(),this._renderLegend();let s=this.getAttribute("series");if(!s&&this._pushedBins&&this._pushedBins.length&&(s=JSON.stringify([{type:"histogram",bins:this._pushedBins}])),s){const t=Qt(this,"series",f);if(0===t.length)return void Yt(this,"chart");const e=this.ensure(".c-chart__plot",()=>{const t=document.createElement("div");return t.className="c-chart__plot",t});this.keepNode(e);const s=document.createDocumentFragment();if(t.some(t=>t&&(Array.isArray(t.values)||Array.isArray(t.bins))))this._renderedBins=[],this._renderedBackground=[],t.forEach((t,e)=>{const r=this._seriesColor(t,e);if("donut"===t.type){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 200 200"),r.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%",r.setAttribute("role","group"),r.setAttribute("aria-label",t.label||"Donut chart"),$(t.values).forEach((s,i)=>{const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("class","c-donut__slice"),a.setAttribute("data-series",String(e+1)),a.dataset.index=String(i),a.style.setProperty("--c",_("var(--chart-"+(i%12+1)+")")||"var(--chart-1)"),a.setAttribute("d",s.path),a.setAttribute("data-title",String(t.values[i])),a.setAttribute("aria-label",k(this,"series","Series")+" "+(e+1)+": "+String(t.values[i])),a.setAttribute("role","button"),a.setAttribute("tabindex",0===i?"0":"-1"),r.appendChild(a)}),s.appendChild(r)}else if("bar"===t.type){const i=Array.isArray(t.values)?t.values:[],a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 300 120"),a.setAttribute("preserveAspectRatio","none"),a.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%",J(i).forEach((t,s)=>{if(t.missing)return;const n=document.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("class","c-chart__bar"),n.setAttribute("data-series",String(e+1)),n.style.setProperty("--c",r),n.setAttribute("x",t.x),n.setAttribute("y",t.y),n.setAttribute("width",t.width),n.setAttribute("height",t.height),n.setAttribute("data-title",String(i[s])),n.setAttribute("aria-label",k(this,"series","Series")+" "+(e+1)+": "+String(i[s])),n.setAttribute("tabindex","0"),n.setAttribute("role","button"),n.dataset.index=String(s),a.appendChild(n)}),s.appendChild(a)}else if("histogram"===t.type){let i=Array.isArray(t.values)?t.values.slice():[];const a=parseInt(this.getAttribute("limit-values")||"0",10);a>0&&(i=i.slice(0,a));const n=parseInt(this.getAttribute("bucket-count")||"0",10),o=this._pushedBins&&this._pushedBins.length?this._pushedBins:null,c=Array.isArray(t.bins)?t.bins.map(re).filter(Boolean):null;let l=o||(c&&c.length?c:null),u=i;if(!l&&n>0&&i.length){const t=i.map(t=>Number(t)||0),e=Math.min.apply(null,t),s=(Math.max.apply(null,t)-e||1)/n,r=new Array(n).fill(0);t.forEach(t=>{const i=Math.min(n-1,Math.floor((t-e)/s));r[i]+=1}),u=r,l=r.map((t,r)=>({x0:e+r*s,x1:e+(r+1)*s,count:t}))}l&&(u=l.map(t=>t.count)),this._renderedBins=l?l.slice():[];const d=this._pushedBackground&&this._pushedBackground.length?this._pushedBackground:null,h=Array.isArray(t.background)?t.background.map(re).filter(Boolean):null,m=d||(h&&h.length?h:[]);this._renderedBackground=m.slice();const b=m.map(t=>Number(t.count)||0);let p=1;b.length&&u.concat(b).forEach(t=>{const e=Number(t)||0;e>p&&(p=e)});const g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox","0 0 300 120"),g.setAttribute("preserveAspectRatio","none"),g.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%",b.length&&J(b,{max:p}).forEach(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","rect");e.setAttribute("class","c-chart__bar"),e.setAttribute("data-context",""),e.setAttribute("aria-hidden","true"),e.style.setProperty("--c",r),e.setAttribute("x",t.x),e.setAttribute("y",t.y),e.setAttribute("width",t.width),e.setAttribute("height",t.height),g.appendChild(e)}),J(u,b.length?{max:p}:void 0).forEach((s,i)=>{if(s.missing)return;const a=document.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("class","c-chart__bar"),a.setAttribute("data-series",String(e+1)),a.style.setProperty("--c",r),a.setAttribute("x",s.x),a.setAttribute("y",s.y),a.setAttribute("width",s.width),a.setAttribute("height",s.height);const n=l?l[i].count:Array.isArray(t.values)?t.values[i]:i;a.setAttribute("data-title",String(n)),a.setAttribute("aria-label",k(this,"series","Series")+" "+(e+1)+": "+String(n)),a.setAttribute("tabindex","0"),a.setAttribute("role","button"),a.dataset.index=String(i),g.appendChild(a)}),s.appendChild(g)}else if("scatter"===t.type){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("viewBox","0 0 300 120"),i.setAttribute("preserveAspectRatio","none"),i.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";const a=(Array.isArray(t.values)?t.values:[]).filter(t=>!j(t)).map(t=>Array.isArray(t)?{x:Number(t[0])||0,y:Number(t[1])||0}:{x:Number(t&&t.x)||0,y:Number(t&&t.y)||0}),n=a.map(t=>t.x),o=a.map(t=>t.y),c=n.length?Math.min.apply(null,n):0,l=n.length?Math.max.apply(null,n):1,u=o.length?Math.min.apply(null,o):0,d=o.length?Math.max.apply(null,o):1,h=l-c||1,m=d-u||1,b=2e3;let p=a;if(a.length>b){const t=Math.ceil(a.length/b);p=a.filter((e,s)=>s%t===0),this.dispatchEvent(new CustomEvent("contour:cap",{bubbles:!0,composed:!0,detail:{series:e+1,total:a.length,shown:p.length}}))}p.forEach((t,s)=>{const a=document.createElementNS("http://www.w3.org/2000/svg","circle");a.setAttribute("class","c-chart__point"),a.setAttribute("data-series",String(e+1)),a.setAttribute("data-index",String(s)),a.style.setProperty("--c",r);const n=(t.x-c)/h*300,o=120-(t.y-u)/m*120;a.setAttribute("cx",n.toFixed(2)),a.setAttribute("cy",o.toFixed(2)),a.setAttribute("r","3"),a.setAttribute("tabindex",0===s?"0":"-1"),a.setAttribute("role","button"),a.setAttribute("data-title",t.x+", "+t.y),a.setAttribute("aria-label",k(this,"series","Series")+" "+(e+1)+": "+t.x+", "+t.y),i.appendChild(a)}),p.length!==a.length&&(i.setAttribute("data-decimated",String(a.length)),i.setAttribute("aria-label",k(this,"series","Series")+" "+(e+1)+" ("+p.length+" "+k(this,"of","of")+" "+a.length+")")),s.appendChild(i)}else{const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("viewBox","0 0 300 120"),i.setAttribute("preserveAspectRatio","none"),i.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("class","c-chart__line"),a.setAttribute("data-series",String(e+1)),a.style.setProperty("--c",r),a.setAttribute("d",W(t.values)),i.appendChild(a);const n=t.values.filter(t=>!j(t)).map(Number).filter(t=>Number.isFinite(t)),o=n.reduce((t,e)=>e>t?e:t,n.length?n[0]:1),c=n.reduce((t,e)=>e<t?e:t,n.length?n[0]:0),l=o-c||1,u=t.values.length||1;let d=!0;t.values.forEach((t,s)=>{if(j(t))return;const a=Number(t);if(!Number.isFinite(a))return;const n=s/Math.max(1,u-1)*300,o=120-(a-c)/l*120,h=document.createElementNS("http://www.w3.org/2000/svg","circle");h.setAttribute("class","c-chart__point"),h.setAttribute("data-series",String(e+1)),h.setAttribute("data-index",String(s)),h.style.setProperty("--c",r),h.setAttribute("cx",String(n)),h.setAttribute("cy",String(o)),h.setAttribute("r","3"),h.setAttribute("tabindex",d?"0":"-1"),d=!1,h.setAttribute("role","button"),h.setAttribute("data-title",String(t)),h.setAttribute("aria-label",k(this,"series","Series")+" "+(e+1)+": "+String(t)),i.appendChild(h)}),s.appendChild(i)}});else{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 300 120"),e.setAttribute("preserveAspectRatio","none"),e.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%",e.setAttribute("aria-hidden","true"),t.forEach((t,s)=>{const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("class","c-chart__line"),r.setAttribute("data-series",String(s+1)),r.style.setProperty("--c",this._seriesColor(t,s)),r.setAttribute("d","string"==typeof t.d&&t.d.trim()?t.d:Array.isArray(t.values)?W(t.values):""),e.appendChild(r)}),s.appendChild(e)}if(se(e,s),this.shed("tooltip",2)){const t=this.querySelector(".c-chart__tooltip");t&&t.remove()}else{this.ensure(".c-chart__tooltip",()=>{const t=document.createElement("div");return t.className="c-chart__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t.id=o("chart-tip"),t}).setAttribute("hidden","")}const r=(this.getAttribute("data-table")||"").trim().toLowerCase(),i="none"===r||"off"===r||"false"===r||"0"===r,a=t.some(t=>Array.isArray(t&&t.values)&&t.values.length);if(!i&&a){let e=this.querySelector(".c-chart__data-table");e||(e=document.createElement("table"),e.className="c-chart__data-table visually-hidden",this.appendChild(e)),e.innerHTML="";const s=this.getAttribute("title")||this.getAttribute("aria-label")||k(this,"chart-data","Chart data"),r=document.createElement("caption");r.textContent=s,e.appendChild(r);const i=document.createElement("thead"),a=document.createElement("tr"),n=document.createElement("th");n.setAttribute("scope","col"),n.textContent=k(this,"series","Series"),a.appendChild(n);const o=t.reduce((t,e)=>Math.max(t,Array.isArray(e.values)?e.values.length:Array.isArray(e)?e.length:0),0);for(let t=0;t<o;t++){const e=document.createElement("th");e.setAttribute("scope","col"),e.textContent=k(this,"value","Value")+" "+(t+1),a.appendChild(e)}i.appendChild(a),e.appendChild(i);const c=document.createElement("tbody");t.forEach((t,e)=>{const s=Array.isArray(t.values)?t.values:Array.isArray(t)?t:[],r=document.createElement("tr"),i=document.createElement("th");i.setAttribute("scope","row"),i.textContent=t.label||"Series "+(e+1),r.appendChild(i);for(let t=0;t<o;t++){const e=document.createElement("td");e.textContent=j(s[t])?"":String(s[t]),r.appendChild(e)}c.appendChild(r)}),e.appendChild(c)}else{const t=this.querySelector(".c-chart__data-table");t&&t.remove()}if(this._showsBrush()){const t=this.ensure("contour-brush",()=>document.createElement("contour-brush")),e=this._renderedBins||[],s=this.getAttribute("brush-min")||(e.length?String(e[0].x0):"0"),r=this.getAttribute("brush-max")||(e.length?String(e[e.length-1].x1):"100"),i=Array.isArray(this._rangeOverride)?this._rangeOverride:null,a=null===this._rangeOverride;t.setAttribute("min",s),t.setAttribute("max",r),t.setAttribute("start",i?String(i[0]):a?s:this.getAttribute("brush-start")||s),t.setAttribute("end",i?String(i[1]):a?r:this.getAttribute("brush-end")||r);const n=this.querySelector(".c-chart__plot");t.previousElementSibling!==n&&this.insertBefore(t,n?n.nextSibling:null)}else{const t=this.querySelector("contour-brush");t&&t.remove()}const n=this.getAttribute("note");let c=this.querySelector(".c-chart__note");n?(c||(c=document.createElement("div"),c.className="c-chart__note",this.appendChild(c)),c.textContent=n):c&&c.remove()}else{this._renderedBins=[],this._renderedBackground=[];const t=this.ensure(".c-chart__plot",()=>{const t=document.createElement("div");return t.className="c-chart__plot",t});t.innerHTML="";const e=document.createElement("div");e.className="c-chart__empty",e.textContent=this.getAttribute("empty")||"No data",e.style.display="grid",e.style.placeItems="center",e.style.height="100%",e.style.color="var(--color-text-muted)",t.appendChild(e);const s=this.getAttribute("note");let r=this.querySelector(".c-chart__note");s?(r||(r=document.createElement("div"),r.className="c-chart__note",this.appendChild(r)),r.textContent=s):r&&r.remove()}this._applyBrownout()}enhance(){if(this._wiredChart)return;this._wiredChart=!0,Zt(this);const t=this.parentElement||document,e=t=>{const e=t&&t.detail&&(null!=t.detail.key?t.detail.key:t.detail.label),s=t&&t.detail&&t.detail.index,r=t&&t.detail&&t.detail.pressed;if(null==e&&null==s)return;this.querySelectorAll("[data-series]").forEach(t=>{const i=t.getAttribute("data-series");(String(i)===String(e)||t.getAttribute("data-key")===String(e)||null!=s&&String(i)===String(s+1))&&(t.style.display=!1===r?"none":"")})};if(t.addEventListener("contour:legend-toggle",e),i(this,()=>t.removeEventListener("contour:legend-toggle",e)),this.addEventListener("contour:brush-end",t=>{this._showsBrush()&&t.target&&t.target.matches("contour-brush")&&(void 0!==this._rangeOverride&&t.detail&&Array.isArray(t.detail.range)&&(this._rangeOverride=t.detail.range.slice()),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:t.detail})))}),this.hasAttribute("zoomable")){let t=1,e=0,s=0;const r=this.querySelector(".c-chart__plot"),a=()=>{r&&(r.style.transform=`translate(${e}px, ${s}px) scale(${t})`,r.style.transformOrigin="center center")};this.addEventListener("wheel",e=>{e.preventDefault();const s=e.deltaY<0?1.1:.9;t=Math.min(5,Math.max(.5,t*s)),a()},{passive:!1});let n=!1,o=0,c=0,l=0,u=0;this.addEventListener("mousedown",t=>{0===t.button&&(n=!0,o=t.clientX,c=t.clientY,l=e,u=s,this.style.cursor="grabbing")});const d=t=>{n&&(e=l+(t.clientX-o),s=u+(t.clientY-c),a())},h=()=>{n&&(n=!1,this.style.cursor="")};window.addEventListener("mousemove",d),window.addEventListener("mouseup",h),i(this,()=>{window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",h)}),this.addEventListener("dblclick",()=>{t=1,e=0,s=0,a()})}let s=null,r=null;const a=()=>{s=null},n=t=>{const e=this.querySelector(".c-chart__plot"),i=this.querySelector(".c-chart__tooltip");if(!e||!i)return;const n=t.target&&t.target.closest?t.target.closest(".c-chart__bar, .c-chart__point, .c-chart__line, .c-donut__slice"):null;if(!n||!e.contains(n))return void i.setAttribute("hidden","");const o=n.getAttribute("data-title")||n.getAttribute("title");o&&(i.textContent=o),s||(s=e.getBoundingClientRect(),r||"function"!=typeof ResizeObserver||(r=new ResizeObserver(a),r.observe(e)));const c=s,l=n.getBoundingClientRect(),u=l.left-c.left+l.width/2,d=l.top-c.top;e.style.setProperty("--chart-tip-inline-start",u+"px"),e.style.setProperty("--chart-tip-block-start",d+"px"),i.removeAttribute("hidden")},o=()=>{const t=this.querySelector(".c-chart__tooltip");t&&t.setAttribute("hidden","")};this.addEventListener("mousemove",n),this.addEventListener("mouseleave",o),i(this,()=>{r&&(r.disconnect(),r=null)}),this.addEventListener("focusin",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-chart__bar, .c-chart__point, .c-chart__line, .c-donut__slice"):null;if(e&&this.contains(e)){n({target:e});const t=this.querySelector(".c-chart__tooltip");t&&t.id&&e.setAttribute("aria-describedby",t.id)}}),this.addEventListener("focusout",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-chart__bar, .c-chart__point, .c-chart__line, .c-donut__slice"):null;e&&this.contains(e)&&e.removeAttribute("aria-describedby"),this.contains(t.relatedTarget)||o()}),this.addEventListener("click",t=>{const e=this.querySelector(".c-chart__plot");if(!e)return;const s=t.target&&t.target.closest?t.target.closest(".c-chart__bar"):null;if(s&&e.contains(s)){const t=parseInt(s.getAttribute("data-series")||"1",10),e=parseInt(s.dataset.index||"0",10);return void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:t,index:e}}))}const r=t.target&&t.target.closest?t.target.closest(".c-chart__point"):null;if(r&&e.contains(r)){const t=parseInt(r.getAttribute("data-series")||"1",10),e=parseInt(r.dataset.index||"0",10);return void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:t,index:e}}))}const i=t.target&&t.target.closest?t.target.closest(".c-donut__slice"):null;if(i&&e.contains(i)){const t=parseInt(i.getAttribute("data-series")||"1",10),e=parseInt(i.dataset.index||"0",10);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:t,index:e,value:i.getAttribute("data-title")||i.getAttribute("title")}}))}}),this.addEventListener("keydown",t=>{const e=this.querySelector(".c-chart__plot");if(!e)return;const s=t.target&&t.target.closest?t.target.closest(".c-chart__bar"):null;if(s&&e.contains(s)){if("Enter"===t.key||" "===t.key){t.preventDefault();const e=parseInt(s.getAttribute("data-series")||"1",10),r=parseInt(s.dataset.index||"0",10);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:e,index:r}}))}const r=s.getAttribute("data-series");if(r){const i=parseInt(r,10),a=Array.from(e.querySelectorAll('.c-chart__bar[data-series="'+i+'"]'));a.indexOf(s)>=0&&z(t,a,{wrap:!1,rtl:I(this),onNavigate:t=>a.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{}})}return}const r=t.target&&t.target.closest?t.target.closest(".c-donut__slice"):null;if(r&&e.contains(r)){const s=parseInt(r.getAttribute("data-series")||"1",10);if("Enter"===t.key||" "===t.key){t.preventDefault();const e=parseInt(r.dataset.index||"0",10);return void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:s,index:e,value:r.getAttribute("data-title")||r.getAttribute("title")}}))}const i=Array.from(e.querySelectorAll('.c-donut__slice[data-series="'+s+'"]'));return void z(t,i,{wrap:!1,rtl:I(this),onNavigate:t=>i.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{}})}const i=t.target&&t.target.closest?t.target.closest(".c-chart__point"):null;if(!i||!e.contains(i))return;const a=parseInt(i.getAttribute("data-series")||"1",10),n=Array.from(e.querySelectorAll('.c-chart__point[data-series="'+a+'"]'));n.indexOf(i);if("Enter"===t.key||" "===t.key){t.preventDefault();const e=parseInt(i.dataset.index||"0",10);return void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:a,index:e}}))}z(t,n,{wrap:!1,rtl:I(this),onNavigate:t=>n.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{}})}),this.addEventListener("keydown",t=>{if(t.target!==this)return;let e=0;try{e=JSON.parse(this.getAttribute("series")||"[]").length}catch(t){e=0}if(0===e)return;void 0===this._activeSeries&&(this._activeSeries=0);let s=this._activeSeries;const r="rtl"===(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase();if("ArrowRight"===t.key)s=r?Math.max(this._activeSeries-1,0):Math.min(this._activeSeries+1,e-1);else if("ArrowLeft"===t.key)s=r?Math.min(this._activeSeries+1,e-1):Math.max(this._activeSeries-1,0);else if("ArrowDown"===t.key)s=Math.min(this._activeSeries+1,e-1);else if("ArrowUp"===t.key)s=Math.max(this._activeSeries-1,0);else if("Home"===t.key)s=0;else{if("End"!==t.key)return"Enter"===t.key||" "===t.key?(t.preventDefault(),void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:this._activeSeries}}))):void 0;s=e-1}s!==this._activeSeries&&(t.preventDefault(),this._activeSeries=s,this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:s}})))}),this.addEventListener("contour:clear-all",()=>{this.hasAttribute("brush")&&(this.removeAttribute("brush"),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"chart",filter:{brush:null}}})),this.requestRender())})}});c("contour-comparison",class extends T{static get observed(){return["divider","value","before","after","before-src","after-src"]}static get properties(){return{divider:{attribute:"divider"},value:{attribute:"value"},before:{attribute:"before"},after:{attribute:"after"},beforeSrc:{attribute:"before-src"},afterSrc:{attribute:"after-src"}}}render(){this.classList.add("c-comparison"),this.setAttribute("role","group");const t="Comparison",e=this.getAttribute("aria-label");null!==e&&e!==this._lastAutoAria||(this.setAttribute("aria-label",t),this._lastAutoAria=t),this.style.blockSize||(this.style.blockSize="12rem");const s=this.getAttribute("value");this.style.setProperty("--comparison-pos",(s??"50")+"%");const r=this.getAttribute("before")??"Before",i=this.getAttribute("after")??"After";if(!this.querySelector(".c-comparison__pane--before")){const t=document.createElement("div");t.className="c-comparison__pane c-comparison__pane--before",this.appendChild(t)}if(!this.querySelector(".c-comparison__pane:not(.c-comparison__pane--before)")){const t=document.createElement("div");t.className="c-comparison__pane",this.appendChild(t)}const a=(t,e,s)=>{if(!t)return;let r=t.querySelector(".c-comparison__media--"+s);e?(r||(r=document.createElement("img"),r.className="c-comparison__media c-comparison__media--"+s,r.alt="",t.prepend(r)),r.getAttribute("src")!==e&&r.setAttribute("src",e)):r&&r.remove()};a(this.querySelector(".c-comparison__pane--before"),this.getAttribute("before-src"),"before"),a(this.querySelector(".c-comparison__pane:not(.c-comparison__pane--before)"),this.getAttribute("after-src"),"after");const n=this.querySelector(".c-comparison__pane--before");if(n){let t=n.querySelector(".c-comparison__label--before");t||(t=document.createElement("span"),t.className="c-comparison__label c-comparison__label--before",n.appendChild(t)),t.textContent=r}const o=this.querySelector(".c-comparison__pane:not(.c-comparison__pane--before)");if(o){let t=o.querySelector(".c-comparison__label--after");t||(t=document.createElement("span"),t.className="c-comparison__label c-comparison__label--after",o.appendChild(t)),t.textContent=i}const c=this.getAttribute("divider");if(null!==c){const t=this.ensure(".c-comparison__divider",()=>{const t=document.createElement("div");return t.className="c-comparison__divider",t.setAttribute("role","slider"),t.setAttribute("aria-orientation","vertical"),t.setAttribute("aria-valuemin","0"),t.setAttribute("aria-valuemax","100"),t.setAttribute("aria-valuenow",String(Math.round(parseFloat(s??"50")))),t.setAttribute("aria-label",k(this,"comparison-divider","Comparison divider")),t.setAttribute("tabindex","0"),t});c&&(t.textContent=c)}else{const t=this.querySelector(".c-comparison__divider");t&&t.remove()}}enhance(){if(this._wiredComparison)return;this._wiredComparison=!0;const t=()=>this.querySelector(".c-comparison__divider"),e=t=>{const e=Math.max(0,Math.min(100,t));this.style.setProperty("--comparison-pos",e+"%"),this.setAttribute("value",String(Math.round(e)));const s=this.querySelector(".c-comparison__divider");s&&s.setAttribute("aria-valuenow",String(Math.round(e))),this.dispatchEvent(new CustomEvent("contour:drag",{bubbles:!0,composed:!0,detail:{value:e}}))};let s=!1;const r=t=>{if(!s)return;const r=this.getBoundingClientRect(),i=(t.clientX-r.left)/r.width*100;e(i)},a=()=>{s=!1,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",a)};i(this,()=>{s=!1,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",a)}),this.addEventListener("pointerdown",r=>{const i=t();if(!i||!i.contains(r.target))return;s=!0;try{this.setPointerCapture(r.pointerId)}catch(t){}const a=this.getBoundingClientRect(),n=(r.clientX-a.left)/a.width*100;e(n),r.preventDefault()}),this.addEventListener("pointermove",t=>{if(!s)return;const r=this.getBoundingClientRect(),i=(t.clientX-r.left)/r.width*100;e(i)});const n=()=>{s=!1;try{this.releasePointerCapture&&this.releasePointerCapture(this._comparisonPointer)}catch(t){}this._comparisonPointer=null};this.addEventListener("pointerup",n),this.addEventListener("pointercancel",n),i(this,()=>{this.removeEventListener("pointerup",n),this.removeEventListener("pointercancel",n)}),this.addEventListener("keydown",s=>{const r=t();if(!r||document.activeElement!==r)return;const i=parseFloat(this.style.getPropertyValue("--comparison-pos"))||50;"ArrowLeft"===s.key?(s.preventDefault(),e(i-5)):"ArrowRight"===s.key?(s.preventDefault(),e(i+5)):"Home"===s.key?(s.preventDefault(),e(0)):"End"===s.key&&(s.preventDefault(),e(100))})}});c("contour-streaming-chart",class extends T{static get updateMode(){return"keyed"}static get observed(){return["line","dot","values","interval","pause","brownout","brownout-level","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{line:{attribute:"line"},dot:{attribute:"dot"},interval:{attribute:"interval",type:Number},pause:{attribute:"pause",type:Boolean},src:{attribute:"src"}}}get values(){return(this._valuesNums||[]).slice()}set values(t){this._pushedValues=ee(Array.isArray(t)?t.map(Number).filter(Number.isFinite):[]),this.requestRender()}render(){this.classList.add("c-streaming-chart"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"streaming-chart","Streaming chart")),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");let t=this.querySelector(".c-streaming-chart__pause");t||(t=document.createElement("button"),t.className="c-btn c-btn--icon c-btn--ghost c-btn--sm c-streaming-chart__pause",t.type="button",this.appendChild(t));const e=!!this._streamPausedByUser;if(t.setAttribute("aria-pressed",String(e)),t.setAttribute("aria-label",e?k(this,"play-stream","Play stream"):k(this,"pause-stream","Pause stream")),L(t,e?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-play" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-pause" /></svg>'),Zt(this),$t(this,["line","values"]),Xt(this,"streaming-chart"))return;let s=Jt(this,"line"),r=Jt(this,"dot"),i=this._pushedValues;if(void 0===i){i=null;const t=Jt(this,"values");if(t)try{const e=JSON.parse(t);Array.isArray(e)?i=e:f(this,"values",new Error("not an array"))}catch(t){f(this,"values",t)}}if(i=ee((i||[]).map(Number).filter(Number.isFinite)),this._valuesNums=[],!s&&i.length>1&&(s=W(i,{width:300,height:192}),this._valuesNums=i,!r)){const t=function(t,e){const s=null!=(e=e||{}).width?e.width:300,r=null!=e.height?e.height:120,i=t.map(t=>Number(t)||0);if(!i.length)return"";const a=null!=e.max?e.max:Math.max.apply(null,i),n=null!=e.min?e.min:Math.min.apply(null,i),o=Number.isFinite(a-n)&&a-n!==0?a-n:1,c=i.length||1;return i.map((t,e)=>{const i=e/Math.max(1,c-1)*s,a=r-(t-n)/o*r;return i.toFixed(2)+","+a.toFixed(2)}).join(" ")}(i,{width:300,height:192}).split(" ");r=t[t.length-1]}if(!s){const t=this.querySelector(":scope > .c-streaming-chart__plot");return t&&t.remove(),void Yt(this,"streaming-chart")}if(s){let t=this.querySelector(":scope > .c-streaming-chart__plot");t||(t=document.createElementNS("http://www.w3.org/2000/svg","svg"),t.setAttribute("class","c-streaming-chart__plot"),t.setAttribute("viewBox","0 0 300 192"),t.setAttribute("aria-hidden","true"),this.appendChild(t));let e=t.querySelector(".c-streaming-chart__line");if(e||(e=document.createElementNS("http://www.w3.org/2000/svg","path"),e.setAttribute("class","c-streaming-chart__line"),t.appendChild(e)),e.setAttribute("d",s),r&&!this.shed("dot",2)){let e=t.querySelector(".c-streaming-chart__live-dot");e||(e=document.createElementNS("http://www.w3.org/2000/svg","circle"),e.setAttribute("class","c-streaming-chart__live-dot"),e.setAttribute("r","4"),t.appendChild(e));const s=r.split(/[ ,]+/);s.length>=2&&(e.setAttribute("cx",s[0]),e.setAttribute("cy",s[1]))}else{const e=t.querySelector(".c-streaming-chart__live-dot");e&&e.remove()}}}enhance(){const t=()=>{const t=parseFloat(this.getAttribute("interval")||""),e=Number.isFinite(t)&&t>0&&!this.hasAttribute("pause")&&!this._streamPausedByUser&&!1!==this._viewVisible;e!==this._streamRunning&&(this._streamRunning=e,void 0!==this._streamTimer&&(clearInterval(this._streamTimer),this._streamTimer=void 0),this.dispatchEvent(new CustomEvent("contour:stream-state",{detail:{running:e},bubbles:!0,composed:!0})),e&&(this._streamTimer=setInterval(()=>{if(!this.isConnected||this.hasAttribute("pause"))return;this._streamFrame+=1,this.dispatchEvent(new CustomEvent("contour:tick",{detail:{frame:this._streamFrame},bubbles:!0,composed:!0}));const t=this.getAttribute("src");var e;t&&(e=t,It.delete(e),this.requestRender())},Math.max(1e3,1e3*t))))};t(),this._wiredStreamView||(this._wiredStreamView=!0,this._viewVisible=!0,function(t){if(t._contourViewWired)return()=>{};t._contourViewWired=!0;const e=e=>t.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}));if("function"!=typeof IntersectionObserver)return e("contour:view-enter"),()=>{};const s=new IntersectionObserver(t=>{for(const s of t)s.isIntersecting?e("contour:view-enter"):e("contour:view-leave")});s.observe(t),i(t,()=>s.disconnect())}(this),this.addEventListener("contour:view-enter",()=>{this._viewVisible=!0,t()}),this.addEventListener("contour:view-leave",()=>{this._viewVisible=!1,t()})),this._wiredStream||(this._wiredStream=!0,this._streamFrame=0,i(this,()=>{void 0!==this._streamTimer&&(clearInterval(this._streamTimer),this._streamTimer=void 0)}),this._streamPausedByUser=!1,this.addEventListener("click",e=>{const s=e.target,r=this.querySelector(".c-streaming-chart__pause");r&&(s===r||r.contains(s))&&(e.preventDefault(),this._streamPausedByUser=!this._streamPausedByUser,r.setAttribute("aria-pressed",String(this._streamPausedByUser)),r.setAttribute("aria-label",this._streamPausedByUser?"Play stream":"Pause stream"),L(r,this._streamPausedByUser?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-play" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-pause" /></svg>'),this._streamPausedByUser?(this.setAttribute("data-user-paused",""),this.setAttribute("data-motion","paused")):(this.removeAttribute("data-user-paused"),this.removeAttribute("data-motion")),t())}),this.addEventListener("keydown",e=>{if(" "===e.key||"Enter"===e.key){e.preventDefault(),this._streamPausedByUser=!this._streamPausedByUser,this._streamPausedByUser?(this.setAttribute("data-user-paused",""),this.setAttribute("data-motion","paused")):(this.removeAttribute("data-user-paused"),this.removeAttribute("data-motion"));const s=this.querySelector(".c-streaming-chart__pause");s&&(s.setAttribute("aria-pressed",String(this._streamPausedByUser)),s.setAttribute("aria-label",this._streamPausedByUser?"Play stream":"Pause stream")),t()}}))}});c("contour-reference-rule",class extends T{static get observed(){return["value","direction","label","band"]}static get properties(){return{value:{attribute:"value"},direction:{attribute:"direction"},label:{attribute:"label"},band:{attribute:"band"}}}render(){this.classList.add("c-reference-rule");const t=this.getAttribute("direction")||"horizontal";this.setAttribute("data-direction",t);let e=this.querySelector(".c-reference-rule__line");e||(e=document.createElement("div"),e.className="c-reference-rule__line",this.appendChild(e));const s=this.getAttribute("band");s?this.setAttribute("data-band",s):this.removeAttribute("data-band");const r=this.getAttribute("label");let i=this.querySelector(".c-reference-rule__label");r?(i||(i=document.createElement("span"),i.className="c-reference-rule__label",this.appendChild(i)),i.textContent=r):i&&i.remove()}});c("contour-meter",class extends T{static get observed(){return["value","label","variant","min","max","low","high","optimum","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}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(){if(this.classList.add("c-meter"),Zt(this),$t(this,["value","label"]),Xt(this,"meter"))return;const t=Jt(this,"value")||this._remoteData&&this._remoteData.value,e=Jt(this,"label")||this._remoteData&&this._remoteData.label||"",s=this.getAttribute("variant");if(Array.from(this.classList).forEach(t=>{t.startsWith("c-meter--")&&this.classList.remove(t)}),s&&this.classList.add("c-meter--"+s),!t&&!e)return void Yt(this,"meter");if(null===t)this.style.removeProperty("--meter-value");else{const e=parseFloat(t),s=parseFloat(this.getAttribute("min"))||0,r=parseFloat(this.getAttribute("max"))||100;if(Number.isFinite(e)){const t=r>s?Math.min(1,Math.max(0,(e-s)/(r-s))):0;this.style.setProperty("--meter-value",String(t))}else this.style.removeProperty("--meter-value")}const r=this.ensure(".c-meter__core",()=>{const t=document.createElement("span");return t.className="c-meter__core",t});let i=r.querySelector(".c-meter__value");i||(i=document.createElement("span"),i.className="c-meter__value",r.appendChild(i));const a=parseFloat(t),n=parseFloat(this.getAttribute("min"))||0,o=parseFloat(this.getAttribute("max"))||100,c=Number.isFinite(a)&&o>n?Math.min(1,Math.max(0,(a-n)/(o-n))):0;if(i.textContent=Math.round(100*c)+"%",e){(r.querySelector(".c-meter__label")||(()=>{const t=document.createElement("span");return t.className="c-meter__label",r.appendChild(t),t})()).textContent=e}this.hasAttribute("role")||this.setAttribute("role","meter"),e&&!this.hasAttribute("aria-label")&&this.setAttribute("aria-label",e);const l=Number.isFinite(a)?String(a):"0",u=this._meterAriaValue;this.hasAttribute("aria-valuenow")&&this.getAttribute("aria-valuenow")!==u||(this.setAttribute("aria-valuenow",l),this._meterAriaValue=l);const d=this.getAttribute("min"),h=this.getAttribute("max");null!==d?this.setAttribute("aria-valuemin",d):this.setAttribute("aria-valuemin",String(n)),null!==h?this.setAttribute("aria-valuemax",h):this.setAttribute("aria-valuemax",String(o));for(const t of["low","high","optimum"]){const e=this.getAttribute(t);null!==e?this.setAttribute("data-"+t,e):this.removeAttribute("data-"+t)}}});c("contour-delta",class extends T{static get observed(){return["value","direction","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{value:{attribute:"value"},direction:{attribute:"direction"},src:{attribute:"src"}}}render(){if(this.classList.add("c-delta"),Zt(this),$t(this,"value"),Xt(this,"delta"))return;const t=Jt(this,"value")||"";Array.from(this.classList).forEach(t=>{t.startsWith("c-delta--")&&this.classList.remove(t)});const e=this.getAttribute("direction")||this._remoteData&&this._remoteData.direction||"up";if(!t)return void Yt(this,"delta");this.classList.add("c-delta--"+e);const s={up:"#i-arrow-up",down:"#i-arrow-down",flat:"#i-minus"}[e]||"#i-arrow-up";this.querySelectorAll("svg").forEach(t=>t.remove());const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("aria-hidden","true");const i=document.createElementNS("http://www.w3.org/2000/svg","use");i.setAttribute("href",s),r.appendChild(i),this.appendChild(r),this.appendChild(document.createTextNode(" "+t))}});c("contour-stat",class extends T{static get observed(){return["value","label","delta","unit","format","locale","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}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(){if(this.classList.add("c-stat"),Zt(this),$t(this,["value","label"]),Xt(this,"stat"))return;const t=Jt(this,"value"),e=Jt(this,"label"),s=this.getAttribute("delta");if(t){this.ensure(".c-stat__value",()=>{const t=document.createElement("div");return t.className="c-stat__value",t.setAttribute("aria-live","polite"),t}).textContent=B(t,this.getAttribute("format"),this.getAttribute("locale"),this.getAttribute("unit"))}else{const t=this.querySelector(".c-stat__value");t&&t.remove()}if(e){this.ensure(".c-stat__label",()=>{const t=document.createElement("div");return t.className="c-stat__label",t}).textContent=e}else{const t=this.querySelector(".c-stat__label");t&&t.remove()}if(s){this.ensure(".c-stat__delta",()=>{const t=document.createElement("div");return t.className="c-stat__delta",t}).textContent=s}else{const t=this.querySelector(".c-stat__delta");t&&t.remove()}const r=this.getAttribute("unit"),i=this.querySelector(".c-stat__value");if(i)if(r){let t=i.querySelector(".c-stat__unit");t||(t=document.createElement("span"),t.className="c-stat__unit",i.appendChild(t)),t.textContent=r}else{const t=i.querySelector(".c-stat__unit");t&&t.remove()}t||e||Yt(this,"stat")}});c("contour-gauge",class extends T{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","cache-key","no-cache"]}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(){if(this.classList.add("c-gauge"),Zt(this),$t(this,["value"]),Xt(this,"gauge"))return;const t=this.getAttribute("value"),e=parseFloat(t),s=null!==t&&""!==t&&Number.isFinite(e),r=Number.isFinite(parseFloat(this.getAttribute("min")))?parseFloat(this.getAttribute("min")):0,i=Number.isFinite(parseFloat(this.getAttribute("max")))?parseFloat(this.getAttribute("max")):100,a=this.getAttribute("heading"),n="false"!==this.getAttribute("show-header"),c=this.getAttribute("description"),l=this.getAttribute("no-data-message")||"No readings in view";this.brownoutLevel();if(!s){if(a&&n){this.ensure(".c-gauge__title",()=>{const t=document.createElement("div");return t.className="c-gauge__title",t}).textContent=a}return this.ensure(".c-gauge__empty",()=>{const t=document.createElement("div");return t.className="c-gauge__empty",t.setAttribute("part","empty"),t}).textContent=l,void[".c-gauge__dial",".c-gauge__value",".c-gauge__band"].forEach(t=>{const e=this.querySelector(t);e&&e.remove()})}if(a&&n){this.ensure(".c-gauge__title",()=>{const t=document.createElement("div");return t.className="c-gauge__title",t.setAttribute("part","title"),t}).textContent=a}else{const t=this.querySelector(".c-gauge__title");t&&t.remove()}let u=[];const d=this.getAttribute("thresholds");if(d)try{const t=JSON.parse(d);Array.isArray(t)?u=t:f(this,"thresholds",new Error("not an array"))}catch(t){u=[]}let h=null;if(u&&u.length){const t=[...u].sort((t,e)=>(t.value||0)-(e.value||0));for(let s=t.length-1;s>=0;s--)if(e>=(t[s].value||0)){h=t[s];break}}const m=this.shed("dial",3);let b=this.querySelector(".c-gauge__dial");if(m)b&&b.remove();else{b||(b=document.createElementNS("http://www.w3.org/2000/svg","svg"),b.setAttribute("class","c-gauge__dial"),b.setAttribute("part","dial"),b.setAttribute("aria-hidden","true"),b.setAttribute("viewBox","0 0 100 100"),this.appendChild(b)),b.innerHTML="";const t=document.createElementNS("http://www.w3.org/2000/svg","path");if(t.setAttribute("class","c-gauge__track"),t.setAttribute("d","M 10 90 A 40 40 0 0 1 90 90"),b.appendChild(t),u&&u.length){const t=[...u].sort((t,e)=>(t.value||0)-(e.value||0)),e=t=>{const e=(1-(t-r)/(i-r||1))*Math.PI;return{x:50+40*Math.cos(e),y:90-40*Math.sin(e)}};for(let s=0;s<t.length;s++){const r=t[s].value||0,a=s+1<t.length&&t[s+1].value||i,n=e(r),o=e(a),c=document.createElementNS("http://www.w3.org/2000/svg","path");c.setAttribute("class","c-gauge__zone"),c.setAttribute("stroke",t[s].color||"var(--color-primary)"),c.setAttribute("d","M "+n.x.toFixed(2)+" "+n.y.toFixed(2)+" A 40 40 0 0 1 "+o.x.toFixed(2)+" "+o.y.toFixed(2)),b.appendChild(c)}}const s=Math.max(0,Math.min(1,(e-r)/(i-r||1))),a=Math.PI*(1-s),n=document.createElementNS("http://www.w3.org/2000/svg","line");n.setAttribute("class","c-gauge__needle needle"),n.setAttribute("x1","50"),n.setAttribute("y1","90"),n.setAttribute("x2",String(50+35*Math.cos(a))),n.setAttribute("y2",String(90-35*Math.sin(a))),b.appendChild(n);const o=document.createElementNS("http://www.w3.org/2000/svg","circle");o.setAttribute("class","c-gauge__hub hub"),o.setAttribute("cx","50"),o.setAttribute("cy","90"),o.setAttribute("r","4"),b.appendChild(o)}const p=this.ensure(".c-gauge__value",()=>{const t=document.createElement("div");return t.className="c-gauge__value",t.setAttribute("part","value"),t});p.textContent=B(String(e),this.getAttribute("format"),this.getAttribute("locale"))+(this.getAttribute("unit")?" "+this.getAttribute("unit"):""),p.setAttribute("role","meter");const g=Math.max(r,Math.min(i,e));p.setAttribute("aria-valuenow",String(g)),p.setAttribute("aria-valuemin",String(r)),p.setAttribute("aria-valuemax",String(i)),a&&(p.id||(p.id=o("gauge-value"))),h?p.setAttribute("aria-valuetext",e+", "+(h.label||">= "+h.value)):p.setAttribute("aria-valuetext",String(e));const _=this.querySelector(".c-gauge__title");_?(_.id||(_.id=o("gauge-title")),p.setAttribute("aria-labelledby",_.id),p.removeAttribute("aria-label")):(p.removeAttribute("aria-labelledby"),a?p.setAttribute("aria-label",a):p.setAttribute("aria-label",p.textContent||"Gauge"));const v=this.querySelector(".c-gauge__band");if(h){this.ensure(".c-gauge__band",()=>{const t=document.createElement("div");return t.className="c-gauge__band",t.setAttribute("part","band"),t}).textContent=h.label||">= "+h.value}else v&&v.remove();if(c){let t=this.querySelector(".c-gauge__desc");t||(t=document.createElement("div"),t.className="c-gauge__desc",this.appendChild(t)),t.textContent=c}}enhance(){}});c("contour-axis",class extends T{static get observed(){return["orientation","values","ticks","format","locale","min","max","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{orientation:{attribute:"orientation"},values:{attribute:"values"},ticks:{attribute:"ticks"},format:{attribute:"format"},locale:{attribute:"locale"},min:{attribute:"min"},max:{attribute:"max"},src:{attribute:"src"}}}render(){this.classList.add("c-axis"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"axis","Axis"));const t=this.getAttribute("orientation")||"horizontal";if(this.classList.toggle("c-axis--horizontal","horizontal"===t),this.classList.toggle("c-axis--vertical","vertical"===t),"horizontal"===t?this.setAttribute("part","axis-x"):this.setAttribute("part","axis-y"),Zt(this),$t(this,["values"]),Xt(this,"axis"))return;let e=[];const s=this.getAttribute("values");if(s)try{e=JSON.parse(s)}catch(t){e=s.split(",").map(t=>t.trim())}const r=parseInt(this.getAttribute("ticks")||"0",10)||e.length,i=Array.from(this.querySelectorAll(":scope > .c-axis__tick"));if(this.classList.toggle("c-axis--value-ticks",!i.length),i.length)i.forEach(t=>{const e=t.querySelector(".c-axis__label");e&&!e.textContent&&(e.textContent=t.textContent)});else{Array.from(this.querySelectorAll(".c-axis__tick")).forEach(t=>t.remove());const t=e.length?e:Array.from({length:r},(t,e)=>e),s=t.map(t=>Number(t)).filter(Number.isFinite);let i=s.length?Math.min(...s):0,a=s.length?Math.max(...s):0;const n=parseFloat(this.getAttribute("min")),o=parseFloat(this.getAttribute("max"));Number.isFinite(n)&&(i=n),Number.isFinite(o)&&(a=o);const c=a-i||1;t.forEach(t=>{const e=document.createElement("span");e.className="c-axis__tick";const s=document.createElement("span");s.className="c-axis__label",s.textContent=B(String(t),this.getAttribute("format"),this.getAttribute("locale")),e.appendChild(s);const r=Number(t);e.style.setProperty("--tick-pos",Number.isFinite(r)?(r-i)/c*100+"%":"0%"),this.appendChild(e)})}}enhance(){}});c("contour-brush",class extends T{static get observed(){return["start","end","min","max","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{start:{attribute:"start"},end:{attribute:"end"},min:{attribute:"min"},max:{attribute:"max"},src:{attribute:"src"}}}_rangeValue(){const t=parseFloat(this.getAttribute("start")),e=parseFloat(this.getAttribute("end"));return Number.isFinite(t)&&Number.isFinite(e)?[t,e]:null}_brushDetail(){const t=this._rangeValue();return{start:t?t[0]:null,end:t?t[1]:null,value:t?t[1]:null,range:t}}render(){if(this.classList.add("c-brush"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"brush-selection","Brush selection")),Zt(this),$t(this,[]),Xt(this,"brush"))return;let t=this.querySelector(".c-brush__selection");t||(t=document.createElement("div"),t.className="c-brush__selection",this.appendChild(t));const e=parseFloat(this.getAttribute("start")||"0"),s=parseFloat(this.getAttribute("end")||"100"),r=parseFloat(this.getAttribute("min")||"0"),i=parseFloat(this.getAttribute("max")||"100"),a=i-r||1,n=(e-r)/a*100,o=(s-e)/a*100;t.style.insetInlineStart=n+"%",t.style.inlineSize=o+"%",["start","end"].forEach(t=>{let n=this.querySelector(".c-brush__handle--"+t);n||(n=document.createElement("div"),n.className="c-brush__handle c-brush__handle--"+t,this.appendChild(n));const o="start"===t?e:s;n.style.insetInlineStart=(o-r)/a*100+"%",n.setAttribute("role","slider"),n.setAttribute("tabindex","0"),n.setAttribute("aria-valuemin",String(r)),n.setAttribute("aria-valuemax",String(i)),n.setAttribute("aria-valuenow",String(o)),n.setAttribute("aria-label","start"===t?"Start":"End")})}enhance(){if(this._wiredBrush)return;this._wiredBrush=!0;let t=null;const e=()=>parseFloat(this.getAttribute("min")||"0"),s=()=>parseFloat(this.getAttribute("max")||"100"),r=t=>{const r=this.getBoundingClientRect(),i=Math.max(0,Math.min(1,(t-r.left)/(r.width||1)));return e()+i*(s()-e())};this.addEventListener("pointerdown",e=>{const s=e.target&&e.target.classList&&e.target.classList.contains("c-brush__handle")?e.target:null;t=s?s.classList.contains("c-brush__handle--start")?"start":"end":"move";try{this.setPointerCapture(e.pointerId)}catch(t){}this.dispatchEvent(new CustomEvent("contour:brush-start",{bubbles:!0,composed:!0,detail:this._brushDetail()}))}),this.addEventListener("pointermove",i=>{if(!t)return;const a=r(i.clientX),n=e(),o=s(),c=o-n||1,l=this.querySelector(".c-brush__selection");let u=parseFloat(this.getAttribute("start")||"0"),d=parseFloat(this.getAttribute("end")||"100");if("start"===t)u=Math.min(a,d);else if("end"===t)d=Math.max(a,u);else{const t=d-u;u=a-t/2,d=a+t/2,u<n&&(d+=n-u,u=n),d>o&&(u-=d-o,d=o)}u=Math.max(n,Math.min(o,u)),d=Math.max(n,Math.min(o,d)),l&&(l.style.insetInlineStart=(u-n)/c*100+"%",l.style.inlineSize=(d-u)/c*100+"%");const h=this.querySelector(".c-brush__handle--start"),m=this.querySelector(".c-brush__handle--end");h&&(h.style.insetInlineStart=(u-n)/c*100+"%"),m&&(m.style.insetInlineStart=(d-n)/c*100+"%"),this._brushPending={start:u,end:d},this.dispatchEvent(new CustomEvent("contour:brush",{bubbles:!0,composed:!0,detail:{start:u,end:d,value:u,range:[u,d]}}))}),this.addEventListener("pointerup",e=>{if(!t)return;t=null;const s=this._brushPending;s&&(this.setAttribute("start",String(s.start)),this.setAttribute("end",String(s.end)),this._brushPending=null),this.dispatchEvent(new CustomEvent("contour:brush-end",{bubbles:!0,composed:!0,detail:this._brushDetail()})),this.dispatchEvent(new CustomEvent("contour:brush",{bubbles:!0,composed:!0,detail:this._brushDetail()}))}),this.addEventListener("pointercancel",()=>{t&&(t=null,this._brushPending=null,this.requestRender())}),this.addEventListener("keydown",t=>{const r=t.target&&t.target.classList&&t.target.classList.contains("c-brush__handle")?t.target:null,i=r?r.classList.contains("c-brush__handle--start")?"start":"end":null,a=e(),n=s(),o=(n-a)/100||1;let c=parseFloat(this.getAttribute("start")||"0"),l=parseFloat(this.getAttribute("end")||"100");if("Enter"===t.key||" "===t.key)return t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:brush-start",{bubbles:!0,composed:!0,detail:this._brushDetail()})),void this.dispatchEvent(new CustomEvent("contour:brush-end",{bubbles:!0,composed:!0,detail:this._brushDetail()}));let u=!0;if("ArrowLeft"===t.key||"ArrowDown"===t.key)if("start"===i)c-=o;else if("end"===i)l-=o;else{const t=l-c;c-=o,l=c+t}else if("ArrowRight"===t.key||"ArrowUp"===t.key)if("start"===i)c+=o;else if("end"===i)l+=o;else{const t=l-c;l+=o,c=l-t}else"Home"===t.key?"end"===i?l=c:c=a:"End"===t.key?"start"===i?c=l:l=n:u=!1;if(u){if(t.preventDefault(),c=Math.max(a,Math.min(n,c)),l=Math.max(a,Math.min(n,l)),c>l){const t=c;c=l,l=t}this.dispatchEvent(new CustomEvent("contour:brush-start",{bubbles:!0,composed:!0,detail:this._brushDetail()})),this.setAttribute("start",String(c)),this.setAttribute("end",String(l)),this.dispatchEvent(new CustomEvent("contour:brush",{bubbles:!0,composed:!0,detail:this._brushDetail()})),this.dispatchEvent(new CustomEvent("contour:brush-end",{bubbles:!0,composed:!0,detail:this._brushDetail()}))}}),this.addEventListener("contour:clear-all",()=>{(this.hasAttribute("start")||this.hasAttribute("end"))&&(this.removeAttribute("start"),this.removeAttribute("end"),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"brush",filter:{start:null,end:null}}})),this.requestRender())})}});c("contour-stacked-bar",class extends T{static get observed(){return["segments","values","colors","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","max","no-cache"]}static get properties(){return{segments:{attribute:"segments"},values:{attribute:"values"},colors:{attribute:"colors"},src:{attribute:"src"},max:{attribute:"max"}}}render(){if(this.classList.add("c-stacked-bar"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"stacked-bar","Stacked bar")),Zt(this),$t(this,["segments","values"]),Xt(this,"stacked-bar"))return;Array.from(this.querySelectorAll(".c-stacked-bar__segment")).forEach(t=>t.remove());const t=Array.from(this.querySelectorAll(":scope > .c-stacked-bar__segment"));let e=[];if(t.length)e=t.map(t=>({label:t.getAttribute("data-title")||t.getAttribute("title")||t.textContent||"",value:parseFloat(t.style.inlineSize)||0,color:t.dataset&&t.dataset.color||t.style.background||void 0})),t.forEach(t=>t.remove());else{this.getAttribute("segments")&&(e=Qt(this,"segments",f))}const s=e.map(t=>"object"==typeof t?t.value||0:Number(t)||0),r=s.some(t=>t<0),i=s.filter(t=>t>0).reduce((t,e)=>t+e,0),a=Math.abs(s.filter(t=>t<0).reduce((t,e)=>t+e,0)),n=i+a,o=Math.max(i,a,1),c=Math.max(1,parseFloat(this.getAttribute("max"))||(r?o:n));this.querySelectorAll(".c-stacked-bar__track").forEach(t=>t.remove());const l=(t,e,r)=>{const i=s[e],a=document.createElement("div");a.className="c-stacked-bar__segment"+(0===i?" c-stacked-bar__segment--zero":""),a.style.inlineSize=r+"%",a.style.background=_("object"==typeof t&&t.color?t.color:"var(--chart-"+(e%8+1)+")"),a.dataset.color="object"==typeof t&&t.color?t.color:a.style.background;const n="object"==typeof t&&t.label||"";return a.setAttribute("data-title",n+" "+i),a.setAttribute("role","img"),a.setAttribute("aria-label",(n?n+": ":"")+i),a};if(r){this.classList.add("c-stacked-bar--diverging");const t=document.createElement("div");t.className="c-stacked-bar__track c-stacked-bar__track--neg";const r=document.createElement("div");r.className="c-stacked-bar__track",e.forEach((e,i)=>{const a=s[i];if(0===a)return;const n=Math.abs(a)/c*100;(a<0?t:r).appendChild(l(e,i,n))}),this.appendChild(t),this.appendChild(r)}else{this.classList.remove("c-stacked-bar--diverging");const t=document.createElement("div");t.className="c-stacked-bar__track",e.forEach((e,r)=>t.appendChild(l(e,r,s[r]/c*100))),this.appendChild(t)}e.length||Yt(this,"stacked-bar")}enhance(){}});c("contour-category",class extends T{static get observed(){return["items","search","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","note","limit","sort","format","locale","unit","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"},note:{attribute:"note"},limit:{attribute:"limit"},sort:{attribute:"sort"},format:{attribute:"format"},locale:{attribute:"locale"},unit:{attribute:"unit"}}}render(){if(this.classList.add("c-category"),this.setAttribute("role","listbox"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"category","Category")),Zt(this),$t(this,["items"]),Xt(this,"category"))return;Array.from(this.querySelectorAll(".c-category__item")).forEach(t=>t.remove());const t=Array.from(this.querySelectorAll(":scope > .c-category__item"));let e=[];if(t.length)t.forEach(t=>{const s=t.querySelector(".c-category__label");e.push({label:s?s.textContent:t.textContent,value:0})}),t.forEach(t=>t.remove());else{this.getAttribute("items")&&(e=Qt(this,"items",f))}const s=this.getAttribute("sort")||"value-desc";e.sort((t,e)=>{const r="object"==typeof t?t.value||0:Number(t)||0,i="object"==typeof e?e.value||0:Number(e)||0,a="object"==typeof t?t.label||t.name||"":String(t),n="object"==typeof e?e.label||e.name||"":String(e);return"value-asc"===s?r-i:"alpha-asc"===s?String(a).localeCompare(String(n)):"alpha-desc"===s?String(n).localeCompare(String(a)):i-r});const r=parseInt(this.getAttribute("limit")||"0",10);r>0&&(e=e.slice(0,r));const i=e.reduce((t,e)=>Math.max(t,Math.abs("object"==typeof e?e.value||0:Number(e)||0)),0)||1;e.forEach((t,e)=>{const s="object"==typeof t?t.value||0:Number(t)||0,r="object"==typeof t?t.label||t.name||"":String(t),a=document.createElement("div");a.className="c-category__item",a.setAttribute("role","option"),a.setAttribute("aria-selected","false"),a.setAttribute("tabindex",0===e?"0":"-1");const n=document.createElement("span");n.className="c-category__label",n.textContent=r;const o=document.createElement("div");o.style.flex="1";const c=document.createElement("div");c.className="c-category__bar",c.style.inlineSize=Math.abs(s)/i*100+"%",o.appendChild(c);const l=document.createElement("span");l.className="c-category__value",l.textContent=B(s,this.getAttribute("format"),this.getAttribute("locale"),this.getAttribute("unit")),a.appendChild(n),a.appendChild(o),a.appendChild(l),this.appendChild(a)}),e.length||Yt(this,"category");const a=this.getAttribute("note");let n=this.querySelector(".c-category__note");a?(n||(n=document.createElement("div"),n.className="c-category__note",this.appendChild(n)),n.textContent=a):n&&n.remove()}enhance(){if(this._wiredCategory)return;this._wiredCategory=!0;const t=()=>Array.from(this.querySelectorAll(".c-category__item"));this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-category__item"):null;if(!s||!this.contains(s))return;const r=t(),i=r.indexOf(s);r.forEach((t,e)=>t.setAttribute("aria-selected",e===i?"true":"false")),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:i,label:s.querySelector(".c-category__label")?s.querySelector(".c-category__label").textContent:s.textContent.trim()}}))}),this.addEventListener("keydown",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-category__item"):null;if(!s||!this.contains(s))return;const r=t(),i=r.indexOf(s);if("Enter"===e.key||" "===e.key)return e.preventDefault(),r.forEach((t,e)=>t.setAttribute("aria-selected",e===i?"true":"false")),void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:i,label:s.querySelector(".c-category__label")?s.querySelector(".c-category__label").textContent:s.textContent.trim()}}));z(e,r,{wrap:!1,homeEnd:!0,rtl:I(this),onNavigate:t=>r.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{if("Enter"===e.key||" "===e.key){const t=r.indexOf(document.activeElement);r.forEach((e,s)=>e.setAttribute("aria-selected",s===t?"true":"false")),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:t,label:document.activeElement.querySelector(".c-category__label")?document.activeElement.querySelector(".c-category__label").textContent:document.activeElement.textContent.trim()}}))}}})}),this.addEventListener("contour:clear-all",()=>{this.hasAttribute("search")&&(this.removeAttribute("search"),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"category",filter:{search:null}}})))})}});c("contour-donut",class extends T{static get observed(){return["value","values","items","label","color","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","brownout","brownout-level","note","cache-key","no-cache"]}static get properties(){return{value:{attribute:"value"},values:{attribute:"values"},items:{attribute:"items"},label:{attribute:"label"},color:{attribute:"color"},src:{attribute:"src"},note:{attribute:"note"}}}render(){if(this.classList.add("c-donut"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"donut-chart","Donut chart")),Zt(this),$t(this,["items","values"]),Xt(this,"donut"))return;Array.from(this.querySelectorAll(".c-donut__ring, .c-donut__center, .c-donut__list, .c-donut__empty")).forEach(t=>t.remove());const t=Array.from(this.querySelectorAll(":scope > .c-donut__item"));let e=[];if(t.length)t.forEach(t=>{const s=t.querySelector(".c-donut__swatch"),r=t.querySelector("span:last-child"),i=r?r.textContent:t.textContent,a=i.match(/—\s*(\d+(?:\.\d+)?)$/);e.push({label:i.replace(/—\s*\d+(?:\.\d+)?$/,"").trim(),value:a?Number(a[1]):0,color:s?s.dataset&&s.dataset.color||s.style.background:void 0})}),t.forEach(t=>t.remove());else{this.getAttribute("items")&&(e=Qt(this,"items",f))}const s=e.map(t=>"object"==typeof t?t.value||0:Number(t)||0),r=s.reduce((t,e)=>t+(e>0?e:0),0)||1,i=(this.brownoutLevel(),this.getAttribute("color"));if(!this.shed("ring",3)){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("class","c-donut__ring"),t.setAttribute("viewBox","0 0 32 32"),t.setAttribute("role","img");const r=this.getAttribute("label")||"Donut chart";t.setAttribute("aria-label",r);$(s,{cx:16,cy:16,r:15,inner:9,gap:.03}).forEach((s,r)=>{const a=e[s.index],n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("class","c-donut__slice"),n.setAttribute("d",s.path),n.setAttribute("fill","var(--c, var(--chart-1))"),n.style.setProperty("--c",_(i||("object"==typeof a&&a.color?a.color:"var(--chart-"+(s.index%8+1)+")"))||"var(--chart-1)"),n.dataset.index=String(s.index);const o=("object"==typeof a?a.label||"":String(a))+" — "+s.value;n.setAttribute("data-title",o),n.setAttribute("aria-label",o),n.setAttribute("tabindex",0===r?"0":"-1"),n.setAttribute("role","button"),t.appendChild(n)}),this.appendChild(t)}const a=document.createElement("div");a.className="c-donut__center",a.textContent=this.getAttribute("value")??String(r),this.appendChild(a);const n=document.createElement("div");n.className="c-donut__list",n.setAttribute("role","list"),e.forEach((t,e)=>{const r=document.createElement("div");r.className="c-donut__item",r.setAttribute("role","listitem");const a=document.createElement("span");a.className="c-donut__swatch",a.style.background=_(i||("object"==typeof t&&t.color?t.color:"var(--chart-"+(e%8+1)+")")),a.style.background&&(a.dataset.color=i||("object"==typeof t&&t.color?t.color:a.style.background)),r.appendChild(a);const o=document.createElement("span");o.textContent=("object"==typeof t?t.label||"":String(t))+" — "+s[e],r.appendChild(o),n.appendChild(r)}),this.appendChild(n),e.length||Yt(this,"donut");const o=this.getAttribute("note");let c=this.querySelector(".c-donut__note");o?(c||(c=document.createElement("div"),c.className="c-donut__note",this.appendChild(c)),c.textContent=o):c&&c.remove()}enhance(){if(this._wiredDonut)return;this._wiredDonut=!0;const t=()=>Array.from(this.querySelectorAll(".c-donut__slice")),e=t=>{const e=Number(t.dataset.index);Number.isFinite(e)&&this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:1,index:e,value:t.getAttribute("data-title")||t.getAttribute("title")}}))};this.addEventListener("keydown",s=>{const r=s.target&&s.target.closest?s.target.closest(".c-donut__slice"):null;if(!r||!this.contains(r))return;const i=t(),a=i.indexOf(r);let n=-1;if("ArrowRight"===s.key||"ArrowDown"===s.key)n=Math.min(a+1,i.length-1);else if("ArrowLeft"===s.key||"ArrowUp"===s.key)n=Math.max(a-1,0);else if("Home"===s.key)n=0;else if("End"===s.key)n=i.length-1;else if("Enter"===s.key||" "===s.key)return s.preventDefault(),void e(r);if(n>=0&&n!==a){s.preventDefault(),i.forEach((t,e)=>t.setAttribute("tabindex",e===n?"0":"-1"));try{i[n].focus()}catch(t){}}}),this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-donut__slice"):null;s&&this.contains(s)&&e(s)})}});c("contour-time-series",class extends T{static get observed(){return["values","points","series","series-style","title","brownout","brownout-level","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","note","cache-key","no-cache"]}static get properties(){return{values:{attribute:"values"},points:{attribute:"points"},series:{attribute:"series"},src:{attribute:"src"},note:{attribute:"note"}}}render(){if(this.classList.add("c-time-series"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Time series"),Zt(this),$t(this,["values","points","series"]),Xt(this,"time-series"))return;this.ensure(".c-time-series__tooltip",()=>{const t=document.createElement("div");return t.className="c-time-series__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t.id=o("timeseries-tip"),t}),Array.from(this.querySelectorAll(".c-time-series__plot, .c-time-series__axis")).forEach(t=>t.remove());let t=[];this.getAttribute("series")&&(t=Qt(this,"series",f));const e=Jt(this,"series");if(Array.isArray(e)&&(t=e),!t.length){let e=[];if(this.getAttribute("values")&&(e=Qt(this,"values",f)),e.length){const s=(this.getAttribute("style")||"").trim().toLowerCase();t=[{label:"Series 1",values:e,style:this.getAttribute("series-style")||("line"===s||"bar"===s?s:"bar"),color:"var(--chart-1)"}]}}const s=t.reduce((t,e)=>{const s=Array.isArray(e.values)?Math.max(...e.values,0):0;return Math.max(t,s)},1),r=t.reduce((t,e)=>{const s=Array.isArray(e.values)?Math.min(...e.values,0):0;return Math.min(t,s)},0),i=document.createElement("div");i.className="c-time-series__plot",i.setAttribute("part","plot");const a=[];t.forEach((t,e)=>{const n=Array.isArray(t.values)?t.values:[],o=t.style||"bar",c=t.color||`var(--chart-${e%8+1})`,l=t.label||`Series ${e+1}`;if("line"===o){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("viewBox","0 0 300 120"),t.setAttribute("preserveAspectRatio","none"),t.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";const a=s-r||1,o=n.length||1,u=n.map((t,e)=>{const s=e/Math.max(1,o-1)*300,i=120-(t-r)/a*120;return s.toFixed(2)+","+i.toFixed(2)}).join(" "),d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("class","c-time-series__line"),d.setAttribute("data-series",String(e+1)),d.setAttribute("d","M "+u.replace(/ /g," L ")),d.style.stroke=c,d.style.fill="none",d.style.strokeWidth="2",t.appendChild(d),n.forEach((s,i)=>{const n=i/Math.max(1,o-1)*300,c=120-(s-r)/a*120,u=document.createElementNS("http://www.w3.org/2000/svg","circle");u.setAttribute("class","c-time-series__point"),u.setAttribute("data-series",String(e+1)),u.setAttribute("data-index",String(i)),u.setAttribute("cx",n.toFixed(2)),u.setAttribute("cy",c.toFixed(2)),u.setAttribute("r","3"),u.setAttribute("tabindex",0===i&&0===e?"0":"-1"),u.setAttribute("role","button"),u.setAttribute("data-title",String(s)),u.setAttribute("aria-label",l+": "+String(s)),t.appendChild(u)}),i.appendChild(t)}else n.forEach((t,r)=>{const i=document.createElement("div");i.className="c-time-series__bar",i.setAttribute("data-series",String(e+1)),i.setAttribute("data-index",String(r)),i.style.blockSize=t/s*100+"%",i.style.background=_(c),i.setAttribute("data-title",String(t)),i.setAttribute("role","button"),i.setAttribute("aria-label",l+": "+String(t)),i.setAttribute("tabindex",0===r&&0===e?"0":"-1"),(a[r]||(a[r]=[])).push(i)})}),a.forEach(t=>{t&&t.forEach(t=>i.appendChild(t))}),this.appendChild(i);const n=t.find(t=>Array.isArray(t.values)&&t.values.length),c=n?n.values.length:0;if(c>1){const t=document.createElement("div");t.className="c-time-series__axis";const e=n.x;[0,Math.floor((c-1)/2),c-1].filter((t,e,s)=>t>=0&&s.indexOf(t)===e).forEach(s=>{const r=document.createElement("span");r.className="c-time-series__tick",r.textContent=Array.isArray(e)&&null!=e[s]?String(e[s]):String(s),t.appendChild(r)}),this.appendChild(t)}t.length&&t.some(t=>Array.isArray(t.values)&&t.values.length)||Yt(this,"time-series");const l=this.getAttribute("note");let u=this.querySelector(".c-time-series__note");l&&!this.shed("note",2)?(u||(u=document.createElement("div"),u.className="c-time-series__note",this.appendChild(u)),u.textContent=l):u&&u.remove();const d=this.querySelector(".c-time-series__axis");d&&(d.style.display=this.shed("axis",3)?"none":"")}enhance(){if(this._wiredTimeSeries)return;this._wiredTimeSeries=!0;const t=()=>Array.from(this.querySelectorAll(".c-time-series__bar")),e=()=>Array.from(this.querySelectorAll(".c-time-series__point"));this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-time-series__bar"):null;if(!e||!this.contains(e))return;const s=Number(e.dataset.series||"0"),r=Number(e.dataset.index||"0");this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:s,index:r,value:e.getAttribute("data-title")||e.getAttribute("title")}}))});this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-time-series__point"):null;if(!e||!this.contains(e))return;const s=Number(e.dataset.series||"0"),r=Number(e.dataset.index||"0");this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:s,index:r,value:e.getAttribute("data-title")||e.getAttribute("title")}}))}),this.addEventListener("keydown",s=>{const r=s.target&&s.target.closest?s.target.closest(".c-time-series__bar"):null,i=s.target&&s.target.closest?s.target.closest(".c-time-series__point"):null,a=r||i;if(!a||!this.contains(a))return;const n=r?t():e(),o=n.indexOf(a);if("Enter"===s.key||" "===s.key){s.preventDefault();const t=Number(a.dataset.series||"0");return void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:t,index:o,value:a.getAttribute("data-title")||a.getAttribute("title")}}))}z(s,n,{wrap:!1,homeEnd:!0,rtl:I(this),onNavigate:t=>n.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{}})}),this.addEventListener("focusin",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-time-series__bar"):null;if(e&&this.contains(e)){const t=this.querySelector(".c-time-series__tooltip");t&&(t.textContent=e.getAttribute("data-title")||e.getAttribute("title"),t.removeAttribute("hidden"),t.id&&e.setAttribute("aria-describedby",t.id))}const s=t.target&&t.target.closest?t.target.closest(".c-time-series__point"):null;if(s&&this.contains(s)){const t=this.querySelector(".c-time-series__tooltip");t&&(t.textContent=s.getAttribute("data-title")||s.getAttribute("title"),t.removeAttribute("hidden"),t.id&&s.setAttribute("aria-describedby",t.id))}}),this.addEventListener("focusout",t=>{const e=(t.target&&t.target.closest?t.target.closest(".c-time-series__bar"):null)||(t.target&&t.target.closest?t.target.closest(".c-time-series__point"):null);e&&this.contains(e)&&e.removeAttribute("aria-describedby");const s=this.querySelector(".c-time-series__tooltip");s&&!this.contains(t.relatedTarget)&&s.setAttribute("hidden","")})}});c("contour-pivot",class extends T{static get observed(){return["rows","columns","values","data","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","filter","aggregate","cache-key","no-cache"]}static get properties(){return{rows:{attribute:"rows"},columns:{attribute:"columns"},values:{attribute:"values"},data:{attribute:"data"},src:{attribute:"src"},filter:{attribute:"filter"},aggregate:{attribute:"aggregate"}}}_aggregateFn(t){const e=(t||"sum").toLowerCase();return"avg"===e||"average"===e||"mean"===e?t=>t.length?t.reduce((t,e)=>t+e,0)/t.length:0:"count"===e?t=>t.length:"min"===e?t=>t.length?Math.min(...t):0:"max"===e?t=>t.length?Math.max(...t):0:t=>t.reduce((t,e)=>t+e,0)}render(){if(this.classList.add("c-pivot"),Zt(this),$t(this,["data"]),Xt(this,"pivot"))return;Array.from(this.querySelectorAll("table, .c-pivot__wrap, .c-pivot__toolbar, .c-pivot__empty")).forEach(t=>t.remove());let t=[];const e=this.getAttribute("data");if(e)try{t=JSON.parse(e)}catch(e){f(this,"data",e),t=[]}const s=this.getAttribute("rows")?this.getAttribute("rows").split(",").map(t=>t.trim()).filter(Boolean):[],r=this.getAttribute("columns")?this.getAttribute("columns").split(",").map(t=>t.trim()).filter(Boolean):[],i=this.getAttribute("aggregate")||"sum",a=this._aggregateFn(i),n=(this.getAttribute("filter")||"").toLowerCase().trim(),o=document.createElement("div");o.className="c-pivot__toolbar",o.style.display="flex";const c=document.createElement("input");c.type="search",c.className="c-input c-pivot__filter",c.placeholder=k(this,"filter","Filter…"),c.value=this.getAttribute("filter")||"",c.setAttribute("aria-label",k(this,"filter-pivot","Filter pivot"));const l=document.createElement("select");l.className="c-select c-pivot__aggregate",l.setAttribute("aria-label",k(this,"aggregation","Aggregation")),["sum","avg","count","min","max"].forEach(t=>{const e=document.createElement("option");e.value=t,e.textContent=t,t===i&&(e.selected=!0),l.appendChild(e)}),o.appendChild(c),o.appendChild(l),this.appendChild(o);let u=s,d=r;if(n&&(u=s.filter(e=>e.toLowerCase().includes(n)||t.some(t=>t.row===e&&String(t.value).toLowerCase().includes(n))),d=r.filter(e=>e.toLowerCase().includes(n)||t.some(t=>t.col===e&&String(t.value).toLowerCase().includes(n)))),!t.length&&!s.length&&!r.length)return void Yt(this,"pivot");if(n&&(!u.length||!d.length)){const t=document.createElement("div");return t.className="c-pivot__empty",t.setAttribute("role","status"),t.textContent=this.getAttribute("empty")||k(this,"empty","No matching data"),void this.appendChild(t)}if(this._pivotSort&&this._pivotSort.col){const e=this._pivotSort.col,s="asc"===this._pivotSort.dir?1:-1,r=s=>a(t.filter(t=>t.row===s&&t.col===e).map(t=>Number(t.value)).filter(t=>Number.isFinite(t)));u=u.slice().sort((t,e)=>(r(t)-r(e))*s)}const h=document.createElement("div");h.className="c-table-wrap c-pivot__wrap";const m=document.createElement("table");m.className="c-table c-pivot__table",m.setAttribute("role","grid"),m.setAttribute("aria-rowcount",String(u.length+1)),m.setAttribute("aria-colcount",String(d.length+1));const b=document.createElement("thead"),p=document.createElement("tr"),g=document.createElement("th");g.textContent="",g.setAttribute("role","columnheader"),g.setAttribute("aria-label",k(this,"row","Row")),p.appendChild(g);let _=!1;d.forEach(t=>{const e=document.createElement("th");e.textContent=t,e.setAttribute("role","columnheader"),e.setAttribute("tabindex",_?"-1":"0"),_=!0,p.appendChild(e)}),b.appendChild(p),m.appendChild(b);const v=document.createElement("tbody");u.forEach(e=>{const s=document.createElement("tr");s.setAttribute("role","row");const r=document.createElement("th");r.textContent=e,r.setAttribute("role","rowheader"),r.setAttribute("tabindex",_?"-1":"0"),_=!0,s.appendChild(r),d.forEach(r=>{const i=document.createElement("td");i.setAttribute("role","gridcell"),i.setAttribute("tabindex","-1"),i.dataset.row=e,i.dataset.col=r;const n=t.filter(t=>t.row===e&&t.col===r),o=n.map(t=>Number(t.value)).filter(t=>Number.isFinite(t));if(n.length&&o.length===n.length&&o.length){const t=a(o);i.textContent=Number.isInteger(t)?String(t):t.toFixed(2)}else n.length?i.textContent=n.map(t=>t.value).join(", "):i.textContent="";i.textContent.trim()||i.setAttribute("aria-label",k(this,"empty","Empty")),s.appendChild(i)}),v.appendChild(s)}),m.appendChild(v),h.appendChild(m),this.appendChild(h)}enhance(){this._wiredPivot||(this._wiredPivot=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("th"):null,s=t.target&&t.target.closest?t.target.closest("td"):null,r=t.target&&t.target.closest?t.target.closest(".c-pivot__filter"):null,i=t.target&&t.target.closest?t.target.closest(".c-pivot__aggregate"):null;if(!r&&!i){if(e&&this.contains(e)&&e.parentElement&&e.parentElement.parentElement&&"THEAD"===e.parentElement.parentElement.tagName){const t=e.textContent.trim();if(t){const e=this._pivotSort;this._pivotSort={col:t,dir:e&&e.col===t&&"desc"===e.dir?"asc":"desc"},this.requestRender()}return void this.dispatchEvent(new CustomEvent("contour:sort",{bubbles:!0,composed:!0,detail:{column:t}}))}s&&this.contains(s)&&this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{row:s.dataset.row||"",col:s.dataset.col||"",value:s.textContent}}))}}),this.addEventListener("input",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-pivot__filter"):null;e&&this.contains(e)&&(this.setAttribute("filter",e.value),this.dispatchEvent(new CustomEvent("contour:filter",{bubbles:!0,composed:!0,detail:{query:e.value}})),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"pivot",filter:{filter:e.value}}})))}),this.addEventListener("change",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-pivot__aggregate"):null;e&&this.contains(e)&&(this.setAttribute("aggregate",e.value),this.dispatchEvent(new CustomEvent("contour:aggregate",{bubbles:!0,composed:!0,detail:{aggregate:e.value}})))}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest("th, td"):null;if(!e||!this.contains(e))return;const s=this.querySelector("table");if(!s)return;const r=Array.from(s.querySelectorAll("tr")),i=r.indexOf(e.parentElement),a=Array.from(e.parentElement.children).indexOf(e);let n=null;if("ArrowRight"===t.key?n=e.parentElement.children[a+1]:"ArrowLeft"===t.key?n=e.parentElement.children[a-1]:"ArrowDown"===t.key?n=r[i+1]&&r[i+1].children[a]:"ArrowUp"===t.key?n=r[i-1]&&r[i-1].children[a]:"Home"===t.key?n=e.parentElement.children[0]:"End"===t.key&&(n=e.parentElement.children[e.parentElement.children.length-1]),n){t.preventDefault();try{n.focus()}catch(t){}}}),this.addEventListener("contour:clear-all",()=>{this.hasAttribute("filter")&&(this.removeAttribute("filter"),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"pivot",filter:{filter:null}}})))}))}});c("contour-widget-state",class extends T{static get observed(){return["loading","error","empty","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}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"),Zt(this),$t(this,[]),Xt(this,"widget-state")}enhance(){}});c("contour-brownout",class extends T{static get observed(){return["level"]}static get properties(){return{level:{attribute:"level"}}}render(){this.classList.add("c-brownout");const t=this.getAttribute("level")||"0";this.dataset.level=t,this.setAttribute("data-level",t);let e=this.querySelector(".c-brownout__decorative");e||(e=document.createElement("span"),e.className="c-brownout__decorative",e.setAttribute("aria-hidden","true"),this.appendChild(e));let s=this.querySelector(".c-brownout__label");s||(s=document.createElement("span"),s.className="c-brownout__label",this.appendChild(s)),s.textContent=k(this,"level","Level")+" "+t;const r=parseInt(t,10)||0;this._shedDisplay||(this._shedDisplay=new WeakMap),Array.from(this.children).forEach(t=>{if(t.classList.contains("c-brownout__decorative")||t.classList.contains("c-brownout__label"))return;const e=parseInt(t.getAttribute("data-shed")||"2",10);!t.hasAttribute("data-essential")&&Number.isFinite(e)&&r>=e?(this._shedDisplay.has(t)||this._shedDisplay.set(t,t.style.display),t.style.display="none"):this._shedDisplay.has(t)&&(t.style.display=this._shedDisplay.get(t),this._shedDisplay.delete(t))})}enhance(){}});c("contour-instrument",class extends T{static get observed(){return["rows","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{rows:{attribute:"rows"},src:{attribute:"src"}}}render(){if(this.classList.add("c-instrument"),Zt(this),$t(this,"rows"),Xt(this,"instrument"))return;const t=Jt(this,"rows");if(Array.from(this.querySelectorAll(".c-instrument__item")).forEach(t=>t.remove()),t)try{JSON.parse(t).forEach(t=>{const e=document.createElement("span");e.className="c-instrument__item",e.appendChild(document.createTextNode(String(t.key||t[0]||"")));const s=document.createElement("span");s.className="c-instrument__value",s.textContent=t.value||t[1]||"",e.appendChild(s),this.appendChild(e)})}catch(t){f(this,"attribute",t)}else Yt(this,"instrument")}});class ie extends T{static get observed(){return["size","axis-x","axis-y","colors","selected"]}static get properties(){return{size:{attribute:"size"},axisX:{attribute:"axis-x"},axisY:{attribute:"axis-y"},colors:{attribute:"colors"},selected:{attribute:"selected"}}}get _bvBlock(){return"c-bivariate"}get _bvDefaultAxisX(){return"Income"}get _bvDefaultAxisY(){return"Density"}get _bvLiveClassName(){return`${this._bvBlock}__live`}get _bvLiveInlineStyles(){return!0}get _bvAnnounce(){return!1}render(){this.classList.add(this._bvBlock),this.setAttribute("role","group");const t="Bivariate legend",e=this.getAttribute("aria-label");null!==e&&e!==this._lastAutoAria||(this.setAttribute("aria-label",t),this._lastAutoAria=t);const s=Math.min(12,Math.max(1,parseInt(this.getAttribute("size")??"3",10)??3)),r=this.getAttribute("axis-y")??this._bvDefaultAxisY,i=this.getAttribute("axis-x")??this._bvDefaultAxisX,a=this.ensure(`.${this._bvBlock}__matrix`,()=>{const t=document.createElement("div");return t.className=`${this._bvBlock}__matrix`,t});a.style.gridTemplateColumns=`repeat(${s}, 1fr)`,a.style.gridTemplateRows=`repeat(${s}, 1fr)`;if(!Array.from(a.children).filter(t=>t.classList&&t.classList.contains(`${this._bvBlock}__cell`)).length){a.innerHTML="";let t=Qt(this,"colors",f);if(!t.length){t=["#e8e8e8","#b5c0da","#2a5a99","#e4acac","#b07f99","#2d3a6b","#c85a5a","#994d6e","#2a1a30"].slice(0,s*s)}for(let e=0;e<s;e++)for(let n=0;n<s;n++){const o=document.createElement("div");o.className=`${this._bvBlock}__cell`,o.setAttribute("role","button"),o.setAttribute("tabindex",0===e&&0===n?"0":"-1");const c=s-e;o.setAttribute("aria-label",`${r} ${c} of ${s}, ${i} ${n+1} of ${s}`);const l=(s-1-e)*s+n;if(t[l]){const e=_(t[l]);e&&(o.style.background=e,o.dataset.color=e)}a.appendChild(o)}const e=this.getAttribute("selected");if(e){const t=e.split(","),r=parseInt(t[0],10),i=parseInt(t[1],10);Array.from(a.querySelectorAll(`.${this._bvBlock}__cell`)).forEach((t,e)=>{Math.floor(e/s)===r&&e%s===i?t.setAttribute("data-selected",""):t.removeAttribute("data-selected")})}let n=this.querySelector(`.${this._bvBlock}__live`);n||(n=document.createElement("div"),n.className=this._bvLiveClassName,n.setAttribute("aria-live","polite"),this._bvLiveInlineStyles&&(n.style.position="absolute",n.style.width="1px",n.style.height="1px",n.style.overflow="hidden",n.style.clip="rect(0,0,0,0)"),this.appendChild(n))}const n=this.getAttribute("axis-x");if(n){this.ensure(`.${this._bvBlock}__axis--x`,()=>{const t=document.createElement("div");return t.className=`${this._bvBlock}__axis ${this._bvBlock}__axis--x`,t}).textContent=n}else{const t=this.querySelector(`.${this._bvBlock}__axis--x`);t&&t.remove()}const o=this.getAttribute("axis-y");if(o){this.ensure(`.${this._bvBlock}__axis--y`,()=>{const t=document.createElement("div");return t.className=`${this._bvBlock}__axis ${this._bvBlock}__axis--y`,t}).textContent=o}else{const t=this.querySelector(`.${this._bvBlock}__axis--y`);t&&t.remove()}}enhance(){if(this._wiredBivariate)return;this._wiredBivariate=!0;const t=t=>{const e=this.querySelector(`.${this._bvBlock}__matrix`),s=Array.from(e?e.querySelectorAll(`.${this._bvBlock}__cell`):[]),r=s.indexOf(t);if(r<0)return;const i=Math.min(12,Math.max(1,parseInt(this.getAttribute("size")||"3",10)||3)),a=Math.floor(r/i),n=r%i;if(s.forEach((t,e)=>{Math.floor(e/i)===a&&e%i===n?t.setAttribute("data-selected",""):t.removeAttribute("data-selected")}),this._bvAnnounce){const e=this.querySelector(`.${this._bvBlock}__live`);e&&(e.textContent=t.getAttribute("aria-label")||"")}this.dispatchEvent(new CustomEvent("contour:select",{detail:{row:a,col:n},bubbles:!0,composed:!0}))};this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(`.${this._bvBlock}__cell`):null;s&&this.contains(s)&&t(s)}),this.addEventListener("keydown",e=>{const s=e.target&&e.target.closest?e.target.closest(`.${this._bvBlock}__cell`):null;if(!s||!this.contains(s))return;if("Enter"===e.key||" "===e.key)return e.preventDefault(),void t(s);const r=this.querySelector(`.${this._bvBlock}__matrix`);if(!r)return;const i=Array.from(r.querySelectorAll(`.${this._bvBlock}__cell`)),a=i.indexOf(s);if(a<0)return;const n=Math.min(12,Math.max(1,parseInt(this.getAttribute("size")||"3",10)||3)),o=Math.floor(a/n),c=a%n;let l=o,u=c;if("ArrowRight"===e.key)u=Math.min(n-1,c+1);else if("ArrowLeft"===e.key)u=Math.max(0,c-1);else if("ArrowDown"===e.key)l=Math.min(n-1,o+1);else if("ArrowUp"===e.key)l=Math.max(0,o-1);else if("Home"===e.key)l=0,u=0;else{if("End"!==e.key)return;l=n-1,u=n-1}e.preventDefault();const d=i[l*n+u];if(d){i.forEach((t,e)=>t.setAttribute("tabindex",e===l*n+u?"0":"-1"));try{d.focus()}catch(t){}}})}clear(){this.removeAttribute("selected"),this.dispatchEvent(new CustomEvent("contour:clear",{bubbles:!0,composed:!0}))}}c("contour-bivariate",ie);c("contour-bivariate-legend",class extends ie{static get observed(){return["size","axis-x","axis-y","colors","selected"]}static get properties(){return{size:{attribute:"size"},axisX:{attribute:"axis-x"},axisY:{attribute:"axis-y"},colors:{attribute:"colors"},selected:{attribute:"selected"}}}get _bvBlock(){return"c-bivariate-legend"}get _bvDefaultAxisX(){return"X"}get _bvDefaultAxisY(){return"Y"}get _bvLiveClassName(){return"visually-hidden c-bivariate-legend__live"}get _bvLiveInlineStyles(){return!1}get _bvAnnounce(){return!0}clear(){this.removeAttribute("selected");Array.from(this.querySelectorAll(".c-bivariate-legend__cell")).forEach(t=>t.removeAttribute("data-selected")),this.dispatchEvent(new CustomEvent("contour:clear",{bubbles:!0,composed:!0}))}});c("contour-survey",class extends T{static get observed(){return["date","instrument","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{date:{attribute:"date"},instrument:{attribute:"instrument"},src:{attribute:"src"}}}render(){if(this.classList.add("c-survey"),Zt(this),$t(this,"date"),Xt(this,"survey"))return;const t=Jt(this,"date");Array.from(this.childNodes).forEach(t=>{t.nodeType===Node.TEXT_NODE?"Surveyed"!==t.textContent.trim()&&"·"!==t.textContent.trim()||t.remove():t.classList&&(t.classList.contains("c-survey__value")||t.classList.contains("c-survey__sep"))&&t.remove()});const e=t||this._remoteData&&this._remoteData.date,s=this.getAttribute("instrument")||this._remoteData&&this._remoteData.instrument;if(!e)return void Yt(this,"survey");const r=document.createElement("span");if(r.className="c-survey__value",r.textContent=e,this.appendChild(document.createTextNode("Surveyed ")),this.appendChild(r),s){const t=document.createElement("span");t.className="c-survey__sep",t.textContent="·",this.appendChild(t);const e=document.createElement("span");e.className="c-survey__value",e.textContent=s,this.appendChild(e)}}});c("contour-threshold",class extends T{static get observed(){return["label","norm","state","value","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},norm:{attribute:"norm"},state:{attribute:"state"},value:{attribute:"value"},src:{attribute:"src"}}}render(){if(this.classList.add("c-threshold"),this.hasAttribute("role")||this.setAttribute("role","meter"),Zt(this),$t(this,"value"),Xt(this,"threshold"))return;const t=t=>{const e=Number(t);return Number.isFinite(e)?(e<=1?100*e:e)+"%":String(t)},e=Jt(this,"value")||this._remoteData&&this._remoteData.value,s=this.getAttribute("norm")||this._remoteData&&this._remoteData.norm,r=this.getAttribute("state")||this._remoteData&&this._remoteData.state,i=this.getAttribute("label")||this._remoteData&&this._remoteData.label;if(!e&&!s&&!i)return void Yt(this,"threshold");const a=Number(e);if(Number.isFinite(a)){const t=Math.min(100,Math.max(0,a));this.setAttribute("aria-valuenow",String(t)),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax","100")}else this.removeAttribute("aria-valuenow"),this.removeAttribute("aria-valuemin"),this.removeAttribute("aria-valuemax");const n=[i,Number.isFinite(a)?String(a):null,s?k(this,"target","target")+" "+s:null].filter(Boolean).join(", ");if(n?this.setAttribute("aria-valuetext",n):this.removeAttribute("aria-valuetext"),e){this.ensure(".c-threshold__fill",()=>{const t=document.createElement("span");return t.className="c-threshold__fill",t}).style.setProperty("--value",t(e))}else{const t=this.querySelector(".c-threshold__fill");t&&t.remove()}if(s){this.ensure(".c-threshold__target",()=>{const t=document.createElement("span");return t.className="c-threshold__target",t}).style.setProperty("--target",t(s))}else{const t=this.querySelector(".c-threshold__target");t&&t.remove()}r?this.setAttribute("data-state",r):this.removeAttribute("data-state"),i&&this.setAttribute("aria-label",i)}enhance(){this._wiredThreshold||(this._wiredThreshold=!0,this.addEventListener("contour:clear-all",()=>{(this.hasAttribute("norm")||this.hasAttribute("value"))&&(this.removeAttribute("norm"),this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"threshold",filter:{norm:null,value:null}}})),this.requestRender())}))}});c("contour-metrics",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-metrics"),this.setAttribute("role","list"),Zt(this),$t(this,"items"),Xt(this,"metrics"))return;const t=Jt(this,"items");Array.from(this.querySelectorAll(".c-metrics__item")).forEach(t=>t.remove());let e=null;if(t)try{e=JSON.parse(t)}catch(t){e=null}Array.isArray(e)&&e.length?e.forEach(t=>{const e=document.createElement("div");e.className="c-metrics__item",e.setAttribute("role","listitem");const s=document.createElement("div");s.className="c-metrics__value",s.textContent="object"==typeof t&&null!==t?t.value??t.v??"":String(t);const r=document.createElement("div");r.className="c-metrics__label",r.textContent="object"==typeof t&&null!==t?t.label??t.l??"":"",e.appendChild(s),e.appendChild(r),this.appendChild(e)}):t||Yt(this,"metrics")}enhance(){Zt(this)}});c("contour-legend",class extends T{static get observed(){return["title","ramp","scale","items","method","norm","selectable","brownout","brownout-level","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","glyphs","thresholds","breaks","no-data-color","no-data-label","size","table","classification","audit","continuous","ends","caption","graduated","cache-key","no-cache"]}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"},graduated:{attribute:"graduated",type:Boolean}}}render(){this.classList.add("c-legend");const t=this.hasAttribute("graduated");t&&this.classList.add("c-legend--graduated");if(this.hasAttribute("continuous")||this.hasAttribute("selectable")?this.setAttribute("role","group"):this.setAttribute("role","list"),Zt(this),$t(this,"items"),Xt(this,"legend"))return;const e=this.hasAttribute("selectable");e?this.classList.add("c-legend--interactive"):this.classList.remove("c-legend--interactive");const s=Array.from(this.querySelectorAll(":scope > .c-legend__item"));let r=Jt(this,"items");s.length&&(r=JSON.stringify(s.map(t=>{const e=t.querySelector(".c-legend__swatch"),s=t.querySelector(".c-legend__label")||t;return{label:s?s.textContent.trim():t.textContent.trim(),color:e&&(e.dataset&&e.dataset.color||e.style.background)||void 0}})),s.forEach(t=>t.remove()));const i=this.getAttribute("title");if(i){this.ensure(".c-legend__title",()=>{const t=document.createElement("div");return t.className="c-legend__title",t}).textContent=i}else{const t=this.querySelector(".c-legend__title");t&&t.remove()}if(r)try{const s=JSON.parse(r),a=this.ensure(".c-legend__items",()=>{const t=document.createElement("div");return t.className="c-legend__items",t});this.hasAttribute("selectable")?a.setAttribute("role","group"):a.removeAttribute("role"),i&&a.setAttribute("aria-label",i),a.innerHTML="",s.forEach(s=>{const r="string"==typeof s?s:s.label||String(s),i="string"==typeof s?s:s.key||s.label||String(s),n=document.createElement("div");if(n.className="c-legend__item",n.setAttribute("tabindex","-1"),e){n.setAttribute("role","button");const t=this._legendUnpressed&&this._legendUnpressed.has(i);n.setAttribute("aria-pressed",t?"false":"true"),n.dataset.key=i}else n.setAttribute("role","listitem");const o=document.createElement("span");if(t){o.className="c-legend__swatch c-legend__swatch--graduated";const t=s&&null!=s.size?s.size:s&&null!=s.value?s.value:1,e=Math.max(6,Math.min(24,4*parseFloat(t)));o.style.inlineSize=e+"px",o.style.blockSize=e+"px"}else o.className="c-legend__swatch";if(s&&s.color){const t=_(s.color);t&&(o.style.background=t,o.dataset.color=t)}if(n.appendChild(o),t&&s&&null!=s.break){const t=document.createElement("span");t.className="c-legend__break-label",t.textContent=String(s.break),n.appendChild(t)}const c=s&&(s.shape||s.marker||s.glyph)||this.getAttribute("glyphs");if(c){const t=document.createElement("span");t.className="c-legend__glyph",t.setAttribute("part","glyph"),t.textContent="circle"===c?"●":"square"===c?"■":"triangle"===c?"▲":"diamond"===c?"◆":"star"===c?"★":String(c),s&&null!=s.size&&(t.style.fontSize="number"==typeof s.size?s.size+"px":String(s.size)),n.appendChild(t)}if(s&&null!=s.break){const t=document.createElement("span");t.className="c-legend__break",t.textContent=String(s.break),n.appendChild(t)}const l=document.createElement("span");l.className="c-legend__label",l.textContent=r,n.dataset.label=r,n.appendChild(l);const u="object"==typeof s&&s&&(s.caption||s.note)||"";if(u){const t=document.createElement("span");t.className="c-legend__caption",t.textContent=u,n.appendChild(t)}s&&(s.threshold||null!=s.break)&&(o.style.outline="2px solid var(--color-border-strong)"),a.appendChild(n)})}catch(t){f(this,"attribute",t)}else{const t=this.querySelector(".c-legend__items");t&&t.remove();this.getAttribute("title")||this.getAttribute("ramp")||this.getAttribute("scale")||this.getAttribute("method")||this.getAttribute("norm")||Yt(this,"legend")}const a=this.getAttribute("caption");let n=this.querySelector(".c-legend__caption");if(a)n||(n=document.createElement("span"),n.className="c-legend__caption",this.appendChild(n)),n.id=n.id||o("legend-caption"),n.textContent=a,n.style.position="absolute",n.style.width="1px",n.style.height="1px",n.style.overflow="hidden",n.style.clip="rect(0,0,0,0)";else if(n){const t=n.id;n.remove(),t&&this.querySelectorAll(".c-legend__item").forEach(e=>{const s=(e.getAttribute("aria-describedby")||"").split(" ").filter(e=>e&&e!==t);s.length?e.setAttribute("aria-describedby",s.join(" ")):e.removeAttribute("aria-describedby")})}const c=this.querySelector(".c-legend__items");if(c){const t=Array.from(c.querySelectorAll(".c-legend__item"));e?t.forEach((t,e)=>t.setAttribute("tabindex",0===e?"0":"-1")):t.forEach(t=>t.setAttribute("tabindex","-1")),n&&t.forEach(t=>t.setAttribute("aria-describedby",n.id))}const l=this.getAttribute("no-data-color"),u=this.getAttribute("no-data-label")||"No data";if(l){let t=this.querySelector(".c-legend__no-data");t||(t=document.createElement("div"),t.className="c-legend__no-data",this.appendChild(t)),t.setAttribute("part","no-data"),t.setAttribute("aria-label",u),t.textContent=u;const e=document.createElement("span");e.className="glyph",e.style.background=_(l),e.dataset.color=l,t.prepend(e)}else{const t=this.querySelector(".c-legend__no-data");t&&t.remove()}const d=this.getAttribute("audit");if(d){this.ensure(".c-legend__audit",()=>{const t=document.createElement("div");return t.className="c-legend__audit",t}).textContent=d}else{const t=this.querySelector(".c-legend__audit");t&&t.remove()}if(this.hasAttribute("continuous")){const t=this.getAttribute("ends");let e=null;if(t)try{e=JSON.parse(t)}catch(s){e=t.split(",")}if(Array.isArray(e)&&e.length>=2){const t=this.ensure(".c-legend__ramp",()=>{const t=document.createElement("div");return t.className="c-legend__ramp",t});let s=this.querySelector(".c-legend__ramp-label--start");s||(s=document.createElement("span"),s.className="c-legend__ramp-label c-legend__ramp-label--start",t.appendChild(s)),s.textContent=e[0];let r=this.querySelector(".c-legend__ramp-label--end");r||(r=document.createElement("span"),r.className="c-legend__ramp-label c-legend__ramp-label--end",t.appendChild(r)),r.textContent=e[e.length-1]}}const h=this.getAttribute("size");if(h){this.ensure(".c-legend__size",()=>{const t=document.createElement("div");return t.className="c-legend__size",t}).textContent=h}else{const t=this.querySelector(".c-legend__size");t&&t.remove()}const m=this.getAttribute("classification");if(m){this.ensure(".c-legend__classification",()=>{const t=document.createElement("div");return t.className="c-legend__classification",t}).textContent=m}else{const t=this.querySelector(".c-legend__classification");t&&t.remove()}const b=this.getAttribute("table");if(b){let t=null;try{t=JSON.parse(b)}catch(e){t=null}if(Array.isArray(t)){let e=this.querySelector(".c-legend__table-wrap");e||(e=document.createElement("details"),e.className="c-legend__table-wrap",this.appendChild(e)),e.innerHTML="";const s=document.createElement("summary");s.textContent=k(this,"data-table","Data table"),e.appendChild(s);const r=document.createElement("table");r.className="c-legend__table";const i=document.createElement("tbody");t.forEach(t=>{const e=document.createElement("tr");(Array.isArray(t)?t:[t.label??t.key??"",t.value??""]).forEach(t=>{const s=document.createElement("td");s.textContent=t,e.appendChild(s)}),i.appendChild(e)}),r.appendChild(i),e.appendChild(r)}}else{const t=this.querySelector(".c-legend__table-wrap");t&&t.remove()}const p=this.getAttribute("method");if(p){this.ensure(".c-legend__method",()=>{const t=document.createElement("div");return t.className="c-legend__method",t}).textContent=p}else{const t=this.querySelector(".c-legend__method");t&&t.remove()}const g=this.getAttribute("norm");if(g){this.ensure(".c-legend__norm",()=>{const t=document.createElement("span");return t.className="c-legend__norm",t}).textContent=g}else{const t=this.querySelector(".c-legend__norm");t&&t.remove()}const v=this.getAttribute("ramp");if(v){const t=this.ensure(".c-legend__ramp",()=>{const t=document.createElement("div");return t.className="c-legend__ramp",t});t.style.background=_(v);const e=this.getAttribute("breaks");if(e){let s=null;try{s=JSON.parse(e)}catch(t){s=e.split(",").map(t=>t.trim())}Array.isArray(s)&&(Array.from(t.querySelectorAll(".c-legend__ramp-segment")).forEach(t=>t.remove()),s.forEach((e,s)=>{const r=document.createElement("span");r.className="c-legend__ramp-segment",r.style.flex="1";const i=document.createElement("span");i.className="c-legend__ramp-break",i.textContent=String(e),r.appendChild(i),t.appendChild(r)}))}}else{const t=this.querySelector(".c-legend__ramp");t&&t.remove()}const y=this.getAttribute("scale");if(y){this.ensure(".c-legend__scale",()=>{const t=document.createElement("div");return t.className="c-legend__scale",t}).textContent=y}else{const t=this.querySelector(".c-legend__scale");t&&t.remove()}const A=this.shed("chrome",2),E=this.shed("items",3);[".c-legend__ramp",".c-legend__scale"].forEach(t=>{const e=this.querySelector(t);e&&(e.style.display=A?"none":"")}),this.querySelectorAll(".c-legend__caption").forEach(t=>{t.style.display=A?"none":""});const w=this.querySelector(".c-legend__items");w&&(w.style.display=E?"none":"")}enhance(){if(!this._wiredLegend){this._wiredLegend=!0,this.addEventListener("click",t=>{if(!this.hasAttribute("selectable"))return;const e=t.target&&t.target.closest?t.target.closest(".c-legend__item"):null;if(!e||!this.contains(e))return;const s="true"!==e.getAttribute("aria-pressed");e.setAttribute("aria-pressed",String(s)),this._legendUnpressed=this._legendUnpressed||new Set;const r=e.dataset.key||e.textContent.trim();r&&(s?this._legendUnpressed.delete(r):this._legendUnpressed.add(r));const i=Array.from(this.querySelectorAll(".c-legend__item")).indexOf(e),a=e.querySelector(".c-legend__label"),n=e.dataset.label||(a?a.textContent.trim():e.textContent.trim());this.dispatchEvent(new CustomEvent("contour:legend-toggle",{detail:{label:n,key:e.dataset.key||n,pressed:s,index:i},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("contour:select",{detail:{label:n,key:e.dataset.key||n,value:e.dataset.key||n},bubbles:!0,composed:!0}))});try{let t=null;try{t=JSON.parse(this.getAttribute("items")||"null")}catch(e){t=this.getAttribute("items")}this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:this.getAttribute("items"),items:t},bubbles:!0,composed:!0}))}catch(t){}this.addEventListener("change",t=>{const e=t.target;e&&e.classList&&e.classList.contains("c-legend__break-input")&&this.dispatchEvent(new CustomEvent("contour:break-change",{detail:{value:e.value},bubbles:!0,composed:!0}))}),this.addEventListener("keydown",t=>{if(!this.hasAttribute("selectable"))return;const e=Array.from(this.querySelectorAll(".c-legend__item"));if(!e.length)return;const s=document.activeElement,r=e.indexOf(s);if("Escape"===t.key)return e.forEach(t=>t.setAttribute("aria-pressed","false")),void this.dispatchEvent(new CustomEvent("contour:clear",{bubbles:!0,composed:!0}));if(1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey){if("Enter"===t.key||" "===t.key)return t.preventDefault(),void(s&&s.classList.contains("c-legend__item")&&s.click());z(t,e,{wrap:!0,homeEnd:!0,rtl:I(this),onNavigate:t=>e.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{}})}else if(e.length>7){const s=r>=0?r+1:0;for(let r=0;r<e.length;r++){const i=(s+r)%e.length;if((e[i].textContent||"").trim().toLowerCase().startsWith(t.key.toLowerCase())){t.preventDefault(),e[i].focus(),e.forEach((t,e)=>t.setAttribute("tabindex",e===i?"0":"-1"));break}}}}),this.addEventListener("contour:clear-all",()=>{const t=Array.from(this.querySelectorAll(".c-legend__item"));let e=!1;t.forEach(t=>{"button"===t.getAttribute("role")&&"true"===t.getAttribute("aria-pressed")&&(t.setAttribute("aria-pressed","false"),e=!0)}),e&&this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"legend",filter:{selection:null}}}))})}}});c("contour-measure",class extends T{static get observed(){return["label","value","point","line","unit","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},point:{attribute:"point"},line:{attribute:"line"},unit:{attribute:"unit"},src:{attribute:"src"}}}render(){if(this.classList.add("c-measure"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"measure","Measure")),Zt(this),$t(this,["label","value","point","line"]),Xt(this,"measure"))return;const t=Jt(this,"label"),e=Jt(this,"value"),s=Jt(this,"point"),r=Jt(this,"line");if(!(t||e||s||r))return void Yt(this,"measure");if(t){this.ensure(".c-measure__label",()=>{const t=document.createElement("span");return t.className="c-measure__label",t}).textContent=t}else{const t=this.querySelector(".c-measure__label");t&&t.remove()}if(e){this.ensure(".c-measure__readout",()=>{const t=document.createElement("span");return t.className="c-measure__readout",t}).textContent=e}else{const t=this.querySelector(".c-measure__readout");t&&t.remove()}let i=this.querySelector(".c-measure__unit-select");i||(i=document.createElement("select"),i.className="c-measure__unit-select",i.setAttribute("aria-label",k(this,"unit","Unit")),i.setAttribute("data-contour-label","true"),this.appendChild(i)),["m","km","mi","ft"].forEach(t=>{if(!i.querySelector('option[value="'+t+'"]')){const e=document.createElement("option");e.value=t,e.textContent=t,i.appendChild(e)}});const a=void 0!==this._measureUnit?this._measureUnit:this.getAttribute("unit");if(a&&i.querySelector('option[value="'+a+'"]')&&(i.value=a),s){this.ensure(".c-measure__point",()=>{const t=document.createElement("span");return t.className="c-measure__point",t}).textContent=s}else{const t=this.querySelector(".c-measure__point");t&&t.remove()}if(!r){const t=this.querySelector("svg");return void(t&&t.remove())}if(r){this.ensure(".c-measure__line",()=>{const t=document.createElement("span");return t.className="c-measure__line",t}).style.inlineSize=r}else{const t=this.querySelector(".c-measure__line");t&&t.remove()}}enhance(){this._wiredMeasure||(this._wiredMeasure=!0,this.addEventListener("change",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-measure__unit-select"):null;e&&this.contains(e)&&(this._measureUnit=e.value,this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{unit:e.value}})))}))}});c("contour-timeline",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-timeline");let t=this.querySelector(".c-timeline__list");if(t||(t=document.createElement("ol"),t.className="c-timeline__list",t.setAttribute("aria-label",this.getAttribute("aria-label")||"Timeline"),this.appendChild(t)),Zt(this),$t(this,"items"),Xt(this,"timeline"))return;const e=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-timeline__item")),s=Jt(this,"items");if(s&&!e.length){Array.from(t.querySelectorAll(".c-timeline__item")).forEach(t=>t.remove());try{JSON.parse(s).forEach((e,s)=>{const r=document.createElement("li");if(r.className="c-timeline__item",r.setAttribute("tabindex",0===s?"0":"-1"),e.time){const t=document.createElement("time");t.className="c-timeline__time",t.setAttribute("datetime",String(e.time)),t.textContent=e.time,r.appendChild(t)}if(e.title){const t=document.createElement("div");t.className="c-timeline__title",t.textContent=e.title,r.appendChild(t)}if(e.text){const t=document.createElement("div");t.className="c-timeline__text",t.textContent=e.text,r.appendChild(t)}t.appendChild(r)})}catch(t){f(this,"attribute",t)}}else e.length||Yt(this,"timeline")}enhance(){if(this._wiredTimeline)return;this._wiredTimeline=!0;Array.from(this.querySelectorAll(".c-timeline__item")).forEach((t,e)=>t.setAttribute("tabindex",0===e?"0":"-1")),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-timeline__item"):null;if(!e||!this.contains(e))return;const s=Array.from(this.querySelectorAll(".c-timeline__item")).indexOf(e);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:s}}))}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-timeline__item"));e.length&&z(t,e,{wrap:!1,homeEnd:!0,onNavigate:t=>e.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{"Enter"!==t.key&&" "!==t.key||this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:e.indexOf(document.activeElement)}}))}})})}});c("contour-heatmap",class extends T{static get observed(){return["cells","count","legend","brownout","brownout-level","empty","loading","values","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","dir","no-cache"]}static get properties(){return{cells:{attribute:"cells"},count:{attribute:"count"},legend:{attribute:"legend"},src:{attribute:"src"}}}render(){if(this.classList.add("c-heatmap"),this.hasAttribute("role")||this.setAttribute("role","grid"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"heatmap","Heatmap")),Zt(this),$t(this,"cells"),Xt(this,"heatmap"))return;const t=Array.from(this.querySelectorAll(":scope > .c-heatmap__cell"));if(t.length){const e=Math.ceil(Math.sqrt(t.length));this.style.gridTemplateColumns="repeat("+e+", 1fr)",this.style.inlineSize="16rem";let s=null,r=0;const i=()=>{s=document.createElement("div"),s.setAttribute("role","row"),this.appendChild(s),r=0};i(),t.forEach(t=>{t.setAttribute("role","gridcell"),s.appendChild(t),r++,r===e&&i()})}else{Array.from(this.querySelectorAll(".c-heatmap__cell")).forEach(t=>t.remove());const e=Math.min(200,Math.max(0,parseInt(this.getAttribute("cells")||this.getAttribute("count")||"0",10)||0)),s=e>0?Math.ceil(Math.sqrt(e)):1;if(this.style.gridTemplateColumns="repeat("+s+", 1fr)",this.style.inlineSize="16rem",e>0){let t=[];try{t=JSON.parse(this.getAttribute("values")||"[]")}catch(e){t=[]}const r=t.map(t=>{const e=Number(t);return Number.isFinite(e)?e:null}),i=r.filter(t=>null!==t),a=i.length?Math.min.apply(null,i):0,n=(i.length?Math.max.apply(null,i):0)-a,c=t=>null===t?0:n<=0?4:Math.min(7,1+Math.floor((t-a)/n*7));let l=null,u=0;const d=()=>{l=document.createElement("div"),l.setAttribute("role","row"),this.appendChild(l),u=0};d();for(let i=0;i<e;i++){const a=document.createElement("div");a.className="c-heatmap__cell",a.setAttribute("role","gridcell"),a.setAttribute("tabindex",0===i?"0":"-1"),a.dataset.index=String(i);const n=c(r[i]);n&&(a.style.setProperty("--c","var(--chart-seq-"+n+")"),a.dataset.band=String(n)),void 0!==t[i]&&a.setAttribute("data-title",String(t[i])),l.appendChild(a),u++,u===s&&i<e-1&&d()}if(this.shed("tooltip",2)){const t=this.querySelector(".c-heatmap__tooltip");t&&t.remove()}else{this.ensure(".c-heatmap__tooltip",()=>{const t=document.createElement("div");return t.className="c-heatmap__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t.id=o("heatmap-tip"),t}).setAttribute("hidden","")}}else t.length||Yt(this,"heatmap")}if(this.hasAttribute("legend")&&!this.shed("legend",2)){this.ensure(".c-heatmap__legend",()=>{const t=document.createElement("div");t.className="c-heatmap__legend";const e=document.createElement("div");return e.className="c-heatmap__legend-bar",t.appendChild(e),t})}else{const t=this.querySelector(".c-heatmap__legend");t&&t.remove()}}enhance(){if(this._wiredHeatmap)return;this._wiredHeatmap=!0;const t=()=>Array.from(this.querySelectorAll(".c-heatmap__cell")),e=t=>{const e=this.querySelector(".c-heatmap__tooltip");if(!e)return;const s=t.target&&t.target.closest?t.target.closest(".c-heatmap__cell"):null;if(!s||!this.contains(s))return void e.setAttribute("hidden","");const r=s.getAttribute("data-title")||s.getAttribute("title");e.textContent=r||k(this,"cell","Cell")+" "+(s.dataset.index||"");const i=this.getBoundingClientRect(),a=s.getBoundingClientRect();this.style.position=this.style.position||"relative",e.style.setProperty("--chart-tip-inline-start",a.left-i.left+a.width/2+"px"),e.style.setProperty("--chart-tip-block-start",a.top-i.top+"px"),e.removeAttribute("hidden")},s=()=>{const t=this.querySelector(".c-heatmap__tooltip");t&&t.setAttribute("hidden","")};this.addEventListener("mouseover",e),this.addEventListener("mouseout",t=>{t.relatedTarget&&this.contains(t.relatedTarget)||s()}),this.addEventListener("focusin",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-heatmap__cell"):null;if(s&&this.contains(s)){e({target:s});const t=this.querySelector(".c-heatmap__tooltip");t&&t.id&&s.setAttribute("aria-describedby",t.id)}}),this.addEventListener("focusout",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-heatmap__cell"):null;e&&this.contains(e)&&e.removeAttribute("aria-describedby"),this.contains(t.relatedTarget)||s()}),this.addEventListener("keydown",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-heatmap__cell"):null;if(!s||!this.contains(s))return;const r=t(),i=r.indexOf(s);let a=-1;const n="rtl"===(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase();if("ArrowRight"===e.key)a=n?Math.max(i-1,0):Math.min(i+1,r.length-1);else if("ArrowLeft"===e.key)a=n?Math.min(i+1,r.length-1):Math.max(i-1,0);else if("ArrowDown"===e.key)a=Math.min(i+Math.ceil(Math.sqrt(r.length)),r.length-1);else if("ArrowUp"===e.key)a=Math.max(i-Math.ceil(Math.sqrt(r.length)),0);else if("Home"===e.key)a=0;else if("End"===e.key)a=r.length-1;else if("Enter"===e.key||" "===e.key)return e.preventDefault(),void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:1,index:i}}));if(a>=0&&a!==i){e.preventDefault(),r.forEach((t,e)=>t.setAttribute("tabindex",e===a?"0":"-1"));try{r[a].focus()}catch(e){}}}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-heatmap__cell"):null;if(!s||!this.contains(s))return;const r=t().indexOf(s);r>=0&&this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:1,index:r}}))})}});c("contour-compare",class extends T{static get observed(){return["no","text","yes","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{no:{attribute:"no"},text:{attribute:"text"},yes:{attribute:"yes"},src:{attribute:"src"}}}render(){this.classList.add("c-compare"),this.setAttribute("role","group");const t="Comparison",e=this.getAttribute("aria-label");if(null!==e&&e!==this._lastAutoAria||(this.setAttribute("aria-label",t),this._lastAutoAria=t),Zt(this),$t(this,["no","text","yes"]),Xt(this,"compare"))return;const s=Jt(this,"yes")||this._remoteData&&this._remoteData.yes,r=Jt(this,"no")||this._remoteData&&this._remoteData.no,i=Jt(this,"text")||this._remoteData&&this._remoteData.text;if(Array.from(this.querySelectorAll(".c-compare__yes, .c-compare__no, .c-compare__text")).forEach(t=>t.remove()),s){const t=document.createElement("span");t.className="c-compare__yes",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-check" /></svg>'),this.appendChild(t)}if(r){const t=document.createElement("div");t.className="c-compare__no",t.textContent=r,this.appendChild(t)}if(i){const t=document.createElement("p");t.className="c-compare__text",t.textContent=i,this.appendChild(t)}s||r||i||Yt(this,"compare")}});c("contour-sparkline",class extends T{static get observed(){return["points","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{points:{attribute:"points"},src:{attribute:"src"}}}render(){if(this.classList.add("c-sparkline"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"sparkline","Sparkline")),Zt(this),$t(this,"points"),Xt(this,"sparkline"))return;const t=Jt(this,"points");if(t)try{const e=JSON.parse(t),s=Array.isArray(e)?e.filter(Number.isFinite):[];if(0===s.length)throw new Error("empty");Array.from(this.querySelectorAll(".c-sparkline__dot, .c-sparkline__line, .c-sparkline__area")).forEach(t=>t.remove());const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","c-sparkline__line"),r.setAttribute("viewBox","0 0 100 30"),r.setAttribute("preserveAspectRatio","none"),r.style.inlineSize="100%",r.style.blockSize="100%",r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("title",this.getAttribute("aria-label")||"Sparkline");const i=Math.min(...s),a=Math.max(...s)-i||1,n=t=>30-(t-i)/a*30;this._sparkScale={min:i,range:a};const c=s.length,l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",s.map((t,e)=>(0===e?"M":"L")+" "+(1===c?50:100*e/(c-1))+" "+n(t)).join(" ")),r.appendChild(l);const u=document.createElementNS("http://www.w3.org/2000/svg","circle");u.setAttribute("class","c-sparkline__dot"),u.setAttribute("r","2"),u.setAttribute("cx","0"),u.setAttribute("cy","15"),r.appendChild(u),this.appendChild(r),this._sparkPoints=e;this.ensure(".c-sparkline__tooltip",()=>{const t=document.createElement("div");return t.className="c-sparkline__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t.id=o("sparkline-tip"),t}).setAttribute("hidden","")}catch(t){Array.from(this.querySelectorAll("svg")).forEach(t=>t.remove()),Yt(this,"sparkline")}else Yt(this,"sparkline")}enhance(){if(this._wiredSparkline)return;this._wiredSparkline=!0,this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const t=t=>{const e=this.querySelector("svg"),s=this.querySelector(".c-sparkline__tooltip"),r=this.querySelector(".c-sparkline__dot");if(!s||!e)return;const i=e.getBoundingClientRect(),a=t.clientX-i.left,n=Math.max(0,Math.min(1,a/i.width)),o=this._sparkPoints||[];if(0===o.length)return;const c=Math.round(n*(o.length-1)),l=o[c],u=1===o.length?50:100*c/(o.length-1),d=this._sparkScale||{min:Math.min(...o),range:Math.max(...o)-Math.min(...o)||1},h=30-(l-d.min)/d.range*30;r&&(r.setAttribute("cx",String(u)),r.setAttribute("cy",String(h)),r.removeAttribute("hidden")),s.textContent=String(l);const m=u/100*i.width;s.style.setProperty("--chart-tip-inline-start",m+"px"),s.style.setProperty("--chart-tip-block-start","0px"),s.removeAttribute("hidden")},e=()=>{const t=this.querySelector(".c-sparkline__tooltip"),e=this.querySelector(".c-sparkline__dot");t&&t.setAttribute("hidden",""),e&&e.setAttribute("hidden","")};this.addEventListener("mousemove",t),this.addEventListener("mouseleave",e),this.addEventListener("focusin",()=>{if(!(this._sparkPoints||[]).length)return;const e=this.querySelector("svg");if(!e)return;const s=e.getBoundingClientRect();t({clientX:s.left+s.width-1});const r=this.querySelector(".c-sparkline__tooltip");r&&r.id&&this.setAttribute("aria-describedby",r.id)}),this.addEventListener("focusout",()=>{this.removeAttribute("aria-describedby"),e()}),this.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:1}})))})}});c("contour-chart-grid",class extends T{static get updateMode(){return"keyed"}static get observed(){return["title","series","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{title:{attribute:"title"},series:{attribute:"series"},src:{attribute:"src"}}}render(){this.classList.add("c-chart-grid"),this.setAttribute("role","group");const t="Chart grid",e=this.getAttribute("aria-label");if(null!==e&&e!==this._lastAutoAria||(this.setAttribute("aria-label",t),this._lastAutoAria=t),Zt(this),$t(this,"series"),Xt(this,"chart-grid"))return;const s=this.getAttribute("title");if(s){this.ensure(".c-chart-grid__title",()=>{const t=document.createElement("div");return t.className="c-chart-grid__title",t}).textContent=s}const r=Jt(this,"series");let i=[];if(r)try{const t=JSON.parse(r);Array.isArray(t)&&(i=t)}catch(t){}Array.from(this.querySelectorAll(".c-chart-grid__cell")).forEach(t=>t.remove()),i.forEach((t,e)=>{const s=Array.isArray(t)?t:t&&Array.isArray(t.values)?t.values:[],r=!Array.isArray(t)&&t&&t.label?t.label:k(this,"series","Series")+" "+(e+1),i=s.map(Number).filter(Number.isFinite),a=document.createElement("div");a.className="c-chart-grid__cell";const n=document.createElement("span");if(n.className="c-chart-grid__label",n.textContent=r,a.appendChild(n),i.length>1){const t=Math.min(...i),s=Math.max(...i)-t||1,r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","c-chart-grid__spark"),r.setAttribute("viewBox","0 0 100 30"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("aria-hidden","true");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d",i.map((e,r)=>(0===r?"M":"L")+" "+100*r/(i.length-1)+" "+(30-(e-t)/s*30)).join(" ")),n.style.stroke="var(--chart-"+(e%8+1)+")",n.style.fill="none",n.style.strokeWidth="2",r.appendChild(n),a.appendChild(r)}this.appendChild(a)}),i.length||s||Yt(this,"chart-grid")}});c("contour-contour-plot",class extends T{static get observed(){return["values","levels","label","empty"]}static get properties(){return{values:{attribute:"values"},levels:{attribute:"levels"},label:{attribute:"label"}}}render(){this.classList.add("c-contour-plot"),this.hasAttribute("role")||this.setAttribute("role","group");const t=this.getAttribute("label");!t&&this.hasAttribute("aria-label")||this.setAttribute("aria-label",t||"Contour plot");const e=this.getAttribute("values"),s=this.getAttribute("levels");let r=null;if(e)try{r=JSON.parse(e)}catch(t){r=null}let a=[.3,.5,.7];if(s)try{const t=JSON.parse(s);Array.isArray(t)&&t.length&&(a=t)}catch(t){}let n=this.querySelector("svg");if(n||(n=document.createElementNS("http://www.w3.org/2000/svg","svg"),n.setAttribute("class","c-contour-plot__svg"),this.appendChild(n)),n.removeAttribute("aria-hidden"),Array.from(n.querySelectorAll(".c-contour-plot__contour")).forEach(t=>t.remove()),!Array.isArray(r)||0===r.length||!Array.isArray(r[0])||0===r[0].length){const t=document.createElement("div");return t.className="c-contour-plot__empty",t.textContent=this.getAttribute("empty")||Bt(this,"contour"),void this.appendChild(t)}if(Array.isArray(r)&&r.length>1&&Array.isArray(r[0])&&r[0].length>1){const t=()=>{const t=this.clientWidth||300,e=this.clientHeight||300;n.setAttribute("viewBox",`0 0 ${t} ${e}`),n.querySelectorAll(".c-contour-plot__contour").forEach(t=>t.remove());let s=0;G(r,a,t,e).forEach((t,e)=>{if(!t.d)return;const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",t.d),r.setAttribute("class","c-contour-plot__contour"+(e>0?" c-contour-plot__contour--level-"+(e+1):"")),r.setAttribute("tabindex",0===s?"0":"-1"),r.setAttribute("role","button"),r.setAttribute("aria-label",k(this,"level","Level")+" "+(e+1)+": "+t.level),r.dataset.level=String(e+1),r.dataset.value=String(t.level),s+=1,n.appendChild(r)})};t(),"undefined"==typeof ResizeObserver||this._contourResize||(this._contourResize=new ResizeObserver(()=>t()),this._contourResize.observe(this),i(this,()=>{this._contourResize.disconnect(),this._contourResize=null}))}else if(!Array.isArray(r)){const t=document.createElement("div");t.className="c-contour-plot__empty",t.textContent=this.getAttribute("empty")||"No field",this.appendChild(t)}}enhance(){if(this._wiredContourPlot)return;this._wiredContourPlot=!0;const t=()=>Array.from(this.querySelectorAll(".c-contour-plot__contour")),e=e=>{const s=t().indexOf(e);if(s<0)return;const r=Number(e.dataset.level),i=Number(e.dataset.value);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{level:r,value:i,index:s}}))};this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-contour-plot__contour"):null;s&&this.contains(s)&&e(s)}),this.addEventListener("keydown",s=>{const r=s.target&&s.target.closest?s.target.closest(".c-contour-plot__contour"):null;if(r&&this.contains(r))if("Enter"===s.key||" "===s.key)s.preventDefault(),e(r);else{const e=t();z(s,e,{wrap:!1,homeEnd:!0,rtl:I(this),onNavigate:t=>e.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1"))})}})}});c("contour-error-boundary",class extends T{static get observed(){return["fallback","error"]}static get properties(){return{fallback:{attribute:"fallback"},error:{attribute:"error"}}}render(){this.classList.add("c-error-boundary"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite");if(this.getAttribute("error")){this.dataset.state="error",Array.from(this.children).forEach(t=>{t.hasAttribute("data-fallback")||(void 0===t.dataset.contourDisplay&&(t.dataset.contourDisplay=t.style.display),t.style.display="none")});let t=this.querySelector("[data-fallback]");t?("none"===t.style.display&&(t.style.display=""),("1"===t.dataset.contourGenerated||this.hasAttribute("fallback"))&&(t.textContent=this.getAttribute("fallback")||t.textContent||"Something went wrong.")):(t=document.createElement("div"),t.className="c-error-boundary__fallback",t.dataset.fallback="",t.dataset.contourGenerated="1",t.textContent=this.getAttribute("fallback")||"Something went wrong.",this.appendChild(t))}else this.dataset.state="ready",Array.from(this.children).forEach(t=>{t.hasAttribute("data-fallback")?"1"===t.dataset.contourGenerated?t.remove():t.style.display="none":void 0!==t.dataset.contourDisplay?(t.style.display=t.dataset.contourDisplay,delete t.dataset.contourDisplay):"none"===t.style.display&&(t.style.display="")})}enhance(){this._wiredErrorBoundary||(this._wiredErrorBoundary=!0,this.addEventListener("error",t=>{t.stopPropagation();const e=t&&t.error&&t.error.message?t.error.message:t&&t.message?t.message:"Unknown error",s=t&&t.target&&(t.target.src||t.target.href)?t.target.src||t.target.href:void 0;this.setAttribute("error",e),this.dispatchEvent(new CustomEvent("contour:error",{bubbles:!0,composed:!0,detail:s?{message:e,src:s}:{message:e}}))},!0))}});c("contour-data-export",class extends T{static get observed(){return["data","format","filename","label"]}static get properties(){return{data:{attribute:"data"},format:{attribute:"format"},filename:{attribute:"filename"},label:{attribute:"label"}}}render(){this.classList.add("c-data-export"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"data-export","Data export"));const t=(this.getAttribute("format")||"json").toLowerCase(),e="csv"===t||"json"===t?t:"json",s=this.ensure(".c-data-export__btn",()=>{const t=document.createElement("button");return t.className="c-btn c-data-export__btn",t.type="button",t});L(s,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-download" /></svg>'),s.appendChild(document.createTextNode(" "+(this.getAttribute("label")||k(this,"export","Export")+" "+e.toUpperCase()))),s.parentNode!==this&&this.appendChild(s)}enhance(){if(this._wiredDataExport)return;this._wiredDataExport=!0;const t=t=>{let e=null==t?"":String(t);return/^[=+\-@\t\r]/.test(e)&&(e="'"+e),/[",\r\n]/.test(e)?'"'+e.replace(/"/g,'""')+'"':e};this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-data-export__btn"):null;if(!s||!this.contains(s))return;const r=(this.getAttribute("format")||"json").toLowerCase(),i="csv"===r||"json"===r?r:(console.warn("[contour-data-export] unsupported format:",r),"json"),a=this.getAttribute("data")||"[]";let n=a;if("csv"===i)try{const e=JSON.parse(a);if(Array.isArray(e))if(0===e.length)n="";else{const s=Object.keys(e[0]);n=[s.map(t).join(",")].concat(e.map(e=>s.map(s=>t(e[s])).join(","))).join("\r\n")}}catch(t){f(this,"data",t)}const o=new Blob(["csv"===i?"\ufeff"+n:n],{type:"csv"===i?"text/csv":"application/json"}),c=URL.createObjectURL(o),l=document.createElement("a");l.href=c,l.download=this.getAttribute("filename")||"export."+i,document.body.appendChild(l),l.click(),l.remove(),setTimeout(()=>URL.revokeObjectURL(c),0),this.dispatchEvent(new CustomEvent("contour:export",{bubbles:!0,composed:!0,detail:{format:i}}))})}});class ae extends T{static get observed(){return["query","fields"]}static get properties(){return{query:{attribute:"query"},fields:{attribute:"fields"}}}readRules(){const t=[],e=Array.from(this.querySelectorAll(".c-query-builder__row")),s=Array.from(this.querySelectorAll(".c-query-builder__connector__op"));return e.forEach((e,r)=>{const i={field:e.querySelector(".c-query-builder__field")?.value||"",op:e.querySelector(".c-query-builder__op")?.value||"=",value:e.querySelector(".c-query-builder__value")?.value||""};r>0&&s[r-1]&&(i.connector=s[r-1].value||"AND");const a=e.closest(".c-query-builder__group");a&&(i.group=a._groupName||""),t.push(i)}),t}static reindexConnectors(t,e){return t.forEach((t,s)=>{s>0&&e&&e[s]?t.connector=e[s]:delete t.connector}),t}attributeChangedCallback(t,e,s){"query"===t&&this._suppressQueryRender||super.attributeChangedCallback(t,e,s)}commit(t,e=!0){if(e)this.setAttribute("query",JSON.stringify(t));else{this._suppressQueryRender=!0;try{this.setAttribute("query",JSON.stringify(t))}finally{this._suppressQueryRender=!1}}this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{query:t}}))}render(){this.classList.add("c-query-builder");const t=this.getAttribute("fields");let e=[];if(t)try{e=JSON.parse(t)}catch(t){e=[]}const s=this.getAttribute("query");let r=[];if(s)try{r=JSON.parse(s)}catch(t){r=[]}const i=this.ensure(".c-query-builder__list",()=>{const t=document.createElement("div");return t.className="c-query-builder__list",t});Array.from(i.querySelectorAll(".c-query-builder__row, .c-query-builder__connector, .c-query-builder__group")).forEach(t=>t.remove());let a=null;r.forEach((t,s)=>{const n=t&&t.group?String(t.group):"",o=!(!n||!a||a._groupName!==n);let c=null;if(s>0){c=document.createElement("div"),c.className="c-query-builder__connector";const e=document.createElement("select");e.className="c-input c-query-builder__connector__op",e.setAttribute("aria-label",k(this,"connector","Connector")+" "+s),["AND","OR"].forEach(s=>{const r=document.createElement("option");r.value=s,r.textContent=s,s===(t.connector||"AND")&&(r.selected=!0),e.appendChild(r)}),c.appendChild(e)}if(n)if(o)c&&a.appendChild(c);else{c&&i.appendChild(c),a=document.createElement("div"),a.className="c-query-builder__group",a._groupName=n;const t=document.createElement("div");t.className="c-query-builder__group-head";const e=document.createElement("div");e.className="c-query-builder__group-label",e.textContent=n;const s=document.createElement("button");s.type="button",s.className="c-btn c-btn--sm c-btn--ghost c-query-builder__group-remove",s.setAttribute("aria-label",k(this,"remove-group","Remove group")+" "+n),s.setAttribute("data-group",n),s.textContent="×",t.appendChild(e),t.appendChild(s),a.appendChild(t),i.appendChild(a)}else c&&i.appendChild(c),a=null;const l=document.createElement("div");l.className="c-query-builder__row";const u=document.createElement("select");u.className="c-input c-query-builder__field",u.setAttribute("aria-label",k(this,"field","Field")+" "+(s+1)),e.forEach(e=>{const s=document.createElement("option");s.value="string"==typeof e?e:e.value||e.label||"",s.textContent="string"==typeof e?e:e.label||e.value||"",s.value===t.field&&(s.selected=!0),u.appendChild(s)});const d=document.createElement("select");d.className="c-input c-query-builder__op",d.setAttribute("aria-label",k(this,"operator","Operator")+" "+(s+1)),["=","!=",">","<","contains"].forEach(e=>{const s=document.createElement("option");s.value=e,s.textContent=e,e===t.op&&(s.selected=!0),d.appendChild(s)});const h=document.createElement("input");h.className="c-input c-query-builder__value",h.type="text",h.setAttribute("value",t.value||""),h.value=t.value||"",h.setAttribute("aria-label",k(this,"value","Value")+" "+(s+1));const m=document.createElement("button");m.type="button",m.className="c-btn c-btn--sm c-btn--ghost c-query-builder__move c-query-builder__move--up",m.setAttribute("aria-label",k(this,"move-rule","Move rule")+" "+(s+1)+" "+k(this,"up","up")),m.textContent="↑",0===s&&(m.disabled=!0);const b=document.createElement("button");b.type="button",b.className="c-btn c-btn--sm c-btn--ghost c-query-builder__move c-query-builder__move--down",b.setAttribute("aria-label",k(this,"move-rule","Move rule")+" "+(s+1)+" "+k(this,"down","down")),b.textContent="↓",s===r.length-1&&(b.disabled=!0);const p=document.createElement("button");p.type="button",p.className="c-btn c-btn--sm c-btn--ghost c-query-builder__remove",p.setAttribute("aria-label",k(this,"remove-rule","Remove rule")+" "+(s+1)),p.textContent="×",l.appendChild(u),l.appendChild(d),l.appendChild(h),l.appendChild(m),l.appendChild(b),l.appendChild(p),a?a.appendChild(l):i.appendChild(l)});const n=this.ensure(".c-query-builder__add",()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--sm c-query-builder__add",t});L(n,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-plus" /></svg>'),n.appendChild(document.createTextNode(" "+k(this,"add-rule","Add rule"))),n.parentNode!==this&&this.appendChild(n);const o=this.ensure(".c-query-builder__add-group",()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--sm c-btn--ghost c-query-builder__add-group",t});L(o,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-plus" /></svg>'),o.appendChild(document.createTextNode(" "+k(this,"add-group","Add group"))),o.parentNode!==this&&this.appendChild(o)}enhance(){this._wiredQueryBuilder||(this._wiredQueryBuilder=!0,this.addEventListener("change",t=>{const e=t.target;e instanceof Element&&e.matches(".c-query-builder__field, .c-query-builder__op, .c-query-builder__value, .c-query-builder__connector__op")&&this.commit(this.readRules(),!1)}),this.addEventListener("click",t=>{const e=t.target;if(!(e instanceof Element))return;if(e.closest(".c-query-builder__add")){const t=this.readRules().map(t=>t.connector),e=this.readRules();e.push({field:"",op:"=",value:""}),this.commit(ae.reindexConnectors(e,t));const s=this.querySelectorAll(".c-query-builder__row"),r=s[s.length-1],i=r&&r.querySelector(".c-query-builder__field");if(i)try{i.focus()}catch(t){}return}if(e.closest(".c-query-builder__add-group")){const t=this.readRules().map(t=>t.connector),e=this.readRules(),s=new Set(e.map(t=>t.group).filter(Boolean));let r=1;for(;s.has("Group "+r);)r++;e.push({field:"",op:"=",value:"",group:"Group "+r}),this.commit(ae.reindexConnectors(e,t));const i=this.querySelectorAll(".c-query-builder__row"),a=i[i.length-1],n=a&&a.querySelector(".c-query-builder__field");if(n)try{n.focus()}catch(t){}return}const s=e.closest(".c-query-builder__group-remove");if(s){const t=s.getAttribute("data-group")||"",e=this.readRules().map(t=>t.connector),r=this.readRules().filter(e=>(e.group||"")!==t);return void this.commit(ae.reindexConnectors(r,e))}const r=e.closest(".c-query-builder__move");if(r){const t=r.closest(".c-query-builder__row");if(!t)return;const e=r.classList.contains("c-query-builder__move--up"),s=this.readRules().map(t=>t.connector),i=this.readRules(),a=Array.from(this.querySelectorAll(".c-query-builder__row")).indexOf(t);if(a<0)return;const n=e?a-1:a+1;if(n<0||n>=i.length)return;const o=i[n];i[n]=i[a],i[a]=o,this.commit(ae.reindexConnectors(i,s));const c=this.querySelectorAll(".c-query-builder__row")[n],l=c&&c.querySelector(e?".c-query-builder__move--up":".c-query-builder__move--down");if(l&&!l.disabled)try{l.focus()}catch(t){}return}if(e.closest(".c-query-builder__remove")){const t=e.closest(".c-query-builder__row");if(!t)return;const s=this.readRules().map(t=>t.connector),r=this.readRules(),i=Array.from(this.querySelectorAll(".c-query-builder__row")).indexOf(t);i>=0&&r.splice(i,1),this.commit(ae.reindexConnectors(r,s))}}))}}function ne(t,e,s,r){const i=_(t.getAttribute(e));if(i)return i;try{const e=getComputedStyle(t).getPropertyValue(s).trim();if(e)return e}catch(t){}return r}c("contour-query-builder",ae);c("contour-donut-glyph",class extends T{static get observed(){return["size","value","color","stroke-width","bg-color","empty","loading","error","cache-key","no-cache","retry","skeleton","src"]}static get properties(){return{size:{attribute:"size"},value:{attribute:"value"},color:{attribute:"color"},strokeWidth:{attribute:"stroke-width"},bgColor:{attribute:"bg-color"}}}render(){if(this.classList.add("c-donut-glyph"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"donut-glyph","Donut glyph")),Zt(this),Xt(this,"donut-glyph"))return;const t=this.querySelector("canvas");t&&t.remove();const e=Number(this.getAttribute("size"))||24,s=document.createElement("canvas");s.width=e,s.height=e,s.style.inlineSize=e+"px",s.style.blockSize=e+"px";const r=s.getContext("2d");r&&(!function(t,{size:e=24,value:s=0,color:r="#1f77b4",strokeWidth:i,bgColor:a="transparent"}={}){const n=Number(e)||24,o=null!=i?Number(i):Y(n),c=X(s),l=n/2,u=n/2,d=(n-o)/2;a&&"transparent"!==a?(t.fillStyle=a,t.fillRect(0,0,n,n)):t.clearRect(0,0,n,n),t.beginPath(),t.arc(l,u,d,0,2*Math.PI),t.lineWidth=o,t.strokeStyle="rgba(0,0,0,0.12)",t.stroke(),c>0&&(t.beginPath(),t.arc(l,u,d,-Math.PI/2,-Math.PI/2+2*c*Math.PI),t.lineWidth=o,t.strokeStyle=r,t.lineCap="round",t.stroke())}(r,{size:e,value:Number(this.getAttribute("value"))||0,color:ne(this,"color","--color-data","#1f77b4"),strokeWidth:this.getAttribute("stroke-width")?Number(this.getAttribute("stroke-width")):void 0,bgColor:this.getAttribute("bg-color")||"transparent"}),this.appendChild(s))}});c("contour-sparkline-glyph",class extends T{static get observed(){return["size","points","color","stroke-width","bg-color","empty","loading","error","cache-key","no-cache","retry","skeleton","src"]}static get properties(){return{size:{attribute:"size"},points:{attribute:"points"},color:{attribute:"color"},strokeWidth:{attribute:"stroke-width"},bgColor:{attribute:"bg-color"}}}render(){if(this.classList.add("c-sparkline-glyph"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"sparkline-glyph","Sparkline glyph")),Zt(this),Xt(this,"sparkline-glyph"))return;const t=this.querySelector("canvas");t&&t.remove();const e=Number(this.getAttribute("size"))||24,s=document.createElement("canvas");s.width=e,s.height=e,s.style.inlineSize=e+"px",s.style.blockSize=e+"px";const r=s.getContext("2d");if(!r)return;let i=[];const a=this.getAttribute("points");if(a)try{const t=JSON.parse(a);i=Array.isArray(t)?t.filter(Number.isFinite):[]}catch(t){f(this,"points",t)}Q(r,{size:e,values:i,color:ne(this,"color","--color-data","#1f77b4"),strokeWidth:this.getAttribute("stroke-width")?Number(this.getAttribute("stroke-width")):void 0,bgColor:this.getAttribute("bg-color")||"transparent"}),this.appendChild(s)}});c("contour-purity-ring",class extends T{static get observed(){return["size","hue","concentration","color","uncertainty","time-step","time-steps","empty","loading","error","cache-key","no-cache","retry","skeleton","src"]}static get properties(){return{size:{attribute:"size"},hue:{attribute:"hue"},concentration:{attribute:"concentration"},color:{attribute:"color"},uncertainty:{attribute:"uncertainty"},timeStep:{attribute:"time-step"},timeSteps:{attribute:"time-steps"}}}render(){if(this.classList.add("c-purity-ring"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"purity-ring","Purity ring")),Zt(this),Xt(this,"purity-ring"))return;const t=this.querySelector("canvas");t&&t.remove();const e=Number(this.getAttribute("size"))||32,s=document.createElement("canvas");s.width=e,s.height=e,s.style.inlineSize=e+"px",s.style.blockSize=e+"px";const r=s.getContext("2d");r&&(Z(r,{size:e,hue:Number(this.getAttribute("hue"))||0,concentration:Number(this.getAttribute("concentration"))||0,color:ne(this,"color","--color-data",void 0),uncertainty:Number(this.getAttribute("uncertainty"))||0,timeStep:this.getAttribute("time-step")?Number(this.getAttribute("time-step")):void 0,timeSteps:this.getAttribute("time-steps")?Number(this.getAttribute("time-steps")):4}),this.appendChild(s))}});const oe=t=>{const e=String(null==t?"":t).trim();if(!e)return"";if(e.startsWith("#"))return"hash:"+e;try{const t="undefined"!=typeof location?location.href:"http://localhost/",s=new URL(e,t);return"path:"+s.pathname.replace(/\/+$/,"")+s.search}catch(t){return"raw:"+e}};c("contour-docs-nav",class extends T{static get observed(){return["items","title","current","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","empty","no-cache"]}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 t=this.getAttribute("title");if(t?this.setAttribute("aria-label",t):this.setAttribute("aria-label",k(this,"documentation-navigation","Documentation navigation")),Zt(this),$t(this,"items"),Xt(this,"docs-nav"))return;const e=Jt(this,"items"),s=this.hasAttribute("src")?e:e||(this.hasAttribute("items")?this.getAttribute("items"):null),r=this.querySelector(".c-docs-nav__list"),i=r?Array.from(r.children).filter(t=>t.classList&&t.classList.contains("c-docs-nav__group")):[];if(s&&!i.length)try{const t=JSON.parse(s),e=this.ensure(".c-docs-nav__list",()=>{const t=document.createElement("div");return t.className="c-docs-nav__list",t});e.innerHTML="",t.forEach(t=>{const s=document.createElement("div");if(s.className="c-docs-nav__group",t.title){const e=document.createElement("div");e.className="c-docs-nav__group-title",e.textContent=t.title,s.appendChild(e)}const r=document.createElement("div");r.className="c-docs-nav__list",(t.links||t.items||[]).forEach(t=>{const e=document.createElement("a");e.className="c-docs-nav__link",e.href=v("string"==typeof t?"#":t.href||"#");const s="string"==typeof t?t:t.label||t;if("object"==typeof t&&null!==t&&t.badge){const s=document.createElement("span");s.className="c-docs-nav__badge",s.textContent=t.badge,e.appendChild(s)}if(e.appendChild(document.createTextNode(s)),"object"==typeof t&&null!==t&&t.chevron){const t=document.createElement("span");t.className="c-docs-nav__chevron",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),e.appendChild(t)}if("object"==typeof t&&null!==t&&Array.isArray(t.items)){e.classList.add("c-docs-nav__link--nested");const s=document.createElement("div");s.className="c-docs-nav__list c-docs-nav__list--nested",t.items.forEach(t=>{const e=document.createElement("a");e.className="c-docs-nav__link",e.href=v("string"==typeof t?"#":t.href||"#"),e.textContent="string"==typeof t?t:t.label||t,s.appendChild(e)}),r.appendChild(e),r.appendChild(s)}else r.appendChild(e)}),s.appendChild(r),e.appendChild(s)})}catch(t){f(this,"attribute",t)}else!s&&r?(r.remove(),Yt(this,"docs-nav")):s||r||Yt(this,"docs-nav");this.applyCurrent()}applyCurrent(){const t=Array.from(this.querySelectorAll(".c-docs-nav__link"));if(!t.length)return;const e=this.getAttribute("current"),s=(t=>{const e=String(null==t?"":t).trim();return e?oe(e):"undefined"==typeof location?"":"path:"+String(location.pathname||"").replace(/\/+$/,"")+(location.search||"")})(e);t.forEach(t=>{const r=t.getAttribute("href")||"",i=oe(r);Boolean(s)&&(i&&i===s||r.startsWith("#")&&!e&&(t=>{if("undefined"==typeof location)return!1;if(location.hash&&location.hash===t)return!0;const e=String(location.pathname||"").split("/").filter(Boolean).pop()||"";return Boolean(e)&&t==="#"+e})(r))?t.setAttribute("aria-current","page"):t.removeAttribute("aria-current")})}enhance(){if(!this._wiredDocsNav&&(this._wiredDocsNav=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-docs-nav__link"):null;if(e&&this.contains(e)){const t=e.textContent||"";this.dispatchEvent(new CustomEvent("contour:docs-nav-select",{bubbles:!0,composed:!0,detail:{label:t,href:e.getAttribute("href")}}))}}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-docs-nav__link"));e.length&&(e.some(t=>0===t.tabIndex)||e.forEach((t,e)=>t.tabIndex=0===e?0:-1),z(t,e,{wrap:!0,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e){const e=document.activeElement;e&&(t.preventDefault(),e.click())}}}))}),"undefined"!=typeof window&&window.addEventListener)){const t=()=>this.applyCurrent();window.addEventListener("hashchange",t),window.addEventListener("popstate",t),i(this,()=>{window.removeEventListener("hashchange",t),window.removeEventListener("popstate",t)})}}});c("contour-docs-shell",class extends T{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 t=this.getAttribute("title");if(t){this.ensure(".c-docs-shell__title",()=>{const t=document.createElement(E(this,"h2"));return t.className="c-docs-shell__title",t}).textContent=t,this.setAttribute("aria-label",t)}else{const t=this.querySelector(".c-docs-shell__title");t&&t.remove()}const e=this.getAttribute("lede");if(e){this.ensure(".c-docs-shell__lede",()=>{const t=document.createElement("p");return t.className="c-docs-shell__lede",t}).textContent=e}else{const t=this.querySelector(".c-docs-shell__lede");t&&t.remove()}const s=this.getAttribute("article");if(s){L(this.ensure(".c-docs-shell__article",()=>{const t=document.createElement("article");return t.className="c-docs-shell__article",t}),g(s))}else{const t=this.querySelector(".c-docs-shell__article");t&&t.remove()}}});c("contour-file-tree",class extends T{static get updateMode(){return"keyed"}static get observed(){return["items"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-file-tree");const t=this.getAttribute("items");if(t)try{const e=JSON.parse(t),s=(t,e)=>{const r=document.createElement("div");r.className="c-file-tree__row"+(t.dir?" c-file-tree__row--dir":"")+(t.active?" c-file-tree__row--active":""),r.style.setProperty("--depth",String(e));const i=document.createElement("span");L(i,t.dir?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-folder" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-file" /></svg>'),i.appendChild(document.createTextNode(" "+(t.label||t.name||""))),r.appendChild(i),this.appendChild(r),Array.isArray(t.children)&&t.children.forEach(t=>s(t,e+1))};Array.from(this.querySelectorAll(".c-file-tree__row")).forEach(t=>t.remove()),e.forEach(t=>s(t,0))}catch(t){f(this,"attribute",t)}}});function ce(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function le(t){if(!t.hasAttribute("open")||t._modalEngaged)return;t._modalEngaged=!0,t.setAttribute("aria-modal","true"),Ft(t,!0);const e=t.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(e)try{e.focus()}catch(t){}}function ue(t,e,s,r){if("open"===e&&r&&!t._declarativeOpen){t._declarativeOpen=!0;try{null===s||t.hasAttribute("aria-modal")?null===s&&t.hasAttribute("aria-modal")&&t.close():(t.removeAttribute("open"),t.show())}finally{t._declarativeOpen=!1}}}c("contour-changelog",class extends T{static get observed(){return["src","max","loading","error"]}static get properties(){return{src:{attribute:"src"},max:{attribute:"max",type:Number}}}render(){this.classList.add("c-changelog");const t=this.getAttribute("src");if(t){if(this.dataset.loaded===t)return;this.dataset.loaded="";const e=this.ensure(".c-changelog__loading",()=>{const t=document.createElement("div");return t.className="c-changelog__loading",t});e.textContent=k(this,"loading","Loading…"),Array.from(this.querySelectorAll(".c-changelog__entry, .c-changelog__error")).forEach(t=>t.remove()),this.querySelector(".c-changelog__loading")||this.appendChild(e);try{this._changelogAbort&&this._changelogAbort.abort()}catch(t){}this._changelogAbort="undefined"!=typeof AbortController?new AbortController:null,fetch(t,this._changelogAbort?{signal:this._changelogAbort.signal}:void 0).then(t=>{if(!t.ok)throw new Error("HTTP "+t.status);return t.text()}).then(e=>{if(!this.isConnected)return;const s=this.querySelector(".c-changelog__loading");s&&s.remove(),this.dataset.loaded=t;const r=function(t){const e=String(t).split(/\r?\n/),s=[];let r=null;for(const t of e){const e=t.match(/^##\s+\[?([^\]\n]+)\]?\s*[-–—]?\s*(.*)$/);if(e&&t.startsWith("## ")){const t=e[1].trim(),i=e[2].trim();if(/^\d|unreleased/i.test(t)){r&&s.push(r),r={version:t,date:i.replace(/^[-–—]\s*/,"").trim(),body:""};continue}}r&&(r.body+=t+"\n")}r&&s.push(r);return s}(e),i=parseInt(this.getAttribute("max")||"0",10),a=i>0?r.slice(0,i):r;if(!a.length){const t=document.createElement("div");return t.className="c-changelog__empty",t.textContent=k(this,"empty","No releases found."),void this.appendChild(t)}a.forEach(t=>{const e=document.createElement("details");e.className="c-changelog__entry";const s=document.createElement("summary");s.className="c-changelog__summary";const r=document.createElement("span");if(r.className="c-changelog__version",r.textContent=t.version,s.appendChild(r),t.date){const e=document.createElement("span");e.className="c-changelog__date",e.textContent=t.date,s.appendChild(e)}e.appendChild(s);const i=document.createElement("div");i.className="c-changelog__body",L(i,function(t){const e=String(t).trim().split(/\r?\n/),s=[];let r=!1;for(const t of e){const e=t.trimEnd();/^###\s+/.test(e)?(r&&(s.push("</ul>"),r=!1),s.push("<h3>"+ce(e.replace(/^###\s+/,""))+"</h3>")):/^##\s+/.test(e)?(r&&(s.push("</ul>"),r=!1),s.push("<h2>"+ce(e.replace(/^##\s+/,""))+"</h2>")):/^#\s+/.test(e)?(r&&(s.push("</ul>"),r=!1),s.push("<h2>"+ce(e.replace(/^#\s+/,""))+"</h2>")):/^[-*]\s+/.test(e)?(r||(s.push("<ul>"),r=!0),s.push("<li>"+ce(e.replace(/^[-*]\s+/,""))+"</li>")):""===e.trim()?r&&(s.push("</ul>"),r=!1):(r&&(s.push("</ul>"),r=!1),s.push("<p>"+ce(e)+"</p>"))}r&&s.push("</ul>");return s.join("")}(t.body)),e.appendChild(i),this.appendChild(e)})}).catch(t=>{if(!this.isConnected)return;const e=this.querySelector(".c-changelog__loading");e&&e.remove();const s=document.createElement("div");s.className="c-changelog__error",s.textContent=k(this,"load-error","Failed to load changelog")+": "+(t&&t.message?t.message:t),this.appendChild(s)})}}disconnectedCallback(){super.disconnectedCallback();try{this._changelogAbort&&this._changelogAbort.abort()}catch(t){}this._changelogAbort=null}});c("contour-dialog",class extends T{static get observed(){return["title","size","heading","open"]}static get properties(){return{title:{attribute:"title"},size:{attribute:"size"}}}attributeChangedCallback(t,e,s){"open"!==t?super.attributeChangedCallback(t,e,s):ue(this,t,s,this._wiredDialog)}showModal(){this.show()}get open(){return this.hasAttribute("open")}set open(t){t?this.show():this.close()}render(){this.classList.add("c-dialog"),Array.from(this.classList).forEach(t=>{t.startsWith("c-dialog--")&&this.classList.remove(t)});const t=this.getAttribute("size");t&&this.classList.add("c-dialog--"+t),this.hasAttribute("role")||this.setAttribute("role","dialog");const e=this.getAttribute("title");let s=this.querySelector(".c-dialog__head");if(e){if(!s){s=document.createElement("div"),s.className="c-dialog__head";const t=document.createElement(E(this,"h2"));t.className="c-dialog__title",s.appendChild(t);const e=document.createElement("button");e.className="c-btn c-btn--icon c-btn--ghost c-dialog__close",e.setAttribute("type","button"),e.setAttribute("aria-label",k(this,"close","Close")),L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-x" /></svg>'),s.appendChild(e)}const t=s.querySelector(".c-dialog__title");t&&(t.textContent=e,t.id||(t.id=o("contour-dialog-title")),this.setAttribute("aria-labelledby",t.id))}s&&s.parentNode!==this&&this.prepend(s);const r=this.ensure(".c-dialog__body",()=>{const t=document.createElement("div");return t.className="c-dialog__body",t});Array.from(this.childNodes).forEach(t=>{t!==r&&t!==s&&(1===t.nodeType&&t.classList&&t.classList.contains("c-dialog__head")||r.appendChild(t))}),s&&s.parentNode===this?(r.parentNode!==this||s.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_PRECEDING)&&this.insertBefore(r,s.nextSibling):r.parentNode!==this&&this.appendChild(r)}enhance(){this._wiredDialog||(this._wiredDialog=!0,this.returnValue="",i(this,()=>{this.hasAttribute("open")&&Ft(this,!1)}),this.show=()=>{if(this.hasAttribute("open"))return;this._dialogLastFocus=document.activeElement,this._declarativeOpen=!0;try{this.setAttribute("open","")}finally{this._declarativeOpen=!1}this.setAttribute("aria-modal","true");const t=this.querySelector("dialog")||("DIALOG"===this.tagName?this:null);if(t&&"function"==typeof t.showModal)try{t.showModal()}catch(t){}Ft(this,!0);const e=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(e)try{e.focus()}catch(t){}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}))},this.close=()=>{const t=this.hasAttribute("open")||this.hasAttribute("aria-modal"),e=this.querySelector("dialog")||("DIALOG"===this.tagName?this:null);e&&"function"==typeof e.close&&e.close(),this._declarativeOpen=!0;try{this.hasAttribute("open")&&this.removeAttribute("open")}finally{this._declarativeOpen=!1}if(this.removeAttribute("aria-modal"),t){Ft(this,!1),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}));const t=this._dialogLastFocus;if(t&&"function"==typeof t.focus)try{t.focus()}catch(t){}}},this.focus=()=>{const t=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(t)try{t.focus()}catch(t){}else try{HTMLElement.prototype.focus.call(this)}catch(t){}},this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-dialog__close"):null;(e&&this.contains(e)||t.target===this)&&this.close()}),this.addEventListener("keydown",t=>{"Escape"===t.key&&this.hasAttribute("open")&&this.close()}),le(this))}});class de extends T{static get observed(){return["title","body","variant","icon","closable","action","actions","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}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");const t=/^(warning|danger)$/.test(this.getAttribute("variant")||""),e=t?"alert":"status",s=t?"assertive":"polite";if(this.hasAttribute("role")&&this.getAttribute("role")!==this._autoRole||(this.setAttribute("role",e),this._autoRole=e),this.hasAttribute("aria-live")&&this.getAttribute("aria-live")!==this._autoLive||(this.setAttribute("aria-live",s),this._autoLive=s),Zt(this),$t(this,"title"),Xt(this,"alert"))return;const r=this.getAttribute("variant");Array.from(this.classList).forEach(t=>{t.startsWith("c-alert--")&&this.classList.remove(t)}),r&&this.classList.add("c-alert--"+r);const i=this.getAttribute("icon"),a="none"===i?"":i||C(r);if(a){const t=this.ensure(".c-alert__icon",()=>{const t=document.createElement("span");return t.className="c-alert__icon",t});t.parentNode===this&&this.firstChild!==t&&this.prepend(t),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(a).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>')}else{const t=this.querySelector(".c-alert__icon");t&&t.remove()}const n=this.getAttribute("title")||this._remoteData&&this._remoteData.title;if(n){const t=this.ensure(".c-alert__title",()=>{const t=document.createElement("div");return t.className="c-alert__title",t});t.parentNode===this&&this.firstChild!==t&&this.prepend(t),t.textContent=n}else{const t=this.querySelector(".c-alert__title");t&&t.remove()}const o=this.getAttribute("body"),c=Array.from(this.childNodes).filter(t=>(1!==t.nodeType||!t.classList||!(t.classList.contains("c-alert__icon")||t.classList.contains("c-alert__title")||t.classList.contains("c-alert__body")))&&!(3===t.nodeType&&!t.textContent.trim()));if(c.length){const t=this.ensure(".c-alert__body",()=>{const t=document.createElement("div");return t.className="c-alert__body",t});t.textContent="";for(const e of c)t.appendChild(e)}else if(o){this.ensure(".c-alert__body",()=>{const t=document.createElement("div");return t.className="c-alert__body",t}).textContent=o}else{const t=this.querySelector(".c-alert__body");t&&t.remove()}Array.from(this.querySelectorAll(".c-alert__action")).forEach(t=>t.remove());const l=this.getAttribute("actions");let u=[];if(l)try{const t=JSON.parse(l);Array.isArray(t)&&(u=t.map(t=>String(t)))}catch(t){u=[l]}else{const t=this.getAttribute("action");t&&(u=[t])}if(u.forEach(t=>{const e=document.createElement("button");e.className="c-btn c-btn--sm c-alert__action",e.type="button",e.setAttribute("data-alert-action",""),e.textContent=t,this.appendChild(e)}),w(this,"closable"))this.ensure(".c-alert__close",()=>{const t=document.createElement("button");return t.className="c-alert__close",t.type="button",t.setAttribute("aria-label",k(this,"close","Close")),t.textContent="×",t});else{const t=this.querySelector(".c-alert__close");t&&t.remove()}n||o||a||c.length||Yt(this,"alert")}}de.prototype.enhance=function(){this._wiredAlert||(this._wiredAlert=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-alert__action"):null;if(e&&this.contains(e))return t.preventDefault(),void this.dispatchEvent(new CustomEvent("contour:action",{bubbles:!0,composed:!0,detail:{label:e.textContent.trim()}}));const s=t.target&&t.target.closest?t.target.closest(".c-alert__close"):null;s&&this.contains(s)&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})),this.remove())}))},c("contour-alert",de);c("contour-disclosure",class extends T{static get observed(){return["summary","icon"]}static get properties(){return{summary:{attribute:"summary"},icon:{attribute:"icon"}}}disconnectedCallback(){this._disclosureContent=null,super.disconnectedCallback()}connectedCallback(){this.innerHTML.trim()&&!this._disclosureContent&&(this._disclosureContent=this.innerHTML),super.connectedCallback()}attributeChangedCallback(t,e,s){const r=this.querySelector("details");if(r){const t=r.querySelector(".c-disclosure__body");t&&(this._disclosureContent=t.innerHTML)}else this.innerHTML.trim()&&(this._disclosureContent=this.innerHTML);super.attributeChangedCallback(t,e,s)}render(){this.classList.add("c-disclosure");const t=this.getAttribute("summary"),e=this.getAttribute("icon");if(t){let s=this.innerHTML.trim()?this.innerHTML:this._disclosureContent||"";s.trim()&&(this._disclosureContent=s);const r=this.ensure("details",()=>{const r=document.createElement("details"),i=document.createElement("summary");if(i.className="c-disclosure__summary",e){const t=document.createElement("span");t.className="c-disclosure__icon",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(e).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'),i.appendChild(t)}i.appendChild(document.createTextNode(t)),r.appendChild(i);const a=document.createElement("div");return a.className="c-disclosure__body",L(a,s),r.appendChild(a),r}),i=r.querySelector("summary");if(i){const s=i.querySelector(".c-disclosure__icon");if(e&&!s){const t=document.createElement("span");t.className="c-disclosure__icon",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(e).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'),i.insertBefore(t,i.firstChild)}else!e&&s&&s.remove();Array.from(i.childNodes).filter(t=>3===t.nodeType).forEach(t=>t.remove()),i.appendChild(document.createTextNode(t))}const a=r.querySelector(".c-disclosure__body");a&&L(a,s),r.parentNode!==this&&(L(this,""),this.appendChild(r))}else{const t=this.querySelector("details");t&&t.remove()}}enhance(){this._wiredDisclosure||(this._wiredDisclosure=!0,this.addEventListener("toggle",t=>{const e=t.target;e&&"DETAILS"===e.tagName&&this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:e.open},bubbles:!0,composed:!0}))},!0))}});class he extends T{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"),this.hasAttribute("role")||this.setAttribute("role","note"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Callout"),Array.from(this.classList).forEach(t=>{t.startsWith("c-callout--")&&this.classList.remove(t)});const t=this.getAttribute("variant");t&&this.classList.add("c-callout--"+t);const e=this.getAttribute("icon"),s="none"===e?"":e||C(t);if(s){const t=this.ensure(".c-callout__icon",()=>{const t=document.createElement("span");return t.className="c-callout__icon",t});t.parentNode===this&&this.firstChild!==t&&this.prepend(t),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(s).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>')}else{const t=this.querySelector(".c-callout__icon");t&&t.remove()}const r=this.getAttribute("title");if(r){const t=this.ensure(".c-callout__title",()=>{const t=document.createElement("div");return t.className="c-callout__title",t});t.parentNode===this&&this.firstChild!==t&&this.prepend(t),t.textContent=r}else{const t=this.querySelector(".c-callout__title");t&&t.remove()}if(w(this,"closable"))this.ensure(".c-callout__close",()=>{const t=document.createElement("button");return t.className="c-callout__close",t.type="button",t.setAttribute("aria-label",k(this,"close","Close")),t.textContent="×",t});else{const t=this.querySelector(".c-callout__close");t&&t.remove()}}}he.prototype.enhance=function(){this._wiredCallout||(this._wiredCallout=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-callout__close"):null;e&&this.contains(e)&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})),this.remove())}))},c("contour-callout",he);c("contour-empty",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","status");const t=this.getAttribute("state")||"empty",e=this.getAttribute("title")||("filtered"===t?"Nothing matches":"error"===t?"Could not load":"No data yet"),s=this.getAttribute("body")||("filtered"===t?"Try clearing some filters.":"error"===t?"Check your connection and try again.":"There is nothing to show here yet."),r=this.getAttribute("action")||("filtered"===t?"Clear filters":"error"===t?"Retry":""),i=this.getAttribute("icon");if(i){L(this.ensure(".c-empty__icon",()=>{const t=document.createElement("span");return t.className="c-empty__icon",t}),'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(i).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>')}else{const t=this.querySelector(".c-empty__icon");t&&t.remove()}const a=this.getAttribute("illustration");if(a){L(this.ensure(".c-empty__illustration",()=>{const t=document.createElement("div");return t.className="c-empty__illustration",t}),g(a))}else{const t=this.querySelector(".c-empty__illustration");t&&t.remove()}if(e){this.ensure(".c-empty__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-empty__title",t}).textContent=e}else{const t=this.querySelector(".c-empty__title");t&&t.remove()}if(s){this.ensure(".c-empty__text",()=>{const t=document.createElement("p");return t.className="c-empty__text",t}).textContent=s}else{const t=this.querySelector(".c-empty__text");t&&t.remove()}if(r){this.ensure("button.c-btn[data-empty-action]",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--primary",t.type="button",t.setAttribute("data-empty-action",""),t}).textContent=r}else{const t=this.querySelector("[data-empty-action]");t&&t.remove()}}enhance(){xt(this)}});c("contour-faq",class extends T{static get observed(){return["question","answer","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{question:{attribute:"question"},answer:{attribute:"answer"},items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-faq"),Zt(this),$t(this,"items"),Xt(this,"faq"))return;const t=Jt(this,"items"),e=this.getAttribute("question"),s=this.getAttribute("answer"),r=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-faq__item"));if(t&&!r.length)try{const e=JSON.parse(t);Array.from(this.querySelectorAll(".c-faq__item")).forEach(t=>t.remove()),e.forEach((t,e)=>{const s=document.createElement("details");s.className="c-faq__item",0===e&&s.setAttribute("open","");const r=document.createElement("summary");r.className="c-faq__question",r.textContent="string"==typeof t?t:t.question||t.q||"";const i=document.createElement("span");i.className="c-faq__sign",i.setAttribute("aria-hidden","true"),L(i,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-plus" /></svg>'),r.appendChild(i),s.appendChild(r);const a=document.createElement("div");a.className="c-faq__answer",a.textContent="string"==typeof t?"":t.answer||t.a||"",s.appendChild(a),this.appendChild(s)})}catch(t){f(this,"attribute",t)}else if(!t)if(e||s){const t=this.ensure("details.c-faq__item",()=>{const t=document.createElement("details");return t.className="c-faq__item",t});t.hasAttribute("open")||t.setAttribute("open","");const r=this.ensure("summary.c-faq__question",()=>{const t=document.createElement("summary");return t.className="c-faq__question",t},t);r.textContent=e||"";const i=this.ensure(".c-faq__sign",()=>{const t=document.createElement("span");return t.className="c-faq__sign",t},r);i.setAttribute("aria-hidden","true"),L(i,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-plus" /></svg>');this.ensure(".c-faq__answer",()=>{const t=document.createElement("div");return t.className="c-faq__answer",t},t).textContent=s||""}else Yt(this,"faq")}});c("contour-accordion",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","exclusive","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},exclusive:{attribute:"exclusive",type:Boolean},src:{attribute:"src"}}}render(){this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"accordion","Accordion"));const t=Array.from(this.children).filter(t=>"DETAILS"===t.tagName);if(Zt(this),$t(this,"items"),Xt(this,"accordion"))return;const e=Jt(this,"items");if(e&&!t.length){Array.from(this.querySelectorAll("details.c-disclosure")).forEach(t=>t.remove());try{JSON.parse(e).forEach(t=>{const e=document.createElement("details");e.className="c-disclosure";const s=document.createElement("summary");s.className="c-disclosure__summary",s.textContent=t.title||t.question||t.q||t.label||"",e.appendChild(s);const r=document.createElement("div");r.className="c-disclosure__body",r.textContent=t.body||t.answer||t.a||t.content||"",e.appendChild(r),this.appendChild(e)})}catch(t){f(this,"attribute",t)}}else e||t.length||Yt(this,"accordion");const s=this.getAttribute("persist");if(s){let t=null;if("storage"===s&&this.id)try{t=localStorage.getItem("contour-accordion:"+this.id)}catch(t){}else if("url"===s)try{t=new URLSearchParams(window.location.search).get("c-accordion")}catch(t){}if(null!==t)try{const e=JSON.parse(t);if(Array.isArray(e)){const t=new Set(e.map(t=>String(t)));Array.from(this.querySelectorAll("details.c-disclosure")).forEach(e=>{const s=e.querySelector("summary"),r=(s?s.textContent:"").trim().slice(0,120);t.has(r)&&(e.open=!0)})}}catch(t){}}}enhance(){this._wiredAccordion||(this._wiredAccordion=!0,this.addEventListener("toggle",t=>{const e=t.target;if(e&&"DETAILS"===e.tagName){e.open&&this.hasAttribute("exclusive")&&Array.from(this.querySelectorAll("details.c-disclosure")).forEach(t=>{t!==e&&(t.open=!1)}),this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:e.open},bubbles:!0,composed:!0}));const s=this.getAttribute("persist");if("storage"===s&&this.id)try{const t=[];Array.from(this.querySelectorAll("details.c-disclosure")).forEach(e=>{if(e.open){const s=e.querySelector("summary");t.push((s?s.textContent:"").trim().slice(0,120))}}),localStorage.setItem("contour-accordion:"+this.id,JSON.stringify(t))}catch(t){}else if("url"===s)try{const t=[];Array.from(this.querySelectorAll("details.c-disclosure")).forEach(e=>{if(e.open){const s=e.querySelector("summary");t.push((s?s.textContent:"").trim().slice(0,120))}});const e=new URL(window.location.href);e.searchParams.set("c-accordion",JSON.stringify(t)),window.history.replaceState(null,"",e.toString())}catch(t){}}},!0))}});c("contour-drawer",class extends T{static get observed(){return["title","body","size","open"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},size:{attribute:"size"}}}attributeChangedCallback(t,e,s){"open"!==t?super.attributeChangedCallback(t,e,s):ue(this,t,s,this._wiredDrawer)}showModal(){this.show()}get open(){return this.hasAttribute("open")}set open(t){t?this.show():this.close()}render(){this.classList.add("c-drawer"),Array.from(this.classList).forEach(t=>{t.startsWith("c-drawer--")&&this.classList.remove(t)});const t=this.getAttribute("size");t&&this.classList.add("c-drawer--"+t),this.hasAttribute("role")||this.setAttribute("role","dialog");const e=this.getAttribute("title");let s=this.querySelector(".c-drawer__head");if(e){if(!s){s=document.createElement("div"),s.className="c-drawer__head";const t=document.createElement("div");t.className="c-drawer__title",s.appendChild(t);const e=document.createElement("button");e.className="c-btn c-btn--icon c-btn--ghost c-drawer__close",e.setAttribute("type","button"),e.setAttribute("aria-label",k(this,"close","Close")),L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-x" /></svg>'),s.appendChild(e)}const t=s.querySelector(".c-drawer__title");t&&(t.textContent=e,t.id||(t.id=o("contour-drawer-title")),this.setAttribute("aria-labelledby",t.id)),s.parentNode!==this&&this.prepend(s)}else if(s){const t=s.querySelector(".c-drawer__title");t&&t.id&&this.getAttribute("aria-labelledby")===t.id&&this.removeAttribute("aria-labelledby"),s.remove()}this.hasAttribute("open")?this.classList.add("is-open"):this.classList.remove("is-open");const r=this.getAttribute("body"),i=Array.from(this.childNodes).filter(t=>(1!==t.nodeType||!t.classList||!t.classList.contains("c-drawer__head")&&!t.classList.contains("c-drawer__body"))&&!(3===t.nodeType&&!t.textContent.trim()));if(i.length){const t=this.ensure(".c-drawer__body",()=>{const t=document.createElement("div");return t.className="c-drawer__body",t});for(const e of i)t.appendChild(e)}else if(r){L(this.ensure(".c-drawer__body",()=>{const t=document.createElement("div");return t.className="c-drawer__body",t}),g(r))}else{const t=this.querySelector(".c-drawer__body");t&&t.remove()}}enhance(){if(this._wiredDrawer)return;this._wiredDrawer=!0,this.returnValue="",i(this,()=>{this.hasAttribute("open")&&Ft(this,!1)}),this._drawerLastFocus=null,this.show=()=>{if(this.hasAttribute("open"))return;this._drawerLastFocus=document.activeElement,this._declarativeOpen=!0;try{this.setAttribute("open","")}finally{this._declarativeOpen=!1}this.setAttribute("aria-modal","true"),this.classList.add("is-open"),Ft(this,!0);const t=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(t)try{t.focus()}catch(t){}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}))},this.close=()=>{if(!this.hasAttribute("open")&&!this.hasAttribute("aria-modal"))return;this._declarativeOpen=!0;try{this.removeAttribute("open")}finally{this._declarativeOpen=!1}this.removeAttribute("aria-modal"),this.classList.remove("is-open"),Ft(this,!1),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}));const t=this._drawerLastFocus;if(t&&"function"==typeof t.focus)try{t.focus()}catch(t){}},this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-drawer__close"):null;(e&&this.contains(e)||t.target===this)&&this.close()}),this.addEventListener("keydown",t=>{"Escape"===t.key&&this.hasAttribute("open")&&this.close()});let t=0,e=0;this.addEventListener("touchstart",s=>{if(!this.hasAttribute("open"))return;const r=s.touches&&s.touches[0];r&&(t=r.clientX,e=r.clientY)},{passive:!0}),this.addEventListener("touchend",s=>{if(!this.hasAttribute("open"))return;const r=s.changedTouches&&s.changedTouches[0];if(!r)return;const i=r.clientX-t,a=r.clientY-e;Math.abs(i)>60&&Math.abs(i)>1.5*Math.abs(a)&&this.close()},{passive:!0}),le(this)}});c("contour-sheet",class extends T{static get observed(){return["title","body","size","open"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},size:{attribute:"size"}}}attributeChangedCallback(t,e,s){"open"!==t?super.attributeChangedCallback(t,e,s):ue(this,t,s,this._wiredSheet)}showModal(){this.show()}get open(){return this.hasAttribute("open")}set open(t){t?this.show():this.close()}render(){this.classList.add("c-sheet"),Array.from(this.classList).forEach(t=>{t.startsWith("c-sheet--")&&this.classList.remove(t)});const t=this.getAttribute("size");t&&this.classList.add("c-sheet--"+t),this.hasAttribute("role")||this.setAttribute("role","dialog");const e=this.getAttribute("title");let s=this.querySelector(".c-sheet__head");if(e){if(!s){s=document.createElement("div"),s.className="c-sheet__head";const t=document.createElement("div");t.className="c-sheet__title",s.appendChild(t);const e=document.createElement("button");e.className="c-btn c-btn--icon c-btn--ghost c-sheet__close",e.setAttribute("type","button"),e.setAttribute("aria-label",k(this,"close","Close")),L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-x" /></svg>'),s.appendChild(e)}const t=s.querySelector(".c-sheet__title");t&&(t.textContent=e,t.id||(t.id=o("contour-sheet-title")),this.setAttribute("aria-labelledby",t.id)),s.parentNode!==this&&this.prepend(s)}else if(s){const t=s.querySelector(".c-sheet__title");t&&t.id&&this.getAttribute("aria-labelledby")===t.id&&this.removeAttribute("aria-labelledby"),s.remove()}this.hasAttribute("open")?this.classList.add("is-open"):this.classList.remove("is-open");const r=this.getAttribute("body"),i=Array.from(this.childNodes).filter(t=>(1!==t.nodeType||!t.classList||!t.classList.contains("c-sheet__head")&&!t.classList.contains("c-sheet__body"))&&!(3===t.nodeType&&!t.textContent.trim()));if(i.length){const t=this.ensure(".c-sheet__body",()=>{const t=document.createElement("div");return t.className="c-sheet__body",t});for(const e of i)t.appendChild(e)}else if(r){L(this.ensure(".c-sheet__body",()=>{const t=document.createElement("div");return t.className="c-sheet__body",t}),g(r))}else{const t=this.querySelector(".c-sheet__body");t&&t.remove()}}enhance(){if(this._wiredSheet)return;this._wiredSheet=!0,this.returnValue="",i(this,()=>{this.hasAttribute("open")&&Ft(this,!1)}),this._sheetLastFocus=null,this.show=()=>{if(this.hasAttribute("open"))return;this._sheetLastFocus=document.activeElement,this._declarativeOpen=!0;try{this.setAttribute("open","")}finally{this._declarativeOpen=!1}this.setAttribute("aria-modal","true"),this.classList.add("is-open"),Ft(this,!0);const t=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(t)try{t.focus()}catch(t){}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}))},this.close=()=>{if(!this.hasAttribute("open")&&!this.hasAttribute("aria-modal"))return;this._declarativeOpen=!0;try{this.removeAttribute("open")}finally{this._declarativeOpen=!1}this.removeAttribute("aria-modal"),this.classList.remove("is-open"),Ft(this,!1),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}));const t=this._sheetLastFocus;if(t&&"function"==typeof t.focus)try{t.focus()}catch(t){}},this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-sheet__close"):null;(e&&this.contains(e)||t.target===this)&&this.close()}),this.addEventListener("keydown",t=>{"Escape"===t.key&&this.hasAttribute("open")&&this.close()});let t=0,e=0;this.addEventListener("touchstart",s=>{if(!this.hasAttribute("open"))return;const r=s.touches&&s.touches[0];r&&(e=r.clientX,t=r.clientY)},{passive:!0}),this.addEventListener("touchend",s=>{if(!this.hasAttribute("open"))return;const r=s.changedTouches&&s.changedTouches[0];if(!r)return;const i=r.clientY-t,a=r.clientX-e;i>60&&Math.abs(i)>1.5*Math.abs(a)&&this.close()},{passive:!0}),le(this)}});c("contour-toast",class extends T{static get observed(){return["message","variant","duration","action","icon"]}static get properties(){return{message:{attribute:"message"},variant:{attribute:"variant"},duration:{attribute:"duration",type:Number},action:{attribute:"action"}}}render(){this.classList.add("c-toast"),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"),this.hasAttribute("aria-atomic")||this.setAttribute("aria-atomic","true");const t=this.getAttribute("message");t&&!this.hasChildNodes()&&(this.textContent=t);const e=this.getAttribute("variant");Array.from(this.classList).forEach(t=>{t.startsWith("c-toast--")&&this.classList.remove(t)}),e&&this.classList.add("c-toast--"+e);const s=this.getAttribute("icon"),r="none"===s?"":s||C(e);let i=this.querySelector(".c-toast__icon");r?(i||(i=document.createElement("span"),i.className="c-toast__icon"),L(i,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(r).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'),this.firstChild!==i&&this.prepend(i)):i&&i.remove();const a=this.getAttribute("action");let n=this.querySelector(".c-toast__action");a?(n||(n=document.createElement("button"),n.className="c-toast__action",n.type="button",this.appendChild(n)),n.textContent=a):n&&n.remove();let o=this.querySelector(".c-toast__close");o||(o=document.createElement("button"),o.className="c-toast__close",o.type="button",o.setAttribute("aria-label",k(this,"close","Close")),o.textContent="×",this.appendChild(o))}enhance(){if(this._wiredToast)return;this._wiredToast=!0,this.addEventListener("click",t=>{(t.target&&t.target.closest?t.target.closest(".c-toast__close"):null)&&(t.preventDefault(),this._dismiss())});const t=()=>{clearTimeout(this._toastTimer),this._toastTimer=null};this.addEventListener("mouseenter",t),this.addEventListener("focusin",t),this.addEventListener("mouseleave",()=>this._arm()),this.addEventListener("focusout",()=>this._arm()),this._arm(),i(this,()=>clearTimeout(this._toastTimer))}_durationMs(){const t=null!=this._toastDuration?Number(this._toastDuration):Number(this.duration);return 0===t?0:t>0?t:4e3}_arm(){clearTimeout(this._toastTimer),this._toastTimer=null;const t=this._durationMs();t>0&&(this._toastTimer=setTimeout(()=>this._dismiss(),t))}_dismiss(){clearTimeout(this._toastTimer),this._toastTimer=null,this.setAttribute("hidden",""),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}))}show(t,e){const s=null!=t?String(t):this.getAttribute("message"),r=e&&e.variant||this.getAttribute("variant"),i=e&&e.action||this.getAttribute("action");s&&!this.hasChildNodes()&&(this.textContent=s),Array.from(this.classList).forEach(t=>{t.startsWith("c-toast--")&&this.classList.remove(t)}),r&&this.classList.add("c-toast--"+r);let a=this.querySelector(".c-toast__action");i?(a||(a=document.createElement("button"),a.className="c-toast__action",a.type="button",this.appendChild(a)),a.textContent=i):a&&a.remove(),e&&null!=e.duration&&(this._toastDuration=Number(e.duration)),this.removeAttribute("hidden"),this._arm()}});c("contour-expandable",class extends T{static get observed(){return["summary"]}static get properties(){return{summary:{attribute:"summary"}}}disconnectedCallback(){this._expandableContent=null,super.disconnectedCallback()}connectedCallback(){this.innerHTML.trim()&&!this._expandableContent&&(this._expandableContent=this.innerHTML),super.connectedCallback()}attributeChangedCallback(t,e,s){const r=this.querySelector("details");if(r){const t=r.querySelector(".c-expandable__body");t&&(this._expandableContent=t.innerHTML)}else this.innerHTML.trim()&&(this._expandableContent=this.innerHTML);super.attributeChangedCallback(t,e,s)}render(){this.classList.add("c-expandable"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("summary")||"Expandable");const t=this.getAttribute("summary");if(t){let e=this.innerHTML.trim()?this.innerHTML:this._expandableContent||"";e.trim()&&(this._expandableContent=e);const s=this.ensure("details",()=>{const s=document.createElement("details"),r=document.createElement("summary");r.className="c-expandable__summary",r.textContent=t,s.appendChild(r);const i=document.createElement("div");return i.className="c-expandable__body",L(i,e),s.appendChild(i),s}),r=s.querySelector("summary");r&&(r.textContent=t);const i=s.querySelector(".c-expandable__body");i&&L(i,e),s.parentNode!==this&&(L(this,""),this.appendChild(s))}else{const t=this.querySelector("details");t&&t.remove()}}enhance(){this._wiredExpandable||(this._wiredExpandable=!0,this.addEventListener("toggle",t=>{const e=t.target;e&&"DETAILS"===e.tagName&&this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:e.open},bubbles:!0,composed:!0}))},!0))}});c("contour-toast-host",class extends T{static get observed(){return[]}render(){this.classList.add("c-toast-host"),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"toast-host","Toast host")),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"),this.hasAttribute("aria-atomic")||this.setAttribute("aria-atomic","true")}enhance(){if(this._wiredToastHost)return;this._wiredToastHost=!0,this._toastQueue=[],this._toastActive=null;const t=(t,s)=>{s=s||{};const r=document.createElement("div");r.className="c-toast",r.setAttribute("role","status"),r.setAttribute("aria-live","polite"),r.setAttribute("aria-atomic","true"),s.variant&&r.classList.add("c-toast--"+s.variant);const i=C(s.variant);if(i){const t=document.createElement("span");t.className="c-toast__icon",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+i+'" /></svg>'),r.appendChild(t)}r.dataset.message=null==t?"":String(t);const a=document.createElement("span");if(a.className="c-toast__text",a.textContent=null==t?"":String(t),r.appendChild(a),s.action&&("string"==typeof s.action||s.action.label)){const t="string"==typeof s.action?s.action:s.action.label,i=document.createElement("button");i.type="button",i.className="c-btn c-btn--ghost c-toast__action",i.textContent=t,i.addEventListener("click",t=>{if(t.stopPropagation(),"object"==typeof s.action&&"function"==typeof s.action.onClick)try{s.action.onClick()}catch(t){}e(r)}),r.appendChild(i)}const n=document.createElement("button");return n.type="button",n.className="c-toast__close",n.setAttribute("aria-label",k(this,"close","Close")),n.textContent="×",r.appendChild(n),n.addEventListener("click",t=>{t.stopPropagation(),e(r)}),r._arm=()=>{clearTimeout(r._timer);const t=s.duration,i=0===t?0:t>0?t:4e3;i>0&&(r._timer=setTimeout(()=>e(r),i))},r.addEventListener("mouseenter",()=>clearTimeout(r._timer)),r.addEventListener("focusin",()=>clearTimeout(r._timer)),r.addEventListener("mouseleave",r._arm),r.addEventListener("focusout",r._arm),r},e=t=>{t&&t.parentNode&&(t._timer&&(clearTimeout(t._timer),t._timer=null),t.parentNode.removeChild(t),this._toastActive===t&&(this._toastActive=null),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0,detail:{message:t.textContent}})),s())},s=()=>{for(;this._toastQueue.length;){const e=this._toastQueue.shift();if(e._deduped)continue;const s=t(e.message,e.opts);this._toastActive=s,this.appendChild(s),s._arm()}};this.show=(t,r)=>{r=r||{};const i=String(null==t?"":t),a=this._toastActive;if(a&&a.dataset&&a.dataset.message===i&&""!==i){a._timer&&clearTimeout(a._timer);const t=r.duration&&r.duration>0?r.duration:4e3;return a._timer=setTimeout(()=>e(a),t),a}const n=this._toastQueue.find(t=>String(t.message)===i&&""!==i);if(n)return n.opts=Object.assign({},n.opts,r),null;const o={message:t,opts:r,_deduped:!1};return this._toastQueue.push(o),s(),this._toastActive},this.hide=()=>{this._toastActive&&e(this._toastActive),this._toastQueue.length=0,Array.from(this.querySelectorAll(".c-toast")).forEach(t=>{t._timer&&clearTimeout(t._timer),t.parentNode&&t.parentNode.removeChild(t)}),this._toastActive=null}}});c("contour-combobox",class extends T{static get observed(){return["options","items","placeholder","label","value","multiple","loading","error","retry","src","lazy","refresh","timeout","empty","skeleton","virtual","disabled","required","name","cache-key","no-cache"]}static get formAssociated(){return!0}static get properties(){return{options:{attribute:"options"},items:{attribute:"items"},placeholder:{attribute:"placeholder"},label:{attribute:"label"},value:{attribute:"value"},multiple:{attribute:"multiple",type:Boolean},virtual:{attribute:"virtual",type:Boolean},src:{attribute:"src"},disabled:{attribute:"disabled",type:Boolean},required:{attribute:"required",type:Boolean},name:{attribute:"name"}}}render(){if(this.classList.add("c-combobox"),void 0===this._comboboxDefault&&(this._comboboxDefault=this.getAttribute("value")),Zt(this),$t(this,"options"),Xt(this,"combobox"))return;const t=Jt(this,"options")||this.getAttribute("options")||this.getAttribute("items"),e=Array.from(this.children).filter(t=>!t.classList||!t.classList.contains("c-combobox__input")&&!t.classList.contains("c-combobox__list"));if(t&&!e.length)try{const e=t?JSON.parse(t):[];this._comboboxOptions=e;const s=this.ensure(".c-combobox__input",()=>{const t=document.createElement("input");return t.className="c-input c-combobox__input",t.type="text",t});s.type="text",s.placeholder=this.getAttribute("placeholder")||k(this,"search","Search…"),s.setAttribute("aria-label",this.getAttribute("label")||k(this,"search","Search")),this.hasAttribute("disabled")?(s.setAttribute("disabled",""),this.classList.add("is-disabled")):(s.removeAttribute("disabled"),this.classList.remove("is-disabled")),this.hasAttribute("required")?(s.setAttribute("required",""),s.setAttribute("aria-required","true")):(s.removeAttribute("required"),s.removeAttribute("aria-required")),this.hasAttribute("name")&&s.setAttribute("name",this.getAttribute("name"));const r=this.getAttribute("value");if(null!==r){const t=String(r).split(",").map(t=>t.trim()).filter(Boolean).map(t=>{const s=e.find(e=>String("string"==typeof e?e:e.value)===t);return s?String("string"==typeof s?s:s.label):t});if(this.hasAttribute("multiple"))s.value="",s.placeholder=t.join(", ")||this.getAttribute("placeholder")||k(this,"search","Search…");else{const t=e.find(t=>String("string"==typeof t?t:t.value)===String(r));s.value=t?String("string"==typeof t?t:t.label):r}}const i=this.ensure(".c-combobox__list",()=>{const t=document.createElement("ul");return t.className="c-combobox__list",t.setAttribute("hidden",""),t});i.innerHTML="",i.setAttribute("hidden",""),this._comboboxVirtual=this.hasAttribute("virtual")&&e.length>100,this._comboboxVirtual?(i.classList.add("c-combobox__list--virtual"),i.style.maxBlockSize="20rem",i.style.overflow="auto",this._renderComboboxWindow("",!0)):(i.classList.remove("c-combobox__list--virtual"),i.style.maxBlockSize="",i.style.overflow="",this._renderComboboxWindow("",!0))}catch(t){f(this,"attribute",t)}else if(e.length||t){if(e.length){const t=this.ensure(".c-combobox__input",()=>{const t=document.createElement("input");return t.className="c-input c-combobox__input",t.type="text",t});t.type="text",t.placeholder=this.getAttribute("placeholder")||k(this,"search","Search…"),t.setAttribute("aria-label",this.getAttribute("label")||k(this,"search","Search")),this.hasAttribute("required")?(t.setAttribute("required",""),t.setAttribute("aria-required","true")):(t.removeAttribute("required"),t.removeAttribute("aria-required")),this.hasAttribute("name")&&t.setAttribute("name",this.getAttribute("name"));const s=this.ensure(".c-combobox__list",()=>{const t=document.createElement("ul");return t.className="c-combobox__list",t.setAttribute("hidden",""),t});for(const t of e)"LI"===t.tagName&&(s.appendChild(t),t.setAttribute("role","option"));this._comboboxOptions=Array.from(s.querySelectorAll("li")).map(t=>({label:t.textContent.trim(),value:null!=t.dataset.value?t.dataset.value:t.textContent.trim()}))}}else Yt(this,"combobox");if(this.getAttribute("value"))this.ensure(".c-combobox__clear",()=>{const t=document.createElement("button");return t.className="c-combobox__clear",t.type="button",t.setAttribute("aria-label",k(this,"clear","Clear")),t.textContent="×",t});else{const t=this.querySelector(".c-combobox__clear");t&&t.remove()}}_renderComboboxWindow(t="",e=!1){const s=this.querySelector(".c-combobox__list"),r=this._comboboxOptions||[];if(!s)return;const i=String(t||"").toLowerCase(),a=r.map((t,e)=>({opt:t,index:e,label:"string"==typeof t?t:t.label,value:"string"==typeof t?t:t.value})).filter(t=>!i||String(t.label).toLowerCase().includes(i));this._comboboxFiltered=a;const n=y("--combobox-row-height",32),o=s.scrollTop,c=this._comboboxVirtual&&!e?Math.min(Math.max(0,a.length-20),Math.max(0,Math.floor(o/n)-6)):0;this._comboboxWindowStart=c;const l=this._comboboxVirtual?Math.min(a.length,c+20+12):a.length,u=(this.getAttribute("value")||"").split(",").map(t=>t.trim()).filter(Boolean);s.innerHTML="";const d=t=>{const e=document.createElement("li");e.setAttribute("aria-hidden","true"),e.style.blockSize=`${t}px`,s.appendChild(e)};if(this._comboboxVirtual&&d(c*n),!a.length){const t=document.createElement("li");t.className="c-combobox__empty",t.setAttribute("role","option"),t.setAttribute("aria-disabled","true"),t.setAttribute("aria-selected","false"),t.textContent=this.getAttribute("empty")||k(this,"no-matches","No matches"),s.appendChild(t)}this.hasAttribute("multiple")?s.setAttribute("aria-multiselectable","true"):s.removeAttribute("aria-multiselectable"),a.slice(c,l).forEach(e=>{const r=document.createElement("li");r.className="c-combobox__option",r.dataset.optionIndex=String(e.index),r.dataset.optionValue=String(null!=e.value?e.value:e.label),r.setAttribute("role","option");const i=String(e.label),a=String(t||"").toLowerCase();if(a&&i.toLowerCase().includes(a)){const t=i.toLowerCase().indexOf(a),e=i.slice(0,t),s=i.slice(t,t+a.length),n=i.slice(t+a.length);r.innerHTML="",e&&r.appendChild(document.createTextNode(e));const o=document.createElement("mark");o.className="c-combobox__match",o.textContent=s,r.appendChild(o),n&&r.appendChild(document.createTextNode(n))}else r.textContent=i;const n=this.hasAttribute("multiple")&&u.includes(String(e.value));r.setAttribute("aria-selected",String(n)),n&&r.classList.add("c-combobox__option--selected"),s.appendChild(r)}),this._comboboxVirtual&&d(Math.max(0,a.length-l)*n),this._comboboxVirtual&&!e&&(s.scrollTop=o)}_syncFormValue(){if(!this._internals)return;const t=this.getAttribute("value"),e=null!=t&&""!==t?t:null;this._internals.setFormValue(e),this._syncValidity(this.hasAttribute("required")&&!e)}enhance(){_t(this),this._internals&&!this._wiredComboboxForm&&(this._wiredComboboxForm=!0,this._syncFormValue(),this.addEventListener("contour:select",t=>{const e=t&&t.detail&&(t.detail.value||t.detail.label);null!=e&&this.setAttribute("value",String(e)),this._syncFormValue()})),this._wiredComboboxClear||(this._wiredComboboxClear=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-combobox__clear"):null;if(!e||!this.contains(e))return;t.preventDefault(),this.removeAttribute("value");const s=this.querySelector(".c-combobox__input");s&&(s.value=""),this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{name:this.getAttribute("name"),value:null,checked:null}}))}))}formResetCallback(){this._contourResetting=!0;try{const t=this._comboboxDefault??null;null===t?this.removeAttribute("value"):this.setAttribute("value",t),this._syncFormValue()}finally{this._contourResetting=!1}}});class me extends T{static get observed(){return["label","hint","error","placeholder","type","required","name","value","disabled","custom-error"]}static get formAssociated(){return!0}static get properties(){return{label:{attribute:"label"},hint:{attribute:"hint"},error:{attribute:"error"},placeholder:{attribute:"placeholder"},type:{attribute:"type"},required:{attribute:"required",type:Boolean},name:{attribute:"name"},value:{attribute:"value"},disabled:{attribute:"disabled",type:Boolean},customError:{attribute:"custom-error"}}}render(){this.classList.add("c-field");const t=this.getAttribute("label"),e=this.getAttribute("hint"),s=this.getAttribute("error"),r=this.getAttribute("placeholder")||"";if(t){this.ensure(".c-field__label",()=>{const t=document.createElement("label");return t.className="c-field__label",t}).textContent=t}else{const t=this.querySelector(".c-field__label");t&&t.remove()}const i=Array.from(this.children).find(t=>t.constructor&&t.constructor.formAssociated)?null:this.ensure("input.c-input, textarea, select",()=>{const t=document.createElement("input");return t.className="c-input",t});if(i){i.type=this.getAttribute("type")||"text",i.placeholder=r,i.id||(i.id=this._fieldInputId||(this._fieldInputId=o("contour-field")));const t=this.querySelector(".c-field__label");if(t?(i.id||(i.id=o("contour-field")),t.setAttribute("for",i.id),i.setAttribute("aria-label",t.textContent)):i.hasAttribute("aria-label")||i.setAttribute("aria-label",k(this,"field","Field")),e){this.ensure(".c-field__hint",()=>{const t=document.createElement("span");return t.className="c-field__hint",t}).textContent=e}else{const t=this.querySelector(".c-field__hint");t&&t.remove()}if(s){this.ensure(".c-field__error",()=>{const t=document.createElement("span");return t.className="c-field__error",t}).textContent=s}else{const t=this.querySelector(".c-field__error");t&&t.remove()}const a=this.getAttribute("custom-error");if(null!==a){i.setAttribute("aria-invalid","true"),this.classList.add("is-invalid"),this.setAttribute("data-invalid","");let t=this.querySelector(".c-field__error");t||(t=document.createElement("span"),t.className="c-field__error",this.appendChild(t)),t.textContent=a,t.id||(t.id=o("err")),i.setAttribute("aria-describedby",(i.getAttribute("aria-describedby")||"").split(" ").filter(e=>e&&e!==t.id).concat(t.id).join(" "))}const n=this.querySelector(".c-field__hint"),c=this.querySelector(".c-field__error"),l=[];n&&(n.id||(n.id=o("hint")),l.push(n.id)),c&&(c.id||(c.id=o("err")),l.push(c.id)),l.length&&i.setAttribute("aria-describedby",l.join(" ")),this.hasAttribute("required")?(i.setAttribute("aria-required","true"),i.setAttribute("required","")):(i.removeAttribute("aria-required"),i.removeAttribute("required")),this.hasAttribute("name")&&i.setAttribute("name",this.getAttribute("name")),this.hasAttribute("value")&&(i.value=this.getAttribute("value")),this.hasAttribute("disabled")?(i.setAttribute("disabled",""),this.classList.add("is-disabled")):(i.removeAttribute("disabled"),this.classList.remove("is-disabled"))}}}me.prototype.enhance=function(){if(this._wiredField)return;this._wiredField=!0;const t=()=>{const t=this.querySelector("input, textarea, select");t&&this._internals&&(this._internals.setFormValue(t.value),this._syncValidity(this.hasAttribute("required")&&!t.value))};this.addEventListener("input",e=>{const s=this.querySelector("input, textarea, select");s&&e.target===s&&(t(),this._emitForm("contour:input"))}),this.addEventListener("change",e=>{const s=this.querySelector("input, textarea, select");s&&e.target===s&&(t(),this._emitForm("contour:change"))}),this.addEventListener("focusout",e=>{const s=this.querySelector("input, textarea, select");if(!s||e.target!==s)return;if(s.checkValidity()){if(s.setAttribute("aria-invalid","false"),this.classList.remove("is-invalid"),this.removeAttribute("data-invalid"),!this.getAttribute("error")){const t=this.querySelector(".c-field__error");if(t){const e=t.id;t.remove(),e&&s.setAttribute("aria-describedby",(s.getAttribute("aria-describedby")||"").split(" ").filter(t=>t&&t!==e).join(" "))}}}else{s.setAttribute("aria-invalid","true"),this.classList.add("is-invalid"),this.setAttribute("data-invalid","");const t=new CustomEvent("contour:invalid",{bubbles:!0,composed:!0,cancelable:!0,detail:{field:this,input:s,message:s.validationMessage||"Invalid value"}});if(this.dispatchEvent(t)&&!this.getAttribute("error")&&!this.getAttribute("custom-error")){const t=s.validationMessage||"Invalid value";let e=this.querySelector(".c-field__error");e||(e=document.createElement("span"),e.className="c-field__error",this.appendChild(e)),e.textContent=t,e.id||(e.id=o("err")),s.setAttribute("aria-describedby",(s.getAttribute("aria-describedby")||"").split(" ").filter(t=>t&&t!==e.id).concat(e.id).join(" "))}}t()},!0),t()},c("contour-field",me);c("contour-field-group",class extends T{static get observed(){return["label","hint","error","required"]}static get properties(){return{label:{attribute:"label"},hint:{attribute:"hint"},error:{attribute:"error"},required:{attribute:"required",type:Boolean}}}render(){this.classList.add("c-field-group"),this.setAttribute("role","group");const t=this.getAttribute("label");if(t){this.ensure(".c-field-group__label",()=>{const t=document.createElement("div");return t.className="c-field-group__label",t}).textContent=t}else{const t=this.querySelector(".c-field-group__label");t&&t.remove()}const e=this.getAttribute("hint");if(e){this.ensure(".c-field-group__hint",()=>{const t=document.createElement("span");return t.className="c-field-group__hint",t}).textContent=e}else{const t=this.querySelector(".c-field-group__hint");t&&t.remove()}const s=this.getAttribute("error");if(s){this.ensure(".c-field-group__error",()=>{const t=document.createElement("span");return t.className="c-field-group__error",t}).textContent=s}else{const t=this.querySelector(".c-field-group__error");t&&t.remove()}s?this.classList.add("is-error"):this.classList.remove("is-error");const r=this.hasAttribute("required");this.querySelectorAll("input, select, textarea").forEach(t=>{r?t.hasAttribute("aria-required")||t.setAttribute("aria-required","true"):"true"===t.getAttribute("aria-required")&&t.removeAttribute("aria-required")})}enhance(){this._wiredFieldGroup||(this._wiredFieldGroup=!0)}});c("contour-form",class extends T{static get observed(){return["submitting","error","summary","title","submit-label"]}static get properties(){return{submitting:{attribute:"submitting",type:Boolean},error:{attribute:"error"},summary:{attribute:"summary"},title:{attribute:"title"},submitLabel:{attribute:"submit-label"}}}render(){this.classList.add("c-form"),this.hasAttribute("submitting")?this.classList.add("is-submitting"):this.classList.remove("is-submitting");const t=this.getAttribute("title");let e=this.querySelector(".c-form__title");t?(e||(e=document.createElement("h2"),e.className="c-form__title",this.prepend(e)),e.textContent=t):e&&e.remove();const s=this.getAttribute("summary")||this.getAttribute("error");let r=this.querySelector(".c-form__summary");s?(r||(r=document.createElement("div"),r.className="c-form__summary",r.setAttribute("role","alert"),this.prepend(r)),r.textContent=s,r.removeAttribute("hidden")):r&&r.setAttribute("hidden","");const i=this.getAttribute("submit-label");let a=this.querySelector(".c-form__submit");a||(a=document.createElement("button"),a.type="submit",a.className="c-btn c-btn--primary c-form__submit",this.appendChild(a)),i?(a.textContent=i,a.dataset&&delete a.dataset.contourLabel):q(a,this,"submit","Submit"),this.hasAttribute("submitting")?a.setAttribute("disabled",""):a.removeAttribute("disabled")}enhance(){if(this._wiredForm)return;this._wiredForm=!0;const t=this.closest("form")||this,e=t=>{const e=t.target;if(t.preventDefault(),e&&"function"==typeof e.checkValidity&&!e.checkValidity()){const t=Array.from(e.querySelectorAll(":invalid")).map(t=>t.getAttribute("aria-label")||t.name||t.id||"field").join(", ");let s=this.querySelector(".c-form__summary");return s||(s=document.createElement("div"),s.className="c-form__summary",s.setAttribute("role","alert"),this.prepend(s)),s.textContent=k(this,"validation-summary","Please fix")+": "+(t||k(this,"invalid-fields","invalid fields")),void s.removeAttribute("hidden")}this._submit()};this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-form__submit"):null;e&&this.contains(e)&&(t.target.closest("form")||(t.preventDefault(),this._submit()))}),t.addEventListener("submit",e),i(this,()=>{t!==this&&t.removeEventListener("submit",e)})}_submit(){this.classList.add("is-submitting");const t=this.querySelector("[type='submit'], .c-form__submit");t&&t.setAttribute("disabled",""),this.dispatchEvent(new CustomEvent("contour:submit",{bubbles:!0,composed:!0,detail:{submitting:!0}}))}});class be extends T{static get observed(){return["min","max","value","low","high","range","sparkline","label","disabled","error","help","name","step"]}static get formAssociated(){return!0}static get properties(){return{min:{attribute:"min"},max:{attribute:"max"},value:{attribute:"value"},label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},name:{attribute:"name"},step:{attribute:"step"}}}render(){this.classList.add("c-range");const t=this.getAttribute("min")||"0",e=this.getAttribute("max")||"100",s=this.hasAttribute("range")||this.hasAttribute("low")||this.hasAttribute("high"),r=this.getAttribute("sparkline");if(r){let t=this.querySelector(".c-range__sparkline");t||(t=document.createElement("canvas"),t.className="c-range__sparkline",t.setAttribute("part","sparkline-canvas"),t.setAttribute("aria-hidden","true"),this.insertBefore(t,this.firstChild)),this._drawRangeSpark(t,r)}else{const t=this.querySelector(".c-range__sparkline");t&&t.remove()}if(s){this.querySelector("input.c-range:not(.c-range__low):not(.c-range__high)");let s=this.querySelector("input.c-range__low");s||(s=document.createElement("input"),s.type="range",s.className="c-range c-range__low",s.setAttribute("part","input"),this.appendChild(s));let r=this.querySelector("input.c-range__high");r||(r=document.createElement("input"),r.type="range",r.className="c-range c-range__high",r.setAttribute("part","input"),this.appendChild(r)),s.min=t,s.max=e,r.min=t,r.max=e;const i=this.getAttribute("step");i?(s.step=i,r.step=i):(s.removeAttribute("step"),r.removeAttribute("step")),this.hasAttribute("disabled")?(s.setAttribute("disabled",""),r.setAttribute("disabled","")):(s.removeAttribute("disabled"),r.removeAttribute("disabled"));const a=this.getAttribute("low")||t,n=this.getAttribute("high")||e;null!==this._rangeUserLow&&this._rangeAttrLowAtDirty===(this.getAttribute("low")||t)?s.value=this._rangeUserLow:(s.value=a,this._rangeUserLow=null,this._rangeAttrLowAtDirty=null),null!==this._rangeUserHigh&&this._rangeAttrHighAtDirty===(this.getAttribute("high")||e)?r.value=this._rangeUserHigh:(r.value=n,this._rangeUserHigh=null,this._rangeAttrHighAtDirty=null);const o=this.getAttribute("label");o&&(s.setAttribute("aria-label",o+" low"),r.setAttribute("aria-label",o+" high"))}else{Array.from(this.querySelectorAll("input.c-range__low, input.c-range__high, input[type='hidden'][data-range]")).forEach(t=>t.remove());const s=this.ensure("input.c-range",()=>{const t=document.createElement("input");return t.type="range",t.setAttribute("part","input"),t});s.className="c-range",s.type="range",s.min=t,s.max=e;const r=this.getAttribute("step");r?s.step=r:s.removeAttribute("step"),this.hasAttribute("disabled")?s.setAttribute("disabled",""):s.removeAttribute("disabled");const i=this.getAttribute("value")||"50";null!==this._rangeUserValue&&this._rangeAttrAtDirty===(this.getAttribute("value")||"50")?s.value=this._rangeUserValue:(s.value=i,this._rangeUserValue=null,this._rangeAttrAtDirty=null);const a=this.getAttribute("label");a?s.setAttribute("aria-label",a):s.hasAttribute("aria-label")||s.setAttribute("aria-label",k(this,"range","Range"));const n=()=>{const t=Number(s.min)||0,e=Number(s.max)||100,r=Number(s.value)||0,i=e>t?(r-t)/(e-t)*100:0;s.style.setProperty("--fill",i+"%")};n(),s._fillWired||(s._fillWired=!0,s.addEventListener("input",n))}}_drawRangeSpark(t,e){let s=[];try{const t=JSON.parse(e);Array.isArray(t)&&(s=t.map(Number).filter(Number.isFinite))}catch(t){}if(s.length<2)return;const r=()=>{if(!t.isConnected)return;const e=t.clientWidth,r=t.clientHeight;if(!e||!r)return;const i="undefined"!=typeof window&&window.devicePixelRatio||1;t.width=Math.round(e*i),t.height=Math.round(r*i);const a=t.getContext&&t.getContext("2d");if(!a)return;a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,e,r);const n=Math.min.apply(null,s),o=Math.max.apply(null,s)-n||1;let c="";try{c=getComputedStyle(this).getPropertyValue("--chart-1").trim()}catch(t){}c&&!/^(var|light-dark)\(/.test(c)||(c="#1f77b4"),a.beginPath(),a.lineWidth=1.5,a.strokeStyle=c,s.forEach((t,i)=>{const c=(t=>t/(s.length-1)*(e-4)+2)(i),l=(t=>r-2-(t-n)/o*(r-4))(t);0===i?a.moveTo(c,l):a.lineTo(c,l)}),a.stroke()};"function"==typeof requestAnimationFrame?requestAnimationFrame(r):r()}}be.prototype.render;be.prototype.attributeChangedCallback=function(t,e,s){return"value"===t&&(this._rangeUserValue=null,this._rangeAttrAtDirty=null),"low"===t&&(this._rangeUserLow=null,this._rangeAttrLowAtDirty=null),"high"===t&&(this._rangeUserHigh=null,this._rangeAttrHighAtDirty=null),T.prototype.attributeChangedCallback.call(this,t,e,s)},be.prototype._syncFormValue=function(){if(!this._internals)return;const t=this.querySelector("input.c-range__low"),e=this.querySelector("input.c-range__high");if(t&&e){const s=this.getAttribute("name");if(s){const r=new FormData;r.append(s,t.value),r.append(s,e.value),this._internals.setFormValue(r)}else this._internals.setFormValue(null)}else{const t=this.querySelector("input.c-range:not(.c-range__low):not(.c-range__high)");t&&this._internals.setFormValue(t.value)}},be.prototype.formResetCallback=function(){this._contourResetting=!0;try{this._rangeUserValue=null,this._rangeAttrAtDirty=null,this._rangeUserLow=null,this._rangeAttrLowAtDirty=null,this._rangeUserHigh=null,this._rangeAttrHighAtDirty=null,this.isConnected&&this._contourAuthored&&this.attributeChangedCallback("__rerender__",null,""),this._syncFormValue()}finally{this._contourResetting=!1}},be.prototype.formStateRestoreCallback=function(t){if(!this._internals||null==t)return;const e=this.querySelector("input.c-range__low"),s=this.querySelector("input.c-range__high");if(e&&s&&t instanceof FormData){const r=t.getAll(this.getAttribute("name"));r.length>=2&&(e.value=String(r[0]),s.value=String(r[1]))}else{const e=this.querySelector("input.c-range:not(.c-range__low):not(.c-range__high)");e&&(e.value=String(t))}this._syncFormValue()},be.prototype.enhance=function(){if(this._wiredRange)return;this._wiredRange=!0,this._syncFormValue();const t=()=>{this._syncFormValue()};this.addEventListener("input",e=>{const s=this.querySelector("input.c-range__low"),r=this.querySelector("input.c-range__high"),i=this.querySelector("input.c-range:not(.c-range__low):not(.c-range__high)");s&&r&&(e.target===s||e.target===r)?(this._rangeUserLow=s.value,this._rangeUserHigh=r.value,this._rangeAttrLowAtDirty=this.getAttribute("low")||this.getAttribute("min")||"0",this._rangeAttrHighAtDirty=this.getAttribute("high")||this.getAttribute("max")||"100",t(),this._emitForm("contour:input",{low:Number(s.value),high:Number(r.value)}),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{low:Number(s.value),high:Number(r.value)}}))):i&&e.target===i&&(this._rangeUserValue=i.value,this._rangeAttrAtDirty=this.getAttribute("value")||"50",t(),this._emitForm("contour:input"))}),this.addEventListener("change",e=>{const s=this.querySelector("input.c-range__low"),r=this.querySelector("input.c-range__high"),i=this.querySelector("input.c-range:not(.c-range__low):not(.c-range__high)");s&&r&&(e.target===s||e.target===r)?(t(),this._emitForm("contour:change",{low:Number(s.value),high:Number(r.value)}),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{low:Number(s.value),high:Number(r.value)}}))):i&&e.target===i&&(t(),this._emitForm("contour:change"))}),t()},c("contour-range",be);c("contour-switch",class extends T{static get observed(){return["label","required","checked","disabled","error","help"]}static get properties(){return{label:{attribute:"label"},required:{attribute:"required",type:Boolean},checked:{attribute:"checked",type:Boolean},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"}}}static get formAssociated(){return!0}render(){this.classList.add("c-switch"),void 0===this._switchDefaultChecked&&(this._switchDefaultChecked=this.hasAttribute("checked"));const t=this.getAttribute("label"),e=this.ensure("input.c-switch__input",()=>{const t=document.createElement("input");return t.className="c-switch__input",t.type="checkbox",t});e.checked=this.hasAttribute("checked"),e.setAttribute("role","switch"),e.setAttribute("aria-checked",String(e.checked)),this._setCustomState("data-checked",e.checked),this.hasAttribute("disabled")?(e.setAttribute("disabled",""),this.classList.add("is-disabled")):(e.removeAttribute("disabled"),this.classList.remove("is-disabled"));const s=this.getAttribute("error"),r=this.getAttribute("help");let i=this.querySelector(".c-switch__message");if(s||r?(i||(i=document.createElement("div"),i.className="c-switch__message",this.appendChild(i)),i.textContent=s||r||"",i.classList.toggle("c-switch__message--error",!!s)):i&&i.remove(),s?this.classList.add("is-error"):this.classList.remove("is-error"),t){e.setAttribute("aria-label",t);(this.querySelector(":scope > span:not([class])")||(()=>{const t=document.createElement("span");return this.appendChild(t),t})()).textContent=t}e.hasAttribute("aria-label")||e.setAttribute("aria-label",k(this,"switch","Switch"))}enhance(){const t=this.querySelector("input");t&&this._internals&&(t.setAttribute("aria-checked",String(t.checked)),this._setCustomState("data-checked",t.checked),this._internals.setFormValue(t.checked?t.value||"on":null),this._syncValidity(this.hasAttribute("required")&&!t.checked)),this._wiredSwitch||(this._wiredSwitch=!0,this.addEventListener("click",t=>{if(t.target&&t.target.closest&&t.target.closest("input"))return;const e=this.querySelector("input");e&&!e.disabled&&(t.preventDefault(),e.click())}),this.addEventListener("change",t=>{const e=this.querySelector("input");e&&t.target===e&&this._internals&&(e.setAttribute("aria-checked",String(e.checked)),this._setCustomState("data-checked",e.checked),this._setCustomState("data-indeterminate",!1),this.removeAttribute("indeterminate"),this.toggleAttribute("checked",e.checked),this._internals.setFormValue(e.checked?e.value||"on":null),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.checked))}))}formResetCallback(){this._contourResetting=!0;try{this.toggleAttribute("checked",!!this._switchDefaultChecked);const t=this.querySelector("input");t&&(t.checked=this.hasAttribute("checked")),this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-check",class extends T{static get observed(){return["label","name","value","required","type","checked","indeterminate","disabled","error","help"]}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},indeterminate:{attribute:"indeterminate",type:Boolean},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"}}}static get formAssociated(){return!0}render(){this.classList.add("c-check"),void 0===this._checkDefaultChecked&&(this._checkDefaultChecked=this.hasAttribute("checked"));const t=this.getAttribute("label"),e=this.ensure("input.c-check__input",()=>{const t=document.createElement("input");return t.className="c-check__input",t.type="radio"===this.getAttribute("type")?"radio":"checkbox",t});if(e.checked=this.hasAttribute("checked"),e.indeterminate=this.hasAttribute("indeterminate")&&!e.checked,t){e.setAttribute("aria-label",t);(this.querySelector(":scope > span:not([class])")||(()=>{const t=document.createElement("span");return this.appendChild(t),t})()).textContent=t}e.hasAttribute("aria-label")||e.setAttribute("aria-label",k(this,"checkbox","Checkbox")),this.hasAttribute("name")&&(e.name=this.getAttribute("name")),this.hasAttribute("value")&&(e.value=this.getAttribute("value")),this.hasAttribute("disabled")?(e.setAttribute("disabled",""),this.classList.add("is-disabled")):(e.removeAttribute("disabled"),this.classList.remove("is-disabled"));const s=this.getAttribute("error"),r=this.getAttribute("help");let i=this.querySelector(".c-check__message");s||r?(i||(i=document.createElement("div"),i.className="c-check__message",this.appendChild(i)),i.textContent=s||r||"",i.classList.toggle("c-check__message--error",!!s)):i&&i.remove(),s?this.classList.add("is-error"):this.classList.remove("is-error")}enhance(){const t=this.querySelector("input");t&&this._internals&&(this._setCustomState("data-checked",t.checked),this._setCustomState("data-indeterminate",t.indeterminate),this._internals.setFormValue(t.checked?t.value||"on":null),this._syncValidity(this.hasAttribute("required")&&!t.checked)),this._wiredCheck||(this._wiredCheck=!0,this.addEventListener("click",t=>{if(t.target&&t.target.closest&&t.target.closest("input"))return;const e=this.querySelector("input");e&&!e.disabled&&(t.preventDefault(),e.click())}),this.addEventListener("change",t=>{const e=this.querySelector("input");e&&t.target===e&&this._internals&&(this._setCustomState("data-checked",e.checked),this._setCustomState("data-indeterminate",!1),this.removeAttribute("indeterminate"),this.toggleAttribute("checked",e.checked),this._internals.setFormValue(e.checked?e.value||"on":null),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.checked))}))}formResetCallback(){this._contourResetting=!0;try{this.toggleAttribute("checked",!!this._checkDefaultChecked);const t=this.querySelector("input");t&&(t.checked=this.hasAttribute("checked")),this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-radio",class extends T{static get observed(){return["label","name","value","required","checked","disabled","error","help"]}static get properties(){return{label:{attribute:"label"},name:{attribute:"name"},value:{attribute:"value"},required:{attribute:"required",type:Boolean},checked:{attribute:"checked",type:Boolean},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"}}}static get formAssociated(){return!0}render(){this.classList.add("c-radio");const t=this.getAttribute("label"),e=this.ensure("input.c-radio__input",()=>{const t=document.createElement("input");return t.className="c-radio__input",t.type="radio",t});e.checked=this.hasAttribute("checked"),this.hasAttribute("name")&&(e.name=this.getAttribute("name")),this.hasAttribute("value")&&(e.value=this.getAttribute("value")),this.hasAttribute("disabled")?(e.setAttribute("disabled",""),this.classList.add("is-disabled")):(e.removeAttribute("disabled"),this.classList.remove("is-disabled"));const s=this.getAttribute("error"),r=this.getAttribute("help");let i=this.querySelector(".c-radio__message");if(s||r?(i||(i=document.createElement("div"),i.className="c-radio__message",this.appendChild(i)),i.textContent=s||r||"",i.classList.toggle("c-radio__message--error",!!s)):i&&i.remove(),s?this.classList.add("is-error"):this.classList.remove("is-error"),t){e.setAttribute("aria-label",t);(this.querySelector(":scope > span:not([class])")||(()=>{const t=document.createElement("span");return this.appendChild(t),t})()).textContent=t}e.hasAttribute("aria-label")||e.setAttribute("aria-label",k(this,"radio","Radio"))}enhance(){const t=this.querySelector("input");t&&this._internals&&(this._setCustomState("data-checked",t.checked),this._setCustomState("data-indeterminate",t.indeterminate),this._internals.setFormValue(t.checked?t.value||"on":null),this._syncValidity(this.hasAttribute("required")&&!t.checked)),this._wiredRadio||(this._wiredRadio=!0,this.addEventListener("click",t=>{if(t.target&&t.target.closest&&t.target.closest("input"))return;const e=this.querySelector("input");e&&!e.disabled&&(t.preventDefault(),e.click())}),this.addEventListener("change",t=>{const e=this.querySelector("input");e&&t.target===e&&this._internals&&(this._setCustomState("data-checked",e.checked),this._internals.setFormValue(e.checked?e.value||"on":null),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.checked))}))}});c("contour-select",class extends T{static get observed(){return["options","items","required","label","placeholder","disabled","error","help","value","name","multiple","autocomplete"]}static get properties(){return{options:{attribute:"options"},items:{attribute:"items"},required:{attribute:"required",type:Boolean},label:{attribute:"label"},placeholder:{attribute:"placeholder"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},value:{attribute:"value"},name:{attribute:"name"},multiple:{attribute:"multiple",type:Boolean},autocomplete:{attribute:"autocomplete"}}}static get formAssociated(){return!0}render(){this.classList.add("c-select"),void 0===this._selectDefault&&(this._selectDefault=this.getAttribute("value"));const t=this.getAttribute("options")||this.getAttribute("items"),e=new Set(this._contourGenerated||[]),s=Array.from(this.children).filter(t=>!e.has(t));if(t&&!s.length)try{const e=JSON.parse(t),s=this.ensure("select.c-select",()=>{const t=document.createElement("select");return t.className="c-select",t});s.innerHTML="";const r=this.getAttribute("label");r&&s.setAttribute("aria-label",r);const i=this.getAttribute("placeholder");if(i){const t=document.createElement("option");t.value="",t.textContent=i,t.disabled=!0,t.selected=!0,s.appendChild(t)}const a={};e.forEach(t=>{const e="object"==typeof t&&null!==t?t.group:null;if(e){a[e]||(a[e]=document.createElement("optgroup"),a[e].label=e,s.appendChild(a[e]));const r=document.createElement("option");r.value="string"==typeof t?t:t.value,r.textContent="string"==typeof t?t:t.label,a[e].appendChild(r)}else{const e=document.createElement("option");e.value="string"==typeof t?t:t.value,e.textContent="string"==typeof t?t:t.label,s.appendChild(e)}}),s.parentNode!==this&&this.appendChild(s),this.classList.remove("c-select"),s.classList.add("c-select")}catch(t){f(this,"attribute",t)}const r=this.querySelector("select");r&&!r.classList.contains("c-select")&&(r.classList.add("c-select"),this.classList.remove("c-select"));const i=this.querySelector("select");if(i){this.hasAttribute("disabled")?(i.setAttribute("disabled",""),this.classList.add("is-disabled")):(i.removeAttribute("disabled"),this.classList.remove("is-disabled")),this.hasAttribute("name")&&i.setAttribute("name",this.getAttribute("name")),this.hasAttribute("multiple")?i.setAttribute("multiple",""):i.removeAttribute("multiple"),this.hasAttribute("autocomplete")&&i.setAttribute("autocomplete",this.getAttribute("autocomplete")),this.hasAttribute("required")?i.setAttribute("required",""):i.removeAttribute("required");const t=this.getAttribute("value");if(null!==t)if(i.multiple){const e=new Set(String(t).split(",").map(t=>t.trim()).filter(Boolean));Array.from(i.options).forEach(t=>{t.selected=e.has(t.value)})}else i.value=t}const a=this.getAttribute("label");if(a){let t=this.querySelector("label.c-select__label");t||(t=document.createElement("label"),t.className="c-select__label",this.insertBefore(t,i||this.firstChild)),t.textContent=a,i&&(i.id||(i.id=o("contour-select")),t.setAttribute("for",i.id),i.setAttribute("aria-label",a))}if(!this.querySelector("select")?.hasAttribute("aria-label")){const t=this.querySelector("select");t&&t.setAttribute("aria-label",k(this,"select","Select"))}const n=this.getAttribute("error"),c=this.getAttribute("help");let l=this.querySelector(".c-select__message");n||c?(l||(l=document.createElement("div"),l.className="c-select__message",this.appendChild(l)),l.textContent=n||c||"",l.classList.toggle("c-select__message--error",!!n)):l&&l.remove(),n?this.classList.add("is-error"):this.classList.remove("is-error")}enhance(){this._internals&&this._syncFormValue(),this._wiredSelect||(this._wiredSelect=!0,this.addEventListener("input",t=>{const e=this.querySelector("select");e&&t.target===e&&this._emitForm("contour:input")}),this.addEventListener("change",t=>{const e=this.querySelector("select");if(!e||t.target!==e||!this._internals)return;const s=e.multiple?Array.from(e.selectedOptions).map(t=>t.value).join(","):e.value;this.setAttribute("value",s),this._syncFormValue(),this._emitForm("contour:change")}))}_syncFormValue(){if(!this._internals)return;const t=this.querySelector("select");if(t)if(t.multiple){const e=Array.from(t.selectedOptions).map(t=>t.value),s=this.getAttribute("name");if(s&&e.length){const t=new FormData;for(const r of e)t.append(s,r);this._internals.setFormValue(t)}else this._internals.setFormValue(null);this._syncValidity(this.hasAttribute("required")&&!e.length)}else this._internals.setFormValue(t.value),this._syncValidity(this.hasAttribute("required")&&!t.value)}formResetCallback(){this._contourResetting=!0;try{const t=this._selectDefault??null;null===t?this.removeAttribute("value"):this.setAttribute("value",t),this._syncFormValue()}finally{this._contourResetting=!1}}formStateRestoreCallback(t){const e=this.querySelector("select");if(!e||!this._internals)return;const s=t instanceof FormData?Array.from(t.getAll(this.getAttribute("name"))).map(String):null==t?[]:String(t).split(",").map(t=>t.trim()).filter(Boolean);this._contourResetting=!0;try{if(e.multiple){const t=new Set(s);for(const s of e.options)s.selected=t.has(s.value);this.setAttribute("value",s.join(","))}else e.value=s[0]||"",this.setAttribute("value",e.value);this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-version",class extends T{static get observed(){return["options","items","value","name"]}static get formAssociated(){return!0}static get properties(){return{options:{attribute:"options"},items:{attribute:"items"},value:{attribute:"value"},name:{attribute:"name"}}}render(){this.classList.add("c-version"),void 0===this._versionDefault&&(this._versionDefault=this.getAttribute("value"));const t=this.getAttribute("options")||this.getAttribute("items"),e=new Set(this._contourGenerated||[]),s=Array.from(this.children).filter(t=>!e.has(t));if(t&&!s.length)try{const e=JSON.parse(t),s=this.ensure("select.c-version",()=>{const t=document.createElement("select");return t.className="c-version",t});s.innerHTML="",s.hasAttribute("aria-label")||s.setAttribute("aria-label",k(this,"version","Version")),e.forEach(t=>{const e=document.createElement("option");"string"==typeof t?(e.value=t,e.textContent=t):(e.value=t.value||t.label,e.textContent=t.label||t.value,t.selected&&(e.selected=!0)),s.appendChild(e)}),s.parentNode!==this&&this.appendChild(s),this.classList.remove("c-version"),s.classList.add("c-version")}catch(t){f(this,"attribute",t)}const r=this.querySelector("select");if(r){this.hasAttribute("name")&&r.setAttribute("name",this.getAttribute("name"));const t=this.getAttribute("value");null!==t&&(r.value=t)}}enhance(){const t=()=>{const t=this.querySelector("select");t&&this._internals&&this._internals.setFormValue(t.value)};t(),this._wiredVersion||(this._wiredVersion=!0,this.addEventListener("change",e=>{const s=this.querySelector("select");s&&e.target===s&&(this.setAttribute("value",s.value),t(),this._emitForm("contour:change"))}))}formResetCallback(){this._contourResetting=!0;try{const t=this._versionDefault??null;null===t?this.removeAttribute("value"):this.setAttribute("value",t),this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-textarea",class extends T{static get observed(){return["placeholder","required","disabled","error","help","value","name","label"]}static get properties(){return{placeholder:{attribute:"placeholder"},required:{attribute:"required",type:Boolean},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},value:{attribute:"value"},name:{attribute:"name"},label:{attribute:"label"}}}static get formAssociated(){return!0}render(){const t=this.ensure("textarea",()=>{const t=document.createElement("textarea");return t.className="c-textarea",t});t.className="c-textarea",this.hasAttribute("name")?t.name=this.getAttribute("name"):t.removeAttribute("name"),this.hasAttribute("value")&&(t.value=this.getAttribute("value")),this.hasAttribute("aria-label")&&!t.hasAttribute("aria-label")&&t.setAttribute("aria-label",this.getAttribute("aria-label")),this.hasAttribute("label")&&!t.hasAttribute("aria-label")&&t.setAttribute("aria-label",this.getAttribute("label")),t.hasAttribute("aria-label")||t.setAttribute("aria-label",k(this,"textarea","Textarea")),this.hasAttribute("placeholder")?t.placeholder=this.getAttribute("placeholder"):t.removeAttribute("placeholder"),this.hasAttribute("required")?t.setAttribute("required",""):t.removeAttribute("required"),this.hasAttribute("disabled")?(t.setAttribute("disabled",""),this.classList.add("is-disabled")):(t.removeAttribute("disabled"),this.classList.remove("is-disabled"));const e=this.getAttribute("error"),s=this.getAttribute("help");let r=this.querySelector(".c-textarea__message");e||s?(r||(r=document.createElement("div"),r.className="c-textarea__message",this.appendChild(r)),r.textContent=e||s||"",r.classList.toggle("c-textarea__message--error",!!e)):r&&r.remove(),e?this.classList.add("is-error"):this.classList.remove("is-error")}enhance(){const t=this.querySelector("textarea");t&&this._internals&&(this._internals.setFormValue(t.value),this._syncValidity(this.hasAttribute("required")&&!t.value.trim())),this._wiredTextarea||(this._wiredTextarea=!0,this.addEventListener("input",t=>{const e=this.querySelector("textarea");e&&t.target===e&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:input"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}),this.addEventListener("change",t=>{const e=this.querySelector("textarea");e&&t.target===e&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}))}});c("contour-input",class extends T{static get observed(){return["type","placeholder","required","value","disabled","error","help","label","name"]}static get properties(){return{type:{attribute:"type"},placeholder:{attribute:"placeholder"},required:{attribute:"required",type:Boolean},value:{attribute:"value"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},label:{attribute:"label"},name:{attribute:"name"}}}static get formAssociated(){return!0}render(){this.classList.add("c-input");const t=this.ensure("input",()=>{const t=document.createElement("input");return t.className="c-input",t});t.className="c-input",t.type=this.getAttribute("type")||"text",t.placeholder=this.getAttribute("placeholder")||"",this.hasAttribute("name")?t.name=this.getAttribute("name"):t.removeAttribute("name");let e=this.getAttribute("label");if(!e){const t=this.closest("contour-field");t&&(e=t.getAttribute("label"))}e?t.setAttribute("aria-label",e):t.getAttribute("aria-label")||t.setAttribute("aria-label",k(this,"input","Input")),this.hasAttribute("value")&&(t.value=this.getAttribute("value")),this.hasAttribute("required")?t.setAttribute("required",""):t.removeAttribute("required"),this.hasAttribute("disabled")?(t.setAttribute("disabled",""),this.classList.add("is-disabled")):(t.removeAttribute("disabled"),this.classList.remove("is-disabled"));const s=this.getAttribute("error"),r=this.getAttribute("help");let i=this.querySelector(".c-input__message");s||r?(i||(i=document.createElement("div"),i.className="c-input__message",this.appendChild(i)),i.textContent=s||r||"",i.classList.toggle("c-input__message--error",!!s)):i&&i.remove(),s?this.classList.add("is-error"):this.classList.remove("is-error")}enhance(){const t=this.querySelector("input");t&&this._internals&&(this._internals.setFormValue(t.value),this._syncValidity(this.hasAttribute("required")&&!t.value.trim())),this._wiredInput||(this._wiredInput=!0,this.addEventListener("input",t=>{const e=this.querySelector("input");e&&t.target===e&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:input"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}),this.addEventListener("change",t=>{const e=this.querySelector("input");e&&t.target===e&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}))}});c("contour-input-group",class extends T{static get observed(){return["label","placeholder","clearable","submit","value","name","required","disabled"]}static get properties(){return{label:{attribute:"label"},placeholder:{attribute:"placeholder"},clearable:{attribute:"clearable",type:Boolean},submit:{attribute:"submit",type:Boolean},value:{attribute:"value"},name:{attribute:"name"},required:{attribute:"required",type:Boolean},disabled:{attribute:"disabled",type:Boolean}}}static get formAssociated(){return!0}render(){this.classList.add("c-input-group");this.ensure("svg",()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true");const e=document.createElementNS("http://www.w3.org/2000/svg","use");return e.setAttribute("href","#i-search"),t.appendChild(e),t});const t=this.ensure("input.c-input",()=>{const t=document.createElement("input");return t.className="c-input",t.type="text",t});t.placeholder=this.getAttribute("placeholder")||this.getAttribute("label")||"",this.hasAttribute("name")?t.name=this.getAttribute("name"):t.removeAttribute("name"),this.hasAttribute("value")&&(t.value=this.getAttribute("value")),this.hasAttribute("required")?t.setAttribute("required",""):t.removeAttribute("required"),this.hasAttribute("disabled")?(t.setAttribute("disabled",""),this.classList.add("is-disabled")):(t.removeAttribute("disabled"),this.classList.remove("is-disabled"));const e=this.getAttribute("label");t.hasAttribute("aria-label")||t.setAttribute("aria-label",e||"Search");const s=this.querySelector(".c-input-group__clear");if(s&&s.remove(),this.hasAttribute("clearable")){const t=document.createElement("button");t.className="c-input-group__clear",t.type="button",t.setAttribute("aria-label",k(this,"clear","Clear")),t.textContent="×",this.appendChild(t)}const r=this.querySelector(".c-input-group__submit");if(r&&r.remove(),this.hasAttribute("submit")){const t=document.createElement("button");t.className="c-input-group__submit",t.type="submit",t.setAttribute("aria-label",k(this,"submit","Submit")),t.textContent="→",this.appendChild(t)}}enhance(){const t=this.querySelector("input.c-input");t&&this._internals&&(this._internals.setFormValue(t.value),this._syncValidity(this.hasAttribute("required")&&!t.value.trim())),this._wiredInputGroup||(this._wiredInputGroup=!0,this.addEventListener("input",t=>{const e=this.querySelector("input.c-input");e&&t.target===e&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:input"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}),this.addEventListener("change",t=>{const e=this.querySelector("input.c-input");e&&t.target===e&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-input-group__clear"):null;if(e&&this.contains(e)){t.preventDefault();const e=this.querySelector("input.c-input");e&&(e.value="",e.focus()),this._internals&&(this._internals.setFormValue(""),this._syncValidity(this.hasAttribute("required"))),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:""}}))}}))}});c("contour-radio-list",class extends T{static get observed(){return["items","options","name","value","required","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","dir","no-cache"]}static get properties(){return{items:{attribute:"items"},options:{attribute:"options"},name:{attribute:"name"},value:{attribute:"value"},required:{attribute:"required",type:Boolean},src:{attribute:"src"}}}static get formAssociated(){return!0}attributeChangedCallback(t,e,s){"value"===t&&this._radioSync||super.attributeChangedCallback(t,e,s)}render(){if(this.classList.add("c-radio-list"),this.setAttribute("role","radiogroup"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("name")||"Options"),this.hasAttribute("required")?this.setAttribute("aria-required","true"):this.removeAttribute("aria-required"),Zt(this),$t(this,"items"),Xt(this,"radio-list"))return;const t=Jt(this,"items")||this.getAttribute("options")||this.getAttribute("items"),e=this.querySelector("input.c-radio__input:checked"),s=this.hasAttribute("value")?this.getAttribute("value"):e?e.value:null;if(Array.from(this.querySelectorAll("label.c-radio")).forEach(t=>t.remove()),t)try{const e=JSON.parse(t),r=this.getAttribute("name")||o("radio-list");e.forEach(t=>{const e=document.createElement("label");e.className="c-radio";const i=document.createElement("input");if(i.type="radio",i.className="c-radio__input",i.name=r,i.tabIndex=-1,"string"==typeof t)i.value=t,t===s&&(i.checked=!0),e.appendChild(i),e.appendChild(document.createTextNode(" "+t));else{i.value=t.value||t.label,(t.checked||null!=s&&String(t.value||t.label)===String(s))&&(i.checked=!0),e.appendChild(i);const r=document.createElement("span");r.textContent=t.label||t.value,e.appendChild(r)}this.appendChild(e)});const i=Array.from(this.querySelectorAll("input.c-radio__input")),a=i.find(t=>t.checked)||i[0];a&&(a.tabIndex=0)}catch(t){f(this,"attribute",t)}else Yt(this,"radio-list")}enhance(){const t=()=>{const t=this.querySelector("input.c-radio__input:checked"),e=t?t.value:null;if(this._internals&&this._internals.setFormValue(e),null!=e&&this.getAttribute("value")!==e){this._radioSync=!0;try{this.setAttribute("value",e)}finally{this._radioSync=!1}}this._syncValidity(this.hasAttribute("required")&&null==e)};t(),this._wiredRadioList||(this._wiredRadioList=!0,this.addEventListener("change",e=>{const s=e.target&&e.target.closest?e.target.closest("input.c-radio__input"):null;s&&this.contains(s)&&(t(),this._emitForm("contour:change"))}),this.addEventListener("keydown",e=>{const s=Array.from(this.querySelectorAll("input.c-radio__input"));if(!s.length)return;const r=s.indexOf(e.target);if(-1===r)return;const i="rtl"===(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase();let a=-1;if("ArrowDown"===e.key)a=(r+1)%s.length;else if("ArrowUp"===e.key)a=(r-1+s.length)%s.length;else if("ArrowRight"===e.key)a=i?(r-1+s.length)%s.length:(r+1)%s.length;else if("ArrowLeft"===e.key)a=i?(r+1)%s.length:(r-1+s.length)%s.length;else if("Home"===e.key)a=0;else{if("End"!==e.key)return;a=s.length-1}e.preventDefault();const n=s.find(t=>t.checked);for(const t of s)t.tabIndex=-1;s[a].tabIndex=0,s[a].checked=!0,s[a].focus(),t(),n!==s[a]&&this._emitForm("contour:change")}))}formResetCallback(){this._contourResetting=!0;try{this.isConnected&&this._contourAuthored&&this.attributeChangedCallback("__rerender__",null,""),this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-fieldset",class extends T{static get observed(){return["legend","disabled"]}static get properties(){return{legend:{attribute:"legend"},disabled:{attribute:"disabled",type:Boolean}}}render(){const t=this.ensure("fieldset",()=>{const t=document.createElement("fieldset");return t.className="c-fieldset",t});this.hasAttribute("disabled")?t.setAttribute("disabled",""):t.removeAttribute("disabled");const e=this.getAttribute("legend");let s=t.querySelector("legend");e?(s||(s=document.createElement("legend"),s.className="c-fieldset__legend",t.prepend(s)),s.textContent=e):s&&s.remove();const r=Array.from(this.children).filter(e=>e!==t);r.length&&r.forEach(e=>t.appendChild(e))}});c("contour-checkbox-group",class extends T{static get observed(){return["legend","name","options","items","value","required","disabled"]}static get properties(){return{legend:{attribute:"legend"},name:{attribute:"name"},options:{attribute:"options"},items:{attribute:"items"},value:{attribute:"value"},required:{attribute:"required",type:Boolean},disabled:{attribute:"disabled",type:Boolean}}}static get formAssociated(){return!0}render(){this.classList.add("c-checkbox-group"),void 0===this._checkboxGroupDefault&&(this._checkboxGroupDefault=this.getAttribute("value"));const t=this.ensure("fieldset",()=>{const t=document.createElement("fieldset");return t.className="c-checkbox-group__fieldset",t});this.hasAttribute("disabled")?t.setAttribute("disabled",""):t.removeAttribute("disabled"),this.hasAttribute("required")?t.setAttribute("aria-required","true"):t.removeAttribute("aria-required");const e=this.getAttribute("legend");let s=t.querySelector("legend");e?(s||(s=document.createElement("legend"),s.className="c-checkbox-group__legend",t.prepend(s)),s.textContent=e):s&&s.remove();const r=this.getAttribute("name")||"group",i=this.getAttribute("options")||this.getAttribute("items"),a=(this.getAttribute("value")||"").split(",").map(t=>t.trim()).filter(Boolean);if(i)try{const e=JSON.parse(i);Array.from(t.querySelectorAll(".c-check")).forEach(t=>t.remove()),e.forEach(e=>{const s="string"==typeof e?e:e.label||e.value||"",i="string"==typeof e?e:e.value||e.label||"",n=document.createElement("label");n.className="c-check";const o=document.createElement("input");o.type="checkbox",o.className="c-check__input",o.name=r,o.value=i,o.setAttribute("data-contour-preserve-key",i),a.includes(i)&&(o.checked=!0);const c=document.createElement("span");c.textContent=s,n.appendChild(o),n.appendChild(c),t.appendChild(n)})}catch(t){f(this,"attribute",t)}if(a.length){const t=()=>{if(this.isConnected){for(const t of this.querySelectorAll("input[type=checkbox]"))a.includes(t.value)&&(t.checked=!0);this._internals&&this._syncFormValue()}};t(),"function"==typeof queueMicrotask&&queueMicrotask(t),"function"==typeof requestAnimationFrame&&requestAnimationFrame(t)}}enhance(){this._internals&&this._syncFormValue(),this._wiredCheckboxGroup||(this._wiredCheckboxGroup=!0,this.addEventListener("change",t=>{const e=t.target;if(e&&e.matches&&e.matches("input[type=checkbox]")){const t=Array.from(this.querySelectorAll("input[type=checkbox]:checked")).map(t=>t.value);this.setAttribute("value",t.join(",")),this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t.join(","),values:t}}))}}))}_syncFormValue(){if(!this._internals)return;const t=Array.from(this.querySelectorAll("input[type=checkbox]:checked")),e=this.getAttribute("name");if(e&&t.length){const s=new FormData;for(const r of t)s.append(e,r.value);this._internals.setFormValue(s)}else this._internals.setFormValue(null);this._syncValidity(this.hasAttribute("required")&&!t.length)}formResetCallback(){this._contourResetting=!0;try{const t=this._checkboxGroupDefault??null;null===t?this.removeAttribute("value"):this.setAttribute("value",t),this._syncFormValue()}finally{this._contourResetting=!1}}formStateRestoreCallback(t){const e=t instanceof FormData?Array.from(t.getAll(this.getAttribute("name"))).map(String):null==t?[]:String(t).split(",").map(t=>t.trim()).filter(Boolean);this._contourResetting=!0;try{this.setAttribute("value",e.join(",")),this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-search-field",class extends T{static get observed(){return["value","placeholder","label","name","required","disabled"]}static get properties(){return{value:{attribute:"value"},placeholder:{attribute:"placeholder"},label:{attribute:"label"},name:{attribute:"name"},required:{attribute:"required",type:Boolean},disabled:{attribute:"disabled",type:Boolean}}}static get formAssociated(){return!0}render(){this.classList.add("c-search-field");const t=this.ensure("input",()=>{const t=document.createElement("input");return t.type="search",t.className="c-search-field__input",t});t.placeholder=this.getAttribute("placeholder")||"Search",null!==this.getAttribute("value")&&(t.value=this.getAttribute("value")),this.hasAttribute("name")&&(t.name=this.getAttribute("name")),this.hasAttribute("required")?t.setAttribute("required",""):t.removeAttribute("required"),this.hasAttribute("disabled")?(t.setAttribute("disabled",""),this.classList.add("is-disabled")):(t.removeAttribute("disabled"),this.classList.remove("is-disabled"));const e=this.getAttribute("label");e?t.setAttribute("aria-label",e):t.hasAttribute("aria-label")||t.setAttribute("aria-label",k(this,"search","Search"))}enhance(){const t=this.querySelector("input");t&&this._internals&&(this._internals.setFormValue(t.value),this._syncValidity(this.hasAttribute("required")&&!t.value.trim())),this._wiredSearchField||(this._wiredSearchField=!0,this.addEventListener("input",t=>{const e=t.target;e&&e.matches&&e.matches("input")&&(this._internals&&(this._internals.setFormValue(e.value),this._syncValidity(this.hasAttribute("required")&&!e.value.trim())),this._emitForm("contour:input"))}),this.addEventListener("change",t=>{const e=t.target;e&&e.matches&&e.matches("input")&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}))}});c("contour-density-toggle",class extends T{static get observed(){return["value","label"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"}}}render(){this.classList.add("c-density-toggle");const t=this.getAttribute("value")||"comfortable";this.setAttribute("data-density",t);const e=this.ensure("button",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-density-toggle__btn",t.type="button",t}),s=this.getAttribute("label")||("compact"===t?"Compact":"Comfortable");e.textContent=s,e.setAttribute("aria-pressed","compact"===t?"true":"false")}enhance(){this._wiredDensityToggle||(this._wiredDensityToggle=!0,this.addEventListener("click",()=>{const t="compact"===this.getAttribute("data-density")?"comfortable":"compact";this.setAttribute("value",t),this.setAttribute("data-density",t);const e=this.querySelector(".c-density-toggle__btn");e&&(e.textContent="compact"===t?"Compact":"Comfortable",e.setAttribute("aria-pressed","compact"===t?"true":"false")),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t}}))}))}});c("contour-pressable",class extends T{static get observed(){return["disabled","label"]}static get properties(){return{disabled:{attribute:"disabled",type:Boolean}}}render(){this.classList.add("c-pressable"),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Pressable"),this.hasAttribute("disabled")?(this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1")):(this.removeAttribute("aria-disabled"),this.hasAttribute("tabindex")&&"-1"!==this.getAttribute("tabindex")||this.setAttribute("tabindex","0"))}enhance(){if(this._wiredPressable)return;this._wiredPressable=!0;const t=()=>this.hasAttribute("disabled")||"true"===this.getAttribute("aria-disabled");this.addEventListener("click",e=>{t()&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener("keydown",e=>{if(t())return e.preventDefault(),void e.stopImmediatePropagation();"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.click(),this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0})))})}});c("contour-resize-handle",class extends T{render(){this.classList.add("c-resize-handle"),this.hasAttribute("role")||this.setAttribute("role","separator"),this.hasAttribute("aria-valuenow")||this.setAttribute("aria-valuenow","0"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"resize-handle","Resize handle")),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("aria-orientation")||this.setAttribute("aria-orientation","horizontal")}enhance(){this._wiredResizeHandle||(this._wiredResizeHandle=!0,this.addEventListener("keydown",t=>{const e=Number(this.getAttribute("aria-valuenow"))||0;let s=0;if("ArrowLeft"===t.key||"ArrowDown"===t.key)s=-5;else if("ArrowRight"===t.key||"ArrowUp"===t.key)s=5;else if("Home"===t.key)s=-e;else{if("End"!==t.key)return;s=100-e}t.preventDefault();const r=Math.min(100,Math.max(0,e+s));this.setAttribute("aria-valuenow",String(r)),this.dispatchEvent(new CustomEvent("contour:resize",{bubbles:!0,composed:!0,detail:{value:r,delta:s}}))}))}});c("contour-search-trigger",class extends T{static get observed(){return["label","shortcut"]}static get properties(){return{label:{attribute:"label"},shortcut:{attribute:"shortcut"}}}render(){this.classList.add("c-search-trigger");const t=this.getAttribute("label")||"Search";this.hasAttribute("aria-label")||this.setAttribute("aria-label",t);const e=this.ensure(".c-search-trigger__text",()=>{const t=document.createElement("span");return t.className="c-search-trigger__text",t});e.className="c-search-trigger__text",e.textContent.trim()&&e.textContent.trim()===t||(e.textContent=t);const s=this.ensure("kbd.c-search-trigger__kbd",()=>{const t=document.createElement("kbd");return t.className="c-search-trigger__kbd",t});s.className="c-search-trigger__kbd",s.textContent=this.getAttribute("shortcut")||"⌘K"}});c("contour-shortcut-list",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-shortcut-list"),this.setAttribute("role","list");const t=this.getAttribute("title");if(t){this.ensure(".c-shortcut-list__title",()=>{const t=document.createElement("div");return t.className="c-shortcut-list__title",t}).textContent=t}}});c("contour-shortcut-row",class extends T{static get observed(){return["desc","key"]}static get properties(){return{desc:{attribute:"desc"},key:{attribute:"key"}}}render(){this.classList.add("c-shortcut-row"),this.hasAttribute("role")||this.setAttribute("role","listitem");const t=this.getAttribute("key"),e=this.getAttribute("desc");if(t){const e=this.ensure(".c-shortcut-row__keys",()=>{const t=document.createElement("kbd");return t.className="c-shortcut-row__keys",t});e.className="c-shortcut-row__keys",e.textContent=t}else{const t=this.querySelector(".c-shortcut-row__keys");t&&t.remove()}if(e){const t=this.ensure(".c-shortcut-row__label",()=>{const t=document.createElement("span");return t.className="c-shortcut-row__label",t});t.className="c-shortcut-row__label",t.textContent=e}else{const t=this.querySelector(".c-shortcut-row__label");t&&t.remove()}}});c("contour-shortcut-panel",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-shortcut-panel");const t=this.getAttribute("title");if(t){this.ensure(".c-shortcut-panel__title",()=>{const t=document.createElement("div");return t.className="c-shortcut-panel__title",t}).textContent=t}else{const t=this.querySelector(".c-shortcut-panel__title");t&&t.remove()}}});c("contour-shortcut-overlay",class extends T{static get observed(){return["title","open","keybind"]}static get properties(){return{title:{attribute:"title"},open:{attribute:"open",type:Boolean},keybind:{attribute:"keybind"}}}render(){this.classList.add("c-shortcut-overlay"),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("aria-modal")||this.setAttribute("aria-modal","true"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Keyboard shortcuts");const t=this.getAttribute("title");if(t){this.ensure(".c-shortcut-overlay__title",()=>{const t=document.createElement("div");return t.className="c-shortcut-overlay__title",t}).textContent=t}this.hasAttribute("open")?this.removeAttribute("hidden"):this.hasAttribute("hidden")||this.setAttribute("hidden","")}show(){if(this.hasAttribute("open"))return;this._opener=document.activeElement,this.setAttribute("open",""),this.removeAttribute("hidden"),Ft(this,!0),this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}));const t=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");t&&t.focus()}hide(){this.hasAttribute("open")&&(this.removeAttribute("open"),this.setAttribute("hidden",""),Ft(this,!1),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})),this._opener&&"function"==typeof this._opener.focus&&this._opener.focus(),this._opener=null)}toggle(){this.hasAttribute("open")?this.hide():this.show()}enhance(){if(this._wiredShortcutOverlay)return;this._wiredShortcutOverlay=!0;const t=t=>{if("?"!==t.key||!w(this,"keybind")||t.metaKey||t.ctrlKey||t.altKey)"Escape"===t.key&&this.hasAttribute("open")&&this.hide();else{const e=t.target&&t.target.tagName||"";if("INPUT"===e||"TEXTAREA"===e||t.target&&t.target.isContentEditable)return;t.preventDefault(),this.toggle()}};document.addEventListener("keydown",t),i(this,()=>document.removeEventListener("keydown",t)),this.addEventListener("click",t=>{t.target===this&&this.hide()})}});c("contour-row-action",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("disabled")?(this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1")):(this.removeAttribute("aria-disabled"),this.hasAttribute("tabindex")&&"-1"!==this.getAttribute("tabindex")||this.setAttribute("tabindex","0"));const t=this.getAttribute("label");t&&!this.hasChildNodes()&&(this.textContent=t),t&&!this.hasAttribute("aria-label")&&this.setAttribute("aria-label",t)}enhance(){if(this._wiredRowAction)return;this._wiredRowAction=!0;const t=()=>this.hasAttribute("disabled")||"true"===this.getAttribute("aria-disabled");this.addEventListener("click",e=>{t()&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener("keydown",e=>{if(t())return e.preventDefault(),void e.stopImmediatePropagation();"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.click(),this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0})))})}});c("contour-segmented",class extends T{static get observed(){return["options","items","selected","label","value"]}static get properties(){return{options:{attribute:"options"},items:{attribute:"items"},selected:{attribute:"selected"},label:{attribute:"label"},value:{attribute:"value"}}}render(){this.classList.add("c-segmented");const t=this.getAttribute("options")||this.getAttribute("items");if(t){let e=null;try{e=JSON.parse(t)}catch(t){e=null}if(Array.isArray(e)){Array.from(this.querySelectorAll("button.c-segmented__option")).forEach(t=>t.remove());const t=this.getAttribute("selected")||this.getAttribute("value");e.forEach((e,s)=>{const r="string"==typeof e?e:e.label||e.value||"",i="string"==typeof e?e:e.value||e.label||"",a=document.createElement("button");a.className="c-segmented__option",a.type="button",a.textContent=r,a.dataset.value=i,null!==t&&String(i)===String(t)||null===t&&0===s?a.setAttribute("aria-pressed","true"):a.setAttribute("aria-pressed","false"),this.appendChild(a)})}}}enhance(){gt(this)}});c("contour-draggable",class extends T{render(){this.classList.add("c-draggable"),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("draggable")||this.setAttribute("draggable","true"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Draggable item")}_dragValue(){return this.getAttribute("value")||this.getAttribute("label")||(this.textContent||"").trim()||"draggable"}enhance(){this._wiredDraggable||(this._wiredDraggable=!0,this.addEventListener("dragstart",t=>{if(!t.dataTransfer)return;const e=this._dragValue();try{t.dataTransfer.effectAllowed="move"}catch(t){}t.dataTransfer.setData("text/plain",e),this.classList.add("c-draggable--dragging"),this.dispatchEvent(new CustomEvent("contour:dragstart",{bubbles:!0,composed:!0,detail:{value:e}}))}),this.addEventListener("dragend",()=>{this.classList.remove("c-draggable--dragging"),this.dispatchEvent(new CustomEvent("contour:dragend",{bubbles:!0,composed:!0,detail:{value:this._dragValue()}}))}),this.addEventListener("keydown",t=>{if("Enter"===t.key||" "===t.key)return t.preventDefault(),void this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0}));"ArrowUp"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:move",{bubbles:!0,composed:!0,detail:{direction:"ArrowUp"===t.key?"up":"down"}})))}))}});c("contour-drag-handle",class extends T{render(){this.classList.add("c-drag-handle"),this.hasAttribute("role")||this.setAttribute("role","separator");const t=this.getAttribute("min")||"0",e=this.getAttribute("max")||"100";this.hasAttribute("aria-valuenow")||this.setAttribute("aria-valuenow",t),this.hasAttribute("aria-valuemin")||this.setAttribute("aria-valuemin",t),this.hasAttribute("aria-valuemax")||this.setAttribute("aria-valuemax",e),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Drag handle"),this.hasAttribute("aria-orientation")||this.setAttribute("aria-orientation","horizontal");const s=this.getAttribute("controls");s&&!this.hasAttribute("aria-controls")&&this.setAttribute("aria-controls",s);const r=this.ensure(".c-drag-handle__grip",()=>{const t=document.createElement("span");return t.className="c-drag-handle__grip",t.setAttribute("aria-hidden","true"),L(t,'<svg viewBox="0 0 24 24"><use href="#i-drag" /></svg>'),t});r.parentNode!==this&&this.appendChild(r)}enhance(){this._wiredDragHandle||(this._wiredDragHandle=!0,this.addEventListener("keydown",t=>{const e=Number(this.getAttribute("aria-valuenow")||0),s=Number(this.getAttribute("aria-valuemin")||0),r=Number(this.getAttribute("aria-valuemax")||100);let i=0;if("ArrowLeft"===t.key||"ArrowDown"===t.key)i=-1;else if("ArrowRight"===t.key||"ArrowUp"===t.key)i=1;else if("Home"===t.key)i=s-e;else{if("End"!==t.key)return;i=r-e}t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:drag",{bubbles:!0,composed:!0,detail:{key:t.key,delta:i,value:e}}))}))}});c("contour-drop-indicator",class extends T{static get observed(){return["label","open"]}static get properties(){return{label:{attribute:"label"},open:{attribute:"open",type:Boolean}}}render(){this.classList.add("c-drop-indicator"),this.classList.toggle("c-drop-indicator--visible",this.hasAttribute("open")),this.hasAttribute("role")||this.setAttribute("role","presentation"),"presentation"===this.getAttribute("role")&&(this.removeAttribute("aria-label"),this.removeAttribute("aria-labelledby")),Array.from(this.childNodes).forEach(t=>{(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ELEMENT_NODE&&"SPAN"===t.tagName)&&t.remove()});const t=this.getAttribute("label");if(t){this.ensure(".c-drop-indicator__label",()=>{const t=document.createElement("span");return t.className="c-drop-indicator__label",t}).textContent=t}}});c("contour-drop-zone",class extends T{static get observed(){return["label"]}static get properties(){return{label:{attribute:"label"}}}render(){this.classList.add("c-drop-zone"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Drop zone"),Array.from(this.childNodes).forEach(t=>{(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ELEMENT_NODE&&"SPAN"===t.tagName)&&t.remove()});const t=this.getAttribute("label");if(t){const e=this.ensure(".c-drop-zone__label",()=>{const t=document.createElement("p");return t.className="c-drop-zone__label",t});L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-upload" /></svg>'),e.appendChild(document.createTextNode(" "+t))}}enhance(){if(this._wiredDropZone)return;this._wiredDropZone=!0;const t=t=>t.dataTransfer&&Array.from(t.dataTransfer.types).includes("text/plain"),e=()=>{this.classList.remove("c-drop-zone--active","c-drop-zone--reject")};this.addEventListener("dragenter",e=>{e.dataTransfer&&(this.classList.toggle("c-drop-zone--reject",!t(e)),t(e)&&(e.preventDefault(),this.classList.add("c-drop-zone--active")))}),this.addEventListener("dragover",e=>{e.dataTransfer&&(this.classList.toggle("c-drop-zone--reject",!t(e)),t(e)&&(e.preventDefault(),this.classList.add("c-drop-zone--active")))}),this.addEventListener("dragleave",e),this.addEventListener("drop",s=>{if(!t(s))return;s.preventDefault(),e();const r=s.dataTransfer.getData("text/plain")||"";this.dispatchEvent(new CustomEvent("contour:drop",{bubbles:!0,composed:!0,detail:{value:r,label:this.getAttribute("label")}}))})}});c("contour-resizable",class extends T{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 t="vertical"===this.getAttribute("direction");if(this.classList.add(t?"c-resizable--vertical":"c-resizable--horizontal"),!this.querySelector(".c-resizable__pane")){const t=document.createElement("div");t.className="c-resizable__pane";const e=document.createElement("div");e.className="c-resize-handle",e.setAttribute("tabindex","0"),e.setAttribute("role","separator"),e.setAttribute("aria-valuenow","0");const s=document.createElement("div");s.className="c-resizable__pane",this.appendChild(t),this.appendChild(e),this.appendChild(s)}const e=this._splitValue||this.getAttribute("value"),s=this.querySelector(".c-resize-handle");if(s&&(s.setAttribute("role","separator"),s.setAttribute("tabindex","0"),s.setAttribute("aria-valuenow",String(Math.round(parseFloat(e)||50))),s.setAttribute("aria-valuemin","10"),s.setAttribute("aria-valuemax","90"),s.setAttribute("aria-orientation",t?"horizontal":"vertical"),s.setAttribute("aria-label",k(this,"resize-panels","Resize panels"))),e){const t=this.querySelector(".c-resizable__pane");t&&(t.style.flex=`0 0 ${e}%`)}}enhance(){if(this._wiredResizable)return;this._wiredResizable=!0;const t=t=>{const e=this.querySelector(".c-resizable__pane");e&&(e.style.flex=`0 0 ${t}%`),this._splitValue=String(t);const s=this.querySelector(".c-resize-handle");if(s){const e=this.classList.contains("c-resizable--vertical");s.setAttribute("role","separator"),s.setAttribute("aria-valuenow",String(t)),s.setAttribute("aria-valuemin","10"),s.setAttribute("aria-valuemax","90"),s.setAttribute("aria-orientation",e?"horizontal":"vertical"),s.setAttribute("aria-label",k(this,"resize-panels","Resize panels")),s.setAttribute("tabindex","0")}},e=(e,s)=>{const r=this.getBoundingClientRect(),i=this.classList.contains("c-resizable--vertical"),a=i?r.height:r.width,n=i?s-r.top:e-r.left,o=a>0?Math.min(.9,Math.max(.1,n/a)):.5;t(Math.round(100*o))};this.addEventListener("pointerdown",t=>{const e=this.querySelector(".c-resize-handle");if(e&&t.target===e){if(this._resizing=!0,e.classList.add("c-resize-handle--dragging"),e.setPointerCapture)try{e.setPointerCapture(t.pointerId)}catch(t){}t.preventDefault()}}),this.addEventListener("pointermove",t=>{this._resizing&&e(t.clientX,t.clientY)});const s=t=>{if(!this._resizing)return;this._resizing=!1,this._splitValue&&(this.setAttribute("value",this._splitValue),this._splitValue=null);const e=this.getBoundingClientRect();this.dispatchEvent(new CustomEvent("contour:resize",{bubbles:!0,composed:!0,detail:{width:Math.round(e.width),height:Math.round(e.height)}}));const s=this.querySelector(".c-resize-handle");if(s&&(s.classList.remove("c-resize-handle--dragging"),s.hasPointerCapture&&s.hasPointerCapture(t.pointerId)))try{s.releasePointerCapture(t.pointerId)}catch(t){}};this.addEventListener("pointerup",s),this.addEventListener("pointercancel",s),this.addEventListener("keydown",e=>{const s=this.querySelector(".c-resize-handle");if(!s||document.activeElement!==s)return;this.classList.contains("c-resizable--vertical");const r=parseFloat(this.getAttribute("value"))||50;"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),t(Math.max(10,r-5)),this._splitValue=null,this.setAttribute("value",String(Math.max(10,r-5)))):"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),t(Math.min(90,r+5)),this._splitValue=null,this.setAttribute("value",String(Math.min(90,r+5))));const i=this.getBoundingClientRect();this.dispatchEvent(new CustomEvent("contour:resize",{bubbles:!0,composed:!0,detail:{width:Math.round(i.width),height:Math.round(i.height)}}))})}});c("contour-split-view",class extends T{static get observed(){return["direction","value","left-label","right-label"]}static get properties(){return{direction:{attribute:"direction"},value:{attribute:"value"},"left-label":{attribute:"left-label"},"right-label":{attribute:"right-label"}}}render(){this.classList.add("c-split-view"),this.setAttribute("role","region");const t="vertical"===this.getAttribute("direction");if(t?(this.classList.add("c-split-view--vertical"),this.classList.remove("c-split-view--horizontal")):(this.classList.add("c-split-view--horizontal"),this.classList.remove("c-split-view--vertical")),this.getAttribute("left-label")&&this.setAttribute("aria-label",this.getAttribute("left-label")),!this.querySelector(".c-split-view__pane")){const e=document.createElement("div");e.className="c-split-view__pane c-split-view__pane--left",e.setAttribute("role","region"),this.getAttribute("left-label")&&e.setAttribute("aria-label",this.getAttribute("left-label"));const s=document.createElement("div");s.className="c-split-view__divider",s.setAttribute("tabindex","0"),s.setAttribute("role","separator"),s.setAttribute("aria-valuenow",this.getAttribute("value")||"50"),s.setAttribute("aria-valuemin","10"),s.setAttribute("aria-valuemax","90"),s.setAttribute("aria-orientation",t?"horizontal":"vertical"),s.setAttribute("aria-label",k(this,"split-divider","Split divider"));const r=document.createElement("div");r.className="c-split-view__pane c-split-view__pane--right",r.setAttribute("role","region"),this.getAttribute("right-label")&&r.setAttribute("aria-label",this.getAttribute("right-label")),this.appendChild(e),this.appendChild(s),this.appendChild(r)}if(!this.querySelector(".c-split-view__divider")){const e=document.createElement("div");e.className="c-split-view__divider",e.setAttribute("tabindex","0"),e.setAttribute("role","separator"),e.setAttribute("aria-valuenow",this.getAttribute("value")||"50"),e.setAttribute("aria-valuemin","10"),e.setAttribute("aria-valuemax","90"),e.setAttribute("aria-orientation",t?"horizontal":"vertical"),e.setAttribute("aria-label",k(this,"split-divider","Split divider")),this.appendChild(e)}const e=this.getAttribute("value")||"50",s=this.querySelector(".c-split-view__pane--left");s&&(s.style.flex=`0 0 ${e}%`);const r=this.querySelector(".c-split-view__divider");r&&(r.setAttribute("aria-valuenow",e),r.setAttribute("aria-valuemin","10"),r.setAttribute("aria-valuemax","90"),r.setAttribute("aria-orientation",t?"horizontal":"vertical"))}enhance(){if(this._wiredSplitView)return;this._wiredSplitView=!0;const t=()=>"column"===getComputedStyle(this).flexDirection,e=()=>{const e=this.querySelector(".c-split-view__divider");e&&e.setAttribute("aria-orientation",t()?"horizontal":"vertical")};if(e(),"function"==typeof ResizeObserver){const t=new ResizeObserver(e);t.observe(this),i(this,()=>t.disconnect())}const s=(e,s)=>{const r=this.getBoundingClientRect(),i=t(),a=i?r.height:r.width,n=i?s-r.top:e-r.left,o=a>0?Math.min(.9,Math.max(.1,n/a)):.5,c=Math.round(100*o),l=this.querySelector(".c-split-view__pane--left");l&&(l.style.flex=`0 0 ${c}%`);const u=this.querySelector(".c-split-view__divider");u&&u.setAttribute("aria-valuenow",String(c)),this.setAttribute("value",String(c))};this.addEventListener("pointerdown",t=>{const e=this.querySelector(".c-split-view__divider");if(e&&t.target===e){if(this._resizing=!0,e.classList.add("c-split-view__divider--dragging"),e.setPointerCapture)try{e.setPointerCapture(t.pointerId)}catch(t){}t.preventDefault()}}),this.addEventListener("pointermove",t=>{this._resizing&&s(t.clientX,t.clientY)});const r=t=>{if(!this._resizing)return;this._resizing=!1;const e=this.querySelector(".c-split-view__divider");if(e&&(e.classList.remove("c-split-view__divider--dragging"),e.hasPointerCapture&&e.hasPointerCapture(t.pointerId)))try{e.releasePointerCapture(t.pointerId)}catch(t){}const s=this.getBoundingClientRect();this.dispatchEvent(new CustomEvent("contour:split-change",{bubbles:!0,composed:!0,detail:{value:this.getAttribute("value"),width:Math.round(s.width),height:Math.round(s.height)}}))};this.addEventListener("pointerup",r),this.addEventListener("pointercancel",r),this.addEventListener("keydown",t=>{const e=this.querySelector(".c-split-view__divider");if(!e||document.activeElement!==e)return;const s=parseFloat(this.getAttribute("value"))||50;if("ArrowLeft"===t.key||"ArrowDown"===t.key){t.preventDefault();const e=Math.max(10,s-5),r=this.querySelector(".c-split-view__pane--left");r&&(r.style.flex=`0 0 ${e}%`),this.setAttribute("value",String(e));const i=this.querySelector(".c-split-view__divider");i&&i.setAttribute("aria-valuenow",String(e))}else if("ArrowRight"===t.key||"ArrowUp"===t.key){t.preventDefault();const e=Math.min(90,s+5),r=this.querySelector(".c-split-view__pane--left");r&&(r.style.flex=`0 0 ${e}%`),this.setAttribute("value",String(e));const i=this.querySelector(".c-split-view__divider");i&&i.setAttribute("aria-valuenow",String(e))}const r=this.getBoundingClientRect();this.dispatchEvent(new CustomEvent("contour:split-change",{bubbles:!0,composed:!0,detail:{value:this.getAttribute("value"),width:Math.round(r.width),height:Math.round(r.height)}}))})}});c("contour-table-wrap",class extends T{static get observed(){return[]}static get properties(){return{}}render(){this.classList.add("c-table-wrap"),Array.from(this.childNodes).forEach(t=>{(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ELEMENT_NODE&&"SPAN"===t.tagName)&&t.remove()})}});c("contour-scroll-area",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-scroll-area");const t=this.getAttribute("title");if(t){this.ensure(".c-scroll-area__title",()=>{const t=document.createElement("div");return t.className="c-scroll-area__title",t}).textContent=t}}});c("contour-btn",class extends T{static get observed(){return["variant","size","color","label","disabled","href","loading","title"]}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");for(const t of["variant","size","color"]){const e=this.getAttribute(t);e&&this.classList.add("c-btn--"+e)}this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("disabled")?(this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1")):(this.removeAttribute("aria-disabled"),this.hasAttribute("tabindex")&&"-1"!==this.getAttribute("tabindex")||this.setAttribute("tabindex","0"));const t=this.getAttribute("label")||this.getAttribute("title");t&&!this.hasChildNodes()&&(this.textContent=t),t&&!this.hasAttribute("aria-label")&&this.setAttribute("aria-label",t),this.hasAttribute("loading")?(this.setAttribute("data-loading","true"),this.setAttribute("aria-busy","true")):(this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"))}enhance(){if(this._wiredBtn)return;this._wiredBtn=!0;const t=()=>this.hasAttribute("disabled")||"true"===this.getAttribute("aria-disabled");this.addEventListener("click",e=>{t()&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener("click",e=>{if(t())return;const s=v(this.getAttribute("href"));s&&"#"!==s&&(location.href=s)}),this.addEventListener("keydown",e=>{if(t())return e.preventDefault(),void e.stopImmediatePropagation();"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.click(),this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0})))})}});c("contour-app",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-app");const t=this.ensure(".c-app__header",()=>{const t=document.createElement("header");return t.className="c-app__header",t}),e=this.getAttribute("title");if(e){const s=this.ensure(".c-app__title",()=>{const t=document.createElement("div");return t.className="c-app__title",t});s.textContent=e,s.parentNode!==t&&t.appendChild(s)}const s=this.ensure(".c-app__main",()=>{const t=document.createElement("main");return t.className="c-app__main",t});s.parentNode!==this&&this.appendChild(s),t.parentNode!==this&&this.insertBefore(t,s),Array.from(this.children).forEach(e=>{e!==t&&e!==s&&s.appendChild(e)})}});c("contour-app-body",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-app-body");const t=!!(this.parentElement&&this.parentElement.closest&&this.parentElement.closest("contour-app"))?"div":"main";let e=this.querySelector(":scope > .c-app-body__main");e&&e.tagName.toLowerCase()!==t&&(e.remove(),e=null),e||(e=document.createElement(t),e.className="c-app-body__main",this.appendChild(e));const s=this.getAttribute("title");if(s){const t=this.ensure(".c-app-body__title",()=>{const t=document.createElement("div");return t.className="c-app-body__title",t});t.textContent=s,t.parentNode!==e&&e.appendChild(t)}e.parentNode!==this&&this.appendChild(e)}});c("contour-btn-group",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-btn-group"),this.setAttribute("role","group"),this.getAttribute("title")&&this.setAttribute("aria-label",this.getAttribute("title"))}enhance(){this._wiredBtnGroup||(this._wiredBtnGroup=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-btn"):null;if(e&&this.contains(e)){const t=Array.from(this.querySelectorAll(".c-btn")).indexOf(e);this.dispatchEvent(new CustomEvent("contour:btn-group-change",{bubbles:!0,composed:!0,detail:{index:t,label:e.textContent}}))}}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-btn"));e.length&&z(t,e,{wrap:!1,homeEnd:!0,rtl:I(this)})}))}});c("contour-range-scale",class extends T{static get observed(){return["label","ticks"]}static get properties(){return{label:{attribute:"label"},ticks:{attribute:"ticks"}}}render(){this.classList.add("c-range-scale"),this.setAttribute("role","group"),this.getAttribute("label")&&this.setAttribute("aria-label",this.getAttribute("label"));const t=this.getAttribute("label");if(t){this.ensure(".c-range-scale__label",()=>{const t=document.createElement("span");return t.className="c-range-scale__label",t}).textContent=t}const e=this.getAttribute("ticks");Array.from(this.querySelectorAll(".c-range-scale__tick")).forEach(t=>t.remove()),e&&e.split(",").map(t=>t.trim()).filter(Boolean).forEach(t=>{const e=document.createElement("span");e.className="c-range-scale__tick",e.textContent=t,this.appendChild(e)})}enhance(){this._wiredRangeScale||(this._wiredRangeScale=!0,this.addEventListener("input",t=>{const e=t.target;e&&e.matches&&e.matches("input")&&this.dispatchEvent(new CustomEvent("contour:range-change",{bubbles:!0,composed:!0,detail:{value:e.value}}))}),this.addEventListener("change",t=>{const e=t.target;e&&e.matches&&e.matches("input")&&this.dispatchEvent(new CustomEvent("contour:range-change",{bubbles:!0,composed:!0,detail:{value:e.value}}))}))}});c("contour-time-range",class extends T{static get observed(){return["label","value","ticks","required","disabled"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},ticks:{attribute:"ticks"},required:{attribute:"required",type:Boolean},disabled:{attribute:"disabled",type:Boolean}}}render(){this.classList.add("c-time-range"),this.setAttribute("role","group"),this.getAttribute("label")&&this.setAttribute("aria-label",this.getAttribute("label"));const t=this.getAttribute("label");if(t){this.ensure(".c-time-range__label",()=>{const t=document.createElement("span");return t.className="c-time-range__label",t}).textContent=t}const e=this.querySelector("input");!e||!t||e.hasAttribute("aria-label")||e.labels&&e.labels.length||e.setAttribute("aria-label",t);const s=this.getAttribute("value");null!==s&&e&&e.value!==s&&(e.value=s);const r=this.getAttribute("ticks");Array.from(this.querySelectorAll(".c-time-range__tick")).forEach(t=>t.remove()),r&&r.split(",").map(t=>t.trim()).filter(Boolean).forEach(t=>{const e=document.createElement("span");e.className="c-time-range__tick",e.textContent=t,this.appendChild(e)})}enhance(){this._wiredTimeRange||(this._wiredTimeRange=!0,this.addEventListener("input",t=>{const e=t.target;e&&e.matches&&e.matches("input")&&this.dispatchEvent(new CustomEvent("contour:time-range-change",{bubbles:!0,composed:!0,detail:{value:e.value}}))}),this.addEventListener("change",t=>{const e=t.target;e&&e.matches&&e.matches("input")&&this.dispatchEvent(new CustomEvent("contour:time-range-change",{bubbles:!0,composed:!0,detail:{value:e.value}}))}))}});c("contour-skip-link",class extends T{static get observed(){return["href","label"]}static get properties(){return{href:{attribute:"href"},label:{attribute:"label"}}}render(){Array.from(this.childNodes).forEach(t=>{t.nodeType===Node.TEXT_NODE&&t.remove()});const t=this.ensure("a",()=>{const t=document.createElement("a");return t.className="c-skip-link",t});t.setAttribute("href",v(this.getAttribute("href")||"#main")),t.textContent=this.getAttribute("label")||"Skip to content"}});c("contour-icon",class extends T{static get observed(){return["name","size","label"]}static get properties(){return{name:{attribute:"name"},size:{attribute:"size"},label:{attribute:"label"}}}render(){const t=this.getAttribute("name")||"",e=t.startsWith("i-")?t.slice(2):t,s=this.getAttribute("size"),r=this.getAttribute("label");this.innerHTML="";const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("class","c-icon"),i.setAttribute("aria-hidden","true"),s&&(i.style.width=s,i.style.height=s);const a=document.createElementNS("http://www.w3.org/2000/svg","use");a.setAttribute("href","#i-"+e),i.appendChild(a),this.appendChild(i),r?(this.setAttribute("role","img"),this.setAttribute("aria-label",r)):(this.removeAttribute("role"),this.removeAttribute("aria-label"))}});c("contour-dashboard-grid",class extends T{static get observed(){return["cols","gap"]}static get properties(){return{cols:{attribute:"cols"},gap:{attribute:"gap"}}}render(){this.classList.add("c-dashboard-grid");const t=this.getAttribute("cols");t&&this.style.setProperty("--dashboard-grid-cols",t);const e=this.getAttribute("gap");e&&this.style.setProperty("--dashboard-grid-gap",e)}});c("contour-analysis-stack",class extends T{static get observed(){return["title","heading"]}static get properties(){return{title:{attribute:"title"},heading:{attribute:"heading"}}}render(){this.classList.add("c-analysis-stack");const t=this.getAttribute("title");let e=this.querySelector(".c-analysis-stack__header");if(t){e||(e=document.createElement("div"),e.className="c-analysis-stack__header",this.prepend(e));let s=e.querySelector(".c-analysis-stack__title");s||(s=document.createElement(E(this,"h3")),s.className="c-analysis-stack__title",e.appendChild(s)),s.textContent=t}else e&&e.remove()}});const pe=new Set(["point","line","polygon","raster","heatmap","symbol"]);function ge(t,e,s){if(t._wiredMapItems)return;t._wiredMapItems=!0;const r=()=>Array.from(t.querySelectorAll(e)),i=r=>{const i=t.querySelector(s);if(!i)return;const a=r&&r.target&&"function"==typeof r.target.closest?r.target.closest(e):null;if(!a||!t.contains(a))return void i.setAttribute("hidden","");const n=a.getAttribute("data-title")||a.getAttribute("title");n&&(i.textContent=n);const o=t.getBoundingClientRect(),c=a.getBoundingClientRect();i.style.setProperty("--chart-tip-inline-start",c.left-o.left+c.width/2+"px"),i.style.setProperty("--chart-tip-block-start",c.top-o.top+"px"),i.removeAttribute("hidden")},a=()=>{const e=t.querySelector(s);e&&e.setAttribute("hidden","")};t.addEventListener("mouseover",i),t.addEventListener("mouseout",e=>{e.relatedTarget&&t.contains(e.relatedTarget)||a()}),t.addEventListener("focusin",s=>{const r=s&&s.target&&"function"==typeof s.target.closest?s.target.closest(e):null;r&&t.contains(r)&&i({target:r})}),t.addEventListener("focusout",e=>{t.contains(e.relatedTarget)||a()}),t.addEventListener("click",s=>{const i=s&&s.target&&"function"==typeof s.target.closest?s.target.closest(e):null;if(!i||!t.contains(i))return;const a=r().indexOf(i);a<0||t.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:a,label:i.getAttribute("data-title")||i.getAttribute("title")||i.textContent.trim()}}))}),t.addEventListener("keydown",s=>{const i=s&&s.target&&"function"==typeof s.target.closest?s.target.closest(e):null;if(i&&t.contains(i))if("Enter"===s.key||" "===s.key){s.preventDefault();const e=r().indexOf(i);e>=0&&t.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:e,label:i.getAttribute("data-title")||i.getAttribute("title")||i.textContent.trim()}}))}else{const e=r();z(s,e,{wrap:!1,homeEnd:!0,rtl:I(t),onNavigate:t=>e.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1"))})}})}c("contour-minimap",class extends T{static get observed(){return["label","viewport","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},viewport:{attribute:"viewport"},src:{attribute:"src"}}}render(){if(this.classList.add("c-minimap"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Minimap"),Zt(this),$t(this,["label","viewport"]),Xt(this,"minimap"))return;const t=Jt(this,"label")||this._remoteData&&this._remoteData.label,e=Jt(this,"viewport")||this._remoteData&&(this._remoteData.viewport||this._remoteData.value);if(t||e){if(t){this.ensure(".c-minimap__label",()=>{const t=document.createElement("span");return t.className="c-minimap__label",t}).textContent=t}else{const t=this.querySelector(".c-minimap__label");t&&t.remove()}if(e){this.ensure(".c-minimap__viewport",()=>{const t=document.createElement("div");return t.className="c-minimap__viewport",t}).textContent=e}else{const t=this.querySelector(".c-minimap__viewport");t&&t.remove()}}else Yt(this,"minimap")}enhance(){if(this._wiredMinimap)return;this._wiredMinimap=!0,this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");let t=!1,e=0,s=0;this.addEventListener("pointerdown",r=>{const i=this.querySelector(".c-minimap__viewport");if(i&&i.contains(r.target)){t=!0,e=r.clientX,s=r.clientY;try{i.setPointerCapture(r.pointerId)}catch(t){}}}),this.addEventListener("pointermove",r=>{if(!t)return;const i=r.clientX-e,a=r.clientY-s;this.dispatchEvent(new CustomEvent("contour:move",{detail:{direction:"drag",dx:i,dy:a},bubbles:!0,composed:!0}))}),this.addEventListener("pointerup",()=>{t=!1}),this.addEventListener("keydown",t=>{let e=null;"ArrowUp"===t.key?e="up":"ArrowDown"===t.key?e="down":"ArrowLeft"===t.key?e="left":"ArrowRight"===t.key?e="right":"Home"===t.key?e="home":"End"===t.key&&(e="end"),e&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:move",{detail:{direction:e},bubbles:!0,composed:!0})))})}});c("contour-coordinate",class extends T{static get observed(){return["value","format","locale","precision","live","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{value:{attribute:"value"},format:{attribute:"format"},locale:{attribute:"locale"},precision:{attribute:"precision"},live:{attribute:"live"},src:{attribute:"src"}}}render(){if(this.classList.add("c-coordinate"),Zt(this),$t(this,"value"),Xt(this,"coordinate"))return;const t=Jt(this,"value")||this._remoteData&&(this._remoteData.value||this._remoteData.coordinate);if(!t)return void Yt(this,"coordinate");const e=this.getAttribute("format")||"decimal";let s=String(t);if("dms"===e){const e=String(t).split(/[,\s]+/).map(Number);if(e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])){const t=parseInt(this.getAttribute("precision")||"1",10),r=Number.isFinite(t)&&t>=0?t:1,i=(t,e)=>{const s=Math.floor(Math.abs(t)),i=Math.floor(60*(Math.abs(t)-s)),a="lat"===e?t<0?"S":"N":t<0?"W":"E";return s+"°"+i+"'"+(60*(60*(Math.abs(t)-s)-i)).toFixed(r)+'"'+a};s=i(e[0],"lat")+" "+i(e[1],"lon")}}else if("web-mercator"===e){const e=String(t).split(/[,\s]+/).map(Number);if(e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])){const t=20037508.34*e[1]/180,r=Math.log(Math.tan((90+e[0])*Math.PI/360))/(Math.PI/180)*20037508.34/180;s=t.toFixed(2)+", "+r.toFixed(2)}}else if("decimal"===e){const e=String(t).split(/[,\s]+/).map(Number),r=parseInt(this.getAttribute("precision")||"",10);s=e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])&&Number.isFinite(r)&&r>=0?e[0].toFixed(r)+", "+e[1].toFixed(r):B(t,this.getAttribute("format"),this.getAttribute("locale"))}else s=B(t,this.getAttribute("format"),this.getAttribute("locale"));const r=this.ensure(".c-coordinate__value",()=>{const t=document.createElement("span");return t.className="c-coordinate__value",t});this.hasAttribute("live")?(r.setAttribute("role","status"),r.setAttribute("aria-live","polite")):(r.removeAttribute("role"),r.removeAttribute("aria-live")),r.textContent=s;let i=this.querySelector(".c-coordinate__copy");function a(t){try{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}catch(t){}}i||(i=document.createElement("button"),i.type="button",i.className="c-btn c-btn--sm c-btn--icon c-coordinate__copy",L(i,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-copy" /></svg>'),i.setAttribute("aria-label",k(this,"copy-coordinate","Copy coordinate")),i.setAttribute("data-contour-label","true"),this.appendChild(i)),i.onclick=()=>{try{navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(s).catch(()=>{a(s)}):a(s)}catch(t){a(s)}this.dispatchEvent(new CustomEvent("contour:copy",{detail:{text:s},bubbles:!0,composed:!0}))}}});c("contour-layer-panel",class extends T{static get observed(){return["label","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","allow-rename","allow-remove","allow-duplicate","allow-zoom","allow-opacity","allow-reorder","allow-projection","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-layer-panel"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"layer-panel","Layer panel")),this._layerIdSeen=new Set,Zt(this),$t(this,"items"),Xt(this,"layer-panel"))return;const t=Jt(this,"items"),e=this.getAttribute("label");if(e){this.ensure(".c-layer-panel__label",()=>{const t=document.createElement("span");return t.className="c-layer-panel__label",t}).textContent=e}else{const t=this.querySelector(".c-layer-panel__label");t&&t.remove()}const s=Array.from(this.querySelectorAll(":scope > .c-layer-panel__item")),r=new Map,i=new Map;this.querySelectorAll(".c-layer-panel__item").forEach(t=>{const e=t.querySelector(".c-layer-panel__name"),s=t.querySelector(".c-layer-panel__toggle");if(e&&s){const t=s.hasAttribute("aria-pressed")?"true"===s.getAttribute("aria-pressed"):!!s.checked;r.set(e.textContent,t)}const a=t.querySelector(".c-layer-panel__opacity");e&&a&&i.set(e.textContent,a.value)});let a=null;if(s.length)a=s.map(t=>{const e=t.querySelector(".c-layer-panel__name"),s=t.querySelector(".c-layer-panel__toggle"),r=!s||(s.hasAttribute("aria-pressed")?"true"===s.getAttribute("aria-pressed"):!!s.checked),i=t.querySelector(".c-layer-panel__caption");return{name:e?e.textContent:"",visible:r,caption:i?i.textContent:t.dataset.caption||void 0}}),s.forEach(t=>t.remove());else if(t)try{a=JSON.parse(t),Array.from(this.querySelectorAll(".c-layer-panel__item")).forEach(t=>t.remove())}catch(t){f(this,"attribute",t)}a&&a.forEach(t=>{const e="string"==typeof t?t:t.name||t.label||"",s="object"==typeof t&&t&&(t.caption||t.subtitle)||"";null==this._layerIdByName&&(this._layerIdByName=new Map);const a="object"==typeof t&&t&&t.id?String(t.id):"";let n;if(a)n=a;else if(this._layerIdByName.has(e))n=this._layerIdByName.get(e);else{n=(e?e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""):"")||"layer",this._layerIdByName.set(e,n)}if(null==this._layerIdSeen&&(this._layerIdSeen=new Set),this._layerIdSeen.has(n)){let t=2;for(;this._layerIdSeen.has(n+"-"+t);)t++;n=n+"-"+t}this._layerIdSeen.add(n);const o=document.createElement("div");if(o.className="c-layer-panel__item"+(t.dragging?" c-layer-panel__item--dragging":""),o.dataset.layerId=n,"false"!==this.getAttribute("allow-reorder")){const t=document.createElement("button");t.type="button",t.className="c-drag-handle--dots",t.setAttribute("aria-label",k(this,"reorder","Reorder")+" "+(e||k(this,"layer","layer"))),t.setAttribute("tabindex","0"),o.appendChild(t)}const c=document.createElement("button");c.type="button",c.className="c-layer-panel__toggle",c.setAttribute("part","visibility-toggle"),c.setAttribute("aria-label",k(this,"toggle","Toggle")+" "+(e||k(this,"layer","layer")));const l=r.has(e)?r.get(e):"object"==typeof t&&!1!==t.visible;c.setAttribute("aria-pressed",String(!!l)),c.checked=!!l,L(c,l?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-check" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-minus" /></svg>'),o.appendChild(c);const u=document.createElement("span");if(u.className="c-layer-panel__name",u.textContent=e,o.appendChild(u),s){const t=document.createElement("span");t.className="c-layer-panel__caption",t.textContent=s,o.appendChild(t)}if("false"!==this.getAttribute("allow-opacity")){const s=document.createElement("input");s.type="range",s.className="c-layer-panel__opacity",s.min="0",s.max="100",s.setAttribute("aria-label",k(this,"opacity-of","Opacity of")+" "+(e||"layer")),s.value=i.has(e)?i.get(e):"object"==typeof t&&null!=t.opacity?t.opacity:"100",o.appendChild(s)}if("false"!==this.getAttribute("allow-rename")){const t=document.createElement("button");t.type="button",t.className="c-btn c-btn--icon c-btn--ghost c-btn--sm c-layer-panel__rename",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-pen" /></svg>'),t.setAttribute("aria-label",k(this,"rename","Rename")+" "+(e||"layer")),o.appendChild(t)}if("false"!==this.getAttribute("allow-duplicate")){const t=document.createElement("button");t.type="button",t.className="c-btn c-btn--icon c-btn--ghost c-btn--sm c-layer-panel__duplicate",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-copy" /></svg>'),t.setAttribute("aria-label",k(this,"duplicate","Duplicate")+" "+(e||"layer")),o.appendChild(t)}if("false"!==this.getAttribute("allow-zoom")){const t=document.createElement("button");t.type="button",t.className="c-layer-panel__zoom",t.textContent=k(this,"zoom","Zoom"),t.setAttribute("aria-label",k(this,"zoom-to","Zoom to")+" "+(e||"layer")),o.appendChild(t)}if("false"!==this.getAttribute("allow-remove")){const t=document.createElement("button");t.type="button",t.className="c-layer-panel__remove",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-minus" /></svg>'),t.setAttribute("aria-label",k(this,"remove","Remove")+" "+(e||"layer")),o.appendChild(t)}if(this.hasAttribute("allow-projection")&&"false"!==this.getAttribute("allow-projection")){const t=document.createElement("select");t.className="c-select c-layer-panel__projection",t.setAttribute("aria-label",k(this,"projection-of","Projection of")+" "+(e||k(this,"layer","layer"))),["EPSG:4326","EPSG:3857"].forEach(e=>{const s=document.createElement("option");s.value=e,s.textContent=e,t.appendChild(s)}),o.appendChild(t)}this.appendChild(o)}),a||s.length||t||(Array.from(this.querySelectorAll(".c-layer-panel__item")).forEach(t=>t.remove()),Yt(this,"layer-panel"))}enhance(){if(this._wiredLayerPanel)return;this._wiredLayerPanel=!0;const t=t=>t&&t.dataset&&t.dataset.layerId||"";this.addEventListener("change",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-layer-panel__item"):null;if(!s||!this.contains(s))return;const r=s.querySelector(".c-layer-panel__name")?.textContent||"",i=t(s);if(e.target.classList.contains("c-layer-panel__toggle")){const t="boolean"==typeof e.target.checked?e.target.checked:"true"!==e.target.getAttribute("aria-pressed");e.target.checked=t,e.target.setAttribute("aria-pressed",String(t)),L(e.target,t?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-check" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-minus" /></svg>'),this.dispatchEvent(new CustomEvent("contour:layer-visibility",{bubbles:!0,composed:!0,detail:{layerId:i,name:r,visible:t}}))}else e.target.classList.contains("c-layer-panel__opacity")?this.dispatchEvent(new CustomEvent("contour:layer-opacity",{bubbles:!0,composed:!0,detail:{layerId:i,name:r,opacity:Number(e.target.value)}})):e.target.classList.contains("c-layer-panel__projection")&&this.dispatchEvent(new CustomEvent("contour:layer-projection",{bubbles:!0,composed:!0,detail:{layerId:i,name:r,projection:e.target.value}}))}),this.addEventListener("input",e=>{const s=e.target;if(!s||!s.classList||!s.classList.contains("c-layer-panel__opacity"))return;const r=s.closest(".c-layer-panel__item");if(!r||!this.contains(r))return;const i=r.querySelector(".c-layer-panel__name")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:layer-opacity",{bubbles:!0,composed:!0,detail:{layerId:t(r),name:i,opacity:Number(s.value)}}))}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest("button"):null;if(!s||!this.contains(s))return;const r=s.closest(".c-layer-panel__item");if(s.classList.contains("c-layer-panel__toggle")){if(!r)return;const e=r.querySelector(".c-layer-panel__name")?.textContent||"",i=t(r),a="true"!==s.getAttribute("aria-pressed");return s.setAttribute("aria-pressed",String(a)),s.checked=a,L(s,a?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-check" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-minus" /></svg>'),void this.dispatchEvent(new CustomEvent("contour:layer-visibility",{bubbles:!0,composed:!0,detail:{layerId:i,name:e,visible:a}}))}if(!r)return;const i=r.querySelector(".c-layer-panel__name")?.textContent||"",a=t(r);if(s.classList.contains("c-layer-panel__rename")){const t=r.querySelector(".c-layer-panel__name");if(t){const e=document.createElement("input");e.type="text",e.className="c-input c-layer-panel__rename-input",e.value=i,e.setAttribute("aria-label",k(this,"rename-layer","Rename layer")),t.replaceWith(e),e.focus(),e.select();let s=!1;const r=()=>{if(s)return;if(!e.isConnected)return;s=!0;const t=(e.value||"").trim(),r=document.createElement("span");r.className="c-layer-panel__name",r.textContent=t||i,e.replaceWith(r),t&&t!==i&&(null==this._layerIdByName&&(this._layerIdByName=new Map),this._layerIdByName.set(t,a),this.dispatchEvent(new CustomEvent("contour:layer-rename",{bubbles:!0,composed:!0,detail:{layerId:a,name:i,newName:t}})))};e.addEventListener("keydown",t=>{"Enter"===t.key?(t.preventDefault(),r()):"Escape"===t.key&&(t.preventDefault(),e.value=i,r())}),e.addEventListener("blur",r,{once:!0})}}else s.classList.contains("c-layer-panel__duplicate")?this.dispatchEvent(new CustomEvent("contour:layer-duplicate",{bubbles:!0,composed:!0,detail:{layerId:a,name:i}})):s.classList.contains("c-layer-panel__zoom")?this.dispatchEvent(new CustomEvent("contour:layer-zoom",{bubbles:!0,composed:!0,detail:{layerId:a,name:i}})):s.classList.contains("c-layer-panel__remove")&&this.dispatchEvent(new CustomEvent("contour:layer-remove",{bubbles:!0,composed:!0,detail:{layerId:a,name:i}}))}),this.addEventListener("keydown",t=>{if(t.target&&t.target.classList&&t.target.classList.contains("c-layer-panel__toggle")&&("Enter"===t.key||" "===t.key))return t.preventDefault(),void t.target.click();const e=t.target&&t.target.closest?t.target.closest(".c-layer-panel__item"):null;if(!e||!this.contains(e))return;const s=t.target&&t.target.classList&&t.target.classList.contains("c-drag-handle--dots");if(s&&("ArrowUp"===t.key||"ArrowDown"===t.key)||t.altKey&&("ArrowUp"===t.key||"ArrowDown"===t.key)){t.preventDefault();const r=Array.from(this.querySelectorAll(".c-layer-panel__item")),i=r.indexOf(e);if(i<0)return;const a="ArrowUp"===t.key?-1:1,n=i+a;if(n<0||n>=r.length)return;e.classList.add("c-layer-panel__item--dragging"),a<0?this.insertBefore(e,r[n]):this.insertBefore(r[n],e),(s?t.target:e).focus(),setTimeout(()=>e.classList.remove("c-layer-panel__item--dragging"),200);const o=Array.from(this.querySelectorAll(".c-layer-panel__item")).map((t,e)=>t.dataset.layerId||t.getAttribute("data-layer-id")||String(e));this.dispatchEvent(new CustomEvent("contour:layer-reorder",{bubbles:!0,composed:!0,detail:{layerIds:o}}))}})}});c("contour-time-slider",class extends T{static get observed(){return["label","value","min","max","loop","speed","speeds","show-loop","loop-label","current-time","time-format","is-playing","play-label","pause-label","time-label","speed-label"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},min:{attribute:"min"},max:{attribute:"max"},distance:{attribute:"distance"},resolution:{attribute:"resolution"},latitude:{attribute:"latitude"},src:{attribute:"src"},loop:{attribute:"loop",type:Boolean},speed:{attribute:"speed"},speeds:{attribute:"speeds"},showLoop:{attribute:"show-loop",type:Boolean},loopLabel:{attribute:"loop-label"},currentTime:{attribute:"current-time"},timeFormat:{attribute:"time-format"},isPlaying:{attribute:"is-playing",type:Boolean},playLabel:{attribute:"play-label"},pauseLabel:{attribute:"pause-label"},timeLabel:{attribute:"time-label"},speedLabel:{attribute:"speed-label"}}}render(){this.classList.add("c-time-slider"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Time slider");const t=this.ensure(".c-time-slider__play",()=>{const t=document.createElement("button");t.className="c-time-slider__play",t.type="button",t.setAttribute("aria-label",this.getAttribute("play-label")||"Play"),t.setAttribute("data-state","play");const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true");const s=document.createElementNS("http://www.w3.org/2000/svg","use");return s.setAttribute("href","#i-play"),e.appendChild(s),t.appendChild(e),t}),e=this.ensure(".c-time-slider__track",()=>{const t=document.createElement("input");return t.className="c-time-slider__track",t.type="range",t.min="0",t.max="100",t.setAttribute("part","input"),t.setAttribute("aria-label",this.getAttribute("time-label")||"Time"),t});e.min=this.getAttribute("min")||"0",e.max=this.getAttribute("max")||"100";const s=this.getAttribute("value")||"0";this._timeSliderAttrLast!==s&&(e.value=s,this._timeSliderAttrLast=s),e.setAttribute("aria-label",this.getAttribute("label")||this.getAttribute("time-label")||"Time");const r=this.ensure(".c-time-slider__time",()=>{const t=document.createElement("span");return t.className="c-time-slider__time",t}),i=this.getAttribute("current-time"),a=this.getAttribute("time-format");i?(r.textContent=i,e.setAttribute("aria-valuetext",i)):a?(r.textContent=B(String(e.value),a),e.removeAttribute("aria-valuetext")):(r.textContent=String(e.value),e.removeAttribute("aria-valuetext"));const n=this.ensure("datalist",()=>document.createElement("datalist"));n.id||(n.id=o("time-slider-ticks")),L(n,"");const c=Number(e.min)||0,l=Number(e.max)||100;for(let t=0;t<5;t++){const e=document.createElement("option");e.value=String(Math.round(c+t/4*(l-c))),n.appendChild(e)}e.setAttribute("list",n.id),n.parentNode!==this&&this.appendChild(n);let u=null;const d=this.getAttribute("speeds");if(d)try{u=JSON.parse(d)}catch(t){u=null}const h=this.ensure(".c-time-slider__speed",()=>{const t=document.createElement("select");return t.className="c-select c-time-slider__speed",t.setAttribute("aria-label",this.getAttribute("speed-label")||"Speed"),t});L(h,"");(Array.isArray(u)?u:[.5,1,2,5,10]).forEach(t=>{const e=document.createElement("option");e.value=String(t),e.textContent=String(t),String(t)===(this.getAttribute("speed")||"")&&(e.selected=!0),h.appendChild(e)});const m=this.getAttribute("speed");m&&(h.value=m);if(this.hasAttribute("show-loop")){const t=this.ensure(".c-time-slider__loop",()=>{const t=document.createElement("button");return t.className="c-time-slider__loop",t.type="button",t.setAttribute("aria-label",this.getAttribute("loop-label")||"Loop"),t});t.setAttribute("aria-pressed",this.hasAttribute("loop")?"true":"false"),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-refresh" /></svg>')}else{const t=this.querySelector(".c-time-slider__loop");t&&t.remove()}const b=this.hasAttribute("is-playing");t.setAttribute("data-state",b?"pause":"play"),t.setAttribute("aria-label",b?this.getAttribute("pause-label")||"Pause":this.getAttribute("play-label")||"Play");const p=t.querySelector("use");p&&p.setAttribute("href",b?"#i-pause":"#i-play")}enhance(){if(this._timeSliderReconcile&&this._timeSliderReconcile(),this._wiredTimeSlider)return;let t;this._wiredTimeSlider=!0;const e=()=>{void 0!==t&&(clearInterval(t),t=void 0)},s=()=>{const t=this.querySelector(".c-time-slider__track");if(!t)return;const e=this.querySelector(".c-time-slider__time"),s=this.getAttribute("current-time"),r=this.getAttribute("time-format");e&&(e.textContent=s||(r?B(String(t.value),r):String(t.value))),s?t.setAttribute("aria-valuetext",s):t.removeAttribute("aria-valuetext")},r=()=>{const t=this.querySelector(".c-time-slider__track");if(!t)return void e();const r=Number(t.max)||100,i=Number(t.min)||0,a=this.hasAttribute("loop");let n=(Number(t.value)||0)+1;n>r&&(n=a?i:r),t.value=String(n);const o=this.querySelector(".c-time-slider__speed");this._timeSliderScrubbing||o&&document.activeElement===o||this.setAttribute("value",String(n)),s(),this.dispatchEvent(new CustomEvent("contour:time-change",{detail:{value:String(n)},bubbles:!0,composed:!0})),!a&&n>=r&&(e(),this.removeAttribute("is-playing"),this.dispatchEvent(new CustomEvent("contour:pause",{bubbles:!0,composed:!0})))},a=()=>{e();const s=parseFloat(this.getAttribute("speed")||"1")||1;t=setInterval(r,Math.max(100,1e3/s))};this._timeSliderReconcile=()=>{const s=this.hasAttribute("is-playing");s&&void 0===t?(a(),this.dispatchEvent(new CustomEvent("contour:play",{bubbles:!0,composed:!0}))):s||void 0===t||(e(),this.dispatchEvent(new CustomEvent("contour:pause",{bubbles:!0,composed:!0})))},this.addEventListener("click",t=>{if(t.target&&t.target.closest?t.target.closest(".c-time-slider__play"):null)return void this.toggleAttribute("is-playing",!this.hasAttribute("is-playing"));const e=t.target&&t.target.closest?t.target.closest(".c-time-slider__loop"):null;if(e){const t="true"!==e.getAttribute("aria-pressed");e.setAttribute("aria-pressed",String(t)),this.toggleAttribute("loop",t),this.dispatchEvent(new CustomEvent("contour:loop-change",{detail:{loop:t},bubbles:!0,composed:!0}))}}),this.addEventListener("pointerdown",t=>{t.target&&t.target.closest&&t.target.closest(".c-time-slider__track")&&(this._timeSliderScrubbing=!0)},{passive:!0});const n=()=>{this._timeSliderScrubbing=!1};this.addEventListener("pointerup",n,{passive:!0}),this.addEventListener("pointercancel",n,{passive:!0}),this.addEventListener("input",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-time-slider__track"):null;e&&(this._timeSliderScrubbing||this.setAttribute("value",e.value),s(),this.dispatchEvent(new CustomEvent("contour:time-change",{detail:{value:e.value},bubbles:!0,composed:!0})))}),this.addEventListener("change",e=>{const r=e.target&&e.target.closest?e.target.closest(".c-time-slider__speed"):null;if(r){const e=Number(r.value);return this.setAttribute("speed",String(e)),void 0!==t&&a(),void this.dispatchEvent(new CustomEvent("contour:speed-change",{detail:{speed:e},bubbles:!0,composed:!0}))}const i=e.target&&e.target.closest?e.target.closest(".c-time-slider__track"):null;i&&(this.setAttribute("value",i.value),s())}),i(this,e),this._timeSliderReconcile()}disconnectedCallback(){super.disconnectedCallback(),this._wiredTimeSlider=!1,this._timeSliderReconcile=null}});c("contour-hexbin",class extends T{static get observed(){return["label","cells","width","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},cells:{attribute:"cells"},width:{attribute:"width"},src:{attribute:"src"}}}render(){this.classList.add("c-hexbin"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Hexbin");const t=this.getAttribute("label")||this._remoteData&&this._remoteData.label;if(t){this.ensure(".c-hexbin__label",()=>{const t=document.createElement("span");return t.className="c-hexbin__label",t}).textContent=t}else{const t=this.querySelector(".c-hexbin__label");t&&t.remove()}if(Zt(this),$t(this,"cells"),Xt(this,"hexbin"))return;const e=Jt(this,"cells")||(this._remoteData&&this._remoteData.cells?JSON.stringify(this._remoteData.cells):null),s=Array.from(this.querySelectorAll(":scope > .c-hexbin__cell"));this.ensure(".c-hexbin__tooltip",()=>{const t=document.createElement("div");return t.className="c-hexbin__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t}).setAttribute("hidden","");const r=this.getAttribute("width");if(r?this.style.inlineSize=r:this.style.removeProperty("inline-size"),s.length){const t=Math.ceil(Math.sqrt(s.length||1));this.style.gridTemplateColumns="repeat("+t+", minmax(0, 1fr))",s.forEach((t,e)=>t.setAttribute("tabindex",0===e?"0":"-1"))}else{let t=null;if(e)try{t=JSON.parse(e)}catch(e){t=null}if(Array.isArray(t))try{Array.from(this.querySelectorAll(".c-hexbin__cell")).forEach(t=>t.remove());const e=Math.ceil(Math.sqrt(t.length||1));this.style.gridTemplateColumns="repeat("+e+", minmax(0, 1fr))";const s=t.map(t=>Number("object"==typeof t&&null!==t?t.value:t)).filter(t=>Number.isFinite(t)),r=s.length?Math.min(...s):0,i=s.length?Math.max(...s):0,a=i-r;if(t.forEach((t,e)=>{const s=document.createElement("div");s.className="c-hexbin__cell",s.setAttribute("tabindex",0===e?"0":"-1");const i="object"==typeof t&&null!==t&&null!=t.value?t.value:t;null!=i&&""!==i&&(s.textContent=i,s.setAttribute("data-title",String(i)));const n=Number(i);if(Number.isFinite(n)){const t=a>0?(n-r)/a:1,e=Math.round(20+60*t);s.style.background="color-mix(in oklab, var(--color-primary) "+e+"%, var(--color-surface-2))"}this.appendChild(s)}),a>0&&s.length){const t=this.ensure(".c-hexbin__legend",()=>{const t=document.createElement("div");return t.className="c-hexbin__legend",t});t.textContent="";const e=document.createElement("div");e.className="c-hexbin__legend-swatch",e.style.background="color-mix(in oklab, var(--color-primary) 20%, var(--color-surface-2))",e.setAttribute("title",String(r));const s=document.createElement("div");s.className="c-hexbin__legend-swatch",s.style.background="color-mix(in oklab, var(--color-primary) 80%, var(--color-surface-2))",s.setAttribute("title",String(i));const a=document.createElement("span");a.className="c-hexbin__legend-label",a.textContent=String(r);const n=document.createElement("span");n.className="c-hexbin__legend-label",n.textContent=String(i),t.appendChild(e),t.appendChild(a),t.appendChild(s),t.appendChild(n)}}catch(t){f(this,"attribute",t)}else Array.from(this.querySelectorAll(".c-hexbin__cell")).forEach(t=>t.remove()),Yt(this,"hexbin")}}enhance(){this._wiredHexbin||(this._wiredHexbin=!0,ge(this,".c-hexbin__cell",".c-hexbin__tooltip"))}});c("contour-flow-map",class extends T{static get observed(){return["label","nodes","flows","edges","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},nodes:{attribute:"nodes"},flows:{attribute:"flows"},edges:{attribute:"edges"},src:{attribute:"src"}}}render(){this.classList.add("c-flow-map"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Flow map");const t=this.getAttribute("label")||this._remoteData&&this._remoteData.label;if(t){this.ensure(".c-flow-map__label",()=>{const t=document.createElement("span");return t.className="c-flow-map__label",t}).textContent=t}else{const t=this.querySelector(".c-flow-map__label");t&&t.remove()}if(Zt(this),$t(this,"nodes"),Xt(this,"flow-map"))return;const e=Jt(this,"nodes")||(this._remoteData&&this._remoteData.nodes?JSON.stringify(this._remoteData.nodes):null),s=Array.from(this.querySelectorAll(":scope > .c-flow-map__node"));let r=null;if(s.length)r=s.map(t=>t.textContent||t.getAttribute("data-title")||t.getAttribute("title")||""),s.forEach(t=>t.remove());else if(e)try{r=JSON.parse(e)}catch(t){r=null}if(r)try{Array.from(this.querySelectorAll(".c-flow-map__node")).forEach(t=>t.remove()),r.forEach((t,e)=>{const s=document.createElement("span");s.className="c-flow-map__node"+(t.source?" c-flow-map__node--source":"")+(t.target?" c-flow-map__node--target":""),s.setAttribute("tabindex",0===e?"0":"-1"),s.textContent="string"==typeof t?t:t.label||t.name||"","object"==typeof t&&(t.label||t.name)&&s.setAttribute("data-title",t.label||t.name),this.appendChild(s)});this.ensure(".c-flow-map__tooltip",()=>{const t=document.createElement("div");return t.className="c-flow-map__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t}).setAttribute("hidden","")}catch(t){f(this,"attribute",t)}else r||(Array.from(this.querySelectorAll(".c-flow-map__node")).forEach(t=>t.remove()),Yt(this,"flow-map"));const i=null!=this.flows&&""!==this.flows?this.flows:null!=this.edges&&""!==this.edges?this.edges:this._remoteData&&null!=this._remoteData.flows?JSON.stringify(this._remoteData.flows):null;let a=null;if(null!=i)try{const t=JSON.parse(i);Array.isArray(t)?a=t:f(this,"flows",new Error("expected an array"))}catch(t){f(this,"flows",t)}const n=this.querySelector(".c-flow-map__summary");if(a){const t=this.ensure(".c-flow-map__summary",()=>{const t=document.createElement("div");return t.className="c-flow-map__summary c-table-wrap",t});let e=t.querySelector("table");e||(e=document.createElement("table"),e.className="c-table c-flow-map__table",t.appendChild(e)),L(e,"");const s=document.createElement("caption");s.textContent=k(this,"flow-summary","Flow summary"),e.appendChild(s);const r=document.createElement("thead"),i=document.createElement("tr");[["source","Source"],["target","Target"],["magnitude","Magnitude"]].forEach(([t,e])=>{const s=document.createElement("th");s.setAttribute("scope","col"),s.textContent=k(this,t,e),i.appendChild(s)}),r.appendChild(i),e.appendChild(r);const n=document.createElement("tbody"),o=t=>"string"==typeof t?t:t&&"object"==typeof t?String(t.label||t.name||t.id||""):"";a.forEach(t=>{const e=t&&"object"==typeof t?t:{},s=document.createElement("tr"),r=document.createElement("th");r.setAttribute("scope","row"),r.textContent=o(e.source),s.appendChild(r);const i=document.createElement("td");i.textContent=o(e.target),s.appendChild(i);const a=document.createElement("td"),c=null!=e.value?e.value:e.magnitude,l=Number(c);a.textContent=null==c||""===c?"":Number.isFinite(l)?(l>0?"+":"")+l:String(c),s.appendChild(a),n.appendChild(s)}),e.appendChild(n)}else n&&n.remove()}enhance(){this._wiredFlowMap||(this._wiredFlowMap=!0,ge(this,".c-flow-map__node",".c-flow-map__tooltip"))}});c("contour-isochrone",class extends T{static get observed(){return["label","center","rings","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},center:{attribute:"center"},rings:{attribute:"rings"},src:{attribute:"src"}}}render(){this.classList.add("c-isochrone"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Isochrone");const t=this.getAttribute("label")||this._remoteData&&this._remoteData.label;if(t){this.ensure(".c-isochrone__label",()=>{const t=document.createElement("span");return t.className="c-isochrone__label",t}).textContent=t}else{const t=this.querySelector(".c-isochrone__label");t&&t.remove()}const e=this.getAttribute("center")||this._remoteData&&this._remoteData.center;if(e){this.ensure(".c-isochrone__center",()=>{const t=document.createElement("span");return t.className="c-isochrone__center",t}).textContent=e}else{const t=this.querySelector(".c-isochrone__center");t&&t.remove()}if(Zt(this),$t(this,"rings"),Xt(this,"isochrone"))return;const s=Jt(this,"rings")||(this._remoteData&&this._remoteData.rings?JSON.stringify(this._remoteData.rings):null),r=Array.from(this.querySelectorAll(":scope > .c-isochrone__ring"));let i=null;if(r.length)i=r.map(t=>t.textContent||t.getAttribute("data-title")||t.getAttribute("title")||""),r.forEach(t=>t.remove());else if(s)try{i=JSON.parse(s)}catch(t){i=null}if(i)try{Array.from(this.querySelectorAll(".c-isochrone__ring")).forEach(t=>t.remove()),i.forEach((t,e)=>{const s=document.createElement("span"),r="string"==typeof t?t:t&&(t.label||t.name||t.value||t.min),i=null==r?"":String(r),a=i.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");s.className="c-isochrone__ring"+(a?" c-isochrone__ring--"+a:""),s.setAttribute("tabindex",0===e?"0":"-1"),s.setAttribute("aria-label",i||"Isochrone ring "+(e+1)),i&&s.setAttribute("data-title",i),this.appendChild(s)});this.ensure(".c-isochrone__tooltip",()=>{const t=document.createElement("div");return t.className="c-isochrone__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t}).setAttribute("hidden","")}catch(t){f(this,"attribute",t)}else i||(Array.from(this.querySelectorAll(".c-isochrone__ring")).forEach(t=>t.remove()),Yt(this,"isochrone"))}enhance(){this._wiredIsochrone||(this._wiredIsochrone=!0,ge(this,".c-isochrone__ring",".c-isochrone__tooltip"))}});c("contour-catchment",class extends T{static get observed(){return["label","area","center","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},area:{attribute:"area"},center:{attribute:"center"},src:{attribute:"src"}}}render(){this.classList.add("c-catchment"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Catchment");const t=this.getAttribute("label")||this._remoteData&&this._remoteData.label;if(t){this.ensure(".c-catchment__label",()=>{const t=document.createElement("span");return t.className="c-catchment__label",t}).textContent=t}else{const t=this.querySelector(".c-catchment__label");t&&t.remove()}const e=this.getAttribute("area")||this._remoteData&&this._remoteData.area;if(e){this.ensure(".c-catchment__area",()=>{const t=document.createElement("span");return t.className="c-catchment__area",t}).textContent=e}else{const t=this.querySelector(".c-catchment__area");t&&t.remove()}const s=this.getAttribute("center")||this._remoteData&&this._remoteData.center;if(s){this.ensure(".c-catchment__center",()=>{const t=document.createElement("span");return t.className="c-catchment__center",t}).textContent=s}else{const t=this.querySelector(".c-catchment__center");t&&t.remove()}if(Zt(this),$t(this,["label","area","center"]),Xt(this,"catchment"))return;const r=Jt(this,"label")||this._remoteData&&this._remoteData.label,i=Jt(this,"area")||this._remoteData&&this._remoteData.area,a=Jt(this,"center")||this._remoteData&&this._remoteData.center;if(!r&&!i&&!a)return void Yt(this,"catchment");const n=this.ensure(".c-catchment__tooltip",()=>{const t=document.createElement("div");return t.className="c-catchment__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t});n.setAttribute("hidden",""),i&&(n.textContent=i)}enhance(){if(this._wiredCatchment)return;this._wiredCatchment=!0;const t=()=>{const t=this.querySelector(".c-catchment__tooltip");t&&t.removeAttribute("hidden")},e=()=>{const t=this.querySelector(".c-catchment__tooltip");t&&t.setAttribute("hidden","")};this.addEventListener("mouseenter",t),this.addEventListener("mouseleave",e),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("focusin",t),this.addEventListener("focusout",e),this.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{area:this.getAttribute("area")}})))})}});c("contour-compass",class extends T{static get observed(){return["label","needle","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","empty","no-cache"]}static get properties(){return{label:{attribute:"label"},needle:{attribute:"needle"},src:{attribute:"src"}}}render(){this.classList.add("c-compass"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Compass");const t=this.getAttribute("label")||this._remoteData&&this._remoteData.label;if(Zt(this),$t(this,"needle"),Xt(this,"compass"))return;const e=Jt(this,"needle")||this._remoteData&&(this._remoteData.needle||this._remoteData.value);if(e||t){for(const t of["n","s","e","w"]){const e=".c-compass__label--"+t;let s=this.querySelector(e);s||(s=document.createElement("span"),s.className="c-compass__label "+e.slice(1),s.textContent=t.toUpperCase(),s.setAttribute("role","button"),s.setAttribute("tabindex","0"),this.appendChild(s))}if(t&&"compass"!==t.toLowerCase()){this.ensure(".c-compass__label:not([class*='--'])",()=>{const t=document.createElement("span");return t.className="c-compass__label",t}).textContent=t}if(e){const t=Number(e)||0,s=this.ensure("svg.c-compass__needle",()=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("class","c-compass__needle"),e.setAttribute("viewBox","0 0 40 40"),e.setAttribute("aria-hidden","true");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("class","c-compass__needle--n"),s.setAttribute("d",U(20,20,16,t)),e.appendChild(s);const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("class","c-compass__needle--s"),r.setAttribute("d",U(20,20,16,t+180)),e.appendChild(r),e}),r=s.querySelector(".c-compass__needle--n");r&&r.setAttribute("d",U(20,20,16,t));const i=s.querySelector(".c-compass__needle--s");i&&i.setAttribute("d",U(20,20,16,t+180))}else{const t=this.querySelector("svg.c-compass__needle, .c-compass__needle");t&&t.remove()}}else Yt(this,"compass")}enhance(){if(this._wiredCompass)return;this._wiredCompass=!0;const t={n:0,e:90,s:180,w:270},e=e=>{const s=t[e];if(void 0===s)return;const r=this.querySelector(".c-compass__needle");if(r){const t=r.querySelector(".c-compass__needle--n");t&&t.setAttribute("d",U(20,20,16,s));const e=r.querySelector(".c-compass__needle--s");e&&e.setAttribute("d",U(20,20,16,s+180))}this.dispatchEvent(new CustomEvent("contour:bearing",{bubbles:!0,composed:!0,detail:{direction:e,degrees:s}}))};this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-compass__label--n, .c-compass__label--e, .c-compass__label--s, .c-compass__label--w"):null;if(!s||!this.contains(s))return;const r=s.className.match(/c-compass__label--([nsew])/);r&&e(r[1])}),this.addEventListener("keydown",t=>{if("Enter"!==t.key&&" "!==t.key)return;const s=t.target&&t.target.closest?t.target.closest(".c-compass__label--n, .c-compass__label--e, .c-compass__label--s, .c-compass__label--w"):null;if(!s||!this.contains(s))return;t.preventDefault();const r=s.className.match(/c-compass__label--([nsew])/);r&&e(r[1])})}});c("contour-layer-switch",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-layer-switch"),this.hasAttribute("role")||this.setAttribute("role","list"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"layer-switch","Layer switch")),Zt(this),$t(this,"items"),Xt(this,"layer-switch"))return;const t=Jt(this,"items"),e=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-layer-switch__item"));if(t&&!e.length){Array.from(this.querySelectorAll(".c-layer-switch__item")).forEach(t=>t.remove());try{const e=JSON.parse(t);(Array.isArray(e)?e.slice(0,50):e).forEach(t=>{const e=document.createElement("div");e.className="c-layer-switch__item",e.setAttribute("role","listitem");const s="string"==typeof t?t:t.name||t.label||"",r="object"==typeof t&&t&&t.id?String(t.id):s?s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""):"";this._layerSwitchSeq=(this._layerSwitchSeq||0)+1,e.dataset.layerId=r||"layer-"+this._layerSwitchSeq;const i=document.createElement("span");i.className="c-layer-switch__swatch";const a="object"==typeof t&&t&&t.shape?String(t.shape):"";if(pe.has(a)&&i.classList.add("c-swatch--"+a),t.color){const e=_(t.color);e&&(pe.has(a)?i.style.color=e:i.style.background=e)}i.setAttribute("aria-hidden","true"),e.appendChild(i);const n=document.createElement("span");if(n.className="c-layer-switch__name",n.textContent="string"==typeof t?t:t.name||t.label||"",e.appendChild(n),null!=t.count){const s=document.createElement("span");s.className="c-layer-switch__count",s.textContent=t.count,e.appendChild(s)}const o=document.createElement("button");o.className="c-layer-switch__toggle",o.type="button",o.setAttribute("aria-label",k(this,"toggle","Toggle")+" "+("string"==typeof t?t:t.name||t.label||k(this,"layer","layer")));const c="object"!=typeof t||!1!==t.visible;o.setAttribute("aria-pressed",String(c)),L(o,c?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-check" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-minus" /></svg>'),e.appendChild(o),this.appendChild(e)})}catch(t){f(this,"attribute",t)}}else t||e.length||(Array.from(this.querySelectorAll(".c-layer-switch__item")).forEach(t=>t.remove()),Yt(this,"layer-switch"))}enhance(){this._wiredLayerSwitch||(this._wiredLayerSwitch=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-layer-switch__toggle"):null;if(!e||!this.contains(e))return;const s=e.closest(".c-layer-switch__item"),r=s&&s.querySelector(".c-layer-switch__name")?.textContent||"",i=s&&s.dataset&&s.dataset.layerId||"",a="true"!==e.getAttribute("aria-pressed");e.setAttribute("aria-pressed",String(a)),this.dispatchEvent(new CustomEvent("contour:layer-toggle",{bubbles:!0,composed:!0,detail:{layerId:i,name:r,visible:a}}))}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-layer-switch__toggle"):null;e&&this.contains(e)&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click()))}))}});c("contour-basemap-switcher",class extends T{static get observed(){return["items","value","label"]}static get properties(){return{items:{attribute:"items"},value:{attribute:"value"},label:{attribute:"label"}}}render(){this.classList.add("c-basemap-switcher"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||k(this,"basemap","Basemap"));let t=[];try{const e=JSON.parse(this.getAttribute("items")||"[]");Array.isArray(e)&&(t=e)}catch(t){}const e=this.getAttribute("value");Array.from(this.querySelectorAll(".c-basemap-switcher__item")).forEach(t=>t.remove()),t.forEach(t=>{const s="string"==typeof t?t:t.label||t.value||t,r="string"==typeof t?t:t.value||t.label||t,i=document.createElement("button");i.type="button",i.className="c-basemap-switcher__item c-btn c-btn--sm"+(e===r?" is-active":""),i.textContent=s,i.dataset.value=r,e===r&&i.setAttribute("aria-pressed","true"),this.appendChild(i)})}enhance(){this._wiredBasemap||(this._wiredBasemap=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-basemap-switcher__item"):null;if(!e||!this.contains(e))return;const s=e.dataset.value,r=(e.textContent||"").trim();this.setAttribute("value",s),this.dispatchEvent(new CustomEvent("contour:map-style",{bubbles:!0,composed:!0,detail:{style:s,name:r}}))}))}});c("contour-map-slot",class extends T{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 t=this.getAttribute("chrome");if(t){this.ensure(".c-map-slot__chrome",()=>{const t=document.createElement("div");return t.className="c-map-slot__chrome",t}).textContent=t}else{const t=this.querySelector(".c-map-slot__chrome");t&&t.remove()}const e=this.getAttribute("attribution");if(e){this.ensure(".c-map-slot__attribution",()=>{const t=document.createElement("div");return t.className="c-map-slot__attribution",t}).textContent=e}else{const t=this.querySelector(".c-map-slot__attribution");t&&t.remove()}const s=this.getAttribute("scale");if(s){this.ensure(".c-map-slot__scale",()=>{const t=document.createElement("div");return t.className="c-map-slot__scale",t}).textContent=s}else{const t=this.querySelector(".c-map-slot__scale");t&&t.remove()}}});c("contour-map-area",class extends T{static get observed(){return["attribution","attribution-mark","scale","controls","style","style-name","src"]}static get properties(){return{attribution:{attribute:"attribution"},"attribution-mark":{attribute:"attribution-mark"},scale:{attribute:"scale"},controls:{attribute:"controls"},"style-name":{attribute:"style-name"}}}render(){this.classList.add("c-map-area"),this.classList.add("c-map-slot");const t=this.getAttribute("style");if(t&&t!==this._lastMapStyle){this._lastMapStyle=t;const e=this.getAttribute("style-name")||t;this.dispatchEvent(new CustomEvent("contour:map-style",{bubbles:!0,composed:!0,detail:{style:t,name:e}})),"function"==typeof requestAnimationFrame&&requestAnimationFrame(()=>this.dispatchEvent(new CustomEvent("contour:map-ready",{bubbles:!0,composed:!0})))}this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"map-area","Map area"));const e=this.getAttribute("attribution");if(e&&"engine"!==e){this.ensure(".c-map-slot__attribution",()=>{const t=document.createElement("div");return t.className="c-map-slot__attribution",t}).textContent=e}else{const t=this.querySelector(".c-map-slot__attribution");t&&t.remove()}const s=this.getAttribute("attribution-mark");if(s){this.ensure(".c-map-slot__attribution-mark",()=>{const t=document.createElement("span");return t.className="c-map-slot__attribution-mark",t}).textContent=s}else{const t=this.querySelector(".c-map-slot__attribution-mark");t&&t.remove()}const r=this.getAttribute("scale");if(r&&"engine"!==r){this.ensure(".c-map-slot__scale",()=>{const t=document.createElement("div");return t.className="c-map-slot__scale",t}).textContent=r}else{const t=this.querySelector(".c-map-slot__scale");t&&t.remove()}const i=this.getAttribute("controls");if(i)try{const t=JSON.parse(i),e=this.ensure(".c-map-slot__controls",()=>{const t=document.createElement("div");return t.className="c-map-slot__controls",t});L(e,""),t.forEach(t=>{const s=document.createElement("button");s.className="c-map-slot__control",s.type="button";const r="object"==typeof t&&t,i=r?t.label||t.action||"":String(t),a=r&&t.action?{zoomIn:"i-plus",zoomOut:"i-minus",zoomReset:"i-crosshair",zoom:"i-zoom",reset:"i-refresh",locate:"i-crosshair",recenter:"i-crosshair"}[String(t.action)]:null;a&&L(s,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+a+'" /></svg>'),s.appendChild(document.createTextNode((a?" ":"")+i)),r&&t.action&&(s.dataset.mapAction=String(t.action)),r&&t.label&&s.setAttribute("aria-label",String(t.label)),e.appendChild(s)})}catch(t){f(this,"attribute",t)}else{const t=this.querySelector(".c-map-slot__controls");t&&t.remove()}}enhance(){this._wiredMapArea||(this._wiredMapArea=!0,this._map=null,this.getViewport=()=>{const t=this._map;if(!t)return null;try{if("function"==typeof t.getBounds){const e=t.getBounds();return function(t){const e=t||{},s=V(e.west),r=V(e.east),i=Number.isFinite(s)&&Number.isFinite(r)&&s>r;return{west:s,south:P(e.south),east:i?r+360:r,north:P(e.north),crossesAntimeridian:i}}({west:e.getWest(),south:e.getSouth(),east:e.getEast(),north:e.getNorth()})}if(t.transform&&"object"==typeof t.transform)return{zoom:t.transform.zoom,center:t.transform.center}}catch(t){}return null},this._emitViewport=()=>{this.dispatchEvent(new CustomEvent("contour:map-viewport",{bubbles:!0,composed:!0,detail:this.getViewport()}))},this._detachEngine=()=>{const t=this._map;if(t&&"function"==typeof t.off){try{t.off("moveend",this._emitViewport)}catch(t){}try{t.off("idle",this._onMapIdle)}catch(t){}try{t.off("load",this._onMapIdle)}catch(t){}}if(this._mapRO){try{this._mapRO.disconnect()}catch(t){}this._mapRO=null}},this._onMapIdle=()=>{this._mapReadySent||(this._mapReadySent=!0,this.dispatchEvent(new CustomEvent("contour:map-ready",{bubbles:!0,composed:!0})))},this.attachMap=t=>{if(this._detachEngine(),this._map=t||null,this._mapReadySent=!1,this._map){const e=()=>{this.isConnected&&this._map===t&&(this.clientWidth&&this.clientHeight||this.dispatchEvent(new CustomEvent("contour:error",{bubbles:!0,composed:!0,detail:{src:this.getAttribute("src")||"",message:"Map container has zero size; the engine cannot render.",name:"map-zero-size",status:0}})))};"function"==typeof requestAnimationFrame?requestAnimationFrame(e):e()}if(this._map&&"function"==typeof this._map.on){try{this._map.on("moveend",this._emitViewport)}catch(t){}try{this._map.on("idle",this._onMapIdle)}catch(t){}try{this._map.on("load",this._onMapIdle)}catch(t){}}if("undefined"!=typeof ResizeObserver&&this._map)try{let t=0;this._mapRO=new ResizeObserver(()=>{t||(t=requestAnimationFrame(()=>{t=0;const e=this._map;if(e)try{"function"==typeof e.resize?e.resize():"function"==typeof e.invalidateSize&&e.invalidateSize()}catch(t){}}))}),this._mapRO.observe(this)}catch(t){this._mapRO=null}if(this.dispatchEvent(new CustomEvent("contour:map-attach",{bubbles:!0,composed:!0})),this._emitViewport(),this._map&&"function"==typeof this._map.loaded)try{this._map.loaded()&&this._onMapIdle()}catch(t){}},this.detachMap=()=>{this._detachEngine(),this._map=null,this.dispatchEvent(new CustomEvent("contour:map-detach",{bubbles:!0,composed:!0}))},this.hasOwnProperty("map")||Object.defineProperty(this,"map",{get:()=>this._map,set:t=>this.attachMap(t)}),this.fitBounds=(t,e)=>{const s=this._map;if(s&&"function"==typeof s.fitBounds)try{s.fitBounds(t,e)}catch(t){}},this.flyTo=t=>{const e=this._map;if(e&&"function"==typeof e.flyTo)try{e.flyTo(t)}catch(t){}},this.attachChrome=t=>{const e=t||this._map;if(!e||this._chromeMap===e)return;this._chromeMap=e,this._chromeDelegated||(this._chromeDelegated=!0,this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-drag-handle--dots, .c-layer-panel__grip"):null;if(!e||!this.contains(e))return;if("ArrowUp"!==t.key&&"ArrowDown"!==t.key)return;const s=e.closest(".c-layer-panel__item");if(!s)return;const r=s.parentNode,i="ArrowUp"===t.key?s.previousElementSibling:s.nextElementSibling;if(!i||!i.classList||!i.classList.contains("c-layer-panel__item"))return;t.preventDefault(),"ArrowUp"===t.key?r.insertBefore(s,i):r.insertBefore(i,s);try{e.focus()}catch(t){}const a=Array.from(r.querySelectorAll(":scope > .c-layer-panel__item")).map((t,e)=>t.dataset.layerId||t.getAttribute("data-layer-id")||String(e));this.dispatchEvent(new CustomEvent("contour:layer-reorder",{bubbles:!0,composed:!0,detail:{layerIds:a}}))}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-map-slot__control"):null;if(!e||!this.contains(e))return;const s=this._map;if(!s)return;const r=e.dataset.mapAction,i=(e.getAttribute("aria-label")||e.textContent||"").toLowerCase(),a=r?/out|minus|zoomout/i.test(r):/out|minus|−|-/.test(i)&&!/in\b/.test(i);try{a?s.zoomOut():s.zoomIn()}catch(t){}}));const s=this.querySelector(".c-readout");if(s&&"function"==typeof e.getCenter){const t=s.querySelector(".c-readout__value--coord"),r=s.querySelector(".c-readout__row:nth-child(2) .c-readout__value"),i=()=>{const s=this._map||e;if("function"!=typeof s.getCenter)return;const i=s.getCenter();t&&i&&(t.textContent=`${i.lng.toFixed(6)}, ${i.lat.toFixed(6)}`),r&&"function"==typeof s.getZoom&&(r.textContent=s.getZoom().toFixed(1))};try{e.on("move",i)}catch(t){}i()}const r=this.querySelector(".c-compass__needle");if(r&&"function"==typeof e.getBearing){const t=r.querySelector(".c-compass__needle--n"),s=r.querySelector(".c-compass__needle--s"),i=r.closest("contour-compass"),a=t=>{const e=t*Math.PI/180;return[20+16*Math.sin(e),20-16*Math.cos(e)]},n=()=>{const r=this._map||e;if("function"!=typeof r.getBearing)return;const n=-r.getBearing(),[o,c]=a(n),[l,u]=a(n+180);if(t&&t.setAttribute("d",`M ${o} ${c} L 20 20 Z`),s&&s.setAttribute("d",`M ${l} ${u} L 20 20 Z`),i){const t=i.getAttribute("aria-label")||"";if(!t||/^compass\b/i.test(t)){const t=Math.round((n%360+360)%360);i.setAttribute("aria-label",`Compass, bearing ${t} degrees`)}}};try{e.on("rotate",n)}catch(t){}n()}},this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-map-slot__control"):null;e&&this.contains(e)&&this.dispatchEvent(new CustomEvent("contour:map-control",{bubbles:!0,composed:!0,detail:{control:e.textContent}}))}))}});c("contour-map-panel",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-map-panel"),this.hasAttribute("role")||this.setAttribute("role","region");const t=this.getAttribute("title");if(t){const e=this._mapPanelTitle;(!this.hasAttribute("aria-label")||e&&this.getAttribute("aria-label")===e)&&this.setAttribute("aria-label",t),this._mapPanelTitle=t}else this._mapPanelTitle&&this.getAttribute("aria-label")===this._mapPanelTitle&&(this.removeAttribute("aria-label"),this._mapPanelTitle=null)}});c("contour-map-footer",class extends T{static get observed(){return["brand"]}static get properties(){return{brand:{attribute:"brand"}}}render(){this.classList.add("c-map-footer"),this.hasAttribute("role")||this.setAttribute("role","contentinfo");const t=this.getAttribute("brand");if(t){this.ensure(".c-map-footer__brand",()=>{const t=document.createElement("span");return t.className="c-map-footer__brand",t}).textContent=t}else{const t=this.querySelector(".c-map-footer__brand");t&&t.remove()}}});c("contour-scale-bar",class extends T{static get observed(){return["label","value","distance","resolution","latitude","zoom","units","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},distance:{attribute:"distance"},resolution:{attribute:"resolution"},latitude:{attribute:"latitude"},zoom:{attribute:"zoom"},src:{attribute:"src"}}}render(){if(this.classList.add("c-scale-bar"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"map-scale","Map scale")),Zt(this),$t(this,["label","value"]),Xt(this,"scale-bar"))return;let t=Jt(this,"value")||this._remoteData&&this._remoteData.value;const e=parseFloat(this.getAttribute("resolution")),s=parseFloat(this.getAttribute("latitude")),r=parseFloat(this.getAttribute("zoom"));let i=e;!Number.isFinite(i)&&Number.isFinite(s)&&Number.isFinite(r)&&(i=function(t,e){const s=P(t);return Number.isFinite(s)?156543.03392*Math.cos(s*Math.PI/180)/Math.pow(2,e):NaN}(s,r));let a=null;if(Number.isFinite(i)&&i>0){const e=parseFloat(this.getAttribute("distance"))||1e3;if(t=String(Math.round(e/i)),!this.getAttribute("label")&&!Jt(this,"label")){a="imperial"===(this.getAttribute("units")||"metric")?e>=1609.34?(e/1609.34).toFixed(1)+" mi":Math.round(3.28084*e)+" ft":e>=1e3?e/1e3+" km":e+" m"}}const n=a||Jt(this,"label")||this._remoteData&&this._remoteData.label;if(n){this.ensure(".c-scale-bar__label",()=>{const t=document.createElement("span");return t.className="c-scale-bar__label",t}).textContent=n}else{const t=this.querySelector(".c-scale-bar__label");t&&t.remove()}const o=this.ensure(".c-scale-bar__units",()=>{const t=document.createElement("button");return t.type="button",t.className="c-scale-bar__units",t}),c=this.getAttribute("units")||"metric";if(o.textContent="imperial"===c?"mi":"km",o.onclick=()=>{this.setAttribute("units","imperial"===(this.getAttribute("units")||"metric")?"metric":"imperial")},!t)return void Yt(this,"scale-bar");const l=this.ensure(".c-scale-bar__line",()=>{const t=document.createElement("span");return t.className="c-scale-bar__line",t});l.style.inlineSize=/^\d+(\.\d+)?$/.test(String(t))?t+"px":t;const u=function(t,e){t=Number(t)||0,e=Math.max(1,Math.round(e||4));const s=[];for(let r=0;r<=e;r++)s.push(t/e*r);return s}(parseFloat(t)||0,4),d=u[u.length-1]||1;Array.from(l.querySelectorAll(".c-scale-bar__tick")).forEach(t=>t.remove()),u.forEach(t=>{const e=document.createElement("span");e.className="c-scale-bar__tick",e.style.insetInlineStart=t/d*100+"%",l.appendChild(e)})}});c("contour-split-map",class extends T{static get observed(){return[]}render(){this.classList.add("c-split-map");const t=this.ensure(".c-split-map__pane--left",()=>{const t=document.createElement("div");return t.className="c-split-map__pane c-split-map__pane--left",t}),e=this.ensure(".c-split-map__pane--right",()=>{const t=document.createElement("div");return t.className="c-split-map__pane c-split-map__pane--right",t});t.parentNode!==this&&this.appendChild(t),e.parentNode!==this&&this.appendChild(e)}});c("contour-map-legend",class extends T{static get observed(){return["items","label","collapsed"]}static get properties(){return{items:{attribute:"items"},label:{attribute:"label"},collapsed:{attribute:"collapsed",type:Boolean}}}render(){this.classList.add("c-map-legend");const t=this.getAttribute("label")||k(this,"legend","Legend"),e=this.ensure(".c-map-legend__head",()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--sm c-map-legend__head",t});L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-layers" /></svg>'),e.appendChild(document.createTextNode(" "+t));const s=this.hasAttribute("collapsed");e.setAttribute("aria-expanded",s?"false":"true");let r=[];try{const t=JSON.parse(this.getAttribute("items")||"[]");Array.isArray(t)&&(r=t)}catch(t){}const i=this.ensure(".c-map-legend__list",()=>{const t=document.createElement("ul");return t.className="c-map-legend__list",t});L(i,""),s||r.forEach(t=>{const e="string"==typeof t?t:t.label||t.name||"",s="object"==typeof t&&t?t.color:null,r=document.createElement("li");r.className="c-map-legend__item";const a="object"==typeof t&&t&&t.shape?String(t.shape):"";if(s||pe.has(a)){const t=document.createElement("span");t.className="c-map-legend__swatch",pe.has(a)&&t.classList.add("c-swatch--"+a),s&&(pe.has(a)?t.style.color=s:t.style.setProperty("--c",s)),r.appendChild(t)}r.appendChild(document.createTextNode(" "+e)),i.appendChild(r)})}enhance(){this._wiredMapLegend||(this._wiredMapLegend=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-map-legend__head"):null;e&&this.contains(e)&&this.toggleAttribute("collapsed")}))}});c("contour-resize-observer",class extends T{static get observed(){return["debounce"]}static get properties(){return{debounce:{attribute:"debounce"}}}render(){this.classList.add("c-resize-observer"),this.setAttribute("aria-hidden","true")}enhance(){if(this._wiredResizeObserver)return;if(this._wiredResizeObserver=!0,"function"!=typeof ResizeObserver)return;const t=parseInt(this.getAttribute("debounce")||"0",10)||0;let e=null;const s=new ResizeObserver(s=>{const r=()=>{const t=s[s.length-1],e=t&&t.contentRect?t.contentRect:this.getBoundingClientRect();this.dispatchEvent(new CustomEvent("contour:resize",{bubbles:!0,composed:!0,detail:{width:e.width,height:e.height}}))};t>0?(clearTimeout(e),e=setTimeout(r,t)):r()});s.observe(this),i(this,()=>{s.disconnect(),clearTimeout(e)})}});c("contour-reserved",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-reserved");const t=this.getAttribute("title");if(t){this.ensure(".c-reserved__title",()=>{const t=document.createElement("div");return t.className="c-reserved__title",t}).textContent=t}}});c("contour-theme-scope",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-theme-scope");const t=this.getAttribute("title");if(t){this.ensure(".c-theme-scope__title",()=>{const t=document.createElement("div");return t.className="c-theme-scope__title",t}).textContent=t}}});c("contour-activity",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-activity"),this.setAttribute("role","group"),Zt(this),$t(this,"items"),Xt(this,"activity"))return;const t=Jt(this,"items");if(t)try{const e=JSON.parse(t);Array.from(this.querySelectorAll(".c-activity__item")).forEach(t=>t.remove()),e.forEach((t,e)=>{const s=document.createElement("div");s.className="c-activity__item",s.setAttribute("role","button"),s.setAttribute("tabindex",0===e?"0":"-1");const r=document.createElement("span");r.className="c-activity__dot c-activity__dot--"+(t.variant||"primary"),r.setAttribute("aria-hidden","true"),s.appendChild(r);const i=document.createElement("span");i.className="c-activity__glyph",i.setAttribute("aria-hidden","true"),L(i,'<svg viewBox="0 0 24 24"><use href="#'+({primary:"i-info",success:"i-check-circle",warning:"i-alert",danger:"i-x"}[t.variant]||"i-info")+'" /></svg>'),s.appendChild(i);const a=document.createElement("span");if(a.className="c-activity__text",a.textContent="string"==typeof t?t:t.text||t.label||"",s.hasAttribute("aria-label")||s.setAttribute("aria-label",a.textContent),s.appendChild(a),t.time){const e=document.createElement("span");e.className="c-activity__time",e.textContent=t.time,s.appendChild(e)}this.appendChild(s)})}catch(t){f(this,"attribute",t)}else Yt(this,"activity")}enhance(){this._wiredActivity||(this._wiredActivity=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-activity__item"):null;if(e&&this.contains(e)){const t=Array.from(this.querySelectorAll(".c-activity__item")).indexOf(e),s=e.querySelector(".c-activity__text")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:activity-select",{bubbles:!0,composed:!0,detail:{index:t,text:s}}))}}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-activity__item"));e.length&&z(t,e,{wrap:!1,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:()=>{if("Enter"===t.key||" "===t.key){const t=e.indexOf(document.activeElement);this.dispatchEvent(new CustomEvent("contour:activity-select",{bubbles:!0,composed:!0,detail:{index:t,text:document.activeElement.querySelector(".c-activity__text")?.textContent||""}}))}}})}))}});c("contour-activity-feed",class extends T{static get observed(){return["items","filter","unread-only","empty","loading","error","labels","src","lazy","refresh","timeout","skeleton","cache-key","no-cache","retry"]}static get properties(){return{items:{attribute:"items"},filter:{attribute:"filter"},"unread-only":{attribute:"unread-only",type:Boolean}}}render(){if(this.classList.add("c-activity-feed"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"title","Activity feed")),Zt(this),$t(this,"items"),Xt(this,"activity-feed"))return;const t=Jt(this,"items"),e=this.getAttribute("filter"),s=this.hasAttribute("unread-only");let r=this.querySelector(".c-activity-feed__header");r||(r=document.createElement("div"),r.className="c-activity-feed__header",this.insertBefore(r,this.firstChild));let i=r.querySelector(".c-activity-feed__title");i||(i=document.createElement("div"),i.className="c-activity-feed__title",r.appendChild(i)),i.textContent=k(this,"title","Activity feed");let a=this.querySelector(".c-activity-feed__toolbar");a||(a=document.createElement("div"),a.className="c-activity-feed__toolbar",this.appendChild(a));a.querySelector("[data-activity-clear]")||(()=>{const t=document.createElement("button");t.type="button",t.className="c-btn c-btn--ghost c-btn--sm",t.setAttribute("data-activity-clear",""),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-x" /></svg>'),t.appendChild(document.createTextNode(" "+k(this,"clear","Clear all"))),a.appendChild(t)})();(a.querySelector("[data-activity-unread]")||(()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--ghost c-btn--sm",t.setAttribute("data-activity-unread",""),t.textContent=k(this,"unread","Unread only"),a.appendChild(t),t})()).setAttribute("aria-pressed",s?"true":"false");let n=this.querySelector(".c-activity-feed__list");if(n||(n=document.createElement("ol"),n.className="c-activity-feed__list",this.appendChild(n)),t)try{let r=JSON.parse(t);if(e&&(r=r.filter(t=>String(t.severity||t.type||"").toLowerCase()===e.toLowerCase())),s&&(r=r.filter(t=>!t.read)),Array.from(n.querySelectorAll(".c-activity-feed__item")).forEach(t=>t.remove()),0===r.length){let t=n.querySelector(".c-activity-feed__empty");t||(t=document.createElement("div"),t.className="c-activity-feed__empty",t.textContent=k(this,"empty","No activity"),n.appendChild(t))}else{const t=n.querySelector(".c-activity-feed__empty");t&&t.remove(),r.forEach((t,e)=>{const s=document.createElement("li");s.className="c-activity-feed__item"+(t.read?"":" c-activity-feed__item--unread"),s.setAttribute("role","listitem"),s.setAttribute("tabindex",0===e?"0":"-1");const r=document.createElement("span");r.className="c-activity-feed__dot c-activity-feed__dot--"+(t.severity||"info"),r.setAttribute("aria-hidden","true"),s.appendChild(r);const i=document.createElement("span");i.className="c-activity-feed__text",i.textContent="string"==typeof t?t:t.text||t.label||"",s.appendChild(i);const a=document.createElement("time");a.className="c-activity-feed__time",t.time&&a.setAttribute("datetime",String(t.time)),a.textContent=t.time||"",s.appendChild(a);const o=document.createElement("span");o.className="c-activity-feed__severity",o.textContent=t.severity||"",s.appendChild(o),n.appendChild(s)})}}catch(t){f(this,"attribute",t)}}enhance(){this._wiredActivityFeed||(this._wiredActivityFeed=!0,this.addEventListener("click",t=>{const e=t.target.closest(".c-activity-feed__item");if(e&&this.contains(e)){const t=Array.from(this.querySelectorAll(".c-activity-feed__item")).indexOf(e),s=e.querySelector(".c-activity-feed__text")?.textContent||"";return e.classList.remove("c-activity-feed__item--unread"),void this.dispatchEvent(new CustomEvent("contour:activity-select",{bubbles:!0,composed:!0,detail:{index:t,text:s}}))}const s=t.target&&t.target.closest?t.target.closest("button"):null;s&&this.contains(s)&&(s.hasAttribute("data-activity-clear")?this.dispatchEvent(new CustomEvent("contour:activity-clear",{bubbles:!0,composed:!0,detail:{}})):s.hasAttribute("data-activity-unread")&&(this.toggleAttribute("unread-only"),this.dispatchEvent(new CustomEvent("contour:activity-filter",{bubbles:!0,composed:!0,detail:{unread:this.hasAttribute("unread-only")}}))))}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-activity-feed__item"));e.length&&z(t,e,{wrap:!1,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:()=>{if("Enter"===t.key||" "===t.key){const t=e.indexOf(document.activeElement);this.dispatchEvent(new CustomEvent("contour:activity-select",{bubbles:!0,composed:!0,detail:{index:t,text:document.activeElement.querySelector(".c-activity-feed__text")?.textContent||""}}))}}})}))}});c("contour-advanced",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-advanced"),this.setAttribute("role","region");const t=this.getAttribute("title");if(t){this.ensure(".c-advanced__title",()=>{const t=document.createElement("div");return t.className="c-advanced__title",t}).textContent=t,this.setAttribute("aria-label",t)}}enhance(){this._wiredAdvanced||(this._wiredAdvanced=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-advanced__title"):null;if(!e||!this.contains(e))return;const s=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:advanced-toggle",{bubbles:!0,composed:!0,detail:{title:s}}))}),this.addEventListener("keydown",t=>{if(t.target===this&&("Enter"===t.key||" "===t.key)){t.preventDefault();const e=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:advanced-toggle",{bubbles:!0,composed:!0,detail:{title:e}}))}}))}});c("contour-affordance",class extends T{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 t=this.getAttribute("name");if(t){this.ensure(".c-affordance__name",()=>{const t=document.createElement("div");return t.className="c-affordance__name",t}).textContent=t,this.setAttribute("aria-label",t)}else{const t=this.querySelector(".c-affordance__name");t&&t.remove()}const e=this.getAttribute("note");if(e){this.ensure(".c-affordance__note",()=>{const t=document.createElement("div");return t.className="c-affordance__note",t}).textContent=e}else{const t=this.querySelector(".c-affordance__note");t&&t.remove()}const s=this.getAttribute("demo");if(s){this.ensure(".c-affordance__demo",()=>{const t=document.createElement("div");return t.className="c-affordance__demo",t}).textContent=s}else{const t=this.querySelector(".c-affordance__demo");t&&t.remove()}}enhance(){this._wiredAffordance||(this._wiredAffordance=!0,this.addEventListener("click",t=>{const e=this.getAttribute("name")||"";this.dispatchEvent(new CustomEvent("contour:affordance-activate",{bubbles:!0,composed:!0,detail:{name:e}}))}),this.addEventListener("keydown",t=>{if("Enter"===t.key||" "===t.key){t.preventDefault();const e=this.getAttribute("name")||"";this.dispatchEvent(new CustomEvent("contour:affordance-activate",{bubbles:!0,composed:!0,detail:{name:e}}))}}))}});c("contour-affordances",class extends T{static get observed(){return["name","title"]}static get properties(){return{name:{attribute:"name"},title:{attribute:"title"}}}render(){if(this.classList.add("c-affordances"),this.setAttribute("role","group"),!this.querySelector(".c-affordance")){const t=document.createElement("div");t.className="c-affordance";const e=this.getAttribute("name")||this.getAttribute("title")||k(this,"affordance","Affordance"),s=document.createElement("div");s.className="c-affordance__name",s.textContent=e,t.appendChild(s);const r=document.createElement("div");r.className="c-affordance__demo",r.textContent=k(this,"demo","Demo"),t.appendChild(r),this.appendChild(t)}}});c("contour-menu",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-menu"),this.hasAttribute("role")||this.setAttribute("role","menu"),Zt(this),$t(this,"items"),Xt(this,"menu"))return;const t=Jt(this,"items"),e=Array.from(this.querySelectorAll("li[role='menuitem'], li.c-menu__item, [role='menuitem']")),s=this.querySelector("ul.c-menu");if(e.length){if(s)for(const t of e)t.classList.contains("c-menu__item")||t.classList.add("c-menu__item"),t.getAttribute("role")||t.setAttribute("role","menuitem"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1");else{const t=document.createElement("ul");t.className="c-menu",t.setAttribute("role","menu");for(const s of e)s.parentElement===this&&t.appendChild(s);this.appendChild(t)}const t=e.find(t=>"true"!==t.getAttribute("aria-disabled"));return t&&t.setAttribute("tabindex","0"),this.classList.remove("c-menu"),void(s&&s.classList.add("c-menu"))}if(!s)if(t)try{const e=JSON.parse(t),s=this.ensure("ul.c-menu",()=>{const t=document.createElement("ul");return t.className="c-menu",t.setAttribute("role","menu"),t});s.innerHTML="",s.setAttribute("role","menu"),e.forEach(t=>{if("---"===t||"separator"===t){const t=document.createElement("li");t.className="c-menu__separator",t.setAttribute("role","separator"),s.appendChild(t)}else if("string"==typeof t){const e=document.createElement("li");e.className="c-menu__item",e.setAttribute("role","menuitem"),e.textContent=t,s.appendChild(e)}else if(t.group){const e=document.createElement("li");e.className="c-menu__group",e.setAttribute("role","group"),t.group&&e.setAttribute("aria-label",String(t.group));const r=document.createElement("div");if(r.className="c-menu__group-label",r.textContent=String(t.group),e.appendChild(r),Array.isArray(t.items)){const s=document.createElement("ul");s.className="c-menu",s.setAttribute("role","menu"),t.items.forEach(t=>{const e=document.createElement("li");if(e.className="c-menu__item"+(t.danger?" c-menu__item--danger":"")+(t.disabled?" c-menu__item--disabled":""),e.setAttribute("role","menuitem"),t.disabled&&e.setAttribute("aria-disabled","true"),t.label||t.title){const s=document.createElement("span");s.className="c-menu__label",s.textContent=t.label||t.title||"",e.appendChild(s)}s.appendChild(e)}),e.appendChild(s)}s.appendChild(e)}else{const e=document.createElement("li");e.className="c-menu__item"+(t.danger?" c-menu__item--danger":"")+(t.disabled?" c-menu__item--disabled":"");const r="checkbox"===t.type?"menuitemcheckbox":"radio"===t.type?"menuitemradio":"menuitem";if(e.setAttribute("role",r),"checkbox"!==t.type&&"radio"!==t.type||e.setAttribute("aria-checked",String(!!t.checked)),t.disabled&&e.setAttribute("aria-disabled","true"),t.items&&Array.isArray(t.items)&&(e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","false")),t.label||t.title){const s=document.createElement("span");s.className="c-menu__label",s.textContent=t.label||t.title||"",e.appendChild(s)}if(t.shortcut){const s=document.createElement("span");s.className="c-menu__shortcut",s.textContent=t.shortcut,e.appendChild(s)}if(t.items&&Array.isArray(t.items)){const s=document.createElement("ul");s.className="c-menu",s.setAttribute("role","menu"),t.items.forEach(t=>{const e=document.createElement("li");if(e.className="c-menu__item"+(t.danger?" c-menu__item--danger":"")+(t.disabled?" c-menu__item--disabled":""),e.setAttribute("role","menuitem"),t.disabled&&e.setAttribute("aria-disabled","true"),t.label||t.title){const s=document.createElement("span");s.className="c-menu__label",s.textContent=t.label||t.title||"",e.appendChild(s)}s.appendChild(e)}),e.appendChild(s)}s.appendChild(e)}}),s.parentNode!==this&&this.appendChild(s),this.classList.remove("c-menu"),s.classList.add("c-menu")}catch(t){f(this,"attribute",t)}else Yt(this,"menu")}enhance(){At(this)}});c("contour-tabs",class extends T{static get observed(){return["tabs","items","autoplay","pause","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","orientation","closable","cache-key","no-cache"]}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(){if(this.classList.add("c-tabs"),Zt(this),$t(this,"tabs"),Xt(this,"tabs"))return;const t=Jt(this,"tabs")||Jt(this,"items")||this.getAttribute("tabs")||this.getAttribute("items"),e=Array.from(this.querySelectorAll("[role='tab']")),s=this.querySelector(".c-tabs__list"),r=Array.from(this.querySelectorAll(".c-tabs__panel"));if(e.length){if(!s){const t=document.createElement("div");t.className="c-tabs__list",t.setAttribute("role","tablist");const s="vertical"===this.getAttribute("orientation")?"vertical":"horizontal";t.setAttribute("aria-orientation",s),"vertical"===s?this.classList.add("c-tabs--vertical"):this.classList.remove("c-tabs--vertical");for(const s of e)s.parentElement===this&&t.appendChild(s);this.prepend(t)}const t="vertical"===this.getAttribute("orientation")?"vertical":"horizontal";s&&s.setAttribute("aria-orientation",t),"vertical"===t?this.classList.add("c-tabs--vertical"):this.classList.remove("c-tabs--vertical");const i=e.findIndex(t=>"true"===t.getAttribute("aria-selected"));return void e.forEach((t,e)=>{t.classList.contains("c-tabs__tab")||t.classList.add("c-tabs__tab"),t.getAttribute("role")||t.setAttribute("role","tab");let s=t.getAttribute("aria-controls");if(s){let t=r.find(t=>t.id===s);t||(t=document.createElement("div"),t.className="c-tabs__panel",t.id=s,t.setAttribute("role","tabpanel"),this.appendChild(t))}else{const i=r[e];i&&(s=i.id||o("c-tabs-panel"),i.id=s,t.setAttribute("aria-controls",s))}const a=i>=0?e===i:0===e;t.setAttribute("aria-selected",String(a)),t.tabIndex=a?0:-1;const n=t.getAttribute("aria-controls"),c=n?document.getElementById(n):null;c&&(c.hidden=!a)})}if(t&&!e.length)try{const e=JSON.parse(t),s=this.ensure(".c-tabs__list",()=>{const t=document.createElement("div");return t.className="c-tabs__list",t.setAttribute("role","tablist"),t});s.setAttribute("role","tablist");const r="vertical"===this.getAttribute("orientation")?"vertical":"horizontal";s.setAttribute("aria-orientation",r),"vertical"===r?this.classList.add("c-tabs--vertical"):this.classList.remove("c-tabs--vertical");const i=Array.from(s.querySelectorAll("[role='tab']")).findIndex(t=>"true"===t.getAttribute("aria-selected")),a=i>=0?i:0;s.innerHTML="",Array.from(this.querySelectorAll(".c-tabs__panel")).forEach(t=>t.remove()),e.forEach((t,e)=>{const r="string"==typeof t?t:t.label||t.title||"",i=o("c-tabs-panel"),n=document.createElement(this.hasAttribute("closable")?"div":"button");n.className="c-tabs__tab","BUTTON"===n.tagName&&(n.type="button"),n.setAttribute("role","tab"),n.setAttribute("aria-selected",String(e===a)),n.setAttribute("aria-controls",i),n.tabIndex=e===a?0:-1;const c=document.createElement("span");if(c.textContent=r,n.textContent="",n.appendChild(c),this.hasAttribute("closable")){const t=document.createElement("button");t.type="button",t.className="c-tabs__close",t.setAttribute("aria-label",k(this,"close","Close")+" "+r),t.textContent="×",t.addEventListener("click",t=>{t.stopPropagation();const e=Array.from(s.querySelectorAll("[role='tab']")).indexOf(n),i=n.getAttribute("aria-controls"),a=i?document.getElementById(i):null;n.remove(),a&&a.remove(),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0,detail:{index:e,label:r}}));const o=s.querySelectorAll("[role='tab']");o.length&&o[0].click()}),n.appendChild(t)}s.appendChild(n);const l=document.createElement("div");l.className="c-tabs__panel",l.id=i,l.setAttribute("role","tabpanel"),"object"==typeof t&&null!==t&&void 0!==t.content&&(l.textContent=String(t.content)),e!==a&&(l.hidden=!0),this.appendChild(l)}),s.parentNode!==this&&this.prepend(s)}catch(t){f(this,"attribute",t)}else if(!t&&!e.length){const t=this.querySelector(".c-tabs__list");t&&t.remove(),Yt(this,"tabs")}}enhance(){pt(this);const t=()=>{const t=parseFloat(this.getAttribute("autoplay")||""),e=this.hasAttribute("pause")||this._tabsHover||this._tabsFocus,s="function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,r=Number.isFinite(t)&&t>0&&!e&&!s;r!==this._tabsAutoplayRunning&&(this._tabsAutoplayRunning=r,void 0!==this._tabsTimer&&(clearInterval(this._tabsTimer),this._tabsTimer=void 0),r&&(this._tabsTimer=setInterval(()=>{if(!this.isConnected||this.hasAttribute("pause")||this._tabsHover||this._tabsFocus)return;const t=this.querySelector(".c-tabs__list"),e=t?Array.from(t.querySelectorAll("[role='tab']")):[];if(!e.length)return;const s=e.findIndex(t=>"true"===t.getAttribute("aria-selected")),r=e[(s+1)%e.length];r&&r.click()},Math.max(1e3,1e3*t))))};t(),this._wiredTabsAutoplay||(this._wiredTabsAutoplay=!0,this.addEventListener("pointerenter",()=>{this._tabsHover=!0,t()}),this.addEventListener("pointerleave",()=>{this._tabsHover=!1,t()}),this.addEventListener("focusin",()=>{this._tabsFocus=!0,t()}),this.addEventListener("focusout",()=>{this._tabsFocus=!1,t()}),i(this,()=>{void 0!==this._tabsTimer&&(clearInterval(this._tabsTimer),this._tabsTimer=void 0)}))}});c("contour-code-tabs",class extends T{static get observed(){return["tabs","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","cache-key","no-cache"]}static get properties(){return{tabs:{attribute:"tabs"},src:{attribute:"src"}}}render(){if(this.classList.add("c-code-tabs"),Zt(this),$t(this,"tabs"),Xt(this,"code-tabs"))return;const t=Jt(this,"tabs"),e=this.querySelector(".c-code-tabs__list"),s=e?Array.from(e.children).filter(t=>t.getAttribute&&"tab"===t.getAttribute("role")):[];if(t&&!s.length)try{const e=JSON.parse(t),s=this.ensure(".c-code-tabs__list",()=>{const t=document.createElement("div");return t.className="c-code-tabs__list",t.setAttribute("role","tablist"),t});s.setAttribute("role","tablist");const r=Array.from(s.querySelectorAll("[role='tab']")).findIndex(t=>"true"===t.getAttribute("aria-selected")),i=r>=0?r:0;s.innerHTML="",Array.from(this.querySelectorAll(".c-code-tabs__panel")).forEach(t=>t.remove()),e.forEach((t,e)=>{const r="string"==typeof t?t:t.label||t.title||"",a=o("c-code-tabs-panel"),n=document.createElement("button");n.className="c-code-tabs__tab",n.type="button",n.setAttribute("role","tab"),n.setAttribute("aria-selected",String(e===i)),n.setAttribute("aria-controls",a),n.tabIndex=e===i?0:-1,n.textContent=r,s.appendChild(n);const c=document.createElement("div");if(c.className="c-code-tabs__panel",c.id=a,c.setAttribute("role","tabpanel"),"object"==typeof t&&null!==t&&void 0!==t.content){const e=document.createElement("pre"),s=document.createElement("code");s.textContent=String(t.content),e.appendChild(s),c.appendChild(e);const r=document.createElement("button");r.className="c-btn c-btn--ghost c-btn--sm c-code-tabs__copy",r.type="button",r.textContent=k(this,"copy","Copy"),r.setAttribute("aria-label",k(this,"copy-code","Copy code")),r.dataset.copy=String(t.content),c.appendChild(r)}e!==i&&(c.hidden=!0),this.appendChild(c)}),s.parentNode!==this&&this.prepend(s)}catch(t){f(this,"attribute",t)}else!t&&e?(e.remove(),Yt(this,"code-tabs")):t||e||Yt(this,"code-tabs")}enhance(){pt(this),this._wiredCodeTabs||(this._wiredCodeTabs=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-code-tabs__copy"):null;if(!e||!this.contains(e))return;const s=e.dataset.copy||"";if(s)try{navigator.clipboard.writeText(s),e.textContent=k(this,"copied","Copied!"),setTimeout(()=>{e.textContent=k(this,"copy","Copy")},2e3)}catch(t){}}))}});c("contour-breadcrumb",class extends T{static get observed(){return["items","separator","max","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},separator:{attribute:"separator"},max:{attribute:"max",type:Number},src:{attribute:"src"}}}render(){if(this.classList.add("c-breadcrumb"),this.hasAttribute("role")||this.setAttribute("role","navigation"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"breadcrumb","Breadcrumb")),Zt(this),$t(this,"items"),Xt(this,"breadcrumb"))return;const t=Jt(this,"items"),e=this.querySelector("nav"),s=e?e.querySelector("ol"):null,r=s?Array.from(s.children).filter(t=>"LI"===t.tagName):[];if(t&&!r.length)try{const e=JSON.parse(t),s=this.ensure("nav",()=>{const t=document.createElement("nav");return t.setAttribute("aria-label",k(this,"breadcrumb","Breadcrumb")),t});s.setAttribute("aria-label",k(this,"breadcrumb","Breadcrumb")),s.id||(s.id=o("contour-breadcrumb-list")),s.innerHTML="";const r=document.createElement("ol");r.className="c-breadcrumb__list",s.appendChild(r);const i=this.getAttribute("separator")||"/",a=this._overflowExpanded?null:this.max,n=Number.isFinite(a)&&a>1&&e.length>a?e.slice(-a):e;if(Number.isFinite(a)&&a>1&&e.length>a){const t=document.createElement("button");t.type="button",t.className="c-breadcrumb__overflow",t.setAttribute("aria-label",`Show ${e.length-n.length+1} more items`),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-controls",s.id),t.textContent="…",t.addEventListener("click",()=>{this._overflowExpanded=!0,this.requestRender(),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{expanded:!0}}))});const i=document.createElement("li");i.appendChild(t),r.appendChild(i)}n.forEach((t,e)=>{const s=document.createElement("li");if(e<n.length-1){const e=document.createElement("a");e.href=v(t.href||"#"),e.textContent=t.label||t,s.appendChild(e);const r=document.createElement("span");r.className="c-breadcrumb__sep",r.setAttribute("aria-hidden","true"),r.textContent=i,s.appendChild(r)}else{const e=document.createElement("span");e.textContent=t.label||t,e.setAttribute("aria-current","page"),s.appendChild(e)}r.appendChild(s)})}catch(t){f(this,"attribute",t)}else!t&&e?e.remove():t||e||Yt(this,"breadcrumb")}});c("contour-pagination",class extends T{static get observed(){return["pages","current","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","cache-key","no-cache"]}static get properties(){return{pages:{attribute:"pages"},current:{attribute:"current"},src:{attribute:"src"}}}render(){if(this.classList.add("c-pagination"),this.hasAttribute("role")||this.setAttribute("role","navigation"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"pagination","Pagination")),Zt(this),$t(this,"pages"),Xt(this,"pagination"))return;const t=Jt(this,"pages");Array.from(this.querySelectorAll(".c-pagination__link")).forEach(t=>t.remove());let e=this.getAttribute("current")||"1";if("storage"===this.getAttribute("persist")&&this.id)try{const t=localStorage.getItem("contour-pagination:"+this.id);null!==t&&(e=t)}catch(t){}else if("url"===this.getAttribute("persist"))try{const t=new URLSearchParams(window.location.search).get("c-pagination");null!==t&&(e=t)}catch(t){}const s=parseInt(e,"10")||1;if(this.setAttribute("page",String(s)),t){let e=parseInt(t,10);if(!Number.isFinite(e)||e<1)try{const s=JSON.parse(t);Array.isArray(s)&&(e=s.length)}catch(t){}const r=document.createElement("button");r.type="button",r.className="c-pagination__link c-pagination__prev",r.setAttribute("data-action","prev"),L(r,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-left" /></svg>'),r.setAttribute("aria-label",k(this,"prev","Previous page")),s<=1&&r.setAttribute("disabled",""),this.appendChild(r);const i=new Set([1,e,s]);s>1&&i.add(s-1),s<e&&i.add(s+1);const a=[...i].filter(t=>t>=1&&t<=e).sort((t,e)=>t-e);let n=0;for(const t of a){if(n&&t-n>1){const t=document.createElement("span");t.className="c-pagination__ellipsis",t.textContent="…",t.setAttribute("aria-hidden","true"),this.appendChild(t)}const e=document.createElement("button");e.type="button",e.className="c-pagination__link",e.textContent=String(t),t===s&&e.setAttribute("aria-current","page"),this.appendChild(e),n=t}const o=document.createElement("button");o.type="button",o.className="c-pagination__link c-pagination__next",o.setAttribute("data-action","next"),L(o,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),o.setAttribute("aria-label",k(this,"next","Next page")),s>=e&&o.setAttribute("disabled",""),this.appendChild(o)}else Yt(this,"pagination")}enhance(){Et(this)}});c("contour-pager",class extends T{static get observed(){return["prev","next"]}static get properties(){return{prev:{attribute:"prev"},next:{attribute:"next"}}}render(){this.classList.add("c-pager"),this.hasAttribute("role")||this.setAttribute("role","navigation"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"pagination","Pagination")),Array.from(this.querySelectorAll(".c-pager__link")).forEach(t=>t.remove());const t=this.getAttribute("prev"),e=this.getAttribute("next");if(t){const e=document.createElement("a");e.className="c-pager__link",e.href=v(t.split("|")[1]||"#");const s=document.createElement("span");s.className="c-pager__dir",s.textContent=k(this,"previous","← Previous"),e.appendChild(s);const r=document.createElement("span");r.className="c-pager__title",r.textContent=t.split("|")[0],e.appendChild(r),this.appendChild(e)}if(e){const t=document.createElement("a");t.className="c-pager__link c-pager__link--next",t.href=v(e.split("|")[1]||"#");const s=document.createElement("span");s.className="c-pager__dir",s.textContent=k(this,"next","Next")+" →",t.appendChild(s);const r=document.createElement("span");r.className="c-pager__title",r.textContent=e.split("|")[0],t.appendChild(r),this.appendChild(t)}}});c("contour-toc",class extends T{static get observed(){return["title","items","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","empty","no-cache"]}static get properties(){return{title:{attribute:"title"},items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-toc"),this.setAttribute("role","group"),Zt(this),$t(this,"items"),Xt(this,"toc"))return;const t=Jt(this,"items"),e=this.getAttribute("title")||"On this page";this.ensure(".c-toc__title",()=>{const t=document.createElement("div");return t.className="c-toc__title",t}).textContent=e;const s=this.querySelector(".c-toc__list"),r=s?Array.from(s.children).filter(t=>"A"===t.tagName):[];if(t&&!r.length)try{const s=JSON.parse(t),r=this.ensure(".c-toc__list",()=>{const t=document.createElement("nav");return t.className="c-toc__list",t});r.className="c-toc__list",r.setAttribute("aria-label",e),r.innerHTML="",s.forEach((t,e)=>{const s=document.createElement("a");s.className="c-toc__link"+(t.sub?" c-toc__link--sub":""),s.href=v(t.href||"#"),s.textContent=t.label||t,s.tabIndex=0===e?0:-1,t.current&&s.setAttribute("aria-current","true"),r.appendChild(s)})}catch(t){f(this,"attribute",t)}else!t&&s?(s.remove(),Yt(this,"toc")):t||s||Yt(this,"toc")}enhance(){if(this._wiredTocSpy)return;const t=()=>Array.from(this.querySelectorAll(".c-toc__link")),e=()=>t().map(t=>{const e=t.getAttribute("href")||"";if(!e.startsWith("#")||e.length<2)return null;const s=document.getElementById(e.slice(1));return s?{a:t,el:s}:null}).filter(Boolean);if(!e().length)return;this._wiredTocSpy=!0;const s=()=>{const s=e();if(!s.length)return;const r=(()=>{const t=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--header-height"));return(Number.isFinite(t)?t:0)+Math.min(120,.2*window.innerHeight)})();let i=s[0];for(const t of s)t.el.getBoundingClientRect().top<=r&&(i=t);document.documentElement.scrollHeight>window.innerHeight+2&&window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-2&&(i=s[s.length-1]);const a=i.el.id;t().forEach(t=>{t.getAttribute("href")==="#"+a?"true"!==t.getAttribute("aria-current")&&t.setAttribute("aria-current","true"):t.hasAttribute("aria-current")&&t.removeAttribute("aria-current")})};let r=0;const a=()=>{r||(r=requestAnimationFrame(()=>{r=0,s()}))};window.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),window.addEventListener("hashchange",a),s(),i(this,()=>{window.removeEventListener("scroll",a),window.removeEventListener("resize",a),window.removeEventListener("hashchange",a),r&&cancelAnimationFrame(r)}),this._wiredTocScroll||(this._wiredTocScroll=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-toc__link"):null;if(!e||!this.contains(e))return;const s=e.getAttribute("href")||"";if(!s.startsWith("#")||s.length<2)return;const r=document.getElementById(s.slice(1));if(r){t.preventDefault();try{r.scrollIntoView({behavior:"smooth",block:"start"})}catch(t){r.scrollIntoView()}this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{href:s}}))}}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-toc__link"));e.length&&z(t,e,{wrap:!0,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e){const e=document.activeElement;e&&(t.preventDefault(),e.click())}}})}))}});c("contour-header",class extends T{static get observed(){return["brand","brand-href","links"]}static get properties(){return{brand:{attribute:"brand"},"brand-href":{attribute:"brand-href"},links:{attribute:"links"}}}render(){this.classList.add("c-header"),this.hasAttribute("role")||this.setAttribute("role","banner"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("brand")||"Header");const t=this.getAttribute("brand"),e=this.getAttribute("links"),s=this.ensure(".c-header__inner",()=>{const t=document.createElement("div");return t.className="container c-header__inner",t});s.className="container c-header__inner";let r=s.querySelector(".c-brand");if(t){if(!r){r=document.createElement("a"),r.className="c-brand",r.setAttribute("data-contour-generated",""),r.href=v(this.getAttribute("brand-href")||"#"),L(r,'<span class="c-mark"><svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-mark" /></svg></span>');const t=document.createElement("span");t.className="c-brand__name",r.appendChild(t),s.insertBefore(r,s.firstChild)}const e=r.querySelector(".c-brand__name");e&&(e.textContent=t)}else r&&r.hasAttribute("data-contour-generated")&&r.remove();let i=s.querySelector(".c-header__nav");const a=i?Array.from(i.children).filter(t=>"A"===t.tagName):[];if(e&&!a.length)try{const t=JSON.parse(e);i||(i=document.createElement("nav"),i.className="c-header__nav",i.setAttribute("aria-label",k(this,"main","Main")),i.setAttribute("data-contour-generated",""),s.appendChild(i)),i.innerHTML="",t.forEach(t=>{const e=document.createElement("a");e.href=v(t.href||"#"),e.textContent=t.label||t,i.appendChild(e)})}catch(t){}else e&&a.length||i&&!e&&!a.length&&i.hasAttribute("data-contour-generated")&&i.remove();if(!s.querySelector(".c-header__actions")){const t=document.createElement("div");t.className="c-header__actions",s.appendChild(t)}const n=s.querySelector(".c-header__nav");if(n){n.id||(n.id=o("header-nav"));const t=s.querySelector(".c-header__actions");if(t&&!t.querySelector(".c-header__toggle")){const e=document.createElement("button");e.type="button",e.className="c-header__toggle",e.setAttribute("aria-label",k(this,"toggle-navigation","Toggle navigation")),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",n.id),L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-menu" /></svg>'),t.appendChild(e)}}s.parentNode!==this&&this.appendChild(s)}enhance(){if(this._wiredHeader)return;this._wiredHeader=!0;const t=()=>{const t=window.scrollY||document.documentElement.scrollTop||0;this.classList.toggle("c-header--scrolled",t>8)};t(),window.addEventListener("scroll",t,{passive:!0}),i(this,()=>window.removeEventListener("scroll",t)),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-header__toggle"):null;if(!e||!this.contains(e))return;const s=this.querySelector("#"+CSS.escape(e.getAttribute("aria-controls")||""));if(!s)return;const r=s.classList.toggle("is-open");e.setAttribute("aria-expanded",String(r)),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{open:r}}))}),this.addEventListener("keydown",t=>{if("Escape"!==t.key)return;const e=this.querySelector(".c-header__toggle"),s=e&&this.querySelector("#"+CSS.escape(e.getAttribute("aria-controls")||""));e&&s&&s.classList.contains("is-open")&&(s.classList.remove("is-open"),e.setAttribute("aria-expanded","false"))})}});c("contour-footer",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","contentinfo");const t=this.getAttribute("brand");if(t){this.ensure(".c-footer__brand",()=>{const t=document.createElement("div");return t.className="c-footer__brand",t}).textContent=t}else{const t=this.querySelector(".c-footer__brand");t&&t.remove()}const e=this.getAttribute("note");if(e){this.ensure(".c-footer__note",()=>{const t=document.createElement("p");return t.className="c-footer__note",t}).textContent=e}else{const t=this.querySelector(".c-footer__note");t&&t.remove()}const s=this.getAttribute("links");if(s)try{const t=JSON.parse(s),e=this.ensure(".c-footer__links",()=>{const t=document.createElement("div");return t.className="c-footer__links",t});e.innerHTML="",t.forEach(t=>{const s=document.createElement("a");s.href=v("string"==typeof t?"#":t.href||"#"),s.textContent="string"==typeof t?t:t.label||t,e.appendChild(s)})}catch(t){f(this,"attribute",t)}else{const t=this.querySelector(".c-footer__links");t&&t.remove()}const r=this.getAttribute("cols");if(r)try{const t=JSON.parse(r);this.querySelectorAll(".c-footer__col").forEach(t=>t.remove()),t.forEach(t=>{const e=document.createElement("div");if(e.className="c-footer__col",t.title){const s=document.createElement(E(this,"h3"));s.textContent=t.title,e.appendChild(s)}(t.links||[]).forEach(t=>{const s=document.createElement("a");s.href=v("string"==typeof t?"#":t.href||"#"),s.textContent="string"==typeof t?t:t.label||t,e.appendChild(s)}),this.appendChild(e)})}catch(t){f(this,"attribute",t)}else this.querySelectorAll(".c-footer__col").forEach(t=>t.remove())}});c("contour-scheme-toggle",class extends T{static get observed(){return[]}_stored(){try{return localStorage.getItem("contour-scheme")??"light dark"}catch(t){return"light dark"}}_resolved(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}_rendered(){const t=this._stored();return"light dark"===t?this._resolved():t}render(){if(this.classList.add("c-scheme-toggle"),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),!this.querySelector(".c-scheme-toggle__icons")&&!this.querySelector(".c-scheme-toggle__glyph")){const t=document.createElement("span");t.className="c-scheme-toggle__glyph",t.setAttribute("aria-hidden","true"),this.appendChild(t)}this._sync()}_sync(){const t=this._rendered(),e="dark"===t?"light":"dark";this.setAttribute("aria-pressed",String("dark"===t)),this.setAttribute("aria-label","dark"===e?"Switch to dark theme":"Switch to light theme");const s=this.querySelector(".c-scheme-toggle__glyph");s&&(s.textContent="dark"===t?"☀":"☾")}_apply(t){const e=document.documentElement,s="light dark"===t?this._resolved():t;e.classList.add("is-theme-switching");const r=document.querySelector('meta[name="color-scheme"]');r&&r.setAttribute("content",t),e.setAttribute("data-theme",s);try{"light dark"===t?localStorage.removeItem("contour-scheme"):localStorage.setItem("contour-scheme",t)}catch(t){}requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove("is-theme-switching"))),this._sync(),this.dispatchEvent(new CustomEvent("contour:theme-change",{detail:{theme:s},bubbles:!0,composed:!0}))}enhance(){if(this._wiredScheme)return;this._wiredScheme=!0,this.addEventListener("click",()=>{const t="dark"===this._rendered()?"light":"dark";this._apply(t===this._resolved()?"light dark":t)}),this.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.click())});const t=window.matchMedia("(prefers-color-scheme: dark)");t.addEventListener&&t.addEventListener("change",()=>{"light dark"===this._stored()&&(document.documentElement.setAttribute("data-theme",this._resolved()),this._sync())});try{const t=localStorage.getItem("contour-theme");t&&(localStorage.getItem("contour-scheme")||"dark"!==t&&"light"!==t||localStorage.setItem("contour-scheme",t),localStorage.removeItem("contour-theme"))}catch(t){}const e=this._stored();"light dark"!==e?this._apply(e):this._sync()}});c("contour-sidebar",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","navigation"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Sidebar"),this.hasAttribute("collapsed")?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed");const t=this.getAttribute("title");if(t){this.ensure(".c-sidebar__title",()=>{const t=document.createElement("div");return t.className="c-sidebar__title",t}).textContent=t}else{const t=this.querySelector(".c-sidebar__title");t&&t.remove()}const e=this.hasAttribute("collapsed"),s=this.ensure(".c-sidebar__toggle",()=>{const t=document.createElement("button");return t.className="c-sidebar__toggle",t.type="button",t});s.setAttribute("aria-label",e?"Expand sidebar":"Collapse sidebar"),s.setAttribute("aria-pressed",String(e)),L(s,e?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-down" /></svg>');const r=this.getAttribute("items");if(r)try{const t=JSON.parse(r),e=this.ensure("nav.c-sidebar__nav",()=>{const t=document.createElement("nav");return t.className="c-sidebar__nav",t});e.innerHTML="",t.forEach((t,s)=>{const r=document.createElement("a");r.className="c-sidebar__link",r.href=v(t&&t.href||"#"),r.textContent=t&&(t.label||t)||"",r.tabIndex=0===s?0:-1,e.appendChild(r)})}catch(t){f(this,"attribute",t)}}enhance(){this._wiredSidebar||(this._wiredSidebar=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-sidebar__toggle"):null;e&&this.contains(e)&&(this.toggleAttribute("collapsed"),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{collapsed:this.hasAttribute("collapsed")}})))}),this.addEventListener("keydown",t=>{const e=this.querySelector("nav.c-sidebar__nav");if(!e)return;const s=Array.from(e.querySelectorAll(".c-sidebar__link"));s.length&&z(t,s,{wrap:!0,homeEnd:!0,onNavigate:t=>{s.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e){const e=document.activeElement;e&&(t.preventDefault(),e.click())}}})}))}});c("contour-toolbar",class extends T{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 t=this.getAttribute("title");this.setAttribute("role","toolbar"),t&&this.setAttribute("aria-label",t);const e=this.getAttribute("actions");if(e)try{const t=JSON.parse(e),s=this.overflow&&this.overflow>0?this.overflow:t.length,r=t.slice(0,s),i=t.slice(s);if(r.forEach((t,e)=>{const s=document.createElement("button");s.className="c-toolbar__btn",s.type="button",s.tabIndex=0===e?0:-1,s.textContent="string"==typeof t?t:t.label||t,("string"==typeof t||t&&t.label)&&s.classList.add("c-toolbar__btn--text"),this.appendChild(s)}),i.length){const t=document.createElement("div");t.className="c-toolbar__overflow";const e=document.createElement("button");e.className="c-toolbar__btn c-toolbar__overflow-btn",e.type="button",e.tabIndex=-1,e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","false"),e.textContent="…",e.setAttribute("aria-label",k(this,"more-options","More options")),t.appendChild(e);const s=document.createElement("div");s.className="c-toolbar__overflow-menu",s.setAttribute("role","menu"),s.setAttribute("hidden",""),i.forEach(t=>{const e=document.createElement("button");e.className="c-toolbar__btn",e.type="button",e.setAttribute("role","menuitem"),e.textContent="string"==typeof t?t:t.label||t,s.appendChild(e)}),t.appendChild(s),this.appendChild(t)}}catch(t){f(this,"attribute",t)}}enhance(){this._wiredToolbar||(this._wiredToolbar=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-toolbar__overflow-btn"):null;if(e&&this.contains(e)){const t=e.parentElement&&e.parentElement.querySelector(".c-toolbar__overflow-menu");if(t){const s=t.hasAttribute("hidden");s?t.removeAttribute("hidden"):t.setAttribute("hidden",""),e.setAttribute("aria-expanded",String(s)),e.tabIndex=s?-1:0;const r=Array.from(t.querySelectorAll("[role='menuitem']"));if(r.forEach((t,e)=>t.tabIndex=s&&0===e?0:-1),s)try{r[0]?.focus()}catch(t){}}return}const s=t.target&&t.target.closest?t.target.closest(".c-toolbar__btn"):null;s&&this.contains(s)&&this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0,detail:{label:s.textContent.trim()}}))}),this.addEventListener("keydown",t=>{if("Escape"===t.key){const e=this.querySelector(".c-toolbar__overflow-menu:not([hidden])");if(e){e.setAttribute("hidden","");const s=this.querySelector(".c-toolbar__overflow-btn");return s&&(s.setAttribute("aria-expanded","false"),s.tabIndex=0,s.focus()),void t.preventDefault()}}const e=this.querySelector(".c-toolbar__overflow-menu:not([hidden])");if(e){const s=Array.from(e.querySelectorAll("[role='menuitem']"));if(s.length)return void z(t,s,{wrap:!0,homeEnd:!0,onNavigate:t=>{s.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e||" "===e){const e=document.activeElement;e&&(t.preventDefault(),e.click())}}})}const s=Array.from(this.querySelectorAll(":scope > .c-toolbar__btn"));s.length&&z(t,s,{wrap:!0,homeEnd:!0,onNavigate:t=>{s.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e||" "===e){const e=document.activeElement;if(e)if(t.preventDefault(),e.classList.contains("c-toolbar__overflow-btn")){const t=e.parentElement&&e.parentElement.querySelector(".c-toolbar__overflow-menu");if(t){const s=t.hasAttribute("hidden");s?t.removeAttribute("hidden"):t.setAttribute("hidden",""),e.setAttribute("aria-expanded",String(s)),e.tabIndex=s?-1:0;const r=Array.from(t.querySelectorAll("[role='menuitem']"));if(r.forEach((t,e)=>t.tabIndex=s&&0===e?0:-1),s)try{r[0]?.focus()}catch(t){}}}else e.click()}}})}),this.addEventListener("focusout",t=>{if(!this.contains(t.relatedTarget)){const t=this.querySelector(".c-toolbar__overflow-menu:not([hidden])");if(t){t.setAttribute("hidden","");const e=this.querySelector(".c-toolbar__overflow-btn");e&&e.setAttribute("aria-expanded","false")}}}))}});c("contour-tree",class extends T{static get updateMode(){return"keyed"}static get observed(){return["items","virtual","item-height","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","selectable","cache-key","no-cache","density"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"},"item-height":{attribute:"item-height"}}}_itemHeight(){const t=Number(this.getAttribute("item-height"));return Number.isFinite(t)&&t>0?t:y("--virtual-list-item-height",28)}_labelToPaths(t,e,s){(t||[]).forEach((t,r)=>{const i=e+"."+r,a=String(t.label||t).trim().slice(0,120);s.has(a)||s.set(a,[]),s.get(a).push(i),Array.isArray(t.children)&&this._labelToPaths(t.children,i,s)})}_restoreExpanded(){const t=this.getAttribute("persist");if(!t||!this._treeData)return;let e=null;try{if("storage"===t&&this.id){const t=localStorage.getItem("contour-tree:"+this.id);null!==t&&(e=JSON.parse(t))}else if("url"===t){const t=new URLSearchParams(window.location.search).get("c-tree");null!==t&&(e=JSON.parse(t))}}catch(t){e=null}if(!Array.isArray(e))return;const s=new Set(e.map(t=>String(t))),r=new Map;this._labelToPaths(this._treeData,"",r);const i=this._expanded||(this._expanded=new Set);for(const t of s){const e=r.get(t);e&&e.forEach(t=>i.add(t))}}_persistExpanded(){const t=this.getAttribute("persist");if(!t||!this._expanded)return;const e=new Map,s=(t,r)=>{(t||[]).forEach((t,i)=>{const a=r+"."+i;e.set(a,t),Array.isArray(t.children)&&s(t.children,a)})};s(this._treeData,"");const r=[];for(const t of this._expanded){const s=e.get(t);s&&r.push(String(s.label||s).trim().slice(0,120))}try{if("storage"===t&&this.id)localStorage.setItem("contour-tree:"+this.id,JSON.stringify(r));else if("url"===t){const t=new URL(window.location.href);t.searchParams.set("c-tree",JSON.stringify(r)),window.history.replaceState(null,"",t.toString())}}catch(t){}}_flatten(t,e,s,r,i){(t||[]).forEach((t,a)=>{const n=e+"."+a,o=Array.isArray(t.children)&&t.children.length>0,c=r.has(n);i.push({node:t,path:n,depth:s,hasChildren:o,expanded:c}),o&&c&&this._flatten(t.children,n,s+1,r,i)})}_renderNodeFlat(t,e,s,r){const i=e.node,a=e.depth,n=document.createElement("div");if(n.className="c-tree__node",n.setAttribute("role","treeitem"),n.setAttribute("aria-level",String(a)),n.setAttribute("aria-setsize",String(s)),n.setAttribute("aria-posinset",String(r)),n.dataset.path=e.path,e.hasChildren){n.setAttribute("aria-expanded",String(e.expanded));const t=document.createElement("div");t.className="c-tree__row"+(i.active?" c-tree__row--active":"")+(i.dir?" c-tree__row--dir":""),t.style.paddingInlineStart=`calc(${a-1} * 1rem * var(--density, 1))`;const s=document.createElement("button");s.className="c-tree__toggle",s.setAttribute("type","button"),s.setAttribute("aria-expanded",String(e.expanded)),s.setAttribute("aria-label",k(this,"toggle","Toggle")),L(s,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),t.appendChild(s);const r=document.createElement("span");r.textContent=i.label,t.appendChild(r),n.appendChild(t)}else{const t=document.createElement("div");if(t.className="c-tree__leaf"+(i.active?" c-tree__row--active":"")+(i.dir?" c-tree__row--dir":""),t.style.paddingInlineStart=`calc(${a} * 1rem * var(--density, 1))`,this.hasAttribute("selectable")){const s=document.createElement("input");s.type="checkbox",s.className="c-tree__select",s.setAttribute("aria-label",k(this,"select","Select")+" "+(i.label||i)),this._selectedTree&&this._selectedTree.has(e.path)&&(s.checked=!0),t.insertBefore(s,t.firstChild)}t.appendChild(document.createTextNode(i.label||i)),n.appendChild(t)}return n}_renderWindow(t,e){if(!this._treeData)return;const s=this._itemHeight(),r=this._expanded||(this._expanded=new Set),i=[];this._flatten(this._treeData,"",1,r,i);const a=i.length,n=t.clientHeight||320,o=Math.ceil(n/s)+6;let c=Math.floor((e||0)/s);c<0&&(c=0),c>Math.max(0,a-o)&&(c=Math.max(0,a-o));const l=Math.min(a,c+o),u=c*s,d=Math.max(0,(a-l)*s);L(t,"");const h=document.createElement("div");h.className="c-tree__spacer c-tree__spacer--top",h.style.height=u+"px",t.appendChild(h);const m=new Map;i.forEach((t,e)=>{const s=t.path.includes(".")?t.path.slice(0,t.path.lastIndexOf(".")):"";let r=m.get(s);r||(r=[],m.set(s,r)),r.push(e)});for(let e=c;e<l;e++){const s=i[e],r=s.path.includes(".")?s.path.slice(0,s.path.lastIndexOf(".")):"",a=m.get(r);t.appendChild(this._renderNodeFlat(t,s,a.length,a.indexOf(e)+1))}const b=document.createElement("div");b.className="c-tree__spacer c-tree__spacer--bottom",b.style.height=d+"px",t.appendChild(b)}render(){this.classList.add("c-tree");const t=Array.from(this.children).filter(t=>!t.classList||!t.classList.contains("c-tree"));if(Zt(this),$t(this,"items"),Xt(this,"tree"))return;const e=Jt(this,"items");if(e&&!t.length)try{const t=JSON.parse(e),s=this.ensure("div.c-tree",()=>{const t=document.createElement("div");return t.className="c-tree",t.setAttribute("role","tree"),t});L(s,""),s.className="c-tree",s.setAttribute("role","tree");if(this.hasAttribute("virtual")){this._treeData=t,this._expanded=this._expanded||new Set,this._treeRoot=s,this._restoreExpanded(),s.style.maxHeight=s.style.maxHeight||"24rem",s.style.overflow="auto";const e=this._treeScrollTop||0;this._renderWindow(s,e);try{s.scrollTop=e}catch(t){}}else{this._treeData=null;const e=(t,r,i,a)=>{const n=r?document.createElement("div"):s;r&&(n.className="c-tree__children",n.setAttribute("role","group"),R()?n.setAttribute("hidden","until-found"):n.setAttribute("hidden","")),t.forEach((s,r)=>{const o=(a||"")+"."+r,c=document.createElement("div");if(c.className="c-tree__node",c.setAttribute("role","treeitem"),c.setAttribute("aria-level",String(i)),c.setAttribute("aria-setsize",String(t.length)),c.setAttribute("aria-posinset",String(r+1)),c.dataset.path=o,s.children){c.setAttribute("aria-expanded","false");const t=document.createElement("div");if(t.className="c-tree__row"+(s.active?" c-tree__row--active":"")+(s.dir?" c-tree__row--dir":""),s.indent){const e=document.createElement("span");e.className="c-tree__indent",e.style.inlineSize=1*s.indent+"rem",t.appendChild(e)}const r=document.createElement("button");r.className="c-tree__toggle",r.setAttribute("type","button"),r.setAttribute("aria-expanded","false"),r.setAttribute("aria-label",k(this,"toggle","Toggle")),L(r,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),t.appendChild(r);const a=document.createElement("span");a.textContent=s.label,t.appendChild(a),c.appendChild(t),e(s.children,c,i+1,o)}else{const t=document.createElement("div");if(t.className="c-tree__leaf"+(s.active?" c-tree__row--active":"")+(s.dir?" c-tree__row--dir":""),s.indent){const e=document.createElement("span");e.className="c-tree__indent",e.style.inlineSize=1*s.indent+"rem",t.appendChild(e)}if(this.hasAttribute("selectable")){const e=document.createElement("input");e.type="checkbox",e.className="c-tree__select",e.setAttribute("aria-label",k(this,"select","Select")+" "+(s.label||s)),this._selectedTree&&this._selectedTree.has(o)&&(e.checked=!0),t.insertBefore(e,t.firstChild)}t.appendChild(document.createTextNode(s.label||s)),c.appendChild(t)}n.appendChild(c)}),r&&r.appendChild(n)};e(t,null,1,"")}this.classList.remove("c-tree"),s.classList.add("c-tree"),s.parentNode!==this&&this.appendChild(s)}catch(t){f(this,"attribute",t)}else e||t.length||Yt(this,"tree")}enhance(){if(this._wiredTreeToggle||(this._wiredTreeToggle=!0,this.addEventListener("click",t=>{if(!this.hasAttribute("virtual"))return;let e=t.target&&t.target.closest?t.target.closest(".c-tree__toggle"):null;if(!e){const s=t.target&&t.target.closest?t.target.closest(".c-tree__row"):null;s&&(e=s.querySelector(":scope > .c-tree__toggle"))}if(!e||!this.contains(e))return;t.stopPropagation();const s=e.closest(".c-tree__node"),r=s&&s.dataset?s.dataset.path:null,i="true"===e.getAttribute("aria-expanded");r&&this._expanded&&(i?this._expanded.delete(r):this._expanded.add(r)),e.setAttribute("aria-expanded",String(!i));const a=e.closest(".c-tree__row");if(a&&a.setAttribute("aria-expanded",String(!i)),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{path:r,expanded:!i}})),this.hasAttribute("virtual")&&this._treeRoot){const t=this._treeRoot;this._treeScrollTop=t.scrollTop||0,this._renderWindow(t,this._treeScrollTop);try{t.scrollTop=this._treeScrollTop}catch(t){}this._persistExpanded()}})),this.hasAttribute("virtual")&&!this._wiredTreeScroll){this._wiredTreeScroll=!0;const t=()=>{const t=this.querySelector(".c-tree");if(!t||t._treeScrollWired)return;t._treeScrollWired=!0;let e=0;const s=()=>{e||(e=requestAnimationFrame(()=>{e=0,this._treeScrollTop=t.scrollTop||0,this._renderWindow(t,this._treeScrollTop);try{t.scrollTop=this._treeScrollTop}catch(t){}}))};t.addEventListener("scroll",s,{passive:!0}),i(this,()=>{t.removeEventListener("scroll",s),e&&cancelAnimationFrame(e)})};if(t(),!this.querySelector(".c-tree")){const e=new MutationObserver(()=>{this.querySelector(".c-tree")&&(t(),e.disconnect())});e.observe(this,{childList:!0,subtree:!0}),i(this,()=>e.disconnect())}}if(this.hasAttribute("virtual")&&!this._wiredTreeDragScroll){this._wiredTreeDragScroll=!0;let t=0,e=0;const s=()=>{if(!e)return void(t=0);const r=this._treeRoot;r&&(r.scrollTop+=8*e,this._treeScrollTop=r.scrollTop,this._renderWindow(r,this._treeScrollTop)),t=requestAnimationFrame(s)};this.addEventListener("dragover",r=>{const i=this._treeRoot;if(!i)return;const a=i.getBoundingClientRect();e=r.clientY<a.top+40?-1:r.clientY>a.bottom-40?1:0,e&&!t&&(t=requestAnimationFrame(s))});const r=()=>{e=0,t&&(cancelAnimationFrame(t),t=0)};this.addEventListener("dragend",r),this.addEventListener("drop",r)}ft(this)}});c("contour-filter-bar",class extends T{static get observed(){return["label","divider","items","input","placeholder","mode","modes","scope","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","count","clearable","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},divider:{attribute:"divider"},items:{attribute:"items"},src:{attribute:"src"},count:{attribute:"count"},clearable:{attribute:"clearable"},scope:{attribute:"scope"}}}render(){if(this.classList.add("c-filter-bar"),Zt(this),$t(this,"items"),Xt(this,"filter-bar"))return;const t=this.getAttribute("label");if(t){this.ensure(".c-filter-bar__label",()=>{const t=document.createElement("span");return t.className="c-filter-bar__label",t}).textContent=t}else{const t=this.querySelector(".c-filter-bar__label");t&&t.remove()}if(this.hasAttribute("divider"))this.ensure(".c-filter-bar__divider",()=>{const t=document.createElement("span");return t.className="c-filter-bar__divider",t});else{const t=this.querySelector(".c-filter-bar__divider");t&&t.remove()}if(this.hasAttribute("input")||this.hasAttribute("placeholder")){let t=this.querySelector(".c-filter-bar__input");t||(t=document.createElement("input"),t.type="search",t.className="c-filter-bar__input",this.appendChild(t));const e=this.getAttribute("placeholder");e&&t.setAttribute("placeholder",e)}else{const t=this.querySelector(".c-filter-bar__input");t&&t.remove()}const e=this.getAttribute("modes");let s=null;if(e)try{s=JSON.parse(e)}catch(t){s=e.split(",").map(t=>t.trim())}if(s||this.hasAttribute("mode")){let e=this.querySelector(".c-filter-bar__modes");e||(e=document.createElement("div"),e.className="c-filter-bar__modes",e.setAttribute("role","toolbar"),e.setAttribute("aria-label",t||"Filter modes"),this.appendChild(e)),L(e,"");const r=this.getAttribute("mode");(Array.isArray(s)?s:["draw","erase","select"]).forEach(t=>{const s="string"==typeof t?t:t.label||t.value||t,i="string"==typeof t?t:t.value||t.label||t,a=document.createElement("button");a.type="button",a.className="c-filter-bar__mode",a.textContent=s,a.dataset.mode=i,r&&r===i&&a.setAttribute("aria-pressed","true"),e.appendChild(a)})}else{const t=this.querySelector(".c-filter-bar__modes");t&&t.remove()}const r=this.getAttribute("scope");if("viewport"===r||"global"===r){Array.from(this.querySelectorAll(".c-filter-bar__scope")).forEach(t=>t.remove());const t=document.createElement("div");t.className="c-filter-bar__modes c-filter-bar__scope",t.setAttribute("role","toolbar"),t.setAttribute("aria-label",k(this,"data-scope","Data scope")),["viewport","global"].forEach(e=>{const s=document.createElement("button");s.type="button",s.className="c-filter-bar__mode c-filter-bar__scope-btn",s.textContent="viewport"===e?"Viewport":"Global",s.dataset.scope=e,r===e&&s.setAttribute("aria-pressed","true"),t.appendChild(s)}),this.appendChild(t)}else{const t=this.querySelector(".c-filter-bar__scope");t&&t.remove()}Array.from(this.querySelectorAll(".c-filter-pill")).forEach(t=>t.remove());const i=Jt(this,"items"),a=Array.from(this.querySelectorAll(":scope > .c-filter-pill"));let n=null;if(a.length)n=a.map(t=>t.textContent.trim()),a.forEach(t=>t.remove());else if(i)try{n=JSON.parse(i)}catch(t){n=null}if(Array.isArray(n)&&n.forEach(t=>{const e=document.createElement("span");e.className="c-filter-pill";const s="object"==typeof t&&null!==t,r="string"==typeof t?t:t.label||t.value||"",i=s?t.key:null,a=s?t.value:t;if(null!=i&&""!==i&&e.setAttribute("key",String(i)),null!=a&&""!==a&&e.setAttribute("value",String(a)),e.textContent=r,!s||!1!==t.removable){const t=document.createElement("button");t.className="c-filter-pill__remove",t.type="button",t.setAttribute("aria-label",k(this,"remove","Remove")+" "+r),t.textContent="×",e.appendChild(t)}this.appendChild(e)}),Array.from(this.querySelectorAll(".c-filter-bar__clear-all")).forEach(t=>t.remove()),this.hasAttribute("clearable")){const t=document.createElement("button");t.type="button",t.className="c-btn c-btn--ghost c-btn--sm c-filter-bar__clear-all";const e=this.getAttribute("count");L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-x" /></svg>'),t.appendChild(document.createTextNode(" "+(e?k(this,"clear-all","Clear all")+" ("+e+")":k(this,"clear-all","Clear all")))),this.appendChild(t)}n||t||Yt(this,"filter-bar")}enhance(){if(xt(this),this._wiredFilterBar)return;this._wiredFilterBar=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-filter-bar__mode"):null;if(e&&this.contains(e))if(e.classList.contains("c-filter-bar__scope-btn")){const t=e.dataset.scope||null;Array.from(this.querySelectorAll(".c-filter-bar__scope-btn")).forEach(t=>t.setAttribute("aria-pressed",String(t===e))),t&&this.setAttribute("scope",t),this.dispatchEvent(new CustomEvent("contour:scope-change",{bubbles:!0,composed:!0,detail:{scope:t}}))}else{const t=e.dataset.mode||e.textContent.trim();Array.from(this.querySelectorAll(".c-filter-bar__mode:not(.c-filter-bar__scope-btn)")).forEach(t=>t.setAttribute("aria-pressed",String(t===e))),this.dispatchEvent(new CustomEvent("contour:mode-change",{bubbles:!0,composed:!0,detail:{mode:t}}))}}),this.addEventListener("keydown",t=>{z(t,Array.from(this.querySelectorAll(".c-filter-bar__mode")),{wrap:!1,onKey:()=>{document.activeElement.click()}})});const t=this.querySelector(".c-filter-bar__input");t&&!t._wiredFilterInput&&(t._wiredFilterInput=!0,t.addEventListener("input",()=>{this.dispatchEvent(new CustomEvent("contour:input",{bubbles:!0,composed:!0,detail:{value:t.value}}))}),t.addEventListener("change",()=>{this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t.value}}))})),this._wiredClearAll||(this._wiredClearAll=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-filter-bar__clear-all"):null;e&&this.contains(e)&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:clear-all",{bubbles:!0,composed:!0,detail:{}})))}))}});c("contour-command",class extends T{static get observed(){return["placeholder","items","recent","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache","anchor"]}static get properties(){return{placeholder:{attribute:"placeholder"},items:{attribute:"items"},recent:{attribute:"recent"},empty:{attribute:"empty"},src:{attribute:"src"}}}render(){if(this.classList.add("c-command"),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"command-palette","Command palette")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),Zt(this),$t(this,"items"),Xt(this,"command"))return;const t=this.getAttribute("placeholder")||"Search…",e=this.ensure(".c-command__input",()=>{const t=document.createElement("div");return t.className="c-command__input",t}),s=this.ensure(".c-command__field",()=>{const t=document.createElement("input");return t.className="c-command__field",t.type="text",t});e.contains(s)||e.appendChild(s),s.type="text",s.placeholder=t,s.setAttribute("aria-label",k(this,"command","Command")),s.setAttribute("role","combobox"),s.setAttribute("aria-autocomplete","list"),s.setAttribute("aria-expanded","true");const r=this.querySelector(".c-command__list");r&&!r.id&&(r.id=o("c-command-list")),r&&r.id&&s.setAttribute("aria-controls",r.id),this._applyCommandAnchor();const i=Jt(this,"items"),a=this.querySelector(".c-command__list"),n=a?Array.from(a.children).filter(t=>t.classList&&t.classList.contains("c-command__item")||t.classList&&t.classList.contains("c-command__group")):[];if(i&&!n.length)try{const t=JSON.parse(i),e=this.ensure(".c-command__list",()=>{const t=document.createElement("div");return t.className="c-command__list",t.setAttribute("role","listbox"),t.id=o("c-command-list"),t});e.setAttribute("role","listbox"),L(e,"");const s=this.getAttribute("recent");if(s)try{const t=JSON.parse(s),r=document.createElement("div");r.className="c-command__group";const i=document.createElement("div");i.className="c-command__group-title",i.textContent=k(this,"recent","Recent"),r.appendChild(i),t.forEach(t=>{const e=document.createElement("div");e.className="c-command__item",e.setAttribute("role","option");const s=document.createElement("div");s.className="c-command__item-body";const i=document.createElement("div");i.className="c-command__item-title",i.textContent="string"==typeof t?t:t.title||t.label||"",s.appendChild(i),e.appendChild(s),r.appendChild(e)}),e.appendChild(r)}catch(t){}t.forEach(t=>{if(t.group){const s=document.createElement("div");s.className="c-command__group";const r=document.createElement("div");r.className="c-command__group-title",r.textContent=t.group,s.appendChild(r);const i=document.createElement("div");if(i.className="c-command__item",i.setAttribute("role","option"),t.icon){const e=document.createElement("span");e.className="c-command__item-icon",e.textContent=t.icon,i.appendChild(e)}const a=document.createElement("div");if(a.className="c-command__item-body",t.title||t.label){const e=document.createElement("div");e.className="c-command__item-title",e.textContent=t.title||t.label,a.appendChild(e)}if(t.hint){const e=document.createElement("span");e.className="c-command__item-hint",e.textContent=t.hint,a.appendChild(e)}if(t.shortcut){const e=document.createElement("kbd");e.className="c-command__item-shortcut",e.textContent=t.shortcut,i.appendChild(e)}i.appendChild(a),s.appendChild(i),e.appendChild(s)}else{const s=document.createElement("div");if(s.className="c-command__item",s.setAttribute("role","option"),t.icon){const e=document.createElement("span");e.className="c-command__item-icon",e.textContent=t.icon,s.appendChild(e)}const r=document.createElement("div");if(r.className="c-command__item-body",t.title||t.label){const e=document.createElement("div");e.className="c-command__item-title",e.textContent=t.title||t.label,r.appendChild(e)}if(t.hint){const e=document.createElement("span");e.className="c-command__item-hint",e.textContent=t.hint,r.appendChild(e)}if(t.shortcut){const e=document.createElement("kbd");e.className="c-command__item-shortcut",e.textContent=t.shortcut,s.appendChild(e)}s.appendChild(r),e.appendChild(s)}})}catch(t){f(this,"attribute",t)}else!i&&r&&r.remove();const c=this.getAttribute("empty");if(c){const t=this.ensure(".c-command__empty",()=>{const t=document.createElement("div");return t.className="c-command__empty",t});t.textContent=c,t.hidden=this.querySelectorAll(".c-command__item").length>0}else{const t=this.querySelector(".c-command__empty");t&&t.remove()}this.ensure(".c-command__status",()=>{const t=document.createElement("div");return t.className="c-command__status",t.setAttribute("role","status"),t}).textContent="",i||r||Yt(this,"command")}_applyCommandAnchor(){const t=this.getAttribute("anchor"),e=t?t.startsWith("#")?document.getElementById(t.slice(1)):document.querySelector(t):null;if(this._commandAnchorEl&&this._commandAnchorEl!==e&&(this._commandAnchorEl.style.removeProperty("anchor-name"),this._commandAnchorEl.removeAttribute("aria-controls"),this._commandAnchorEl.removeAttribute("aria-expanded")),this._commandAnchorEl=e||null,e){const t="--command-"+this.id;e.style.setProperty("anchor-name",t),this.style.setProperty("position-anchor",t),e.setAttribute("aria-controls",this.id),this._commandAnchorDispose||(this._commandAnchorDispose=!0,i(this,()=>{this._commandAnchorEl&&(this._commandAnchorEl.style.removeProperty("anchor-name"),this._commandAnchorEl.removeAttribute("aria-controls"),this._commandAnchorEl.removeAttribute("aria-expanded")),this._commandAnchorDispose=!1}))}else this.style.removeProperty("position-anchor")}show(){if(this.matches(":popover-open"))return void(this.hasAttribute("open")||this.setAttribute("open",""));if("function"==typeof this.showPopover)try{this.showPopover()}catch(t){}this.classList.add("is-open");const t=this.querySelector(".c-command__field");t&&t.setAttribute("aria-expanded","true"),this.hasAttribute("open")||this.setAttribute("open",""),this._setCommandTriggerExpanded(!0)}hide(){if(!this.matches(":popover-open"))return void(this.hasAttribute("open")&&this.removeAttribute("open"));if("function"==typeof this.hidePopover)try{this.hidePopover()}catch(t){}this.classList.remove("is-open");const t=this.querySelector(".c-command__field");t&&t.setAttribute("aria-expanded","false"),this.hasAttribute("open")&&this.removeAttribute("open"),this._setCommandTriggerExpanded(!1)}toggle(){this.matches(":popover-open")?this.hide():this.show()}_setCommandTriggerExpanded(t){const e=this._commandAnchorEl;e&&(e.setAttribute("aria-controls",this.id),e.setAttribute("aria-expanded",String(!!t)))}enhance(){if(this._wiredCommand)return;this._wiredCommand=!0,this.addEventListener("beforetoggle",t=>{if("open"===t.newState){this.classList.add("is-open"),S(this,"contour:open",{});const e=this.querySelector(".c-command__field");if(e){e.setAttribute("aria-expanded","true");try{e.focus()}catch(t){}}this._setCommandTriggerExpanded(!0)}else this.classList.remove("is-open"),S(this,"contour:close",{}),this._setCommandTriggerExpanded(!1)}),this.addEventListener("toggle",t=>{"open"===t.newState&&requestAnimationFrame(()=>{this._applyCommandAnchor()})});const t=()=>this.querySelector(".c-command__field"),e=()=>Array.from(this.querySelectorAll(".c-command__item")),s=()=>e().filter(t=>!t.hidden&&!t.closest("[hidden]"));let r=-1;const i=()=>{if(s().forEach((e,s)=>{if(e.classList.toggle("c-command__item--active",s===r),e.setAttribute("aria-selected",String(s===r)),s===r){e.id||(e.id=o("contour-command-option"));const s=t();s&&s.setAttribute("aria-activedescendant",e.id)}}),r<0){const e=t();e&&e.removeAttribute("aria-activedescendant")}};this.addEventListener("keydown",a=>{const n=t();if(!n||a.target!==n)return;const o=s();if(o.length)if("ArrowDown"===a.key)a.preventDefault(),r=Math.min(r+1,o.length-1),i();else if("ArrowUp"===a.key)a.preventDefault(),r=Math.max(r-1,0),i();else if("Home"===a.key)a.preventDefault(),r=0,i();else if("End"===a.key)a.preventDefault(),r=o.length-1,i();else if("Enter"===a.key){if(a.preventDefault(),r>=0&&o[r]){const t=o[r],s=e().indexOf(t);this.dispatchEvent(new CustomEvent("contour:select",{detail:{index:s,label:t.textContent.trim()},bubbles:!0,composed:!0})),this.hide()}}else"Escape"===a.key&&this.hide()}),this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-command__item"):null;if(s&&this.contains(s)){const t=e().indexOf(s);this.dispatchEvent(new CustomEvent("contour:select",{detail:{index:t,label:s.textContent.trim()},bubbles:!0,composed:!0})),this.hide()}}),this.addEventListener("input",s=>{const a=t();if(!a||s.target!==a)return;const n=a.value.trim().toLowerCase(),o=e();let c=0;o.forEach(t=>{const e=!n||(t.textContent||"").toLowerCase().includes(n);t.hidden=!e,e&&(c+=1)}),this.querySelectorAll(".c-command__group").forEach(t=>{const e=Array.from(t.querySelectorAll(".c-command__item")).some(t=>!t.hidden);t.hidden=!e});const l=o.findIndex(t=>!t.hidden);r=l>=0?0:-1,i();const u=this.querySelector(".c-command__empty");u&&(u.hidden=0!==c);const d=this.querySelector(".c-command__status");d&&(d.textContent=n?`${c} of ${o.length}`:"")})}});c("contour-spatial-filter",class extends T{static get observed(){return["modes","mode","active","bounds","operator","loading","error","retry","cache-key","skeleton","src"]}static get properties(){return{modes:{attribute:"modes"},mode:{attribute:"mode"},active:{attribute:"active"},bounds:{attribute:"bounds"},operator:{attribute:"operator"}}}render(){if(this.classList.add("c-spatial-filter"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"spatial-filter","Spatial filter")),Zt(this),Xt(this,"spatial-filter"))return;const t=this.getAttribute("modes");let e=null;if(t)try{e=JSON.parse(t)}catch(s){e=t.split(",").map(t=>t.trim())}const s=Array.isArray(e)?e:["rect","circle","polygon","clear"];let r=this.querySelector(".c-spatial-filter__modes");r||(r=document.createElement("div"),r.className="c-spatial-filter__modes",r.setAttribute("role","toolbar"),r.setAttribute("aria-label",k(this,"spatial-filter-modes","Spatial filter modes")),this.appendChild(r)),L(r,"");const i=this.getAttribute("mode");i!==this._spatialSeenMode&&(this._spatialMode=null,this._spatialSeenMode=i);const a=null!=this._spatialMode?this._spatialMode:i;s.forEach(t=>{const e="string"==typeof t?t:t.label||t.value||t,s="string"==typeof t?t:t.value||t.label||t,i=document.createElement("button");i.type="button",i.className="c-spatial-filter__mode c-btn c-btn--ghost c-btn--sm";const n={rect:"i-square",circle:"i-circle",polygon:"i-triangle",lasso:"i-lasso",clear:"i-x"}[s];n&&L(i,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+n+'" /></svg>'),i.appendChild(document.createTextNode((n?" ":"")+e)),i.dataset.mode=s,a&&a===s&&i.setAttribute("aria-pressed","true"),r.appendChild(i)});let n=this.querySelector(".c-spatial-filter__operator");n||(n=document.createElement("div"),n.className="c-spatial-filter__operator",this.appendChild(n));const o=this.getAttribute("operator")||"intersects";L(n,"");const c=document.createElement("span");c.textContent=k(this,"operator","Operator")+":",n.appendChild(c);const l=document.createElement("select");l.className="c-spatial-filter__operator-select",l.setAttribute("aria-label",k(this,"operator","Operator")),l.setAttribute("data-contour-label","true"),["intersects","contains","within","disjoint"].forEach(t=>{const e=document.createElement("option");e.value=t,e.textContent=t,t===o&&e.setAttribute("selected",""),l.appendChild(e)}),n.appendChild(l);let u=this.querySelector(".c-spatial-filter__readout");u||(u=document.createElement("div"),u.className="c-spatial-filter__readout",this.appendChild(u));const d=this.getAttribute("bounds");u.textContent=d||"—";let h=this.querySelector(".c-spatial-filter__clear-all");h||(h=document.createElement("button"),h.type="button",h.className="c-spatial-filter__clear-all",this.appendChild(h)),q(h,this,"clear-all","Clear all");const m=this.hasAttribute("active");m!==this._spatialSeenActive&&(this._spatialActive=null,this._spatialSeenActive=m),(null!=this._spatialActive?this._spatialActive:m)?this.classList.add("c-spatial-filter--active"):this.classList.remove("c-spatial-filter--active")}enhance(){this._wiredSpatialFilter||(this._wiredSpatialFilter=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("button"):null;if(!e||!this.contains(e))return;if(e.classList.contains("c-spatial-filter__clear-all"))return this.classList.remove("c-spatial-filter--active"),Array.from(this.querySelectorAll(".c-spatial-filter__mode")).forEach(t=>t.setAttribute("aria-pressed","false")),this._spatialActive=!1,this._spatialMode=null,this.dispatchEvent(new CustomEvent("contour:clear",{bubbles:!0,composed:!0,detail:{}})),void this.dispatchEvent(new CustomEvent("contour:spatial-filter",{bubbles:!0,composed:!0,detail:{action:"clear-all"}}));const s=e.closest(".c-spatial-filter__mode");if(!s)return;const r=s.dataset.mode||s.textContent.trim();if("clear"===r)return this.classList.remove("c-spatial-filter--active"),Array.from(this.querySelectorAll(".c-spatial-filter__mode")).forEach(t=>t.setAttribute("aria-pressed","false")),this._spatialActive=!1,this._spatialMode=null,void this.dispatchEvent(new CustomEvent("contour:clear",{bubbles:!0,composed:!0,detail:{}}));this.classList.add("c-spatial-filter--active"),Array.from(this.querySelectorAll(".c-spatial-filter__mode")).forEach(t=>t.setAttribute("aria-pressed",String(t===s))),this._spatialActive=!0,this._spatialMode=r,this.dispatchEvent(new CustomEvent("contour:draw-start",{bubbles:!0,composed:!0,detail:{mode:r}})),this.dispatchEvent(new CustomEvent("contour:spatial-filter",{bubbles:!0,composed:!0,detail:{action:"draw-start",mode:r}}))}),this.addEventListener("change",t=>{const e=t.target;e&&e.classList.contains("c-spatial-filter__operator-select")&&(this.setAttribute("operator",e.value),this.dispatchEvent(new CustomEvent("contour:spatial-filter",{bubbles:!0,composed:!0,detail:{action:"operator",operator:e.value}})))}),this.addEventListener("keydown",t=>{z(t,Array.from(this.querySelectorAll(".c-spatial-filter__mode")),{wrap:!1,onKey:()=>{document.activeElement.click()}})}))}});c("contour-avatar",class extends T{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(t=>{t.startsWith("c-avatar--")&&this.classList.remove(t)});const t=this.getAttribute("name"),e=this.getAttribute("size");e&&this.classList.add("c-avatar--"+e);const s=this.getAttribute("variant");s&&this.classList.add("c-avatar--"+s);const r=this.querySelector("img.c-avatar__img");r&&r.remove();const i=this.querySelector(".c-avatar__status");i&&i.remove();const a=this.getAttribute("src");if(a){this.textContent="";const e=document.createElement("img");e.className="c-avatar__img",e.src=a,e.alt=t||"",e.loading="lazy",e.decoding="async",e.addEventListener("error",()=>{if(e.remove(),t){const e=t.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2);this.textContent=e}}),this.appendChild(e)}else if(t){const e=t.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2);this.querySelector("img.c-avatar__img"),this.textContent=e}const n=this.getAttribute("status");if(n){const t=document.createElement("span");t.className="c-avatar__status c-avatar__status--"+n,t.setAttribute("aria-hidden","true"),this.appendChild(t)}}});c("contour-badge",class extends T{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(t=>{t.startsWith("c-badge--")&&this.classList.remove(t)});const t=this.getAttribute("variant");t&&this.classList.add("c-badge--"+t);const e=this.getAttribute("size");e&&this.classList.add("c-badge--"+e);const s=this.getAttribute("label");if(s){let t=null;for(const e of this.childNodes)if(3===e.nodeType){t=e;break}t?t.nodeValue=s:this.insertBefore(document.createTextNode(s),this.firstChild)}if(w(this,"removable"))this.ensure(".c-badge__remove",()=>{const t=document.createElement("button");return t.className="c-badge__remove",t.type="button",t.setAttribute("aria-label",k(this,"remove","Remove")),t.textContent="×",t});else{const t=this.querySelector(".c-badge__remove");t&&t.remove()}}enhance(){xt(this)}});c("contour-chip",class extends T{static get observed(){return["variant","key","value","live"]}static get properties(){return{variant:{attribute:"variant"},key:{attribute:"key"},value:{attribute:"value"},live:{attribute:"live",type:Boolean}}}render(){this.classList.add("c-chip"),w(this,"live")&&!this.hasAttribute("role")?this.setAttribute("role","status"):!w(this,"live")&&"status"===this.getAttribute("role")&&this._autoChipRole&&this.removeAttribute("role"),this._autoChipRole=w(this,"live"),Array.from(this.classList).forEach(t=>{t.startsWith("c-chip--")&&this.classList.remove(t)});const t=this.getAttribute("variant");t&&this.classList.add("c-chip--"+t);const e=this.getAttribute("key"),s=this.getAttribute("value");if(e){this.ensure(".c-chip__key",()=>{const t=document.createElement("span");return t.className="c-chip__key",t}).textContent=e}else{const t=this.querySelector(".c-chip__key");t&&t.remove()}if(s){this.ensure(".c-chip__value",()=>{const t=document.createElement("span");return t.className="c-chip__value",t}).textContent=s}else{const t=this.querySelector(".c-chip__value");t&&t.remove()}}});c("contour-tag",class extends T{static get observed(){return["label","removable","variant","live"]}static get properties(){return{label:{attribute:"label"},removable:{attribute:"removable",type:Boolean},variant:{attribute:"variant"},live:{attribute:"live",type:Boolean}}}render(){this.classList.add("c-tag"),w(this,"live")&&!this.hasAttribute("role")?this.setAttribute("role","status"):!w(this,"live")&&"status"===this.getAttribute("role")&&this._autoTagRole&&this.removeAttribute("role"),this._autoTagRole=w(this,"live"),Array.from(this.classList).forEach(t=>{t.startsWith("c-tag--")&&this.classList.remove(t)});const t=this.getAttribute("variant");t&&this.classList.add("c-tag--"+t);const e=this.getAttribute("label");if(e){let t=null;for(const e of this.childNodes)if(3===e.nodeType){t=e;break}t?t.nodeValue=e+" ":this.insertBefore(document.createTextNode(e+" "),this.firstChild)}if(w(this,"removable"))this.ensure(".c-tag__remove",()=>{const t=document.createElement("button");return t.className="c-tag__remove",t.type="button",t.setAttribute("aria-label",k(this,"remove","Remove")),t.textContent="×",t});else{const t=this.querySelector(".c-tag__remove");t&&t.remove()}}enhance(){xt(this)}});c("contour-dot",class extends T{static get observed(){return["variant","live"]}static get properties(){return{variant:{attribute:"variant"},live:{attribute:"live",type:Boolean}}}render(){this.classList.add("c-dot"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","status indicator"),Array.from(this.classList).forEach(t=>{t.startsWith("c-dot--")&&this.classList.remove(t)});const t=this.getAttribute("variant");t&&this.classList.add("c-dot--"+t),w(this,"live")?this.classList.add("c-dot--live"):this.classList.remove("c-dot--live")}});c("contour-pill",class extends T{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"),w(this,"live")&&!this.hasAttribute("role")?this.setAttribute("role","status"):!w(this,"live")&&"status"===this.getAttribute("role")&&this._autoPillRole&&this.removeAttribute("role"),this._autoPillRole=w(this,"live"),Array.from(this.classList).forEach(t=>{t.startsWith("c-pill--")&&this.classList.remove(t)});const t=this.getAttribute("variant");t&&this.classList.add("c-pill--"+t);const e=this.getAttribute("label");e&&(this.textContent=e),w(this,"live")?this.classList.add("c-pill--live"):this.classList.remove("c-pill--live")}});c("contour-kbd",class extends T{static get observed(){return["key"]}static get properties(){return{key:{attribute:"key"}}}render(){this.classList.add("c-kbd");const t=this.getAttribute("key");t&&(this.textContent=t)}});c("contour-spinner",class extends T{static get observed(){return["size"]}static get properties(){return{size:{attribute:"size"}}}render(){this.classList.add("c-spinner"),Array.from(this.classList).forEach(t=>{t.startsWith("c-spinner--")&&this.classList.remove(t)});const t=this.getAttribute("size");t&&this.classList.add("c-spinner--"+t),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"loading","Loading"))}});c("contour-skeleton",class extends T{static get observed(){return["size","shimmer"]}static get properties(){return{size:{attribute:"size"},shimmer:{attribute:"shimmer",type:Boolean}}}render(){this.classList.add("c-skeleton"),Array.from(this.classList).forEach(t=>{t.startsWith("c-skeleton--")&&this.classList.remove(t)});const t=this.getAttribute("size");t&&this.classList.add("c-skeleton--"+t),this.hasAttribute("aria-hidden")||this.setAttribute("aria-hidden","true");const e=this.getAttribute("shimmer");w(this,"shimmer")&&"off"!==e?this.classList.remove("c-skeleton--static"):this.classList.add("c-skeleton--static")}});c("contour-mark",class extends T{static get observed(){return["src","icon","label"]}static get properties(){return{src:{attribute:"src"},icon:{attribute:"icon"},label:{attribute:"label"}}}render(){this.classList.add("c-mark");const t=this.getAttribute("src")||this.getAttribute("icon");if(t){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),L(e,'<use href="'+v(t)+'" />'),this.appendChild(e)}const e=this.getAttribute("label");if(e&&!this.querySelector("[data-mark-label]")){const t=document.createElement("span");t.className="c-mark__label",t.setAttribute("data-mark-label",""),t.textContent=e,this.appendChild(t)}}});c("contour-loading",class extends T{static get observed(){return["label"]}static get properties(){return{label:{attribute:"label"}}}render(){this.classList.add("c-loading"),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"),this.ensure(".c-spinner",()=>{const t=document.createElement("span");return t.className="c-spinner",t.setAttribute("aria-hidden","true"),t});const t=this.getAttribute("label")||"Loading";let e=this.querySelector("[data-loading-label]");e||(e=document.createElement("span"),e.className="visually-hidden",e.setAttribute("data-loading-label",""),this.appendChild(e)),e.textContent=t,this.hasAttribute("aria-label")||this.setAttribute("aria-label",t)}});c("contour-elevation",class extends T{render(){this.classList.add("c-elevation")}});c("contour-filter-pill",class extends T{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 t=this.getAttribute("key"),e=this.getAttribute("value");if(t){this.ensure(".c-filter-pill__key",()=>{const t=document.createElement("span");return t.className="c-filter-pill__key",t}).textContent=t}else{const t=this.querySelector(".c-filter-pill__key");t&&t.remove()}if(e){this.ensure(".c-filter-pill__value",()=>{const t=document.createElement("span");return t.className="c-filter-pill__value",t}).textContent=e}else{const t=this.querySelector(".c-filter-pill__value");t&&t.remove()}if(w(this,"removable"))this.ensure(".c-filter-pill__remove",()=>{const t=document.createElement("button");return t.className="c-filter-pill__remove",t.type="button",t.setAttribute("aria-label",k(this,"remove-filter","Remove filter")),t.textContent="×",t});else{const t=this.querySelector(".c-filter-pill__remove");t&&t.remove()}}enhance(){xt(this)}});c("contour-datamark",class extends T{static get observed(){return["value","unit","label","format","locale"]}static get properties(){return{value:{attribute:"value"},unit:{attribute:"unit"},label:{attribute:"label"},format:{attribute:"format"},locale:{attribute:"locale"}}}render(){this.classList.add("c-datamark");const t=this.getAttribute("value"),e=this.getAttribute("unit"),s=this.getAttribute("label"),r=this.getAttribute("format"),i=this.getAttribute("locale"),a=t||s;if(a){const s=t?B(t,r,i,e):a;if(this.textContent=s,e&&t){const t=document.createElement("span");t.className="u-subtle",t.textContent=" "+e,this.appendChild(t)}}}});c("contour-destructive-hint",class extends T{static get observed(){return["text"]}static get properties(){return{text:{attribute:"text"}}}render(){this.classList.add("c-destructive-hint");const t=this.getAttribute("text");t&&(this.textContent=t)}});c("contour-icon-badge",class extends T{static get observed(){return["icon"]}static get properties(){return{icon:{attribute:"icon"}}}render(){this.classList.add("c-icon-badge");const t=this.getAttribute("icon");if(t){const e=String(t).replace(/[^a-zA-Z0-9_-]/g,"");e&&!e.startsWith("i-")&&"undefined"!=typeof console&&console.warn&&console.warn("ContourIconBadge: icon '"+t+"' may not exist in the sprite (expected i-* name).");const s=this.querySelector("svg"),r=s||document.createElementNS("http://www.w3.org/2000/svg","svg");if(s){const t=r.querySelector("use");t&&t.setAttribute("href","#"+e)}else{r.setAttribute("aria-hidden","true");const t=document.createElementNS("http://www.w3.org/2000/svg","use");t.setAttribute("href","#"+e),r.appendChild(t),this.appendChild(r)}}else{const t=this.querySelector("svg");t&&t.remove()}}});c("contour-live-badge",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","status"),Array.from(this.classList).forEach(t=>{t.startsWith("c-live-badge--")&&this.classList.remove(t)});const t=this.getAttribute("state");t?this.classList.add("c-live-badge--"+t):w(this,"live")&&this.classList.add("c-live-badge--connected");const e=this.getAttribute("label");e&&!this.hasChildNodes()&&(this.textContent=e)}});c("contour-skeleton-group",class extends T{static get observed(){return["count","size","shimmer"]}static get properties(){return{count:{attribute:"count",type:Number},size:{attribute:"size"},shimmer:{attribute:"shimmer",type:Boolean}}}render(){this.classList.add("c-skeleton-group");const t=Math.max(0,parseInt(this.getAttribute("count")||"3",10)||3),e=this.getAttribute("size"),s=this.getAttribute("shimmer");Array.from(this.querySelectorAll(".c-skeleton")).forEach(t=>t.remove());for(let r=0;r<t;r++){const t=document.createElement("div");t.className="c-skeleton",e&&t.classList.add("c-skeleton--"+e),t.setAttribute("aria-hidden","true"),w(this,"shimmer")&&"off"!==s?t.classList.remove("c-skeleton--static"):t.classList.add("c-skeleton--static"),this.appendChild(t)}}});c("contour-avatar-group",class extends T{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 t=this.getAttribute("items"),e=parseInt(this.getAttribute("max")||"4",10)||4;if(Array.from(this.querySelectorAll(".c-avatar, .c-avatar-group__overflow")).forEach(t=>t.remove()),t)try{const s=JSON.parse(t);if(s.slice(0,e).forEach(t=>{const e=document.createElement("span");e.className="c-avatar";const s="string"==typeof t?t:t.name||t.label||"";if(e.textContent=s.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2),"object"==typeof t&&t.color){const s=_(t.color);s&&(e.style.background=s,e.dataset.color=s)}this.appendChild(e)}),s.length>e){const t=document.createElement("span");t.className="c-avatar c-avatar-group__overflow";const r=s.length-e;t.textContent="+"+r,t.setAttribute("aria-label","+"+r+" more"),this.appendChild(t)}}catch(t){f(this,"attribute",t)}}});c("contour-divider",class extends T{static get observed(){return["label","orientation"]}static get properties(){return{label:{attribute:"label"},orientation:{attribute:"orientation"}}}render(){this.classList.add("c-divider"),this.hasAttribute("role")||this.setAttribute("role","separator");const t=this.getAttribute("orientation")||"horizontal";this.classList.add("c-divider--"+t);const e=this.getAttribute("label");if(e){this.ensure(".c-divider__label",()=>{const t=document.createElement("span");return t.className="c-divider__label",t}).textContent=e}}});c("contour-status-light",class extends T{static get observed(){return["status","label"]}static get properties(){return{status:{attribute:"status"},label:{attribute:"label"}}}render(){this.classList.add("c-status-light");const t=this.getAttribute("status")||"neutral";this.classList.add("c-status-light--"+t),this.hasAttribute("role")||this.setAttribute("role","img");const e=this.getAttribute("label");if(e&&!this.hasAttribute("aria-label")?this.setAttribute("aria-label",e):e||this.hasAttribute("aria-label")||this.setAttribute("aria-label",t),e){this.ensure(".c-status-light__label",()=>{const t=document.createElement("span");return t.className="c-status-light__label",t}).textContent=e}}});c("contour-badge-overflow",class extends T{static get observed(){return["count","max"]}static get properties(){return{count:{attribute:"count"},max:{attribute:"max"}}}render(){this.classList.add("c-badge-overflow");const t=Number(this.getAttribute("count")||0),e=Number(this.getAttribute("max")||3),s=Math.max(0,t-e),r=this.querySelector(".c-badge-overflow__more");if(r&&r.remove(),s>0){const t=document.createElement("span");t.className="c-badge c-badge-overflow__more",t.textContent="+"+s,this.appendChild(t)}}});c("contour-tooltip",class extends T{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"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"tooltip","Tooltip")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),this.hasAttribute("role")||this.setAttribute("role","tooltip"),this.id||(this.id=o("tip"));const t=this.getAttribute("text");null===t||this.hasChildNodes()||(this.textContent=t)}enhance(){if(this._wiredTooltip)return;this._wiredTooltip=!0;const t=this.getAttribute("anchor");if(t){let e=null;e=t.startsWith("#")?document.getElementById(t.slice(1)):document.querySelector(t),e&&(e.setAttribute("popovertarget",this.id||(this.id=o("tip"))),e.setAttribute("aria-describedby",this.id))}const e=this.delay&&this.delay>0?this.delay:0,s=this.getAttribute("anchor");let r=null;s&&(r=s.startsWith("#")?document.getElementById(s.slice(1)):document.querySelector(s));const a="--tooltip-"+(this.id||(this.id=o("tip")));(()=>{r&&(r.style.setProperty("anchor-name",a),this.style.setProperty("position-anchor",a),this.style.setProperty("position-area","top"))})();const n="function"==typeof this.showPopover;let c=null,l=null;const u=()=>{if(n)try{this.showPopover()}catch(t){}else this.classList.add("is-open"),this.style.zIndex="var(--z-tooltip)";try{requestAnimationFrame(x)}catch(t){x()}},d=()=>{if(l&&(clearTimeout(l),l=null),n)try{this.hidePopover()}catch(t){}else this.classList.remove("is-open"),this.style.removeProperty("z-index")},h=()=>{c&&clearTimeout(c),e>0?c=setTimeout(u,e):u()},m=()=>{c&&(clearTimeout(c),c=null),l&&clearTimeout(l),l=setTimeout(d,300)};this.addEventListener("pointerenter",()=>{l&&(clearTimeout(l),l=null)}),this.addEventListener("pointerleave",m),i(this,()=>{r&&r.style.removeProperty("anchor-name")});const b=this.getAttribute("trigger")||"hover",p=s?s.startsWith("#")?document.getElementById(s.slice(1)):document.querySelector(s):null,g=p||this,_=()=>{"click"!==b&&h()},v=()=>{"click"!==b&&m()},y=()=>{"click"!==b&&h()},f=()=>{"click"!==b&&m()},A=t=>{p&&p.hasAttribute("popovertarget")?"click"!==b&&t&&t.preventDefault&&t.preventDefault():"click"!==b&&"hover"!==b||(this.matches(":popover-open")?m():h())},E=()=>{"click"!==b&&h()},w=()=>{"click"!==b&&setTimeout(m,1500)};g.addEventListener("mouseenter",_),g.addEventListener("mouseleave",v),g.addEventListener("focus",y),g.addEventListener("blur",f),g.addEventListener("click",A),g.addEventListener("touchstart",E,{passive:!0}),g.addEventListener("touchend",w,{passive:!0});const x=()=>{try{const t=this.getBoundingClientRect();t.right>window.innerWidth?this.classList.add("c-tooltip--flip-x"):this.classList.remove("c-tooltip--flip-x"),t.bottom>window.innerHeight?this.classList.add("c-tooltip--flip-y"):this.classList.remove("c-tooltip--flip-y")}catch(t){}};i(this,()=>{g.removeEventListener("mouseenter",_),g.removeEventListener("mouseleave",v),g.removeEventListener("focus",y),g.removeEventListener("blur",f),g.removeEventListener("click",A),g.removeEventListener("touchstart",E),g.removeEventListener("touchend",w),c&&clearTimeout(c)}),this.addEventListener("toggle",t=>{const e=t.target;if(e&&e===this){const t=this.matches(":popover-open");S(this,t?"contour:open":"contour:close",{open:t})}})}});c("contour-progress",class extends T{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 t=this.getAttribute("value"),e=this.getAttribute("min"),s=this.getAttribute("max"),r=null!==e?Number(e):0,i=null!==s?Number(s):100,a=i-r||1;if(null===t)this.style.removeProperty("--progress"),this.classList.add("c-progress--indeterminate"),this.getAttribute("aria-valuenow")===this._progressAriaValue&&this.removeAttribute("aria-valuenow"),this._progressAriaValue=null;else{this.classList.remove("c-progress--indeterminate");const e=Number(t);let s;s=Number.isFinite(e)?e<=1&&t.includes(".")?100*e:(e-r)/a*100:0,s=Math.max(0,Math.min(100,s)),this.style.setProperty("--progress",s+"%"),this.classList.toggle("c-progress--complete",s>=100);const n=Number.isFinite(e)?Math.max(r,Math.min(i,e)):r,o=this._progressAriaValue;this.hasAttribute("aria-valuenow")&&this.getAttribute("aria-valuenow")!==o||(this.setAttribute("aria-valuenow",String(n)),this._progressAriaValue=String(n))}this.ensure(".c-progress__bar",()=>{const t=document.createElement("span");return t.className="c-progress__bar",t}),this.hasAttribute("role")||this.setAttribute("role","progressbar");const n=this.getAttribute("label");if(this.hasAttribute("aria-label")||this.setAttribute("aria-label",n||"Progress"),null!==e?this.setAttribute("aria-valuemin",e):this.hasAttribute("aria-valuemin")||this.setAttribute("aria-valuemin","0"),null!==s?this.setAttribute("aria-valuemax",s):this.hasAttribute("aria-valuemax")||this.setAttribute("aria-valuemax","100"),this.hasAttribute("aria-valuenow")){const t=Number(this.getAttribute("aria-valuenow"));Number.isFinite(t)&&this.setAttribute("aria-valuenow",String(Math.max(r,Math.min(i,t))))}if(w(this,"paused")?this.classList.add("c-progress--paused"):Array.from(this.classList).forEach(t=>{"c-progress--paused"===t&&this.classList.remove(t)}),w(this,"pausable")){const t=w(this,"paused"),e=this.ensure(".c-progress__pause",()=>{const t=document.createElement("button");return t.className="c-progress__pause",t.type="button",t});e.setAttribute("aria-label",t?"Resume":"Pause"),e.textContent=t?"▶":"⏸"}else{const t=this.querySelector(".c-progress__pause");t&&t.remove()}}enhance(){this._wiredProgress||(this._wiredProgress=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-progress__pause"):null;if(!e||!this.contains(e))return;t.preventDefault();const s=!w(this,"paused");this.toggleAttribute("paused",s),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{paused:s}}))}))}});c("contour-version-banner",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("message")||"Version banner"),Array.from(this.children).forEach(t=>t.remove());const t=this.getAttribute("message");if(t){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),L(e,'<use href="#i-info" />'),this.appendChild(e);const s=document.createElement("span");s.textContent=t,this.appendChild(s)}const e=this.getAttribute("link"),s=this.getAttribute("href");if(e&&s){const t=document.createElement("a");t.className="c-version-banner__link",t.href=v(s),t.textContent=e,this.appendChild(t)}if(w(this,"dismissible")){const t=document.createElement("button");t.className="c-version-banner__dismiss",t.type="button",t.setAttribute("aria-label",k(this,"dismiss","Dismiss")),t.textContent="×",this.appendChild(t)}}enhance(){this._wiredVersionBanner||(this._wiredVersionBanner=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-version-banner__dismiss"):null;e&&this.contains(e)&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})),this.remove())}))}});c("contour-banner",class extends T{static get observed(){return["message","variant"]}static get properties(){return{message:{attribute:"message"},variant:{attribute:"variant"}}}render(){this.classList.add("c-banner");const t=this.getAttribute("variant");Array.from(this.classList).forEach(t=>{t.startsWith("c-banner--")&&this.classList.remove(t)}),t&&["info","success","warning","danger","error"].includes(t)&&this.classList.add("c-banner--"+t);const e=C(t);let s=this.querySelector(".c-banner__icon");e?(s||(s=document.createElement("span"),s.className="c-banner__icon"),L(s,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(e).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'),this.firstChild!==s&&this.prepend(s)):s&&s.remove();const r=this.getAttribute("message");if(r){this.ensure(".c-banner__message",()=>{const t=document.createElement("span");return t.className="c-banner__message",t}).textContent=r}}});function _e(t){return!!t&&"function"==typeof t.showPopover&&"function"==typeof t.hidePopover}function ve(t,e,s,r){if(!t||!e)return;const i=e.getBoundingClientRect(),a=t.offsetWidth||0,n=t.offsetHeight||0;let o=i.bottom+s;o+n>window.innerHeight&&i.top-s-n>=0&&(o=i.top-s-n);let c=r?i.right-a:i.left;c=Math.max(0,Math.min(c,Math.max(0,window.innerWidth-a))),t.style.position="fixed",t.style.inset="auto",t.style.margin="0",t.style.top=o+"px",t.style.left=c+"px"}function ye(t){const e=t._menuReposition;e&&(window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e),t._menuReposition=null)}function fe(t,e,s,r,i){if(e)if(r){if(e.hidden=!1,_e(e)){e.style.removeProperty("margin");const r=getComputedStyle(e),a=parseFloat(r.marginBlockStart||r.marginTop)||0;try{e.showPopover()}catch(t){}ve(e,s(),a,i),function(t,e,s,r,i){ye(t);const a=()=>{e.hidden||ve(e,s(),r,i)};t._menuReposition=a,window.addEventListener("scroll",a,!0),window.addEventListener("resize",a)}(t,e,s,a,i)}}else{if(_e(e)&&e.matches(":popover-open"))try{e.hidePopover()}catch(t){}ye(t),e.hidden=!0}}c("contour-pull-to-refresh",class extends T{static get observed(){return["threshold"]}static get properties(){return{threshold:{attribute:"threshold"}}}render(){this.classList.add("c-pull-to-refresh"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"label","Pull to refresh"));const t=this.ensure(".c-pull-to-refresh__indicator",()=>{const t=document.createElement("div");return t.className="c-pull-to-refresh__indicator",t});t.innerHTML="";const e=document.createElement("span");e.className="c-pull-to-refresh__label",e.setAttribute("aria-live","polite"),e.textContent=this._ptrError?this._ptrError:this._ptrRefreshing?k(this,"refreshing","Refreshing…"):k(this,"label","Pull to refresh"),t.appendChild(e);const s=document.createElement("button");s.type="button",s.className="c-pull-to-refresh__btn",s.textContent=k(this,"refresh","Refresh"),t.appendChild(s),t.parentNode!==this&&this.prepend(t),this.classList.toggle("is-refreshing",!!this._ptrRefreshing),this.classList.toggle("has-error",!!this._ptrError),this.setAttribute("aria-busy",String(!!this._ptrRefreshing))}complete(){this._ptrRefreshing=!1,this._ptrError=null,this.style.removeProperty("--ptr-offset"),this.requestRender()}fail(t){this._ptrRefreshing=!1,this._ptrError=String(t||k(this,"error","Refresh failed")),this.style.removeProperty("--ptr-offset"),this.requestRender(),this.dispatchEvent(new CustomEvent("contour:error",{bubbles:!0,composed:!0,detail:{message:this._ptrError}}))}_refresh(){this._ptrRefreshing||(this._ptrRefreshing=!0,this._ptrError=null,this.style.removeProperty("--ptr-offset"),this.requestRender(),this.dispatchEvent(new CustomEvent("contour:refresh",{bubbles:!0,composed:!0})))}enhance(){if(this._wiredPullToRefresh)return;this._wiredPullToRefresh=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-pull-to-refresh__btn"):null;e&&this.contains(e)&&this._refresh()});let t=0,e=!1,s=0;this.addEventListener("pointerdown",r=>{if(!(this._ptrRefreshing||this.scrollTop>0||r.target&&r.target.closest&&r.target.closest(".c-pull-to-refresh__btn"))){t=r.clientY,e=!0,s=0;try{this.setPointerCapture(r.pointerId)}catch(t){}}}),this.addEventListener("pointermove",r=>{if(!e)return;const i=r.clientY-t;i>0&&(s=Math.min(120,.6*i),this.style.setProperty("--ptr-offset",s+"px"))});const r=()=>{if(!e)return;e=!1;const t=Number(this.getAttribute("threshold"))||60;s>=t?this._refresh():this.style.removeProperty("--ptr-offset"),s=0};this.addEventListener("pointerup",r),this.addEventListener("pointercancel",r)}});c("contour-dropdown",class extends T{static get observed(){return["label","items","empty"]}static get properties(){return{label:{attribute:"label"},items:{attribute:"items"}}}render(){this.classList.add("c-dropdown"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"dropdown","Dropdown"));const t=this.ensure(".c-dropdown__trigger",()=>{const t=document.createElement("button");return t.className="c-dropdown__trigger c-btn c-btn--sm",t.type="button",t});t.textContent=this.getAttribute("label")||"Menu",t.setAttribute("aria-haspopup","menu"),t.setAttribute("aria-expanded","false");const e=this.ensure(".c-dropdown__menu",()=>{const t=document.createElement("div");return t.className="c-dropdown__menu c-menu",t.setAttribute("role","menu"),t.hidden=!0,_e(t)&&t.setAttribute("popover","manual"),t});e.id||(e.id=(this.id||o("dd"))+"-menu"),t.setAttribute("aria-controls",e.id);const s=Array.from(this.querySelectorAll(":scope > .c-menu__item")),r=this.getAttribute("items");if(s.length)e.innerHTML="",s.forEach(t=>{e.appendChild(t)});else if(r){const t=Qt(this,"items",f);e.innerHTML="",0===t.length?Yt(this,"dropdown"):t.forEach(t=>{const s=document.createElement("button");s.className="c-menu__item",s.type="button",s.setAttribute("role","menuitem"),s.textContent="string"==typeof t?t:t.label||t.title||"",e.appendChild(s)})}e.parentNode!==this&&this.appendChild(e),t.parentNode!==this&&this.insertBefore(t,e)}enhance(){if(this._wiredDropdown)return;this._wiredDropdown=!0;const t=()=>this.querySelector(".c-dropdown__trigger"),e=()=>this.querySelector(".c-dropdown__menu");this.addEventListener("click",s=>{const r=t(),i=e(),a=s.target&&s.target.closest?s.target.closest(".c-menu__item"):null;if(a&&i&&i.contains(a)&&!i.hidden){const e=Array.from(i.querySelectorAll(".c-menu__item")).indexOf(a);if(this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:e,value:a.textContent}})),fe(this,i,t,!1,!1),r){r.setAttribute("aria-expanded","false");try{r.focus()}catch(t){}}return}if((s.target===r||r&&r.contains(s.target))&&i){const e=i.hidden;if(fe(this,i,t,e,!1),r.setAttribute("aria-expanded",String(e)),e){i.id||(i.id=(this.id||o("dd"))+"-menu"),r.setAttribute("aria-controls",i.id);const t=i.querySelector(".c-menu__item");if(t)try{t.focus()}catch(t){}}}});const s=s=>{const r=e(),i=t();!r||r.hidden||this.contains(s.target)||(fe(this,r,t,!1,!1),i&&i.setAttribute("aria-expanded","false"))};document.addEventListener("click",s),i(this,()=>document.removeEventListener("click",s)),i(this,()=>ye(this));const r=s=>{const r=e(),i=t();if("Escape"===s.key&&r&&!r.hidden){if(s.preventDefault(),fe(this,r,t,!1,!1),i){i.setAttribute("aria-expanded","false");try{i.focus()}catch(t){}}return}if("ArrowDown"===s.key&&s.target===i&&r&&r.hidden){s.preventDefault(),fe(this,r,t,!0,!1),i.setAttribute("aria-expanded","true"),r.id||(r.id=(this.id||o("dd"))+"-menu"),i.setAttribute("aria-controls",r.id);const e=r.querySelector(".c-menu__item");if(e)try{e.focus()}catch(t){}return}if(!r||r.hidden)return;const a=Array.from(r.querySelectorAll(".c-menu__item"));if(1===s.key.length&&!s.ctrlKey&&!s.metaKey&&!s.altKey){const t=(this._ddTypeaheadQuery||"")+s.key.toLowerCase();this._ddTypeaheadQuery=t,clearTimeout(this._ddTypeaheadTimer),this._ddTypeaheadTimer=setTimeout(()=>{this._ddTypeaheadQuery=""},800);const e=a.find(e=>e.textContent.toLowerCase().startsWith(t));e&&e.focus()}z(s,a,{wrap:!0,enter:!1,onKey:t=>{"Enter"!==t&&" "!==t||document.activeElement.click()}})},a=s=>{const r=e();if(r&&!r.hidden&&!this.contains(s.relatedTarget)){fe(this,r,t,!1,!1);const e=t();e&&e.setAttribute("aria-expanded","false")}};this.addEventListener("focusout",a),i(this,()=>this.removeEventListener("focusout",a)),document.addEventListener("keydown",r),i(this,()=>document.removeEventListener("keydown",r))}});c("contour-split-button",class extends T{static get observed(){return["label","menu","empty"]}static get properties(){return{label:{attribute:"label"},menu:{attribute:"menu"}}}render(){this.classList.add("c-split-button");const t=this.ensure(".c-split-button__main",()=>{const t=document.createElement("button");return t.className="c-btn c-split-button__main",t.type="button",t});t.textContent=this.getAttribute("label")||k(this,"action","Action");const e=this.ensure(".c-split-button__toggle",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--icon c-split-button__toggle",t.type="button",t.setAttribute("aria-label",k(this,"more-options","More options")),t.textContent="▾",t}),s=this.ensure(".c-split-button__menu",()=>{const t=document.createElement("div");return t.className="c-menu c-split-button__menu",t.setAttribute("role","menu"),t.hidden=!0,_e(t)&&t.setAttribute("popover","manual"),t});s.id||(s.id=(this.id||o("split"))+"-menu"),e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-controls",s.id),e.setAttribute("aria-expanded",String(!s.hidden));if(this.getAttribute("menu")){const t=Qt(this,"menu",f);s.innerHTML="",0===t.length?Yt(this,"split-button"):t.forEach(t=>{const e=document.createElement("button");e.className="c-menu__item",e.type="button",e.setAttribute("role","menuitem"),e.textContent="string"==typeof t?t:t.label||t.title||"",s.appendChild(e)})}t.parentNode!==this&&this.appendChild(t),e.parentNode!==this&&this.appendChild(e),s.parentNode!==this&&this.appendChild(s)}enhance(){if(this._wiredSplitButton)return;this._wiredSplitButton=!0;const t=()=>this.querySelector(".c-split-button__toggle"),e=()=>this.querySelector(".c-split-button__menu"),s=()=>Array.from(e()?.querySelectorAll(".c-menu__item")||[]),r=(r,i)=>{const a=e(),n=t();if(!a)return;const o=!a.hidden;if(fe(this,a,t,r,!0),n&&n.setAttribute("aria-expanded",String(r)),r&&i){const t=s()[0];if(t)try{t.focus()}catch(t){}}o!==r&&this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{open:r}}))};i(this,()=>ye(this)),this.addEventListener("click",i=>{const a=i.target&&i.target.closest?i.target.closest(".c-split-button__main"):null;if(a&&this.contains(a))return void this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0,detail:{label:a.textContent}}));const n=t();if(i.target===n||n&&n.contains(i.target)){const t=e();return void r(!!t&&t.hidden,!0)}const o=i.target&&i.target.closest?i.target.closest(".c-menu__item"):null;if(o&&this.contains(o)){const e=s().indexOf(o);r(!1,!1);try{t()?.focus()}catch(t){}this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{label:o.textContent,index:e}}))}}),this.addEventListener("keydown",i=>{const a=t(),n=e(),o=s(),c=i.target===a||a&&a.contains(i.target),l=o.indexOf(i.target);if(!c||"Enter"!==i.key&&" "!==i.key&&"ArrowDown"!==i.key){if(c&&"ArrowUp"===i.key){i.preventDefault(),r(!0,!1);const t=o[o.length-1];if(t)try{t.focus()}catch(t){}}else if(l>=0){if("ArrowDown"===i.key)i.preventDefault(),o[(l+1)%o.length]?.focus();else if("ArrowUp"===i.key)i.preventDefault(),o[(l-1+o.length)%o.length]?.focus();else if("Home"===i.key)i.preventDefault(),o[0]?.focus();else if("End"===i.key)i.preventDefault(),o[o.length-1]?.focus();else if("Escape"===i.key){i.preventDefault(),r(!1,!1);try{a?.focus()}catch(t){}}}else if("Escape"===i.key&&n&&!n.hidden){r(!1,!1);try{a?.focus()}catch(t){}}}else i.preventDefault(),r(!0,!0);if(1===i.key.length&&!i.ctrlKey&&!i.metaKey&&!i.altKey){const t=(this._sbTypeaheadQuery||"")+i.key.toLowerCase();this._sbTypeaheadQuery=t,clearTimeout(this._sbTypeaheadTimer),this._sbTypeaheadTimer=setTimeout(()=>{this._sbTypeaheadQuery=""},800);const e=o.find(e=>e.textContent.toLowerCase().startsWith(t));e&&e.focus()}});const a=t=>{const s=e();!s||s.hidden||this.contains(t.relatedTarget)||r(!1,!1)};this.addEventListener("focusout",a),i(this,()=>this.removeEventListener("focusout",a));const n=t=>{const s=e();!s||s.hidden||this.contains(t.target)||r(!1,!1)};document.addEventListener("click",n),i(this,()=>document.removeEventListener("click",n))}});c("contour-map-popup",class extends T{static get observed(){return["title","content","cluster-count","cluster-expanded","cluster-items","anchor"]}static get properties(){return{title:{attribute:"title"},content:{attribute:"content"},"cluster-count":{attribute:"cluster-count",type:Number},"cluster-expanded":{attribute:"cluster-expanded",type:Boolean},"cluster-items":{attribute:"cluster-items"}}}render(){this.classList.add("c-map-popup"),this.setAttribute("role","dialog"),this.hasAttribute("popover")||this.setAttribute("popover","auto"),this.id||(this.id=o("map-popup"));const t=this.getAttribute("title");if(t){this.ensure(".c-map-popup__title",()=>{const t=document.createElement("div");return t.className="c-map-popup__title",t}).textContent=t}const e=Array.from(this.childNodes).filter(t=>(1!==t.nodeType||!t.classList||!t.classList.contains("c-map-popup__title")&&!t.classList.contains("c-map-popup__body"))&&!(3===t.nodeType&&!t.textContent.trim())),s=this.getAttribute("content");if(e.length){const t=this.ensure(".c-map-popup__body",()=>{const t=document.createElement("div");return t.className="c-map-popup__body",t});for(const s of e)t.appendChild(s)}else if(s){this.ensure(".c-map-popup__body",()=>{const t=document.createElement("div");return t.className="c-map-popup__body",t}).textContent=s}const r=Number(this.getAttribute("cluster-count"));if(Number.isFinite(r)&&r>1){const t=this.ensure(".c-map-popup__cluster",()=>{const t=document.createElement("button");return t.className="c-map-popup__cluster c-btn c-btn--sm",t.type="button",t}),e=this.hasAttribute("cluster-expanded");t.textContent=e?"Hide locations":`${r} locations`,t.setAttribute("aria-expanded",String(e)),t.setAttribute("aria-label",e?"Hide locations":`Show ${r} locations`)}else{const t=this.querySelector(".c-map-popup__cluster");t&&t.remove()}const i=this.hasAttribute("cluster-expanded");let a=Qt(this,"cluster-items",f);const n=this.querySelector(".c-map-popup__cluster-list");if(i&&Array.isArray(a)&&a.length){const t=n||document.createElement("ul");t.className="c-map-popup__cluster-list",L(t,""),a.forEach(e=>{const s=document.createElement("li");s.className="c-map-popup__cluster-item",s.textContent="string"==typeof e?e:e.label||e.name||JSON.stringify(e),t.appendChild(s)}),t.parentNode!==this&&this.appendChild(t)}else n&&n.remove();this.hasAttribute("aria-label")||this.setAttribute("aria-label",t||"Map popup");const c=this.getAttribute("anchor");let l=null;c&&(l=c.startsWith("#")?document.getElementById(c.slice(1)):document.querySelector(c)),this._mapPopupAnchorEl=l;const u="--map-popup-"+this.id;l&&(l.style.setProperty("anchor-name",u),this.style.setProperty("position-anchor",u))}enhance(){if(this._wiredMapPopup)return;this._wiredMapPopup=!0;const t=()=>{try{this.hidePopover()}catch(t){}this.classList.remove("is-open"),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}))},e=e=>{"Escape"===e.key&&(this.classList.contains("is-open")||this.matches(":popover-open"))&&(e.preventDefault(),t())};document.addEventListener("keydown",e),i(this,()=>document.removeEventListener("keydown",e)),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-map-popup__close"):null;s&&this.contains(s)&&t();const r=e.target&&e.target.closest?e.target.closest(".c-map-popup__cluster"):null;if(r&&this.contains(r)){const t=!this.hasAttribute("cluster-expanded");this.toggleAttribute("cluster-expanded",t),this.dispatchEvent(new CustomEvent("contour:cluster-toggle",{bubbles:!0,composed:!0,detail:{count:Number(this.getAttribute("cluster-count")),expanded:t}}))}});const s="--map-popup-"+this.id,r=()=>{const t=this._mapPopupAnchorEl;t&&(t.style.setProperty("anchor-name",s),this.style.setProperty("position-anchor",s))},a=()=>{try{const t=this.getBoundingClientRect(),e=t.right>window.innerWidth||t.left<0,s=t.bottom>window.innerHeight||t.top<0,r=e||s;this.classList.toggle("c-map-popup--flip-x",e&&!s),this.classList.toggle("c-map-popup--flip-y",s&&!e),this.classList.toggle("c-map-popup--flip-both",e&&s),r&&this.dispatchEvent(new CustomEvent("contour:map-popup-reposition",{bubbles:!0,composed:!0,detail:{anchor:this.getAttribute("anchor")||"",flippedX:e,flippedY:s,left:Math.round(t.left),top:Math.round(t.top)}}))}catch(t){}};this.addEventListener("toggle",t=>{"open"===t.newState&&requestAnimationFrame(()=>{r(),a()})});const n=()=>a();window.addEventListener("resize",n),i(this,()=>{window.removeEventListener("resize",n),this._mapPopupAnchorEl&&this._mapPopupAnchorEl.style.removeProperty("anchor-name")})}});c("contour-animation-controls",class extends T{static get observed(){return["playing","speed","progress","min","max","caption","show-thumb","show-thumb-caption","loop","step","markers"]}static get properties(){return{playing:{attribute:"playing",type:Boolean},speed:{attribute:"speed"},progress:{attribute:"progress"},min:{attribute:"min"},max:{attribute:"max"},loop:{attribute:"loop",type:Boolean},step:{attribute:"step"},markers:{attribute:"markers"}}}render(){this.classList.add("c-animation-controls"),this.setAttribute("role","toolbar"),this.setAttribute("aria-label",k(this,"animation-controls","Animation controls"));const t=this.ensure(".c-animation-controls__play",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-btn--icon c-animation-controls__play",t.type="button",t});L(t,this.hasAttribute("playing")?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-pause" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-play" /></svg>'),t.setAttribute("aria-label",this.hasAttribute("playing")?k(this,"pause","Pause"):k(this,"play","Play"));const e=this.getAttribute("speed")||"1x",s=this.ensure(".c-animation-controls__speed",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-animation-controls__speed",t.type="button",t});s.textContent=e,s.setAttribute("aria-label",k(this,"playback-speed","Playback speed")+" "+e);const r=this.ensure(".c-animation-controls__loop",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-btn--icon c-animation-controls__loop",t.type="button",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-refresh" /></svg>'),t});r.setAttribute("aria-label",k(this,"loop","Loop")),r.setAttribute("aria-pressed",String(this.hasAttribute("loop"))),t.tabIndex=0,s.tabIndex=-1,r.tabIndex=-1;const i=this.ensure(".c-animation-controls__scrubber",()=>{const t=document.createElement("input");return t.className="c-range c-animation-controls__scrubber",t.type="range",t});"false"===this.getAttribute("show-thumb")?i.classList.remove("c-animation-controls__scrubber--thumb"):i.classList.add("c-animation-controls__scrubber--thumb"),i.min=this.getAttribute("min")||"0",i.max=this.getAttribute("max")||"100",i.step=this.getAttribute("step")||"1",i.value=this.getAttribute("progress")||"0";{const t=Number(i.min)||0,e=Number(i.max)||100,s=Number(i.value)||0,r=e===t?0:(s-t)/(e-t)*100;i.style.setProperty("--fill",r+"%")}const a=Number(i.min)||0,n=Number(i.max)||100,c=Number(i.value)||a;i.setAttribute("aria-valuenow",String(c)),i.setAttribute("aria-valuetext",String(Math.round(c))),i.setAttribute("aria-valuemin",String(a)),i.setAttribute("aria-valuemax",String(n));const l=this.getAttribute("caption");l?i.setAttribute("aria-label",l):i.getAttribute("aria-label")||i.setAttribute("aria-label",k(this,"playhead","Playhead"));const u=this.getAttribute("markers");let d=[];if(u)try{const t=JSON.parse(u);d=Array.isArray(t)?t:[]}catch(t){f(this,"markers",t)}const h=this.querySelector("datalist.c-animation-controls__markers");if(d.length){const t=this.ensure("datalist.c-animation-controls__markers",()=>{const t=document.createElement("datalist");return t.className="c-animation-controls__markers",t});t.id||(t.id=this._animMarkersId||(this._animMarkersId=o("anim-markers"))),L(t,""),d.forEach(e=>{const s=document.createElement("option"),r="object"==typeof e&&null!==e?e.value:e;s.value=String(r),"object"==typeof e&&null!==e&&e.label&&(s.label=String(e.label)),t.appendChild(s)}),i.setAttribute("list",t.id)}else h&&h.remove(),i.removeAttribute("list");const m=this.hasAttribute("show-thumb-caption")||this.hasAttribute("show-thumb");if(l&&m){this.ensure(".c-animation-controls__caption",()=>{const t=document.createElement("span");return t.className="c-animation-controls__caption",t}).textContent=l}else{const t=this.querySelector(".c-animation-controls__caption");t&&t.remove()}this.hasAttribute("loop")&&this.setAttribute("aria-label",k(this,"animation-controls-loop","Animation controls, loop"))}enhance(){if(this._wiredAnimControls)return;this._wiredAnimControls=!0;const t=[.5,1,2,4],e=t=>{this._animScrubbing||this.setAttribute("progress",String(t))};this.addEventListener("pointerdown",t=>{t.target&&t.target.closest&&t.target.closest(".c-animation-controls__scrubber")&&(this._animScrubbing=!0)},{passive:!0});const s=()=>{this._animScrubbing=!1};this.addEventListener("pointerup",s,{passive:!0}),this.addEventListener("pointercancel",s,{passive:!0}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-animation-controls__play"):null;if(s&&this.contains(s)){const t=!this.hasAttribute("playing");return this.toggleAttribute("playing",t),void this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{playing:t}}))}const r=e.target&&e.target.closest?e.target.closest(".c-animation-controls__speed"):null;if(r&&this.contains(r)){const e=parseFloat(this.getAttribute("speed")||"1x"),s=t.indexOf(Number.isFinite(e)?e:1),r=t[(s+1)%t.length];return this.setAttribute("speed",r+"x"),void this.dispatchEvent(new CustomEvent("contour:speed-change",{bubbles:!0,composed:!0,detail:{speed:r}}))}const i=e.target&&e.target.closest?e.target.closest(".c-animation-controls__loop"):null;if(i&&this.contains(i)){const t=!this.hasAttribute("loop");this.toggleAttribute("loop",t),this.dispatchEvent(new CustomEvent("contour:loop-change",{bubbles:!0,composed:!0,detail:{loop:t}}))}}),this.addEventListener("input",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-animation-controls__scrubber"):null;if(s&&this.contains(s)){const t=Number(s.value),r=Number(s.min)||0,i=Number(s.max)||100,a=i===r?0:(t-r)/(i-r)*100;s.style.setProperty("--fill",a+"%"),e(t),this.dispatchEvent(new CustomEvent("contour:seek",{bubbles:!0,composed:!0,detail:{progress:t,value:t}}))}}),this.addEventListener("change",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-animation-controls__scrubber"):null;e&&this.contains(e)&&this.setAttribute("progress",e.value)}),this.addEventListener("keydown",t=>{if(t.target&&t.target.closest&&t.target.closest(".c-animation-controls__scrubber"))return;const e=Array.from(this.querySelectorAll(".c-animation-controls__play, .c-animation-controls__speed, .c-animation-controls__loop"));e.includes(t.target)&&z(t,e,{wrap:!0,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>{e.tabIndex=s===t?0:-1})},onKey:(t,e,s)=>{"Enter"!==t&&" "!==t||s.click()}})});let r=null;const a=()=>{const t=this.getAttribute("speed")||"1x",e=parseFloat(t);return Number.isFinite(e)&&e>0?e:1},n=()=>{const t=this.querySelector(".c-animation-controls__scrubber");if(!t)return;const s=Number(t.min||0),r=Number(t.max||100);let i=Number(t.value||0)+a(),n=!1;i>r&&(this.hasAttribute("loop")?i=s:(i=r,c(),n=!0)),t.value=String(i),e(i),this.dispatchEvent(new CustomEvent("contour:time-change",{bubbles:!0,composed:!0,detail:{progress:i,value:i}})),n&&(this.removeAttribute("playing"),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{playing:!1}})))},o=()=>{r||(r=setInterval(n,100))},c=()=>{r&&(clearInterval(r),r=null)};this.hasAttribute("playing")&&o();const l=new MutationObserver(()=>{this.hasAttribute("playing")?o():c()});l.observe(this,{attributes:!0,attributeFilter:["playing"]}),i(this,()=>{c(),l.disconnect()})}});c("contour-annotation",class extends T{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"),this.setAttribute("role","note"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const t=this.getAttribute("label");if(t&&this.setAttribute("aria-label",t),t){this.ensure(".c-annotation__label",()=>{const t=document.createElement("span");return t.className="c-annotation__label",t}).textContent=t}const e=this.getAttribute("x"),s=this.getAttribute("y");null!==e&&this.style.setProperty("--annotation-x",e),null!==s&&this.style.setProperty("--annotation-y",s)}enhance(){if(this._wiredAnnotation)return;this._wiredAnnotation=!0;const t=(t,e)=>{const s=parseFloat(t);return Number.isFinite(s)?Math.min(100,Math.max(0,s)):e},e=(t,e,s)=>{this.batch(()=>{this.setAttribute("x",t+"%"),this.setAttribute("y",e+"%")}),this.dispatchEvent(new CustomEvent("contour:drag",{bubbles:!0,composed:!0,detail:{delta:s?1:0,key:s||"pointer",value:t+","+e}}))};let s=null;this.addEventListener("pointerdown",e=>{if(void 0!==e.button&&0!==e.button)return;const r=this.offsetParent||this.parentElement;if(!r)return;const i=r.getBoundingClientRect();s={px:e.clientX,py:e.clientY,x:t(this.getAttribute("x"),50),y:t(this.getAttribute("y"),50),w:i.width||1,h:i.height||1};try{this.setPointerCapture(e.pointerId)}catch(t){}try{this.focus()}catch(t){}e.preventDefault()}),this.addEventListener("pointermove",t=>{if(!s)return;const r=Math.round(10*(s.x+(t.clientX-s.px)/s.w*100))/10,i=Math.round(10*(s.y+(t.clientY-s.py)/s.h*100))/10;e(Math.min(100,Math.max(0,r)),Math.min(100,Math.max(0,i)))});const r=()=>{s&&(s=null,this.dispatchEvent(new CustomEvent("contour:dragend",{bubbles:!0,composed:!0,detail:{value:(this.getAttribute("x")||"")+","+(this.getAttribute("y")||"")}})))};this.addEventListener("pointerup",r),this.addEventListener("pointercancel",r),this.addEventListener("keydown",s=>{const r=s.shiftKey?10:1;let i=0,a=0;if("ArrowLeft"===s.key)i=-r;else if("ArrowRight"===s.key)i=r;else if("ArrowUp"===s.key)a=-r;else{if("ArrowDown"!==s.key)return;a=r}s.preventDefault();const n=Math.min(100,Math.max(0,t(this.getAttribute("x"),50)+i)),o=Math.min(100,Math.max(0,t(this.getAttribute("y"),50)+a));e(n,o,s.key),this.dispatchEvent(new CustomEvent("contour:dragend",{bubbles:!0,composed:!0,detail:{value:n+","+o}}))})}});c("contour-style-switcher",class extends T{static get observed(){return["items","value"]}static get properties(){return{items:{attribute:"items"},value:{attribute:"value"}}}render(){this.classList.add("c-style-switcher"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"style-switcher","Style switcher"));const t=this.getAttribute("items"),e=this.getAttribute("value"),s=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-style-switcher__option"));if(t&&!s.length){Array.from(this.querySelectorAll(".c-style-switcher__option")).forEach(t=>t.remove());try{JSON.parse(t).forEach(t=>{const e="string"==typeof t?t:t.name||t.label||"",s=document.createElement("button");s.className="c-style-switcher__option c-btn c-btn--sm",s.type="button",s.textContent=e,s.dataset.value=e,this.appendChild(s)})}catch(t){f(this,"attribute",t)}}const r=Array.from(this.querySelectorAll(".c-style-switcher__option"));let i=null;r.forEach(t=>{const s=(null!=t.dataset.value?t.dataset.value:t.textContent.trim())===e;t.classList.toggle("c-style-switcher__option--active",s),t.setAttribute("aria-pressed",String(s)),t.tabIndex=-1,s&&!i&&(i=t)}),(i||r[0])?.setAttribute("tabindex","0")}enhance(){if(this._wiredStyleSwitcher)return;this._wiredStyleSwitcher=!0;const t=t=>{const e=null!=t.dataset.value?t.dataset.value:t.textContent.trim();this.setAttribute("value",e),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:e}}))};this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-style-switcher__option"):null;s&&this.contains(s)&&t(s)}),this.addEventListener("keydown",e=>{z(e,Array.from(this.querySelectorAll(".c-style-switcher__option")),{onKey:e=>{if("Enter"===e||" "===e){const e=document.activeElement;e&&e.classList.contains("c-style-switcher__option")&&t(e)}}})})}});c("contour-style-panel",class extends T{static get observed(){return["title","layers","layer","single","classification","palette","breaks","opacity","n","colors","property"]}static get properties(){return{title:{attribute:"title"},layers:{attribute:"layers"},classification:{attribute:"classification"},palette:{attribute:"palette"},breaks:{attribute:"breaks"},opacity:{attribute:"opacity"}}}render(){if(this.classList.add("c-style-panel"),!this._stylePanelDefault){this._stylePanelDefault={};for(const t of["property","classification","palette","breaks","opacity","n","colors"])this._stylePanelDefault[t]=this.getAttribute(t)}this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"style-panel","Style panel"));const t=this.getAttribute("title");if(t){this.ensure(".c-style-panel__title",()=>{const t=document.createElement("div");return t.className="c-style-panel__title",t}).textContent=t}if(this.hasAttribute("single")||!!this.getAttribute("layer")){const t=this.ensure(".c-style-panel__body",()=>{const t=document.createElement("div");return t.className="c-style-panel__body",t});L(t,"");const e=o("style-panel"),s=e+"-property",r=e+"-policy",i=e+"-palette",a=e+"-n",n=document.createElement("label");n.textContent=k(this,"colour-field","Colour field"),n.setAttribute("for",s),t.appendChild(n);const c=document.createElement("input");c.type="text",c.id=s,c.className="c-style-panel__property c-input",c.setAttribute("aria-label",k(this,"colour-field","Colour field"));const l=this.getAttribute("property");l&&(c.value=l),t.appendChild(c);const u=document.createElement("label");u.textContent=k(this,"classification","Classification"),u.setAttribute("for",r),t.appendChild(u);const d=document.createElement("select");d.id=r,d.className="c-style-panel__classification c-input",d.setAttribute("aria-label",k(this,"classification-method","Classification method")),["equal","quantile","jenks","manual"].forEach(t=>{const e=document.createElement("option");e.value=t,e.textContent=t,d.appendChild(e)});const h=this.getAttribute("classification");h&&(d.value=h),t.appendChild(d);const m=document.createElement("label");m.textContent=k(this,"palette","Palette"),m.setAttribute("for",i),t.appendChild(m);const b=document.createElement("input");b.type="text",b.id=i,b.className="c-style-panel__palette c-input",b.placeholder=k(this,"palette","Palette"),b.setAttribute("aria-label",k(this,"palette","Palette"));const p=this.getAttribute("palette");p&&(b.value=p),t.appendChild(b);const g=document.createElement("label");g.textContent=k(this,"classes","Classes"),g.setAttribute("for",a),t.appendChild(g);const _=document.createElement("input");_.type="number",_.id=a,_.className="c-style-panel__n c-input",_.min="2",_.max="12",_.setAttribute("aria-label",k(this,"class-count","Class count"));const v=this.getAttribute("n");_.value=v||"5",t.appendChild(_);const y=document.createElement("input");y.type="range",y.className="c-style-panel__opacity",y.setAttribute("aria-label",k(this,"opacity","Opacity")),y.min="0",y.max="100";const f=this.getAttribute("opacity");y.value=null!=f?f:"100",t.appendChild(y);const A=this.getAttribute("breaks");let E=null;if(A)try{E=JSON.parse(A)}catch(t){E=A.split(",").map(t=>t.trim())}if(Array.isArray(E)&&E.length){const e=document.createElement("div");e.className="c-style-panel__breaks",E.forEach((t,s)=>{const r=document.createElement("div");r.className="break";const i=document.createElement("span");i.textContent=String(t),r.appendChild(i);const a=document.createElement("input");a.type="number",a.className="c-style-panel__breaks c-input",a.setAttribute("aria-label",k(this,"class-lower-bound","Class lower bound")),a.value=String(t),r.appendChild(a),e.appendChild(r)}),t.appendChild(e)}const w=this.getAttribute("colors");let x=null;if(w)try{x=JSON.parse(w)}catch(t){x=w.split(",").map(t=>t.trim())}if(Array.isArray(x)){const e=document.createElement("div");e.className="c-style-panel__colors",x.forEach((t,s)=>{const r=document.createElement("input");r.type="color",r.className="c-style-panel__color c-input",r.setAttribute("aria-label",k(this,"colour-for-class","Colour for class")+" "+(s+1)),r.value=t,e.appendChild(r)}),t.appendChild(e)}const C=document.createElement("div");C.className="c-style-panel__actions c-btn-group";const S=document.createElement("button");S.type="button",S.className="c-btn c-btn--primary",S.textContent=k(this,"apply","Apply"),S.dataset.action="apply";const N=document.createElement("button");return N.type="button",N.className="c-btn",N.textContent=k(this,"revert","Revert"),N.dataset.action="revert",C.appendChild(S),C.appendChild(N),void t.appendChild(C)}const e=this.getAttribute("layers"),s=this.ensure(".c-style-panel__body",()=>{const t=document.createElement("div");return t.className="c-style-panel__body",t}),r=Array.from(this.querySelectorAll(":scope > .c-style-panel__row"));let i=null;if(r.length)i=r.map(t=>({name:t.querySelector(".c-style-panel__name")?.textContent||"",color:t.querySelector(".c-style-panel__color")?.value,classification:t.querySelector(".c-style-panel__classification")?.value,palette:t.querySelector(".c-style-panel__palette")?.value,breaks:t.querySelector(".c-style-panel__breaks")?.value,opacity:t.querySelector(".c-style-panel__opacity")?.value})),r.forEach(t=>t.remove());else if(e)try{i=JSON.parse(e)}catch(t){f(this,"layers",t),i=null}i&&(L(s,""),i.forEach(t=>{const e=document.createElement("div");e.className="c-style-panel__row";const r=document.createElement("span");r.className="c-style-panel__name",r.textContent="string"==typeof t?t:t.name||t.label||"",e.appendChild(r);const i=document.createElement("input");i.type="color",i.className="c-style-panel__color",i.setAttribute("aria-label",k(this,"colour-for","Colour for")+" "+("string"==typeof t?t:t.name||t.label||k(this,"layer","layer"))),"object"==typeof t&&t.color&&(i.value=t.color),e.appendChild(i);const a=document.createElement("select");a.className="c-style-panel__classification",a.setAttribute("aria-label",k(this,"classification-method","Classification method")),["equal","quantile","jenks","manual"].forEach(t=>{const e=document.createElement("option");e.value=t,e.textContent=t,a.appendChild(e)}),"object"==typeof t&&t.classification&&(a.value=t.classification),e.appendChild(a);const n=document.createElement("input");n.type="text",n.className="c-style-panel__palette",n.setAttribute("aria-label",k(this,"palette","Palette")),n.placeholder="palette","object"==typeof t&&t.palette&&(n.value=t.palette),e.appendChild(n);const o=document.createElement("input");o.type="text",o.className="c-style-panel__breaks",o.placeholder="breaks",o.setAttribute("aria-label",k(this,"class-breaks","Class breaks")),"object"==typeof t&&t.breaks&&(o.value=Array.isArray(t.breaks)?t.breaks.join(","):t.breaks),e.appendChild(o);const c=document.createElement("input");c.type="range",c.className="c-style-panel__opacity",c.setAttribute("aria-label",k(this,"opacity","Opacity")),c.min="0",c.max="100",c.value="object"==typeof t&&null!=t.opacity?t.opacity:"100",e.appendChild(c),s.appendChild(e)}))}enhance(){this._wiredStylePanel||(this._wiredStylePanel=!0,this.addEventListener("change",t=>{const e=t.target;if(!e||!this.contains(e))return;const s=e.closest(".c-style-panel__row"),r=s&&s.querySelector(".c-style-panel__name")?.textContent||"";if(e.classList.contains("c-style-panel__color"))this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:e.value,layer:r,property:"color"},bubbles:!0,composed:!0}));else if(e.classList.contains("c-style-panel__classification"))this.dispatchEvent(new CustomEvent("contour:break-change",{detail:{value:e.value,layer:r},bubbles:!0,composed:!0}));else if(e.classList.contains("c-style-panel__opacity")){const t=r?r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""):"";this.dispatchEvent(new CustomEvent("contour:layer-opacity",{detail:{layerId:t,name:r,opacity:Number(e.value)},bubbles:!0,composed:!0}))}else e.classList.contains("c-style-panel__property")?this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:e.value,layer:r,property:"property"},bubbles:!0,composed:!0})):e.classList.contains("c-style-panel__n")&&this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:Number(e.value),layer:r,property:"n"},bubbles:!0,composed:!0}))}),this.addEventListener("input",t=>{const e=t.target;if(e&&this.contains(e)&&(e.classList.contains("c-style-panel__color")&&e.setAttribute("data-edited","true"),e.classList.contains("c-style-panel__palette")||e.classList.contains("c-style-panel__breaks"))){const t=e.closest(".c-style-panel__row"),s=t&&t.querySelector(".c-style-panel__name")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:e.value,layer:s,property:e.classList.contains("c-style-panel__palette")?"palette":"breaks"},bubbles:!0,composed:!0}))}}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("button"):null;if(e&&this.contains(e))if("apply"===e.dataset.action){const t=this.querySelector(".c-style-panel__body"),e={applied:!0};if(t){const s=t.querySelector(".c-style-panel__property"),r=t.querySelector(".c-style-panel__classification"),i=t.querySelector(".c-style-panel__palette"),a=t.querySelector(".c-style-panel__n"),n=Array.from(t.querySelectorAll(".c-style-panel__color")).map(t=>t.value);s&&(e.property=s.value),r&&(e.classification=r.value),i&&(e.palette=i.value),a&&(e.n=Number(a.value)),n.length&&(e.colors=n)}this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:e,bubbles:!0,composed:!0}))}else if("revert"===e.dataset.action){const t=this._stylePanelDefault||{};this._contourResetting=!0;try{for(const e of["property","classification","palette","breaks","opacity","n","colors"])null===t[e]||void 0===t[e]?this.removeAttribute(e):this.setAttribute(e,t[e]);this.attributeChangedCallback("__rerender__",null,"")}finally{this._contourResetting=!1}this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{applied:!1},bubbles:!0,composed:!0}))}}))}});c("contour-popover",class extends T{static get observed(){return["title","content","anchor"]}static get properties(){return{title:{attribute:"title"},content:{attribute:"content"}}}render(){this.classList.add("c-popover"),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"popover","Popover")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),this.id||(this.id=o("popover"));const t=this.getAttribute("title");if(t){this.ensure(".c-popover__title",()=>{const t=document.createElement("div");return t.className="c-popover__title",t}).textContent=t}const e=Array.from(this.childNodes).filter(t=>(1!==t.nodeType||!t.classList||!t.classList.contains("c-popover__title")&&!t.classList.contains("c-popover__body"))&&!(3===t.nodeType&&!t.textContent.trim())),s=this.getAttribute("content");if(e.length){const t=this.ensure(".c-popover__body",()=>{const t=document.createElement("div");return t.className="c-popover__body",t});for(const s of e)t.appendChild(s)}else if(s){this.ensure(".c-popover__body",()=>{const t=document.createElement("div");return t.className="c-popover__body",t}).textContent=s}this._applyPopoverAnchor()}_applyPopoverAnchor(){const t=this.getAttribute("anchor"),e=t?t.startsWith("#")?document.getElementById(t.slice(1)):document.querySelector(t):null;if(this._popoverAnchorEl&&this._popoverAnchorEl!==e&&(this._popoverAnchorEl.style.removeProperty("anchor-name"),this._popoverAnchorEl.removeAttribute("aria-controls"),this._popoverAnchorEl.removeAttribute("aria-expanded")),this._popoverAnchorEl=e||null,e){const t="--popover-"+this.id;e.style.setProperty("anchor-name",t),this.style.setProperty("position-anchor",t),e.setAttribute("aria-controls",this.id),this._popoverAnchorDispose||(this._popoverAnchorDispose=!0,i(this,()=>{this._popoverAnchorEl&&this._popoverAnchorEl.style.removeProperty("anchor-name"),this._popoverAnchorDispose=!1}))}else this.style.removeProperty("position-anchor")}_setPopoverTriggerExpanded(t){const e=this._popoverAnchorEl;e&&(e.setAttribute("aria-controls",this.id),e.setAttribute("aria-expanded",String(!!t)))}enhance(){if(this._wiredPopover)return;this._wiredPopover=!0;const t=()=>{try{this.hidePopover()}catch(t){}this.classList.remove("is-open"),S(this,"contour:close",{}),this._setPopoverTriggerExpanded(!1)},e=e=>{if(this.classList.contains("is-open")||this.matches(":popover-open")){if("Escape"===e.key)return e.preventDefault(),void t();if("Tab"===e.key){const t=Array.from(this.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(!t.length)return void e.preventDefault();const s=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===s?(e.preventDefault(),r.focus()):e.shiftKey||document.activeElement!==r||(e.preventDefault(),s.focus())}}};document.addEventListener("keydown",e),i(this,()=>document.removeEventListener("keydown",e));const s=()=>{this.classList.add("is-open"),S(this,"contour:open",{});const t=this.querySelector('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])');if(t)try{t.focus()}catch(t){}else try{this.focus()}catch(t){}this._setPopoverTriggerExpanded(!0)};this.addEventListener("beforetoggle",t=>{"open"===t.newState&&s()});const r=t=>{t.target&&t.target!==this&&this.contains(t.target)&&this.classList.add("is-parent")};this.addEventListener("contour:open",r),this.addEventListener("contour:show",r),this.addEventListener("contour:close",t=>{t.target&&t.target!==this&&this.classList.remove("is-parent")}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-popover__close"):null;s&&this.contains(s)&&t()})}});c("contour-hover-card",class extends T{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"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"hover-card","Hover card")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),this.id||(this.id=o("hover-card"));const t=this.getAttribute("title");if(t){this.ensure(".c-hover-card__title",()=>{const t=document.createElement("div");return t.className="c-hover-card__title",t}).textContent=t}const e=Array.from(this.childNodes).filter(t=>(1!==t.nodeType||!t.classList||!t.classList.contains("c-hover-card__title")&&!t.classList.contains("c-hover-card__body"))&&!(3===t.nodeType&&!t.textContent.trim())),s=this.getAttribute("content");if(e.length){const t=this.ensure(".c-hover-card__body",()=>{const t=document.createElement("div");return t.className="c-hover-card__body",t});for(const s of e)t.appendChild(s)}else if(s){this.ensure(".c-hover-card__body",()=>{const t=document.createElement("div");return t.className="c-hover-card__body",t}).textContent=s}if(!this.hasAttribute("role")){const t=!!this.querySelector("a[href], button, input, select, textarea");this.setAttribute("role",t?"dialog":"tooltip")}"function"==typeof this._wireHoverAnchor&&this._wireHoverAnchor()}enhance(){if(this._wiredHoverCard)return;this._wiredHoverCard=!0;let t=null,e=null;const s="function"==typeof this.showPopover,r=()=>{t&&(clearTimeout(t),t=null),e&&(clearTimeout(e),e=null)},a=t=>{if(r(),s)try{this.showPopover(t?{source:t}:void 0)}catch(t){try{this.showPopover()}catch(t){}}else this.classList.add("is-open");this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}))},n=()=>{if(r(),s)try{this.hidePopover()}catch(t){}else this.classList.remove("is-open");this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}))},o=()=>{e&&clearTimeout(e),e=setTimeout(n,300)};this.addEventListener("mouseenter",r),this.addEventListener("mouseleave",o),this.addEventListener("focusin",r),this.addEventListener("focusout",t=>{this.contains(t.relatedTarget)||o()}),this._wireHoverAnchor=()=>{const e=this.getAttribute("anchor")||"";if(this._hoverAnchorSel===e&&this._hoverAnchorCleanup)return;if(this._hoverAnchorCleanup&&(this._hoverAnchorCleanup(),this._hoverAnchorCleanup=null),this._hoverAnchorSel=e,!e)return;const s=e.startsWith("#")?document.getElementById(e.slice(1)):document.querySelector(e);if(!s)return;s.setAttribute("popovertarget",this.id),s.setAttribute("aria-describedby",this.id);const i="--hover-card-"+this.id;s.style.setProperty("anchor-name",i),this.style.setProperty("position-anchor",i);const n=()=>{r(),t=setTimeout(()=>a(s),300)},c=()=>{o()},l=()=>a(s),u=()=>{o()},d=t=>{t&&t.preventDefault&&t.preventDefault()};s.addEventListener("mouseenter",n),s.addEventListener("mouseleave",c),s.addEventListener("focus",l),s.addEventListener("blur",u),s.addEventListener("click",d),this._hoverAnchorCleanup=()=>{s.removeEventListener("mouseenter",n),s.removeEventListener("mouseleave",c),s.removeEventListener("focus",l),s.removeEventListener("blur",u),s.removeEventListener("click",d),s.style.removeProperty("anchor-name"),s.getAttribute("aria-describedby")===this.id&&s.removeAttribute("aria-describedby")}},this._wireHoverAnchor();const c=t=>{"Escape"===t.key&&(this.classList.contains("is-open")||this.matches(":popover-open"))&&(t.preventDefault(),n())};document.addEventListener("keydown",c),i(this,()=>{r(),this._hoverAnchorCleanup&&(this._hoverAnchorCleanup(),this._hoverAnchorCleanup=null),this._hoverAnchorSel=null,document.removeEventListener("keydown",c)})}});c("contour-context-menu",class extends T{static get observed(){return["items","trigger"]}static get properties(){return{items:{attribute:"items"},trigger:{attribute:"trigger"}}}render(){this.classList.add("c-context-menu"),this.hasAttribute("role")||this.setAttribute("role","menu"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"context-menu","Context menu")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),this.id||(this.id=o("context-menu"));const t=this.getAttribute("items");if(t)try{const e=JSON.parse(t);Array.from(this.querySelectorAll("[data-contour-generated='1']")).forEach(t=>t.remove()),e.forEach(t=>{const e=document.createElement("button");e.className="c-menu__item",e.type="button",e.setAttribute("role","menuitem"),e.dataset.contourGenerated="1",e.textContent="string"==typeof t?t:t.label||t.title||"",this.appendChild(e)})}catch(t){f(this,"attribute",t)}}enhance(){if(this._wiredContextMenu)return;this._wiredContextMenu=!0;const t=t=>{if("function"==typeof this.hidePopover)try{this.hidePopover()}catch(t){}if(this.classList.remove("is-open"),t&&this._ctxOpener&&this._ctxOpener.isConnected&&"function"==typeof this._ctxOpener.focus)try{this._ctxOpener.focus()}catch(t){}this._ctxOpener=null},e=(t,e)=>{if(this._ctxOpener=document.activeElement,"function"==typeof this.showPopover)try{this.showPopover()}catch(t){}else this.classList.add("is-open");if(Number.isFinite(t)&&Number.isFinite(e)){this.style.position="fixed",this.style.left=t+"px",this.style.top=e+"px";const s=this.getBoundingClientRect(),r=window.innerWidth||document.documentElement.clientWidth,i=window.innerHeight||document.documentElement.clientHeight,a=Math.max(8,Math.min(t,Math.max(8,r-s.width-8))),n=Math.max(8,Math.min(e,Math.max(8,i-s.height-8)));this.style.left=a+"px",this.style.top=n+"px"}const s=this.querySelector(".c-menu__item:not([disabled])");if(s&&"function"==typeof s.focus)try{s.focus()}catch(t){}},s=this.getAttribute("trigger");if(s){const t=document.querySelector(s);if(t){t.hasAttribute("aria-haspopup")||t.setAttribute("aria-haspopup","menu");const s=t=>{t.preventDefault(),e(t.clientX,t.clientY)};t.addEventListener("contextmenu",s),i(this,()=>t.removeEventListener("contextmenu",s))}}this.addEventListener("contextmenu",t=>{t.preventDefault(),e(t.clientX,t.clientY)}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-menu__item"):null;s&&this.contains(s)&&(this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{label:s.textContent.trim()}})),t(!1))}),this.addEventListener("keydown",e=>{const s=Array.from(this.querySelectorAll(".c-menu__item"));z(e,s,{wrap:!0,onKey:()=>{"Enter"!==e.key&&" "!==e.key||document.activeElement.click()}}),"Escape"===e.key&&(e.preventDefault(),t(!0))})}});c("contour-fab",class extends T{static get observed(){return["label","icon"]}static get properties(){return{label:{attribute:"label"},icon:{attribute:"icon"}}}render(){this.classList.add("c-fab"),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const t=this.getAttribute("label");t&&this.setAttribute("aria-label",t);const e=this.getAttribute("icon");if(e&&!this.querySelector("svg")){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.setAttribute("viewBox","0 0 24 24");const s=document.createElementNS("http://www.w3.org/2000/svg","use");s.setAttribute("href",e.startsWith("#")?e:"#"+e),t.appendChild(s),this.appendChild(t)}}enhance(){this._wiredFab||(this._wiredFab=!0,this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0}))}),this.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0})))}))}});c("contour-command-palette",class extends T{static get observed(){return["open","items"]}static get properties(){return{open:{attribute:"open",type:Boolean},items:{attribute:"items"}}}attributeChangedCallback(t,e,s){super.attributeChangedCallback(t,e,s),"open"===t&&this.isConnected&&e!==s&&(null!==s?this.show():this.hide())}_recentsKey(){return"contour-command-palette:"+(this.id||"default")+":recents"}_recents(){try{const t=JSON.parse(localStorage.getItem(this._recentsKey())||"[]");return Array.isArray(t)?t:[]}catch(t){return f(this,"recents",t),[]}}_remember(t){try{const e=this._recents().filter(e=>e!==t);e.unshift(t),localStorage.setItem(this._recentsKey(),JSON.stringify(e.slice(0,5)))}catch(t){}}_cmdRow(t,e,s){const r=document.createElement("div");return r.className="c-command-palette__item",r.setAttribute("role","option"),r.id=this.id+"-opt-"+(s?"r":"")+e,r.textContent=t,r.dataset.index=String(e),r.dataset.label=t,s&&(r.dataset.recent="true"),r}render(){this.classList.add("c-command-palette"),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("aria-modal")||this.setAttribute("aria-modal","true"),this.hasAttribute("aria-label")||this.hasAttribute("aria-labelledby")||this.setAttribute("aria-label",k(this,"command-palette","Command palette")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),this.id||(this.id=o("cmd-palette"));const t=this.ensure(".c-command__input",()=>{const t=document.createElement("div");return t.className="c-command__input",t}),e=this.ensure(".c-command__field",()=>{const t=document.createElement("input");return t.className="c-command__field",t.type="search",t.placeholder=k(this,"search","Search…"),t.setAttribute("aria-label",k(this,"search-commands","Search commands")),t.setAttribute("role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded","false"),t}),s=this.hasAttribute("open")||this.classList.contains("is-open")||"function"==typeof this.matches&&this.matches(":popover-open");e.setAttribute("aria-expanded",String(s)),t.contains(e)||t.appendChild(e);const r=this.ensure(".c-command-palette__list",()=>{const t=document.createElement("div");return t.className="c-command-palette__list",t.setAttribute("role","listbox"),t});r.hasAttribute("aria-label")||r.hasAttribute("aria-labelledby")||r.setAttribute("aria-label",k(this,"commands","Commands")),r.id||(r.id=this.id+"-list"),e.setAttribute("aria-controls",r.id);let i=[];const a=this.getAttribute("items");if(a)try{i=JSON.parse(a)}catch(t){f(this,"items",t)}Array.isArray(i)||(i=[]);const n=t=>"string"==typeof t?t:t.label||t.title||"";L(r,"");const c=(this._cmdQuery||"").toLowerCase().trim()?[]:this._recents().filter(t=>i.some(e=>n(e)===t));if(c.length){const t=document.createElement("div");t.className="c-command-palette__group",t.setAttribute("role","presentation"),t.textContent=k(this,"recent","Recent"),r.appendChild(t),c.forEach(t=>r.appendChild(this._cmdRow(t,i.findIndex(e=>n(e)===t),!0)))}let l=null;i.forEach((t,e)=>{const s="object"==typeof t&&null!==t&&t.group||null;if(s&&s!==l){const t=document.createElement("div");t.className="c-command-palette__group",t.setAttribute("role","presentation"),t.textContent=s,r.appendChild(t),l=s}r.appendChild(this._cmdRow(n(t),e,!1))}),this._cmdQuery&&(e.value=this._cmdQuery),this._cmdFilter?this._cmdFilter(this._cmdQuery||""):this._cmdSetActive&&this._cmdSetActive(this._cmdCursor||0)}show(){if(this.classList.contains("is-open")||this.matches(":popover-open"))return void(this.hasAttribute("open")||this.setAttribute("open",""));if("function"==typeof this.showPopover)try{this.showPopover()}catch(t){}this.classList.add("is-open"),Ft(this,!0);const t=this.querySelector(".c-command__field");if(t){t.setAttribute("aria-expanded","true");try{t.focus()}catch(t){}}this.hasAttribute("open")||this.setAttribute("open","")}hide(){if(!(this.classList.contains("is-open")||this.matches(":popover-open")))return void(this.hasAttribute("open")&&this.removeAttribute("open"));if("function"==typeof this.hidePopover)try{this.hidePopover()}catch(t){}this.classList.remove("is-open"),Ft(this,!1);const t=this.querySelector(".c-command__field");t&&t.setAttribute("aria-expanded","false"),this.hasAttribute("open")&&this.removeAttribute("open")}toggle(){this.classList.contains("is-open")||this.matches(":popover-open")?this.hide():this.show()}enhance(){if(this._cmdSetActive&&this._cmdSetActive(this._cmdCursor||0),this._wiredCmdPalette)return;this._wiredCmdPalette=!0;const t=()=>this.querySelector(".c-command__field"),e=()=>this.querySelector(".c-command-palette__list"),s=()=>Array.from(this.querySelectorAll(".c-command-palette__item")),r=()=>s().filter(t=>!t.hidden),a=e=>{const s=r();if(!s.length)return void(this._cmdCursor=0);this._cmdCursor=Math.max(0,Math.min(e,s.length-1)),s.forEach((t,e)=>t.classList.toggle("is-active",e===this._cmdCursor));const i=s[this._cmdCursor],a=t();a&&i?a.setAttribute("aria-activedescendant",i.id):a&&a.removeAttribute("aria-activedescendant")},n=t=>{const r=(t||"").toLowerCase().trim();s().forEach(t=>{const e=(t.dataset.label||t.textContent||"").toLowerCase();t.hidden=""!==r&&!e.includes(r)}),Array.from(e().querySelectorAll(".c-command-palette__group")).forEach(t=>{let e=t.nextElementSibling,s=!1;for(;e&&!e.classList.contains("c-command-palette__group");)!e.hidden&&e.classList.contains("c-command-palette__item")&&(s=!0),e=e.nextElementSibling;t.hidden=!s});let i=e().querySelector(".c-command-palette__empty");s().some(t=>!t.hidden)?i&&(i.hidden=!0):(i||(i=document.createElement("div"),i.className="c-command-palette__empty",i.setAttribute("role","status"),e().appendChild(i)),i.textContent=k(this,"no-matches","No matches"),i.hidden=!1),a(0)},o=t=>{if(!t)return;const e={index:Number(t.dataset.index),label:t.dataset.label||t.textContent};this.value=e,this._remember(e.label),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:e})),this.hide()};this._cmdSetActive=a,this._cmdFilter=n,this.addEventListener("input",e=>{const s=t();s&&e.target===s&&(this._cmdQuery=s.value,n(s.value))}),this.addEventListener("keydown",e=>{const s=t();if(!s||e.target!==s)return;const i=r();if("Escape"===e.key)return e.preventDefault(),void this.hide();i.length&&("ArrowDown"===e.key?(e.preventDefault(),a(this._cmdCursor+1)):"ArrowUp"===e.key?(e.preventDefault(),a(this._cmdCursor-1)):"Home"===e.key?(e.preventDefault(),a(0)):"End"===e.key?(e.preventDefault(),a(i.length-1)):"Enter"===e.key&&(e.preventDefault(),o(i[this._cmdCursor])))}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-command-palette__item"):null;e&&this.contains(e)&&!e.hidden&&o(e)});let c=null;this.addEventListener("beforetoggle",t=>{if("open"===t.newState)c=document.activeElement,this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}));else if(Ft(this,!1),c&&"function"==typeof c.focus){this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}));try{c.focus()}catch(t){}}}),i(this,()=>{(this.classList.contains("is-open")||this.matches(":popover-open"))&&Ft(this,!1)}),a(0)}});c("contour-side-sheet",class extends T{static get observed(){return["open","side","title","mode","size"]}static get properties(){return{open:{attribute:"open",type:Boolean},side:{attribute:"side"},title:{attribute:"title"},mode:{attribute:"mode"},size:{attribute:"size"}}}show(){this.setAttribute("open","")}showModal(){this._sheetForceModal=!0,this.show()}close(){this.removeAttribute("open")}get open(){return this.hasAttribute("open")}set open(t){t?this.show():this.close()}_modal(){return this._sheetForceModal||"non-modal"!==(this.getAttribute("mode")||"modal")}render(){this.classList.add("c-side-sheet"),this.setAttribute("role","dialog"),this._modal()?this.setAttribute("aria-modal","true"):this.removeAttribute("aria-modal"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Side sheet");for(const t of Array.from(this.classList))/^c-side-sheet--(start|end|sm|md|lg)$/.test(t)&&this.classList.remove(t);const t="start"===this.getAttribute("side")?"start":"end";this.classList.add("c-side-sheet--"+t);const e=this.getAttribute("size");"sm"!==e&&"md"!==e&&"lg"!==e||this.classList.add("c-side-sheet--"+e),this.hasAttribute("open")?(this.classList.add("is-open"),this.removeAttribute("inert")):(this.classList.remove("is-open"),this.setAttribute("inert",""));const s=this.getAttribute("title");if(s){this.ensure(".c-side-sheet__title",()=>{const t=document.createElement("div");return t.className="c-side-sheet__title",t}).textContent=s}}enhance(){if(this._wiredSideSheet)return;this._wiredSideSheet=!0;let t=null;const e=t=>{if("Escape"===t.key&&this.hasAttribute("open"))return t.preventDefault(),void this.close();if("Tab"===t.key&&this.hasAttribute("open")&&this._modal()){const e=Array.from(this.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])")).filter(t=>!t.hasAttribute("disabled"));if(!e.length)return void t.preventDefault();const s=e[0],r=e[e.length-1];t.shiftKey&&document.activeElement===s?(t.preventDefault(),r.focus()):t.shiftKey||document.activeElement!==r||(t.preventDefault(),s.focus())}};document.addEventListener("keydown",e),i(this,()=>document.removeEventListener("keydown",e)),this.addEventListener("click",t=>{t.target===this&&this.close()});let s=!1;const r=()=>{const e=this.hasAttribute("open");if(e&&!s){s=!0,t=document.activeElement,this._modal()&&Ft(this,!0);const e=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(e)try{e.focus()}catch(t){}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}))}else if(!e&&s){if(s=!1,this._modal()&&Ft(this,!1),this._sheetForceModal=!1,t&&"function"==typeof t.focus)try{t.focus()}catch(t){}t=null,this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}))}},a=new MutationObserver(r);a.observe(this,{attributes:!0,attributeFilter:["open"]}),this.hasAttribute("open")&&r(),i(this,()=>{a.disconnect(),this.hasAttribute("open")&&this._modal()&&Ft(this,!1)})}});c("contour-tour",class extends T{static get observed(){return["steps","current","open","persist","id"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current"},open:{attribute:"open",type:Boolean},persist:{attribute:"persist",type:Boolean}}}_steps(){let t=[];try{const e=this.getAttribute("steps");t=e?JSON.parse(e):[]}catch(e){f(this,"steps",e),t=[]}return Array.isArray(t)?t:[]}_current(t){const e=Number(this.getAttribute("current")||0);return Number.isFinite(e)?Math.min(Math.max(0,e),Math.max(0,t-1)):0}_storageKey(){return this.id?"contour-tour:"+this.id:(this.hasAttribute("persist")&&!this._tourWarnedNoId&&(this._tourWarnedNoId=!0,console.warn("[contour-tour] persist requires an id attribute")),null)}_completed(){if(!this.hasAttribute("persist"))return!1;const t=this._storageKey();try{return!!t&&"done"===localStorage.getItem(t)}catch(t){return!1}}_markCompleted(){if(!this.hasAttribute("persist"))return;const t=this._storageKey();try{t&&localStorage.setItem(t,"done")}catch(t){}}show(){this.setAttribute("open","")}close(){this.hasAttribute("open")&&(this.removeAttribute("open"),this._markCompleted(),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})))}render(){this.classList.add("c-tour"),this.setAttribute("role","dialog"),this.setAttribute("aria-label",k(this,"tour","Tour"));const t=this._steps();this._tourInitialized||(this._tourInitialized=!0,!t.length||this.hasAttribute("open")||this._completed()||this.setAttribute("open",""));const e=this.hasAttribute("open")&&t.length>0;e?this.removeAttribute("hidden"):this.setAttribute("hidden","");const s=this._current(t.length),r=t[s]||{},i=this.ensure(".c-tour__step",()=>{const t=document.createElement("div");return t.className="c-tour__step",t});i.textContent=k(this,"step","Step")+" "+(s+1)+" / "+t.length;const a=this.ensure(".c-tour__tip",()=>{const t=document.createElement("div");return t.className="c-tour__tip",t});a.setAttribute("aria-live","polite"),a.textContent="string"==typeof r?r:r.text||r.title||"",i.nextSibling!==a&&this.insertBefore(i,a);const n=this.ensure(".c-tour__nav",()=>{const t=document.createElement("div");return t.className="c-tour__nav c-btn-group",t}),o=this.ensure(".c-tour__back",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-tour__back",t.type="button",t},n);o.textContent=k(this,"back","Back"),o.disabled=0===s;const c=this.ensure(".c-tour__next",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-tour__next",t.type="button",t},n);c.textContent=s>=t.length-1?k(this,"done","Done"):k(this,"next","Next");const l=this.ensure(".c-tour__close",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-tour__close",t.type="button",t},n);l.textContent=k(this,"close","Close"),n.firstChild!==o&&n.insertBefore(o,n.firstChild),o.nextSibling!==c&&n.insertBefore(c,o.nextSibling),c.nextSibling!==l&&n.insertBefore(l,c.nextSibling),this._tourTarget&&this._tourTarget.classList&&this._tourTarget.classList.remove("c-tour__target"),this._tourTarget=null;const u=e&&"object"==typeof r&&r?r.target:null;if(u){const t=document.querySelector(u);if(t&&t.classList&&(t.classList.add("c-tour__target"),this._tourTarget=t,"function"==typeof t.scrollIntoView))try{t.scrollIntoView({block:"nearest"})}catch(t){}}e&&this._positionTour(),e?this._tourFocusStep===s&&this._tourOpen||(this._tourFocusStep=s,queueMicrotask(()=>{if(!this.isConnected||!this.hasAttribute("open"))return;const t=this._tourTarget,e=t&&t.isConnected&&"function"==typeof t.focus&&!t.disabled&&t.matches("a[href], button, input, select, textarea, [tabindex]:not([tabindex='-1'])")?t:this.querySelector(".c-tour__next");if(e)try{e.focus({preventScroll:!0})}catch(t){try{e.focus()}catch(t){}}})):this._tourFocusStep=null,this._tourOpen=e}_positionTour(){const t=window.innerWidth,e=window.innerHeight,s=this.offsetWidth||280,r=this.offsetHeight||120,i=this._tourTarget;if(i&&i.getBoundingClientRect){const a=i.getBoundingClientRect();let n=a.bottom+8;n+r>e-8&&(n=Math.max(8,a.top-r-8));const o=Math.min(Math.max(8,a.left),Math.max(8,t-s-8));this.style.insetBlockStart=n+"px",this.style.insetInlineStart=o+"px",this.style.insetBlockEnd="auto",this.style.transform=""}else this.style.insetBlockStart="auto",this.style.insetBlockEnd="1rem",this.style.insetInlineStart="50%",this.style.transform="translateX(-50%)"}enhance(){if(this._wiredTour)return;this._wiredTour=!0;const t=t=>{const e=this._steps();if(!e.length||!this.hasAttribute("open"))return;const s=this._current(e.length);if("next"===t){if(s>=e.length-1)return void this.close();this.setAttribute("current",String(s+1)),this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:!0,composed:!0,detail:{direction:"next",index:s+1}}))}else{if(0===s)return;this.setAttribute("current",String(s-1)),this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:!0,composed:!0,detail:{direction:"prev",index:s-1}}))}};this._tourStep=t,this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target:null;s&&(s.closest(".c-tour__next")?t("next"):s.closest(".c-tour__back")?t("prev"):s.closest(".c-tour__close")&&this.close())});const e=e=>{if(!this.hasAttribute("open"))return;const s=e.target&&e.target.tagName;if("INPUT"===s||"TEXTAREA"===s||"SELECT"===s)return;if("Escape"===e.key)return void this.close();(this.contains(e.target)||this._tourTarget&&(e.target===this._tourTarget||this._tourTarget.contains(e.target)))&&("ArrowRight"===e.key?(e.preventDefault(),t("next")):"ArrowLeft"===e.key&&(e.preventDefault(),t("prev")))};document.addEventListener("keydown",e);const s=()=>{this.hasAttribute("open")&&this._positionTour()};window.addEventListener("scroll",s,{passive:!0,capture:!0}),window.addEventListener("resize",s,{passive:!0}),i(this,()=>{document.removeEventListener("keydown",e),window.removeEventListener("scroll",s,{capture:!0}),window.removeEventListener("resize",s),this._tourTarget&&this._tourTarget.classList&&this._tourTarget.classList.remove("c-tour__target")})}});c("contour-responsive-content",class extends T{static get observed(){return["breakpoint"]}static get properties(){return{breakpoint:{attribute:"breakpoint"}}}render(){this.classList.add("c-responsive-content");const t=this.getAttribute("breakpoint")||"md";this.dataset.breakpoint=t}});c("contour-palette-editor",class extends T{static get observed(){return["colors"]}static get properties(){return{colors:{attribute:"colors"}}}_palette(){let t=[];try{const e=this.getAttribute("colors");t=e?JSON.parse(e):[]}catch(t){f(this,"colors",t)}return Array.isArray(t)||(t=[]),t.map(t=>"string"==typeof t?{color:t,name:t}:{color:String(t.color||t.value||"#000000"),name:String(t.name||t.label||t.color||t.value||"color")})}_writePalette(t){this.setAttribute("colors",JSON.stringify(t.map(t=>t.name===t.color?t.color:{color:t.color,name:t.name})))}render(){this.classList.add("c-palette-editor"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"palette-editor","Palette editor"));const t=this._palette();Array.from(this.querySelectorAll(".c-palette-editor__swatch, .c-palette-editor__edit, .c-palette-editor__remove, .c-palette-editor__add, .c-palette-editor__contrast")).forEach(t=>t.remove()),t.forEach((t,e)=>{const s=document.createElement("button");s.className="c-palette-editor__swatch c-swatch"+(this._paletteSelected===e?" is-selected":""),s.type="button",s.style.background=_(t.color),s.dataset.color=t.color,s.dataset.index=String(e),s.setAttribute("aria-label",t.name),s.setAttribute("aria-pressed",String(this._paletteSelected===e)),this.appendChild(s);const r=document.createElement("input");r.type="color",r.className="c-palette-editor__edit",r.value=/^#[0-9a-f]{6}$/i.test(t.color)?t.color:"#000000",r.dataset.index=String(e),r.setAttribute("aria-label",k(this,"edit","Edit")+" "+t.name),this.appendChild(r);const i=document.createElement("button");i.type="button",i.className="c-palette-editor__remove",i.dataset.index=String(e),i.setAttribute("aria-label",k(this,"remove","Remove")+" "+t.name),i.textContent="×",this.appendChild(i)});const e=document.createElement("button");e.type="button",e.className="c-palette-editor__add",e.setAttribute("aria-label",k(this,"add-color","Add color")),e.textContent="+",this.appendChild(e);const s=t[this._paletteSelected];if(s){const t=(t=>{const e=/^#([0-9a-f]{6})$/i.exec(t);if(!e)return null;const s=parseInt(e[1],16),r=[s>>16&255,s>>8&255,255&s].map(t=>(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4));return.2126*r[0]+.7152*r[1]+.0722*r[2]})(s.color),e=document.createElement("span");if(e.className="c-palette-editor__contrast",null===t)e.textContent=s.color;else{const r=(t,e)=>(Math.max(t,e)+.05)/(Math.min(t,e)+.05),i=r(t,1),a=r(t,0),n=Math.max(i,a);e.textContent=s.name+": "+i.toFixed(1)+":1 on white, "+a.toFixed(1)+":1 on black — "+(n>=4.5?"AA":"below AA")}this.appendChild(e)}}enhance(){this._wiredPaletteEditor||(this._wiredPaletteEditor=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target:null;if(!e)return;const s=e.closest(".c-palette-editor__swatch");if(s&&this.contains(s))return this._paletteSelected=Number(s.dataset.index),this.requestRender(),void this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{color:s.dataset.color}}));const r=e.closest(".c-palette-editor__remove");if(r&&this.contains(r)){const t=this._palette(),e=Number(r.dataset.index),[s]=t.splice(e,1);return this._paletteSelected>=t.length&&(this._paletteSelected=t.length-1),this._writePalette(t),void this.dispatchEvent(new CustomEvent("contour:remove",{bubbles:!0,composed:!0,detail:{value:s?s.color:""}}))}if(e.closest(".c-palette-editor__add")){const t=this._palette(),e="#888888";t.push({color:e,name:e}),this._paletteSelected=t.length-1,this._writePalette(t),this.dispatchEvent(new CustomEvent("contour:add",{bubbles:!0,composed:!0,detail:{value:e}}))}}),this.addEventListener("change",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-palette-editor__edit"):null;if(!e||!this.contains(e))return;const s=this._palette(),r=Number(e.dataset.index);s[r]&&(s[r].color=e.value,(s[r].name===s[r].color||/^#[0-9a-f]{6}$/i.test(s[r].name))&&(s[r].name=e.value),this._writePalette(s),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{color:e.value,values:s.map(t=>t.color)}})))}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-palette-editor__swatch"));e.includes(t.target)&&z(t,e,{wrap:!0,enter:!0,onKey:(t,e,s)=>{"Enter"!==t&&" "!==t||s.click()}})}))}});c("contour-date-range",class extends T{static get observed(){return["start","end","label","time","min","max","locale","name","required","disabled"]}static get properties(){return{start:{attribute:"start"},end:{attribute:"end"},label:{attribute:"label"},time:{attribute:"time",type:Boolean},min:{attribute:"min"},max:{attribute:"max"},locale:{attribute:"locale"},name:{attribute:"name"},required:{attribute:"required",type:Boolean},disabled:{attribute:"disabled",type:Boolean}}}static get formAssociated(){return!0}render(){this.classList.add("c-date-range"),void 0===this._dateRangeDefaultStart&&(this._dateRangeDefaultStart=this.getAttribute("start"),this._dateRangeDefaultEnd=this.getAttribute("end")),this.setAttribute("role","group"),this.setAttribute("aria-label",this.getAttribute("label")||"Date range");const t=this.getAttribute("label");if(t){this.ensure(".c-date-range__label",()=>{const t=document.createElement("span");return t.className="c-date-range__label",t}).textContent=t}const e=this.ensure(".c-date-range__start",()=>{const t=document.createElement("input");return t.className="c-input c-date-range__start",t});e.type=this.hasAttribute("time")?"datetime-local":"date",e.value=this.getAttribute("start")||"",e.setAttribute("aria-label",t?t+" — start":"Start date");const s=this.ensure(".c-date-range__end",()=>{const t=document.createElement("input");return t.className="c-input c-date-range__end",t});s.type=e.type,s.value=this.getAttribute("end")||"",s.setAttribute("aria-label",t?t+" — end":"End date");const r=this.getAttribute("min"),i=this.getAttribute("max");[e,s].forEach(t=>{r?t.min=r:t.removeAttribute("min"),i?t.max=i:t.removeAttribute("max"),this.getAttribute("locale")&&(t.lang=this.getAttribute("locale")),this.hasAttribute("disabled")?t.setAttribute("disabled",""):t.removeAttribute("disabled")}),e.value&&(s.min=r&&r>e.value?r:e.value),s.value&&(e.max=i&&i<s.value?i:s.value),this.hasAttribute("required")?this.setAttribute("aria-required","true"):this.removeAttribute("aria-required"),this._internals&&this._syncFormValue()}enhance(){this._wiredDateRange||(this._wiredDateRange=!0,this.addEventListener("change",t=>{const e=t.target;if(e&&(e.classList.contains("c-date-range__start")||e.classList.contains("c-date-range__end"))){const t=this.querySelector(".c-date-range__start"),e=this.querySelector(".c-date-range__end");this.batch(()=>{t&&this.setAttribute("start",t.value),e&&this.setAttribute("end",e.value)}),this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{start:t?.value,end:e?.value}}))}}))}_syncFormValue(){if(!this._internals)return;const t=this.querySelector(".c-date-range__start")?.value||"",e=this.querySelector(".c-date-range__end")?.value||"",s=this.getAttribute("name");if(s&&(t||e)){const r=new FormData;t&&r.append(s,t),e&&r.append(s,e),this._internals.setFormValue(r)}else this._internals.setFormValue(null);const r=this.hasAttribute("required")&&(!t||!e),i=!!(t&&e&&t>e);r?this._internals.setValidity({valueMissing:!0},"Both dates are required."):i?this._internals.setValidity({customError:!0},"Start must be on or before end."):this._internals.setValidity({}),this._setCustomState("data-invalid",r||i);for(const t of this.querySelectorAll("input"))t.setAttribute("aria-invalid",String(r||i))}formResetCallback(){this._contourResetting=!0;try{null===this._dateRangeDefaultStart?this.removeAttribute("start"):this.setAttribute("start",this._dateRangeDefaultStart),null===this._dateRangeDefaultEnd?this.removeAttribute("end"):this.setAttribute("end",this._dateRangeDefaultEnd),this._syncFormValue()}finally{this._contourResetting=!1}}formStateRestoreCallback(t){if(!this._internals||null==t)return;const e=t instanceof FormData?Array.from(t.getAll(this.getAttribute("name"))).map(String):String(t).split(",");this._contourResetting=!0;try{this.setAttribute("start",e[0]||""),this.setAttribute("end",e[1]||""),this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-shortcut",class extends T{static get observed(){return["key","label"]}static get properties(){return{key:{attribute:"key"},label:{attribute:"label"}}}render(){this.classList.add("c-shortcut"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Keyboard shortcut");const t=this.getAttribute("key")||"",e=this.getAttribute("label")||"";if(t){this.ensure(".c-shortcut__key",()=>{const t=document.createElement("kbd");return t.className="c-shortcut__key",t}).textContent=t}if(e){this.ensure(".c-shortcut__label",()=>{const t=document.createElement("span");return t.className="c-shortcut__label",t}).textContent=e}}enhance(){if(this._wiredShortcut)return;this._wiredShortcut=!0;const t=t=>{const e=this.getAttribute("key");e&&t.key===e&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0})))};document.addEventListener("keydown",t),i(this,()=>document.removeEventListener("keydown",t))}});c("contour-date-picker",class extends T{static get formAssociated(){return!0}static get observed(){return["value","range","range-start","range-end","label","disabled","error","help","time","min","max","locale","required","name"]}static get properties(){return{value:{attribute:"value"},range:{attribute:"range",type:Boolean},rangeStart:{attribute:"range-start"},rangeEnd:{attribute:"range-end"},label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},time:{attribute:"time",type:Boolean},min:{attribute:"min"},max:{attribute:"max"},locale:{attribute:"locale"}}}render(){this.classList.add("c-date-picker"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"date-picker","Date picker"));const t=this.getAttribute("label");if(t){this.ensure(".c-date-picker__label",()=>{const t=document.createElement("label");return t.className="c-date-picker__label",t}).textContent=t}const e=this.keepNode(this.ensure(".c-date-picker__input",()=>{const t=document.createElement("input");return t.className="c-input c-date-picker__input",t})),s=this.hasAttribute("range"),r=this.hasAttribute("time")?"datetime-local":"date",i=(t,e,s)=>{t.type=r;const i=e||"";document.activeElement!==t&&t.value!==i&&(t.value=i),t.setAttribute("aria-label",s),this.hasAttribute("min")?t.min=this.getAttribute("min"):t.removeAttribute("min"),this.hasAttribute("max")?t.max=this.getAttribute("max"):t.removeAttribute("max"),this.hasAttribute("locale")?t.lang=this.getAttribute("locale"):t.removeAttribute("lang"),this.hasAttribute("disabled")?t.setAttribute("disabled",""):t.removeAttribute("disabled")};i(e,s?this.getAttribute("range-start"):this.getAttribute("value"),s?"Start date":t||"Date");let a=this.querySelector(".c-date-picker__end");s?(a=this.keepNode(a||document.createElement("input")),a.className="c-input c-date-picker__input c-date-picker__end",i(a,this.getAttribute("range-end"),"End date"),a.parentNode!==this&&this.appendChild(a)):a&&a.remove();const n=this.getAttribute("min"),c=this.getAttribute("max"),l=t=>{if(!n&&!c)return;const e=t.value;if(!e)return;let s=e;n&&s<n&&(s=n),c&&s>c&&(s=c),s!==e&&document.activeElement!==t&&(t.value=s)};l(e),a&&l(a),this.hasAttribute("disabled")?this.classList.add("is-disabled"):this.classList.remove("is-disabled");const u=this.getAttribute("error"),d=this.getAttribute("help");let h=this.querySelector(".c-date-picker__message");u||d?(h||(h=document.createElement("div"),h.className="c-date-picker__message",h.id||(h.id=o("c-date-picker-message")),this.appendChild(h)),h.textContent=u||d||"",h.classList.toggle("c-date-picker__message--error",!!u)):h&&h.remove(),u?this.classList.add("is-error"):this.classList.remove("is-error");let m=!!u;this.hasAttribute("range")&&(m=m||this._validateRange());const b=h?h.id:"",p=t=>{m?t.setAttribute("aria-invalid","true"):t.removeAttribute("aria-invalid"),b?t.setAttribute("aria-describedby",b):t.removeAttribute("aria-describedby")};p(e);const g=this.querySelector(".c-date-picker__end");g&&p(g);this.keepNode(this.ensure(".c-date-picker__calendar-toggle",()=>{const t=document.createElement("button");t.className="c-btn c-btn--sm c-date-picker__calendar-toggle",t.type="button",t.setAttribute("aria-label",k(this,"open-calendar","Open calendar")),t.setAttribute("aria-expanded","false");const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true");const s=document.createElementNS("http://www.w3.org/2000/svg","use");return s.setAttribute("href","#i-chevron-down"),e.appendChild(s),t.appendChild(e),t}));let _=this.querySelector(".c-date-picker__calendar");_||(_=document.createElement("div"),_.className="c-date-picker__calendar",_.setAttribute("hidden",""),_.setAttribute("role","dialog"),_.setAttribute("aria-label",k(this,"calendar","Calendar")),this.appendChild(_)),this.keepNode(_),this._internals&&this._syncFormValue()}_renderCalendar(){const t=this.querySelector(".c-date-picker__calendar");if(!t)return;const e=this.querySelector(".c-date-picker__input"),s=e&&e.value?(t=>{const e=/^(\d{4})-(\d{2})-(\d{2})/.exec(t||"");return e?new Date(Number(e[1]),Number(e[2])-1,Number(e[3])):new Date})(e.value):new Date,r=this._calMonth||new Date(s.getFullYear(),s.getMonth(),1);this._calMonth=r;const i=r.getFullYear(),a=r.getMonth(),n=this.getAttribute("locale")||void 0,o=this._datePickerFirstDayOfWeek(n),c=(new Date(i,a,1).getDay()-o+7)%7,l=new Date(i,a+1,0).getDate();L(t,"");const u=document.createElement("div");u.className="c-date-picker__calendar-header";const d=document.createElement("button");d.type="button",d.className="c-btn c-btn--sm c-btn--icon",L(d,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-left" /></svg>'),d.setAttribute("aria-label",k(this,"previous-month","Previous month"));const h=document.createElement("span");h.className="c-date-picker__calendar-title",h.textContent=r.toLocaleString(this.getAttribute("locale")||void 0,{month:"long",year:"numeric"});const m=document.createElement("button");m.type="button",m.className="c-btn c-btn--sm c-btn--icon",L(m,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),m.setAttribute("aria-label",k(this,"next-month","Next month")),u.appendChild(d),u.appendChild(h),u.appendChild(m),t.appendChild(u);const b=document.createElement("div");b.className="c-date-picker__calendar-grid",b.setAttribute("role","grid"),b.setAttribute("aria-label",h.textContent);const p=()=>{const t=document.createElement("div");return t.className="c-date-picker__calendar-row",t.setAttribute("role","row"),b.appendChild(t),t};let g=p(),_=0;const v=t=>{7===_&&(g=p(),_=0),g.appendChild(t),_++},y=["Su","Mo","Tu","We","Th","Fr","Sa"],f=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];for(let t=0;t<7;t++){const e=(o+t)%7,s=document.createElement("div");s.className="c-date-picker__calendar-weekday",s.setAttribute("role","columnheader");const r=new Date(2026,0,e+1);s.setAttribute("aria-label",r.toLocaleDateString(n,{weekday:"long"})||f[e]),s.textContent=r.toLocaleDateString(n,{weekday:"short"})||y[e],v(s)}for(let t=0;t<c;t++){const t=document.createElement("div");t.className="c-date-picker__calendar-day c-date-picker__calendar-day--empty",t.setAttribute("role","gridcell"),t.setAttribute("aria-hidden","true"),v(t)}const A=e?e.value:"",E=A&&A.slice(0,7)===`${i}-${String(a+1).padStart(2,"0")}`&&parseInt(A.slice(8,10),10)||1,w=this.getAttribute("min"),x=this.getAttribute("max");for(let s=1;s<=l;s++){const r=document.createElement("button");r.type="button",r.className="c-date-picker__calendar-day",r.textContent=String(s),r.setAttribute("role","gridcell"),r.setAttribute("tabindex",s===E?"0":"-1"),r.setAttribute("aria-label",new Date(i,a,s).toLocaleDateString(this.getAttribute("locale")||void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric"}));const n=`${i}-${String(a+1).padStart(2,"0")}-${String(s).padStart(2,"0")}`;A&&A.startsWith(n)&&(r.classList.add("is-selected"),r.setAttribute("aria-selected","true"));const o=w&&n<w||x&&n>x;r.disabled=o,o&&r.setAttribute("aria-disabled","true"),r.setAttribute("tabindex",o?"-1":s===E?"0":"-1"),o?v(r):(r.addEventListener("click",()=>{if(!e)return;if(this.hasAttribute("range")){const t=this.querySelector(".c-date-picker__end");!1!==this._rangeStartNext?(this.setAttribute("range-start",n),this._rangeStartNext=!1):t&&(this.setAttribute("range-end",n),this._rangeStartNext=!0)}else this.setAttribute("value",n);t.setAttribute("hidden","");const s=this.querySelector(".c-date-picker__calendar-toggle");s&&s.setAttribute("aria-expanded","false"),this._validateRange(),this._internals&&this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:this.getAttribute("value")}}))}),v(r))}t.appendChild(b),d.addEventListener("click",()=>{this._calMonth=new Date(i,a-1,1),this._renderCalendar()}),m.addEventListener("click",()=>{this._calMonth=new Date(i,a+1,1),this._renderCalendar()}),this._internals&&this._syncFormValue()}_syncFormValue(){if(!this._internals)return;const t=this.querySelector(".c-date-picker__input"),e=this.querySelector(".c-date-picker__end");if(this.hasAttribute("range")&&e){const s=t?t.value:"",r=e.value||"",i=this.getAttribute("name");if(i&&(s||r)){const t=new FormData;s&&t.append(i,s),r&&t.append(i,r),this._internals.setFormValue(t)}else this._internals.setFormValue(null)}else this._internals.setFormValue(t&&t.value?t.value:null);this._syncValidity(this.hasAttribute("required")&&!(t&&t.value))}formResetCallback(){const t=()=>{const t=this.querySelector(".c-date-picker__input"),e=this.querySelector(".c-date-picker__end");t&&(t.value=this.getAttribute("range-start")||this.getAttribute("value")||""),e&&(e.value=this.getAttribute("range-end")||""),this._syncFormValue()};t(),"function"==typeof queueMicrotask&&queueMicrotask(t)}_datePickerFirstDayOfWeek(t){return["en-US","en-CA","en-PH","ja-JP","ko-KR","th-TH","ar-SA","he-IL"].includes(String(t||"").toLowerCase())?0:1}_validateRange(){if(!this.hasAttribute("range"))return!1;const t=this.querySelector(".c-date-picker__input"),e=this.querySelector(".c-date-picker__end");if(!t||!e)return!1;const s=!!t.value&&!!e.value&&t.value>e.value;return this.getAttribute("error")||(s?(t.setAttribute("aria-invalid","true"),e.setAttribute("aria-invalid","true")):(t.removeAttribute("aria-invalid"),e.removeAttribute("aria-invalid"))),s}enhance(){if(this._wiredDatePicker)return;this._wiredDatePicker=!0,this._syncFormValue(),this.addEventListener("change",()=>{this._syncFormValue()}),this.addEventListener("change",t=>{const e=t.target;if(e&&e.classList.contains("c-date-picker__input")){const t=this.querySelector(".c-date-picker__end"),s=t?{start:this.querySelector(".c-date-picker__input").value,end:t.value}:{value:e.value};this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:s}))}});const t=()=>{const t=this.querySelector(".c-date-picker__calendar"),e=this.querySelector(".c-date-picker__calendar-toggle");if(!t)return;t.hasAttribute("hidden")?(t.removeAttribute("hidden"),e&&e.setAttribute("aria-expanded","true"),this._renderCalendar()):(t.setAttribute("hidden",""),e&&e.setAttribute("aria-expanded","false"))};this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-date-picker__calendar-toggle"):null;s&&this.contains(s)&&(e.preventDefault(),t());const r=this.querySelector(".c-date-picker__calendar");if(r&&!r.hasAttribute("hidden")&&!r.contains(e.target)&&!s){r.setAttribute("hidden","");const t=this.querySelector(".c-date-picker__calendar-toggle");t&&t.setAttribute("aria-expanded","false")}}),this.addEventListener("keydown",t=>{const e=this.querySelector(".c-date-picker__calendar");if(!e||e.hasAttribute("hidden"))return;if("Escape"===t.key){t.preventDefault(),e.setAttribute("hidden","");const s=this.querySelector(".c-date-picker__calendar-toggle");return void(s&&(s.setAttribute("aria-expanded","false"),s.focus()))}const s=Array.from(e.querySelectorAll('[role="gridcell"]:not([aria-hidden="true"])')),r=s.indexOf(document.activeElement);if(r<0)return;if("PageUp"===t.key||"PageDown"===t.key){t.preventDefault();const e=this.querySelector("PageUp"===t.key?".c-date-picker__calendar-header button:first-child":".c-date-picker__calendar-header button:last-child");return void(e&&e.click())}let i=-1;if("ArrowRight"===t.key)i=r+1;else if("ArrowLeft"===t.key)i=r-1;else if("ArrowDown"===t.key)i=r+7;else if("ArrowUp"===t.key)i=r-7;else if("Home"===t.key)i=0;else{if("End"!==t.key)return;i=s.length-1}t.preventDefault(),i<0||i>=s.length||(s.forEach((t,e)=>t.setAttribute("tabindex",e===i?"0":"-1")),s[i].focus())})}});c("contour-rating",class extends T{static get observed(){return["value","max","color","readonly","disabled","name"]}static get properties(){return{value:{attribute:"value",type:Number},max:{attribute:"max",type:Number},color:{attribute:"color"},readonly:{attribute:"readonly",type:Boolean},disabled:{attribute:"disabled",type:Boolean},name:{attribute:"name"}}}static get formAssociated(){return!0}render(){this.classList.add("c-rating"),this.hasAttribute("role")||this.setAttribute("role","radiogroup"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"rating","Rating"));const t=parseInt(this.getAttribute("max")||"5",10)||5,e=parseInt(this.getAttribute("value")||"0",10)||0,s=this.getAttribute("color"),r=w(this,"readonly"),i=w(this,"disabled");Array.from(this.querySelectorAll(".c-rating__star")).forEach(t=>t.remove());const a=e>=1&&e<=t?e:1;for(let n=1;n<=t;n++){const t=document.createElement("button");if(t.className="c-rating__star"+(n<=e?" c-rating__star--filled":""),t.type="button",t.setAttribute("role","radio"),t.setAttribute("aria-checked",String(n===e)),t.setAttribute("aria-label",n+(1===n?" star":" stars")),t.setAttribute("tabindex",String(n===a?0:-1)),(r||i)&&(t.setAttribute("aria-disabled","true"),t.disabled=!0,t.tabIndex=-1),L(t,'<span class="c-rating__swatch'+(n<=e?" c-rating__swatch--filled":"")+'" aria-hidden="true"></span>'),s&&n<=e){const e=t.firstChild,r=_(s);e&&r&&(e.style.backgroundColor=r,e.style.borderColor=r)}t.dataset.value=String(n),t.setAttribute("aria-label",n+" star"+(n>1?"s":"")),this.appendChild(t)}this._internals&&this._syncFormValue()}_syncFormValue(){if(!this._internals)return;const t=this.getAttribute("name"),e=this.getAttribute("value");t&&e?this._internals.setFormValue(e):this._internals.setFormValue(null)}enhance(){if(this._wiredRating)return;this._wiredRating=!0;const t=()=>Array.from(this.querySelectorAll(".c-rating__star")),e=e=>{w(this,"readonly")||w(this,"disabled")||(t().forEach(t=>{const s=parseInt(t.dataset.value,10)===e;t.setAttribute("aria-checked",String(s)),t.setAttribute("tabindex",s?"0":"-1"),t.classList.toggle("c-rating__star--filled",parseInt(t.dataset.value,10)<=e);const r=t.querySelector(".c-rating__swatch");r&&r.classList.toggle("c-rating__swatch--filled",parseInt(t.dataset.value,10)<=e)}),this.setAttribute("value",String(e)),this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:e}})))};this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-rating__star"):null;s&&this.contains(s)&&e(parseInt(s.dataset.value,10))}),this.addEventListener("keydown",s=>{const r=t();r.length&&z(s,r,{wrap:!1,homeEnd:!0,onNavigate:t=>{e(parseInt(r[t].dataset.value,10))},onKey:(t,s)=>{"Enter"!==t&&" "!==t||e(parseInt(r[s].dataset.value,10))}})})}});c("contour-time-picker",class extends T{static get formAssociated(){return!0}static get observed(){return["value","label","disabled","error","help"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"}}}render(){this.classList.add("c-time-picker"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"time-picker","Time picker"));const t=this.getAttribute("label");if(t){this.ensure(".c-time-picker__label",()=>{const t=document.createElement("label");return t.className="c-time-picker__label",t}).textContent=t}const e=this.ensure(".c-time-picker__input",()=>{const t=document.createElement("input");return t.className="c-input c-time-picker__input",t.type="time",t.setAttribute("aria-label",this.getAttribute("label")||"Time picker"),t});e.value=this.getAttribute("value")||"",this.hasAttribute("disabled")?(e.setAttribute("disabled",""),this.classList.add("is-disabled")):(e.removeAttribute("disabled"),this.classList.remove("is-disabled"));const s=this.getAttribute("error"),r=this.getAttribute("help");let i=this.querySelector(".c-time-picker__message");s||r?(i||(i=document.createElement("div"),i.className="c-time-picker__message",i.id||(i.id=o("c-time-picker-message")),this.appendChild(i)),i.textContent=s||r||"",i.classList.toggle("c-time-picker__message--error",!!s)):i&&i.remove(),s?this.classList.add("is-error"):this.classList.remove("is-error");const a=i?i.id:"";s?e.setAttribute("aria-invalid","true"):e.removeAttribute("aria-invalid"),a?e.setAttribute("aria-describedby",a):e.removeAttribute("aria-describedby"),this._internals&&this._syncFormValue()}enhance(){this._wiredTimePicker||(this._wiredTimePicker=!0,this._syncFormValue(),this.addEventListener("change",()=>{this._syncFormValue()}),this.addEventListener("change",t=>{const e=t.target;e&&e.classList.contains("c-time-picker__input")&&this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:e.value}}))}))}});c("contour-color-picker",class extends T{static get formAssociated(){return!0}static get observed(){return["value","label","disabled","required","error","help","alpha","presets"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean},required:{attribute:"required",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},alpha:{attribute:"alpha",type:Boolean},presets:{attribute:"presets"}}}render(){this.classList.add("c-color-picker"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"color-picker","Color picker"));const t=this.getAttribute("label");if(t){this.ensure(".c-color-picker__label",()=>{const t=document.createElement("label");return t.className="c-color-picker__label",t}).textContent=t}const e=this.ensure(".c-color-picker__input",()=>{const t=document.createElement("input");return t.className="c-color-picker__input",t.type="color",t}),s=this.getAttribute("value")||"",r=/^#?[0-9a-f]{6}([0-9a-f]{2})?$/i.test(s);if(r?(e.value=s.slice(0,7),this.removeAttribute("data-empty")):(e.value="",this.setAttribute("data-empty","")),e.hasAttribute("aria-label")||e.setAttribute("aria-label",t||"Color"),this.hasAttribute("required")?e.setAttribute("required",""):e.removeAttribute("required"),this.hasAttribute("disabled")?(e.setAttribute("disabled",""),this.classList.add("is-disabled")):(e.removeAttribute("disabled"),this.classList.remove("is-disabled")),this.hasAttribute("alpha")){const t=this.ensure(".c-color-picker__alpha",()=>{const t=document.createElement("input");return t.className="c-color-picker__alpha",t.type="range",t.min="0",t.max="1",t.step="0.01",t}),e=r&&9===s.length?parseInt(s.slice(7,9),16)/255:1;t.value=String(e),t.setAttribute("aria-label",k(this,"alpha","Alpha"))}else{const t=this.querySelector(".c-color-picker__alpha");t&&t.remove()}const i=this.getAttribute("presets");let a=[];if(i)try{a=JSON.parse(i)}catch(t){f(this,"presets",t),a=[]}const n=this.querySelector(".c-color-picker__presets");if(n&&n.remove(),Array.isArray(a)&&a.length){const t=document.createElement("div");t.className="c-color-picker__presets",a.forEach(e=>{const s=document.createElement("button");s.type="button",s.className="c-color-picker__preset";const r=_(e);r&&(s.style.background=r,s.dataset.color=r,s.setAttribute("aria-label",k(this,"preset","Preset")+" "+e),t.appendChild(s))}),this.appendChild(t)}if("undefined"!=typeof window&&"EyeDropper"in window){const t=this.ensure(".c-color-picker__eyedropper",()=>{const t=document.createElement("button");return t.className="c-color-picker__eyedropper",t.type="button",t.textContent=k(this,"pick","Pick"),t.setAttribute("aria-label",k(this,"pick-color","Pick color from screen")),t});this.hasAttribute("disabled")?t.setAttribute("disabled",""):t.removeAttribute("disabled")}else{const t=this.querySelector(".c-color-picker__eyedropper");t&&t.remove()}const c=this.getAttribute("error"),l=this.getAttribute("help");let u=this.querySelector(".c-color-picker__message");c||l?(u||(u=document.createElement("div"),u.className="c-color-picker__message",u.id||(u.id=o("c-color-picker-message")),this.appendChild(u)),u.textContent=c||l||"",u.classList.toggle("c-color-picker__message--error",!!c)):u&&u.remove(),c?this.classList.add("is-error"):this.classList.remove("is-error");const d=u?u.id:"";c?e.setAttribute("aria-invalid","true"):e.removeAttribute("aria-invalid"),d?e.setAttribute("aria-describedby",d):e.removeAttribute("aria-describedby"),this._internals&&this._syncFormValue()}enhance(){this._wiredColorPicker||(this._wiredColorPicker=!0,this._syncFormValue(),this.addEventListener("change",()=>{this._syncFormValue()}),this.addEventListener("contour:change",()=>{this._syncFormValue()}),this.addEventListener("change",t=>{const e=t.target;if(e&&e.classList.contains("c-color-picker__input")){const t=this.getAttribute("value")||"",s=9===t.length?t.slice(7,9):"",r=e.value.slice(0,7)+s;this.setAttribute("value",r),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:r}}))}if(e&&e.classList.contains("c-color-picker__alpha")){const t=(this.getAttribute("value")||"#000000").slice(0,7)+Math.round(255*parseFloat(e.value)).toString(16).padStart(2,"0");this.setAttribute("value",t),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t}}))}}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-color-picker__preset"):null;if(e&&this.contains(e)){const t=e.dataset.color;if(t){this.setAttribute("value",t);const e=this.querySelector(".c-color-picker__input");e&&(e.value=t.slice(0,7)),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t}}))}}const s=t.target&&t.target.closest?t.target.closest(".c-color-picker__eyedropper"):null;if(s&&this.contains(s)&&"undefined"!=typeof window&&"EyeDropper"in window){t.preventDefault();(new window.EyeDropper).open().then(t=>{if(t&&t.sRGBHex){this.setAttribute("value",t.sRGBHex);const e=this.querySelector(".c-color-picker__input");e&&(e.value=t.sRGBHex),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t.sRGBHex}}))}}).catch(()=>{})}}))}});c("contour-number-field",class extends T{static get formAssociated(){return!0}static get observed(){return["value","min","max","step","label","disabled","error","help"]}static get properties(){return{value:{attribute:"value"},min:{attribute:"min"},max:{attribute:"max"},step:{attribute:"step"},label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"}}}render(){this.classList.add("c-number-field");const t=this.getAttribute("label");if(t){this.ensure(".c-number-field__label",()=>{const t=document.createElement("label");return t.className="c-number-field__label",t}).textContent=t}const e=this.ensure(".c-number-field__input",()=>{const t=document.createElement("input");return t.className="c-input c-number-field__input",t.type="number",t.setAttribute("role","spinbutton"),t});e.id||(e.id=o("nf-input"));const s=this.querySelector(".c-number-field__label");s&&s.setAttribute("for",e.id),null!==this.getAttribute("value")&&(e.value=this.getAttribute("value")),null!==this.getAttribute("min")&&(e.min=this.getAttribute("min")),null!==this.getAttribute("max")&&(e.max=this.getAttribute("max")),null!==this.getAttribute("step")&&(e.step=this.getAttribute("step"));const r=e.value;e.setAttribute("aria-valuenow",""===r?"":r),""!==e.min&&e.setAttribute("aria-valuemin",e.min),""!==e.max&&e.setAttribute("aria-valuemax",e.max),e.hasAttribute("aria-label")||e.setAttribute("aria-label",t||"Number"),this.hasAttribute("disabled")?(e.setAttribute("disabled",""),this.classList.add("is-disabled")):(e.removeAttribute("disabled"),this.classList.remove("is-disabled"));const i=this.getAttribute("error"),a=this.getAttribute("help");let n=this.querySelector(".c-number-field__message");i||a?(n||(n=document.createElement("div"),n.className="c-number-field__message",this.appendChild(n)),n.id||(n.id=o("nf-msg")),n.textContent=i||a||"",n.classList.toggle("c-number-field__message--error",!!i),i?n.setAttribute("role","alert"):n.removeAttribute("role"),e.setAttribute("aria-describedby",n.id)):(n&&n.remove(),e.removeAttribute("aria-describedby")),i?(this.classList.add("is-error"),e.setAttribute("aria-invalid","true")):(this.classList.remove("is-error"),e.removeAttribute("aria-invalid")),this._internals&&this._syncFormValue()}enhance(){this._wiredNumberField||(this._wiredNumberField=!0,this._syncFormValue(),this.addEventListener("change",()=>{this._syncFormValue()}),this.addEventListener("change",t=>{const e=t.target;e&&e.classList.contains("c-number-field__input")&&this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:e.value}}))}),this.addEventListener("keydown",t=>{const e=this.querySelector(".c-number-field__input");if(!e||document.activeElement!==e)return;const s=Number(e.step)||1,r=""===e.min?-1/0:Number(e.min),i=""===e.max?1/0:Number(e.max);let a=null;"ArrowUp"===t.key?a=(Number(e.value)||0)+s:"ArrowDown"===t.key?a=(Number(e.value)||0)-s:"Home"===t.key?a=r===-1/0?0:r:"End"===t.key&&(a=i===1/0?Number(e.value)||0:i),null!==a&&(t.preventDefault(),a=Math.min(i,Math.max(r,a)),e.value=String(a),e.setAttribute("aria-valuenow",String(a)),this.setAttribute("value",String(a)),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:e.value}})))}))}});c("contour-file-upload",class extends T{static get formAssociated(){return!0}static get observed(){return["label","accept","multiple","progress","name"]}static get properties(){return{label:{attribute:"label"},accept:{attribute:"accept"},multiple:{attribute:"multiple",type:Boolean},progress:{attribute:"progress"},name:{attribute:"name"}}}render(){this.classList.add("c-file-upload"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"File upload");const t=this.getAttribute("label")||"Drop files here or click to browse";this.ensure(".c-file-upload__dropzone",()=>{const t=document.createElement("div");return t.className="c-file-upload__dropzone",t.setAttribute("role","button"),t.tabIndex=0,t}).textContent=t;const e=this.ensure(".c-file-upload__input",()=>{const t=document.createElement("input");return t.className="c-file-upload__input",t.type="file",t.hidden=!0,t});this.keepNode(e),e.accept=this.getAttribute("accept")||"",e.multiple=this.hasAttribute("multiple");const s=this.getAttribute("progress");if(null!==s){const t=this.ensure(".c-file-upload__progress",()=>{const t=document.createElement("progress");return t.className="c-file-upload__progress",t});t.value=Number(s)||0,t.max=100}else{const t=this.querySelector(".c-file-upload__progress");t&&t.remove()}this.ensure(".c-file-upload__preview",()=>{const t=document.createElement("div");return t.className="c-file-upload__preview",t});this._internals&&this._syncFormValue()}enhance(){if(this._wiredFileUpload)return;this._wiredFileUpload=!0,this._syncFormValue(),this.addEventListener("change",()=>{this._syncFormValue()});const t=()=>this.querySelector(".c-file-upload__dropzone"),e=()=>this.querySelector(".c-file-upload__input"),s=()=>{const t=e();t&&t.click()},r=(t,e)=>{try{const s=new DataTransfer;Array.from(e||[]).forEach(t=>s.items.add(t)),t.files=s.files}catch(t){}};this.addEventListener("click",e=>{const r=t();(e.target===r||r&&r.contains(e.target))&&s()}),this.addEventListener("keydown",e=>{const r=t();!(e.target===r||r&&r.contains(e.target))||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())});const i=t=>{const e=this.querySelector(".c-file-upload__preview");e&&(this._revokeObjectUrls(),L(e,""),Array.from(t||[]).forEach(t=>{const s=document.createElement("div");if(s.className="c-file-upload__preview-item",t.type&&t.type.startsWith("image/")){const e=document.createElement("img");e.className="c-file-upload__preview-thumb",e.alt=t.name,e.loading="lazy",e.decoding="async";try{const s=URL.createObjectURL(t);e.src=s,(this._objectUrls||(this._objectUrls=[])).push(s)}catch(t){}s.appendChild(e)}else{const e=document.createElement("span");e.className="c-file-upload__preview-name",e.textContent=t.name,s.appendChild(e)}e.appendChild(s)}))};this.addEventListener("change",t=>{const e=t.target;e&&e.classList.contains("c-file-upload__input")&&(i(e.files),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{files:e.files}})))}),this.addEventListener("dragover",t=>{t.preventDefault(),this.classList.add("is-dragover")}),this.addEventListener("dragleave",()=>this.classList.remove("is-dragover")),this.addEventListener("drop",t=>{t.preventDefault(),this.classList.remove("is-dragover");const s=e();if(s&&t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length){const e=this.getAttribute("accept");if(e){const a=e.split(",").map(t=>t.trim().toLowerCase()),n=Array.from(t.dataTransfer.files).filter(t=>{const e=t.name.toLowerCase();return a.some(s=>s.startsWith(".")?e.endsWith(s):s.endsWith("/*")?t.type.toLowerCase().startsWith(s.slice(0,-1)):t.type.toLowerCase()===s)});if(0===n.length)return;r(s,n),i(n),this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{files:n}}))}else r(s,t.dataTransfer.files),i(t.dataTransfer.files),this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{files:t.dataTransfer.files}}))}})}disconnectedCallback(){super.disconnectedCallback(),this._revokeObjectUrls()}_revokeObjectUrls(){this._objectUrls&&(this._objectUrls.forEach(t=>{try{URL.revokeObjectURL(t)}catch(t){}}),this._objectUrls=[])}_syncFormValue(){if(!this._internals)return;const t=this.querySelector(".c-file-upload__input");if(t&&t.files&&t.files.length){const e=new FormData,s=this.getAttribute("name")||"file";Array.from(t.files).forEach(t=>e.append(s,t)),this._internals.setFormValue(e)}else this._internals.setFormValue(null)}});c("contour-tags-input",class extends T{static get formAssociated(){return!0}static get observed(){return["value","placeholder","disabled","error","help","required","max"]}static get properties(){return{value:{attribute:"value"},placeholder:{attribute:"placeholder"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},required:{attribute:"required",type:Boolean},max:{attribute:"max"}}}render(){this.classList.add("c-tags-input"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"tags-input","Tags input"));const t=this.ensure(".c-tags-input__input",()=>{const t=document.createElement("input");return t.className="c-input c-tags-input__input",t.type="text",t.setAttribute("aria-label",k(this,"add-tag","Add tag")),t});t.placeholder=this.getAttribute("placeholder")||"Add tag…",this.hasAttribute("disabled")?(t.setAttribute("disabled",""),this.classList.add("is-disabled")):(t.removeAttribute("disabled"),this.classList.remove("is-disabled"));const e=this.getAttribute("error"),s=this.getAttribute("help");let r=this.querySelector(".c-tags-input__message");e||s?(r||(r=document.createElement("div"),r.className="c-tags-input__message",this.appendChild(r)),r.id||(r.id=o("ti-msg")),r.textContent=e||s||"",r.classList.toggle("c-tags-input__message--error",!!e),e?r.setAttribute("role","alert"):r.removeAttribute("role"),t.setAttribute("aria-describedby",r.id)):(r&&r.remove(),t.removeAttribute("aria-describedby")),e?(this.classList.add("is-error"),t.setAttribute("aria-invalid","true")):(this.classList.remove("is-error"),t.removeAttribute("aria-invalid"));const i=this.getAttribute("value");let a=[];try{a=i?JSON.parse(i):[]}catch(t){a=i?i.split(",").map(t=>t.trim()).filter(Boolean):[]}Array.from(this.querySelectorAll(".c-tags-input__tag")).forEach(t=>t.remove()),a.forEach(e=>{const s=document.createElement("span");s.className="c-tag c-tags-input__tag",s.textContent=e;const r=document.createElement("button");r.className="c-tags-input__remove",r.type="button",r.textContent="×",r.setAttribute("aria-label",k(this,"remove","Remove")+" "+e),r.dataset.value=e,s.appendChild(r),this.insertBefore(s,t)}),this._internals&&this._syncFormValue()}enhance(){if(this._wiredTagsInput)return;this._wiredTagsInput=!0,this._syncFormValue(),this.addEventListener("contour:add",()=>{this._syncFormValue()}),this.addEventListener("contour:remove",()=>{this._syncFormValue()});const t=t=>{let e=this.querySelector(".c-tags-input__live");e||(e=document.createElement("span"),e.className="c-tags-input__live visually-hidden",e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),this.appendChild(e)),e.textContent=t},e=()=>{const t=this.getAttribute("value")||"";let e=[];try{e=JSON.parse(t)}catch(s){e=t.split(",").map(t=>t.trim()).filter(Boolean)}return Array.isArray(e)?e.map(String):[]},s=s=>{if(this.hasAttribute("disabled"))return;const r=e(),i=Number(this.getAttribute("max")),a=[],n=[];let o=!1;for(const t of s){const e=String(t).trim();if(e)if(r.includes(e))n.push(e);else{if(Number.isFinite(i)&&i>0&&r.length>=i){o=!0;break}r.push(e),a.push(e)}}if(a.length){this.setAttribute("value",JSON.stringify(r));for(const t of a)this.dispatchEvent(new CustomEvent("contour:add",{bubbles:!0,composed:!0,detail:{value:t}}))}const c=[];a.length&&c.push("Added "+a.join(", ")),n.length&&c.push(n.join(", ")+" already added"),o&&c.push("Tag limit reached ("+i+")"),c.length&&t(c.join(". "))};this.addEventListener("keydown",r=>{const i=this.querySelector(".c-tags-input__input");if(i&&!this.hasAttribute("disabled"))if("Enter"===r.key&&r.target===i){r.preventDefault();const t=i.value;i.value="",s([t])}else if("Backspace"===r.key&&r.target===i&&""===i.value){const s=e();if(s.length){const e=s.pop();this.setAttribute("value",JSON.stringify(s)),t("Removed "+e),this.dispatchEvent(new CustomEvent("contour:remove",{bubbles:!0,composed:!0,detail:{value:e}}))}}}),this.addEventListener("input",t=>{const e=this.querySelector(".c-tags-input__input");if(e&&t.target===e&&!this.hasAttribute("disabled")&&e.value.includes(",")){const t=e.value.split(",");e.value=t.pop(),s(t)}}),this.addEventListener("paste",t=>{const e=this.querySelector(".c-tags-input__input");if(!e||t.target!==e||this.hasAttribute("disabled"))return;const r=t.clipboardData&&t.clipboardData.getData("text/plain");r&&/[,;\n]/.test(r)&&(t.preventDefault(),s(r.split(/[,;\n]+/)))}),this.addEventListener("click",s=>{const r=s.target&&s.target.closest?s.target.closest(".c-tags-input__remove"):null;if(r&&this.contains(r)&&!this.hasAttribute("disabled")){const s=r.dataset.value,i=e().filter(t=>t!==s);this.setAttribute("value",JSON.stringify(i)),t("Removed "+s),this.dispatchEvent(new CustomEvent("contour:remove",{bubbles:!0,composed:!0,detail:{value:s}}))}})}_syncFormValue(){if(!this._internals)return;this._internals.setFormValue(this.getAttribute("value")||"[]");let t=0;try{const e=JSON.parse(this.getAttribute("value")||"[]");t=Array.isArray(e)?e.length:0}catch(e){t=(this.getAttribute("value")||"").split(",").filter(t=>t.trim()).length}this._syncValidity(this.hasAttribute("required")&&0===t)}});c("contour-swatch",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","button"),"button"!==this.getAttribute("role")||this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||this.getAttribute("color")||"Swatch");const t=_(this.getAttribute("color"))||"var(--color-surface-3)";if(this.style.setProperty("--swatch-color",t),this.hasAttribute("selected")?this.classList.add("is-selected"):this.classList.remove("is-selected"),"button"===this.getAttribute("role")&&this.setAttribute("aria-pressed",String(this.hasAttribute("selected"))),!this.hasAttribute("aria-label")){const e=this.getAttribute("label")||t;this.setAttribute("aria-label",e)}if(!this.querySelector("button")&&!this.querySelector("span")){const t=document.createElement("span");t.className="c-swatch__btn",t.setAttribute("aria-hidden","true"),this.appendChild(t)}}enhance(){this._wiredSwatch||(this._wiredSwatch=!0,this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{value:this.getAttribute("color")}}))}),this.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{value:this.getAttribute("color")}})))}))}});c("contour-calendar",class extends T{static get observed(){return["value","month","year","range","start","end"]}static get properties(){return{value:{attribute:"value"},month:{attribute:"month"},year:{attribute:"year"},range:{attribute:"range",type:Boolean},start:{attribute:"start"},end:{attribute:"end"}}}_attrNum(t,e){const s=this.getAttribute(t),r=Number(s);return null!==s&&Number.isFinite(r)?r:e}_ym(){const t=new Date;return{year:this._attrNum("year",t.getFullYear()),month:this._attrNum("month",t.getMonth())}}render(){this.classList.add("c-calendar");const t=new Date,{year:e,month:s}=this._ym(),r=this.ensure(".c-calendar__header",()=>{const t=document.createElement("div");return t.className="c-calendar__header",t});L(r,"");const i=(t,e,s)=>{const r=document.createElement("button");return r.type="button",r.className="c-btn c-btn--sm "+t,r.textContent=e,r.setAttribute("aria-label",s),r},a=i("c-calendar__prev-year","","Previous year");L(a,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevrons-left" /></svg>');const n=i("c-calendar__prev","","Previous month");L(n,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-left" /></svg>');const o=document.createElement("span");o.className="c-calendar__title",o.textContent=new Date(e,s,1).toLocaleString(void 0,{month:"long",year:"numeric"});const c=i("c-calendar__next","","Next month");L(c,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>');const l=i("c-calendar__next-year","","Next year");L(l,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevrons-right" /></svg>'),r.append(a,n,o,c,l);const u=this.ensure(".c-calendar__grid",()=>{const t=document.createElement("div");return t.className="c-calendar__grid",t.setAttribute("role","grid"),t});u.setAttribute("aria-label",o.textContent),L(u,"");const d=new Date(e,s,1).getDay(),h=new Date(e,s+1,0).getDate(),m=this.hasAttribute("range"),b=this.getAttribute("value"),p=this.getAttribute("start"),g=this.getAttribute("end");let _=null,v=0;const y=()=>{_=document.createElement("div"),_.className="c-calendar__row",_.setAttribute("role","row"),u.appendChild(_),v=0},f=new Intl.DateTimeFormat(void 0,{weekday:"short"});y();for(let t=0;t<7;t++){const e=document.createElement("div");e.className="c-calendar__weekday",e.setAttribute("role","columnheader"),e.textContent=f.format(new Date(2023,0,1+t)),_.appendChild(e)}y();for(let t=0;t<d;t++){const t=document.createElement("div");t.className="c-calendar__day c-calendar__day--empty",_.appendChild(t),v++,7===v&&y()}const A=t.getFullYear()+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0"),E=b&&b.startsWith(e+"-"+String(s+1).padStart(2,"0"))?b:A.startsWith(e+"-"+String(s+1).padStart(2,"0"))?A:e+"-"+String(s+1).padStart(2,"0")+"-01";for(let t=1;t<=h;t++){const r=document.createElement("button");r.className="c-calendar__day",r.type="button",r.setAttribute("role","gridcell"),r.textContent=String(t);const i=e+"-"+String(s+1).padStart(2,"0")+"-"+String(t).padStart(2,"0"),a=m?i===p||i===g:i===b;a&&r.classList.add("is-selected"),m&&p&&g&&i>p&&i<g&&r.classList.add("is-in-range"),r.setAttribute("aria-selected",String(a)),i===A&&r.setAttribute("aria-current","date"),r.setAttribute("tabindex",i===E?"0":"-1"),r.dataset.value=i,_.appendChild(r),v++,7===v&&y()}r.parentNode!==this&&this.insertBefore(r,u)}enhance(){if(this._wiredCalendar)return;this._wiredCalendar=!0;const t=(t,e)=>{this.batch(()=>{this.setAttribute("month",String(t)),this.setAttribute("year",String(e))}),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{month:t,year:e}}))},e=t=>{const e=this.querySelector('.c-calendar__day[data-value="'+t+'"]');if(e)try{e.focus()}catch(t){}};this.addEventListener("focusin",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-calendar__day:not(.c-calendar__day--empty)"):null;if(e&&this.contains(e)){for(const t of this.querySelectorAll(".c-calendar__day"))t.tabIndex=-1;e.tabIndex=0}}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target:null;if(!s)return;const{year:r,month:i}=this._ym();if(s.closest(".c-calendar__prev")){const e=new Date(r,i-1,1);return void t(e.getMonth(),e.getFullYear())}if(s.closest(".c-calendar__next")){const e=new Date(r,i+1,1);return void t(e.getMonth(),e.getFullYear())}if(s.closest(".c-calendar__prev-year"))return void t(i,r-1);if(s.closest(".c-calendar__next-year"))return void t(i,r+1);const a=s.closest(".c-calendar__day");if(a&&this.contains(a)&&a.dataset.value){const t=a.dataset.value;if(this.hasAttribute("range")){const e=this.getAttribute("start"),s=this.getAttribute("end");let r,i;!e||e&&s?(r=t,i=null):(r=t<e?t:e,i=t<e?e:t),this.batch(()=>{this.setAttribute("start",r),null===i?this.removeAttribute("end"):this.setAttribute("end",i)}),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{value:t,range:i?[r,i]:[r]}}))}else this.setAttribute("value",t),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{value:t}}))}}),this.addEventListener("keydown",s=>{const r=s.target&&s.target.closest?s.target.closest(".c-calendar__day:not(.c-calendar__day--empty)"):null;if(!r||!this.contains(r)||!r.dataset.value)return;const[i,a,n]=r.dataset.value.split("-").map(Number),{year:o,month:c}=(new Date(i,a-1,n),this._ym()),l=new Date(o,c+1,0).getDate();let u=null;if("ArrowRight"===s.key)u=new Date(i,a-1,n+1);else if("ArrowLeft"===s.key)u=new Date(i,a-1,n-1);else if("ArrowDown"===s.key)u=new Date(i,a-1,n+7);else if("ArrowUp"===s.key)u=new Date(i,a-1,n-7);else if("PageUp"===s.key)u=s.shiftKey?new Date(i-1,a-1,Math.min(n,new Date(i-1,a,0).getDate())):new Date(i,a-2,Math.min(n,new Date(i,a-1,0).getDate()));else if("PageDown"===s.key)u=s.shiftKey?new Date(i+1,a-1,Math.min(n,new Date(i+1,a,0).getDate())):new Date(i,a,Math.min(n,new Date(i,a+1,0).getDate()));else if("Home"===s.key)u=new Date(o,c,1);else{if("End"!==s.key)return;u=new Date(o,c,l)}s.preventDefault();const d=(h=u).getFullYear()+"-"+String(h.getMonth()+1).padStart(2,"0")+"-"+String(h.getDate()).padStart(2,"0");var h;u.getFullYear()===o&&u.getMonth()===c||t(u.getMonth(),u.getFullYear()),e(d)})}});c("contour-notification-center",class extends T{static get observed(){return["count","items","color"]}static get properties(){return{count:{attribute:"count"},items:{attribute:"items"},color:{attribute:"color"}}}render(){this.classList.add("c-notification-center"),this.setAttribute("role","group");const t=this.ensure(".c-notification-center__trigger",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-btn--icon c-notification-center__trigger",t.type="button",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-bell" /></svg><span class="c-notification-center__bullet" aria-hidden="true"></span>'),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-label",k(this,"notifications","Notifications")),t}),e=this.getAttribute("color"),s=t.querySelector(".c-notification-center__bullet");s&&e&&(s.style.background=_(e),s.dataset.color=e);const r=this.ensure(".c-notification-center__panel",()=>{const t=document.createElement("div");return t.className="c-notification-center__panel",t.hidden=!0,t.setAttribute("role","dialog"),t.setAttribute("aria-label",k(this,"notifications","Notifications")),t});r.hidden=!this._notifOpen,t.setAttribute("aria-expanded",String(!!this._notifOpen));const i=Array.from(this.querySelectorAll(":scope > .c-notification-center__item")),a=this.getAttribute("items");if(i.length){L(r,"");const t=document.createElement("div");t.setAttribute("role","list"),t.setAttribute("aria-label",k(this,"notifications","Notifications")),this._notifAuthored||(this._notifAuthored=[]),i.forEach(e=>{t.appendChild(e),this._notifAuthored.push(e)}),r.appendChild(t)}else if(a){let t=null;try{t=JSON.parse(a)}catch(t){f(this,"items",t)}if(L(r,""),Array.isArray(t)){const e=document.createElement("div");e.setAttribute("role","list"),e.setAttribute("aria-label",k(this,"notifications","Notifications"));const s=this._notifShown||50;t.slice(0,s).forEach(t=>{const s=document.createElement("div");s.className="c-notification-center__item"+(t&&t.read?" is-read":""),s.setAttribute("tabindex","-1"),s.setAttribute("role","listitem"),t&&t.current&&s.setAttribute("aria-current","true"),s.dataset.read=t&&t.read?"true":"false";const r=document.createElement("span");r.className="c-notification-center__item-label",r.textContent="string"==typeof t?t:t.text||t.title||"",s.appendChild(r);const i=document.createElement("button");i.type="button",i.className="c-notification-center__archive",i.setAttribute("aria-label",k(this,"archive","Archive notification")),i.textContent="⤓",i.tabIndex=-1,s.appendChild(i);const a=document.createElement("button");a.type="button",a.className="c-notification-center__dismiss",a.setAttribute("aria-label",k(this,"dismiss","Dismiss notification")),a.textContent="×",a.tabIndex=-1,s.appendChild(a),e.appendChild(s)});const i=e.querySelector(".c-notification-center__item");if(i&&(i.tabIndex=0),r.appendChild(e),t.length){if(t.length>s){const e=document.createElement("button");e.type="button",e.className="c-btn c-btn--sm c-notification-center__more",e.textContent=k(this,"more","Show more")+" ("+(t.length-s)+")",r.appendChild(e)}}else{const t=document.createElement("div");t.className="c-notification-center__empty",t.textContent=k(this,"empty","No notifications"),r.appendChild(t)}}else{const t=document.createElement("div");t.className="c-notification-center__error",t.setAttribute("role","alert"),t.textContent=k(this,"error","Could not load notifications"),r.appendChild(t)}}this._syncNotifBadge()}_syncNotifBadge(){const t=this.querySelector(".c-notification-center__trigger");if(!t)return;const e=Array.from(this.querySelectorAll(".c-notification-center__item"));let s;s=this._notifInteracted||!this.hasAttribute("count")?e.filter(t=>"true"!==t.dataset.read).length:Number(this.getAttribute("count"))||0;let r=t.querySelector(".c-notification-center__badge");s>0?(r||(r=document.createElement("span"),r.className="c-notification-center__badge c-badge c-badge--dot",t.appendChild(r)),r.textContent=String(s)):r&&r.remove()}enhance(){if(this._wiredNotifCenter)return;this._wiredNotifCenter=!0;const t=t=>{"true"!==t.dataset.read&&(t.dataset.read="true",t.classList.add("is-read"),this._notifInteracted=!0,this._syncNotifBadge(),this.dispatchEvent(new CustomEvent("contour:read",{bubbles:!0,composed:!0,detail:{label:t.querySelector(".c-notification-center__item-label")?.textContent||t.textContent}})));for(const e of this.querySelectorAll(".c-notification-center__item"))e===t?e.setAttribute("aria-current","true"):e.removeAttribute("aria-current");this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{label:t.querySelector(".c-notification-center__item-label")?.textContent||t.textContent}}))},e=(t,e)=>{const s=t.querySelector(".c-notification-center__item-label")?.textContent||t.textContent;t.remove(),this._notifInteracted=!0,this._syncNotifBadge(),this.dispatchEvent(new CustomEvent("archive"===e?"contour:remove":"contour:dismiss",{bubbles:!0,composed:!0,detail:{label:s}}))};this.addEventListener("click",s=>{const r=this.querySelector(".c-notification-center__trigger"),i=this.querySelector(".c-notification-center__panel");if(r&&(s.target===r||r.contains(s.target)))return void(i&&(i.hidden=!i.hidden,this._notifOpen=!i.hidden,r.setAttribute("aria-expanded",String(!i.hidden)),this.dispatchEvent(new CustomEvent(i.hidden?"contour:close":"contour:open",{bubbles:!0,composed:!0}))));const a=s.target&&s.target.closest?s.target.closest(".c-notification-center__more"):null;if(a&&this.contains(a))return this._notifShown=(this._notifShown||50)+50,void this.requestRender();const n=s.target&&s.target.closest?s.target.closest(".c-notification-center__archive"):null;if(n&&this.contains(n)){const t=n.closest(".c-notification-center__item");return void(t&&e(t,"archive"))}const o=s.target&&s.target.closest?s.target.closest(".c-notification-center__dismiss"):null;if(o&&this.contains(o)){const t=o.closest(".c-notification-center__item");return void(t&&e(t,"dismiss"))}const c=s.target&&s.target.closest?s.target.closest(".c-notification-center__item"):null;c&&this.contains(c)&&t(c)});const s=t=>{const e=this.querySelector(".c-notification-center__panel"),s=this.querySelector(".c-notification-center__trigger");!e||e.hidden||this.contains(t.target)||(e.hidden=!0,this._notifOpen=!1,s&&s.setAttribute("aria-expanded","false"))};document.addEventListener("click",s),i(this,()=>document.removeEventListener("click",s));const r=s=>{const r=this.querySelector(".c-notification-center__panel"),i=this.querySelector(".c-notification-center__trigger");if("Escape"===s.key&&r&&!r.hidden){if(r.hidden=!0,this._notifOpen=!1,i){i.setAttribute("aria-expanded","false");try{i.focus()}catch(t){}}return}if(!r||r.hidden)return;const a=Array.from(r.querySelectorAll(".c-notification-center__item"));if(a.length){if(("Enter"===s.key||" "===s.key)&&a.includes(s.target))return s.preventDefault(),void t(s.target);if(("Delete"===s.key||"Backspace"===s.key)&&a.includes(s.target)){s.preventDefault();const t=a.indexOf(s.target);e(s.target,"dismiss");const r=a[t+1]||a[t-1];if(r&&r.isConnected)try{r.focus()}catch(t){}return}z(s,a,{wrap:!0,onNavigate:t=>{a.forEach((e,s)=>{e.tabIndex=s===t?0:-1})}})}};document.addEventListener("keydown",r),i(this,()=>document.removeEventListener("keydown",r))}});c("contour-stepper",class extends T{static get observed(){return["steps","current"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current"}}}render(){this.classList.add("c-stepper"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"stepper","Stepper"));const t=this.getAttribute("steps"),e=Number(this.getAttribute("current")||0),s=this.ensure(".c-stepper__list",()=>{const t=document.createElement("ol");return t.className="c-stepper__list",t});L(s,"");const r=Array.from(this.querySelectorAll(":scope > .c-stepper__step"));let i=[];if(r.length)i=r.map(t=>t.textContent.trim()),this._stepperAuthored=i,r.forEach(t=>t.remove());else if(t)try{i=JSON.parse(t)}catch(t){f(this,"steps",t),i=this._stepperAuthored||[]}else i=this._stepperAuthored||[];i.forEach((t,r)=>{const i=document.createElement("li");i.className="c-stepper__step"+(r===e?" is-current":"")+(r<e?" is-done":""),r===e&&i.setAttribute("aria-current","step"),i.setAttribute("tabindex",r===e?"0":"-1");const a=document.createElement("span");a.className="c-stepper__marker",a.setAttribute("aria-hidden","true"),r<e?L(a,'<svg viewBox="0 0 24 24"><use href="#i-check" /></svg>'):a.textContent=String(r+1),i.appendChild(a);const n=document.createElement("span");n.className="c-stepper__label",n.textContent="string"==typeof t?t:t.title||t.label||"",i.appendChild(n),s.appendChild(i)});const a=this.ensure(".c-stepper__nav",()=>{const t=document.createElement("div");return t.className="c-stepper__nav c-btn-group",t}),n=this.ensure(".c-stepper__prev",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-stepper__prev",t.type="button",t});n.textContent=k(this,"prev","Back"),e<=0?n.setAttribute("disabled",""):n.removeAttribute("disabled");const o=this.ensure(".c-stepper__next",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-stepper__next",t.type="button",t});o.textContent=k(this,"next","Next"),e>=i.length-1?o.setAttribute("disabled",""):o.removeAttribute("disabled"),a.contains(n)||a.appendChild(n),a.contains(o)||a.appendChild(o),a.parentNode!==this&&this.appendChild(a)}enhance(){if(this._wiredStepper)return;this._wiredStepper=!0;const t=t=>{const e=this.querySelector(".c-stepper__list"),s=e?e.querySelectorAll(".c-stepper__step").length:0;if(!s)return;let r=Number(this.getAttribute("current")||0);r="prev"===t?Math.max(0,r-1):Math.min(s-1,r+1),this.setAttribute("current",String(r)),this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:!0,composed:!0,detail:{direction:t,index:r}}))};this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-stepper__prev"):null,r=e.target&&e.target.closest?e.target.closest(".c-stepper__next"):null;if(s&&this.contains(s))return void t("prev");if(r&&this.contains(r))return void t("next");const i=e.target&&e.target.closest?e.target.closest(".c-stepper__step"):null;if(i&&this.contains(i)){const t=Array.from(this.querySelectorAll(".c-stepper__step")).indexOf(i);t>=0&&t!==Number(this.getAttribute("current")||0)&&(this.setAttribute("current",String(t)),this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:!0,composed:!0,detail:{direction:"jump",index:t}})))}}),this.addEventListener("keydown",e=>{"ArrowLeft"===e.key?(e.preventDefault(),t("prev")):"ArrowRight"===e.key&&(e.preventDefault(),t("next"))})}});c("contour-virtual-list",class extends T{static get updateMode(){return"keyed"}static get observed(){return["items","item-height","orientation","sticky"]}static get properties(){return{items:{attribute:"items"},"item-height":{attribute:"item-height"},orientation:{attribute:"orientation"},sticky:{attribute:"sticky",type:Boolean}}}_items(){const t=this.getAttribute("items");let e=[];try{e=t?JSON.parse(t):[]}catch(t){f(this,"items",t),e=[]}return Array.isArray(e)?e:[]}_itemHeight(){const t=Number(this.getAttribute("item-height"));return Number.isFinite(t)&&t>0?t:y("--virtual-list-item-height",28)}_autoHeight(){return"auto"===this.getAttribute("item-height")}render(){this.classList.add("c-virtual-list"),this.setAttribute("role","list"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"virtual-list","Virtual list"));const t=this.ensure(".c-virtual-list__scroller",()=>{const t=document.createElement("div");return t.className="c-virtual-list__scroller",t});t.setAttribute("role","presentation");const e="horizontal"===this.getAttribute("orientation");t.style.overflowX=e?"auto":"hidden",t.style.overflowY=e?"hidden":"auto";const s=this.ensure(".c-virtual-list__inner",()=>{const t=document.createElement("div");return t.className="c-virtual-list__inner",t.style.position="relative",t});s.parentNode!==t&&t.appendChild(s),this._renderWindow(t,s,e?t.scrollLeft||0:t.scrollTop||0)}_measureHeights(t,e){return Array.from(t.querySelectorAll(".c-virtual-list__item")).map(t=>e?t.getBoundingClientRect().width||this._itemHeight():t.getBoundingClientRect().height||this._itemHeight())}_renderWindow(t,e,s){const r=this._items(),i=this._itemHeight(),a="horizontal"===this.getAttribute("orientation"),n=this._autoHeight(),o=a?t.clientWidth||320:t.clientHeight||320,c=r.length;this._vlItemCount!==c&&(this._vlHeights=null,this._vlItemCount=c);let l=n?this._vlHeights:null,u=null;if(n&&l&&l.length===c){u=[0];for(let t=0;t<c;t++)u.push(u[t]+(l[t]||this._itemHeight()))}const d=n&&!u?c:n?Math.ceil(o/this._itemHeight())+6:Math.ceil(o/i)+4;let h=0;if(n&&u){let t=0,e=c;for(;t<e;){const r=t+e>>1;u[r]<(s||0)?t=r+1:e=r}h=Math.max(0,t-3)}else n||(h=Math.floor((s||0)/i));h<0&&(h=0);const m=Math.min(c,h+d);h>Math.max(0,c-d)&&!n&&(h=Math.max(0,c-d));const b=n&&u?u[h]:n?0:h*i,p=n&&u?Math.max(0,u[c]-u[m]):n?0:Math.max(0,(c-m)*i);e.style.display=a?"flex":"block",e.style.width=a&&n?"max-content":"",e.style.height=a||n?"":c*i+"px",L(e,"");const g=document.createElement("div");g.className="c-virtual-list__spacer c-virtual-list__spacer--top",g.style[a?"width":"height"]=b+"px",e.appendChild(g);for(let t=h;t<m;t++){const s=document.createElement("div");s.className="c-virtual-list__item",s.setAttribute("role","listitem"),s.setAttribute("aria-setsize",String(c)),s.setAttribute("aria-posinset",String(t+1)),s.setAttribute("tabindex",0===t?"0":"-1"),s.textContent="string"==typeof r[t]?r[t]:r[t].label||r[t].text||JSON.stringify(r[t]),this.hasAttribute("sticky")&&r[t]&&r[t].sticky&&(s.style.position="sticky",s.style.insetBlockStart="0",s.style.zIndex="1"),a&&!n&&(s.style.flex="0 0 "+i+"px"),s.dataset.index=String(t),e.appendChild(s)}const _=document.createElement("div");_.className="c-virtual-list__spacer c-virtual-list__spacer--bottom",_.style[a?"width":"height"]=p+"px",e.appendChild(_),a&&!n&&(e.style.width=c*i+"px"),n&&!this._vlHeights&&requestAnimationFrame(()=>{this._vlHeights=this._measureHeights(e,a);const s=t,r=e;s&&r&&this._renderWindow(s,r,s.scrollTop||0)})}enhance(){if(this._wiredVirtualList)return;this._wiredVirtualList=!0;const t=()=>this.querySelector(".c-virtual-list__scroller"),e=()=>this.querySelector(".c-virtual-list__inner");let s=0;const r=()=>{s||(s=requestAnimationFrame(()=>{s=0;const r=t(),i=e();r&&i&&this._renderWindow(r,i,"horizontal"===this.getAttribute("orientation")?r.scrollLeft:r.scrollTop)}))};this.addEventListener("scroll",r,{passive:!0,capture:!0}),i(this,()=>{this.removeEventListener("scroll",r,{capture:!0}),s&&cancelAnimationFrame(s)}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-virtual-list__item"));if(!e.length)return;const s="horizontal"===this.getAttribute("orientation"),r=s?"ArrowRight":"ArrowDown",i=s?"ArrowLeft":"ArrowUp",a=document.activeElement,n=e.indexOf(a),o=this.querySelector(".c-virtual-list__scroller"),c=this.querySelector(".c-virtual-list__inner");if(t.key===r&&n===e.length-1||t.key===i&&0===n&&Number(a&&a.dataset.index)>0){if(t.preventDefault(),o&&c){const e=(t.key===r?1:-1)*this._itemHeight();s?o.scrollLeft+=e:o.scrollTop+=e,this._renderWindow(o,c,s?o.scrollLeft:o.scrollTop);const i=Number(a&&a.dataset.index)+(t.key===r?1:-1);requestAnimationFrame(()=>{const t=this.querySelector(`.c-virtual-list__item[data-index="${i}"]`),e=Array.from(this.querySelectorAll(".c-virtual-list__item"));if(t){e.forEach(t=>t.setAttribute("tabindex","-1")),t.setAttribute("tabindex","0");try{t.focus()}catch(t){}}})}}else z(t,e,{wrap:!1,homeEnd:!0,onNavigate:t=>e.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{if("Enter"===t.key||" "===t.key){const t=Number(document.activeElement.dataset.index);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:t,value:document.activeElement.textContent}}))}}})}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-virtual-list__item"):null;if(!e||!this.contains(e))return;const s=Number(e.dataset.index);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:s,value:e.textContent}}))})}});c("contour-sortable-list",class extends T{static get observed(){return["items","order"]}static get properties(){return{items:{attribute:"items"},order:{attribute:"order"}}}render(){this.classList.add("c-sortable-list");const t=this.ensure(".c-sortable-list__list",()=>{const t=document.createElement("ul");return t.className="c-sortable-list__list",t}),e=this.getAttribute("items");let s=[];try{s=e?JSON.parse(e):[]}catch(t){s=[]}Array.isArray(s)||(s=[]);let r=Array.from({length:s.length},(t,e)=>e);const i=this.getAttribute("order");if(i)try{const t=JSON.parse(i);Array.isArray(t)&&t.length===s.length&&t.every(t=>Number.isInteger(t)&&t>=0&&t<s.length)&&(r=t.slice(),s=t.map(t=>s[t]))}catch(t){}this._sortableSourceOrder=r,this._sortableItems=s,L(t,""),s.forEach((e,s)=>{const r=document.createElement("li");r.className="c-sortable-list__item",r.setAttribute("draggable","true"),r.dataset.index=String(s);const i="string"==typeof e?e:e.label||e.text||"",a=document.createElement("span");a.className="c-sortable-list__handle",a.textContent="⋮⋮",a.setAttribute("role","button"),a.setAttribute("aria-label",k(this,"reorder","Reorder")+" "+(i||String(s+1))),a.setAttribute("data-contour-preserve-key",i||String(s)),a.tabIndex=0,r.appendChild(a);const n=document.createElement("span");n.className="c-sortable-list__label",n.textContent=i,r.appendChild(n),t.appendChild(r)})}enhance(){if(this._wiredSortableList)return;this._wiredSortableList=!0;const t=()=>this.querySelector(".c-sortable-list__list"),e=t=>{let e=this.querySelector(".c-sortable-list__live");e||(e=document.createElement("span"),e.className="c-sortable-list__live visually-hidden",e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),this.appendChild(e)),e.textContent=t},s=e=>Array.from(t().children).indexOf(e),r=(t,e)=>{const s=(this._sortableItems||[]).length,r=Array.isArray(this._sortableSourceOrder)&&this._sortableSourceOrder.length===s?this._sortableSourceOrder.slice():Array.from({length:s},(t,e)=>e),[i]=r.splice(t,1);r.splice(e,0,i),this.setAttribute("order",JSON.stringify(r))};let i=null;this.addEventListener("dragstart",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-sortable-list__item"):null;if(e&&this.contains(e)){if(i=s(e),t.dataTransfer){t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",String(i))}catch(t){}}e.classList.add("is-dragging")}}),this.addEventListener("dragover",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-sortable-list__item"):null;e&&this.contains(e)&&null!==i&&(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"))}),this.addEventListener("drop",a=>{const n=a.target&&a.target.closest?a.target.closest(".c-sortable-list__item"):null;if(!n||!this.contains(n)||null===i)return;a.preventDefault();const o=s(n),c=t(),l=c.children[i];if(l&&i!==o){i<o?c.insertBefore(l,c.children[o+1]||null):c.insertBefore(l,c.children[o]);const t=l.querySelector(".c-sortable-list__label");e((t?t.textContent:"Item")+" moved to position "+(o+1));const s=i;r(s,o),this.dispatchEvent(new CustomEvent("contour:reorder",{bubbles:!0,composed:!0,detail:{from:s,to:o}}))}i=null,Array.from(c.children).forEach(t=>t.classList.remove("is-dragging"))}),this.addEventListener("dragend",()=>{i=null;const e=t();e&&Array.from(e.children).forEach(t=>t.classList.remove("is-dragging"))}),this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-sortable-list__handle"):null;if(!s||!this.contains(s))return;const r="true"===s.getAttribute("aria-pressed");s.setAttribute("aria-pressed",String(!r)),s.classList.toggle("is-grabbed",!r);const i=s.closest(".c-sortable-list__item"),a=i&&i.querySelector(".c-sortable-list__label"),n=a?a.textContent:"Item";e(r?`${n} released`:`${n} grabbed; use Up or Down arrows to reorder`)}),this.addEventListener("keydown",i=>{const a=i.target&&i.target.closest?i.target.closest(".c-sortable-list__handle"):null;if(!a)return;if("Enter"===i.key||" "===i.key)return i.preventDefault(),void a.click();const n=a.closest(".c-sortable-list__item");if(!n)return;const o=t(),c=s(n),l=(t,s)=>{const i=n.querySelector(".c-sortable-list__label");e((i?i.textContent:"Item")+" moved to position "+(s+1)),r(c,s),this.dispatchEvent(new CustomEvent("contour:move",{bubbles:!0,composed:!0,detail:{direction:t,from:c,to:s}})),this.dispatchEvent(new CustomEvent("contour:reorder",{bubbles:!0,composed:!0,detail:{from:c,to:s}}))};"ArrowUp"===i.key&&n.previousElementSibling?(i.preventDefault(),o.insertBefore(n,n.previousElementSibling),l("up",s(n))):"ArrowDown"===i.key&&n.nextElementSibling?(i.preventDefault(),o.insertBefore(n.nextElementSibling,n),l("down",s(n))):"Home"===i.key&&c>0?(i.preventDefault(),o.insertBefore(n,o.firstElementChild),l("up",0)):"End"===i.key&&c<o.children.length-1&&(i.preventDefault(),o.appendChild(n),l("down",o.children.length-1))})}});c("contour-carousel",class extends T{static get observed(){return["items","index","autoplay","paused"]}static get properties(){return{items:{attribute:"items"},index:{attribute:"index"},autoplay:{attribute:"autoplay"},paused:{attribute:"paused",type:Boolean}}}_items(){const t=this.getAttribute("items");let e=[];try{e=t?JSON.parse(t):[]}catch(t){e=[]}return Array.isArray(e)?e:[]}_index(){const t=Number(this.getAttribute("index")),e=this._items();return Number.isFinite(t)&&t>=0&&t<e.length?t:0}render(){this.classList.add("c-carousel"),this.setAttribute("role","region"),this.setAttribute("aria-roledescription","carousel"),Array.from(this.children).forEach(t=>{t.classList&&t.classList.contains("c-carousel__slide")&&t.parentElement===this&&t.remove()});const t=this.ensure(".c-carousel__track",()=>{const t=document.createElement("div");return t.className="c-carousel__track",t.setAttribute("role","group"),t.setAttribute("aria-roledescription","slide container"),t}),e=this._items();L(t,"");const s=this._index();e.forEach((r,i)=>{const a=document.createElement("div");a.className="c-carousel__slide"+(i===s?" is-active":""),a.setAttribute("role","group"),a.setAttribute("aria-roledescription","slide"),a.setAttribute("aria-label",i+1+" of "+e.length),a.setAttribute("aria-hidden",i===s?"false":"true");const n="object"==typeof r&&r?r.src||r.image||r.video:null;if(n){const t=!("object"!=typeof r||!r)&&("video"===r.type||!!r.video);a.classList.add("c-carousel__slide--media");const e=document.createElement(t?"video":"img");e.src=n,t?(e.controls=!0,r.poster&&(e.poster=r.poster)):e.alt="object"==typeof r&&(r.alt||r.label)||"",a.appendChild(e)}else a.textContent="string"==typeof r?r:r.label||r.text||"";a.dataset.index=String(i),t.appendChild(a)});this.ensure(".c-carousel__prev",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-btn--icon c-carousel__prev",t.type="button",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-left" /></svg>'),t.setAttribute("aria-label",k(this,"previous-slide","Previous slide")),t}),this.ensure(".c-carousel__next",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-btn--icon c-carousel__next",t.type="button",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),t.setAttribute("aria-label",k(this,"next-slide","Next slide")),t});const r=this.ensure(".c-carousel__status",()=>{const t=document.createElement("span");return t.className="c-carousel__status",t}),i=Number(this.getAttribute("autoplay")),a=Number.isFinite(i)&&i>0&&!this.hasAttribute("paused")&&!this._reducedMotion();r.setAttribute("aria-live",a?"off":"polite"),r.textContent=e.length?s+1+" of "+e.length:"0 of 0";const n=this.ensure(".c-carousel__dots",()=>{const t=document.createElement("div");return t.className="c-carousel__dots",t.setAttribute("role","group"),t.setAttribute("aria-label",k(this,"slide-controls","Slide controls")),t});n.setAttribute("role","group"),n.setAttribute("aria-label",k(this,"slide-controls","Slide controls")),L(n,""),e.forEach((t,e)=>{const r=document.createElement("button");r.type="button",r.className="c-carousel__dot"+(e===s?" is-active":""),r.setAttribute("aria-label",k(this,"go-to-slide","Go to slide")+" "+(e+1)),r.setAttribute("aria-current",e===s?"true":"false"),r.tabIndex=e===s?0:-1,r.dataset.index=String(e),n.appendChild(r)});const o=i;if(Number.isFinite(o)&&o>0){const t=this.hasAttribute("paused")||this._reducedMotion(),e=this.ensure(".c-carousel__pause",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-btn--icon c-carousel__pause",t.type="button",t});L(e,t?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-play" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-pause" /></svg>'),e.setAttribute("aria-label",t?k(this,"play-slides","Play slides automatically"):k(this,"pause-slides","Pause automatic slides")),e.setAttribute("aria-pressed",String(t)),e.disabled=this._reducedMotion()}else{const t=this.querySelector(".c-carousel__pause");t&&t.remove()}}_reducedMotion(){try{return"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch(t){return!1}}enhance(){const t=Number(this.getAttribute("autoplay")),e=Number.isFinite(t)&&t>0&&!this.hasAttribute("paused")&&!this._reducedMotion()&&this._items().length>1;if(e&&!this._carouselTimer?this._carouselTimer=setInterval(()=>{const t=this._items();if(!t.length)return;const e=(this._index()+1)%t.length;this.setAttribute("index",String(e)),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{index:e,direction:"next"}}))},Math.max(500,t)):!e&&this._carouselTimer&&(clearInterval(this._carouselTimer),this._carouselTimer=null),this._wiredCarousel)return;this._wiredCarousel=!0,i(this,()=>{this._carouselTimer&&(clearInterval(this._carouselTimer),this._carouselTimer=null)});const s=t=>{const e=this._items();if(!e.length)return;let s=this._index();s="prev"===t?(s-1+e.length)%e.length:(s+1)%e.length,this.setAttribute("index",String(s)),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{index:s,direction:t}}))};this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-carousel__pause"):null;if(e&&this.contains(e)){if(this._reducedMotion())return;const t=!this.hasAttribute("paused");return this.toggleAttribute("paused",t),void this.dispatchEvent(new CustomEvent(t?"contour:pause":"contour:play",{bubbles:!0,composed:!0}))}const r=t.target&&t.target.closest?t.target.closest(".c-carousel__prev"):null,i=t.target&&t.target.closest?t.target.closest(".c-carousel__next"):null;if(r&&this.contains(r))return void s("prev");if(i&&this.contains(i))return void s("next");const a=t.target&&t.target.closest?t.target.closest(".c-carousel__dot"):null;if(a&&this.contains(a)){const t=Number(a.dataset.index);Number.isFinite(t)&&t!==this._index()&&(this.setAttribute("index",String(t)),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{index:t,direction:"jump"}})))}});let r=null;this.addEventListener("pointerdown",t=>{r=t.clientX}),this.addEventListener("pointerup",t=>{if(null===r)return;const e=t.clientX-r;r=null,Math.abs(e)>40&&s(e<0?"next":"prev")}),this.addEventListener("pointercancel",()=>{r=null}),this.addEventListener("keydown",t=>{if("ArrowLeft"===t.key)t.preventDefault(),s("prev");else if("ArrowRight"===t.key)t.preventDefault(),s("next");else if("Home"===t.key)t.preventDefault(),this.setAttribute("index","0"),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{index:0,direction:"home"}}));else if("End"===t.key){t.preventDefault();const e=this._items().length-1;e>=0&&(this.setAttribute("index",String(e)),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{index:e,direction:"end"}})))}})}});c("contour-data-grid",class extends T{static get updateMode(){return"keyed"}static get observed(){return["columns","rows","page","filter","page-size","resizable","virtual","row-height","selected","loading","error","empty"]}static get properties(){return{columns:{attribute:"columns"},rows:{attribute:"rows"},page:{attribute:"page"},filter:{attribute:"filter"},"page-size":{attribute:"page-size"},resizable:{attribute:"resizable",type:Boolean},virtual:{attribute:"virtual",type:Boolean},"row-height":{attribute:"row-height"},loading:{attribute:"loading"},error:{attribute:"error"},empty:{attribute:"empty"}}}get selected(){return Array.from(this._dgSelectedKeys||[])}set selected(t){this._dgPushedSelection=Array.isArray(t)?t.map(String):[],this._dgSelectionControlled=!0,this.requestRender()}_dgRowKey(t){if(t&&"object"==typeof t&&!Array.isArray(t)){if(void 0!==t.id&&null!==t.id)return String(t.id);if(void 0!==t.key&&null!==t.key)return String(t.key)}const e=this._dgCols||[],s=e.findIndex(t=>t&&"object"==typeof t&&!0===t.key);if(s>=0&&t){const r="string"==typeof e[s].label?e[s].label:"",i=r&&null!=t[r]?String(t[r]):"";if(""!==i)return i}return JSON.stringify(void 0===t?null:t)}_dgReadSelection(){if(this._dgPushedSelection)return void(this._dgSelectedKeys=new Set(this._dgPushedSelection));const t=this.getAttribute("selected");if(null!==t&&t!==this._dgLastSelectedRaw){this._dgLastSelectedRaw=t,this._dgSelectionControlled=!0;try{const e=JSON.parse(t);this._dgSelectedKeys=new Set(Array.isArray(e)?e.map(String):[])}catch(t){this._dgSelectedKeys=new Set}}else this._dgSelectedKeys=this._dgSelectedKeys||new Set}_dgApplySelection(t){if(!t)return;const e=this._dgSelectedKeys||new Set;t.querySelectorAll("tr[data-row-key]").forEach(t=>{t.setAttribute("aria-selected",String(e.has(t.dataset.rowKey)))})}render(){if(this.classList.add("c-data-grid"),this.hasAttribute("loading")||this.hasAttribute("error")||this.hasAttribute("empty")){const t=this.ensure(".c-data-grid__table",()=>{const t=document.createElement("table");return t.className="c-table c-data-grid__table",t.setAttribute("role","grid"),t}),e=this.ensure("tbody",()=>document.createElement("tbody"));e.parentNode!==t&&t.appendChild(e),L(e,"");const s=document.createElement("tr"),r=document.createElement("td");r.colSpan=1,r.style.textAlign="center",r.style.color="var(--color-text-muted)",this.hasAttribute("loading")?r.textContent=this.getAttribute("loading")||"Loading…":this.hasAttribute("error")?r.textContent=this.getAttribute("error")||"Error":r.textContent=this.getAttribute("empty")||"No data",s.appendChild(r),e.appendChild(s);let i=this.querySelector(".c-data-grid__wrap");return i||(i=document.createElement("div"),i.className="c-table-wrap c-data-grid__wrap"),t.parentNode!==i&&i.appendChild(t),void(i.parentNode!==this&&this.appendChild(i))}const t=this.ensure(".c-data-grid__table",()=>{const t=document.createElement("table");return t.className="c-table c-data-grid__table",t.setAttribute("role","grid"),t}),e=this.ensure("thead",()=>document.createElement("thead")),s=this.ensure("tbody",()=>document.createElement("tbody"));e.parentNode!==t&&t.appendChild(e),s.parentNode!==t&&t.appendChild(s);const r=this.getAttribute("columns");let i=[];try{i=r?JSON.parse(r):[]}catch(t){i=[]}if(i.length&&!e.querySelector("tr")){const t=document.createElement("tr");i.forEach(e=>{const s=document.createElement("th");s.setAttribute("role","columnheader"),s.setAttribute("aria-sort","none"),s.setAttribute("tabindex","0"),s.textContent="string"==typeof e?e:e.label||e.key||"",t.appendChild(s)}),e.appendChild(t)}this.hasAttribute("resizable")&&Array.from(e.querySelectorAll("th")).forEach(t=>{t.style.position="relative",t.setAttribute("data-resizable","true")});const a=this.getAttribute("rows");let n=[];try{n=a?JSON.parse(a):[]}catch(t){n=[]}t.setAttribute("aria-rowcount",String(n.length)),t.setAttribute("aria-colcount",String(i.length));const o=this.getAttribute("filter");if(o){const t=o.toLowerCase();n=n.filter(e=>JSON.stringify(e).toLowerCase().includes(t))}if(null!=this._dgSortCol&&this._dgSortCol>=0&&this._dgSortCol<i.length){const t=this._dgSortCol,s=this._dgSortDir||"asc",r=i[t],a=r?"string"==typeof r?r:r.key||r.label||"":String(t);n=n.slice().sort((e,r)=>{const i=Array.isArray(e)?e[t]??"":e&&null!=e[a]?e[a]:"",n=Array.isArray(r)?r[t]??"":r&&null!=r[a]?r[a]:"",o=Number(i),c=Number(n),l=""===i||""===n||isNaN(o)||isNaN(c)?String(i).localeCompare(String(n)):o-c;return"asc"===s?l:-l}),Array.from(e.querySelectorAll("th")).forEach((e,r)=>{e.setAttribute("aria-sort",r===t?"asc"===s?"ascending":"descending":"none")})}this._dgFilteredRows=n;const c=Number(this.getAttribute("page")||1),l=Number(this.getAttribute("page-size")||0);if(l>0){const t=(c-1)*l;n=n.slice(t,t+l)}this._dgCols=i,this._dgRows=n,this._dgReadSelection();if(this.hasAttribute("virtual")&&!(Number(this.getAttribute("page-size"))>0)){const t=this.querySelector(".c-data-grid__wrap");this._renderDataGridWindow(t?t.scrollTop:0)}else{L(s,"");const t=l>0?(c-1)*l:0;n.forEach((e,r)=>{const a=document.createElement("tr");a.dataset.rowKey=this._dgRowKey(e),a.dataset.index=String(t+r),i.forEach((t,s)=>{const r="string"==typeof t?t:t.key||t.label||"",i=document.createElement("td");i.setAttribute("role","gridcell"),i.setAttribute("tabindex","-1");const n=Array.isArray(e)?e[s]:e?e[r]:void 0;i.textContent=null!=n?n:"",String(i.textContent).trim()||i.setAttribute("aria-label",k(this,"empty","Empty")),a.appendChild(i)}),s.appendChild(a)}),this._dgApplySelection(s)}let u=this.querySelector(".c-data-grid__wrap");if(u||(u=document.createElement("div"),u.className="c-table-wrap c-data-grid__wrap"),t.parentNode!==u&&u.appendChild(t),u.parentNode!==this&&this.appendChild(u),!t.querySelector('[tabindex="0"]')){const e=t.querySelector("tbody td, thead th");e&&e.setAttribute("tabindex","0")}}_rowHeight(){const t=Number(this.getAttribute("row-height"));return Number.isFinite(t)&&t>0?t:this._measuredRowHeight>0?this._measuredRowHeight:y("--data-grid-row-height",32)}_renderDataGridWindow(t){const e=this.querySelector(".c-data-grid__table"),s=e&&e.querySelector("tbody");if(!s)return;const r=this._dgCols||[],i=this._dgRows||[],a=this._rowHeight(),n=Math.ceil(400/a)+6;let o=Math.floor((t||0)/a);o<0&&(o=0),o>Math.max(0,i.length-n)&&(o=Math.max(0,i.length-n));const c=Math.min(i.length,o+n);if(L(s,""),o>0){const t=document.createElement("tr"),e=document.createElement("td");e.colSpan=Math.max(1,r.length),e.style.blockSize=o*a+"px",e.style.padding="0",t.appendChild(e),s.appendChild(t)}for(let t=o;t<c;t++){const e=i[t],a=document.createElement("tr");a.dataset.index=String(t),a.dataset.rowKey=this._dgRowKey(e),r.forEach((t,s)=>{const r="string"==typeof t?t:t.key||t.label||"",i=document.createElement("td");i.setAttribute("role","gridcell"),i.setAttribute("tabindex","-1");const n=Array.isArray(e)?e[s]:e?e[r]:void 0;i.textContent=null!=n?n:"",String(i.textContent).trim()||i.setAttribute("aria-label",k(this,"empty","Empty")),a.appendChild(i)}),s.appendChild(a)}if(c<i.length){const t=document.createElement("tr"),e=document.createElement("td");e.colSpan=Math.max(1,r.length),e.style.blockSize=(i.length-c)*a+"px",e.style.padding="0",t.appendChild(e),s.appendChild(t)}if(!s.querySelector('[tabindex="0"]')){const t=s.querySelector("tr[data-index] td");t&&t.setAttribute("tabindex","0")}this._dgApplySelection(s)}enhance(){if(this._wiredDataGrid)return;this._wiredDataGrid=!0;const t=()=>this.querySelector(".c-data-grid__wrap");this.addEventListener("scroll",t=>{const e=t.target&&t.target.classList&&t.target.classList.contains("c-data-grid__wrap")?t.target:null;e&&this.hasAttribute("virtual")&&this._renderDataGridWindow(e.scrollTop)},!0),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest("[role='gridcell'], [role='columnheader']"):null;if(!e||!this.contains(e))return;const s=e.parentElement,r=this.querySelector(".c-data-grid__table");if(!r)return;if(t.altKey&&("ArrowLeft"===t.key||"ArrowRight"===t.key)&&e.hasAttribute("data-resizable")){t.preventDefault();const i=Array.from(s.children).indexOf(e),a=e.getBoundingClientRect().width||100,n=Math.max(48,a+("ArrowRight"===t.key?16:-16));return Array.from(r.rows).forEach(t=>{t.children[i]&&(t.children[i].style.inlineSize=n+"px")}),void this.dispatchEvent(new CustomEvent("contour:resize",{bubbles:!0,composed:!0,detail:{column:i,width:n}}))}if("Enter"===t.key||" "===t.key)return t.preventDefault(),void("columnheader"===e.getAttribute("role")?e.click():s&&s.click());const i=Array.from(r.querySelectorAll("tr")),a=i.indexOf(s),n=Array.from(s.children).indexOf(e);let o=null;if("ArrowRight"===t.key?o=s.children[n+1]:"ArrowLeft"===t.key?o=s.children[n-1]:"ArrowDown"===t.key?o=i[a+1]&&i[a+1].children[n]:"ArrowUp"===t.key&&(o=i[a-1]&&i[a-1].children[n]),o){t.preventDefault(),r.querySelectorAll('[tabindex="0"]').forEach(t=>t.setAttribute("tabindex","-1")),o.setAttribute("tabindex","0");try{o.focus()}catch(t){}}}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest("tr"):null,r=e.target&&e.target.closest?e.target.closest("th"):null;if(s&&this.contains(s)&&!r&&void 0!==s.dataset.rowKey){const t=s.dataset.rowKey,e=Number(s.dataset.index),r=this._dgSelectedKeys||(this._dgSelectedKeys=new Set);r.has(t)?r.delete(t):r.add(t),this._dgApplySelection(s.parentElement),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{row:e,key:t,index:e}}))}if(r&&this.contains(r)){const e=Array.from(r.parentElement.children).indexOf(r);this._dgSortCol===e?this._dgSortDir="asc"===this._dgSortDir?"desc":"asc":(this._dgSortCol=e,this._dgSortDir="asc");const s=this._dgSortDir,i=this.querySelector(".c-data-grid__table"),a=i&&i.querySelector("tbody"),n=i&&i.querySelector("thead"),o=this._dgCols||[],c=o[e]?"string"==typeof o[e]?o[e]:o[e].key||o[e].label||"":String(e),l=(this._dgFilteredRows||[]).slice();if(l.sort((t,r)=>{const i=Array.isArray(t)?t[e]??"":t&&null!=t[c]?t[c]:"",a=Array.isArray(r)?r[e]??"":r&&null!=r[c]?r[c]:"",n=Number(i),o=Number(a),l=""===i||""===a||isNaN(n)||isNaN(o)?String(i).localeCompare(String(a)):n-o;return"asc"===s?l:-l}),this._dgFilteredRows=l,!this.hasAttribute("virtual")||Number(this.getAttribute("page-size"))>0){if(a){const t=Number(this.getAttribute("page")||1),e=Number(this.getAttribute("page-size")||0);let s=l;if(e>0){const r=(t-1)*e;s=l.slice(r,r+e)}L(a,"");const r=e>0?(t-1)*e:0;s.forEach((t,e)=>{const s=document.createElement("tr");s.dataset.rowKey=this._dgRowKey(t),s.dataset.index=String(r+e),o.forEach((e,r)=>{const i="string"==typeof e?e:e.key||e.label||"",a=document.createElement("td");a.setAttribute("role","gridcell"),a.setAttribute("tabindex","-1");const n=Array.isArray(t)?t[r]:t?t[i]:void 0;a.textContent=null!=n?n:"",s.appendChild(a)}),a.appendChild(s)}),this._dgApplySelection(a)}}else{this._dgRows=l;const e=t();this._renderDataGridWindow(e?e.scrollTop:0)}n&&Array.from(n.querySelectorAll("th")).forEach((t,r)=>{t.setAttribute("aria-sort",r===e?"asc"===s?"ascending":"descending":"none")}),this.dispatchEvent(new CustomEvent("contour:sort",{bubbles:!0,composed:!0,detail:{column:e,direction:s}}))}}),this.addEventListener("pointerdown",t=>{if(!this.hasAttribute("resizable"))return;const e=t.target&&t.target.closest?t.target.closest("th[data-resizable]"):null;if(!e||!this.contains(e)||e.getBoundingClientRect().right-t.clientX>10)return;t.preventDefault();const s=t.clientX,r=e.getBoundingClientRect().width,a=Array.from(e.parentElement.children).indexOf(e);let n=r;const o=t=>{n=Math.max(48,r+t.clientX-s);const e=this.querySelector(".c-data-grid__table");e&&Array.from(e.rows).forEach(t=>{t.children[a]&&(t.children[a].style.inlineSize=n+"px")})},c=()=>{window.removeEventListener("pointermove",o),this.dispatchEvent(new CustomEvent("contour:resize",{bubbles:!0,composed:!0,detail:{column:a,width:n}}))};window.addEventListener("pointermove",o),window.addEventListener("pointerup",c,{once:!0}),i(this,c)}),this._dgApplySelection(this.querySelector(".c-data-grid__table tbody"))}});c("contour-tree-grid",class extends T{static get updateMode(){return"keyed"}static get observed(){return["items","rows","expanded","loading","error","empty"]}static get properties(){return{items:{attribute:"items"},rows:{attribute:"rows"},expanded:{attribute:"expanded"},loading:{attribute:"loading"},error:{attribute:"error"},empty:{attribute:"empty"}}}_expandedSet(){const t=this.getAttribute("expanded");if(!t)return new Set;try{return new Set(JSON.parse(t))}catch(e){return new Set([t])}}render(){this.classList.add("c-tree-grid");const t=this.ensure(".c-tree-grid__table",()=>{const t=document.createElement("table");return t.className="c-table c-tree-grid__table",t.setAttribute("role","treegrid"),t});t.setAttribute("aria-label",k(this,"tree-grid","Tree grid"));const e=this.ensure("tbody",()=>document.createElement("tbody"));if(e.parentNode!==t&&t.appendChild(e),L(e,""),this.hasAttribute("loading")||this.hasAttribute("error")||this.hasAttribute("empty")){const t=document.createElement("tr"),s=document.createElement("td");s.style.textAlign="center",s.style.color="var(--color-text-muted)",this.hasAttribute("loading")?s.textContent=this.getAttribute("loading")||"Loading…":this.hasAttribute("error")?s.textContent=this.getAttribute("error")||"Error":s.textContent=this.getAttribute("empty")||"No data",t.appendChild(s),e.appendChild(t)}else{const t=this.getAttribute("items")||this.getAttribute("rows");let s=[];try{s=t?JSON.parse(t):[]}catch(t){s=[]}Array.isArray(s)||(s=[]);const r=this._expandedSet(),i=[],a=(t,s,n,o,c)=>{const l=document.createElement("tr");l.setAttribute("role","row"),l.setAttribute("tabindex",0===i.length?"0":"-1"),l.setAttribute("aria-level",String(s+1)),l.setAttribute("aria-posinset",String(o)),l.setAttribute("aria-setsize",String(c)),l.dataset.path=n,this._tgSelectedPath===n&&l.setAttribute("aria-selected","true");const u=!!(t&&Array.isArray(t.children)&&t.children.length);u&&l.setAttribute("aria-expanded",r.has(n)?"true":"false");const d=document.createElement("td");d.setAttribute("role","gridcell"),d.style.setProperty("--tree-depth",String(s));const h=t&&(t.label||t.text||t.name)||"";if(u){const t=document.createElement("button");t.type="button",t.className="c-tree-grid__toggle",t.tabIndex=-1,t.textContent=r.has(n)?"▾":"▸",t.setAttribute("aria-label",(r.has(n)?"Collapse":"Expand")+" "+h),d.appendChild(t)}const m=document.createElement("span");m.className="c-tree-grid__label",m.textContent=h,d.appendChild(m),l.appendChild(d),e.appendChild(l),i.push(l),u&&r.has(n)&&t.children.forEach((e,r)=>a(e,s+1,n+"."+r,r+1,t.children.length))};s.forEach((t,e)=>a(t,0,String(e),e+1,s.length))}let s=this.querySelector(".c-tree-grid__wrap");s||(s=document.createElement("div"),s.className="c-table-wrap c-tree-grid__wrap"),t.parentNode!==s&&s.appendChild(t),s.parentNode!==this&&this.appendChild(s)}enhance(){if(this._wiredTreeGrid)return;this._wiredTreeGrid=!0;const t=()=>Array.from(this.querySelectorAll("tr[role='row']")),e=e=>{if(e){t().forEach(t=>t.setAttribute("tabindex",t===e?"0":"-1"));try{e.focus()}catch(t){}}};this.addEventListener("click",s=>{const r=s.target&&s.target.closest?s.target.closest(".c-tree-grid__toggle"):null,i=s.target&&s.target.closest?s.target.closest("tr[role='row']"):null;if(!i||!this.contains(i))return;const a=i.dataset.path;if(e(i),r){s.preventDefault();const t=this._expandedSet();t.has(a)?t.delete(a):t.add(a),this.setAttribute("expanded",JSON.stringify([...t])),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{path:a,expanded:t.has(a)}}))}else this._tgSelectedPath=a,t().forEach(t=>t.setAttribute("aria-selected",String(t===i))),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{path:a}}))}),this.addEventListener("keydown",s=>{const r=s.target&&s.target.closest?s.target.closest("tr[role='row']"):null;if(!r||!this.contains(r))return;const i=t(),a=i.indexOf(r),n=r.dataset.path||"",o=null!==r.getAttribute("aria-expanded"),c=this._expandedSet();if("ArrowRight"===s.key)s.preventDefault(),o&&!c.has(n)?(c.add(n),this.setAttribute("expanded",JSON.stringify([...c])),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{path:n,expanded:!0}}))):o&&c.has(n)&&i[a+1]&&e(i[a+1]);else if("ArrowLeft"===s.key){if(s.preventDefault(),o&&c.has(n))c.delete(n),this.setAttribute("expanded",JSON.stringify([...c])),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{path:n,expanded:!1}}));else if(n.includes(".")){const t=n.slice(0,n.lastIndexOf(".")),s=i.find(e=>e.dataset.path===t);s&&e(s)}}else if("ArrowDown"===s.key)s.preventDefault(),i[a+1]&&e(i[a+1]);else if("ArrowUp"===s.key)s.preventDefault(),i[a-1]&&e(i[a-1]);else if("Enter"===s.key||" "===s.key){s.preventDefault();const t=r.querySelector(".c-tree-grid__toggle");"Enter"===s.key&&t?t.click():(this._tgSelectedPath=n,i.forEach(t=>t.setAttribute("aria-selected",String(t===r))),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{path:n}})))}})}}),c("contour-box",F(["c-box"])),c("contour-cluster",F(["c-cluster"])),c("contour-container",F(["c-container"])),c("contour-row",F(["c-row"])),c("contour-scrim",F(["c-scrim"])),c("contour-stack",F(["c-stack"]));const Ae=t=>{const e=t.querySelector("slot");return(e?e.assignedElements({flatten:!0}):[]).map(t=>(t.textContent||"").trim()).join(" ").trim()||(t.textContent||"").trim()};let Ee=null,we="";const xe=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return(e>>>0).toString(36)},Ce="undefined"!=typeof HTMLElement?HTMLElement:Object;class Se extends Ce{static get observedAttributes(){return l.concat("labels")}constructor(){super();let t=this.shadowRoot;t||(t=this.attachShadow({mode:"open"}),this.constructor.contourTemplate&&t.appendChild(this.constructor.contourTemplate.content.cloneNode(!0)));const e=(()=>{let t=document.styleSheets.length+":";for(const e of document.styleSheets){let s="-1";try{const t=e.cssRules;let r="";for(let e=0;e<t.length;e++)r+=t[e].cssText+"\n";s=t.length+":"+xe(r)}catch(t){}t+=(e.href||"inline")+"~"+s+"|"}if(Ee&&t===we)return Ee;we=t,Ee=[];const e=(t,s)=>{let r;try{r=t.cssRules}catch(t){return}if(r)for(const t of r)if(t instanceof CSSImportRule)t.styleSheet&&e(t.styleSheet,s);else try{s.push(t.cssText)}catch(t){}};for(const t of document.styleSheets)try{if(!t.href||new URL(t.href).origin===location.origin){const s=[];e(t,s);const r=new CSSStyleSheet;s.length&&r.replaceSync(s.join("\n")),Ee.push(r)}}catch(t){}return Ee})();if(e.length)try{t.adoptedStyleSheets=e}catch(t){}this._shadowBase=t.firstElementChild?t.firstElementChild.className:""}enhance(t){t||(t=this.shadowRoot),t&&(t.querySelectorAll("details").forEach(t=>{const e=t.querySelector("summary");e&&!e.hasAttribute("aria-expanded")&&(e.setAttribute("aria-expanded",String(t.open)),t.addEventListener("toggle",()=>{e.setAttribute("aria-expanded",String(t.open))}))}),t.querySelectorAll("[data-live]").forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","status"),t.hasAttribute("aria-live")||t.setAttribute("aria-live","polite")}),t.querySelectorAll(".c-spinner").forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","status"),t.hasAttribute("aria-live")||t.setAttribute("aria-live","polite")}),t.querySelectorAll(".c-toast, .c-toast-host").forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","status"),t.hasAttribute("aria-live")||t.setAttribute("aria-live","polite"),t.hasAttribute("aria-atomic")||t.setAttribute("aria-atomic","true")}),t.querySelectorAll("[role='tab']").forEach(e=>{const s=e.getAttribute("aria-controls");if(s){const r=t.querySelector("#"+CSS.escape(s))||document.getElementById(s);r&&!r.hasAttribute("aria-labelledby")&&(e.id||(e.id=o("tab")),r.setAttribute("aria-labelledby",e.id))}}),t.querySelectorAll("input, textarea, select").forEach(t=>{if(t.hasAttribute("aria-describedby"))return;const e=t.closest(".c-field");if(e){const s=e.querySelector(".c-field__hint");s&&(s.id||(s.id=o("hint")),t.setAttribute("aria-describedby",s.id));const r=e.querySelector(".c-field__error");if(r){r.id||(r.id=o("err"));const e=t.getAttribute("aria-describedby")||"";t.setAttribute("aria-describedby",(e+" "+r.id).trim())}}}),t.querySelectorAll(".c-alert").forEach(t=>{const e=t.classList.contains("c-alert--warning")||t.classList.contains("c-alert--danger"),s=e?"alert":"status",r=e?"assertive":"polite";t.hasAttribute("role")&&!t.dataset.contourAutoRole||(t.setAttribute("role",s),t.dataset.contourAutoRole=s),t.hasAttribute("aria-live")&&!t.dataset.contourAutoLive||(t.setAttribute("aria-live",r),t.dataset.contourAutoLive=r)}),t.querySelectorAll("input[required], textarea[required], select[required]").forEach(t=>{t.hasAttribute("aria-required")||t.setAttribute("aria-required","true")}),this._wireLabels(t),this._wireClose(t))}_wireClose(t){if(!t||this._wiredShadowClose)return;const e=t.querySelectorAll(".c-callout__close, .c-alert__close, .c-tag__remove, .c-filter-pill__remove");if(e.length){this._wiredShadowClose=!0;for(const t of e)t.addEventListener("click",()=>{this.hidden=!0,this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}))})}}_wireLabels(t){t&&t.querySelectorAll("label").forEach(t=>{const e=t.querySelector("slot"),s=t.closest(".c-field")||t.parentElement,r=[];if(e)for(const t of e.assignedElements({flatten:!0}))t.matches("input, textarea, select")&&r.push(t);if(!r.length&&s){const t=s.querySelector('slot[name="input"]');if(t)for(const e of t.assignedElements({flatten:!0}))e.matches("input, textarea, select")&&r.push(e)}for(const e of r){if(e.id||(e.id=o("shadow-input")),t.hasAttribute("for")||t.setAttribute("for",e.id),!e.hasAttribute("aria-label")&&!e.hasAttribute("aria-labelledby")){const s=Ae(t);s&&e.setAttribute("aria-label",s)}if(e._contourLabelWired||(e._contourLabelWired=!0,t.addEventListener("click",t=>{if(!t.target.closest("a, button, input, textarea, select"))try{e.click()}catch(t){}})),s&&!e.hasAttribute("aria-describedby")){const t=s.querySelector(".c-field__hint"),r=s.querySelector(".c-field__error"),i=[];t&&(t.id||(t.id=o("hint")),i.push(t.id)),r&&(r.id||(r.id=o("err")),i.push(r.id)),i.length&&e.setAttribute("aria-describedby",i.join(" "))}}})}connectedCallback(){this.applyMods();try{this.enhance(this.shadowRoot)}catch(t){}this._applyLabels();try{(t=>{tt.delete(t);const e=et.get(t);if(e){for(const{target:t,type:s,fn:r,options:i}of e)try{t.removeEventListener(s,r,i)}catch(t){}et.delete(t)}})(this),pt(this),gt(this),_t(this),ft(this),At(this),Et(this),wt(this),xt(this)}catch(t){}this.shadowRoot&&!this._wiredSlotchange&&(this._wiredSlotchange=!0,this.shadowRoot.addEventListener("slotchange",()=>{try{this.enhance(this.shadowRoot),this._applyLabels(),pt(this),gt(this),_t(this),ft(this),At(this),Et(this),wt(this),xt(this)}catch(t){}}))}attributeChangedCallback(){this.applyMods(),this._applyLabels()}_applyLabels(){const t=this.shadowRoot;if(!t)return;const e=(e,s,r)=>{const i=t.querySelector(e);i&&i.setAttribute("aria-label",k(this,s,r))};e(".c-callout__close","close","Close"),e(".c-alert__close","close","Close"),e(".c-tag__remove","remove","Remove"),e(".c-filter-pill__remove","remove-filter","Remove filter"),e(".c-breadcrumb","breadcrumb","Breadcrumb"),e(".c-spinner","loading","Loading"),e(".c-install__copy","copy-command","Copy command");const s=t.querySelector(".c-install__copy, .c-code__copy");s&&"Copy"===s.textContent.trim()&&(s.textContent=k(this,"copy","Copy"))}applyMods(){const t=this.shadowRoot.firstElementChild;if(!t||!this._shadowBase)return;const e=[];for(const t of l){const s=this.getAttribute(t);if(s)for(const t of this._shadowBase.split(/\s+/))t&&e.push("c-"+t.replace(/^c-/,"")+"--"+s)}if(t.className=(this._shadowBase+" "+e.join(" ")).trim(),t.classList.contains("c-alert")){const e=t.classList.contains("c-alert--warning")||t.classList.contains("c-alert--danger"),s=e?"alert":"status",r=e?"assertive":"polite";t.hasAttribute("role")&&!t.dataset.contourAutoRole||(t.setAttribute("role",s),t.dataset.contourAutoRole=s),t.hasAttribute("aria-live")&&!t.dataset.contourAutoLive||(t.setAttribute("aria-live",r),t.dataset.contourAutoLive=r)}}}const ke={},Ne={},Le=(t,e)=>{ke[t]=[...e.matchAll(/part="([^"]+)"/g)].flatMap(t=>t[1].split(/\s+/)).filter(Boolean)},qe=(t,e)=>{if(Ne[t]=e,Le(t,e),"undefined"==typeof document)return;const s=document.createElement("template");L(s,e);const r=class extends Se{};r.contourTemplate=s,c(t,r)},De=(t,e,s)=>"<"+t+' class="c-'+e+'" part="'+(s||e)+'"'+("button"===t?' type="button"':"")+"><slot></slot></"+t+">",Me={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"],span:["avatar","badge","chip","dot","flag","live-badge","mark","pill"],a:["link","linkish"],kbd:["kbd"],label:["check","radio","switch"],nav:["docs-nav"]},Te={"version-banner":"banner","contour-plot":"plot"};for(const[t,e]of Object.entries(Me))for(const s of e){qe("contour-shadow-"+s,De(t,s,Te[s]||s))}qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("contour-shadow-brownout",'<div class="c-brownout" part="brownout" data-level="0"><slot></slot></div>'),qe("contour-shadow-widget-state",'<div class="c-widget-state" part="widget-state"><slot></slot></div>'),qe("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>'),qe("contour-shadow-axis",'<div class="c-axis" part="axis"><slot></slot></div>'),qe("contour-shadow-brush",'<div class="c-brush" part="brush"><div class="c-brush__selection" part="selection"></div></div>'),qe("contour-shadow-stacked-bar",'<div class="c-stacked-bar" part="bar"><slot></slot></div>'),qe("contour-shadow-category",'<div class="c-category" part="category" role="listbox"><slot></slot></div>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("contour-shadow-coordinate",'<div class="c-coordinate" part="coordinate"><span class="c-coordinate__value" part="value"><slot name="value"></slot></span></div>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("contour-shadow-loading",'<div class="c-loading" part="loading"><span class="c-spinner" part="spinner"></span><slot></slot></div>'),qe("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>'),qe("contour-shadow-breadcrumb",'<nav class="c-breadcrumb" part="breadcrumb" aria-label="Breadcrumb"><ol><slot></slot></ol></nav>'),qe("contour-shadow-menu",'<div class="c-menu" part="menu" role="menu"><slot></slot></div>'),qe("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>'),qe("contour-shadow-chart",'<div class="c-chart" part="chart"><div class="c-chart__plot" part="plot"><slot></slot></div></div>'),qe("contour-shadow-bivariate",'<div class="c-bivariate" part="bivariate"><div class="c-bivariate__matrix" part="matrix"><slot></slot></div></div>'),qe("contour-shadow-bivariate-legend",'<div class="c-bivariate-legend" part="legend"><div class="c-bivariate-legend__matrix" part="matrix"><slot></slot></div></div>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("contour-shadow-container",'<div class="container" part="container"><slot></slot></div>'),qe("contour-shadow-spinner",'<span class="c-spinner" part="spinner" aria-label="Loading"></span>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>');const Fe='<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" viewBox="0 0 24 24"><path d="m18 6-12 12M6 6l12 12" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></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>';Ne["contour-shadow-dialog"]=Fe,Le("contour-shadow-dialog",Fe);class Re extends Se{static contourTemplate="undefined"!=typeof document?(()=>{const t=document.createElement("template");return L(t,Fe),t})():null;enhance(t){if(super.enhance(t),this._wiredShadowDialog)return;this._wiredShadowDialog=!0;const e=t.querySelector("dialog"),s=t.querySelector('[part="close"]');if(s&&s.addEventListener("click",()=>e?.close()),e){let t=null;e.addEventListener("beforetoggle",s=>{if("open"===s.newState){t=document.activeElement,this._syncingOpenAttr=!0,this.hasAttribute("open")||this.setAttribute("open",""),this._syncingOpenAttr=!1,this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}));const r=e.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(r)try{r.focus()}catch(s){}}else if("closed"===s.newState&&(this._syncingOpenAttr=!0,this.hasAttribute("open")&&this.removeAttribute("open"),this._syncingOpenAttr=!1,this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})),t&&"function"==typeof t.focus))try{t.focus()}catch(s){}});const s=()=>{const t="button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])",s=Array.from(e.querySelectorAll(t));for(const r of e.querySelectorAll("slot"))for(const e of r.assignedElements({flatten:!0})){e.matches(t)&&s.push(e);for(const r of e.querySelectorAll(t))s.push(r)}return s},r=()=>this.shadowRoot&&this.shadowRoot.activeElement||document.activeElement;e.addEventListener("keydown",t=>{if("Tab"!==t.key)return;const e=s();if(!e.length)return;const i=e[0],a=e[e.length-1];t.shiftKey&&r()===i?(t.preventDefault(),a.focus()):t.shiftKey||r()!==a||(t.preventDefault(),i.focus())})}}static get observedAttributes(){return[...super.observedAttributes,"open"]}attributeChangedCallback(t,e,s){if(super.attributeChangedCallback(t,e,s),"open"===t&&this.shadowRoot&&!this._syncingOpenAttr){const t=this.shadowRoot.querySelector("dialog");t&&(null===s||t.open?null===s&&t.open&&this.close():this.show())}}connectedCallback(){super.connectedCallback(),this.hasAttribute("open")&&this.show()}show(){if(!this.isConnected)return void(this.hasAttribute("open")||this.setAttribute("open",""));const t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}close(){const t=this.shadowRoot?.querySelector("dialog");t&&t.open&&t.close()}showModal(){this.show()}get open(){return!!this.shadowRoot?.querySelector("dialog")?.open}set open(t){t?this.show():this.close()}get returnValue(){return this.shadowRoot?.querySelector("dialog")?.returnValue??""}set returnValue(t){const e=this.shadowRoot?.querySelector("dialog");e&&(e.returnValue=String(t))}}c("contour-shadow-dialog",Re);const Be=Object.freeze({...Ne});if("undefined"!=typeof globalThis&&(globalThis.ContourShadowTemplates=Be),"undefined"!=typeof window){window.ContourShadowParts=Object.freeze(Object.fromEntries(Object.entries(ke).map(([t,e])=>[t,Object.freeze([...new Set(e)])]))),window.Contour||(window.Contour={});try{window.Contour.shadowTemplates=Be}catch{}}"undefined"!=typeof window&&(window.ContourVersion=t,window.Contour||(window.Contour={format:{value:B,number:(t,e,s)=>B(t,e,s),time:(t,e)=>{try{return new Intl.DateTimeFormat(e||void 0).format(new Date(t))}catch(e){return String(t)}},locale:t=>t||("undefined"!=typeof navigator?navigator.language:"en")},markers:{shapes:K,styles:function(t){return{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%)"}[t]||""},assign:function(t){return(t||[]).map((t,e)=>({...t,marker:K[e%K.length]}))}}}),queueMicrotask(()=>{try{window.dispatchEvent(new CustomEvent("contour:ready",{detail:{version:t,count:e.length}}))}catch(t){}}))}();
1
+ !function(){"use strict";var t="1.9.1";const e=[],s=t=>{if("function"!=typeof getComputedStyle)return!1;const e=getComputedStyle(t);return("auto"===e.overflowY||"scroll"===e.overflowY||"auto"===e.overflowX||"scroll"===e.overflowX)&&(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)},r=new WeakMap,i=(t,e)=>{let s=r.get(t);s||(s=[],r.set(t,s)),s.push(e)};function a(){try{if("undefined"!=typeof window&&(window.ContourDebug||window.__CONTOUR_DEBUG__))return!0}catch(t){}try{if("undefined"!=typeof process&&process.env&&"production"!==process.env.NODE_ENV&&process.env.CONTOUR_DEBUG)return!0}catch(t){}return!1}let n=0;const o=t=>t+"-"+(++n).toString(36),c=(t,s)=>{"undefined"!=typeof customElements&&customElements&&"function"==typeof customElements.define&&(customElements.get(t)||"undefined"!=typeof window&&"function"==typeof window.__contourDefineDefer&&window.__contourDefineDefer(t,s)||(customElements.define(t,s),e.push(t),"undefined"!=typeof window&&(window.ContourElements=Object.freeze(e.slice()))))},l=["variant","size","color"],u=Symbol("JSON"),d=Object.freeze({"contour:activate":{payload:["files","label","row","value"],composed:!0},"contour:add":{payload:["value"],composed:!0},"contour:activity-clear":{payload:[],composed:!0},"contour:activity-filter":{payload:["unread"],composed:!0},"contour:activity-select":{payload:["index","text"],composed:!0},"contour:rendered":{payload:["renderCount"],composed:!0},"contour:cap":{payload:["series","total","shown"],composed:!0},"contour:action":{payload:["label"],composed:!0},"contour:break-change":{payload:["layer","value"],composed:!0},"contour:style-resolved":{payload:["applied","classification","colors","items","layer","n","palette","property","value"],composed:!0},"contour:advanced-toggle":{payload:["title"],composed:!0},"contour:affordance-activate":{payload:["name"],composed:!0},"contour:aggregate":{payload:["aggregate"],composed:!0},"contour:bearing":{payload:["direction","degrees"],composed:!0},"contour:btn-group-change":{payload:["index","label"],composed:!0},"contour:brush-start":{payload:["end","range","start","value"],composed:!0},"contour:brush-end":{payload:["end","range","start","value"],composed:!0},"contour:brush":{payload:["end","range","start","value"],composed:!0},"contour:change":{payload:["checked","color","direction","end","files","high","index","low","month","name","paused","query","speed","start","unit","value","values","year"],composed:!0},"contour:collapse":{payload:["collapsed"],composed:!0},"contour:cluster-toggle":{payload:["count","expanded"],composed:!0},"contour:clear":{payload:[],composed:!0},"contour:clear-all":{payload:[],composed:!0},"contour:close":{payload:["count","index","label","message","open","value"],composed:!0},"contour:copy":{payload:["text"],composed:!0},"contour:apply":{payload:["name"],composed:!0},"contour:dash-action":{payload:["label"],composed:!0},"contour:diff-activate":{payload:["kind","text"],composed:!0},"contour:dismiss":{payload:["label"],composed:!0},"contour:draw-start":{payload:["mode"],composed:!0},"contour:drag":{payload:["delta","key","value"],composed:!0},"contour:do-dont-activate":{payload:["kind","text"],composed:!0},"contour:docs-nav-select":{payload:["label","href"],composed:!0},"contour:dragend":{payload:["value"],composed:!0},"contour:dragstart":{payload:["value"],composed:!0},"contour:drop":{payload:["value","label"],composed:!0},"contour:empty-action":{payload:["state"],composed:!0},"contour:filter":{payload:["query"],composed:!0},"contour:filter-change":{payload:["source","filter"],composed:!0},"contour:error":{payload:["src","message","name","status"],composed:!0},"contour:export":{payload:["format"],composed:!0},"contour:refresh":{payload:[],composed:!0},"contour:hide":{payload:[],composed:!0,deprecated:"use contour:close instead"},"contour:hover":{payload:["row"],composed:!0},"contour:input":{payload:["name","value","checked"],composed:!0},"contour:invalid":{payload:["field","input","message"],composed:!0,cancelable:!0},"contour:inspect-action":{payload:["label","value"],composed:!0},"contour:layer-opacity":{payload:["layerId","name","opacity"],composed:!0},"contour:layer-rename":{payload:["layerId","name","newName"],composed:!0},"contour:layer-duplicate":{payload:["layerId","name"],composed:!0},"contour:layer-zoom":{payload:["layerId","name"],composed:!0},"contour:zoom":{payload:["data","index","row"],composed:!0},"contour:layer-projection":{payload:["layerId","name","projection"],composed:!0},"contour:layer-remove":{payload:["layerId","name"],composed:!0},"contour:layer-reorder":{payload:["layerIds"],composed:!0},"contour:layer-toggle":{payload:["layerId","name","visible"],composed:!0},"contour:layer-visibility":{payload:["layerId","name","visible"],composed:!0},"contour:legend-toggle":{payload:["index","key","label","pressed"],composed:!0},"contour:leave":{payload:[],composed:!0},"contour:load":{payload:["src","count"],composed:!0},"contour:map-control":{payload:["control"],composed:!0},"contour:map-style":{payload:["style","name"],composed:!0},"contour:map-attach":{payload:[],composed:!0},"contour:map-ready":{payload:[],composed:!0},"contour:map-detach":{payload:[],composed:!0},"contour:map-popup-reposition":{payload:["anchor","flippedX","flippedY","left","top"],composed:!0},"contour:map-viewport":{payload:["crossesAntimeridian","west","south","east","north","zoom","center"],composed:!0},"contour:mode-change":{payload:["mode"],composed:!0},"contour:scope-change":{payload:["scope"],composed:!0},"contour:move":{payload:["direction","from","to","dx","dy"],composed:!0},"contour:open":{payload:[],composed:!0},"contour:page":{payload:["page"],composed:!0},"contour:ready":{payload:["version","count"],composed:!0},"contour:read":{payload:["label"],composed:!0},"contour:remove":{payload:["key","label","name","value"],composed:!0},"contour:reorder":{payload:["from","to"],composed:!0},"contour:range-change":{payload:["value"],composed:!0},"contour:resize":{payload:["column","delta","height","value","width"],composed:!0},"contour:retry":{payload:["src"],composed:!0},"contour:loop-change":{payload:["loop"],composed:!0},"contour:pause":{payload:[],composed:!0},"contour:play":{payload:[],composed:!0},"contour:seek":{payload:["progress","value"],composed:!0},"contour:select":{payload:["area","col","expanded","href","index","key","label","labels","level","path","range","result","row","rows","series","value"],composed:!0},"contour:search":{payload:["query"],composed:!0},"contour:spatial-filter":{payload:["action","mode","operator"],composed:!0},"contour:split-change":{payload:["value","width","height"],composed:!0},"contour:speed-change":{payload:["speed"],composed:!0},"contour:showcase-activate":{payload:["title"],composed:!0},"contour:step-activate":{payload:["index","title"],composed:!0},"contour:step-change":{payload:["direction","index","title"],composed:!0},"contour:show":{payload:[],composed:!0,deprecated:"use contour:open instead"},"contour:sort":{payload:["column","direction"],composed:!0},"contour:column-toggle":{payload:["column","visible"],composed:!0},"contour:submit":{payload:["submitting"],composed:!0},"contour:stream-state":{payload:["running"],composed:!0},"contour:tab-change":{payload:["index","label"],composed:!0},"contour:theme-change":{payload:["theme"],composed:!0},"contour:tick":{payload:["frame"],composed:!0},"contour:time-change":{payload:["progress","value"],composed:!0},"contour:time-range-change":{payload:["value"],composed:!0},"contour:toggle":{payload:["collapsed","expanded","label","open","path","playing"],composed:!0},"contour:view-enter":{payload:[],composed:!0},"contour:view-leave":{payload:[],composed:!0}}),h=new Set(["script","iframe","object","embed","style","link","meta","base","form","input","button"]),m=new Set(["animate","animatemotion","animatetransform","set","discard"]),b=new Set(["href","src","xlink:href","from","to","values","by","attributename"]);function p(t){const e=function(t){let e=String(null==t?"":t);e=e.replace(/[\t\n\r]/g,""),e=e.replace(/^[\u0000-\u0020]+/,"").replace(/[\u0000-\u0020]+$/,"");try{e=decodeURIComponent(e)}catch(t){}return e.toLowerCase()}(t),s=e.replace(/[\u0000-\u001f\u007f]/g,"");return s.startsWith("javascript:")||s.startsWith("vbscript:")||s.startsWith("data:text/html")||s.startsWith("data:image/svg+xml")}function g(t){const e=String(null==t?"":t);if("undefined"==typeof DOMParser)return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");const s=(new DOMParser).parseFromString(e,"text/html"),r=t=>{const e=Array.from(t.childNodes);for(const t of e){if(1!==t.nodeType)continue;const e=t.tagName.toLowerCase();if(h.has(e))t.remove();else{if(m.has(e)){const e=Array.from(t.attributes).map(t=>t.name.toLowerCase()),s=String(t.getAttribute("attributename")||"").toLowerCase();if(e.some(t=>b.has(t))||b.has(s)){t.remove();continue}}for(const e of Array.from(t.attributes)){const s=e.name.toLowerCase();s.startsWith("on")?t.removeAttribute(e.name):"style"!==s&&"srcdoc"!==s?b.has(s)&&p(e.value)&&t.removeAttribute(e.name):t.removeAttribute(e.name)}r("template"!==e?t:t.content||t)}}};return r(s.body),s.body.innerHTML}function _(t){const e=String(null==t?"":t).trim();if(!e)return"";if(/[;{}<>"'`\\]/.test(e))return"";if(/url\s*\(/i.test(e)||/expression\s*\(/i.test(e))return"";if(/^#[0-9a-f]{3,8}$/i.test(e))return e;if(/^(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\(/i.test(e))return e;if(/^(var|light-dark|color-mix)\(/i.test(e)){let t=0;for(let s=0;s<e.length;s++){const r=e[s];if("("===r)t++;else if(")"===r&&(t--,t<0))return""}return 0===t?e:""}return/^[a-z]+$/i.test(e)?e:""}function v(t){const e=String(null==t?"":t).trim();if(!e)return"#";if(e.startsWith("#")||e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("?"))return e;if("undefined"==typeof document||!document.baseURI)return"#";try{const t=new URL(e,document.baseURI);return["http:","https:","mailto:","tel:"].includes(t.protocol)?e:"#"}catch(t){return"#"}}function y(t,e){if("undefined"==typeof getComputedStyle||"undefined"==typeof document)return e;const s=parseFloat(getComputedStyle(document.documentElement).getPropertyValue(t));return Number.isFinite(s)&&s>0?s:e}function f(t,e,s){if("undefined"==typeof console||!console.warn)return;const r=t&&t.tagName?t.tagName.toLowerCase():"component",i=s&&s.message||String(s);console.warn(`[contour] ${r}: malformed ${e||"attribute"} — ${i}`)}const A=["accept","action","actions","active","after","allow-duplicate","allow-remove","allow-rename","allow-zoom","alpha","anchor","answer","area","article","attribution","attribution-mark","audit","autoplay","axis","axis-x","axis-y","brownout","brownout-level","before","body","brand","bounds","breakpoint","breaks","brush","brush-end","brush-max","brush-min","brush-start","cache-key","canvas","center","clearable","cols","columns","color","command","cells","checked","chrome","confidence","coverage","debounce","closable","collapsed","collapsible","classification","continuous","content","controls","copyable","count","data","data-table","date","delta","description","glyphs","graduated","demo","density","desc","dir","direction","disabled","distance","dismissible","divider","do","dont","dot","ends","high","input","layer","low","mode","modes","n","opacity","palette","polarity","precision","range","single","empty","exclusive","fallback","filename","format","heading","help","hint","href","icon","illustration","instrument","interval","items","key","layers","level","markers","label","labels","latitude","lazy","lede","legend","left-label","right-label","line","limit","link","links","live","loading","locale","loop","max","media","message","method","methodology","menu","min","multiple","name","needle","next","no","no-cache","no-data-message","nodes","note","norm","options","orientation","page-size","pages","pause","paused","pausable","persist","placeholder","playing","point","points","prev","presets","prompt","question","recent","required","quote","ramp","refresh","removable","resolution","reverse","rings","retry","results","rows","scale","selectable","segments","show-header","sparkline","threshold","thresholds","selected","separator","series","shortcut","side","size","skeleton","sort","sort-dir","status","step","submit","submitting","timeout","trigger","virtual","sticky","cluster-count","cluster-expanded","time","resizable","state","steps","style","subtitle","summary","src","source","table","tabs","tag","text","ticks","title","type","unread-only","unit","updated","row-height","variant","values","viewport","warning","yes","zoom","zoomable","caption","current-time","is-playing","loop-label","no-data-color","no-data-label","property","show-loop","show-thumb","show-thumb-caption","speeds","item-height","pause-label","play-label","speed-label","time-label","shimmer","search","numbered","bucket-count","limit-values","autocomplete","levels","submit-label","fields","gap","flush","head","preview","tags","url","custom-error"];function E(t,e="h3"){const s=t&&t.getAttribute?t.getAttribute("heading"):null;return/^h[1-6]$/.test(s||"")?s:e}function w(t,e){if(!t||!t.getAttribute)return!1;const s=t.getAttribute(e);if(null===s)return!1;const r=s.trim().toLowerCase();return"0"!==r&&"false"!==r&&"no"!==r&&"off"!==r&&"null"!==r&&"undefined"!==r}function x(t){if(null==t||!1===t)return!1;if("string"==typeof t){const e=t.trim().toLowerCase();return"0"!==e&&"false"!==e&&"no"!==e&&"off"!==e&&"null"!==e&&"undefined"!==e}return Boolean(t)}function C(t){switch(String(t||"").toLowerCase()){case"success":return"i-check-circle";case"warning":return"i-alert";case"danger":case"error":return"i-x";case"info":case"note":case"tip":case"accent":return"i-info";default:return""}}function S(t,e,s){if(!t||!t.dispatchEvent)return;const r="contour:open"===e;if(!r&&!("contour:close"===e))return void t.dispatchEvent(new CustomEvent(e,{detail:s,bubbles:!0,composed:!0}));t.dispatchEvent(new CustomEvent(e,{detail:s,bubbles:!0,composed:!0}));const i=r?"contour:show":"contour:hide";console.warn(`[Contour] ${i} is deprecated, use ${e} instead. Will be removed in v2.0. (host: ${t.tagName||t.constructor.name})`),t.dispatchEvent(new CustomEvent(i,{detail:s,bubbles:!0,composed:!0}))}function k(t,e,s){const r=void 0!==s?s:e,i=t&&t.getAttribute?t.getAttribute("labels"):null;if(!i)return r;try{const t=JSON.parse(i);if(t&&"object"==typeof t&&"string"==typeof t[e]&&t[e])return t[e]}catch(t){}return r}let N=null;function L(t,e){if(!t)return;const s=null==e||""===e;if(s||"undefined"==typeof window||!window.trustedTypes||"function"!=typeof window.trustedTypes.createPolicy)t.innerHTML=s?"":e;else{if(!N)try{N=window.trustedTypes.createPolicy("contour-html",{createHTML:t=>t})}catch(t){N=null}t.innerHTML=N?N.createHTML(e):e}}function q(t,e,s,r){t&&(t.dataset&&"true"===t.dataset.contourLabel?t.textContent=k(e,s,r):t.textContent||(t.textContent=k(e,s,r),t.dataset&&(t.dataset.contourLabel="true")))}const D="undefined"!=typeof HTMLElement?HTMLElement:Object,M=new WeakSet;class T extends D{static formAssociated=!1;constructor(){super(),this.constructor.formAssociated&&"function"==typeof this.attachInternals&&(this._internals=this.attachInternals())}static get observed(){return A}static get observedAttributes(){const t=this.observed;return t.includes("labels")?t:[...t,"labels"]}static get properties(){return{}}static get updateMode(){return"scaffold"}brownoutLevel(){const t=this.getAttribute("brownout-level")||this.getAttribute("brownout")||"0",e=parseInt(t,10);return Number.isFinite(e)?e:0}shed(t,e){return this.brownoutLevel()>=(e||1)}get renderCount(){return this._contourRenderCount||0}get updateComplete(){return this._renderTicket||Promise.resolve(this)}_announceRendered(){const t=this.renderCount;this._renderTicket=new Promise(e=>{queueMicrotask(()=>{this._renderTicket=null,e(this),this.isConnected&&this.dispatchEvent(new CustomEvent("contour:rendered",{bubbles:!0,composed:!0,detail:{renderCount:t}}))})})}_countRender(){this._contourRenderCount=(this._contourRenderCount||0)+1}_installProperties(){const t=this.constructor;if(M.has(t))return;M.add(t);const e=t.properties||{},s=new Set,r=t=>"object"==typeof t&&null!==t?JSON.stringify(t):String(t),i=t=>{if(null===t)return null;const e=t.trim();if(e.startsWith("[")||e.startsWith("{"))try{return JSON.parse(e)}catch{}return t};for(const[a,n]of Object.entries(e)){const e=n&&n.attribute||a;s.add(e);const o=n&&n.type||String;Object.defineProperty(t.prototype,a,{get(){const t=this.getAttribute(e);if(o===Boolean)return x(t);if(null===t)return n&&void 0!==n.default?n.default:null;if(o===Number){const e=Number(t);return Number.isNaN(e)?null:e}return o===u?i(t):t},set(t){null==t||!1===t?this.removeAttribute(e):o===Boolean?x(t)?this.setAttribute(e,""):this.removeAttribute(e):this.setAttribute(e,r(t))},configurable:!0})}const a=t.observedAttributes;for(const e of a){if(s.has(e))continue;const a=e.replace(/-([a-z])/g,(t,e)=>e.toUpperCase());if(!/^[a-zA-Z_$][\w$]*$/.test(a))continue;if(a in t.prototype)continue;const n="disabled"===e||"checked"===e||"required"===e||"readonly"===e||"multiple"===e||"selected"===e||"open"===e||"hidden"===e;Object.defineProperty(t.prototype,a,{get(){const t=this.getAttribute(e);return n?x(t):i(t)},set(t){null==t||!1===t?this.removeAttribute(e):n?x(t)?this.setAttribute(e,""):this.removeAttribute(e):this.setAttribute(e,r(t))},configurable:!0})}}connectedCallback(){if(this._contourAuthored){this._wireFormData();for(const t of Object.keys(this))t.startsWith("_wired")&&"_wiredFormData"!==t&&"_wiredValueTracking"!==t&&(this[t]=!1);return void this.attributeChangedCallback("__contour_reconnect__",null,"")}this._installProperties(),this._contourAuthored={nodes:Array.from(this.childNodes)},this._contourOwnedClasses=new Set;for(const t of this._contourAuthored.nodes)1===t.nodeType&&t.setAttribute("data-contour-authored","");const t=Array.from(this.childNodes);this._contourRenderGen=(this._contourRenderGen||0)+1,this._ensureCache=new Map,this._ensureCacheGen=this._contourRenderGen,this._countRender();const e=new Set(Array.from(this.classList));try{this.render()}catch(t){console.error("Contour render error:",t),this.textContent=k(this,"render-error","Component failed to render.")}this._contourGenerated=Array.from(this.childNodes).filter(e=>!t.includes(e)),this._contourOwnedClasses=new Set(Array.from(this.classList).filter(t=>!e.has(t))),this._applyDensity(),this._runEnhance(),this._detachInnerFormControls(),this._wireFormData(),this._wireValueTracking(),this._announceRendered()}attributeChangedCallback(t,e,r){if(e!==r&&this.isConnected&&this._contourAuthored)if(this._batchDepth>0)this._batchDirty=!0;else if(this._contourRendering)this._pendingRerender||(this._pendingRerender=!0,queueMicrotask(()=>{this._pendingRerender=!1,this.isConnected&&this._contourAuthored&&this.attributeChangedCallback("__rerender__",null,"")}));else{"checked"===t&&(this._checkedAttrChanged=!0),this._contourRendering=!0;try{const t=Array.from(this.querySelectorAll("input, textarea, select")).map(t=>({key:t.name||t.id||null,preserveKey:t.getAttribute("data-contour-preserve-key")||null,value:t.value,checked:t.checked,type:t.type,dirty:!!t._contourUserDirty,attrAtDirty:t._contourAttrAtDirty,selected:"SELECT"===t.tagName&&t.multiple?Array.from(t.selectedOptions).map(t=>t.value):null})),e=this.contains(document.activeElement)?document.activeElement:null,r="button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])",i=Array.from(this.querySelectorAll(r)),a=e?i.indexOf(e):-1,n=e&&e.id||null,o=e&&e.getAttribute("data-contour-preserve-key")||null,c=e&&e.getAttribute("name")||null,l=Array.from(this.querySelectorAll("*")).filter(s).map(t=>({el:t,id:t.id||null,preserveKey:t.getAttribute("data-contour-preserve-key")||null,top:t.scrollTop,left:t.scrollLeft})),u=Array.from(this.querySelectorAll("details")).map(t=>({id:t.id||null,preserveKey:t.getAttribute("data-contour-preserve-key")||null,open:t.open}));for(const t of this._contourGenerated||[]){if(!t||t.parentNode!==this)continue;let e=null;if(t.classList&&(t.classList.contains("c-panel__body")||t.classList.contains("c-dialog__body")||t.classList.contains("c-popover__body")||t.classList.contains("c-map-popup__body")||t.classList.contains("c-hover-card__body")||t.classList.contains("c-drawer__body")||t.classList.contains("c-sheet__body")||t.classList.contains("c-alert__body"))?e=t:"PRE"===t.tagName&&(e=t.querySelector("code")||t),e)for(;e.firstChild;)this.insertBefore(e.firstChild,t)}const d=this._contourPersistent,h=t=>!!(d&&d.size&&d.has(t)),m=new Set(this._contourAuthored.nodes||[]);for(const t of this._contourGenerated||[])if(!h(t)){for(const e of Array.from(t.childNodes))m.has(e)&&t.parentNode.insertBefore(e,t);t.parentNode===this&&this.removeChild(t)}const b=new Set(this._contourGenerated||[]),p=Array.from(this.childNodes).filter(t=>!b.has(t)&&!h(t));for(const t of this._contourGenerated||[]){if(h(t))continue;const e=t.querySelectorAll?t.querySelectorAll("[data-contour-authored]"):[];for(const t of e)p.includes(t)||p.push(t)}this._contourAuthored.nodes=p;const g=Array.from(this.childNodes).filter(h);for(const t of g)this.appendChild(t);for(;this.firstChild&&!h(this.firstChild);)this.removeChild(this.firstChild);for(const t of this._contourAuthored.nodes)this.insertBefore(t,this.firstChild&&h(this.firstChild)?this.firstChild:null);for(const t of g)this.appendChild(t);for(const t of this._contourOwnedClasses)this.classList.remove(t);const _=new Set(Array.from(this.classList)),v=Array.from(this.childNodes);this._contourRenderGen=(this._contourRenderGen||0)+1,this._ensureCache=new Map,this._ensureCacheGen=this._contourRenderGen,this._countRender();try{this.render()}catch(t){console.error("Contour render error:",t),this.textContent=k(this,"render-error","Component failed to render.")}this._contourGenerated=Array.from(this.childNodes).filter(t=>!v.includes(t)),this._contourOwnedClasses=new Set(Array.from(this.classList).filter(t=>!_.has(t))),this._applyDensity();const y=Array.from(this.querySelectorAll("input, textarea, select")),f=t.filter(t=>t.key||t.preserveKey),A=t.filter(t=>!t.key&&!t.preserveKey),E=new Set;for(const t of y){const e=t.name||t.id||t.getAttribute("data-contour-preserve-key")||null;if(!e)continue;const s=f.find(t=>(t.key===e||t.preserveKey===e)&&!E.has(t));s&&(E.add(s),this._contourResetting||this._restoreControlValue(t,s),"checkbox"!==t.type&&"radio"!==t.type||"boolean"!=typeof s.checked||this._checkedAttrChanged||this._contourResetting||(t.checked=s.checked))}const w=new Map;for(const t of A){const e=w.get(t.type)||[];e.push(t),w.set(t.type,e)}const x=new Map;for(const t of y){if(t.name||t.id)continue;const e=t.type,s=w.get(e)||[],r=x.get(e)||0;if(r>=s.length)continue;const i=s[r];x.set(e,r+1),this._contourResetting||this._restoreControlValue(t,i),"checkbox"!==t.type&&"radio"!==t.type||"boolean"!=typeof i.checked||this._checkedAttrChanged||this._contourResetting||(t.checked=i.checked)}const C=Array.from(this.querySelectorAll("details")),S=u.filter(t=>t.id||t.preserveKey),N=new Set;for(const t of C){const e=t.id||null,s=t.getAttribute("data-contour-preserve-key")||null;if(!e&&!s)continue;const r=S.find(t=>(t.id===e||t.preserveKey===s)&&!N.has(t.id||t.preserveKey));r&&(N.add(r.id||r.preserveKey),t.open=r.open)}let L=0;const q=u.filter(t=>!t.id);for(const t of C){if(t.id)continue;const e=q[L];if(L+=1,!e)break;t.open=e.open}const D=Array.from(this.querySelectorAll("*")).filter(s),M=l.filter(t=>t.id||t.preserveKey),T=new Set;for(const t of D){const e=t.id||null,s=t.getAttribute("data-contour-preserve-key")||null;if(!e&&!s)continue;const r=M.find(t=>(t.id===e||t.preserveKey===s)&&!T.has(t.el));r&&(T.add(r.el),t.scrollTop=r.top,t.scrollLeft=r.left)}let F=0;const R=l.filter(t=>!t.id&&!t.preserveKey);for(const t of D){if(t.id)continue;const e=R[F];if(F+=1,!e)break;t.scrollTop=e.top,t.scrollLeft=e.left}for(const t of l)t.el&&t.el.isConnected&&d&&d.has(t.el)&&(t.el.scrollTop===t.top&&t.el.scrollLeft===t.left||(t.el.scrollTop=t.top,t.el.scrollLeft=t.left));if(e){let t=null;if(n)try{t=this.querySelector("#"+CSS.escape(n))}catch(e){t=null}if(!t&&o)try{t=this.querySelector('[data-contour-preserve-key="'+CSS.escape(o)+'"]')}catch(e){t=null}if(!t&&c)try{t=this.querySelector('[name="'+CSS.escape(c)+'"]')}catch(e){t=null}if(!t&&a>=0){const e=Array.from(this.querySelectorAll(r));e.length&&(t=e[Math.min(a,e.length-1)])}if(t&&"function"==typeof t.focus)try{t.focus()}catch(t){}else if(document.contains(e))try{e.focus()}catch(t){}else{const t=this.querySelector(r);if(t)try{t.focus()}catch(t){}else try{this.focus()}catch(t){}}}this._runEnhance(),this._detachInnerFormControls(),this._checkedAttrChanged=!1,this._contourResetting=!1}finally{this._contourRendering=!1}this._announceRendered()}}disconnectedCallback(){this._pendingRerender=!1,this._ensureCache=null,this._batchDepth=0,this._batchDirty=!1,this._wiredFormData=!1,this._remoteStatus=null,this._remoteSrc=null,(t=>{const e=r.get(t);if(e){r.delete(t);for(const s of e)try{s()}catch(e){if(a())try{console.warn("Contour disposer failed for",t&&t.tagName,e)}catch(t){}}}})(this);const t=this._contourHostListeners;if(t){for(const{type:e,listener:s,options:r}of t)try{this.removeEventListener(e,s,r)}catch(t){}this._contourHostListeners=null}}adoptedCallback(){this._contourAuthored&&this._applyDensity()}enhance(){}addEventListener(t,e,s){if(this._contourHostWiring&&e&&!e._contourBehaviour){let r=this._contourHostListeners;r||(r=[],this._contourHostListeners=r),r.push({type:t,listener:e,options:s})}return super.addEventListener(t,e,s)}_runEnhance(){this._contourHostWiring=!0;try{this.enhance()}finally{this._contourHostWiring=!1}}_syncFormValue(){if(!this._internals)return;const t=this.querySelector("input:checked, textarea, select")||this.querySelector("input, textarea, select");if(!t)return;const e="checkbox"===t.type||"radio"===t.type?t.checked?t.value||"on":null:t.value;this._internals.setFormValue(e),this._syncValidity(this.hasAttribute("required")&&!e)}_syncValidity(t){if(!this._internals)return;const e=t?{valueMissing:!0}:{};let s=t?"This field is required.":"";const r=this.querySelector("input, textarea, select"),i=r&&r.validity;i&&(i.valueMissing&&(e.valueMissing=!0,s=s||"This field is required."),i.typeMismatch&&(e.typeMismatch=!0,s=s||"Please enter a valid value."),i.patternMismatch&&(e.patternMismatch=!0,s=s||"Please match the requested format."),i.rangeUnderflow&&(e.rangeUnderflow=!0,s=s||"Value is too low."),i.rangeOverflow&&(e.rangeOverflow=!0,s=s||"Value is too high."),i.tooLong&&(e.tooLong=!0,s=s||"Value is too long."),i.tooShort&&(e.tooShort=!0,s=s||"Value is too short."),i.badInput&&(e.badInput=!0,s=s||"Invalid input.")),this._internals.setValidity(e,s),this._setCustomState("data-invalid",Object.keys(e).length>0)}_setCustomState(t,e){let s=this._internals;if(!s)if(this._stateInternals)s=this._stateInternals;else if("function"==typeof this.attachInternals)try{s=this._stateInternals=this.attachInternals()}catch(t){return}const r=s&&s.states;r&&(e?r.has(t)||r.add(t):r.has(t)&&r.delete(t))}_emitForm(t){if(!this._internals)return;const e=this.querySelector("input:checked, textarea, select")||this.querySelector("input, textarea, select");if(!e)return;const s="checkbox"===e.type||"radio"===e.type;this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:{name:this.getAttribute("name"),value:s?e.checked?e.value||"on":null:e.value,checked:s?e.checked:null}}))}formResetCallback(){for(const t of this.querySelectorAll("input, textarea, select"))if(t._contourUserDirty=!1,"checkbox"===t.type||"radio"===t.type)t.checked=this.hasAttribute("checked");else if("SELECT"===t.tagName){const e=t.querySelector("option[selected], option:first-of-type");t.value=e?e.value:""}else t.value=this.hasAttribute("value")?this.getAttribute("value"):t.getAttribute("value")||"";this._syncFormValue()}formDisabledCallback(t){for(const e of this.querySelectorAll("input, textarea, select, button"))t?e.setAttribute("disabled",""):e.removeAttribute("disabled")}formStateRestoreCallback(t){if(!this._internals||null==t)return;const e=Array.from(this.querySelectorAll("input, textarea, select")),s=String(t),r=e.find(t=>("checkbox"===t.type||"radio"===t.type)&&t.value===s);if(r){r.checked=!0;for(const t of e)t!==r&&"radio"===t.type&&t.name===r.name&&(t.checked=!1)}else e.length&&(e[0].value=s);this._syncFormValue()}checkValidity(){return!this._internals||this._internals.checkValidity()}reportValidity(){return!this._internals||this._internals.reportValidity()}_wireFormData(){if(!this._internals||this._wiredFormData)return;const t=this._internals.form;if(!t)return;this._wiredFormData=!0;const e=this.getAttribute("name"),s=t=>{const s=t.target;s&&"radio"===s.type&&s.name&&s.name===e&&this._syncFormValue()};t.addEventListener("change",s);const r=()=>this._syncFormValue();t.addEventListener("formdata",r),i(this,()=>{t.removeEventListener("change",s),t.removeEventListener("formdata",r)})}_wireValueTracking(){if(!this._internals||this._wiredValueTracking)return;this._wiredValueTracking=!0;const t=t=>{const e=t.target;e&&e.matches&&e.matches("input, textarea, select")&&(this._ownerBetween(e,this)||(e._contourUserDirty=!0,e._contourAttrAtDirty=this.getAttribute("value")))};this.addEventListener("input",t),this.addEventListener("change",t)}_restoreControlValue(t,e){if("file"!==t.type){if(e.dirty&&e.attrAtDirty===this.getAttribute("value")){if(e.selected&&"SELECT"===t.tagName&&t.multiple){const s=new Set(e.selected);for(const e of t.options)e.selected=s.has(e.value)}else t.value=e.value;return t._contourUserDirty=!0,void(t._contourAttrAtDirty=e.attrAtDirty)}""===t.value&&null===t.getAttribute("value")&&(t.value=e.value)}}_detachInnerFormControls(){if(this._internals)for(const t of this.querySelectorAll("input, textarea, select"))t.hasAttribute("name")&&""!==t.getAttribute("form")&&t.setAttribute("form","")}batch(t){if("function"==typeof t){this._batchDepth=(this._batchDepth||0)+1,this._batchDirty=this._batchDirty||!1;try{t()}finally{this._batchDepth-=1,0===this._batchDepth&&this._batchDirty&&(this._batchDirty=!1,this.isConnected&&this._contourAuthored&&this.attributeChangedCallback("__rerender__",null,""))}}}requestRender(){this._contourRerenderQueued||(this._contourRerenderQueued=!0,queueMicrotask(()=>{this._contourRerenderQueued=!1,this.isConnected&&this._contourAuthored&&this.attributeChangedCallback("__rerender__",null,"")}))}_applyDensity(){const t=this.getAttribute("density");null!==t?this.setAttribute("data-density",t):this.hasAttribute("data-density")&&this.removeAttribute("data-density")}_ownerBetween(t,e){for(let s=t.parentElement;s&&s!==e;s=s.parentElement)if(s instanceof T)return s;return null}keepNode(t){return t?(this._contourPersistent||(this._contourPersistent=new Set),this._contourPersistent.add(t),t):t}ensure(t,e,s){const r=s||this;r._ensureCache&&r._ensureCacheGen===this._contourRenderGen||(r._ensureCache=new Map,r._ensureCacheGen=this._contourRenderGen);const i=r._ensureCache,a=r===this?t:"\0"+r+"\0"+t;let n=i.get(a);if(void 0===n){n=null;for(const e of r.querySelectorAll(t))if(!this._ownerBetween(e,r)){n=e;break}i.set(a,n)}return n||(n=e(),r.appendChild(n),i.set(a,n)),n}}const F=t=>class extends T{render(){t.forEach(t=>this.classList.add(t));for(const e of Array.from(this.classList))t.some(t=>e.startsWith(t+"--"))&&this.classList.remove(e);l.forEach(e=>{if(this.hasAttribute(e)){const s=this.getAttribute(e);t.forEach(t=>{const e=t.replace("c-","");this.classList.add(`c-${e}--${s}`)})}})}};function R(){try{const t=document.createElement("div");return t.setAttribute("hidden","until-found"),"until-found"===t.getAttribute("hidden")}catch(t){return!1}}function B(t,e,s,r){if(!e)return t;const i=s||"undefined"!=typeof navigator&&navigator.language||"en";if("date"===e||"time"===e)try{const s="time"===e?{timeStyle:"short"}:void 0;return new Intl.DateTimeFormat(i,s).format(new Date(t))}catch(e){return t}if("relative"===e)try{const e=Number(t);let s=e;if(Number.isNaN(e)){const e=new Date(t).getTime();Number.isFinite(e)&&(s=(e-Date.now())/1e3)}const r=new Intl.RelativeTimeFormat(i,{numeric:"auto"});return Math.abs(s)<60?r.format(Math.round(s),"second"):Math.abs(s)<3600?r.format(Math.round(s/60),"minute"):Math.abs(s)<86400?r.format(Math.round(s/3600),"hour"):r.format(Math.round(s/86400),"day")}catch(e){return t}let a={};if("currency"===e)a={style:"currency",currency:"USD"};else if("percent"===e)a={style:"percent"};else if("compact"===e)a={notation:"compact"};else if("unit"===e)a={style:"unit",unit:r||"meter"};else if("number"!==e)try{a=JSON.parse(e)}catch(e){return t}try{return new Intl.NumberFormat(i,a).format(Number(t))}catch(e){return t}}function z(t,e,{wrap:s=!0,enter:r=!0,homeEnd:i=!1,onKey:a,onNavigate:n,rtl:o}={}){const c=e.indexOf(document.activeElement);if(c<0)return;let l=-1;const u=o?"ArrowLeft":"ArrowRight",d=o?"ArrowRight":"ArrowLeft";if(t.key===u||"ArrowDown"===t.key?l=s?(c+1)%e.length:Math.min(c+1,e.length-1):t.key===d||"ArrowUp"===t.key?l=s?(c-1+e.length)%e.length:Math.max(0,c-1):(i||s)&&"Home"===t.key?l=0:(i||s)&&"End"===t.key&&(l=e.length-1),l>=0&&l!==c){t.preventDefault();try{e[l].focus()}catch(t){}n&&n(l),a&&a(t.key,c,e[c])}else!r&&!s||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a&&a(t.key,c,e[c]))}function I(t){let e=t;for(;e&&1===e.nodeType;){const t=e.getAttribute&&e.getAttribute("dir");if(t)return"rtl"===t.toLowerCase();e=e.parentElement}try{return"undefined"!=typeof document&&"rtl"===(document.documentElement.getAttribute("dir")||"").toLowerCase()}catch(t){return!1}}const O=85.05112878;function P(t){const e=Number(t);return Number.isFinite(e)?Math.max(-85.05112878,Math.min(O,e)):NaN}function V(t){const e=Number(t);return Number.isFinite(e)?((e+180)%360+360)%360-180:NaN}function j(t){if(null==t)return!0;if("number"==typeof t)return!Number.isFinite(t);if("string"==typeof t){const e=t.trim();return""===e||"__missing"===e}return!1}function H(t,e,s,r,i,a){t=Number.isFinite(t)?t:0,e=Number.isFinite(e)?e:0,s=Number.isFinite(s)&&s>0?s:0,r=Number.isFinite(r)&&r>=0?r:0,i=Number.isFinite(i)?i:0;const n=(a=Number.isFinite(a)?a:0)-i>Math.PI?1:0,o=t+s*Math.cos(i),c=e+s*Math.sin(i),l=t+s*Math.cos(a),u=e+s*Math.sin(a);if(r<=0)return`M ${t} ${e} L ${o} ${c} A ${s} ${s} 0 ${n} 1 ${l} ${u} Z`;return`M ${o} ${c} A ${s} ${s} 0 ${n} 1 ${l} ${u} L ${t+r*Math.cos(a)} ${e+r*Math.sin(a)} A ${r} ${r} 0 ${n} 0 ${t+r*Math.cos(i)} ${e+r*Math.sin(i)} Z`}function $(t,e){const s=null!=(e=e||{}).cx?e.cx:100,r=null!=e.cy?e.cy:100,i=null!=e.r?e.r:90,a=null!=e.inner?e.inner:55,n=null!=e.gap?e.gap:.02,o=t.reduce((t,e)=>t+(Number(e)>0?Number(e):0),0)||1;let c=-Math.PI/2;const l=[];return t.forEach((t,e)=>{const u=Number(t)||0,d=u/o;if(!(u>0))return void(c+=d*Math.PI*2);const h=d*Math.PI*2-n,m=c+n/2,b=m+Math.max(0,h);l.push({path:H(s,r,i,a,m,b),value:u,index:e}),c+=d*Math.PI*2}),l}function J(t,e){const s=null!=(e=e||{}).width?e.width:300,r=null!=e.height?e.height:120,i=null!=e.gap?e.gap:2,a=t.map(j),n=t.map((t,e)=>a[e]?0:Number(t)||0);let o=Math.min(0,Math.min.apply(null,n.length?n:[0])),c=Math.max(0,Math.max.apply(null,n.length?n:[0]));null!=e.min&&(o=Math.min(o,Number(e.min)||0)),null!=e.max&&(c=Math.max(c,Number(e.max)||0)),Number.isFinite(o)&&Number.isFinite(c)||(o=0,c=1),c===o&&(c=o+1);const l=c-o,u=s/(t.length||1),d=Math.max(1,u-i),h=r-(0-o)/l*r;return n.map((t,e)=>{const s=r-(t-o)/l*r;return{x:e*u+i/2,y:Math.min(s,h),width:d,height:a[e]?0:Math.abs(h-s),zeroY:h,missing:a[e]}})}function W(t,e){const s=null!=(e=e||{}).width?e.width:300,r=null!=e.height?e.height:120,i=t.filter(t=>!j(t)).map(Number).filter(t=>Number.isFinite(t)),a=null!=e.max?e.max:i.length?Math.max.apply(null,i):1,n=null!=e.min?e.min:i.length?Math.min.apply(null,i):0,o=Number.isFinite(a-n)&&a-n!==0?a-n:1,c=t.length||1,l=t.map((t,e)=>{if(j(t))return null;const i=Number(t);if(!Number.isFinite(i))return null;return[e/Math.max(1,c-1)*s,r-(i-n)/o*r]});let u="",d=[];const h=()=>{if(d.length){u+=` M ${d[0][0]} ${d[0][1]}`;for(let t=1;t<d.length;t++){const e=d[t-1],s=d[t],r=(e[0]+s[0])/2;u+=` C ${r} ${e[1]}, ${r} ${s[1]}, ${s[0]} ${s[1]}`}d=[]}};return l.forEach(t=>{t?d.push(t):h()}),h(),u.trim()}function U(t,e,s,r,i){t=Number.isFinite(Number(t))?Number(t):0,e=Number.isFinite(Number(e))?Number(e):0,s=Number.isFinite(Number(s))?Number(s):0,r=null==r?0:Number.isFinite(Number(r))?Number(r):0,i=null==i?3:Number.isFinite(Number(i))?Number(i):3;const a=(r-90)*Math.PI/180,n=t+s*Math.cos(a),o=e+s*Math.sin(a),c=.25*s,l=t-c*Math.cos(a),u=e-c*Math.sin(a),d=Math.cos(a+Math.PI/2),h=Math.sin(a+Math.PI/2),m=t+i*d,b=e+i*h,p=t-i*d,g=e-i*h;return`M ${n.toFixed(2)} ${o.toFixed(2)} L ${m.toFixed(2)} ${b.toFixed(2)} L ${l.toFixed(2)} ${u.toFixed(2)} L ${p.toFixed(2)} ${g.toFixed(2)} Z`}"undefined"!=typeof window&&(window.ContourEvents=Object.freeze(d));const K=["circle","square","triangle","diamond","star"];function G(t,e,s,r){const i=t.length,a=i?t[0].length:0;if(i<2||a<2)return[];const n=s/(a-1),o=r/(i-1);return(e||[]).map(e=>{const s=function(t,e){const s=t.length,r=s?t[0].length:0,i=[];if(!s||!r)return i;const a=(t,s,r,i)=>i===r?.5:(e-r)/(i-r);for(let n=0;n<s-1;n++)for(let s=0;s<r-1;s++){const r=t[n][s],o=t[n][s+1],c=t[n+1][s],l=t[n+1][s+1],u=(r>=e?8:0)|(o>=e?4:0)|(l>=e?2:0)|(c>=e?1:0);if(0===u||15===u)continue;const d={x:s+a(0,0,r,o),y:n},h={x:s+1,y:n+a(0,0,o,l)},m={x:s+a(0,0,c,l),y:n+1},b={x:s,y:n+a(0,0,r,c)};let p;const g=(()=>{const t=r-o-c+l;return Math.abs(t)<1e-12?(r+o+c+l)/4:(r*l-o*c)/t})();switch(5===u?p=g>=e?"top-bottom":"left-right":10===u&&(p=g>=e?"left-right":"top-bottom"),u){case 1:case 14:i.push([b,m]);break;case 2:case 13:i.push([m,h]);break;case 3:case 12:i.push([b,h]);break;case 4:case 11:i.push([d,h]);break;case 6:case 9:i.push([d,m]);break;case 7:case 8:i.push([b,d]);break;case 5:"top-bottom"===p?i.push([d,m],[b,h]):i.push([d,h],[b,m]);break;case 10:"left-right"===p?i.push([b,h],[d,m]):i.push([d,h],[b,m])}}return i}(t,e);let r="";for(const[t,e]of s)r+=`M ${(t.x*n).toFixed(2)} ${(t.y*o).toFixed(2)} L ${(e.x*n).toFixed(2)} ${(e.y*o).toFixed(2)} `;return{level:e,d:r.trim()}})}const X=t=>Math.max(0,Math.min(1,Number(t)||0)),Y=t=>Math.max(1,Math.round((Number(t)||24)/16));function Q(t,{size:e=24,values:s=[],color:r="#1f77b4",strokeWidth:i,bgColor:a="transparent"}={}){const n=Number(e)||24,o=null!=i?Number(i):Y(n),c=Array.isArray(s)?s.filter(t=>Number.isFinite(t)):[],l=c.length;if(a&&"transparent"!==a?(t.fillStyle=a,t.fillRect(0,0,n,n)):t.clearRect(0,0,n,n),l<2)return;const u=o+1,d=n-2*u,h=n-2*u,m=Math.min(...c),b=Math.max(...c)-m||1;t.beginPath(),c.forEach((e,s)=>{const r=u+s/(l-1)*d,i=(t=>u+h-(t-m)/b*h)(e);0===s?t.moveTo(r,i):t.lineTo(r,i)}),t.lineWidth=o,t.strokeStyle=r,t.lineCap="round",t.lineJoin="round",t.stroke()}function Z(t,{size:e=32,hue:s=0,concentration:r=0,color:i,uncertainty:a=0,timeStep:n=0,timeSteps:o=4}={}){const c=Number(e)||32,l=Y(c),u=c/2,d=c/2,h=(c-2*l)/2,m=Math.max(0,Math.min(4,Math.floor(Number(s)||0))),b=i||((t,e)=>["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd"][Math.max(0,Math.min(4,Math.floor(Number(t)||0)))]||e)(m,"#1f77b4"),p=(g=r,_=8,Math.round(X(g)*_)/_);var g,_;if(t.clearRect(0,0,c,c),t.beginPath(),t.arc(u,d,h,0,2*Math.PI),t.lineWidth=l,t.strokeStyle="rgba(0,0,0,0.12)",t.stroke(),p>0&&(t.beginPath(),t.arc(u,d,h,-Math.PI/2,-Math.PI/2+2*p*Math.PI),t.lineWidth=l,t.strokeStyle=b,t.lineCap="round",t.stroke()),a>0){const e=h+l,s=1===a?[l,2*l]:[2*l,l];t.beginPath(),t.arc(u,d,e,0,2*Math.PI),t.lineWidth=l,t.strokeStyle=b,t.setLineDash(s),t.stroke(),t.setLineDash([])}if(o>0&&n>=0){const e=Math.max(0,Math.min(o-1,Math.floor(Number(n)||0))),s=-Math.PI/2+e/o*2*Math.PI,r=u+h*Math.cos(s),i=d+h*Math.sin(s);t.beginPath(),t.arc(r,i,.75*l,0,2*Math.PI),t.fillStyle=b,t.fill()}}const tt=new WeakMap,et=new WeakMap,st=(t,e,s,r,i)=>{let a=et.get(t);a||(a=[],et.set(t,a)),a.push({target:e,type:s,fn:r,options:i});try{r._contourBehaviour=!0}catch(t){}e.addEventListener(s,r,i)},rt=(t,e)=>{let s=tt.get(t);return s||(s=new Set,tt.set(t,s)),!s.has(e)&&(s.add(e),!0)},it=t=>t.shadowRoot?[t,t.shadowRoot]:[t],at=(t,e)=>{const s=[];for(const r of it(t))for(const t of r.querySelectorAll(e))s.includes(t)||s.push(t);return s},nt=(t,e)=>at(t,e)[0]||null,ot=(t,e)=>{const s="function"==typeof t.matches&&t.matches(e)?[t]:[];for(const r of at(t,e))s.includes(r)||s.push(r);return s},ct=t=>{const e=t&&t.getRootNode?t.getRootNode():null;return e&&e.host?e:null},lt=(t,e,s)=>{const r=Array.from(e.querySelectorAll(s));if(ct(e)&&ct(e).host===t)for(const e of t.querySelectorAll(s))r.includes(e)||r.push(e);return r},ut=new WeakMap,dt=(t,e,s)=>{const r=t=>{let e=ut.get(t);e||(e=new Set,ut.set(t,e)),e.has(r)||(e.add(r),s(t))};for(const s of it(t))st(t,s,e,r)},ht=(t,e)=>!!e&&it(t).some(t=>t.contains(e)),mt=(t,e,s)=>"function"==typeof e?.closest&&ht(t,e)?e.closest(s):null,bt=(t,e,s)=>{t.dispatchEvent(new CustomEvent(e,{detail:s,bubbles:!0,composed:!0}))};function pt(t){if(rt(t,"tabs"))for(const e of ot(t,".c-tabs__list, .c-code-tabs__list")){const s=e.classList.contains("c-code-tabs__list")?".c-code-tabs__panel":".c-tabs__panel",r=()=>lt(t,e,"[role='tab']"),i=(e,i)=>{const a=r();e.id||(e.id=o("c-tab")),a.forEach(s=>{const r=s===e;s.setAttribute("aria-selected",String(r)),s.tabIndex=r?0:-1;const i=s.getAttribute("aria-controls");if(!i)return;const a=nt(t,"#"+CSS.escape(i))||document.getElementById(i);a&&(a.hidden=!r,r&&a.setAttribute("aria-labelledby",s.id))});const n=at(t,s);if(n.length){const t=a.indexOf(e);n.forEach((e,s)=>{e.hidden=s!==t})}if(i)try{e.focus()}catch(t){}const c=e.textContent.trim()||e.getAttribute("aria-controls")||"";t.dispatchEvent(new CustomEvent("contour:tab-change",{bubbles:!0,composed:!0,detail:{index:a.indexOf(e),label:c}}))},a=(t,e)=>{if(!(e||"function"!=typeof document.startViewTransition||"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches))try{const s=document.startViewTransition(()=>i(t,e));return s&&s.ready&&s.ready.catch(()=>{}),void(s&&s.finished&&s.finished.catch(()=>{}))}catch(t){}i(t,e)};dt(t,"click",e=>{const s=mt(t,e.target,"[role='tab']");if(s&&r().includes(s)){const t=e.target&&e.target.closest?e.target.closest("button"):null;if(t&&t!==s&&s.contains(t))return;a(s,!1)}}),dt(t,"keydown",e=>{let s=mt(t,e.target,"[role='tab']");!s&&e.target&&e.target.getAttribute&&"tab"===e.target.getAttribute("role")&&ht(t,e.target)&&(s=e.target);const i=r(),n=i.indexOf(s);if(n<0)return;const o="vertical"===t.getAttribute("orientation"),c=I(t),l=o?c?{ArrowDown:n-1,ArrowUp:n+1,Home:i.length-1,End:0}:{ArrowDown:n+1,ArrowUp:n-1,Home:0,End:i.length-1}:c?{ArrowRight:n-1,ArrowLeft:n+1,Home:i.length-1,End:0}:{ArrowRight:n+1,ArrowLeft:n-1,Home:0,End:i.length-1};if(!(e.key in l))return;e.preventDefault();const u=i[(l[e.key]+i.length)%i.length];u&&a(u,!0)});const n=r(),c=t.getAttribute("persist");let l=null;if("storage"===c&&t.id)try{l=localStorage.getItem("contour-tabs:"+t.id)}catch(t){l=null}else if("url"===c)try{const t=new URLSearchParams(window.location.search).get("c-tabs");null!==t&&(l=t)}catch(t){l=null}let u=n.find(t=>"true"===t.getAttribute("aria-selected"))||n[0];if(null!==l){const t=parseInt(l,10);Number.isFinite(t)&&n[t]&&(u=n[t])}u&&i(u,!1),"storage"===c&&t.id?st(t,t,"contour:tab-change",e=>{try{localStorage.setItem("contour-tabs:"+t.id,String(e.detail&&e.detail.index))}catch(t){}}):"url"===c&&st(t,t,"contour:tab-change",t=>{try{const e=new URL(window.location.href);e.searchParams.set("c-tabs",String(t.detail&&t.detail.index)),window.history.replaceState(null,"",e.toString())}catch(t){}})}}function gt(t){const e=ot(t,".c-segmented"),s=()=>{const s=t.getAttribute("value"),r=s!==t._segAuthorValue?s:null;null!==r&&(t._segAuthorValue=s);let i=0;for(const s of e){s.hasAttribute("role")||s.setAttribute("role","group");const e=t.getAttribute("label");e&&!s.hasAttribute("aria-label")&&s.setAttribute("aria-label",e);const a=lt(t,s,"button");i+=a.length,a.forEach(t=>{t.classList.add("c-segmented__option"),t.setAttribute("aria-pressed",null!=r?String(t.dataset.value===r):"true"===t.getAttribute("aria-pressed")?"true":"false")});const n=a.find(t=>"true"===t.getAttribute("aria-pressed"))||a[0];a.forEach(t=>{t.tabIndex=t===n?0:-1})}return i};if(s()||t._segRetryScheduled||(t._segRetryScheduled=!0,setTimeout(()=>{t._segRetryScheduled=!1,s()},0)),!rt(t,"segmented"))return;const r=s=>{const r=e.find(e=>lt(t,e,"button").includes(s));r&&(lt(t,r,"button").forEach(t=>{const e=t===s;t.setAttribute("aria-pressed",String(e)),t.tabIndex=e?0:-1}),bt(t,"contour:change",{value:s.dataset.value||s.textContent.trim()}))};dt(t,"click",e=>{const s=mt(t,e.target,"button");s&&r(s)}),dt(t,"keydown",s=>{const i=mt(t,s.target,"button");if(!i)return;const a=e.find(e=>lt(t,e,"button").includes(i));if(!a)return;const n=lt(t,a,"button");z(s,n,{wrap:!1,homeEnd:!0,rtl:I(t),onNavigate:t=>r(n[t]),onKey:t=>{"Enter"!==t&&" "!==t||r(i)}})})}function _t(t){!function(){if(vt)return;vt=!0,document.addEventListener("click",t=>{for(const e of document.querySelectorAll("contour-combobox, contour-shadow-combobox")){const s=e.shadowRoot?e.shadowRoot.querySelector(".c-combobox__list"):e.querySelector(".c-combobox__list");e.shadowRoot?e.shadowRoot.querySelector(".c-combobox__input"):e.querySelector(".c-combobox__input");if(!s||s.hasAttribute("hidden"))continue;(e.shadowRoot||e).contains(t.target)||s.setAttribute("hidden","")}})}();const e=nt(t,".c-combobox__input"),s=nt(t,".c-combobox__list");if(!e||!s)return;const r=()=>at(t,".c-combobox__option");if(s.id||(s.id=o("c-combobox-list")),s.setAttribute("role","listbox"),e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","listbox"),e.setAttribute("aria-controls",s.id),e.setAttribute("aria-expanded",s.hasAttribute("hidden")?"false":"true"),e.hasAttribute("aria-autocomplete")||e.setAttribute("aria-autocomplete","list"),r().forEach((t,e)=>{t.id||(t.id=o("c-combobox-option")),t.setAttribute("role","option"),t.hasAttribute("aria-selected")||t.setAttribute("aria-selected","false")}),!rt(t,"combobox"))return;const i=()=>nt(t,".c-combobox__input"),a=()=>nt(t,".c-combobox__list");let n=-1;const c=e=>{const s=i(),r=t.hasAttribute("multiple");if(e.forEach((t,e)=>{const s=e===n;t.classList.toggle("c-combobox__option--active",s),r||t.setAttribute("aria-selected",String(s))}),s){const t=n>=0?e[n]:null;t?s.setAttribute("aria-activedescendant",t.id):s.removeAttribute("aria-activedescendant")}},l=e=>{const s=(e||"").toLowerCase();if(t._comboboxVirtual&&"function"==typeof t._renderComboboxWindow)return t._renderComboboxWindow(s,!0),void(n=-1);r().forEach(t=>{t.hidden=!(!s||t.textContent.toLowerCase().includes(s))}),n=-1;const i=a();if(!i)return;const o=r().length,c=r().filter(t=>!t.hidden).length,l=i.querySelector(".c-combobox__empty");if(o>0&&0===c){if(!l){const e=document.createElement("UL"===i.tagName||"OL"===i.tagName?"li":"div");e.className="c-combobox__empty",e.setAttribute("role","option"),e.setAttribute("aria-disabled","true"),e.setAttribute("aria-selected","false"),e.textContent=k(t,"no-matches","No matches"),i.appendChild(e)}}else l&&l.remove()},u=()=>{const t=a();if(!t)return;const e=i();if(e){const s=e.getBoundingClientRect();t.style.position="fixed",t.style.insetBlockStart=`${Math.round(s.bottom+4)}px`,t.style.insetInlineStart=`${Math.round(s.left)}px`,t.style.insetInlineEnd="auto",t.style.inlineSize=`${Math.round(s.width)}px`}t.removeAttribute("hidden"),e&&e.setAttribute("aria-expanded","true")},d=()=>{const e=a();e&&e.setAttribute("hidden","");const s=i();s&&(s.setAttribute("aria-expanded","false"),s.removeAttribute("aria-activedescendant")),n=-1;const o=t.hasAttribute("multiple");r().forEach(t=>{t.classList.remove("c-combobox__option--active"),o||t.setAttribute("aria-selected","false")})};t._comboboxVirtual&&s&&!s._contourVirtualScroll&&(s._contourVirtualScroll=!0,s.addEventListener("scroll",()=>{"function"==typeof t._renderComboboxWindow&&t._renderComboboxWindow(t._comboboxQuery||"")},{passive:!0}));const h=e=>{const s=i();if(!s)return;if(t.hasAttribute("multiple")){const r="true"===e.getAttribute("aria-selected");e.setAttribute("aria-selected",String(!r)),e.classList.toggle("c-combobox__option--selected",!r);const i=(t.getAttribute("value")||"").split(",").map(t=>t.trim()).filter(Boolean),a=t._comboboxVirtual&&t._comboboxFiltered?t._comboboxFiltered.find(t=>t.index===Number(e.dataset.optionIndex))?.value:null!=e.dataset.optionValue?e.dataset.optionValue:e.textContent.trim(),n=i.indexOf(String(a));return r&&n>=0&&i.splice(n,1),!r&&n<0&&i.push(String(a)),t.setAttribute("value",i.join(",")),"function"==typeof t._syncFormValue&&t._syncFormValue(),bt(t,"contour:select",{value:i}),void s.focus()}const r=null!=e.dataset.optionValue?e.dataset.optionValue:e.textContent.trim();s.value=e.textContent,t.setAttribute("value",r),"function"==typeof t._syncFormValue&&t._syncFormValue(),bt(t,"contour:select",{value:r}),d(),s.focus()},m=e=>null!==mt(t,e,".c-combobox__input");dt(t,"input",e=>{m(e.target)&&(t._comboboxQuery=e.target.value,l(e.target.value),u(),"function"==typeof t._emitForm&&t._emitForm("contour:input"))}),dt(t,"focusin",t=>{m(t.target)&&(l(t.target.value),u())}),dt(t,"keydown",t=>{if(!m(t.target))return;const e=r().filter(t=>!t.hidden);"ArrowDown"===t.key?(t.preventDefault(),n=Math.min(n+1,e.length-1),c(e)):"ArrowUp"===t.key?(t.preventDefault(),n=Math.max(n-1,0),c(e)):"Home"===t.key?(t.preventDefault(),n=0,c(e)):"End"===t.key?(t.preventDefault(),n=Math.max(0,e.length-1),c(e)):"Enter"===t.key||" "===t.key?(t.preventDefault(),n>=0&&e[n]&&h(e[n])):"Escape"===t.key&&d()}),dt(t,"click",e=>{const s=mt(t,e.target,".c-combobox__option");s?h(s):ht(t,e.target)&&t.contains(e.target)||d()})}let vt=!1;const yt=t=>at(t,".c-tree__toggle, .c-tree__leaf").filter(t=>!t.closest(".c-tree__children[hidden]"));function ft(t){const e=ot(t,"ul.c-tree")[0];e&&!e.hasAttribute("role")&&e.setAttribute("role","tree"),at(t,".c-tree__children").forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","group")});at(t,".c-tree__node").forEach(t=>{"treeitem"!==t.getAttribute("role")&&t.setAttribute("role","treeitem"),t.setAttribute("aria-level",String((t=>{let e=1;for(let s=t.parentElement;s;s=s.parentElement)s.classList&&s.classList.contains("c-tree__children")&&e++;return e})(t)));const e=t.querySelector(":scope > .c-tree__row");e?t.setAttribute("aria-expanded",e.querySelector(":scope > .c-tree__toggle")?.getAttribute("aria-expanded")||"false"):t.hasAttribute("aria-expanded")&&t.removeAttribute("aria-expanded")});const s=yt(t),r=s.find(t=>"0"===t.getAttribute("tabindex"))||s.find(t=>t===document.activeElement)||s[0];if(s.forEach(t=>t.setAttribute("tabindex",t===r?"0":"-1")),at(t,".c-tree__toggle, .c-tree__leaf").forEach(t=>{s.includes(t)||t.setAttribute("tabindex","-1")}),!rt(t,"tree"))return;t._selectedTree=t._selectedTree||new Set;let i=-1,a=!1,n=!1;dt(t,"pointerdown",t=>{a=Boolean(t.shiftKey),n=Boolean(t.ctrlKey||t.metaKey)}),dt(t,"keydown",t=>{a=Boolean(t.shiftKey),n=Boolean(t.ctrlKey||t.metaKey)}),dt(t,"change",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-tree__select"):null;if(!s||!t.contains(s))return;const r=Array.from(t.querySelectorAll(".c-tree__select")),o=r.indexOf(s),c=t=>{const e=(t=>t&&t.closest?t.closest(".c-tree__node"):null)(t);return e&&e.dataset?e.dataset.path:null},l=c(s),u=Boolean(e.shiftKey||a),d=Boolean(e.ctrlKey||e.metaKey||n);if(a=!1,n=!1,u&&i>=0){const e=Math.min(i,o),a=Math.max(i,o);for(let i=e;i<=a;i++){r[i].checked=s.checked;const e=c(r[i]);e&&(s.checked?t._selectedTree.add(e):t._selectedTree.delete(e))}}else d||s.checked&&r.forEach((e,s)=>{if(s!==o&&e.checked){e.checked=!1;const s=c(e);s&&t._selectedTree.delete(s)}}),l&&(s.checked?t._selectedTree.add(l):t._selectedTree.delete(l));i=o,bt(t,"contour:select",{paths:Array.from(t._selectedTree)})}),at(t,".c-tree__node, .c-tree__leaf").forEach(t=>{t.hasAttribute("draggable")||t.setAttribute("draggable","true")});let o=null;dt(t,"dragstart",e=>{const s=mt(t,e.target,".c-tree__node, .c-tree__leaf");if(s&&(o=(s.textContent||"").trim().slice(0,120),e.dataTransfer)){e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",o)}catch(t){}}}),dt(t,"dragover",e=>{mt(t,e.target,".c-tree__node, .c-tree__leaf")&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move"))}),dt(t,"drop",e=>{const s=mt(t,e.target,".c-tree__node, .c-tree__leaf");if(!s||!o)return;e.preventDefault();const r=(s.textContent||"").trim().slice(0,120);r&&r!==o&&bt(t,"contour:move",{from:o,to:r}),o=null});const c=t.getAttribute("persist");if("storage"===c&&t.id)try{const e=localStorage.getItem("contour-tree:"+t.id);if(null!==e){const s=JSON.parse(e);if(Array.isArray(s)){const e=new Set(s.map(t=>String(t)));at(t,".c-tree__row").forEach(t=>{const s=t.querySelector(":scope > .c-tree__toggle");if("true"===s?.getAttribute("aria-expanded"))return;const r=(t.textContent||"").trim().slice(0,120);if(!e.has(r))return;const i=t.querySelector(":scope > .c-tree__toggle");if(!i)return;const a=t.closest(".c-tree__node"),n=a?a.querySelector(":scope > .c-tree__children"):null;i.setAttribute("aria-expanded","true"),a&&a.setAttribute("aria-expanded","true"),n&&n.removeAttribute("hidden")})}}}catch(t){}else if("url"===c)try{const e=new URLSearchParams(window.location.search).get("c-tree");if(null!==e){const s=JSON.parse(e);if(Array.isArray(s)){const e=new Set(s.map(t=>String(t)));at(t,".c-tree__row").forEach(t=>{const s=t.querySelector(":scope > .c-tree__toggle");if("true"===s?.getAttribute("aria-expanded"))return;const r=(t.textContent||"").trim().slice(0,120);if(!e.has(r))return;const i=t.querySelector(":scope > .c-tree__toggle");if(!i)return;const a=t.closest(".c-tree__node"),n=a?a.querySelector(":scope > .c-tree__children"):null;i.setAttribute("aria-expanded","true"),a&&a.setAttribute("aria-expanded","true"),n&&n.removeAttribute("hidden")})}}}catch(t){}const l=e=>{const s="true"===e.getAttribute("aria-expanded");e.setAttribute("aria-expanded",String(!s));const r=e.closest(".c-tree__row")||e.parentElement,i=e.closest(".c-tree__node"),a=i?i.querySelector(":scope > .c-tree__children"):null;if(a&&(s?R()?a.setAttribute("hidden","until-found"):a.hidden=!0:a.removeAttribute("hidden")),i&&i.setAttribute("aria-expanded",String(!s)),bt(t,"contour:toggle",{open:!s,label:(r?r.textContent:"").trim().slice(0,120)}),"storage"===c&&t.id)try{const e=[];at(t,".c-tree__row").forEach(t=>{const s=t.querySelector(":scope > .c-tree__toggle");"true"===s?.getAttribute("aria-expanded")&&e.push((t.textContent||"").trim().slice(0,120))}),localStorage.setItem("contour-tree:"+t.id,JSON.stringify(e))}catch(t){}else if("url"===c)try{const e=[];at(t,".c-tree__row").forEach(t=>{const s=t.querySelector(":scope > .c-tree__toggle");"true"===s?.getAttribute("aria-expanded")&&e.push((t.textContent||"").trim().slice(0,120))});const s=new URL(window.location.href);s.searchParams.set("c-tree",JSON.stringify(e)),window.history.replaceState(null,"",s.toString())}catch(t){}},u=t=>t.classList&&t.classList.contains("c-tree__toggle")?t:null,d=e=>{at(t,".c-tree__toggle, .c-tree__leaf").forEach(t=>t.setAttribute("tabindex",t===e?"0":"-1"))},h=(e,s)=>{const r=e.closest(".c-tree__node"),i=r&&r.dataset?r.dataset.path:null;i&&t._expanded&&(s?t._expanded.add(i):t._expanded.delete(i));const a=t._treeRoot;if(a){t._treeScrollTop=a.scrollTop||0,t._renderWindow(a,t._treeScrollTop);try{a.scrollTop=t._treeScrollTop}catch(t){}const e=i?a.querySelector('.c-tree__node[data-path="'+i+'"] > .c-tree__row > .c-tree__toggle'):null;e&&(e.focus(),d(e))}t._persistExpanded&&t._persistExpanded()};dt(t,"click",e=>{if(t.hasAttribute("virtual"))return;let s=mt(t,e.target,".c-tree__toggle");if(!s){const r=mt(t,e.target,".c-tree__row");r&&(s=r.querySelector(":scope > .c-tree__toggle"))}s&&(e.preventDefault(),e.stopPropagation(),l(s))}),dt(t,"focusin",e=>{mt(t,e.target,".c-tree__toggle, .c-tree__leaf")&&d(e.target)}),dt(t,"keydown",e=>{const s=mt(t,e.target,".c-tree__toggle, .c-tree__leaf");if(!s)return;const r=yt(t),i=r.indexOf(s);if("Enter"===e.key||" "===e.key){const r=u(s);if(r)return e.preventDefault(),void(t.hasAttribute("virtual")?h(r,"true"!==r.getAttribute("aria-expanded")):l(r));if(t.hasAttribute("selectable")){const t=s.classList.contains("c-tree__leaf")?s:s.closest(".c-tree__leaf"),r=t?t.querySelector(".c-tree__select"):null;r&&(e.preventDefault(),r.click())}return}if("ArrowRight"===e.key){const a=u(s),n=a&&"false"===a.getAttribute("aria-expanded");if(e.preventDefault(),n)t.hasAttribute("virtual")?h(a,!0):(l(a),d(s));else{const t=r[i+1];t&&(t.focus(),d(t))}return}if("ArrowLeft"===e.key){const r=u(s);if(r&&"true"===r.getAttribute("aria-expanded"))e.preventDefault(),t.hasAttribute("virtual")?h(r,!1):(l(r),d(s));else{const t=s.closest(".c-tree__children"),r=t?t.closest(".c-tree__node"):null,i=r?r.querySelector(":scope > .c-tree__row > .c-tree__toggle"):null;i&&(e.preventDefault(),i.focus(),d(i))}return}z(e,r,{wrap:!1,homeEnd:!0,onNavigate:t=>d(r[t])})})}function At(t){const e="[role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio']";at(t,e).forEach(t=>{t.hasAttribute("tabindex")||t.setAttribute("tabindex",(t.getAttribute("aria-disabled"),"-1"))});const s=()=>at(t,e);if(!s().some(t=>"0"===t.getAttribute("tabindex"))&&s().length){const t=s().find(t=>"true"!==t.getAttribute("aria-disabled"));t&&t.setAttribute("tabindex","0")}if(!rt(t,"menu"))return;const r=t=>t.querySelector(":scope > ul.c-menu, :scope > .c-menu"),i=()=>{at(t,"[aria-haspopup='menu']").forEach(t=>t.setAttribute("aria-expanded","false"))};dt(t,"keydown",e=>{const a=s().filter(t=>"true"!==t.getAttribute("aria-disabled"));if(!a.length)return;const n=a.indexOf(e.target),o=n>=0?a[n]:null,c=o?r(o):null;if(o&&"menu"===o.getAttribute("aria-haspopup")&&("ArrowRight"===e.key||"Enter"===e.key||" "===e.key)&&c){e.preventDefault(),i(),o.setAttribute("aria-expanded","true");const t=c.querySelector("[role='menuitem']");if(t){t.setAttribute("tabindex","0");try{t.focus()}catch(t){}}return}if("ArrowLeft"===e.key||"Escape"===e.key){o&&o.closest("ul.c-menu");let s=null;if(o){o.parentElement&&"UL"===o.parentElement.tagName&&o.parentElement;let e=o.parentElement;for(;e&&e!==t;){if(e.getAttribute&&"menu"===e.getAttribute("aria-haspopup")&&e.contains(o)&&e!==o){s=e;break}e=e.parentElement}}if(s){e.preventDefault(),s.setAttribute("aria-expanded","false");try{s.focus()}catch(t){}return}"Escape"===e.key&&i()}if(z(e,a,{wrap:!0,homeEnd:!0,onKey:()=>{if("Enter"===e.key||" "===e.key){const e=a.indexOf(document.activeElement);if(e>=0&&(!o||"menu"!==o.getAttribute("aria-haspopup"))){const s=a[e].getAttribute("role");if("menuitemcheckbox"===s||"menuitemradio"===s){const r="true"===a[e].getAttribute("aria-checked");"menuitemradio"===s&&a.forEach(t=>{t!==a[e]&&"menuitemradio"===t.getAttribute("role")&&t.setAttribute("aria-checked","false")}),a[e].setAttribute("aria-checked",String(!r)),bt(t,"contour:select",{index:e,label:a[e].textContent.trim(),checked:!r})}else bt(t,"contour:select",{index:e,label:a[e].textContent.trim()});i()}}}}),1===e.key.length&&!e.ctrlKey&&!e.metaKey&&!e.altKey){const t=e.key.toLowerCase(),s=a.findIndex(e=>(e.textContent||"").trim().toLowerCase().startsWith(t));s>=0&&(e.preventDefault(),a[s].focus())}}),dt(t,"click",a=>{const n=mt(t,a.target,e);if(!n)return;if("true"===n.getAttribute("aria-disabled"))return;const o=n.getAttribute("role");if("menuitemcheckbox"===o||"menuitemradio"===o){const e="true"===n.getAttribute("aria-checked");return"menuitemradio"===o&&s().forEach(t=>{t!==n&&"menuitemradio"===t.getAttribute("role")&&t.setAttribute("aria-checked","false")}),n.setAttribute("aria-checked",String(!e)),void bt(t,"contour:select",{index:s().indexOf(n),label:n.textContent.trim(),checked:!e})}if("menu"===n.getAttribute("aria-haspopup")){if(r(n)){const t="true"===n.getAttribute("aria-expanded");return i(),void n.setAttribute("aria-expanded",t?"false":"true")}}const c=s().indexOf(n);if(c>=0&&(bt(t,"contour:select",{index:c,label:n.textContent.trim()}),i(),"function"==typeof t.hidePopover))try{t.hidePopover()}catch(a){}})}function Et(t){if(at(t,".c-pagination__link").forEach(t=>{t.hasAttribute("tabindex")||t.setAttribute("tabindex","0")}),!rt(t,"pagination"))return;const e=e=>{const s=parseInt(e.textContent,10);if(Number.isFinite(s))if(at(t,".c-pagination__link").forEach(t=>{parseInt(t.textContent,10)===s?t.setAttribute("aria-current","page"):t.removeAttribute("aria-current")}),t.setAttribute("page",String(s)),bt(t,"contour:page",{page:s}),"storage"===t.getAttribute("persist")&&t.id)try{localStorage.setItem("contour-pagination:"+t.id,String(s))}catch(t){}else if("url"===t.getAttribute("persist"))try{const t=new URL(window.location.href);t.searchParams.set("c-pagination",String(s)),window.history.replaceState(null,"",t.toString())}catch(t){}};dt(t,"click",s=>{const r=mt(t,s.target,".c-pagination__link");if(!r)return;s.preventDefault();const i=r.getAttribute("data-action");if("prev"===i||"next"===i){const s=at(t,".c-pagination__link").filter(t=>!t.getAttribute("data-action")),r=s.find(t=>"page"===t.getAttribute("aria-current")),a=r&&parseInt(r.textContent,10)||1,n="prev"===i?Math.max(1,a-1):Math.min(s.length,a+1),o=s.find(t=>parseInt(t.textContent,10)===n);if(o)return void e(o)}e(r)}),dt(t,"keydown",s=>{const r=mt(t,s.target,".c-pagination__link");if(!r)return;const i=at(t,".c-pagination__link"),a=i.indexOf(r);let n=-1;const o=I(t);if("ArrowRight"===s.key)n=o?Math.max(a-1,0):Math.min(a+1,i.length-1);else if("ArrowLeft"===s.key)n=o?Math.min(a+1,i.length-1):Math.max(a-1,0);else if("Home"===s.key)n=0;else if("End"===s.key)n=i.length-1;else if("Enter"===s.key||" "===s.key)return s.preventDefault(),void e(r);n>=0&&n!==a&&(s.preventDefault(),i[n].focus())})}function wt(t){rt(t,"copy")&&dt(t,"click",e=>{const s=mt(t,e.target,".c-code__copy, .c-install__copy");if(!s)return;const r=mt(t,s,".c-code")||mt(t,s,".c-install")||t,i=r.querySelector("code, .c-install__command"),a=(t=>{const e=t&&t.querySelectorAll?t.querySelectorAll(".c-code__line"):null;return e&&e.length?Array.from(e).map(t=>Array.from(t.childNodes).filter(t=>!(t.classList&&t.classList.contains("c-code__line-number"))).map(t=>t.textContent).join("")).join("\n"):t&&t.textContent||""})(i)||(i?"":r.textContent)||"";(async()=>{try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(a),!0}catch(t){}try{const t=document.createElement("textarea");t.value=a,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.append(t),t.select();const e=document.execCommand("copy");return t.remove(),e}catch(t){return!1}})().then(t=>(t=>{const e=s.querySelector("use"),r=e&&e.getAttribute("href"),i=s.getAttribute("aria-label")||s.title||"";t&&e&&e.setAttribute("href","#i-check"),s.setAttribute("aria-label",t?"Copied":"Copy failed"),s.dataset.copied=String(t);const a=setTimeout(()=>{s.isConnected&&(e&&r&&e.setAttribute("href",r),s.setAttribute("aria-label",i),delete s.dataset.copied,s._copyTimer=null)},1600);s._copyTimer&&clearTimeout(s._copyTimer),s._copyTimer=a})(t)),bt(t,"contour:copy",{text:a})})}function xt(t){rt(t,"removable")&&dt(t,"click",e=>{const s=t=>{t&&t.parentNode&&t.parentNode.removeChild(t)},r=mt(t,e.target,".c-tag__remove");if(r){e.preventDefault();const i=mt(t,r,".c-tag");return bt(t,"contour:remove",{label:i&&i.getAttribute("label")||(i?i.textContent.trim():"")}),void s(i)}const i=mt(t,e.target,".c-filter-pill__remove");if(i){e.preventDefault();const r=mt(t,i,".c-filter-pill");return bt(t,"contour:remove",{key:r&&r.getAttribute("key"),value:r&&r.getAttribute("value")}),void s(r)}mt(t,e.target,"[data-empty-action]")&&bt(t,"contour:empty-action",{state:t.getAttribute("state")||"empty"});const a=mt(t,e.target,".c-alert__close");if(a){if(e.preventDefault(),bt(t,"contour:close",{}),!t.shadowRoot||t.shadowRoot.contains(a))try{t.remove()}catch(t){}return}if(mt(t,e.target,".c-callout__close")){e.preventDefault(),bt(t,"contour:close",{});try{t.remove()}catch(t){}}else;})}const Ct={n:0};let St=null,kt=0,Nt=0;const Lt=new Set,qt=[];let Dt=!1;const Mt=new Map;function Tt(t){if("Tab"!==t.key)return;const e=qt[qt.length-1];if(!e)return;const s=function(t){return Array.from(t.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])")).filter(t=>!t.hasAttribute("disabled")&&"true"!==t.getAttribute("aria-hidden"))}(e);if(!s.length)return void t.preventDefault();const r=s[0],i=s[s.length-1],a=document.activeElement;t.shiftKey?a!==r&&e.contains(a)||(t.preventDefault(),i.focus()):a===i&&(t.preventDefault(),r.focus())}function Ft(t,e){if(e){0===Ct.n&&(kt=window.scrollX,Nt=window.scrollY,St=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden"),Ct.n+=1,qt.push(t),1!==Ct.n||Dt||(Dt=!0,document.addEventListener("keydown",Tt));const e=new Set;for(let s=t;s&&s!==document.body;s=s.parentElement)for(const t of s.parentElement.children)t===s||t.inert||(t.inert=!0,e.add(t));Mt.set(t,e)}else{const e=qt.lastIndexOf(t);e>=0&&qt.splice(e,1),Ct.n=Math.max(0,Ct.n-1);const s=Mt.get(t);if(s){for(const t of s)t.inert=!1,Lt.delete(t);Mt.delete(t)}if(0===Ct.n){for(const t of Lt)t.inert=!1;Lt.clear(),document.documentElement.style.overflow=St||"",window.scrollTo(kt,Nt),Dt&&(document.removeEventListener("keydown",Tt),Dt=!1)}}}const Rt={empty:"No data",chart:"No data",contour:"No field",dropdown:"No options",loading:"Loading…",error:"Could not load."};function Bt(t,e){const s=Rt[e]||e,r=t&&t.getAttribute?t.getAttribute("labels"):null;if(!r)return s;try{const t=JSON.parse(r);if(t&&"object"==typeof t&&"string"==typeof t[e]&&t[e])return t[e]}catch(t){}return s}const zt=new Map,It=new Map;function Ot(t,e){It.size>=64&&It.delete(It.keys().next().value),It.set(t,e)}function Pt(t,e){t._remoteStatus=e,"error"!==e&&(t._remoteError=null),"loading"===e?t.setAttribute("aria-busy","true"):t.removeAttribute("aria-busy"),"function"==typeof t._setCustomState&&t._setCustomState("data-loading","loading"===e)}function Vt(t,e,s){t.dispatchEvent(new CustomEvent(e,{detail:s,bubbles:!0,composed:!0}))}function jt(t){return Array.isArray(t)?t.length:t&&"object"==typeof t?Object.keys(t).length:null==t?0:1}function Ht(t){const e=t._remoteEntry;t._remoteEntry=null,e&&(e.hosts.delete(t),0===e.hosts.size&&e.controller&&e.controller.abort())}function $t(t,e){const s=t.getAttribute("src");if(!s)return Ht(t),void Pt(t,void 0!==t._remoteData?"ready":"idle");!function(t){const e=parseFloat(t.getAttribute("refresh")||""),s=t.hasAttribute("src")&&Number.isFinite(e)&&e>0;if(!s)return void 0!==t._remoteTimer&&(clearTimeout(t._remoteTimer),t._remoteTimer=void 0),void(t._remoteLoop=!1);if(t._remoteLoop)return;t._remoteLoop=!0;const r=()=>{if(t._remoteTimer=void 0,!t.isConnected||!t.hasAttribute("refresh"))return void(t._remoteLoop=!1);if(document.hidden)return void(t._remoteTimer=setTimeout(r,1e3));const e=t.getAttribute("src"),s=t.getAttribute("cache-key");s&&It.delete(s),It.delete(e),t._remoteSrc=null,t._remoteLoop=!1,t.requestRender()};t._remoteTimer=setTimeout(r,Math.max(1e3,1e3*e)),i(t,()=>{clearTimeout(t._remoteTimer),t._remoteTimer=void 0,t._remoteLoop=!1})}(t);if(("string"==typeof e?[e]:e).every(e=>null!==t.getAttribute(e)))return Ht(t),void Pt(t,"ready");if(!function(t){if(!t.hasAttribute("lazy"))return!0;if("function"!=typeof IntersectionObserver)return!0;if(t._remoteVisible)return!0;if(t._lazyRegistered)return!1;Wt||(Wt=new IntersectionObserver(t=>{for(const e of t){const t=Ut.get(e.target);t&&e.isIntersecting&&(Ut.delete(e.target),Wt.unobserve(e.target),t())}},{rootMargin:"200px"}));const e=()=>{t._remoteVisible=!0,t._lazyRegistered=!1,t.requestRender()};return t._lazyRegistered=!0,Ut.set(t,e),Wt.observe(t),i(t,()=>{Wt.unobserve(t),Ut.delete(t),t._lazyRegistered=!1}),!1}(t))return void Pt(t,"loading");const r=t.hasAttribute("no-cache"),a=t.getAttribute("cache-key")||s;if(r){if(t._remoteSrc===s&&void 0!==t._remoteData)return void Pt(t,"ready")}else{const e=It.get(a);if(void 0!==e)return t._remoteSrc=s,t._remoteData=e,void Pt(t,"ready");if(t._remoteSrc===s&&"ready"===t._remoteStatus&&void 0!==t._remoteData)return}if(t._remoteSrc===s&&("loading"===t._remoteStatus||"error"===t._remoteStatus))return;Ht(t),t._remoteSrc=s,Pt(t,"loading");let n=zt.get(s);n||(n={hosts:new Set,controller:new AbortController,cacheKey:a,cacheKeys:new Set},zt.set(s,n),n.promise=function(t,e,s){const r=parseInt(t.getAttribute("timeout")||"",10);let a=null,n=s.controller.signal;Number.isFinite(r)&&r>0&&("undefined"!=typeof AbortSignal&&AbortSignal.timeout?n=AbortSignal.any([n,AbortSignal.timeout(r)]):a=setTimeout(()=>s.controller.abort(),r));a&&(t._remoteDeadline=a,t._remoteDeadlineWired||(t._remoteDeadlineWired=!0,i(t,()=>{t._remoteDeadlineWired=!1,clearTimeout(t._remoteDeadline),t._remoteDeadline=null})));const o=()=>{a&&(clearTimeout(a),t._remoteDeadline===a&&(t._remoteDeadline=null))};return fetch(e,{signal:n}).then(t=>{if(o(),!t.ok){const e=new Error(`Could not load (${t.status})`);throw e.name="HttpError",e.status=t.status,e}return t.text()}).then(t=>{try{return JSON.parse(t)}catch(t){const e=new Error(Rt.error);throw e.name="ParseError",e.cause=t,e}})}(t,s,n).then(t=>{zt.get(s)===n&&zt.delete(s),Ot(s,t);for(const e of n.cacheKeys)e&&e!==s&&Ot(e,t);for(const e of n.hosts)e._remoteData=t,e._remoteEntry=null,Pt(e,"ready"),Vt(e,"contour:load",{src:s,count:jt(t)})},t=>{zt.get(s)===n&&zt.delete(s);for(const e of n.hosts)e._remoteEntry=null,Pt(e,"error"),e._remoteError=t&&"HttpError"===t.name?`Could not load (${t.status})`:Rt.error,Vt(e,"contour:error",{src:s,message:e._remoteError,name:t&&t.name,status:t&&t.status})}).finally(()=>{for(const t of n.hosts)t.isConnected&&t.requestRender();n.hosts.clear()})),n.hosts.add(t),!r&&a&&n.cacheKeys.add(a),t._remoteEntry=n,t._remoteDisposeRegistered||(t._remoteDisposeRegistered=!0,i(t,()=>{t._remoteDisposeRegistered=!1,Ht(t)}))}function Jt(t,e){const s=t.getAttribute(e);if(null!==s)return s;const r=t._remoteData;if(null==r)return null;if(Array.isArray(r))return JSON.stringify(r);if("object"==typeof r){const t="string"==typeof e?[e]:e;for(const e of t)if(void 0!==r[e])return"string"==typeof r[e]?r[e]:JSON.stringify(r[e]);return null}return String(r)}let Wt=null;const Ut=new Map;function Kt(t,e,s){const r=document.createElement("div");return r.className="c-"+t+"__"+e,r.dataset.contourState=e,r.textContent=s,r}function Gt(t,e){const s=document.createElement("div");return s.className="c-skeleton "+(0===t&&e>1?"c-skeleton--title":"c-skeleton--text"),s.dataset.contourState="skeleton",s}function Xt(t,e,s){const r=s||{},i=t.getAttribute("loading");if(null!==i||"loading"===t._remoteStatus)return t.appendChild(Kt(e,"loading",i||Bt(t,"loading"))),!0;const a=t.getAttribute("error");if(null!==a||"error"===t._remoteStatus){const s=Kt(e,"error",null!==a&&""!==a?a:t._remoteError||Bt(t,"error"));if(t.hasAttribute("retry")){const e=document.createElement("button");e.type="button",e.className="c-btn c-btn--ghost c-btn--sm",L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-refresh" /></svg>'),e.appendChild(document.createTextNode(" "+(t.getAttribute("retry")||"Retry"))),e.dataset.action="retry",s.appendChild(e)}return t.appendChild(s),!0}if(t.hasAttribute("skeleton")){const e=parseInt(t.getAttribute("skeleton")||"3",10),s=Math.min(r.max||6,Math.max(1,Number.isFinite(e)?e:3));for(let e=0;e<s;e++)t.appendChild(Gt(e,s));return!0}return!1}function Yt(t,e){t.appendChild(Kt(e,"empty",t.getAttribute("empty")||Bt(t,"empty")))}function Qt(t,e,s){const r=t.getAttribute(e);if(!r)return[];try{const i=JSON.parse(r);return Array.isArray(i)?i:(s&&s(t,e,new Error("not an array")),[])}catch(r){return s&&s(t,e,r),[]}}function Zt(t){t._contourStatesWired||(t._contourStatesWired=!0,t.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest('[data-action="retry"]'):null;if(!s||!t.contains(s))return;e.preventDefault();const r=t.getAttribute("src"),i=t.getAttribute("cache-key");i&&It.delete(i),r&&It.delete(r),Ht(t),t._remoteSrc=null,t._remoteData=void 0,Pt(t,"idle"),Vt(t,"contour:retry",{src:r}),t.requestRender()}))}c("contour-card",class extends T{static get observed(){return["title","variant","heading"]}static get properties(){return{title:{attribute:"title"},variant:{attribute:"variant"}}}render(){this.classList.add("c-card");const t=this.getAttribute("variant");Array.from(this.classList).forEach(t=>{t.startsWith("c-card--")&&this.classList.remove(t)}),t&&this.classList.add("c-card--"+t);const e=this.getAttribute("title");if(e){const t=this.ensure(".c-card__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-card__title",t});t.parentNode===this&&this.firstChild!==t&&this.prepend(t),t.textContent=e}else{const t=this.querySelector(".c-card__title");t&&t.remove()}}});c("contour-feature",class extends T{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 t=this.getAttribute("index"),e=this.getAttribute("title"),s=this.getAttribute("body");if(t){this.ensure(".c-feature__index",()=>{const t=document.createElement("span");return t.className="c-feature__index",t}).textContent=t}else{const t=this.querySelector(".c-feature__index");t&&t.remove()}if(e){this.ensure(".c-feature__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-feature__title",t}).textContent=e}else{const t=this.querySelector(".c-feature__title");t&&t.remove()}if(s){this.ensure(".c-feature__body",()=>{const t=document.createElement("p");return t.className="c-feature__body",t}).textContent=s}else{const t=this.querySelector(".c-feature__body");t&&t.remove()}}});c("contour-steps",class extends T{static get observed(){return["steps","current","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","heading","cache-key","no-cache"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current",type:Number},src:{attribute:"src"}}}render(){this.classList.add("c-steps");let t=this.querySelector(".c-steps__list");if(t||(t=document.createElement("ol"),t.className="c-steps__list",t.setAttribute("aria-label",this.getAttribute("aria-label")||"Steps"),this.appendChild(t)),Zt(this),$t(this,"steps"),Xt(this,"steps"))return;const e=Jt(this,"steps"),s=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-steps__item"));if(s.forEach(e=>{e.parentNode!==t&&t.appendChild(e)}),e&&!s.length){Array.from(t.querySelectorAll(".c-steps__item")).forEach(t=>t.remove());try{JSON.parse(e).forEach((e,s)=>{const r=document.createElement("li");r.className="c-steps__item",r.tabIndex=-1;const i="string"==typeof e?e:e.title,a="string"==typeof e?"":e.body;if(i){const t=document.createElement(E(this,"h3"));t.className="c-steps__title",t.textContent=i,r.appendChild(t)}if(a){const t=document.createElement("p");t.className="c-steps__body",t.textContent=a,r.appendChild(t)}t.appendChild(r)})}catch(t){f(this,"attribute",t)}}else e||s.length||Yt(this,"steps");const r=this.getAttribute("current"),i=null!=this._current?this._current:null!=r?parseInt(r,10):NaN,a=Array.from(this.querySelectorAll(".c-steps__item"));a.forEach((t,e)=>{Number.isFinite(i)&&e===i?t.setAttribute("aria-current","step"):t.removeAttribute("aria-current"),t.tabIndex=Number.isFinite(i)&&e===i?0:-1}),a.length&&!Number.isFinite(i)&&(a[0].tabIndex=0)}enhance(){this._wiredSteps||(this._wiredSteps=!0,this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-steps__item"));e.length&&z(t,e,{wrap:!1,homeEnd:!0,rtl:I(this),onNavigate:t=>{this._current=t,e.forEach((e,s)=>{s===t?e.setAttribute("aria-current","step"):e.removeAttribute("aria-current"),e.tabIndex=s===t?0:-1});const s=e[t].querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:!0,composed:!0,detail:{index:t,title:s}}))},onKey:()=>{if("Enter"===t.key||" "===t.key){const t=e.indexOf(document.activeElement),s=document.activeElement.querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-activate",{bubbles:!0,composed:!0,detail:{index:t,title:s}}))}}})}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-steps__item"):null;if(!e||!this.contains(e))return;const s=Array.from(this.querySelectorAll(".c-steps__item")),r=s.indexOf(e);if(r<0)return;this._current=r,s.forEach((t,e)=>{e===r?t.setAttribute("aria-current","step"):t.removeAttribute("aria-current"),t.tabIndex=e===r?0:-1});const i=e.querySelector(".c-steps__title")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:step-activate",{bubbles:!0,composed:!0,detail:{index:r,title:i}}))}))}});c("contour-link",class extends T{static get observed(){return["href","label"]}static get properties(){return{href:{attribute:"href"},label:{attribute:"label"}}}render(){this.classList.add("c-link");const t=this.getAttribute("href"),e=this.getAttribute("label");if(Array.from(this.querySelectorAll("a[data-contour-generated]")).forEach(t=>t.remove()),t&&e){const s=document.createElement("a");s.dataset.contourGenerated="",s.href=v(t),s.textContent=e;const r=this.getAttribute("aria-label");r&&s.setAttribute("aria-label",r),this.appendChild(s)}}});c("contour-brand",class extends T{static get observed(){return["name","tag"]}static get properties(){return{name:{attribute:"name"},tag:{attribute:"tag"}}}render(){this.classList.add("c-brand");const t=this.getAttribute("name"),e=this.getAttribute("tag");if(t){this.ensure(".c-brand__name",()=>{const t=document.createElement("span");return t.className="c-brand__name",t}).textContent=t}else{const t=this.querySelector(".c-brand__name");t&&t.remove()}if(e){this.ensure(".c-brand__tag",()=>{const t=document.createElement("span");return t.className="c-brand__tag",t}).textContent=e}else{const t=this.querySelector(".c-brand__tag");t&&t.remove()}}});c("contour-section-head",class extends T{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 t=this.getAttribute("title"),e=this.getAttribute("desc");if(!this.querySelector(".c-icon-badge")){const t=document.createElement("div");t.className="c-icon-badge";const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true");const s=document.createElementNS("http://www.w3.org/2000/svg","use");s.setAttribute("href","#i-crosshair"),e.appendChild(s),t.replaceChildren(e),this.prepend(t)}let s=this.querySelector(":scope > div:not(.c-icon-badge)");if(s||(s=document.createElement("div"),this.appendChild(s)),t){const e=this.ensure(".c-section-head__title",()=>{const t=document.createElement(E(this,"h2"));return t.className="c-section-head__title",t});e.textContent=t,e.parentNode!==s&&s.appendChild(e)}else{const t=this.querySelector(".c-section-head__title");t&&t.remove()}if(e){const t=this.ensure(".c-section-head__desc",()=>{const t=document.createElement("p");return t.className="c-section-head__desc",t});t.textContent=e,t.parentNode!==s&&s.appendChild(t)}else{const t=this.querySelector(".c-section-head__desc");t&&t.remove()}}});c("contour-diff",class extends T{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",k(this,"diff","Diff")),Array.from(this.querySelectorAll(".c-diff__line")).forEach(t=>t.remove());const t=(t,e,s,r)=>{const i=document.createElement("div");i.className=t?`c-diff__line c-diff__line--${t}`:"c-diff__line",i.setAttribute("role","listitem"),i.setAttribute("tabindex","0");const a=document.createElement("span");a.className="c-diff__sign",a.textContent=e;const n=document.createElement("span");n.className="c-diff__num",n.setAttribute("aria-hidden","true"),n.textContent=String(r||"");const o=document.createElement("span");return o.textContent=s,i.append(a,n,o),i},e=this.getAttribute("before"),s=this.getAttribute("after");let r=1;e&&String(e).split("\n").forEach(e=>{this.appendChild(t("del","−",e,r++))}),s&&String(s).split("\n").forEach(e=>{this.appendChild(t("add","+",e,r++))})}enhance(){this._wiredDiff||(this._wiredDiff=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-diff__line"):null;if(e&&this.contains(e)){const t=e.classList.contains("c-diff__line--add")?"add":e.classList.contains("c-diff__line--del")?"del":"context",s=e.querySelector("span:last-child")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:diff-activate",{bubbles:!0,composed:!0,detail:{kind:t,text:s}}))}}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-diff__line"):null;e&&this.contains(e)&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click()))}))}});c("contour-do-dont",class extends T{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",k(this,"do-and-dont","Do and don't")),Array.from(this.querySelectorAll(".c-do-dont__item")).forEach(t=>t.remove());const t=(t,e,s)=>{const r=document.createElement("div");r.className=`c-do-dont__item c-do-dont__item--${t}`,r.setAttribute("role","button"),r.setAttribute("tabindex","0");const i=document.createElement("p");i.className="c-do-dont__label",i.textContent=e;const a=document.createElement("p");return a.className="u-muted",a.textContent=s,r.append(i,a),r},e=this.getAttribute("do"),s=this.getAttribute("dont");e&&this.appendChild(t("do","Do",e)),s&&this.appendChild(t("dont","Don't",s))}enhance(){this._wiredDoDont||(this._wiredDoDont=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-do-dont__item"):null;if(e&&this.contains(e)){const t=e.classList.contains("c-do-dont__item--do")?"do":"dont",s=e.querySelector(".u-muted")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:do-dont-activate",{bubbles:!0,composed:!0,detail:{kind:t,text:s}}))}}),Array.from(this.querySelectorAll(".c-do-dont__item")).forEach(t=>{t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.hasAttribute("role")||t.setAttribute("role","button")}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-do-dont__item"):null;e&&this.contains(e)&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click()))}))}});c("contour-flag",class extends T{static get observed(){return["variant","label"]}static get properties(){return{variant:{attribute:"variant"},label:{attribute:"label"}}}render(){this.classList.add("c-flag");const t=this.getAttribute("variant");Array.from(this.classList).forEach(t=>{t.startsWith("c-flag--")&&this.classList.remove(t)}),t&&this.classList.add("c-flag--"+t);const e=this.getAttribute("label");if(e){let t=Array.from(this.childNodes).find(t=>3===t.nodeType);t||(t=document.createTextNode(""),this.appendChild(t)),t.nodeValue=e}}});c("contour-install",class extends T{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 t=this.getAttribute("prompt")||"$",e=this.getAttribute("command")||"";if(e){this.ensure(".c-install__prompt",()=>{const t=document.createElement("span");return t.className="c-install__prompt",t}).textContent=t;if(this.ensure(".c-install__command",()=>{const t=document.createElement("span");return t.className="c-install__command",t}).textContent=e,this.hasAttribute("copyable"))this.ensure(".c-install__copy",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--ghost c-btn--sm c-install__copy",t.type="button",t.setAttribute("aria-label",k(this,"copy-command","Copy command")),t.textContent=k(this,"copy","Copy"),t});else{const t=this.querySelector(".c-install__copy");t&&t.remove()}}}enhance(){wt(this)}});c("contour-testimonial",class extends T{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 t=this.getAttribute("quote");if(t){this.ensure(".c-testimonial__quote",()=>{const t=document.createElement("blockquote");return t.className="c-testimonial__quote",t}).textContent=t}else{const t=this.querySelector(".c-testimonial__quote");t&&t.remove()}const e=this.getAttribute("name"),s=this.getAttribute("role");if(e){const t=this.ensure(".c-testimonial__byline",()=>{const t=document.createElement("figcaption");return t.className="c-testimonial__byline",t}),r=t.querySelector(".c-testimonial__name")||(()=>{const e=document.createElement("cite");return e.className="c-testimonial__name",t.appendChild(e),e})();if(r.className="c-testimonial__name",r.textContent=e,s){const e=t.querySelector(".c-testimonial__role")||(()=>{const e=document.createElement("span");return e.className="c-testimonial__role",t.appendChild(e),e})();e.className="c-testimonial__role",e.textContent=s}else{const e=t.querySelector(".c-testimonial__role");e&&e.remove()}}else{const t=this.querySelector(".c-testimonial__byline");t&&t.remove()}}});c("contour-showcase",class extends T{static get observed(){return["title","text","media","reverse","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","heading","cache-key","no-cache"]}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"),this.setAttribute("role","list"),this.hasAttribute("reverse")?this.classList.add("c-showcase--reverse"):this.classList.remove("c-showcase--reverse");const t=this.getAttribute("title");if(t?this.setAttribute("aria-label",t):this.removeAttribute("aria-label"),this.setAttribute("role","region"),Zt(this),$t(this,"items"),Xt(this,"showcase"))return;const e=Jt(this,"items"),s=this.getAttribute("text"),r=this.getAttribute("media");if(r){const e=this.ensure(".c-showcase__media",()=>{const t=document.createElement("figure");return t.className="c-showcase__media",t});if(/^https?:\/\/|^\/|^\.\/|\.(png|jpg|jpeg|svg|webp|gif|avif)$/i.test(r.trim())){let s=e.querySelector("img");s||(s=document.createElement("img"),e.appendChild(s)),s.src=r.trim(),s.alt=t||""}else L(e,g(r));if(t){let s=e.querySelector(".c-showcase__caption");s||(s=document.createElement("figcaption"),s.className="c-showcase__caption",e.appendChild(s)),s.textContent=t}}else{const t=this.querySelector(".c-showcase__media");t&&t.remove()}if(t){this.ensure(".c-showcase__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-showcase__title",t}).textContent=t}else{const t=this.querySelector(".c-showcase__title");t&&t.remove()}if(s){this.ensure(".c-showcase__text",()=>{const t=document.createElement("p");return t.className="c-showcase__text",t}).textContent=s}else{const t=this.querySelector(".c-showcase__text");t&&t.remove()}const i=this.querySelector(".c-showcase__list"),a=i?Array.from(i.children).filter(t=>"LI"===t.tagName):[];if(e&&!a.length)try{const t=JSON.parse(e),s=this.ensure(".c-showcase__list",()=>{const t=document.createElement("ul");return t.className="c-showcase__list",t});s.replaceChildren(),t.forEach(t=>{const e=document.createElement("li");e.textContent="string"==typeof t?t:t.label||t.title||"",s.appendChild(e)})}catch(t){f(this,"attribute",t)}else e||a.length||t||s||r?!e&&i&&i.remove():Yt(this,"showcase")}enhance(){this._wiredShowcase||(this._wiredShowcase=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-showcase__media"):null;if(e&&this.contains(e)){const t=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:showcase-activate",{bubbles:!0,composed:!0,detail:{title:t}}))}}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest("button, a, input, select, textarea, [role='button'], [role='link'], [role='checkbox'], [role='menuitem'], [role='option'], [role='tab']"):null;if(!(e&&this.contains(e)||"Enter"!==t.key&&" "!==t.key)){if(this.querySelector(".c-showcase__media")){t.preventDefault();const e=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:showcase-activate",{bubbles:!0,composed:!0,detail:{title:e}}))}}}))}});c("contour-pricing",class extends T{static get observed(){return[]}render(){this.classList.add("c-pricing")}});c("contour-recipe",class extends T{static get observed(){return["title","body","canvas","heading","url","tags","head","index"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},canvas:{attribute:"canvas"},url:{attribute:"url"},tags:{attribute:"tags"},head:{attribute:"head"},index:{attribute:"index"}}}render(){this.classList.add("c-recipe");const t=this.getAttribute("url");let e=this.querySelector(".c-recipe__frame");if(t){if(!e){e=document.createElement("div"),e.className="c-recipe__frame";const t=document.createElement("div");t.className="c-recipe__frame-bar";for(let e=0;e<3;e++){const e=document.createElement("span");e.className="c-recipe__frame-dot",t.appendChild(e)}const s=document.createElement("span");s.className="c-recipe__frame-url",t.appendChild(s),e.appendChild(t),this.prepend(e)}const s=e.querySelector(".c-recipe__frame-url");s&&(s.textContent=t)}else e&&e.remove();const s=this.getAttribute("head");if(s){this.ensure(".c-recipe__head",()=>{const t=document.createElement("div");return t.className="c-recipe__head",t}).textContent=s}else{const t=this.querySelector(".c-recipe__head");t&&t.remove()}const r=this.getAttribute("title");if(r){this.ensure(".c-recipe__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-recipe__title",t}).textContent=r}else{const t=this.querySelector(".c-recipe__title");t&&t.remove()}const i=this.getAttribute("index");if(i){this.ensure(".c-recipe__index",()=>{const t=document.createElement("span");return t.className="c-recipe__index",t}).textContent=i}else{const t=this.querySelector(".c-recipe__index");t&&t.remove()}const a=this.getAttribute("body");if(a){this.ensure(".c-recipe__desc",()=>{const t=document.createElement("p");return t.className="c-recipe__desc",t}).textContent=a}else{const t=this.querySelector(".c-recipe__desc");t&&t.remove()}const n=this.getAttribute("tags");if(n){const t=this.ensure(".c-recipe__tags",()=>{const t=document.createElement("div");return t.className="c-recipe__tags",t});t.innerHTML="",n.split(",").map(t=>t.trim()).filter(Boolean).forEach(e=>{const s=document.createElement("span");s.textContent=e,t.appendChild(s)})}else{const t=this.querySelector(".c-recipe__tags");t&&t.remove()}const o=this.getAttribute("canvas");if(o){const t=this.ensure(".c-recipe__canvas",()=>{const t=document.createElement("div");return t.className="c-recipe__canvas",t});if(/^https?:\/\/|^\/|^\.\/|\.(png|jpg|jpeg|svg|webp|gif|avif)$/i.test(o.trim())){let e=t.querySelector("img");e||(e=document.createElement("img"),t.appendChild(e)),e.src=o.trim(),e.alt=""}else L(t,g(o))}else{const t=this.querySelector(".c-recipe__canvas");t&&t.remove()}}});c("contour-logos",class extends T{static get observed(){return[]}render(){this.classList.add("c-logos")}});c("contour-landing-features",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-landing-features"),Zt(this),$t(this,"items"),Xt(this,"landing-features"))return;const t=Jt(this,"items"),e=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-landing-features__item"));if(t&&!e.length)try{const e=JSON.parse(t);this.querySelectorAll(".c-landing-features__item").forEach(t=>t.remove()),e.forEach(t=>{const e=document.createElement("div");if(e.className="c-landing-features__item",t.icon){const s=document.createElement("span");s.className="c-landing-features__icon";const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("aria-hidden","true");const i=document.createElementNS("http://www.w3.org/2000/svg","use");i.setAttribute("href","#"+String(t.icon).replace(/[^a-zA-Z0-9_-]/g,"")),r.appendChild(i),s.appendChild(r),e.appendChild(s)}if(t.title){const s=document.createElement("span");s.className="c-landing-features__title",s.textContent=t.title,e.appendChild(s)}if(t.text){const s=document.createElement("p");s.className="c-landing-features__text",s.textContent=t.text,e.appendChild(s)}this.appendChild(e)})}catch(t){f(this,"attribute",t)}else t||e.length||(this.querySelectorAll(".c-landing-features__item").forEach(t=>t.remove()),Yt(this,"landing-features"))}});c("contour-landing-hero",class extends T{static get observed(){return["actions","title","text","heading","preview"]}static get properties(){return{actions:{attribute:"actions"},title:{attribute:"title"},text:{attribute:"text"},preview:{attribute:"preview"}}}render(){this.classList.add("c-landing-hero");const t=this.getAttribute("preview");let e=this.querySelector(".c-landing-hero__preview");if(t){if(!e){e=document.createElement("div"),e.className="c-landing-hero__preview";const t=document.createElement("div");t.className="c-landing-hero__preview-bar";for(let e=0;e<3;e++){const e=document.createElement("span");e.className="c-landing-hero__preview-dot",t.appendChild(e)}const s=document.createElement("div");s.className="c-landing-hero__preview-body",e.appendChild(t),e.appendChild(s),this.appendChild(e)}const s=e.querySelector(".c-landing-hero__preview-body");if(s)if(/^https?:\/\/|^\/|^\.\/|\.(png|jpg|jpeg|svg|webp|gif|avif)$/i.test(t.trim())){s.innerHTML="";const e=document.createElement("img");e.src=t.trim(),e.alt="",s.appendChild(e)}else L(s,g(t))}else e&&e.remove();const s=this.getAttribute("title");if(s){this.ensure(".c-landing-hero__title",()=>{const t=document.createElement(E(this,"h2"));return t.className="c-landing-hero__title",t}).textContent=s}const r=this.getAttribute("text");if(r){this.ensure(".c-landing-hero__text",()=>{const t=document.createElement("p");return t.className="c-landing-hero__text",t}).textContent=r}const i=this.getAttribute("actions"),a=this.querySelector(".c-landing-hero__actions"),n=a?Array.from(a.children):[];if(i&&!n.length){const t=this.ensure(".c-landing-hero__actions",()=>{const t=document.createElement("div");return t.className="c-landing-hero__actions",t});try{const e=JSON.parse(i);Array.isArray(e)?(t.replaceChildren(),e.forEach(e=>{const s=document.createElement(e.href?"a":"button");s.className="c-btn"+(e.primary?" c-btn--primary":""),e.href?s.href=v(e.href):s.type="button",s.textContent=e.label||e.text||"",t.appendChild(s)})):L(t,g(i))}catch(e){L(t,g(i))}}else i||!a||n.length||a.remove()}});c("contour-linkish",class extends T{static get observed(){return[]}render(){this.classList.add("c-linkish")}});c("contour-price",class extends T{static get observed(){return["value","format","locale"]}static get properties(){return{value:{attribute:"value"},format:{attribute:"format"},locale:{attribute:"locale"}}}render(){this.classList.add("c-price");const t=this.getAttribute("value");let e=this.querySelector(".c-price__amount");t?(e||(e=document.createElement("span"),e.className="c-price__amount",this.appendChild(e)),e.textContent=B(t,this.getAttribute("format"),this.getAttribute("locale"))):e&&e.remove()}});c("contour-prose",class extends T{static get observed(){return[]}render(){this.classList.add("c-prose")}});c("contour-panel",class extends T{static get observed(){return["title","subtitle","status","heading","collapsible","collapsed","flush"]}static get properties(){return{title:{attribute:"title"},subtitle:{attribute:"subtitle"},status:{attribute:"status"},collapsible:{attribute:"collapsible",type:Boolean},collapsed:{attribute:"collapsed",type:Boolean},flush:{attribute:"flush",type:Boolean}}}render(){this.classList.add("c-panel"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Panel");const t=this.getAttribute("title"),e=this.getAttribute("subtitle"),s=this.getAttribute("status");if(t){const e=this.ensure(".c-panel__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-panel__title",t});e.parentNode===this&&this.firstChild!==e&&this.prepend(e),e.textContent=t}else{const t=this.querySelector(".c-panel__title");t&&t.remove()}if(e){this.ensure(".c-panel__subtitle",()=>{const t=document.createElement("p");return t.className="c-panel__subtitle",t}).textContent=e}else{const t=this.querySelector(".c-panel__subtitle");t&&t.remove()}if(s){const t=this.ensure(".c-panel__status",()=>{const t=document.createElement("span");return t.className="c-panel__status",t});Array.from(t.classList).forEach(e=>{e.startsWith("c-panel__status--")&&t.classList.remove(e)}),"error"!==s&&"live"!==s||t.classList.add("c-panel__status--"+s),t.textContent=s}else{const t=this.querySelector(".c-panel__status");t&&t.remove()}if(this.hasAttribute("collapsible")){let t=this.querySelector(".c-panel__collapse");t||(t=document.createElement("button"),t.type="button",t.className="c-panel__collapse c-btn c-btn--ghost c-btn--sm",t.setAttribute("aria-label",k(this,"collapse","Toggle panel")),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24" width="16" height="16"><use href="#i-chevron-down" /></svg>'),this.appendChild(t)),this.hasAttribute("collapsed")?(this.classList.add("c-panel--collapsed"),t.setAttribute("aria-expanded","false"),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24" width="16" height="16"><use href="#i-chevron-right" /></svg>')):(this.classList.remove("c-panel--collapsed"),t.setAttribute("aria-expanded","true"),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24" width="16" height="16"><use href="#i-chevron-down" /></svg>'))}else{const t=this.querySelector(".c-panel__collapse");t&&t.remove(),this.classList.remove("c-panel--collapsed")}const r=this.ensure(".c-panel__body",()=>{const t=document.createElement("div");return t.className="c-panel__body",t});r.classList.toggle("c-panel__body--flush",this.hasAttribute("flush"));const i=this.querySelector(".c-panel__head"),a=this.querySelector(".c-panel__collapse");Array.from(this.childNodes).forEach(t=>{t!==r&&t!==i&&(1===t.nodeType&&(t.classList.contains("c-panel__title")||t.classList.contains("c-panel__subtitle")||t.classList.contains("c-panel__status"))||t!==a&&r.appendChild(t))}),r.parentNode||this.appendChild(r),i&&i.parentNode===this&&r.parentNode===this&&i.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_PRECEDING&&this.insertBefore(r,i.nextSibling)}enhance(){this._wiredPanel||(this._wiredPanel=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-panel__collapse"):null;e&&this.contains(e)&&(t.preventDefault(),this.toggleAttribute("collapsed"),this.dispatchEvent(new CustomEvent("contour:collapse",{bubbles:!0,composed:!0,detail:{collapsed:this.hasAttribute("collapsed")}})))}))}});c("contour-cta",class extends T{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 t=this.getAttribute("title"),e=this.getAttribute("text");if(t){this.ensure(".c-cta__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-cta__title",t}).textContent=t}else{const t=this.querySelector(".c-cta__title");t&&t.remove()}if(e){this.ensure(".c-cta__text",()=>{const t=document.createElement("p");return t.className="c-cta__text",t}).textContent=e}else{const t=this.querySelector(".c-cta__text");t&&t.remove()}const s=this.getAttribute("actions"),r=this.querySelector(".c-cta__actions");if(r&&r.remove(),s)try{const t=JSON.parse(s),e=document.createElement("div");e.className="c-cta__actions";let r=!1;t.forEach(t=>{const s="string"==typeof t?t:t.label||t,i="object"==typeof t&&t?t.href:null,a=!("object"!=typeof t||!t)&&t.primary&&!r;a&&(r=!0);const n=document.createElement(i?"a":"button");n.className=a?"c-btn c-btn--primary":"c-btn c-btn--ghost",i?(n.href=v(i),n.setAttribute("role","button")):n.type="button",n.textContent=s,e.appendChild(n)}),this.appendChild(e)}catch(t){f(this,"attribute",t)}}});c("contour-code",class extends T{static get observed(){return["title","copyable","numbered"]}static get properties(){return{title:{attribute:"title"},copyable:{attribute:"copyable",type:Boolean},numbered:{attribute:"numbered",type:Boolean}}}render(){this.classList.add("c-code");const t=this.getAttribute("title");if(t){const e=this.ensure(".c-code__head",()=>{const t=document.createElement("div");return t.className="c-code__head",t});e.parentNode===this&&this.firstChild!==e&&this.prepend(e);(e.querySelector(".c-code__title")||(()=>{const t=document.createElement("div");return t.className="c-code__title",e.appendChild(t),t})()).textContent=t}else{const t=this.querySelector(".c-code__head");t&&t.remove();const e=this.querySelector(".c-code__title");e&&e.remove()}if(this.hasAttribute("copyable")){const t=this.ensure(".c-code__head",()=>{const t=document.createElement("div");return t.className="c-code__head",t});this.ensure(".c-code__copy",()=>{const e=document.createElement("button");return e.className="c-btn c-btn--ghost c-btn--sm c-code__copy",e.type="button",L(e,'<svg aria-hidden="true" viewBox="0 0 24 24" width="14" height="14"><use href="#i-copy" /></svg>'),e.setAttribute("aria-label",k(this,"copy","Copy")),t.appendChild(e),e})}else{const t=this.querySelector(".c-code__copy");t&&t.remove()}const e=this.ensure("pre",()=>document.createElement("pre"));if(Array.from(this.childNodes).forEach(t=>{t===e||1===t.nodeType&&(t.classList.contains("c-code__head")||t.classList.contains("c-code__copy"))||e.appendChild(t)}),!e.querySelector("code")){const t=document.createElement("code");for(;e.firstChild;)t.appendChild(e.firstChild);e.appendChild(t)}e.parentNode!==this&&this.appendChild(e);const s=this.querySelector(".c-code__head");s&&s.parentNode===this&&e.parentNode===this&&s.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING&&this.insertBefore(e,s.nextSibling);const r=this.hasAttribute("numbered");this.classList.toggle("c-code--numbered",r);const i=e.querySelector("code");if(i){const t="1"===i.dataset.contourLines;r&&!t?((t=>{const e=[[]];let s=e[0];const r=(t,i)=>{if(3===t.nodeType)return void String(t.textContent||"").split("\n").forEach((t,r)=>{r&&(s=[],e.push(s)),t&&s.push({chain:i,text:t})});if(1!==t.nodeType)return;const a=i.concat(t);Array.from(t.childNodes).forEach(t=>r(t,a))};if(Array.from(t.childNodes).forEach(t=>r(t,[])),!e[e.length-1].length&&e.length>1&&e.pop(),!e.length)return;const i=document.createDocumentFragment();e.forEach((t,e)=>{const s=document.createElement("span");s.className="c-code__line",s.setAttribute("data-contour-generated","line");const r=[];for(const e of t){for(let t=0;t<e.chain.length;t++)if(!r[t]||r[t]._contourSrc!==e.chain[t]){const i=e.chain[t].cloneNode(!1);i._contourSrc=e.chain[t],0===t?s.appendChild(i):r[t-1].appendChild(i),r[t]=i,r.length=t+1}(e.chain.length?r[e.chain.length-1]:s).appendChild(document.createTextNode(e.text))}const a=document.createElement("span");a.className="c-code__line-number",a.setAttribute("aria-hidden","true"),a.textContent=String(e+1),s.prepend(a),i.appendChild(s)}),t.textContent="",t.appendChild(i)})(i),i.dataset.contourLines="1"):!r&&t&&((t=>{const e=document.createDocumentFragment();Array.from(t.querySelectorAll(".c-code__line")).forEach(t=>{Array.from(t.childNodes).forEach(t=>{t.classList&&t.classList.contains("c-code__line-number")||e.appendChild(t)}),e.appendChild(document.createTextNode("\n"))}),t.textContent="",t.appendChild(e)})(i),delete i.dataset.contourLines)}}enhance(){wt(this)}});c("contour-plate",class extends T{static get observed(){return[]}render(){this.classList.add("c-plate")}});c("contour-pullquote",class extends T{static get observed(){return["quote","name"]}static get properties(){return{quote:{attribute:"quote"},name:{attribute:"name"}}}render(){this.classList.add("c-pullquote");const t=this.getAttribute("quote");if(t){Array.from(this.childNodes).forEach(t=>{3===t.nodeType&&t.remove()});const e=this.querySelector("cite");this.insertBefore(document.createTextNode(t),e)}const e=this.getAttribute("name");if(e){this.ensure("cite",()=>{const t=document.createElement("cite");return this.appendChild(t),t}).textContent=e}else{const t=this.querySelector("cite");t&&t.remove()}}});c("contour-anchor",class extends T{static get observed(){return["href","label"]}static get properties(){return{href:{attribute:"href"},label:{attribute:"label"}}}render(){this.classList.add("c-anchor");const t=this.getAttribute("href"),e=this.getAttribute("label");if(Array.from(this.querySelectorAll("a[data-contour-generated]")).forEach(t=>t.remove()),t&&e){const s=document.createElement("a");s.dataset.contourGenerated="",s.href=v(t),s.textContent=e;const r=this.getAttribute("aria-label");r&&s.setAttribute("aria-label",r),this.appendChild(s)}}});c("contour-geocoder",class extends T{static get observed(){return["placeholder","value","results","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{placeholder:{attribute:"placeholder"},value:{attribute:"value"},results:{attribute:"results"},src:{attribute:"src"}}}render(){if(this.classList.add("c-geocoder"),Zt(this),$t(this,["results"]),Xt(this,"geocoder"))return;let t=this.querySelector(".c-geocoder__input");t||(t=document.createElement("input"),t.type="search",t.className="c-input c-geocoder__input",t.hasAttribute("aria-label")||t.setAttribute("aria-label",this.getAttribute("placeholder")||"Search location"),t.setAttribute("role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded","false"),this.appendChild(t));const e=this.getAttribute("placeholder");e&&t.setAttribute("placeholder",e);const s=this.getAttribute("value");null!==s&&t.value!==s&&(t.value=s),Array.from(this.querySelectorAll(".c-geocoder__result")).forEach(t=>t.remove()),Array.from(this.querySelectorAll(".c-geocoder__list")).forEach(t=>t.remove());let r=[];const i=this.getAttribute("results");if(i)try{r=JSON.parse(i)}catch(t){r=[]}const a=Jt(this,"results");if("string"==typeof a)try{const t=JSON.parse(a);Array.isArray(t)&&(r=t)}catch(t){}else Array.isArray(a)&&(r=a);if(Array.isArray(r)&&r.length){this._geocoderIndex=-1,this._geocoderListId||(this._geocoderListId=o("geocoder-list"));const e=document.createElement("ul");e.className="c-geocoder__list",e.id=this._geocoderListId,e.setAttribute("role","listbox"),r.forEach((t,s)=>{const r=document.createElement("li");r.className="c-geocoder__result",r.id=this._geocoderListId+"-"+s,r.setAttribute("role","option"),r.setAttribute("aria-selected","false"),r.setAttribute("tabindex","-1"),r.textContent="object"==typeof t?t.label||t.name||"":String(t),"object"==typeof t&&(null!=t.lat&&(r.dataset.lat=String(t.lat)),null!=t.lon&&(r.dataset.lon=String(t.lon))),e.appendChild(r)}),this.appendChild(e),t.setAttribute("aria-controls",this._geocoderListId),t.setAttribute("aria-expanded","true")}else if(t.removeAttribute("aria-controls"),t.setAttribute("aria-expanded","false"),t.removeAttribute("aria-activedescendant"),this._geocoderIndex=-1,!this.hasAttribute("loading")&&!this.hasAttribute("error")){const t=this.querySelector(".c-geocoder__input");t&&t.value&&Yt(this,"geocoder")}}enhance(){if(this._wiredGeocoder)return;this._wiredGeocoder=!0;const t=this.querySelector(".c-geocoder__input");"number"!=typeof this._geocoderIndex&&(this._geocoderIndex=-1);const e=()=>Array.from(this.querySelectorAll(".c-geocoder__result")),s=()=>{const t=e(),s=this._geocoderIndex;return s>=0&&s<t.length?t[s]:null},r=s=>{const r=e();if(!r.length)return;const i=Math.max(0,Math.min(r.length-1,Number.isFinite(s)?s:0));r.forEach((t,e)=>t.setAttribute("aria-selected",e===i?"true":"false")),this._geocoderIndex=i,t&&(i>=0?t.setAttribute("aria-activedescendant",r[i].id):t.removeAttribute("aria-activedescendant"))},i=()=>{this._geocoderIndex=-1,e().forEach(t=>t.setAttribute("aria-selected","false")),t&&t.removeAttribute("aria-activedescendant")},a=t=>{if(!t)return;const e={label:t.textContent.trim(),lat:t.dataset.lat?Number(t.dataset.lat):void 0,lon:t.dataset.lon?Number(t.dataset.lon):void 0};this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{result:e}}))};t&&(this.addEventListener("input",e=>{e.target===t&&(i(),this._geocoderTimer&&clearTimeout(this._geocoderTimer),this._geocoderTimer=setTimeout(()=>{this._geocoderTimer=null,this.isConnected&&this.dispatchEvent(new CustomEvent("contour:search",{bubbles:!0,composed:!0,detail:{query:t.value}}))},200))}),this.addEventListener("keydown",n=>{if(n.target!==t)return;const o=e();if("ArrowDown"===n.key||"ArrowUp"===n.key){if(!o.length)return;n.preventDefault();const t=this._geocoderIndex<0?"ArrowDown"===n.key?-1:o.length:this._geocoderIndex;return void r(t+("ArrowDown"===n.key?1:-1))}if("Enter"===n.key){n.preventDefault();const e=s();return void(e?(a(e),t.setAttribute("aria-expanded","false"),t.removeAttribute("aria-controls"),i()):this.dispatchEvent(new CustomEvent("contour:search",{bubbles:!0,composed:!0,detail:{query:t.value}})))}if("Escape"===n.key&&o.length&&"true"===t.getAttribute("aria-expanded")){n.preventDefault(),i(),t.setAttribute("aria-expanded","false"),t.removeAttribute("aria-controls");const e=this.querySelector(".c-geocoder__list");e&&e.remove()}})),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-geocoder__result"):null;e&&this.contains(e)&&a(e)}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-geocoder__result"):null;e&&this.contains(e)&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a(e)))})}disconnectedCallback(){this._geocoderTimer&&(clearTimeout(this._geocoderTimer),this._geocoderTimer=null),super.disconnectedCallback()}});c("contour-dash-shell",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-dash-shell"),this.setAttribute("role","region");const t=this.getAttribute("title");if(t){const e=this.ensure(".c-dash-toolbar",()=>{const t=document.createElement("div");return t.className="c-dash-toolbar",t});e.parentNode===this&&this.firstChild!==e&&this.prepend(e);(e.querySelector(".c-dash-toolbar__title")||(()=>{const t=document.createElement("span");return t.className="c-dash-toolbar__title",e.appendChild(t),t})()).textContent=t,this.setAttribute("aria-label",t)}}});c("contour-dash-toolbar",class extends T{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 t=this.getAttribute("title");if(t){this.ensure(".c-dash-toolbar__title",()=>{const t=document.createElement("span");return t.className="c-dash-toolbar__title",t}).textContent=t,this.setAttribute("aria-label",t)}else{const t=this.querySelector(".c-dash-toolbar__title");t&&t.remove()}const e=this.getAttribute("actions");if(e)try{const t=JSON.parse(e),s=this.ensure(".c-dash-toolbar__actions",()=>{const t=document.createElement("div");return t.className="c-dash-toolbar__actions",t});s.innerHTML="",t.forEach(t=>{const e=document.createElement("button");e.className="c-btn c-btn--ghost c-btn--sm",e.type="button",e.textContent="string"==typeof t?t:t.label||t,s.appendChild(e)})}catch(t){f(this,"attribute",t)}else{const t=this.querySelector(".c-dash-toolbar__actions");t&&t.remove()}}enhance(){this._wiredDashToolbar||(this._wiredDashToolbar=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-btn"):null;if(e&&this.contains(e)){const t=e.textContent||"";this.dispatchEvent(new CustomEvent("contour:dash-action",{bubbles:!0,composed:!0,detail:{label:t}}))}}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-btn"):null;if(!e||!this.contains(e))return;const s=Array.from(this.querySelectorAll(".c-btn")),r=s.indexOf(e);let i=-1;if("ArrowRight"===t.key?i=Math.min(s.length-1,r+1):"ArrowLeft"===t.key&&(i=Math.max(0,r-1)),i>=0){t.preventDefault();try{s[i].focus()}catch(t){}}else"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())}))}});c("contour-dash-kpi-row",class extends T{static get observed(){return["items","title"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-dash-kpi-row"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"KPI row"),Array.from(this.querySelectorAll("contour-kpi[data-contour-generated]")).forEach(t=>t.remove());const t=this.getAttribute("items");let e=null;if(t)try{e=JSON.parse(t)}catch(t){e=null}if(Array.isArray(e)&&e.length){const t=["value","label","delta","direction","note","unit","format","variant","thresholds","threshold","sparkline","polarity","locale"];e.forEach((e,s)=>{const r=document.createElement("contour-kpi");if("object"==typeof e&&null!==e)for(const s of t){const t=e[s];null!=t&&r.setAttribute(s,"string"==typeof t?t:JSON.stringify(t))}else r.setAttribute("value",String(e));r.setAttribute("tabindex",0===s?"0":"-1"),r.dataset.contourGenerated="",this.appendChild(r)})}}enhance(){this._wiredDashKpiRow||(this._wiredDashKpiRow=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("contour-kpi"):null;if(e&&this.contains(e)){const t=Array.from(this.querySelectorAll("contour-kpi")).indexOf(e);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:t}}))}}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll("contour-kpi"));e.length&&z(t,e,{wrap:!0,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:t}}))},onKey:(t,e)=>{"Enter"!==t&&" "!==t||this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:e}}))}})}))}});c("contour-dash-freshness",class extends T{static get observed(){return["label","value","format","locale"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},format:{attribute:"format"},locale:{attribute:"locale"}}}render(){this.classList.add("c-dash-freshness"),this.setAttribute("role","status"),this.setAttribute("aria-live","polite");const t=this.getAttribute("label"),e=this.getAttribute("value"),s=this.ensure(".c-dot",()=>{const t=document.createElement("span");return t.className="c-dot c-dot--live c-dot--accent",t.setAttribute("aria-hidden","true"),t});s.parentNode!==this&&this.appendChild(s),this._freshnessText&&this._freshnessText.parentNode||(this._freshnessText=document.createTextNode(""),this.appendChild(this._freshnessText));const r=e?B(e,this.getAttribute("format"),this.getAttribute("locale")):e;this._freshnessText.nodeValue=[t,r].filter(Boolean).join(" ")}});c("contour-saved-view",class extends T{static get observed(){return["name","updated","source","active"]}static get properties(){return{name:{attribute:"name"},updated:{attribute:"updated"},source:{attribute:"source"},active:{attribute:"active",type:Boolean}}}render(){this.classList.add("c-saved-view"),this.setAttribute("role","region"),this.getAttribute("name")&&this.setAttribute("aria-label",this.getAttribute("name")),this.hasAttribute("active")?this.classList.add("c-saved-view--active"):this.classList.remove("c-saved-view--active");const t=this.ensure(".c-saved-view__thumb",()=>{const t=document.createElement("div");return t.className="c-saved-view__thumb",t});t.setAttribute("role","img"),t.setAttribute("aria-label",`${k(this,"preview","Preview")} — ${this.getAttribute("name")||k(this,"unnamed","Saved view")}`),t.parentNode!==this&&this.appendChild(t);this.ensure(".c-saved-view__name",()=>{const t=document.createElement("div");return t.className="c-saved-view__name",t}).textContent=this.getAttribute("name")||"Saved view";let e=this.querySelector(".c-saved-view__meta");e||(e=document.createElement("div"),e.className="c-saved-view__meta",this.appendChild(e));const s=this.getAttribute("updated"),r=this.getAttribute("source");if(e.replaceChildren(),s){const t=document.createElement("span");t.textContent=`Updated ${s}`,e.appendChild(t)}if(r){e.childNodes.length&&e.appendChild(document.createTextNode(" · "));const t=document.createElement("span");t.textContent=`${k(this,"source","Source")}: ${r}`,e.appendChild(t)}let i=this.querySelector(".c-saved-view__actions");i||(i=document.createElement("div"),i.className="c-saved-view__actions",this.appendChild(i));q(i.querySelector(".c-saved-view__apply")||(()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--ghost c-btn--sm",t.setAttribute("data-saved-view-apply",""),i.appendChild(t),t})(),this,"apply","Apply");q(i.querySelector(".c-saved-view__remove")||(()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--ghost c-btn--sm",t.setAttribute("data-saved-view-remove",""),i.appendChild(t),t})(),this,"remove","Remove")}enhance(){this._wiredSavedView||(this._wiredSavedView=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("button"):null;e&&this.contains(e)&&(e.hasAttribute("data-saved-view-apply")?this.dispatchEvent(new CustomEvent("contour:apply",{bubbles:!0,composed:!0,detail:{name:this.getAttribute("name")}})):e.hasAttribute("data-saved-view-remove")&&this.dispatchEvent(new CustomEvent("contour:remove",{bubbles:!0,composed:!0,detail:{name:this.getAttribute("name")}})))}))}});c("contour-provenance",class extends T{static get observed(){return["source","confidence","resolution","coverage","warning","methodology"]}static get properties(){return{source:{attribute:"source"},confidence:{attribute:"confidence"},resolution:{attribute:"resolution"},coverage:{attribute:"coverage"},warning:{attribute:"warning"},methodology:{attribute:"methodology"}}}render(){this.classList.add("c-provenance"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"provenance","Data provenance")),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite");const t=this.getAttribute("source");if(t){const e=this.ensure(".c-provenance__source",()=>{const t=document.createElement("span");return t.className="c-provenance__source",t}),s=document.createElement("b");s.textContent=k(this,"source","Source")+":",e.replaceChildren(s,document.createTextNode(" "+t))}else{const t=this.querySelector(".c-provenance__source");t&&t.remove()}const e=this.getAttribute("confidence");if(e){const t=this.ensure(".c-provenance__confidence",()=>{const t=document.createElement("span");return t.className="c-provenance__confidence",t}),s=String(e).toLowerCase(),r="high"===s||"medium"===s||"low"===s;t.className="c-provenance__confidence"+(r?" c-provenance__confidence--"+s:" c-provenance__confidence--unknown"),t.textContent=`Confidence: ${e}`}else{const t=this.querySelector(".c-provenance__confidence");t&&t.remove()}const s=this.getAttribute("resolution");if(s){this.ensure(".c-provenance__resolution",()=>{const t=document.createElement("span");return t.className="c-provenance__resolution",t}).textContent=`Resolution: ${s}`}else{const t=this.querySelector(".c-provenance__resolution");t&&t.remove()}const r=this.getAttribute("coverage");if(r){this.ensure(".c-provenance__coverage",()=>{const t=document.createElement("span");return t.className="c-provenance__coverage",t}).textContent=`Coverage: ${r}`}else{const t=this.querySelector(".c-provenance__coverage");t&&t.remove()}const i=this.getAttribute("methodology");if(i){this.ensure(".c-provenance__methodology",()=>{const t=document.createElement("span");return t.className="c-provenance__methodology",t}).textContent=`Methodology: ${i}`}else{const t=this.querySelector(".c-provenance__methodology");t&&t.remove()}const a=this.getAttribute("warning");if(a){this.ensure(".c-provenance__warning",()=>{const t=document.createElement("span");return t.className="c-provenance__warning",t}).textContent=`Warning: ${a}`}else{const t=this.querySelector(".c-provenance__warning");t&&t.remove()}}});c("contour-feature-inspector",class extends T{static get observed(){return["title","open","data","actions"]}static get properties(){return{title:{attribute:"title"},open:{attribute:"open",type:Boolean},data:{attribute:"data"}}}render(){this.classList.add("c-feature-inspector"),this.hasAttribute("role")||this.setAttribute("role","region"),this.getAttribute("title")&&this.setAttribute("aria-label",this.getAttribute("title"));const t=this.getAttribute("open");null!==t&&"false"!==t?this.setAttribute("open",""):this.removeAttribute("open");this.ensure(".c-feature-inspector__head",()=>{const t=document.createElement("div");return t.className="c-feature-inspector__head",t});this.ensure(".c-feature-inspector__title",()=>{const t=document.createElement("span");return t.className="c-feature-inspector__title",t}).textContent=k(this,"title",this.getAttribute("title")||"Feature inspector");const e=this.ensure(".c-feature-inspector__body",()=>{const t=document.createElement("div");return t.className="c-feature-inspector__body",t});this.querySelectorAll(".c-feature-inspector__field").forEach(t=>t.remove());const s=this.getAttribute("data");if(s)try{const t=JSON.parse(s);if(t&&"object"==typeof t&&!Array.isArray(t))for(const[s,r]of Object.entries(t)){const t=document.createElement("div");t.className="c-feature-inspector__field";const i=document.createElement("span");i.className="c-feature-inspector__label",i.textContent=s;const a=document.createElement("span");a.className="c-feature-inspector__value",a.textContent=String(r),t.appendChild(i),t.appendChild(a),e.appendChild(t)}}catch(t){f(this,"attribute",t)}const r=this.ensure(".c-feature-inspector__actions",()=>{const t=document.createElement("div");return t.className="c-feature-inspector__actions",t});Array.from(r.querySelectorAll("[data-inspect-action]")).forEach(t=>t.remove());const i=this.getAttribute("actions");if(i)try{const t=JSON.parse(i);Array.isArray(t)&&t.forEach(t=>{const e=document.createElement("button");e.type="button",e.className="c-btn c-btn--sm c-feature-inspector__action",e.setAttribute("data-inspect-action",""),e.textContent="string"==typeof t?t:t&&(t.label||t.action)||"",t&&"object"==typeof t&&void 0!==t.value&&e.setAttribute("data-action",String(t.value)),r.appendChild(e)})}catch(t){f(this,"attribute",t)}r.style.display=r.hasChildNodes()?"":"none"}enhance(){this._wiredFeatureInspector||(this._wiredFeatureInspector=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("button"):null;e&&this.contains(e)&&this.dispatchEvent(new CustomEvent("contour:inspect-action",{bubbles:!0,composed:!0,detail:{label:e.textContent||"",value:e.getAttribute("data-action")||""}}))}))}});c("contour-readout",class extends T{static get observed(){return["rows","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","format","locale","unit","precision","cache-key","no-cache"]}static get properties(){return{rows:{attribute:"rows"},format:{attribute:"format"},locale:{attribute:"locale"},precision:{attribute:"precision"},src:{attribute:"src"}}}render(){if(this.classList.add("c-readout"),Zt(this),$t(this,"rows"),Xt(this,"readout"))return;const t=Jt(this,"rows");Array.from(this.querySelectorAll(".c-readout__row")).forEach(t=>t.remove());const e=Array.from(this.children).filter(t=>!t.classList||!t.classList.contains("c-readout__row"));if(t&&!e.length)try{JSON.parse(t).forEach(t=>{const e=document.createElement("div");e.className="c-readout__row";const s=document.createElement("span");s.className="c-readout__key",s.textContent=t.key||t[0];const r=document.createElement("span");r.className="c-readout__value"+(t.primary?" c-readout__value--primary":"")+(t.accent?" c-readout__value--accent":"")+(t.coord?" c-readout__value--coord":""),r.setAttribute("aria-live","polite");const i=void 0!==t.value?t.value:t[1],a=void 0!==t.precision?t.precision:this.getAttribute("precision");null!==a&&""!==a&&(r.dataset.precision=String(a));const n=null!==a&&""!==a&&"number"==typeof i&&Number.isFinite(i)?i.toFixed(Math.max(0,Math.min(20,Number(a)||0))):i;if(r.textContent=B(n,this.getAttribute("format"),this.getAttribute("locale"),void 0!==t.unit?t.unit:this.getAttribute("unit")),e.appendChild(s),e.appendChild(r),t.order){const s=document.createElement("span");s.className="c-readout__order",s.textContent=t.order,e.appendChild(s)}this.appendChild(e)})}catch(t){f(this,"attribute",t)}else t||e.length||Yt(this,"readout")}});c("contour-kpi",class extends T{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","cache-key","no-cache"]}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(){if(this.classList.add("c-kpi"),Zt(this),$t(this,["value","label"]),Xt(this,"kpi"))return;const t=Jt(this,"value"),e=Jt(this,"label"),s=this.getAttribute("delta"),r=this.getAttribute("variant");if(Array.from(this.classList).forEach(t=>{t.startsWith("c-kpi--")&&this.classList.remove(t)}),r&&this.classList.add("c-kpi--"+r),t){this.ensure(".c-kpi__value",()=>{const t=document.createElement("div");return t.className="c-kpi__value",t.setAttribute("aria-live","polite"),t}).textContent=B(t,this.getAttribute("format"),this.getAttribute("locale"),this.getAttribute("unit"))}else{const t=this.querySelector(".c-kpi__value");t&&t.remove()}if(e){const t=this.ensure(".c-kpi__head",()=>{const t=document.createElement("div");return t.className="c-kpi__head",t});let s=t.querySelector(".c-kpi__label");s||(s=document.createElement("div"),s.className="c-kpi__label",t.appendChild(s)),s.textContent=e,t.parentNode!==this&&this.insertBefore(t,this.firstChild)}else{const t=this.querySelector(".c-kpi__head");t&&t.remove()}if(s){const t=this.ensure(".c-kpi__foot",()=>{const t=document.createElement("div");return t.className="c-kpi__foot",t}),e=t.querySelector(".c-delta")||document.createElement("span");e.parentNode||t.insertBefore(e,t.firstChild);const r=this.getAttribute("direction")||"up",i=this.getAttribute("polarity")||"neutral";let a="neutral";"good"===i||"up-good"===i||"auto"===i?a="up"===r?"good":"down"===r?"bad":"neutral":"bad"!==i&&"down-good"!==i||(a="up"===r?"bad":"down"===r?"good":"neutral"),e.className="c-delta c-delta--"+r+" c-delta--"+a,e.textContent="";const n={up:"#i-arrow-up",down:"#i-arrow-down",flat:"#i-minus"}[r]||"#i-arrow-up",o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("aria-hidden","true");const c=document.createElementNS("http://www.w3.org/2000/svg","use");c.setAttribute("href",n),o.appendChild(c),e.appendChild(o),e.appendChild(document.createTextNode(" "+s))}else{const t=this.querySelector(".c-kpi__foot .c-delta");t&&t.remove()}const a=this.getAttribute("note");if(a){const t=this.ensure(".c-kpi__foot",()=>{const t=document.createElement("div");return t.className="c-kpi__foot",t});(t.querySelector(".c-kpi__note")||(()=>{const e=document.createElement("span");return e.className="c-kpi__note",t.appendChild(e),e})()).textContent=a}else{const t=this.querySelector(".c-kpi__note");t&&t.remove()}const n=this.getAttribute("unit"),o=this.querySelector(".c-kpi__value");if(o)if(n){let t=o.querySelector(".c-kpi__unit");t||(t=document.createElement("span"),t.className="c-kpi__unit",o.appendChild(t)),t.textContent=n}else{const t=o.querySelector(".c-kpi__unit");t&&t.remove()}const c=this.getAttribute("threshold")||this.getAttribute("thresholds");if(c){const t=this.ensure(".c-kpi__foot",()=>{const t=document.createElement("div");return t.className="c-kpi__foot",t});let e=t.querySelector(".c-kpi__threshold-badge");e||(e=document.createElement("span"),e.className="c-kpi__threshold-badge",t.appendChild(e)),e.textContent=c,e.setAttribute("part","threshold-badge")}else{const t=this.querySelector(".c-kpi__threshold-badge");t&&t.remove()}const l=this.querySelector(".c-kpi__foot");l&&!l.querySelector(".c-delta, .c-kpi__note, .c-kpi__threshold-badge")&&l.remove();const u=this.getAttribute("sparkline"),d=null!==u&&""!==u&&"0"!==u&&"false"!==u.toLowerCase(),h=this.querySelector(".c-kpi__sparkline-canvas");if(h&&h.remove(),d){let t=null;try{t=JSON.parse(u)}catch(e){t=null}Array.isArray(t)||(t=null);const e=(t||[]).map(t=>Number(t)).filter(t=>Number.isFinite(t));if(e.length>1){const t=document.createElement("canvas");t.className="c-kpi__sparkline-canvas",t.setAttribute("part","sparkline-canvas"),t.setAttribute("aria-hidden","true"),this.appendChild(t),this._sparkSeries=e;const s=()=>{if(!t.isConnected)return;const s=t.clientWidth,r=t.clientHeight;if(!s||!r)return;const i="undefined"!=typeof window&&window.devicePixelRatio||1;t.width=Math.round(s*i),t.height=Math.round(r*i);const a=t.getContext&&t.getContext("2d");if(!a)return;a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,s,r);const n=Math.min.apply(null,e),o=Math.max.apply(null,e)-n||1;let c=getComputedStyle(this).getPropertyValue("--chart-1").trim();if(!c||/^(var|light-dark)\(/.test(c)){const t=document.createElement("span");t.style.display="none",t.style.color=c||"var(--chart-1, #666)",this.appendChild(t),c=getComputedStyle(t).color||"#666",t.remove()}a.beginPath(),a.lineWidth=1.5,a.strokeStyle=c,e.forEach((t,i)=>{const c=(t=>t/(e.length-1)*(s-4)+2)(i),l=(t=>r-2-(t-n)/o*(r-4))(t);0===i?a.moveTo(c,l):a.lineTo(c,l)}),a.stroke()};"function"==typeof requestAnimationFrame?requestAnimationFrame(s):s(),"undefined"==typeof ResizeObserver||this._sparkRO||(this._sparkRO=new ResizeObserver(()=>s()),i(this,()=>{this._sparkRO&&(this._sparkRO.disconnect(),this._sparkRO=null)})),this._sparkRO&&this._sparkRO.observe(t)}}t||e||Yt(this,"kpi")}});class te extends T{static get updateMode(){return"keyed"}static get observed(){return["columns","rows","page","page-size","sort","sort-dir","virtual","title","selected","empty","loading","error","retry","skeleton","persist","density","visible-columns","cache-key","lazy","no-cache","refresh","src","timeout"]}static get properties(){return{columns:{attribute:"columns"},rows:{attribute:"rows"},page:{attribute:"page",type:Number},pageSize:{attribute:"page-size",type:Number}}}get selected(){return this._selectionKeys()}set selected(t){this._pushedSelection=Array.isArray(t)?t.map(String):[],this.requestRender()}_rowKey(t){if(t&&"object"==typeof t&&!Array.isArray(t)){if(void 0!==t.id&&null!==t.id)return String(t.id);if(void 0!==t.key&&null!==t.key)return String(t.key)}const e=this._keyCol;if(null!=e&&e>=0&&t&&void 0!==t[e]&&null!==t[e]){const s=this._cellValue(t[e]);if(""!==s)return String(s)}return JSON.stringify(void 0===t?null:t)}_selectionKeys(){if(this._selectionControlled)return Array.from(this._selectedKeys||[]);const t=this._rowData||[];return Array.from(this._selectedRows||[]).map(e=>this._rowKey(t[e]))}_syncSelectionRows(){const t=this._rowData||[],e=new Set;t.forEach((t,s)=>{this._selectedKeys.has(this._rowKey(t))&&e.add(s)}),this._selectedRows=e}_cellValue(t){return null==t?"":"object"==typeof t?void 0!==t.value?t.value:void 0!==t.label?t.label:JSON.stringify(t):t}_cellFor(t,e,s){if(t&&"object"==typeof t&&!Array.isArray(t)){const r="string"==typeof e?e:e&&(e.key||e.label||e.title)||"";return r&&void 0!==t[r]?t[r]:t[s]}return t?t[s]:void 0}_compare(t,e,s){const r=this._cellValue(t),i=this._cellValue(e);return"number"===s||"numeric"===s?(parseFloat(r)||0)-(parseFloat(i)||0):String(r).localeCompare(String(i),void 0,{numeric:!0})}_applyVisibleColumns(t){const e=this.getAttribute("visible-columns");if(!e)return;let s=null;try{const t=JSON.parse(e);Array.isArray(t)&&(s=new Set(t.map(Number)))}catch(t){}if(!s||!s.size)return;const r=t=>s.has(t);t.querySelectorAll("thead tr th").forEach((t,e)=>{t.hidden=!r(e)}),t.querySelectorAll("tbody tr").forEach(t=>{1===t.children.length&&t.children[0].hasAttribute("colspan")||Array.from(t.children).forEach((t,e)=>{t.hidden=!r(e)})})}render(){if(this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Table"),Zt(this),$t(this,"rows"),Xt(this,"table"))return;const t=this.getAttribute("columns"),e=Jt(this,"rows"),s=Array.from(this.children).filter(t=>!t.classList||!t.classList.contains("c-table-wrap"));if(t&&e&&!s.length)try{const s=JSON.parse(t),r=JSON.parse(e),i=this.getAttribute("sort"),a=this.getAttribute("sort-dir");if(void 0===this._sortCol||i!==this._sortAttrLast||a!==this._sortDirAttrLast){if(this._sortAttrLast=i,this._sortDirAttrLast=a,null!==i){const t=Number(i);this._sortCol=Number.isFinite(t)?t:s.findIndex(t=>"object"==typeof t&&t&&(t.label||t.title||t)===i),this._sortCol<0&&(this._sortCol=null)}else this._sortCol=null;this._sortDir="descending"===a||"desc"===a?-1:1}let n=Array.isArray(r)?r.slice():[];if(null!==this._sortCol&&void 0!==this._sortCol&&this._sortCol>=0&&this._sortCol<s.length){const t=this._sortCol,e=this._sortDir||1,r=s[t],i="object"==typeof r&&r&&r.sortType?r.sortType:"text";n.sort((s,a)=>this._compare(this._cellFor(s,r,t),this._cellFor(a,r,t),i)*e)}this._filters||(this._filters={});const o=Object.keys(this._filters).filter(t=>this._filters[t]);o.length&&(n=n.filter(t=>o.every(e=>{const r=Number(e),i=String(this._filters[r]||"").toLowerCase();return!i||String(this._cellValue(this._cellFor(t,s[r],r))).toLowerCase().includes(i)})));const c=this.getAttribute("page-size"),l=null!==c?parseInt(c,10):NaN,u=Number.isFinite(l)&&l>0;let d=this.getAttribute("page");if(this.getAttribute("persist")&&this.id){const t=this.getAttribute("persist");let e=null;if("storage"===t)try{e=localStorage.getItem("contour-table:"+this.id)}catch(t){}else if("url"===t)try{e=new URLSearchParams(window.location.search).get("c-table-"+this.id)}catch(t){}null!==e&&(d=e)}this._pageInternal?(this._pageInternal=!1,this._pageAttrLast=d):d!==this._pageAttrLast&&(this._page=null,this._pageAttrLast=d);let h=null!==this._page?this._page:parseInt(d||"1",10);(!Number.isFinite(h)||h<1)&&(h=1);let m=1,b=n;if(u){m=Math.max(1,Math.ceil(n.length/l)),h>m&&(h=m);const t=(h-1)*l;b=n.slice(t,t+l)}this._page=h,this._totalPages=m,this._pageSize=l,this._rowData=b,this._keyCol=s.findIndex(t=>"object"==typeof t&&null!==t&&!0===t.key),this._selectedRows=this._selectedRows||new Set,this._selectedKeys=this._selectedKeys||new Set;const p=this.getAttribute("selected");if(p!==this._selectedAttrLast)if(this._selectedAttrLast=p,null!==p)try{const t=JSON.parse(p);Array.isArray(t)?(this._selectedKeys=new Set(t.map(String)),this._selectionControlled=!0):f(this,"selected",new Error("not an array"))}catch(t){f(this,"selected",t)}else void 0===this._pushedSelection&&(this._selectionControlled=!1);void 0!==this._pushedSelection&&(this._selectedKeys=new Set(this._pushedSelection),this._selectionControlled=!0),this._selectionControlled&&this._syncSelectionRows();const g=this._virtualWrap||this.keepNode(this.ensure(".c-table-wrap",()=>{const t=document.createElement("div");return t.className="c-table-wrap",t.setAttribute("tabindex","0"),t.setAttribute("role","region"),t.setAttribute("aria-label",k(this,"table-data","Table data")),t}));this._virtualWrap=g;const _=JSON.stringify(s),v=g.querySelector("table.c-table")&&this._tableCols===_?g.querySelector("table.c-table"):(()=>{const t=document.createElement("table");t.className="c-table";const e=document.createElement("caption");e.className="visually-hidden",e.textContent=this.getAttribute("title")||this.getAttribute("aria-label")||"Table",t.appendChild(e);const r=document.createElement("thead"),i=document.createElement("tr");return s.forEach((t,e)=>{const s="string"==typeof t?t:t.label||t.title||t,r=document.createElement("th"),a="object"==typeof t&&null!==t&&t.sort,n="object"==typeof t&&null!==t&&t.select,o="object"==typeof t&&null!==t&&t.filter;if("object"==typeof t&&null!==t&&("number"===t.type||"numeric"===t.type)&&r.classList.add("c-table__number"),o){r.className=r.className.trim();const t=document.createElement("input");t.type="search",t.className="c-table__filter-input",t.placeholder=s,t.setAttribute("aria-label",k(this,"filter","Filter")+" "+s),t.dataset.filterIndex=String(e),this._filters&&this._filters[e]&&(t.value=this._filters[e]),r.appendChild(t)}else if(n){r.className=(r.className+" c-table__select").trim();const t=document.createElement("input");t.type="checkbox",t.className="c-table__select-all",t.setAttribute("aria-label",k(this,"select-all-rows","Select all rows")),t.dataset.contourPreserveKey="select-all",r.appendChild(t)}else if(a){r.setAttribute("aria-sort",this._sortCol===e?-1===this._sortDir?"descending":"ascending":"none");const t=document.createElement("span");t.className="c-table__sort",t.textContent=s;const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("aria-hidden","true"),L(i,'<use href="#i-chevron-down" />'),t.appendChild(i),r.appendChild(t)}else"object"==typeof t&&null!==t&&t.pinned?(r.className="c-table__pinned",r.textContent=s):r.textContent=s;a&&(r.setAttribute("tabindex","0"),r.setAttribute("role","columnheader"),r.dataset.sortIndex=String(e)),i.appendChild(r)}),r.appendChild(i),t.appendChild(r),t.appendChild(document.createElement("tbody")),t})();this._tableCols=_,this._applyVisibleColumns(v),s.forEach((t,e)=>{if("object"==typeof t&&null!==t&&t.sort){const t=v.querySelector("thead tr th:nth-child("+(e+1)+")");t&&t.setAttribute("aria-sort",this._sortCol===e?-1===this._sortDir?"descending":"ascending":"none")}});const A=v.querySelector("tbody"),E=null!=this._tablePendingScrollTop?this._tablePendingScrollTop:g.scrollTop;this._tablePendingScrollTop=null,A.innerHTML="";const w=this.hasAttribute("virtual")&&!u&&b.length>100,x=this._measuredRowHeight||y("--data-grid-row-height",32),C=30,S=10;let N=0,q=b;if(w){const t=Math.max(0,b.length-C);N=Math.min(t,Math.max(0,Math.floor(E/x)-S)),q=b.slice(N,N+C+2*S),v.setAttribute("aria-rowcount",String(b.length+1)),this._tableWindowStart=N}else v.removeAttribute("aria-rowcount");const D=t=>{const e=document.createElement("tr");e.setAttribute("aria-hidden","true");const r=document.createElement("td");r.colSpan=s.length,r.style.blockSize=`${t}px`,r.style.padding="0",e.appendChild(r),A.appendChild(e)};if(w&&D(N*x),0===q.length){const t=document.createElement("tr"),e=document.createElement("td");e.colSpan=s.length,e.textContent=this.getAttribute("empty")||"No data",e.style.textAlign="center",e.style.color="var(--color-text-muted)",t.appendChild(e),A.appendChild(t)}else q.forEach((t,e)=>{const r=document.createElement("tr");r.dataset.rowIndex=String(N+e);const i=this._rowKey(t);r.dataset.rowKey=i,r.setAttribute("tabindex","-1"),s.forEach((s,a)=>{const n="object"==typeof s&&null!==s&&s.select,o="object"==typeof s&&null!==s&&("number"===s.type||"numeric"===s.type),c=document.createElement("td");if(o&&c.classList.add("c-table__number"),n){const t=document.createElement("input");t.type="checkbox",t.className="c-table__row-select",t.dataset.rowIndex=String(N+e),t.dataset.contourPreserveKey=i,this._selectionControlled?this._selectedKeys.has(i)&&(t.checked=!0):this._selectedRows&&this._selectedRows.has(N+e)&&(t.checked=!0),c.appendChild(t)}else c.textContent=this._cellValue(this._cellFor(t,s,a));r.appendChild(c)}),A.appendChild(r)});if(w&&D(Math.max(0,b.length-N-q.length)*x),!A.querySelector('tr[tabindex="0"]')){const t=A.querySelector("tr[data-row-index]");t&&t.setAttribute("tabindex","0")}if(!this._measuredRowHeight&&!this._measuringRow){const t=A.querySelector("tr[data-row-index]"),e=t?t.getBoundingClientRect().height:0;e>0&&(this._measuredRowHeight=e,Math.abs(e-x)>1&&(this._measuringRow=!0,requestAnimationFrame(()=>{this._measuringRow=!1,this.render()})))}if(v.parentNode!==g){for(;g.firstChild;)g.removeChild(g.firstChild);g.appendChild(v)}if(g.parentNode!==this&&this.appendChild(g),w&&E>0&&g.scrollTop!==E&&(this._tableScrollRestoredAt="undefined"!=typeof performance&&performance.now?performance.now():Date.now(),g.scrollTop=E),this.hasAttribute("virtual")?(g.style.maxHeight=g.style.maxHeight||"24rem",g.style.overflow="auto",g.style.contentVisibility="visible",v.classList.add("c-table--virtual")):(g.style.maxHeight="",g.style.overflow="",g.style.contentVisibility="",v.classList.remove("c-table--virtual")),u){const t=this.ensure(".c-table__pagination",()=>{const t=document.createElement("div");return t.className="c-table__pagination",t});t.innerHTML="";const e=document.createElement("button");e.className="c-btn c-btn--ghost c-btn--sm",e.type="button",e.textContent=k(this,"prev","Previous"),e.disabled=h<=1,e.dataset.action="prev";const s=document.createElement("span");s.textContent=`${k(this,"page","Page")} ${h} ${k(this,"of","of")} ${m}`;const r=document.createElement("button");r.className="c-btn c-btn--ghost c-btn--sm",r.type="button",r.textContent=k(this,"next","Next"),r.disabled=h>=m,r.dataset.action="next",t.appendChild(e),t.appendChild(s),t.appendChild(r)}else{const t=this.querySelector(".c-table__pagination");t&&t.remove()}}catch(t){f(this,"attribute",t)}else e||s.length||Yt(this,"table")}_applySelectionToDom(){this.querySelectorAll(".c-table__row-select").forEach(t=>{const e=Number(t.dataset.rowIndex);if(!Number.isFinite(e))return;const s=this._rowData?this._rowData[e]:void 0,r=this._selectionControlled?this._selectedKeys.has(this._rowKey(s)):!(!this._selectedRows||!this._selectedRows.has(e));t.checked!==r&&(t.checked=r)});const t=this.querySelector(".c-table__select-all");if(t){const e=Array.from(this.querySelectorAll(".c-table__row-select")),s=e.filter(t=>t.checked).length;t.checked=e.length>0&&s===e.length,t.indeterminate=s>0&&s<e.length,t.setAttribute("aria-label",w(this,"virtual")?k(this,"select-visible-rows","Select visible rows"):k(this,"select-all-rows","Select all rows"))}}enhance(){if(this._applySelectionToDom(),this._wiredTable)return;this._wiredTable=!0;const t=t=>{const e=Number(t.dataset.sortIndex);Number.isFinite(e)&&(this._sortCol===e?this._sortDir=1===this._sortDir?-1:1:(this._sortCol=e,this._sortDir=1),this.dispatchEvent(new CustomEvent("contour:sort",{bubbles:!0,composed:!0,detail:{column:e,direction:1===this._sortDir?"ascending":"descending"}})),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"table",filter:{sort:e,sortDir:1===this._sortDir?"ascending":"descending"}}})),this.requestRender())};this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest('button[data-action="retry"]'):null;if(s&&this.contains(s))return e.preventDefault(),void this.dispatchEvent(new CustomEvent("contour:retry",{detail:{src:this.getAttribute("src")},bubbles:!0,composed:!0}));const r=e.target&&e.target.closest?e.target.closest("th[aria-sort]"):null;if(r&&this.contains(r))return e.preventDefault(),void t(r);const i=e.target&&e.target.closest?e.target.closest(".c-table__pagination button"):null;if(i&&this.contains(i)){e.preventDefault();const t=i.dataset.action;let s=null!==this._page?this._page:parseInt(this.getAttribute("page")||"1",10);(!Number.isFinite(s)||s<1)&&(s=1),"prev"===t&&s>1&&(s-=1),"next"===t&&(s+=1),this._page=s,this._pageAttrLast=String(s),this._pageInternal=!0,this.setAttribute("page",String(s)),this.dispatchEvent(new CustomEvent("contour:page",{bubbles:!0,composed:!0,detail:{page:s}})),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"table",filter:{page:s}}}));const r=this.getAttribute("persist");if("storage"===r&&this.id)try{localStorage.setItem("contour-table:"+this.id,String(s))}catch(e){}else if("url"===r&&this.id)try{const t=new URL(window.location.href);t.searchParams.set("c-table-"+this.id,String(s)),window.history.replaceState(null,"",t.toString())}catch(e){}}}),this.addEventListener("keydown",e=>{if("Enter"!==e.key&&" "!==e.key)return;const s=e.target&&e.target.closest?e.target.closest("th[aria-sort]"):null;s&&this.contains(s)&&(e.preventDefault(),t(s))}),this.addEventListener("input",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-table__filter-input"):null;if(!e||!this.contains(e))return;const s=Number(e.dataset.filterIndex);Number.isFinite(s)&&(this._filters||(this._filters={}),this._filters[s]=e.value,this.requestRender(),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"table",filter:{column:s,value:e.value}}})))}),this.addEventListener("scroll",t=>{if(!(this.hasAttribute("virtual")&&t.target&&t.target.classList&&t.target.classList.contains("c-table-wrap")))return;const e=t.target,s=this._measuredRowHeight||y("--data-grid-row-height",32),r=Math.max(0,(this._rowData?this._rowData.length:0)-30),i=Math.min(r,Math.max(0,Math.floor(e.scrollTop/s)-10));if(this._tableWindowStart===i)return;if(this._tableVirtualRaf)return;this._tablePendingScrollTop=e.scrollTop;const a=()=>{this._tableVirtualRaf=0,this.requestRender()};this._tableVirtualRaf="function"==typeof requestAnimationFrame?requestAnimationFrame(a):setTimeout(a,16)},!0),i(this,()=>{this._tableVirtualRaf&&("function"==typeof cancelAnimationFrame?cancelAnimationFrame(this._tableVirtualRaf):clearTimeout(this._tableVirtualRaf),this._tableVirtualRaf=0)}),this._selectedRows=this._selectedRows||new Set,this.addEventListener("change",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-table__row-select"):null;if(e&&this.contains(e)){const t=Number(e.dataset.rowIndex);if(!Number.isFinite(t))return;const s=this._rowKey(this._rowData?this._rowData[t]:void 0);this._selectionControlled?(e.checked?this._selectedKeys.add(s):this._selectedKeys.delete(s),this._syncSelectionRows()):e.checked?this._selectedRows.add(t):this._selectedRows.delete(t),this._applySelectionToDom();const r=Array.from(this._selectedRows),i=this._selectionKeys();return this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{rows:r,key:s,index:t}})),void this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"table",filter:{selectedRows:r,selectedKeys:i}}}))}const s=t.target&&t.target.closest?t.target.closest(".c-table__select-all"):null;if(s&&this.contains(s)){const t=Array.from(this.querySelectorAll(".c-table__row-select"));t.forEach(t=>{t.checked=s.checked}),this._selectionControlled?(t.forEach(t=>{const e=Number(t.dataset.rowIndex),r=this._rowKey(this._rowData?this._rowData[e]:void 0);s.checked?this._selectedKeys.add(r):this._selectedKeys.delete(r)}),this._syncSelectionRows()):this._selectedRows=new Set(s.checked?t.map(t=>Number(t.dataset.rowIndex)):[]),s.indeterminate=!1;const e=Array.from(this._selectedRows),r=this._selectionKeys();this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{rows:e}})),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"table",filter:{selectedRows:e,selectedKeys:r}}}))}}),this.addEventListener("mouseover",t=>{const e=t.target&&t.target.closest?t.target.closest("tbody tr"):null;if(!e||!this.contains(e))return;const s=Number(e.dataset.rowIndex);Number.isFinite(s)&&this._hoveredRow!==s&&(this._hoveredRow=s,this.dispatchEvent(new CustomEvent("contour:hover",{bubbles:!0,composed:!0,detail:{row:s}})))}),this.addEventListener("mouseout",t=>{const e=t.target&&t.target.closest?t.target.closest("tbody tr"):null;if(!e||!this.contains(e))return;(t.relatedTarget&&t.relatedTarget.closest?t.relatedTarget.closest("tbody tr"):null)!==e&&(this._hoveredRow=null,this.dispatchEvent(new CustomEvent("contour:leave",{bubbles:!0,composed:!0,detail:{}})))}),this.addEventListener("click",t=>{if(t.target&&t.target.closest&&t.target.closest("input, button, select, textarea, a[href], label"))return;const e=t.target&&t.target.closest?t.target.closest("tbody tr"):null;if(!e||!this.contains(e))return;const s=void 0!==e.dataset.rowIndex?e.dataset.rowIndex:e.dataset.row,r=Number(s);if(!Number.isFinite(r))return;const i=this._rowData&&this._rowData[r]||null;this.dispatchEvent(new CustomEvent("contour:zoom",{bubbles:!0,composed:!0,detail:{row:r,index:r,data:i}}))}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest("tbody tr"):null;if(!e||!this.contains(e))return;const s=Number(e.dataset.rowIndex);if(Number.isFinite(s)){if("ArrowDown"===t.key||"ArrowUp"===t.key||"Home"===t.key||"End"===t.key){const s=Array.from(this.querySelectorAll("tbody tr[data-row-index]")),r=s.indexOf(e);let i=r;if("ArrowDown"===t.key?i=Math.min(s.length-1,r+1):"ArrowUp"===t.key?i=Math.max(0,r-1):"Home"===t.key?i=0:"End"===t.key&&(i=s.length-1),i!==r&&s[i]){t.preventDefault(),s.forEach(t=>t.setAttribute("tabindex","-1")),s[i].setAttribute("tabindex","0");try{s[i].focus()}catch(t){}}return}"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0,detail:{row:s}})))}}),this.addEventListener("contour:clear-all",()=>{let t=!1;this.hasAttribute("sort")&&(this.removeAttribute("sort"),t=!0),this.hasAttribute("sort-dir")&&(this.removeAttribute("sort-dir"),t=!0),null!==this._sortCol&&void 0!==this._sortCol&&(this._sortCol=null,this._sortDir=1,t=!0),this.hasAttribute("page")&&(this.removeAttribute("page"),t=!0),this._filters&&Object.keys(this._filters).length&&(this._filters={},this.querySelectorAll(".c-table__filter-input").forEach(t=>{t.value=""}),t=!0),this._selectedRows&&this._selectedRows.size&&(this._selectedRows.clear(),t=!0),!this._selectionControlled&&this._selectedKeys&&this._selectedKeys.size&&(this._selectedKeys.clear(),t=!0),t&&(this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"table",filter:{sort:null,sortDir:null,page:null,filters:null}}})),this.requestRender())})}}c("contour-table",te);c("contour-data-table",class extends te{render(){super.render(),this.classList.add("c-data-table"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"data-table","Data table"))}});c("contour-column-picker",class extends T{static get observed(){return["columns","label"]}static get properties(){return{columns:{attribute:"columns"},label:{attribute:"label"}}}render(){this.classList.add("c-column-picker");const t=this.ensure(".c-column-picker__trigger",()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--sm c-column-picker__trigger",t});L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-sliders" /></svg>'),t.appendChild(document.createTextNode(" "+(this.getAttribute("label")||k(this,"columns","Columns"))));const e=this.ensure(".c-column-picker__panel",()=>{const t=document.createElement("div");return t.className="c-column-picker__panel",t});let s=[];try{const t=JSON.parse(this.getAttribute("columns")||"[]");Array.isArray(t)&&(s=t)}catch(t){}e.innerHTML="",s.forEach(t=>{const s="string"==typeof t?t:t.label||t.name||t,r="string"==typeof t?t:t.value||t.name||t,i=document.createElement("label");i.className="c-column-picker__item";const a=document.createElement("input");a.type="checkbox",a.checked=!0,a.dataset.column=r,i.appendChild(a),i.appendChild(document.createTextNode(" "+s)),e.appendChild(i)})}enhance(){this._wiredColPicker||(this._wiredColPicker=!0,this.addEventListener("change",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-column-picker__item input"):null;e&&this.contains(e)&&this.dispatchEvent(new CustomEvent("contour:column-toggle",{bubbles:!0,composed:!0,detail:{column:e.dataset.column,visible:e.checked}}))}))}});const ee=(t,e=600)=>{if(!Array.isArray(t)||t.length<=e)return t;const s=Math.ceil(t.length/e),r=[];for(let e=0;e<t.length;e+=s)r.push(t[e]);const i=t[t.length-1];return r[r.length-1]!==i&&r.push(i),r},se=(t,e)=>{const s=Array.from(e.childNodes),r=Array.from(t.childNodes),i=Math.max(s.length,r.length);for(let e=0;e<i;e++){const i=r[e],a=s[e];if(i)if(a)if(1===i.nodeType&&1===a.nodeType&&i.tagName===a.tagName){for(const t of Array.from(i.attributes))a.hasAttribute(t.name)||i.removeAttribute(t.name);for(const t of Array.from(a.attributes)){const e=a.getAttribute(t.name);i.getAttribute(t.name)!==e&&i.setAttribute(t.name,e)}se(i,a)}else 3===i.nodeType&&3===a.nodeType?i.textContent!==a.textContent&&(i.textContent=a.textContent):t.replaceChild(a,i);else t.removeChild(i);else a&&t.appendChild(a)}},re=t=>{if(!t||"object"!=typeof t)return null;const e=Number(t.x0),s=Number(t.x1),r=Number(t.count);if(!Number.isFinite(e)||!Number.isFinite(s)||!Number.isFinite(r))return null;const i={x0:e,x1:s,count:r},a=Number(t.normalized);return Number.isFinite(a)&&(i.normalized=a),i};c("contour-chart",class extends T{static get updateMode(){return"keyed"}static get observed(){return["series","axis","color","label","legend","brownout","brownout-level","empty","loading","error","retry","skeleton","zoomable","data-table","brush","brush-min","brush-max","brush-start","brush-end","note","bucket-count","limit-values","title","cache-key","dir","src"]}static get properties(){return{series:{attribute:"series"},axis:{attribute:"axis"},color:{attribute:"color"},label:{attribute:"label"},legend:{attribute:"legend"},zoomable:{attribute:"zoomable",type:Boolean},brush:{attribute:"brush",type:Boolean},note:{attribute:"note"},"bucket-count":{attribute:"bucket-count"},"limit-values":{attribute:"limit-values"}}}get bins(){const t=this._pushedBins;return(t&&t.length?t:this._renderedBins||[]).map(t=>({...t}))}set bins(t){this._pushedBins=ee(Array.isArray(t)?t.map(re).filter(Boolean):[]),this.requestRender()}get backgroundData(){const t=this._pushedBackground;return(t&&t.length?t:this._renderedBackground||[]).map(t=>({...t}))}set backgroundData(t){this._pushedBackground=Array.isArray(t)?t.map(re).filter(Boolean):[],this.requestRender()}_showsBrush(){return this.hasAttribute("brush")||void 0!==this._rangeOverride}get range(){const t=this._rangeOverride;if(void 0!==t)return t?t.slice():null;if(!this.hasAttribute("brush"))return null;const e=parseFloat(this.getAttribute("brush-start")),s=parseFloat(this.getAttribute("brush-end"));return Number.isFinite(e)&&Number.isFinite(s)?[e,s]:null}set range(t){if(null==t)return this._rangeOverride=null,void this.requestRender();const e=Array.isArray(t)?t:[t,t],s=Number(e[0]),r=Number(e[1]);Number.isFinite(s)&&Number.isFinite(r)&&(this._rangeOverride=[s,r],this.requestRender())}_axisLabel(){const t=this.getAttribute("axis");if(!t)return"";try{const e=JSON.parse(t);if(e&&"object"==typeof e){const t=e.x;return e.label||e.title||e.name||t&&"object"==typeof t&&(t.label||t.title||t.name)||""}return String(e)}catch(e){return t}}_seriesColor(t,e){const s=_(t&&"object"==typeof t?t.color:"");if(s)return s;const r=_(this.getAttribute("color"));return r||"var(--chart-"+(e%8+1)+")"}_legendOff(){const t=(this.getAttribute("legend")||"").trim().toLowerCase();return"off"===t||"false"===t||"none"===t||"0"===t}_applyBrownout(){const t=this.shed("chrome",2),e=this.shed("marks",3),s=this.querySelector(".c-chart__plot");s&&(s.style.backgroundImage=t?"none":"");const r=this.querySelector(".c-chart__axis");r&&(r.style.display=e?"none":"");const i=this.querySelector(".c-chart__note");i&&(i.style.display=e?"none":"");const a=this.querySelector("contour-brush");a&&(a.style.display=e?"none":"")}_axisConfig(){const t=this.getAttribute("axis");if(!t)return null;try{const e=JSON.parse(t);return e&&"object"==typeof e?e:null}catch(t){return null}}_valueDomain(){const t=this.getAttribute("series");if(!t)return null;try{const e=JSON.parse(t);let s=1/0,r=-1/0,i=!1;return(Array.isArray(e)?e:[]).forEach(t=>{!t||"bar"!==t.type&&"histogram"!==t.type&&"stacked"!==t.type||(i=!0),t&&Array.isArray(t.values)&&t.values.forEach(t=>{const e=Number(t);Number.isFinite(e)&&(e<s&&(s=e),e>r&&(r=e))})}),i&&Number.isFinite(s)&&Number.isFinite(r)&&(s=Math.min(0,s),r=Math.max(0,r)),Number.isFinite(s)&&Number.isFinite(r)?[s,r]:null}catch(t){return null}}_renderValueAxis(){const t=this.querySelector(".c-chart__axis");if(!t)return;const e=this._axisConfig(),s=e&&e.y,r=s&&s.domain||this._valueDomain(),i=this.querySelector(".c-chart__axis-x");if(!r)return this.classList.remove("c-chart--value-axis"),t.className="c-chart__axis",t.textContent=this._axisLabel(),void(i&&i.remove());this.classList.add("c-chart--value-axis"),t.className="c-chart__axis c-chart__axis--y";const a=s&&s.ticks||function(t,e,s){s=s||5;const r=e-t||1;let i=Math.pow(10,Math.floor(Math.log10(r/s)));if(!Number.isFinite(i)||i<=0)return[t,e];const a=s*i/r;a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2);const n=Math.floor(t/i)*i,o=Math.ceil(e/i)*i,c=[];for(let t=n;t<=o+i/2;t+=i)c.push(Math.round(1e9*t)/1e9);return c}(r[0],r[1],5),n=s&&s.format||(t=>String(t));t.textContent="";a.forEach(e=>{const s=document.createElement("span");s.className="c-chart__tick",s.textContent="function"==typeof n?n(e):String(e),t.appendChild(s)}),s&&"object"==typeof s&&(s.label||s.title||s.name)&&t.appendChild(((t,e)=>{const s=document.createElement("span");return s.className="c-chart__tick",s.dataset.axisTitle=e,s.textContent=t,s})(s.label||s.title||s.name,"y"));const o=this._axisLabel();let c=i;o?(c||(c=document.createElement("div"),c.className="c-chart__axis-x",this.appendChild(c)),c.textContent=o):c&&c.remove(),this.style.setProperty("--chart-ticks",String(a.length))}_renderLegend(){const t=this.getAttribute("series");let e=this.querySelector(".c-chart__legend");if(!t||this._legendOff()||this.shed("legend",2))e&&e.remove();else try{const s=JSON.parse(t),r=(Array.isArray(s)?s:[]).map((t,e)=>({s:t,i:e})).filter(t=>t.s&&t.s.label);if(!r.length)return void(e&&e.remove());e||(e=document.createElement("div"),e.className="c-chart__legend",this.appendChild(e)),e.textContent="",r.forEach(({s:t,i:s})=>{const r=document.createElement("span");r.className="c-chart__legend-item";const i=document.createElement("span");i.className="c-chart__legend-swatch",i.style.setProperty("--c",this._seriesColor(t,s)),i.dataset.series=String(s%12+1),i.dataset.style=t.style||"line",r.appendChild(i),r.appendChild(document.createTextNode(t.label)),e.appendChild(r)})}catch(t){}}render(){this.classList.add("c-chart"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-roledescription")||this.setAttribute("aria-roledescription","chart");const t=this.getAttribute("label")||this._axisLabel(),e=this.getAttribute("aria-label");if(!t||null!==e&&e!==this._lastAutoAria||(this.setAttribute("aria-label",t),this._lastAutoAria=t),this.hasAttribute("loading")){this.setAttribute("aria-busy","true");const t=this.ensure(".c-chart__plot",()=>{const t=document.createElement("div");return t.className="c-chart__plot",t});t.innerHTML="";const e=document.createElement("div");e.className="c-chart__loading",e.textContent=this.getAttribute("loading")||"Loading…",e.style.display="grid",e.style.placeItems="center",e.style.height="100%",e.style.color="var(--color-text-muted)",t.appendChild(e);if(this.getAttribute("axis")){this.ensure(".c-chart__axis",()=>{const t=document.createElement("div");return t.className="c-chart__axis",t}).textContent=this._axisLabel()}return}if(this.removeAttribute("aria-busy"),this.hasAttribute("error")){const t=this.ensure(".c-chart__plot",()=>{const t=document.createElement("div");return t.className="c-chart__plot",t});t.innerHTML="";const e=document.createElement("div");if(e.className="c-chart__error",e.textContent=this.getAttribute("error")||"Error",e.style.display="grid",e.style.placeItems="center",e.style.height="100%",e.style.color="var(--color-danger, var(--color-text))",this.hasAttribute("retry")){const t=document.createElement("button");t.className="c-btn c-btn--ghost c-btn--sm",t.type="button",t.textContent=this.getAttribute("retry")||"Retry",t.dataset.action="retry",t.classList.add("u-mbs-sm"),e.appendChild(t)}t.appendChild(e);if(this.getAttribute("axis")){this.ensure(".c-chart__axis",()=>{const t=document.createElement("div");return t.className="c-chart__axis",t}).textContent=this._axisLabel()}return}if(this.hasAttribute("skeleton")){const t=this.ensure(".c-chart__plot",()=>{const t=document.createElement("div");return t.className="c-chart__plot",t});t.innerHTML="";const e=Math.min(5,Math.max(1,parseInt(this.getAttribute("skeleton")||"3",10)||3));for(let s=0;s<e;s++){const e=document.createElement("div");e.className="c-skeleton",e.style.display="block",e.style.inlineSize="100%",e.style.blockSize="0.6rem",e.classList.add("u-mbe-2xs"),t.appendChild(e)}if(this.getAttribute("axis")){this.ensure(".c-chart__axis",()=>{const t=document.createElement("div");return t.className="c-chart__axis",t}).textContent=this._axisLabel()}return}if(this.getAttribute("axis")){this.ensure(".c-chart__axis",()=>{const t=document.createElement("div");return t.className="c-chart__axis",t}).textContent=this._axisLabel()}else{const t=this.querySelector(".c-chart__axis");t&&t.remove()}this._renderValueAxis(),this._renderLegend();let s=this.getAttribute("series");if(!s&&this._pushedBins&&this._pushedBins.length&&(s=JSON.stringify([{type:"histogram",bins:this._pushedBins}])),s){const t=Qt(this,"series",f);if(0===t.length)return void Yt(this,"chart");const e=this.ensure(".c-chart__plot",()=>{const t=document.createElement("div");return t.className="c-chart__plot",t});this.keepNode(e);const s=document.createDocumentFragment();if(t.some(t=>t&&(Array.isArray(t.values)||Array.isArray(t.bins))))this._renderedBins=[],this._renderedBackground=[],t.forEach((t,e)=>{const r=this._seriesColor(t,e);if("donut"===t.type){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("viewBox","0 0 200 200"),r.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%",r.setAttribute("role","group"),r.setAttribute("aria-label",t.label||"Donut chart"),$(t.values).forEach((s,i)=>{const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("class","c-donut__slice"),a.setAttribute("data-series",String(e+1)),a.dataset.index=String(i),a.style.setProperty("--c",_("var(--chart-"+(i%12+1)+")")||"var(--chart-1)"),a.setAttribute("d",s.path),a.setAttribute("data-title",String(t.values[i])),a.setAttribute("aria-label",k(this,"series","Series")+" "+(e+1)+": "+String(t.values[i])),a.setAttribute("role","button"),a.setAttribute("tabindex",0===i?"0":"-1"),r.appendChild(a)}),s.appendChild(r)}else if("bar"===t.type){const i=Array.isArray(t.values)?t.values:[],a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("viewBox","0 0 300 120"),a.setAttribute("preserveAspectRatio","none"),a.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%",J(i).forEach((t,s)=>{if(t.missing)return;const n=document.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("class","c-chart__bar"),n.setAttribute("data-series",String(e+1)),n.style.setProperty("--c",r),n.setAttribute("x",t.x),n.setAttribute("y",t.y),n.setAttribute("width",t.width),n.setAttribute("height",t.height),n.setAttribute("data-title",String(i[s])),n.setAttribute("aria-label",k(this,"series","Series")+" "+(e+1)+": "+String(i[s])),n.setAttribute("tabindex","0"),n.setAttribute("role","button"),n.dataset.index=String(s),a.appendChild(n)}),s.appendChild(a)}else if("histogram"===t.type){let i=Array.isArray(t.values)?t.values.slice():[];const a=parseInt(this.getAttribute("limit-values")||"0",10);a>0&&(i=i.slice(0,a));const n=parseInt(this.getAttribute("bucket-count")||"0",10),o=this._pushedBins&&this._pushedBins.length?this._pushedBins:null,c=Array.isArray(t.bins)?t.bins.map(re).filter(Boolean):null;let l=o||(c&&c.length?c:null),u=i;if(!l&&n>0&&i.length){const t=i.map(t=>Number(t)||0),e=Math.min.apply(null,t),s=(Math.max.apply(null,t)-e||1)/n,r=new Array(n).fill(0);t.forEach(t=>{const i=Math.min(n-1,Math.floor((t-e)/s));r[i]+=1}),u=r,l=r.map((t,r)=>({x0:e+r*s,x1:e+(r+1)*s,count:t}))}l&&(u=l.map(t=>t.count)),this._renderedBins=l?l.slice():[];const d=this._pushedBackground&&this._pushedBackground.length?this._pushedBackground:null,h=Array.isArray(t.background)?t.background.map(re).filter(Boolean):null,m=d||(h&&h.length?h:[]);this._renderedBackground=m.slice();const b=m.map(t=>Number(t.count)||0);let p=1;b.length&&u.concat(b).forEach(t=>{const e=Number(t)||0;e>p&&(p=e)});const g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("viewBox","0 0 300 120"),g.setAttribute("preserveAspectRatio","none"),g.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%",b.length&&J(b,{max:p}).forEach(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","rect");e.setAttribute("class","c-chart__bar"),e.setAttribute("data-context",""),e.setAttribute("aria-hidden","true"),e.style.setProperty("--c",r),e.setAttribute("x",t.x),e.setAttribute("y",t.y),e.setAttribute("width",t.width),e.setAttribute("height",t.height),g.appendChild(e)}),J(u,b.length?{max:p}:void 0).forEach((s,i)=>{if(s.missing)return;const a=document.createElementNS("http://www.w3.org/2000/svg","rect");a.setAttribute("class","c-chart__bar"),a.setAttribute("data-series",String(e+1)),a.style.setProperty("--c",r),a.setAttribute("x",s.x),a.setAttribute("y",s.y),a.setAttribute("width",s.width),a.setAttribute("height",s.height);const n=l?l[i].count:Array.isArray(t.values)?t.values[i]:i;a.setAttribute("data-title",String(n)),a.setAttribute("aria-label",k(this,"series","Series")+" "+(e+1)+": "+String(n)),a.setAttribute("tabindex","0"),a.setAttribute("role","button"),a.dataset.index=String(i),g.appendChild(a)}),s.appendChild(g)}else if("scatter"===t.type){const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("viewBox","0 0 300 120"),i.setAttribute("preserveAspectRatio","none"),i.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";const a=(Array.isArray(t.values)?t.values:[]).filter(t=>!j(t)).map(t=>Array.isArray(t)?{x:Number(t[0])||0,y:Number(t[1])||0}:{x:Number(t&&t.x)||0,y:Number(t&&t.y)||0}),n=a.map(t=>t.x),o=a.map(t=>t.y),c=n.length?Math.min.apply(null,n):0,l=n.length?Math.max.apply(null,n):1,u=o.length?Math.min.apply(null,o):0,d=o.length?Math.max.apply(null,o):1,h=l-c||1,m=d-u||1,b=2e3;let p=a;if(a.length>b){const t=Math.ceil(a.length/b);p=a.filter((e,s)=>s%t===0),this.dispatchEvent(new CustomEvent("contour:cap",{bubbles:!0,composed:!0,detail:{series:e+1,total:a.length,shown:p.length}}))}p.forEach((t,s)=>{const a=document.createElementNS("http://www.w3.org/2000/svg","circle");a.setAttribute("class","c-chart__point"),a.setAttribute("data-series",String(e+1)),a.setAttribute("data-index",String(s)),a.style.setProperty("--c",r);const n=(t.x-c)/h*300,o=120-(t.y-u)/m*120;a.setAttribute("cx",n.toFixed(2)),a.setAttribute("cy",o.toFixed(2)),a.setAttribute("r","3"),a.setAttribute("tabindex",0===s?"0":"-1"),a.setAttribute("role","button"),a.setAttribute("data-title",t.x+", "+t.y),a.setAttribute("aria-label",k(this,"series","Series")+" "+(e+1)+": "+t.x+", "+t.y),i.appendChild(a)}),p.length!==a.length&&(i.setAttribute("data-decimated",String(a.length)),i.setAttribute("aria-label",k(this,"series","Series")+" "+(e+1)+" ("+p.length+" "+k(this,"of","of")+" "+a.length+")")),s.appendChild(i)}else{const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("viewBox","0 0 300 120"),i.setAttribute("preserveAspectRatio","none"),i.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("class","c-chart__line"),a.setAttribute("data-series",String(e+1)),a.style.setProperty("--c",r),a.setAttribute("d",W(t.values)),i.appendChild(a);const n=t.values.filter(t=>!j(t)).map(Number).filter(t=>Number.isFinite(t)),o=n.reduce((t,e)=>e>t?e:t,n.length?n[0]:1),c=n.reduce((t,e)=>e<t?e:t,n.length?n[0]:0),l=o-c||1,u=t.values.length||1;let d=!0;t.values.forEach((t,s)=>{if(j(t))return;const a=Number(t);if(!Number.isFinite(a))return;const n=s/Math.max(1,u-1)*300,o=120-(a-c)/l*120,h=document.createElementNS("http://www.w3.org/2000/svg","circle");h.setAttribute("class","c-chart__point"),h.setAttribute("data-series",String(e+1)),h.setAttribute("data-index",String(s)),h.style.setProperty("--c",r),h.setAttribute("cx",String(n)),h.setAttribute("cy",String(o)),h.setAttribute("r","3"),h.setAttribute("tabindex",d?"0":"-1"),d=!1,h.setAttribute("role","button"),h.setAttribute("data-title",String(t)),h.setAttribute("aria-label",k(this,"series","Series")+" "+(e+1)+": "+String(t)),i.appendChild(h)}),s.appendChild(i)}});else{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("viewBox","0 0 300 120"),e.setAttribute("preserveAspectRatio","none"),e.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%",e.setAttribute("aria-hidden","true"),t.forEach((t,s)=>{const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("class","c-chart__line"),r.setAttribute("data-series",String(s+1)),r.style.setProperty("--c",this._seriesColor(t,s)),r.setAttribute("d","string"==typeof t.d&&t.d.trim()?t.d:Array.isArray(t.values)?W(t.values):""),e.appendChild(r)}),s.appendChild(e)}if(se(e,s),this.shed("tooltip",2)){const t=this.querySelector(".c-chart__tooltip");t&&t.remove()}else{this.ensure(".c-chart__tooltip",()=>{const t=document.createElement("div");return t.className="c-chart__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t.id=o("chart-tip"),t}).setAttribute("hidden","")}const r=(this.getAttribute("data-table")||"").trim().toLowerCase(),i="none"===r||"off"===r||"false"===r||"0"===r,a=t.some(t=>Array.isArray(t&&t.values)&&t.values.length);if(!i&&a){let e=this.querySelector(".c-chart__data-table");e||(e=document.createElement("table"),e.className="c-chart__data-table visually-hidden",this.appendChild(e)),e.innerHTML="";const s=this.getAttribute("title")||this.getAttribute("aria-label")||k(this,"chart-data","Chart data"),r=document.createElement("caption");r.textContent=s,e.appendChild(r);const i=document.createElement("thead"),a=document.createElement("tr"),n=document.createElement("th");n.setAttribute("scope","col"),n.textContent=k(this,"series","Series"),a.appendChild(n);const o=t.reduce((t,e)=>Math.max(t,Array.isArray(e.values)?e.values.length:Array.isArray(e)?e.length:0),0);for(let t=0;t<o;t++){const e=document.createElement("th");e.setAttribute("scope","col"),e.textContent=k(this,"value","Value")+" "+(t+1),a.appendChild(e)}i.appendChild(a),e.appendChild(i);const c=document.createElement("tbody");t.forEach((t,e)=>{const s=Array.isArray(t.values)?t.values:Array.isArray(t)?t:[],r=document.createElement("tr"),i=document.createElement("th");i.setAttribute("scope","row"),i.textContent=t.label||"Series "+(e+1),r.appendChild(i);for(let t=0;t<o;t++){const e=document.createElement("td");e.textContent=j(s[t])?"":String(s[t]),r.appendChild(e)}c.appendChild(r)}),e.appendChild(c)}else{const t=this.querySelector(".c-chart__data-table");t&&t.remove()}if(this._showsBrush()){const t=this.ensure("contour-brush",()=>document.createElement("contour-brush")),e=this._renderedBins||[],s=this.getAttribute("brush-min")||(e.length?String(e[0].x0):"0"),r=this.getAttribute("brush-max")||(e.length?String(e[e.length-1].x1):"100"),i=Array.isArray(this._rangeOverride)?this._rangeOverride:null,a=null===this._rangeOverride;t.setAttribute("min",s),t.setAttribute("max",r),t.setAttribute("start",i?String(i[0]):a?s:this.getAttribute("brush-start")||s),t.setAttribute("end",i?String(i[1]):a?r:this.getAttribute("brush-end")||r);const n=this.querySelector(".c-chart__plot");t.previousElementSibling!==n&&this.insertBefore(t,n?n.nextSibling:null)}else{const t=this.querySelector("contour-brush");t&&t.remove()}const n=this.getAttribute("note");let c=this.querySelector(".c-chart__note");n?(c||(c=document.createElement("div"),c.className="c-chart__note",this.appendChild(c)),c.textContent=n):c&&c.remove()}else{this._renderedBins=[],this._renderedBackground=[];const t=this.ensure(".c-chart__plot",()=>{const t=document.createElement("div");return t.className="c-chart__plot",t});t.innerHTML="";const e=document.createElement("div");e.className="c-chart__empty",e.textContent=this.getAttribute("empty")||"No data",e.style.display="grid",e.style.placeItems="center",e.style.height="100%",e.style.color="var(--color-text-muted)",t.appendChild(e);const s=this.getAttribute("note");let r=this.querySelector(".c-chart__note");s?(r||(r=document.createElement("div"),r.className="c-chart__note",this.appendChild(r)),r.textContent=s):r&&r.remove()}this._applyBrownout()}enhance(){if(this._wiredChart)return;this._wiredChart=!0,Zt(this);const t=this.parentElement||document,e=t=>{const e=t&&t.detail&&(null!=t.detail.key?t.detail.key:t.detail.label),s=t&&t.detail&&t.detail.index,r=t&&t.detail&&t.detail.pressed;if(null==e&&null==s)return;this.querySelectorAll("[data-series]").forEach(t=>{const i=t.getAttribute("data-series");(String(i)===String(e)||t.getAttribute("data-key")===String(e)||null!=s&&String(i)===String(s+1))&&(t.style.display=!1===r?"none":"")})};if(t.addEventListener("contour:legend-toggle",e),i(this,()=>t.removeEventListener("contour:legend-toggle",e)),this.addEventListener("contour:brush-end",t=>{this._showsBrush()&&t.target&&t.target.matches("contour-brush")&&(void 0!==this._rangeOverride&&t.detail&&Array.isArray(t.detail.range)&&(this._rangeOverride=t.detail.range.slice()),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:t.detail})))}),this.hasAttribute("zoomable")){let t=1,e=0,s=0;const r=this.querySelector(".c-chart__plot"),a=()=>{r&&(r.style.transform=`translate(${e}px, ${s}px) scale(${t})`,r.style.transformOrigin="center center")};this.addEventListener("wheel",e=>{e.preventDefault();const s=e.deltaY<0?1.1:.9;t=Math.min(5,Math.max(.5,t*s)),a()},{passive:!1});let n=!1,o=0,c=0,l=0,u=0;this.addEventListener("mousedown",t=>{0===t.button&&(n=!0,o=t.clientX,c=t.clientY,l=e,u=s,this.style.cursor="grabbing")});const d=t=>{n&&(e=l+(t.clientX-o),s=u+(t.clientY-c),a())},h=()=>{n&&(n=!1,this.style.cursor="")};window.addEventListener("mousemove",d),window.addEventListener("mouseup",h),i(this,()=>{window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",h)}),this.addEventListener("dblclick",()=>{t=1,e=0,s=0,a()})}let s=null,r=null;const a=()=>{s=null},n=t=>{const e=this.querySelector(".c-chart__plot"),i=this.querySelector(".c-chart__tooltip");if(!e||!i)return;const n=t.target&&t.target.closest?t.target.closest(".c-chart__bar, .c-chart__point, .c-chart__line, .c-donut__slice"):null;if(!n||!e.contains(n))return void i.setAttribute("hidden","");const o=n.getAttribute("data-title")||n.getAttribute("title");o&&(i.textContent=o),s||(s=e.getBoundingClientRect(),r||"function"!=typeof ResizeObserver||(r=new ResizeObserver(a),r.observe(e)));const c=s,l=n.getBoundingClientRect(),u=l.left-c.left+l.width/2,d=l.top-c.top;e.style.setProperty("--chart-tip-inline-start",u+"px"),e.style.setProperty("--chart-tip-block-start",d+"px"),i.removeAttribute("hidden")},o=()=>{const t=this.querySelector(".c-chart__tooltip");t&&t.setAttribute("hidden","")};this.addEventListener("mousemove",n),this.addEventListener("mouseleave",o),i(this,()=>{r&&(r.disconnect(),r=null)}),this.addEventListener("focusin",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-chart__bar, .c-chart__point, .c-chart__line, .c-donut__slice"):null;if(e&&this.contains(e)){n({target:e});const t=this.querySelector(".c-chart__tooltip");t&&t.id&&e.setAttribute("aria-describedby",t.id)}}),this.addEventListener("focusout",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-chart__bar, .c-chart__point, .c-chart__line, .c-donut__slice"):null;e&&this.contains(e)&&e.removeAttribute("aria-describedby"),this.contains(t.relatedTarget)||o()}),this.addEventListener("click",t=>{const e=this.querySelector(".c-chart__plot");if(!e)return;const s=t.target&&t.target.closest?t.target.closest(".c-chart__bar"):null;if(s&&e.contains(s)){const t=parseInt(s.getAttribute("data-series")||"1",10),e=parseInt(s.dataset.index||"0",10);return void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:t,index:e}}))}const r=t.target&&t.target.closest?t.target.closest(".c-chart__point"):null;if(r&&e.contains(r)){const t=parseInt(r.getAttribute("data-series")||"1",10),e=parseInt(r.dataset.index||"0",10);return void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:t,index:e}}))}const i=t.target&&t.target.closest?t.target.closest(".c-donut__slice"):null;if(i&&e.contains(i)){const t=parseInt(i.getAttribute("data-series")||"1",10),e=parseInt(i.dataset.index||"0",10);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:t,index:e,value:i.getAttribute("data-title")||i.getAttribute("title")}}))}}),this.addEventListener("keydown",t=>{const e=this.querySelector(".c-chart__plot");if(!e)return;const s=t.target&&t.target.closest?t.target.closest(".c-chart__bar"):null;if(s&&e.contains(s)){if("Enter"===t.key||" "===t.key){t.preventDefault();const e=parseInt(s.getAttribute("data-series")||"1",10),r=parseInt(s.dataset.index||"0",10);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:e,index:r}}))}const r=s.getAttribute("data-series");if(r){const i=parseInt(r,10),a=Array.from(e.querySelectorAll('.c-chart__bar[data-series="'+i+'"]'));a.indexOf(s)>=0&&z(t,a,{wrap:!1,rtl:I(this),onNavigate:t=>a.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{}})}return}const r=t.target&&t.target.closest?t.target.closest(".c-donut__slice"):null;if(r&&e.contains(r)){const s=parseInt(r.getAttribute("data-series")||"1",10);if("Enter"===t.key||" "===t.key){t.preventDefault();const e=parseInt(r.dataset.index||"0",10);return void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:s,index:e,value:r.getAttribute("data-title")||r.getAttribute("title")}}))}const i=Array.from(e.querySelectorAll('.c-donut__slice[data-series="'+s+'"]'));return void z(t,i,{wrap:!1,rtl:I(this),onNavigate:t=>i.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{}})}const i=t.target&&t.target.closest?t.target.closest(".c-chart__point"):null;if(!i||!e.contains(i))return;const a=parseInt(i.getAttribute("data-series")||"1",10),n=Array.from(e.querySelectorAll('.c-chart__point[data-series="'+a+'"]'));n.indexOf(i);if("Enter"===t.key||" "===t.key){t.preventDefault();const e=parseInt(i.dataset.index||"0",10);return void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:a,index:e}}))}z(t,n,{wrap:!1,rtl:I(this),onNavigate:t=>n.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{}})}),this.addEventListener("keydown",t=>{if(t.target!==this)return;let e=0;try{e=JSON.parse(this.getAttribute("series")||"[]").length}catch(t){e=0}if(0===e)return;void 0===this._activeSeries&&(this._activeSeries=0);let s=this._activeSeries;const r="rtl"===(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase();if("ArrowRight"===t.key)s=r?Math.max(this._activeSeries-1,0):Math.min(this._activeSeries+1,e-1);else if("ArrowLeft"===t.key)s=r?Math.min(this._activeSeries+1,e-1):Math.max(this._activeSeries-1,0);else if("ArrowDown"===t.key)s=Math.min(this._activeSeries+1,e-1);else if("ArrowUp"===t.key)s=Math.max(this._activeSeries-1,0);else if("Home"===t.key)s=0;else{if("End"!==t.key)return"Enter"===t.key||" "===t.key?(t.preventDefault(),void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:this._activeSeries}}))):void 0;s=e-1}s!==this._activeSeries&&(t.preventDefault(),this._activeSeries=s,this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:s}})))}),this.addEventListener("contour:clear-all",()=>{this.hasAttribute("brush")&&(this.removeAttribute("brush"),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"chart",filter:{brush:null}}})),this.requestRender())})}});c("contour-comparison",class extends T{static get observed(){return["divider","value","before","after","before-src","after-src"]}static get properties(){return{divider:{attribute:"divider"},value:{attribute:"value"},before:{attribute:"before"},after:{attribute:"after"},beforeSrc:{attribute:"before-src"},afterSrc:{attribute:"after-src"}}}render(){this.classList.add("c-comparison"),this.setAttribute("role","group");const t="Comparison",e=this.getAttribute("aria-label");null!==e&&e!==this._lastAutoAria||(this.setAttribute("aria-label",t),this._lastAutoAria=t),this.style.blockSize||(this.style.blockSize="12rem");const s=this.getAttribute("value");this.style.setProperty("--comparison-pos",(s??"50")+"%");const r=this.getAttribute("before")??"Before",i=this.getAttribute("after")??"After";if(!this.querySelector(".c-comparison__pane--before")){const t=document.createElement("div");t.className="c-comparison__pane c-comparison__pane--before",this.appendChild(t)}if(!this.querySelector(".c-comparison__pane:not(.c-comparison__pane--before)")){const t=document.createElement("div");t.className="c-comparison__pane",this.appendChild(t)}const a=(t,e,s)=>{if(!t)return;let r=t.querySelector(".c-comparison__media--"+s);e?(r||(r=document.createElement("img"),r.className="c-comparison__media c-comparison__media--"+s,r.alt="",t.prepend(r)),r.getAttribute("src")!==e&&r.setAttribute("src",e)):r&&r.remove()};a(this.querySelector(".c-comparison__pane--before"),this.getAttribute("before-src"),"before"),a(this.querySelector(".c-comparison__pane:not(.c-comparison__pane--before)"),this.getAttribute("after-src"),"after");const n=this.querySelector(".c-comparison__pane--before");if(n){let t=n.querySelector(".c-comparison__label--before");t||(t=document.createElement("span"),t.className="c-comparison__label c-comparison__label--before",n.appendChild(t)),t.textContent=r}const o=this.querySelector(".c-comparison__pane:not(.c-comparison__pane--before)");if(o){let t=o.querySelector(".c-comparison__label--after");t||(t=document.createElement("span"),t.className="c-comparison__label c-comparison__label--after",o.appendChild(t)),t.textContent=i}const c=this.getAttribute("divider");if(null!==c){const t=this.ensure(".c-comparison__divider",()=>{const t=document.createElement("div");return t.className="c-comparison__divider",t.setAttribute("role","slider"),t.setAttribute("aria-orientation","vertical"),t.setAttribute("aria-valuemin","0"),t.setAttribute("aria-valuemax","100"),t.setAttribute("aria-valuenow",String(Math.round(parseFloat(s??"50")))),t.setAttribute("aria-label",k(this,"comparison-divider","Comparison divider")),t.setAttribute("tabindex","0"),t});c&&(t.textContent=c)}else{const t=this.querySelector(".c-comparison__divider");t&&t.remove()}}enhance(){if(this._wiredComparison)return;this._wiredComparison=!0;const t=()=>this.querySelector(".c-comparison__divider"),e=t=>{const e=Math.max(0,Math.min(100,t));this.style.setProperty("--comparison-pos",e+"%"),this.setAttribute("value",String(Math.round(e)));const s=this.querySelector(".c-comparison__divider");s&&s.setAttribute("aria-valuenow",String(Math.round(e))),this.dispatchEvent(new CustomEvent("contour:drag",{bubbles:!0,composed:!0,detail:{value:e}}))};let s=!1;const r=t=>{if(!s)return;const r=this.getBoundingClientRect(),i=(t.clientX-r.left)/r.width*100;e(i)},a=()=>{s=!1,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",a)};i(this,()=>{s=!1,window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",a)}),this.addEventListener("pointerdown",r=>{const i=t();if(!i||!i.contains(r.target))return;s=!0;try{this.setPointerCapture(r.pointerId)}catch(t){}const a=this.getBoundingClientRect(),n=(r.clientX-a.left)/a.width*100;e(n),r.preventDefault()}),this.addEventListener("pointermove",t=>{if(!s)return;const r=this.getBoundingClientRect(),i=(t.clientX-r.left)/r.width*100;e(i)});const n=()=>{s=!1;try{this.releasePointerCapture&&this.releasePointerCapture(this._comparisonPointer)}catch(t){}this._comparisonPointer=null};this.addEventListener("pointerup",n),this.addEventListener("pointercancel",n),i(this,()=>{this.removeEventListener("pointerup",n),this.removeEventListener("pointercancel",n)}),this.addEventListener("keydown",s=>{const r=t();if(!r||document.activeElement!==r)return;const i=parseFloat(this.style.getPropertyValue("--comparison-pos"))||50;"ArrowLeft"===s.key?(s.preventDefault(),e(i-5)):"ArrowRight"===s.key?(s.preventDefault(),e(i+5)):"Home"===s.key?(s.preventDefault(),e(0)):"End"===s.key&&(s.preventDefault(),e(100))})}});c("contour-streaming-chart",class extends T{static get updateMode(){return"keyed"}static get observed(){return["line","dot","values","interval","pause","brownout","brownout-level","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{line:{attribute:"line"},dot:{attribute:"dot"},interval:{attribute:"interval",type:Number},pause:{attribute:"pause",type:Boolean},src:{attribute:"src"}}}get values(){return(this._valuesNums||[]).slice()}set values(t){this._pushedValues=ee(Array.isArray(t)?t.map(Number).filter(Number.isFinite):[]),this.requestRender()}render(){this.classList.add("c-streaming-chart"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"streaming-chart","Streaming chart")),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");let t=this.querySelector(".c-streaming-chart__pause");t||(t=document.createElement("button"),t.className="c-btn c-btn--icon c-btn--ghost c-btn--sm c-streaming-chart__pause",t.type="button",this.appendChild(t));const e=!!this._streamPausedByUser;if(t.setAttribute("aria-pressed",String(e)),t.setAttribute("aria-label",e?k(this,"play-stream","Play stream"):k(this,"pause-stream","Pause stream")),L(t,e?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-play" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-pause" /></svg>'),Zt(this),$t(this,["line","values"]),Xt(this,"streaming-chart"))return;let s=Jt(this,"line"),r=Jt(this,"dot"),i=this._pushedValues;if(void 0===i){i=null;const t=Jt(this,"values");if(t)try{const e=JSON.parse(t);Array.isArray(e)?i=e:f(this,"values",new Error("not an array"))}catch(t){f(this,"values",t)}}if(i=ee((i||[]).map(Number).filter(Number.isFinite)),this._valuesNums=[],!s&&i.length>1&&(s=W(i,{width:300,height:192}),this._valuesNums=i,!r)){const t=function(t,e){const s=null!=(e=e||{}).width?e.width:300,r=null!=e.height?e.height:120,i=t.map(t=>Number(t)||0);if(!i.length)return"";const a=null!=e.max?e.max:Math.max.apply(null,i),n=null!=e.min?e.min:Math.min.apply(null,i),o=Number.isFinite(a-n)&&a-n!==0?a-n:1,c=i.length||1;return i.map((t,e)=>{const i=e/Math.max(1,c-1)*s,a=r-(t-n)/o*r;return i.toFixed(2)+","+a.toFixed(2)}).join(" ")}(i,{width:300,height:192}).split(" ");r=t[t.length-1]}if(!s){const t=this.querySelector(":scope > .c-streaming-chart__plot");return t&&t.remove(),void Yt(this,"streaming-chart")}if(s){let t=this.querySelector(":scope > .c-streaming-chart__plot");t||(t=document.createElementNS("http://www.w3.org/2000/svg","svg"),t.setAttribute("class","c-streaming-chart__plot"),t.setAttribute("viewBox","0 0 300 192"),t.setAttribute("aria-hidden","true"),this.appendChild(t));let e=t.querySelector(".c-streaming-chart__line");if(e||(e=document.createElementNS("http://www.w3.org/2000/svg","path"),e.setAttribute("class","c-streaming-chart__line"),t.appendChild(e)),e.setAttribute("d",s),r&&!this.shed("dot",2)){let e=t.querySelector(".c-streaming-chart__live-dot");e||(e=document.createElementNS("http://www.w3.org/2000/svg","circle"),e.setAttribute("class","c-streaming-chart__live-dot"),e.setAttribute("r","4"),t.appendChild(e));const s=r.split(/[ ,]+/);s.length>=2&&(e.setAttribute("cx",s[0]),e.setAttribute("cy",s[1]))}else{const e=t.querySelector(".c-streaming-chart__live-dot");e&&e.remove()}}}enhance(){const t=()=>{const t=parseFloat(this.getAttribute("interval")||""),e=Number.isFinite(t)&&t>0&&!this.hasAttribute("pause")&&!this._streamPausedByUser&&!1!==this._viewVisible;e!==this._streamRunning&&(this._streamRunning=e,void 0!==this._streamTimer&&(clearInterval(this._streamTimer),this._streamTimer=void 0),this.dispatchEvent(new CustomEvent("contour:stream-state",{detail:{running:e},bubbles:!0,composed:!0})),e&&(this._streamTimer=setInterval(()=>{if(!this.isConnected||this.hasAttribute("pause"))return;this._streamFrame+=1,this.dispatchEvent(new CustomEvent("contour:tick",{detail:{frame:this._streamFrame},bubbles:!0,composed:!0}));const t=this.getAttribute("src");var e;t&&(e=t,It.delete(e),this.requestRender())},Math.max(1e3,1e3*t))))};t(),this._wiredStreamView||(this._wiredStreamView=!0,this._viewVisible=!0,function(t){if(t._contourViewWired)return()=>{};t._contourViewWired=!0;const e=e=>t.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}));if("function"!=typeof IntersectionObserver)return e("contour:view-enter"),()=>{};const s=new IntersectionObserver(t=>{for(const s of t)s.isIntersecting?e("contour:view-enter"):e("contour:view-leave")});s.observe(t),i(t,()=>s.disconnect())}(this),this.addEventListener("contour:view-enter",()=>{this._viewVisible=!0,t()}),this.addEventListener("contour:view-leave",()=>{this._viewVisible=!1,t()})),this._wiredStream||(this._wiredStream=!0,this._streamFrame=0,i(this,()=>{void 0!==this._streamTimer&&(clearInterval(this._streamTimer),this._streamTimer=void 0)}),this._streamPausedByUser=!1,this.addEventListener("click",e=>{const s=e.target,r=this.querySelector(".c-streaming-chart__pause");r&&(s===r||r.contains(s))&&(e.preventDefault(),this._streamPausedByUser=!this._streamPausedByUser,r.setAttribute("aria-pressed",String(this._streamPausedByUser)),r.setAttribute("aria-label",this._streamPausedByUser?"Play stream":"Pause stream"),L(r,this._streamPausedByUser?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-play" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-pause" /></svg>'),this._streamPausedByUser?(this.setAttribute("data-user-paused",""),this.setAttribute("data-motion","paused")):(this.removeAttribute("data-user-paused"),this.removeAttribute("data-motion")),t())}),this.addEventListener("keydown",e=>{if(" "===e.key||"Enter"===e.key){e.preventDefault(),this._streamPausedByUser=!this._streamPausedByUser,this._streamPausedByUser?(this.setAttribute("data-user-paused",""),this.setAttribute("data-motion","paused")):(this.removeAttribute("data-user-paused"),this.removeAttribute("data-motion"));const s=this.querySelector(".c-streaming-chart__pause");s&&(s.setAttribute("aria-pressed",String(this._streamPausedByUser)),s.setAttribute("aria-label",this._streamPausedByUser?"Play stream":"Pause stream")),t()}}))}});c("contour-reference-rule",class extends T{static get observed(){return["value","direction","label","band"]}static get properties(){return{value:{attribute:"value"},direction:{attribute:"direction"},label:{attribute:"label"},band:{attribute:"band"}}}render(){this.classList.add("c-reference-rule");const t=this.getAttribute("direction")||"horizontal";this.setAttribute("data-direction",t);let e=this.querySelector(".c-reference-rule__line");e||(e=document.createElement("div"),e.className="c-reference-rule__line",this.appendChild(e));const s=this.getAttribute("band");s?this.setAttribute("data-band",s):this.removeAttribute("data-band");const r=this.getAttribute("label");let i=this.querySelector(".c-reference-rule__label");r?(i||(i=document.createElement("span"),i.className="c-reference-rule__label",this.appendChild(i)),i.textContent=r):i&&i.remove()}});c("contour-meter",class extends T{static get observed(){return["value","label","variant","min","max","low","high","optimum","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}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(){if(this.classList.add("c-meter"),Zt(this),$t(this,["value","label"]),Xt(this,"meter"))return;const t=Jt(this,"value")||this._remoteData&&this._remoteData.value,e=Jt(this,"label")||this._remoteData&&this._remoteData.label||"",s=this.getAttribute("variant");if(Array.from(this.classList).forEach(t=>{t.startsWith("c-meter--")&&this.classList.remove(t)}),s&&this.classList.add("c-meter--"+s),!t&&!e)return void Yt(this,"meter");if(null===t)this.style.removeProperty("--meter-value");else{const e=parseFloat(t),s=parseFloat(this.getAttribute("min"))||0,r=parseFloat(this.getAttribute("max"))||100;if(Number.isFinite(e)){const t=r>s?Math.min(1,Math.max(0,(e-s)/(r-s))):0;this.style.setProperty("--meter-value",String(t))}else this.style.removeProperty("--meter-value")}const r=this.ensure(".c-meter__core",()=>{const t=document.createElement("span");return t.className="c-meter__core",t});let i=r.querySelector(".c-meter__value");i||(i=document.createElement("span"),i.className="c-meter__value",r.appendChild(i));const a=parseFloat(t),n=parseFloat(this.getAttribute("min"))||0,o=parseFloat(this.getAttribute("max"))||100,c=Number.isFinite(a)&&o>n?Math.min(1,Math.max(0,(a-n)/(o-n))):0;if(i.textContent=Math.round(100*c)+"%",e){(r.querySelector(".c-meter__label")||(()=>{const t=document.createElement("span");return t.className="c-meter__label",r.appendChild(t),t})()).textContent=e}this.hasAttribute("role")||this.setAttribute("role","meter"),e&&!this.hasAttribute("aria-label")&&this.setAttribute("aria-label",e);const l=Number.isFinite(a)?String(a):"0",u=this._meterAriaValue;this.hasAttribute("aria-valuenow")&&this.getAttribute("aria-valuenow")!==u||(this.setAttribute("aria-valuenow",l),this._meterAriaValue=l);const d=this.getAttribute("min"),h=this.getAttribute("max");null!==d?this.setAttribute("aria-valuemin",d):this.setAttribute("aria-valuemin",String(n)),null!==h?this.setAttribute("aria-valuemax",h):this.setAttribute("aria-valuemax",String(o));for(const t of["low","high","optimum"]){const e=this.getAttribute(t);null!==e?this.setAttribute("data-"+t,e):this.removeAttribute("data-"+t)}}});c("contour-delta",class extends T{static get observed(){return["value","direction","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{value:{attribute:"value"},direction:{attribute:"direction"},src:{attribute:"src"}}}render(){if(this.classList.add("c-delta"),Zt(this),$t(this,"value"),Xt(this,"delta"))return;const t=Jt(this,"value")||"";Array.from(this.classList).forEach(t=>{t.startsWith("c-delta--")&&this.classList.remove(t)});const e=this.getAttribute("direction")||this._remoteData&&this._remoteData.direction||"up";if(!t)return void Yt(this,"delta");this.classList.add("c-delta--"+e);const s={up:"#i-arrow-up",down:"#i-arrow-down",flat:"#i-minus"}[e]||"#i-arrow-up";this.querySelectorAll("svg").forEach(t=>t.remove());const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("aria-hidden","true");const i=document.createElementNS("http://www.w3.org/2000/svg","use");i.setAttribute("href",s),r.appendChild(i),this.appendChild(r),this.appendChild(document.createTextNode(" "+t))}});c("contour-stat",class extends T{static get observed(){return["value","label","delta","unit","format","locale","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}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(){if(this.classList.add("c-stat"),Zt(this),$t(this,["value","label"]),Xt(this,"stat"))return;const t=Jt(this,"value"),e=Jt(this,"label"),s=this.getAttribute("delta");if(t){this.ensure(".c-stat__value",()=>{const t=document.createElement("div");return t.className="c-stat__value",t.setAttribute("aria-live","polite"),t}).textContent=B(t,this.getAttribute("format"),this.getAttribute("locale"),this.getAttribute("unit"))}else{const t=this.querySelector(".c-stat__value");t&&t.remove()}if(e){this.ensure(".c-stat__label",()=>{const t=document.createElement("div");return t.className="c-stat__label",t}).textContent=e}else{const t=this.querySelector(".c-stat__label");t&&t.remove()}if(s){this.ensure(".c-stat__delta",()=>{const t=document.createElement("div");return t.className="c-stat__delta",t}).textContent=s}else{const t=this.querySelector(".c-stat__delta");t&&t.remove()}const r=this.getAttribute("unit"),i=this.querySelector(".c-stat__value");if(i)if(r){let t=i.querySelector(".c-stat__unit");t||(t=document.createElement("span"),t.className="c-stat__unit",i.appendChild(t)),t.textContent=r}else{const t=i.querySelector(".c-stat__unit");t&&t.remove()}t||e||Yt(this,"stat")}});c("contour-gauge",class extends T{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","cache-key","no-cache"]}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(){if(this.classList.add("c-gauge"),Zt(this),$t(this,["value"]),Xt(this,"gauge"))return;const t=this.getAttribute("value"),e=parseFloat(t),s=null!==t&&""!==t&&Number.isFinite(e),r=Number.isFinite(parseFloat(this.getAttribute("min")))?parseFloat(this.getAttribute("min")):0,i=Number.isFinite(parseFloat(this.getAttribute("max")))?parseFloat(this.getAttribute("max")):100,a=this.getAttribute("heading"),n="false"!==this.getAttribute("show-header"),c=this.getAttribute("description"),l=this.getAttribute("no-data-message")||"No readings in view";this.brownoutLevel();if(!s){if(a&&n){this.ensure(".c-gauge__title",()=>{const t=document.createElement("div");return t.className="c-gauge__title",t}).textContent=a}return this.ensure(".c-gauge__empty",()=>{const t=document.createElement("div");return t.className="c-gauge__empty",t.setAttribute("part","empty"),t}).textContent=l,void[".c-gauge__dial",".c-gauge__value",".c-gauge__band"].forEach(t=>{const e=this.querySelector(t);e&&e.remove()})}if(a&&n){this.ensure(".c-gauge__title",()=>{const t=document.createElement("div");return t.className="c-gauge__title",t.setAttribute("part","title"),t}).textContent=a}else{const t=this.querySelector(".c-gauge__title");t&&t.remove()}let u=[];const d=this.getAttribute("thresholds");if(d)try{const t=JSON.parse(d);Array.isArray(t)?u=t:f(this,"thresholds",new Error("not an array"))}catch(t){u=[]}let h=null;if(u&&u.length){const t=[...u].sort((t,e)=>(t.value||0)-(e.value||0));for(let s=t.length-1;s>=0;s--)if(e>=(t[s].value||0)){h=t[s];break}}const m=this.shed("dial",3);let b=this.querySelector(".c-gauge__dial");if(m)b&&b.remove();else{b||(b=document.createElementNS("http://www.w3.org/2000/svg","svg"),b.setAttribute("class","c-gauge__dial"),b.setAttribute("part","dial"),b.setAttribute("aria-hidden","true"),b.setAttribute("viewBox","0 0 100 100"),this.appendChild(b)),b.innerHTML="";const t=document.createElementNS("http://www.w3.org/2000/svg","path");if(t.setAttribute("class","c-gauge__track"),t.setAttribute("d","M 10 90 A 40 40 0 0 1 90 90"),b.appendChild(t),u&&u.length){const t=[...u].sort((t,e)=>(t.value||0)-(e.value||0)),e=t=>{const e=(1-(t-r)/(i-r||1))*Math.PI;return{x:50+40*Math.cos(e),y:90-40*Math.sin(e)}};for(let s=0;s<t.length;s++){const r=t[s].value||0,a=s+1<t.length&&t[s+1].value||i,n=e(r),o=e(a),c=document.createElementNS("http://www.w3.org/2000/svg","path");c.setAttribute("class","c-gauge__zone"),c.setAttribute("stroke",t[s].color||"var(--color-primary)"),c.setAttribute("d","M "+n.x.toFixed(2)+" "+n.y.toFixed(2)+" A 40 40 0 0 1 "+o.x.toFixed(2)+" "+o.y.toFixed(2)),b.appendChild(c)}}const s=Math.max(0,Math.min(1,(e-r)/(i-r||1))),a=Math.PI*(1-s),n=document.createElementNS("http://www.w3.org/2000/svg","line");n.setAttribute("class","c-gauge__needle needle"),n.setAttribute("x1","50"),n.setAttribute("y1","90"),n.setAttribute("x2",String(50+35*Math.cos(a))),n.setAttribute("y2",String(90-35*Math.sin(a))),b.appendChild(n);const o=document.createElementNS("http://www.w3.org/2000/svg","circle");o.setAttribute("class","c-gauge__hub hub"),o.setAttribute("cx","50"),o.setAttribute("cy","90"),o.setAttribute("r","4"),b.appendChild(o)}const p=this.ensure(".c-gauge__value",()=>{const t=document.createElement("div");return t.className="c-gauge__value",t.setAttribute("part","value"),t});p.textContent=B(String(e),this.getAttribute("format"),this.getAttribute("locale"))+(this.getAttribute("unit")?" "+this.getAttribute("unit"):""),p.setAttribute("role","meter");const g=Math.max(r,Math.min(i,e));p.setAttribute("aria-valuenow",String(g)),p.setAttribute("aria-valuemin",String(r)),p.setAttribute("aria-valuemax",String(i)),a&&(p.id||(p.id=o("gauge-value"))),h?p.setAttribute("aria-valuetext",e+", "+(h.label||">= "+h.value)):p.setAttribute("aria-valuetext",String(e));const _=this.querySelector(".c-gauge__title");_?(_.id||(_.id=o("gauge-title")),p.setAttribute("aria-labelledby",_.id),p.removeAttribute("aria-label")):(p.removeAttribute("aria-labelledby"),a?p.setAttribute("aria-label",a):p.setAttribute("aria-label",p.textContent||"Gauge"));const v=this.querySelector(".c-gauge__band");if(h){this.ensure(".c-gauge__band",()=>{const t=document.createElement("div");return t.className="c-gauge__band",t.setAttribute("part","band"),t}).textContent=h.label||">= "+h.value}else v&&v.remove();if(c){let t=this.querySelector(".c-gauge__desc");t||(t=document.createElement("div"),t.className="c-gauge__desc",this.appendChild(t)),t.textContent=c}}enhance(){}});c("contour-axis",class extends T{static get observed(){return["orientation","values","ticks","format","locale","min","max","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{orientation:{attribute:"orientation"},values:{attribute:"values"},ticks:{attribute:"ticks"},format:{attribute:"format"},locale:{attribute:"locale"},min:{attribute:"min"},max:{attribute:"max"},src:{attribute:"src"}}}render(){this.classList.add("c-axis"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"axis","Axis"));const t=this.getAttribute("orientation")||"horizontal";if(this.classList.toggle("c-axis--horizontal","horizontal"===t),this.classList.toggle("c-axis--vertical","vertical"===t),"horizontal"===t?this.setAttribute("part","axis-x"):this.setAttribute("part","axis-y"),Zt(this),$t(this,["values"]),Xt(this,"axis"))return;let e=[];const s=this.getAttribute("values");if(s)try{e=JSON.parse(s)}catch(t){e=s.split(",").map(t=>t.trim())}const r=parseInt(this.getAttribute("ticks")||"0",10)||e.length,i=Array.from(this.querySelectorAll(":scope > .c-axis__tick"));if(this.classList.toggle("c-axis--value-ticks",!i.length),i.length)i.forEach(t=>{const e=t.querySelector(".c-axis__label");e&&!e.textContent&&(e.textContent=t.textContent)});else{Array.from(this.querySelectorAll(".c-axis__tick")).forEach(t=>t.remove());const t=e.length?e:Array.from({length:r},(t,e)=>e),s=t.map(t=>Number(t)).filter(Number.isFinite);let i=s.length?Math.min(...s):0,a=s.length?Math.max(...s):0;const n=parseFloat(this.getAttribute("min")),o=parseFloat(this.getAttribute("max"));Number.isFinite(n)&&(i=n),Number.isFinite(o)&&(a=o);const c=a-i||1;t.forEach(t=>{const e=document.createElement("span");e.className="c-axis__tick";const s=document.createElement("span");s.className="c-axis__label",s.textContent=B(String(t),this.getAttribute("format"),this.getAttribute("locale")),e.appendChild(s);const r=Number(t);e.style.setProperty("--tick-pos",Number.isFinite(r)?(r-i)/c*100+"%":"0%"),this.appendChild(e)})}}enhance(){}});c("contour-brush",class extends T{static get observed(){return["start","end","min","max","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{start:{attribute:"start"},end:{attribute:"end"},min:{attribute:"min"},max:{attribute:"max"},src:{attribute:"src"}}}_rangeValue(){const t=parseFloat(this.getAttribute("start")),e=parseFloat(this.getAttribute("end"));return Number.isFinite(t)&&Number.isFinite(e)?[t,e]:null}_brushDetail(){const t=this._rangeValue();return{start:t?t[0]:null,end:t?t[1]:null,value:t?t[1]:null,range:t}}render(){if(this.classList.add("c-brush"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"brush-selection","Brush selection")),Zt(this),$t(this,[]),Xt(this,"brush"))return;let t=this.querySelector(".c-brush__selection");t||(t=document.createElement("div"),t.className="c-brush__selection",this.appendChild(t));const e=parseFloat(this.getAttribute("start")||"0"),s=parseFloat(this.getAttribute("end")||"100"),r=parseFloat(this.getAttribute("min")||"0"),i=parseFloat(this.getAttribute("max")||"100"),a=i-r||1,n=(e-r)/a*100,o=(s-e)/a*100;t.style.insetInlineStart=n+"%",t.style.inlineSize=o+"%",["start","end"].forEach(t=>{let n=this.querySelector(".c-brush__handle--"+t);n||(n=document.createElement("div"),n.className="c-brush__handle c-brush__handle--"+t,this.appendChild(n));const o="start"===t?e:s;n.style.insetInlineStart=(o-r)/a*100+"%",n.setAttribute("role","slider"),n.setAttribute("tabindex","0"),n.setAttribute("aria-valuemin",String(r)),n.setAttribute("aria-valuemax",String(i)),n.setAttribute("aria-valuenow",String(o)),n.setAttribute("aria-label","start"===t?"Start":"End")})}enhance(){if(this._wiredBrush)return;this._wiredBrush=!0;let t=null;const e=()=>parseFloat(this.getAttribute("min")||"0"),s=()=>parseFloat(this.getAttribute("max")||"100"),r=t=>{const r=this.getBoundingClientRect(),i=Math.max(0,Math.min(1,(t-r.left)/(r.width||1)));return e()+i*(s()-e())};this.addEventListener("pointerdown",e=>{const s=e.target&&e.target.classList&&e.target.classList.contains("c-brush__handle")?e.target:null;t=s?s.classList.contains("c-brush__handle--start")?"start":"end":"move";try{this.setPointerCapture(e.pointerId)}catch(t){}this.dispatchEvent(new CustomEvent("contour:brush-start",{bubbles:!0,composed:!0,detail:this._brushDetail()}))}),this.addEventListener("pointermove",i=>{if(!t)return;const a=r(i.clientX),n=e(),o=s(),c=o-n||1,l=this.querySelector(".c-brush__selection");let u=parseFloat(this.getAttribute("start")||"0"),d=parseFloat(this.getAttribute("end")||"100");if("start"===t)u=Math.min(a,d);else if("end"===t)d=Math.max(a,u);else{const t=d-u;u=a-t/2,d=a+t/2,u<n&&(d+=n-u,u=n),d>o&&(u-=d-o,d=o)}u=Math.max(n,Math.min(o,u)),d=Math.max(n,Math.min(o,d)),l&&(l.style.insetInlineStart=(u-n)/c*100+"%",l.style.inlineSize=(d-u)/c*100+"%");const h=this.querySelector(".c-brush__handle--start"),m=this.querySelector(".c-brush__handle--end");h&&(h.style.insetInlineStart=(u-n)/c*100+"%"),m&&(m.style.insetInlineStart=(d-n)/c*100+"%"),this._brushPending={start:u,end:d},this.dispatchEvent(new CustomEvent("contour:brush",{bubbles:!0,composed:!0,detail:{start:u,end:d,value:u,range:[u,d]}}))}),this.addEventListener("pointerup",e=>{if(!t)return;t=null;const s=this._brushPending;s&&(this.setAttribute("start",String(s.start)),this.setAttribute("end",String(s.end)),this._brushPending=null),this.dispatchEvent(new CustomEvent("contour:brush-end",{bubbles:!0,composed:!0,detail:this._brushDetail()})),this.dispatchEvent(new CustomEvent("contour:brush",{bubbles:!0,composed:!0,detail:this._brushDetail()}))}),this.addEventListener("pointercancel",()=>{t&&(t=null,this._brushPending=null,this.requestRender())}),this.addEventListener("keydown",t=>{const r=t.target&&t.target.classList&&t.target.classList.contains("c-brush__handle")?t.target:null,i=r?r.classList.contains("c-brush__handle--start")?"start":"end":null,a=e(),n=s(),o=(n-a)/100||1;let c=parseFloat(this.getAttribute("start")||"0"),l=parseFloat(this.getAttribute("end")||"100");if("Enter"===t.key||" "===t.key)return t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:brush-start",{bubbles:!0,composed:!0,detail:this._brushDetail()})),void this.dispatchEvent(new CustomEvent("contour:brush-end",{bubbles:!0,composed:!0,detail:this._brushDetail()}));let u=!0;if("ArrowLeft"===t.key||"ArrowDown"===t.key)if("start"===i)c-=o;else if("end"===i)l-=o;else{const t=l-c;c-=o,l=c+t}else if("ArrowRight"===t.key||"ArrowUp"===t.key)if("start"===i)c+=o;else if("end"===i)l+=o;else{const t=l-c;l+=o,c=l-t}else"Home"===t.key?"end"===i?l=c:c=a:"End"===t.key?"start"===i?c=l:l=n:u=!1;if(u){if(t.preventDefault(),c=Math.max(a,Math.min(n,c)),l=Math.max(a,Math.min(n,l)),c>l){const t=c;c=l,l=t}this.dispatchEvent(new CustomEvent("contour:brush-start",{bubbles:!0,composed:!0,detail:this._brushDetail()})),this.setAttribute("start",String(c)),this.setAttribute("end",String(l)),this.dispatchEvent(new CustomEvent("contour:brush",{bubbles:!0,composed:!0,detail:this._brushDetail()})),this.dispatchEvent(new CustomEvent("contour:brush-end",{bubbles:!0,composed:!0,detail:this._brushDetail()}))}}),this.addEventListener("contour:clear-all",()=>{(this.hasAttribute("start")||this.hasAttribute("end"))&&(this.removeAttribute("start"),this.removeAttribute("end"),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"brush",filter:{start:null,end:null}}})),this.requestRender())})}});c("contour-stacked-bar",class extends T{static get observed(){return["segments","values","colors","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","max","no-cache"]}static get properties(){return{segments:{attribute:"segments"},values:{attribute:"values"},colors:{attribute:"colors"},src:{attribute:"src"},max:{attribute:"max"}}}render(){if(this.classList.add("c-stacked-bar"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"stacked-bar","Stacked bar")),Zt(this),$t(this,["segments","values"]),Xt(this,"stacked-bar"))return;Array.from(this.querySelectorAll(".c-stacked-bar__segment")).forEach(t=>t.remove());const t=Array.from(this.querySelectorAll(":scope > .c-stacked-bar__segment"));let e=[];if(t.length)e=t.map(t=>({label:t.getAttribute("data-title")||t.getAttribute("title")||t.textContent||"",value:parseFloat(t.style.inlineSize)||0,color:t.dataset&&t.dataset.color||t.style.background||void 0})),t.forEach(t=>t.remove());else{this.getAttribute("segments")&&(e=Qt(this,"segments",f))}const s=e.map(t=>"object"==typeof t?t.value||0:Number(t)||0),r=s.some(t=>t<0),i=s.filter(t=>t>0).reduce((t,e)=>t+e,0),a=Math.abs(s.filter(t=>t<0).reduce((t,e)=>t+e,0)),n=i+a,o=Math.max(i,a,1),c=Math.max(1,parseFloat(this.getAttribute("max"))||(r?o:n));this.querySelectorAll(".c-stacked-bar__track").forEach(t=>t.remove());const l=(t,e,r)=>{const i=s[e],a=document.createElement("div");a.className="c-stacked-bar__segment"+(0===i?" c-stacked-bar__segment--zero":""),a.style.inlineSize=r+"%",a.style.background=_("object"==typeof t&&t.color?t.color:"var(--chart-"+(e%8+1)+")"),a.dataset.color="object"==typeof t&&t.color?t.color:a.style.background;const n="object"==typeof t&&t.label||"";return a.setAttribute("data-title",n+" "+i),a.setAttribute("role","img"),a.setAttribute("aria-label",(n?n+": ":"")+i),a};if(r){this.classList.add("c-stacked-bar--diverging");const t=document.createElement("div");t.className="c-stacked-bar__track c-stacked-bar__track--neg";const r=document.createElement("div");r.className="c-stacked-bar__track",e.forEach((e,i)=>{const a=s[i];if(0===a)return;const n=Math.abs(a)/c*100;(a<0?t:r).appendChild(l(e,i,n))}),this.appendChild(t),this.appendChild(r)}else{this.classList.remove("c-stacked-bar--diverging");const t=document.createElement("div");t.className="c-stacked-bar__track",e.forEach((e,r)=>t.appendChild(l(e,r,s[r]/c*100))),this.appendChild(t)}e.length||Yt(this,"stacked-bar")}enhance(){}});c("contour-category",class extends T{static get observed(){return["items","search","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","note","limit","sort","format","locale","unit","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"},note:{attribute:"note"},limit:{attribute:"limit"},sort:{attribute:"sort"},format:{attribute:"format"},locale:{attribute:"locale"},unit:{attribute:"unit"}}}render(){if(this.classList.add("c-category"),this.setAttribute("role","listbox"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"category","Category")),Zt(this),$t(this,["items"]),Xt(this,"category"))return;Array.from(this.querySelectorAll(".c-category__item")).forEach(t=>t.remove());const t=Array.from(this.querySelectorAll(":scope > .c-category__item"));let e=[];if(t.length)t.forEach(t=>{const s=t.querySelector(".c-category__label");e.push({label:s?s.textContent:t.textContent,value:0})}),t.forEach(t=>t.remove());else{this.getAttribute("items")&&(e=Qt(this,"items",f))}const s=this.getAttribute("sort")||"value-desc";e.sort((t,e)=>{const r="object"==typeof t?t.value||0:Number(t)||0,i="object"==typeof e?e.value||0:Number(e)||0,a="object"==typeof t?t.label||t.name||"":String(t),n="object"==typeof e?e.label||e.name||"":String(e);return"value-asc"===s?r-i:"alpha-asc"===s?String(a).localeCompare(String(n)):"alpha-desc"===s?String(n).localeCompare(String(a)):i-r});const r=parseInt(this.getAttribute("limit")||"0",10);r>0&&(e=e.slice(0,r));const i=e.reduce((t,e)=>Math.max(t,Math.abs("object"==typeof e?e.value||0:Number(e)||0)),0)||1;e.forEach((t,e)=>{const s="object"==typeof t?t.value||0:Number(t)||0,r="object"==typeof t?t.label||t.name||"":String(t),a=document.createElement("div");a.className="c-category__item",a.setAttribute("role","option"),a.setAttribute("aria-selected","false"),a.setAttribute("tabindex",0===e?"0":"-1");const n=document.createElement("span");n.className="c-category__label",n.textContent=r;const o=document.createElement("div");o.style.flex="1";const c=document.createElement("div");c.className="c-category__bar",c.style.inlineSize=Math.abs(s)/i*100+"%",o.appendChild(c);const l=document.createElement("span");l.className="c-category__value",l.textContent=B(s,this.getAttribute("format"),this.getAttribute("locale"),this.getAttribute("unit")),a.appendChild(n),a.appendChild(o),a.appendChild(l),this.appendChild(a)}),e.length||Yt(this,"category");const a=this.getAttribute("note");let n=this.querySelector(".c-category__note");a?(n||(n=document.createElement("div"),n.className="c-category__note",this.appendChild(n)),n.textContent=a):n&&n.remove()}enhance(){if(this._wiredCategory)return;this._wiredCategory=!0;const t=()=>Array.from(this.querySelectorAll(".c-category__item"));this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-category__item"):null;if(!s||!this.contains(s))return;const r=t(),i=r.indexOf(s);r.forEach((t,e)=>t.setAttribute("aria-selected",e===i?"true":"false")),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:i,label:s.querySelector(".c-category__label")?s.querySelector(".c-category__label").textContent:s.textContent.trim()}}))}),this.addEventListener("keydown",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-category__item"):null;if(!s||!this.contains(s))return;const r=t(),i=r.indexOf(s);if("Enter"===e.key||" "===e.key)return e.preventDefault(),r.forEach((t,e)=>t.setAttribute("aria-selected",e===i?"true":"false")),void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:i,label:s.querySelector(".c-category__label")?s.querySelector(".c-category__label").textContent:s.textContent.trim()}}));z(e,r,{wrap:!1,homeEnd:!0,rtl:I(this),onNavigate:t=>r.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{if("Enter"===e.key||" "===e.key){const t=r.indexOf(document.activeElement);r.forEach((e,s)=>e.setAttribute("aria-selected",s===t?"true":"false")),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:t,label:document.activeElement.querySelector(".c-category__label")?document.activeElement.querySelector(".c-category__label").textContent:document.activeElement.textContent.trim()}}))}}})}),this.addEventListener("contour:clear-all",()=>{this.hasAttribute("search")&&(this.removeAttribute("search"),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"category",filter:{search:null}}})))})}});c("contour-donut",class extends T{static get observed(){return["value","values","items","label","color","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","brownout","brownout-level","note","cache-key","no-cache"]}static get properties(){return{value:{attribute:"value"},values:{attribute:"values"},items:{attribute:"items"},label:{attribute:"label"},color:{attribute:"color"},src:{attribute:"src"},note:{attribute:"note"}}}render(){if(this.classList.add("c-donut"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"donut-chart","Donut chart")),Zt(this),$t(this,["items","values"]),Xt(this,"donut"))return;Array.from(this.querySelectorAll(".c-donut__ring, .c-donut__center, .c-donut__list, .c-donut__empty")).forEach(t=>t.remove());const t=Array.from(this.querySelectorAll(":scope > .c-donut__item"));let e=[];if(t.length)t.forEach(t=>{const s=t.querySelector(".c-donut__swatch"),r=t.querySelector("span:last-child"),i=r?r.textContent:t.textContent,a=i.match(/—\s*(\d+(?:\.\d+)?)$/);e.push({label:i.replace(/—\s*\d+(?:\.\d+)?$/,"").trim(),value:a?Number(a[1]):0,color:s?s.dataset&&s.dataset.color||s.style.background:void 0})}),t.forEach(t=>t.remove());else{this.getAttribute("items")&&(e=Qt(this,"items",f))}const s=e.map(t=>"object"==typeof t?t.value||0:Number(t)||0),r=s.reduce((t,e)=>t+(e>0?e:0),0)||1,i=(this.brownoutLevel(),this.getAttribute("color"));if(!this.shed("ring",3)){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("class","c-donut__ring"),t.setAttribute("viewBox","0 0 32 32"),t.setAttribute("role","img");const r=this.getAttribute("label")||"Donut chart";t.setAttribute("aria-label",r);$(s,{cx:16,cy:16,r:15,inner:9,gap:.03}).forEach((s,r)=>{const a=e[s.index],n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("class","c-donut__slice"),n.setAttribute("d",s.path),n.setAttribute("fill","var(--c, var(--chart-1))"),n.style.setProperty("--c",_(i||("object"==typeof a&&a.color?a.color:"var(--chart-"+(s.index%8+1)+")"))||"var(--chart-1)"),n.dataset.index=String(s.index);const o=("object"==typeof a?a.label||"":String(a))+" — "+s.value;n.setAttribute("data-title",o),n.setAttribute("aria-label",o),n.setAttribute("tabindex",0===r?"0":"-1"),n.setAttribute("role","button"),t.appendChild(n)}),this.appendChild(t)}const a=document.createElement("div");a.className="c-donut__center",a.textContent=this.getAttribute("value")??String(r),this.appendChild(a);const n=document.createElement("div");n.className="c-donut__list",n.setAttribute("role","list"),e.forEach((t,e)=>{const r=document.createElement("div");r.className="c-donut__item",r.setAttribute("role","listitem");const a=document.createElement("span");a.className="c-donut__swatch",a.style.background=_(i||("object"==typeof t&&t.color?t.color:"var(--chart-"+(e%8+1)+")")),a.style.background&&(a.dataset.color=i||("object"==typeof t&&t.color?t.color:a.style.background)),r.appendChild(a);const o=document.createElement("span");o.textContent=("object"==typeof t?t.label||"":String(t))+" — "+s[e],r.appendChild(o),n.appendChild(r)}),this.appendChild(n),e.length||Yt(this,"donut");const o=this.getAttribute("note");let c=this.querySelector(".c-donut__note");o?(c||(c=document.createElement("div"),c.className="c-donut__note",this.appendChild(c)),c.textContent=o):c&&c.remove()}enhance(){if(this._wiredDonut)return;this._wiredDonut=!0;const t=()=>Array.from(this.querySelectorAll(".c-donut__slice")),e=t=>{const e=Number(t.dataset.index);Number.isFinite(e)&&this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:1,index:e,value:t.getAttribute("data-title")||t.getAttribute("title")}}))};this.addEventListener("keydown",s=>{const r=s.target&&s.target.closest?s.target.closest(".c-donut__slice"):null;if(!r||!this.contains(r))return;const i=t(),a=i.indexOf(r);let n=-1;if("ArrowRight"===s.key||"ArrowDown"===s.key)n=Math.min(a+1,i.length-1);else if("ArrowLeft"===s.key||"ArrowUp"===s.key)n=Math.max(a-1,0);else if("Home"===s.key)n=0;else if("End"===s.key)n=i.length-1;else if("Enter"===s.key||" "===s.key)return s.preventDefault(),void e(r);if(n>=0&&n!==a){s.preventDefault(),i.forEach((t,e)=>t.setAttribute("tabindex",e===n?"0":"-1"));try{i[n].focus()}catch(t){}}}),this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-donut__slice"):null;s&&this.contains(s)&&e(s)})}});c("contour-time-series",class extends T{static get observed(){return["values","points","series","series-style","title","brownout","brownout-level","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","note","cache-key","no-cache"]}static get properties(){return{values:{attribute:"values"},points:{attribute:"points"},series:{attribute:"series"},src:{attribute:"src"},note:{attribute:"note"}}}render(){if(this.classList.add("c-time-series"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Time series"),Zt(this),$t(this,["values","points","series"]),Xt(this,"time-series"))return;this.ensure(".c-time-series__tooltip",()=>{const t=document.createElement("div");return t.className="c-time-series__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t.id=o("timeseries-tip"),t}),Array.from(this.querySelectorAll(".c-time-series__plot, .c-time-series__axis")).forEach(t=>t.remove());let t=[];this.getAttribute("series")&&(t=Qt(this,"series",f));const e=Jt(this,"series");if(Array.isArray(e)&&(t=e),!t.length){let e=[];if(this.getAttribute("values")&&(e=Qt(this,"values",f)),e.length){const s=(this.getAttribute("style")||"").trim().toLowerCase();t=[{label:"Series 1",values:e,style:this.getAttribute("series-style")||("line"===s||"bar"===s?s:"bar"),color:"var(--chart-1)"}]}}const s=t.reduce((t,e)=>{const s=Array.isArray(e.values)?Math.max(...e.values,0):0;return Math.max(t,s)},1),r=t.reduce((t,e)=>{const s=Array.isArray(e.values)?Math.min(...e.values,0):0;return Math.min(t,s)},0),i=document.createElement("div");i.className="c-time-series__plot",i.setAttribute("part","plot");const a=[];t.forEach((t,e)=>{const n=Array.isArray(t.values)?t.values:[],o=t.style||"bar",c=t.color||`var(--chart-${e%8+1})`,l=t.label||`Series ${e+1}`;if("line"===o){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("viewBox","0 0 300 120"),t.setAttribute("preserveAspectRatio","none"),t.style.cssText="position: absolute; inset: 0; width: 100%; height: 100%";const a=s-r||1,o=n.length||1,u=n.map((t,e)=>{const s=e/Math.max(1,o-1)*300,i=120-(t-r)/a*120;return s.toFixed(2)+","+i.toFixed(2)}).join(" "),d=document.createElementNS("http://www.w3.org/2000/svg","path");d.setAttribute("class","c-time-series__line"),d.setAttribute("data-series",String(e+1)),d.setAttribute("d","M "+u.replace(/ /g," L ")),d.style.stroke=c,d.style.fill="none",d.style.strokeWidth="2",t.appendChild(d),n.forEach((s,i)=>{const n=i/Math.max(1,o-1)*300,c=120-(s-r)/a*120,u=document.createElementNS("http://www.w3.org/2000/svg","circle");u.setAttribute("class","c-time-series__point"),u.setAttribute("data-series",String(e+1)),u.setAttribute("data-index",String(i)),u.setAttribute("cx",n.toFixed(2)),u.setAttribute("cy",c.toFixed(2)),u.setAttribute("r","3"),u.setAttribute("tabindex",0===i&&0===e?"0":"-1"),u.setAttribute("role","button"),u.setAttribute("data-title",String(s)),u.setAttribute("aria-label",l+": "+String(s)),t.appendChild(u)}),i.appendChild(t)}else n.forEach((t,r)=>{const i=document.createElement("div");i.className="c-time-series__bar",i.setAttribute("data-series",String(e+1)),i.setAttribute("data-index",String(r)),i.style.blockSize=t/s*100+"%",i.style.background=_(c),i.setAttribute("data-title",String(t)),i.setAttribute("role","button"),i.setAttribute("aria-label",l+": "+String(t)),i.setAttribute("tabindex",0===r&&0===e?"0":"-1"),(a[r]||(a[r]=[])).push(i)})}),a.forEach(t=>{t&&t.forEach(t=>i.appendChild(t))}),this.appendChild(i);const n=t.find(t=>Array.isArray(t.values)&&t.values.length),c=n?n.values.length:0;if(c>1){const t=document.createElement("div");t.className="c-time-series__axis";const e=n.x;[0,Math.floor((c-1)/2),c-1].filter((t,e,s)=>t>=0&&s.indexOf(t)===e).forEach(s=>{const r=document.createElement("span");r.className="c-time-series__tick",r.textContent=Array.isArray(e)&&null!=e[s]?String(e[s]):String(s),t.appendChild(r)}),this.appendChild(t)}t.length&&t.some(t=>Array.isArray(t.values)&&t.values.length)||Yt(this,"time-series");const l=this.getAttribute("note");let u=this.querySelector(".c-time-series__note");l&&!this.shed("note",2)?(u||(u=document.createElement("div"),u.className="c-time-series__note",this.appendChild(u)),u.textContent=l):u&&u.remove();const d=this.querySelector(".c-time-series__axis");d&&(d.style.display=this.shed("axis",3)?"none":"")}enhance(){if(this._wiredTimeSeries)return;this._wiredTimeSeries=!0;const t=()=>Array.from(this.querySelectorAll(".c-time-series__bar")),e=()=>Array.from(this.querySelectorAll(".c-time-series__point"));this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-time-series__bar"):null;if(!e||!this.contains(e))return;const s=Number(e.dataset.series||"0"),r=Number(e.dataset.index||"0");this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:s,index:r,value:e.getAttribute("data-title")||e.getAttribute("title")}}))});this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-time-series__point"):null;if(!e||!this.contains(e))return;const s=Number(e.dataset.series||"0"),r=Number(e.dataset.index||"0");this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:s,index:r,value:e.getAttribute("data-title")||e.getAttribute("title")}}))}),this.addEventListener("keydown",s=>{const r=s.target&&s.target.closest?s.target.closest(".c-time-series__bar"):null,i=s.target&&s.target.closest?s.target.closest(".c-time-series__point"):null,a=r||i;if(!a||!this.contains(a))return;const n=r?t():e(),o=n.indexOf(a);if("Enter"===s.key||" "===s.key){s.preventDefault();const t=Number(a.dataset.series||"0");return void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:t,index:o,value:a.getAttribute("data-title")||a.getAttribute("title")}}))}z(s,n,{wrap:!1,homeEnd:!0,rtl:I(this),onNavigate:t=>n.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{}})}),this.addEventListener("focusin",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-time-series__bar"):null;if(e&&this.contains(e)){const t=this.querySelector(".c-time-series__tooltip");t&&(t.textContent=e.getAttribute("data-title")||e.getAttribute("title"),t.removeAttribute("hidden"),t.id&&e.setAttribute("aria-describedby",t.id))}const s=t.target&&t.target.closest?t.target.closest(".c-time-series__point"):null;if(s&&this.contains(s)){const t=this.querySelector(".c-time-series__tooltip");t&&(t.textContent=s.getAttribute("data-title")||s.getAttribute("title"),t.removeAttribute("hidden"),t.id&&s.setAttribute("aria-describedby",t.id))}}),this.addEventListener("focusout",t=>{const e=(t.target&&t.target.closest?t.target.closest(".c-time-series__bar"):null)||(t.target&&t.target.closest?t.target.closest(".c-time-series__point"):null);e&&this.contains(e)&&e.removeAttribute("aria-describedby");const s=this.querySelector(".c-time-series__tooltip");s&&!this.contains(t.relatedTarget)&&s.setAttribute("hidden","")})}});c("contour-pivot",class extends T{static get observed(){return["rows","columns","values","data","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","filter","aggregate","cache-key","no-cache"]}static get properties(){return{rows:{attribute:"rows"},columns:{attribute:"columns"},values:{attribute:"values"},data:{attribute:"data"},src:{attribute:"src"},filter:{attribute:"filter"},aggregate:{attribute:"aggregate"}}}_aggregateFn(t){const e=(t||"sum").toLowerCase();return"avg"===e||"average"===e||"mean"===e?t=>t.length?t.reduce((t,e)=>t+e,0)/t.length:0:"count"===e?t=>t.length:"min"===e?t=>t.length?Math.min(...t):0:"max"===e?t=>t.length?Math.max(...t):0:t=>t.reduce((t,e)=>t+e,0)}render(){if(this.classList.add("c-pivot"),Zt(this),$t(this,["data"]),Xt(this,"pivot"))return;Array.from(this.querySelectorAll("table, .c-pivot__wrap, .c-pivot__toolbar, .c-pivot__empty")).forEach(t=>t.remove());let t=[];const e=this.getAttribute("data");if(e)try{t=JSON.parse(e)}catch(e){f(this,"data",e),t=[]}const s=this.getAttribute("rows")?this.getAttribute("rows").split(",").map(t=>t.trim()).filter(Boolean):[],r=this.getAttribute("columns")?this.getAttribute("columns").split(",").map(t=>t.trim()).filter(Boolean):[],i=this.getAttribute("aggregate")||"sum",a=this._aggregateFn(i),n=(this.getAttribute("filter")||"").toLowerCase().trim(),o=document.createElement("div");o.className="c-pivot__toolbar",o.style.display="flex";const c=document.createElement("input");c.type="search",c.className="c-input c-pivot__filter",c.placeholder=k(this,"filter","Filter…"),c.value=this.getAttribute("filter")||"",c.setAttribute("aria-label",k(this,"filter-pivot","Filter pivot"));const l=document.createElement("select");l.className="c-select c-pivot__aggregate",l.setAttribute("aria-label",k(this,"aggregation","Aggregation")),["sum","avg","count","min","max"].forEach(t=>{const e=document.createElement("option");e.value=t,e.textContent=t,t===i&&(e.selected=!0),l.appendChild(e)}),o.appendChild(c),o.appendChild(l),this.appendChild(o);let u=s,d=r;if(n&&(u=s.filter(e=>e.toLowerCase().includes(n)||t.some(t=>t.row===e&&String(t.value).toLowerCase().includes(n))),d=r.filter(e=>e.toLowerCase().includes(n)||t.some(t=>t.col===e&&String(t.value).toLowerCase().includes(n)))),!t.length&&!s.length&&!r.length)return void Yt(this,"pivot");if(n&&(!u.length||!d.length)){const t=document.createElement("div");return t.className="c-pivot__empty",t.setAttribute("role","status"),t.textContent=this.getAttribute("empty")||k(this,"empty","No matching data"),void this.appendChild(t)}if(this._pivotSort&&this._pivotSort.col){const e=this._pivotSort.col,s="asc"===this._pivotSort.dir?1:-1,r=s=>a(t.filter(t=>t.row===s&&t.col===e).map(t=>Number(t.value)).filter(t=>Number.isFinite(t)));u=u.slice().sort((t,e)=>(r(t)-r(e))*s)}const h=document.createElement("div");h.className="c-table-wrap c-pivot__wrap";const m=document.createElement("table");m.className="c-table c-pivot__table",m.setAttribute("role","grid"),m.setAttribute("aria-rowcount",String(u.length+1)),m.setAttribute("aria-colcount",String(d.length+1));const b=document.createElement("thead"),p=document.createElement("tr"),g=document.createElement("th");g.textContent="",g.setAttribute("role","columnheader"),g.setAttribute("aria-label",k(this,"row","Row")),p.appendChild(g);let _=!1;d.forEach(t=>{const e=document.createElement("th");e.textContent=t,e.setAttribute("role","columnheader"),e.setAttribute("tabindex",_?"-1":"0"),_=!0,p.appendChild(e)}),b.appendChild(p),m.appendChild(b);const v=document.createElement("tbody");u.forEach(e=>{const s=document.createElement("tr");s.setAttribute("role","row");const r=document.createElement("th");r.textContent=e,r.setAttribute("role","rowheader"),r.setAttribute("tabindex",_?"-1":"0"),_=!0,s.appendChild(r),d.forEach(r=>{const i=document.createElement("td");i.setAttribute("role","gridcell"),i.setAttribute("tabindex","-1"),i.dataset.row=e,i.dataset.col=r;const n=t.filter(t=>t.row===e&&t.col===r),o=n.map(t=>Number(t.value)).filter(t=>Number.isFinite(t));if(n.length&&o.length===n.length&&o.length){const t=a(o);i.textContent=Number.isInteger(t)?String(t):t.toFixed(2)}else n.length?i.textContent=n.map(t=>t.value).join(", "):i.textContent="";i.textContent.trim()||i.setAttribute("aria-label",k(this,"empty","Empty")),s.appendChild(i)}),v.appendChild(s)}),m.appendChild(v),h.appendChild(m),this.appendChild(h)}enhance(){this._wiredPivot||(this._wiredPivot=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("th"):null,s=t.target&&t.target.closest?t.target.closest("td"):null,r=t.target&&t.target.closest?t.target.closest(".c-pivot__filter"):null,i=t.target&&t.target.closest?t.target.closest(".c-pivot__aggregate"):null;if(!r&&!i){if(e&&this.contains(e)&&e.parentElement&&e.parentElement.parentElement&&"THEAD"===e.parentElement.parentElement.tagName){const t=e.textContent.trim();if(t){const e=this._pivotSort;this._pivotSort={col:t,dir:e&&e.col===t&&"desc"===e.dir?"asc":"desc"},this.requestRender()}return void this.dispatchEvent(new CustomEvent("contour:sort",{bubbles:!0,composed:!0,detail:{column:t}}))}s&&this.contains(s)&&this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{row:s.dataset.row||"",col:s.dataset.col||"",value:s.textContent}}))}}),this.addEventListener("input",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-pivot__filter"):null;e&&this.contains(e)&&(this.setAttribute("filter",e.value),this.dispatchEvent(new CustomEvent("contour:filter",{bubbles:!0,composed:!0,detail:{query:e.value}})),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"pivot",filter:{filter:e.value}}})))}),this.addEventListener("change",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-pivot__aggregate"):null;e&&this.contains(e)&&(this.setAttribute("aggregate",e.value),this.dispatchEvent(new CustomEvent("contour:aggregate",{bubbles:!0,composed:!0,detail:{aggregate:e.value}})))}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest("th, td"):null;if(!e||!this.contains(e))return;const s=this.querySelector("table");if(!s)return;const r=Array.from(s.querySelectorAll("tr")),i=r.indexOf(e.parentElement),a=Array.from(e.parentElement.children).indexOf(e);let n=null;if("ArrowRight"===t.key?n=e.parentElement.children[a+1]:"ArrowLeft"===t.key?n=e.parentElement.children[a-1]:"ArrowDown"===t.key?n=r[i+1]&&r[i+1].children[a]:"ArrowUp"===t.key?n=r[i-1]&&r[i-1].children[a]:"Home"===t.key?n=e.parentElement.children[0]:"End"===t.key&&(n=e.parentElement.children[e.parentElement.children.length-1]),n){t.preventDefault();try{n.focus()}catch(t){}}}),this.addEventListener("contour:clear-all",()=>{this.hasAttribute("filter")&&(this.removeAttribute("filter"),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"pivot",filter:{filter:null}}})))}))}});c("contour-widget-state",class extends T{static get observed(){return["loading","error","empty","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}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"),Zt(this),$t(this,[]),Xt(this,"widget-state")}enhance(){}});c("contour-brownout",class extends T{static get observed(){return["level"]}static get properties(){return{level:{attribute:"level"}}}render(){this.classList.add("c-brownout");const t=this.getAttribute("level")||"0";this.dataset.level=t,this.setAttribute("data-level",t);let e=this.querySelector(".c-brownout__decorative");e||(e=document.createElement("span"),e.className="c-brownout__decorative",e.setAttribute("aria-hidden","true"),this.appendChild(e));let s=this.querySelector(".c-brownout__label");s||(s=document.createElement("span"),s.className="c-brownout__label",this.appendChild(s)),s.textContent=k(this,"level","Level")+" "+t;const r=parseInt(t,10)||0;this._shedDisplay||(this._shedDisplay=new WeakMap),Array.from(this.children).forEach(t=>{if(t.classList.contains("c-brownout__decorative")||t.classList.contains("c-brownout__label"))return;const e=parseInt(t.getAttribute("data-shed")||"2",10);!t.hasAttribute("data-essential")&&Number.isFinite(e)&&r>=e?(this._shedDisplay.has(t)||this._shedDisplay.set(t,t.style.display),t.style.display="none"):this._shedDisplay.has(t)&&(t.style.display=this._shedDisplay.get(t),this._shedDisplay.delete(t))})}enhance(){}});c("contour-instrument",class extends T{static get observed(){return["rows","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{rows:{attribute:"rows"},src:{attribute:"src"}}}render(){if(this.classList.add("c-instrument"),Zt(this),$t(this,"rows"),Xt(this,"instrument"))return;const t=Jt(this,"rows");if(Array.from(this.querySelectorAll(".c-instrument__item")).forEach(t=>t.remove()),t)try{JSON.parse(t).forEach(t=>{const e=document.createElement("span");e.className="c-instrument__item",e.appendChild(document.createTextNode(String(t.key||t[0]||"")));const s=document.createElement("span");s.className="c-instrument__value",s.textContent=t.value||t[1]||"",e.appendChild(s),this.appendChild(e)})}catch(t){f(this,"attribute",t)}else Yt(this,"instrument")}});class ie extends T{static get observed(){return["size","axis-x","axis-y","colors","selected"]}static get properties(){return{size:{attribute:"size"},axisX:{attribute:"axis-x"},axisY:{attribute:"axis-y"},colors:{attribute:"colors"},selected:{attribute:"selected"}}}get _bvBlock(){return"c-bivariate"}get _bvDefaultAxisX(){return"Income"}get _bvDefaultAxisY(){return"Density"}get _bvLiveClassName(){return`${this._bvBlock}__live`}get _bvLiveInlineStyles(){return!0}get _bvAnnounce(){return!1}render(){this.classList.add(this._bvBlock),this.setAttribute("role","group");const t="Bivariate legend",e=this.getAttribute("aria-label");null!==e&&e!==this._lastAutoAria||(this.setAttribute("aria-label",t),this._lastAutoAria=t);const s=Math.min(12,Math.max(1,parseInt(this.getAttribute("size")??"3",10)??3)),r=this.getAttribute("axis-y")??this._bvDefaultAxisY,i=this.getAttribute("axis-x")??this._bvDefaultAxisX,a=this.ensure(`.${this._bvBlock}__matrix`,()=>{const t=document.createElement("div");return t.className=`${this._bvBlock}__matrix`,t});a.style.gridTemplateColumns=`repeat(${s}, 1fr)`,a.style.gridTemplateRows=`repeat(${s}, 1fr)`;if(!Array.from(a.children).filter(t=>t.classList&&t.classList.contains(`${this._bvBlock}__cell`)).length){a.innerHTML="";let t=Qt(this,"colors",f);if(!t.length){t=["#e8e8e8","#b5c0da","#2a5a99","#e4acac","#b07f99","#2d3a6b","#c85a5a","#994d6e","#2a1a30"].slice(0,s*s)}for(let e=0;e<s;e++)for(let n=0;n<s;n++){const o=document.createElement("div");o.className=`${this._bvBlock}__cell`,o.setAttribute("role","button"),o.setAttribute("tabindex",0===e&&0===n?"0":"-1");const c=s-e;o.setAttribute("aria-label",`${r} ${c} of ${s}, ${i} ${n+1} of ${s}`);const l=(s-1-e)*s+n;if(t[l]){const e=_(t[l]);e&&(o.style.background=e,o.dataset.color=e)}a.appendChild(o)}const e=this.getAttribute("selected");if(e){const t=e.split(","),r=parseInt(t[0],10),i=parseInt(t[1],10);Array.from(a.querySelectorAll(`.${this._bvBlock}__cell`)).forEach((t,e)=>{Math.floor(e/s)===r&&e%s===i?t.setAttribute("data-selected",""):t.removeAttribute("data-selected")})}let n=this.querySelector(`.${this._bvBlock}__live`);n||(n=document.createElement("div"),n.className=this._bvLiveClassName,n.setAttribute("aria-live","polite"),this._bvLiveInlineStyles&&(n.style.position="absolute",n.style.width="1px",n.style.height="1px",n.style.overflow="hidden",n.style.clip="rect(0,0,0,0)"),this.appendChild(n))}const n=this.getAttribute("axis-x");if(n){this.ensure(`.${this._bvBlock}__axis--x`,()=>{const t=document.createElement("div");return t.className=`${this._bvBlock}__axis ${this._bvBlock}__axis--x`,t}).textContent=n}else{const t=this.querySelector(`.${this._bvBlock}__axis--x`);t&&t.remove()}const o=this.getAttribute("axis-y");if(o){this.ensure(`.${this._bvBlock}__axis--y`,()=>{const t=document.createElement("div");return t.className=`${this._bvBlock}__axis ${this._bvBlock}__axis--y`,t}).textContent=o}else{const t=this.querySelector(`.${this._bvBlock}__axis--y`);t&&t.remove()}}enhance(){if(this._wiredBivariate)return;this._wiredBivariate=!0;const t=t=>{const e=this.querySelector(`.${this._bvBlock}__matrix`),s=Array.from(e?e.querySelectorAll(`.${this._bvBlock}__cell`):[]),r=s.indexOf(t);if(r<0)return;const i=Math.min(12,Math.max(1,parseInt(this.getAttribute("size")||"3",10)||3)),a=Math.floor(r/i),n=r%i;if(s.forEach((t,e)=>{Math.floor(e/i)===a&&e%i===n?t.setAttribute("data-selected",""):t.removeAttribute("data-selected")}),this._bvAnnounce){const e=this.querySelector(`.${this._bvBlock}__live`);e&&(e.textContent=t.getAttribute("aria-label")||"")}this.dispatchEvent(new CustomEvent("contour:select",{detail:{row:a,col:n},bubbles:!0,composed:!0}))};this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(`.${this._bvBlock}__cell`):null;s&&this.contains(s)&&t(s)}),this.addEventListener("keydown",e=>{const s=e.target&&e.target.closest?e.target.closest(`.${this._bvBlock}__cell`):null;if(!s||!this.contains(s))return;if("Enter"===e.key||" "===e.key)return e.preventDefault(),void t(s);const r=this.querySelector(`.${this._bvBlock}__matrix`);if(!r)return;const i=Array.from(r.querySelectorAll(`.${this._bvBlock}__cell`)),a=i.indexOf(s);if(a<0)return;const n=Math.min(12,Math.max(1,parseInt(this.getAttribute("size")||"3",10)||3)),o=Math.floor(a/n),c=a%n;let l=o,u=c;if("ArrowRight"===e.key)u=Math.min(n-1,c+1);else if("ArrowLeft"===e.key)u=Math.max(0,c-1);else if("ArrowDown"===e.key)l=Math.min(n-1,o+1);else if("ArrowUp"===e.key)l=Math.max(0,o-1);else if("Home"===e.key)l=0,u=0;else{if("End"!==e.key)return;l=n-1,u=n-1}e.preventDefault();const d=i[l*n+u];if(d){i.forEach((t,e)=>t.setAttribute("tabindex",e===l*n+u?"0":"-1"));try{d.focus()}catch(t){}}})}clear(){this.removeAttribute("selected"),this.dispatchEvent(new CustomEvent("contour:clear",{bubbles:!0,composed:!0}))}}c("contour-bivariate",ie);c("contour-bivariate-legend",class extends ie{static get observed(){return["size","axis-x","axis-y","colors","selected"]}static get properties(){return{size:{attribute:"size"},axisX:{attribute:"axis-x"},axisY:{attribute:"axis-y"},colors:{attribute:"colors"},selected:{attribute:"selected"}}}get _bvBlock(){return"c-bivariate-legend"}get _bvDefaultAxisX(){return"X"}get _bvDefaultAxisY(){return"Y"}get _bvLiveClassName(){return"visually-hidden c-bivariate-legend__live"}get _bvLiveInlineStyles(){return!1}get _bvAnnounce(){return!0}clear(){this.removeAttribute("selected");Array.from(this.querySelectorAll(".c-bivariate-legend__cell")).forEach(t=>t.removeAttribute("data-selected")),this.dispatchEvent(new CustomEvent("contour:clear",{bubbles:!0,composed:!0}))}});c("contour-survey",class extends T{static get observed(){return["date","instrument","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{date:{attribute:"date"},instrument:{attribute:"instrument"},src:{attribute:"src"}}}render(){if(this.classList.add("c-survey"),Zt(this),$t(this,"date"),Xt(this,"survey"))return;const t=Jt(this,"date");Array.from(this.childNodes).forEach(t=>{t.nodeType===Node.TEXT_NODE?"Surveyed"!==t.textContent.trim()&&"·"!==t.textContent.trim()||t.remove():t.classList&&(t.classList.contains("c-survey__value")||t.classList.contains("c-survey__sep"))&&t.remove()});const e=t||this._remoteData&&this._remoteData.date,s=this.getAttribute("instrument")||this._remoteData&&this._remoteData.instrument;if(!e)return void Yt(this,"survey");const r=document.createElement("span");if(r.className="c-survey__value",r.textContent=e,this.appendChild(document.createTextNode("Surveyed ")),this.appendChild(r),s){const t=document.createElement("span");t.className="c-survey__sep",t.textContent="·",this.appendChild(t);const e=document.createElement("span");e.className="c-survey__value",e.textContent=s,this.appendChild(e)}}});c("contour-threshold",class extends T{static get observed(){return["label","norm","state","value","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},norm:{attribute:"norm"},state:{attribute:"state"},value:{attribute:"value"},src:{attribute:"src"}}}render(){if(this.classList.add("c-threshold"),this.hasAttribute("role")||this.setAttribute("role","meter"),Zt(this),$t(this,"value"),Xt(this,"threshold"))return;const t=t=>{const e=Number(t);return Number.isFinite(e)?(e<=1?100*e:e)+"%":String(t)},e=Jt(this,"value")||this._remoteData&&this._remoteData.value,s=this.getAttribute("norm")||this._remoteData&&this._remoteData.norm,r=this.getAttribute("state")||this._remoteData&&this._remoteData.state,i=this.getAttribute("label")||this._remoteData&&this._remoteData.label;if(!e&&!s&&!i)return void Yt(this,"threshold");const a=Number(e);if(Number.isFinite(a)){const t=Math.min(100,Math.max(0,a));this.setAttribute("aria-valuenow",String(t)),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax","100")}else this.removeAttribute("aria-valuenow"),this.removeAttribute("aria-valuemin"),this.removeAttribute("aria-valuemax");const n=[i,Number.isFinite(a)?String(a):null,s?k(this,"target","target")+" "+s:null].filter(Boolean).join(", ");if(n?this.setAttribute("aria-valuetext",n):this.removeAttribute("aria-valuetext"),e){this.ensure(".c-threshold__fill",()=>{const t=document.createElement("span");return t.className="c-threshold__fill",t}).style.setProperty("--value",t(e))}else{const t=this.querySelector(".c-threshold__fill");t&&t.remove()}if(s){this.ensure(".c-threshold__target",()=>{const t=document.createElement("span");return t.className="c-threshold__target",t}).style.setProperty("--target",t(s))}else{const t=this.querySelector(".c-threshold__target");t&&t.remove()}r?this.setAttribute("data-state",r):this.removeAttribute("data-state"),i&&this.setAttribute("aria-label",i)}enhance(){this._wiredThreshold||(this._wiredThreshold=!0,this.addEventListener("contour:clear-all",()=>{(this.hasAttribute("norm")||this.hasAttribute("value"))&&(this.removeAttribute("norm"),this.removeAttribute("value"),this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"threshold",filter:{norm:null,value:null}}})),this.requestRender())}))}});c("contour-metrics",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-metrics"),this.setAttribute("role","list"),Zt(this),$t(this,"items"),Xt(this,"metrics"))return;const t=Jt(this,"items");Array.from(this.querySelectorAll(".c-metrics__item")).forEach(t=>t.remove());let e=null;if(t)try{e=JSON.parse(t)}catch(t){e=null}Array.isArray(e)&&e.length?e.forEach(t=>{const e=document.createElement("div");e.className="c-metrics__item",e.setAttribute("role","listitem");const s=document.createElement("div");s.className="c-metrics__value",s.textContent="object"==typeof t&&null!==t?t.value??t.v??"":String(t);const r=document.createElement("div");r.className="c-metrics__label",r.textContent="object"==typeof t&&null!==t?t.label??t.l??"":"",e.appendChild(s),e.appendChild(r),this.appendChild(e)}):t||Yt(this,"metrics")}enhance(){Zt(this)}});c("contour-legend",class extends T{static get observed(){return["title","ramp","scale","items","method","norm","selectable","brownout","brownout-level","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","glyphs","thresholds","breaks","no-data-color","no-data-label","size","table","classification","audit","continuous","ends","caption","graduated","cache-key","no-cache"]}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"},graduated:{attribute:"graduated",type:Boolean}}}render(){this.classList.add("c-legend");const t=this.hasAttribute("graduated");t&&this.classList.add("c-legend--graduated");if(this.hasAttribute("continuous")||this.hasAttribute("selectable")?this.setAttribute("role","group"):this.setAttribute("role","list"),Zt(this),$t(this,"items"),Xt(this,"legend"))return;const e=this.hasAttribute("selectable");e?this.classList.add("c-legend--interactive"):this.classList.remove("c-legend--interactive");const s=Array.from(this.querySelectorAll(":scope > .c-legend__item"));let r=Jt(this,"items");s.length&&(r=JSON.stringify(s.map(t=>{const e=t.querySelector(".c-legend__swatch"),s=t.querySelector(".c-legend__label")||t;return{label:s?s.textContent.trim():t.textContent.trim(),color:e&&(e.dataset&&e.dataset.color||e.style.background)||void 0}})),s.forEach(t=>t.remove()));const i=this.getAttribute("title");if(i){this.ensure(".c-legend__title",()=>{const t=document.createElement("div");return t.className="c-legend__title",t}).textContent=i}else{const t=this.querySelector(".c-legend__title");t&&t.remove()}if(r)try{const s=JSON.parse(r),a=this.ensure(".c-legend__items",()=>{const t=document.createElement("div");return t.className="c-legend__items",t});this.hasAttribute("selectable")?a.setAttribute("role","group"):a.removeAttribute("role"),i&&a.setAttribute("aria-label",i),a.innerHTML="",s.forEach(s=>{const r="string"==typeof s?s:s.label||String(s),i="string"==typeof s?s:s.key||s.label||String(s),n=document.createElement("div");if(n.className="c-legend__item",n.setAttribute("tabindex","-1"),e){n.setAttribute("role","button");const t=this._legendUnpressed&&this._legendUnpressed.has(i);n.setAttribute("aria-pressed",t?"false":"true"),n.dataset.key=i}else n.setAttribute("role","listitem");const o=document.createElement("span");if(t){o.className="c-legend__swatch c-legend__swatch--graduated";const t=s&&null!=s.size?s.size:s&&null!=s.value?s.value:1,e=Math.max(6,Math.min(24,4*parseFloat(t)));o.style.inlineSize=e+"px",o.style.blockSize=e+"px"}else o.className="c-legend__swatch";if(s&&s.color){const t=_(s.color);t&&(o.style.background=t,o.dataset.color=t)}if(n.appendChild(o),t&&s&&null!=s.break){const t=document.createElement("span");t.className="c-legend__break-label",t.textContent=String(s.break),n.appendChild(t)}const c=s&&(s.shape||s.marker||s.glyph)||this.getAttribute("glyphs");if(c){const t=document.createElement("span");t.className="c-legend__glyph",t.setAttribute("part","glyph"),t.textContent="circle"===c?"●":"square"===c?"■":"triangle"===c?"▲":"diamond"===c?"◆":"star"===c?"★":String(c),s&&null!=s.size&&(t.style.fontSize="number"==typeof s.size?s.size+"px":String(s.size)),n.appendChild(t)}if(s&&null!=s.break){const t=document.createElement("span");t.className="c-legend__break",t.textContent=String(s.break),n.appendChild(t)}const l=document.createElement("span");l.className="c-legend__label",l.textContent=r,n.dataset.label=r,n.appendChild(l);const u="object"==typeof s&&s&&(s.caption||s.note)||"";if(u){const t=document.createElement("span");t.className="c-legend__caption",t.textContent=u,n.appendChild(t)}s&&(s.threshold||null!=s.break)&&(o.style.outline="2px solid var(--color-border-strong)"),a.appendChild(n)})}catch(t){f(this,"attribute",t)}else{const t=this.querySelector(".c-legend__items");t&&t.remove();this.getAttribute("title")||this.getAttribute("ramp")||this.getAttribute("scale")||this.getAttribute("method")||this.getAttribute("norm")||Yt(this,"legend")}const a=this.getAttribute("caption");let n=this.querySelector(".c-legend__caption");if(a)n||(n=document.createElement("span"),n.className="c-legend__caption",this.appendChild(n)),n.id=n.id||o("legend-caption"),n.textContent=a,n.style.position="absolute",n.style.width="1px",n.style.height="1px",n.style.overflow="hidden",n.style.clip="rect(0,0,0,0)";else if(n){const t=n.id;n.remove(),t&&this.querySelectorAll(".c-legend__item").forEach(e=>{const s=(e.getAttribute("aria-describedby")||"").split(" ").filter(e=>e&&e!==t);s.length?e.setAttribute("aria-describedby",s.join(" ")):e.removeAttribute("aria-describedby")})}const c=this.querySelector(".c-legend__items");if(c){const t=Array.from(c.querySelectorAll(".c-legend__item"));e?t.forEach((t,e)=>t.setAttribute("tabindex",0===e?"0":"-1")):t.forEach(t=>t.setAttribute("tabindex","-1")),n&&t.forEach(t=>t.setAttribute("aria-describedby",n.id))}const l=this.getAttribute("no-data-color"),u=this.getAttribute("no-data-label")||"No data";if(l){let t=this.querySelector(".c-legend__no-data");t||(t=document.createElement("div"),t.className="c-legend__no-data",this.appendChild(t)),t.setAttribute("part","no-data"),t.setAttribute("aria-label",u),t.textContent=u;const e=document.createElement("span");e.className="glyph",e.style.background=_(l),e.dataset.color=l,t.prepend(e)}else{const t=this.querySelector(".c-legend__no-data");t&&t.remove()}const d=this.getAttribute("audit");if(d){this.ensure(".c-legend__audit",()=>{const t=document.createElement("div");return t.className="c-legend__audit",t}).textContent=d}else{const t=this.querySelector(".c-legend__audit");t&&t.remove()}if(this.hasAttribute("continuous")){const t=this.getAttribute("ends");let e=null;if(t)try{e=JSON.parse(t)}catch(s){e=t.split(",")}if(Array.isArray(e)&&e.length>=2){const t=this.ensure(".c-legend__ramp",()=>{const t=document.createElement("div");return t.className="c-legend__ramp",t});let s=this.querySelector(".c-legend__ramp-label--start");s||(s=document.createElement("span"),s.className="c-legend__ramp-label c-legend__ramp-label--start",t.appendChild(s)),s.textContent=e[0];let r=this.querySelector(".c-legend__ramp-label--end");r||(r=document.createElement("span"),r.className="c-legend__ramp-label c-legend__ramp-label--end",t.appendChild(r)),r.textContent=e[e.length-1]}}const h=this.getAttribute("size");if(h){this.ensure(".c-legend__size",()=>{const t=document.createElement("div");return t.className="c-legend__size",t}).textContent=h}else{const t=this.querySelector(".c-legend__size");t&&t.remove()}const m=this.getAttribute("classification");if(m){this.ensure(".c-legend__classification",()=>{const t=document.createElement("div");return t.className="c-legend__classification",t}).textContent=m}else{const t=this.querySelector(".c-legend__classification");t&&t.remove()}const b=this.getAttribute("table");if(b){let t=null;try{t=JSON.parse(b)}catch(e){t=null}if(Array.isArray(t)){let e=this.querySelector(".c-legend__table-wrap");e||(e=document.createElement("details"),e.className="c-legend__table-wrap",this.appendChild(e)),e.innerHTML="";const s=document.createElement("summary");s.textContent=k(this,"data-table","Data table"),e.appendChild(s);const r=document.createElement("table");r.className="c-legend__table";const i=document.createElement("tbody");t.forEach(t=>{const e=document.createElement("tr");(Array.isArray(t)?t:[t.label??t.key??"",t.value??""]).forEach(t=>{const s=document.createElement("td");s.textContent=t,e.appendChild(s)}),i.appendChild(e)}),r.appendChild(i),e.appendChild(r)}}else{const t=this.querySelector(".c-legend__table-wrap");t&&t.remove()}const p=this.getAttribute("method");if(p){this.ensure(".c-legend__method",()=>{const t=document.createElement("div");return t.className="c-legend__method",t}).textContent=p}else{const t=this.querySelector(".c-legend__method");t&&t.remove()}const g=this.getAttribute("norm");if(g){this.ensure(".c-legend__norm",()=>{const t=document.createElement("span");return t.className="c-legend__norm",t}).textContent=g}else{const t=this.querySelector(".c-legend__norm");t&&t.remove()}const v=this.getAttribute("ramp");if(v){const t=this.ensure(".c-legend__ramp",()=>{const t=document.createElement("div");return t.className="c-legend__ramp",t});t.style.background=_(v);const e=this.getAttribute("breaks");if(e){let s=null;try{s=JSON.parse(e)}catch(t){s=e.split(",").map(t=>t.trim())}Array.isArray(s)&&(Array.from(t.querySelectorAll(".c-legend__ramp-segment")).forEach(t=>t.remove()),s.forEach((e,s)=>{const r=document.createElement("span");r.className="c-legend__ramp-segment",r.style.flex="1";const i=document.createElement("span");i.className="c-legend__ramp-break",i.textContent=String(e),r.appendChild(i),t.appendChild(r)}))}}else{const t=this.querySelector(".c-legend__ramp");t&&t.remove()}const y=this.getAttribute("scale");if(y){this.ensure(".c-legend__scale",()=>{const t=document.createElement("div");return t.className="c-legend__scale",t}).textContent=y}else{const t=this.querySelector(".c-legend__scale");t&&t.remove()}const A=this.shed("chrome",2),E=this.shed("items",3);[".c-legend__ramp",".c-legend__scale"].forEach(t=>{const e=this.querySelector(t);e&&(e.style.display=A?"none":"")}),this.querySelectorAll(".c-legend__caption").forEach(t=>{t.style.display=A?"none":""});const w=this.querySelector(".c-legend__items");w&&(w.style.display=E?"none":"")}enhance(){if(!this._wiredLegend){this._wiredLegend=!0,this.addEventListener("click",t=>{if(!this.hasAttribute("selectable"))return;const e=t.target&&t.target.closest?t.target.closest(".c-legend__item"):null;if(!e||!this.contains(e))return;const s="true"!==e.getAttribute("aria-pressed");e.setAttribute("aria-pressed",String(s)),this._legendUnpressed=this._legendUnpressed||new Set;const r=e.dataset.key||e.textContent.trim();r&&(s?this._legendUnpressed.delete(r):this._legendUnpressed.add(r));const i=Array.from(this.querySelectorAll(".c-legend__item")).indexOf(e),a=e.querySelector(".c-legend__label"),n=e.dataset.label||(a?a.textContent.trim():e.textContent.trim());this.dispatchEvent(new CustomEvent("contour:legend-toggle",{detail:{label:n,key:e.dataset.key||n,pressed:s,index:i},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("contour:select",{detail:{label:n,key:e.dataset.key||n,value:e.dataset.key||n},bubbles:!0,composed:!0}))});try{let t=null;try{t=JSON.parse(this.getAttribute("items")||"null")}catch(e){t=this.getAttribute("items")}this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:this.getAttribute("items"),items:t},bubbles:!0,composed:!0}))}catch(t){}this.addEventListener("change",t=>{const e=t.target;e&&e.classList&&e.classList.contains("c-legend__break-input")&&this.dispatchEvent(new CustomEvent("contour:break-change",{detail:{value:e.value},bubbles:!0,composed:!0}))}),this.addEventListener("keydown",t=>{if(!this.hasAttribute("selectable"))return;const e=Array.from(this.querySelectorAll(".c-legend__item"));if(!e.length)return;const s=document.activeElement,r=e.indexOf(s);if("Escape"===t.key)return e.forEach(t=>t.setAttribute("aria-pressed","false")),void this.dispatchEvent(new CustomEvent("contour:clear",{bubbles:!0,composed:!0}));if(1!==t.key.length||t.ctrlKey||t.metaKey||t.altKey){if("Enter"===t.key||" "===t.key)return t.preventDefault(),void(s&&s.classList.contains("c-legend__item")&&s.click());z(t,e,{wrap:!0,homeEnd:!0,rtl:I(this),onNavigate:t=>e.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{}})}else if(e.length>7){const s=r>=0?r+1:0;for(let r=0;r<e.length;r++){const i=(s+r)%e.length;if((e[i].textContent||"").trim().toLowerCase().startsWith(t.key.toLowerCase())){t.preventDefault(),e[i].focus(),e.forEach((t,e)=>t.setAttribute("tabindex",e===i?"0":"-1"));break}}}}),this.addEventListener("contour:clear-all",()=>{const t=Array.from(this.querySelectorAll(".c-legend__item"));let e=!1;t.forEach(t=>{"button"===t.getAttribute("role")&&"true"===t.getAttribute("aria-pressed")&&(t.setAttribute("aria-pressed","false"),e=!0)}),e&&this.dispatchEvent(new CustomEvent("contour:filter-change",{bubbles:!0,composed:!0,detail:{source:"legend",filter:{selection:null}}}))})}}});c("contour-measure",class extends T{static get observed(){return["label","value","point","line","unit","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},point:{attribute:"point"},line:{attribute:"line"},unit:{attribute:"unit"},src:{attribute:"src"}}}render(){if(this.classList.add("c-measure"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"measure","Measure")),Zt(this),$t(this,["label","value","point","line"]),Xt(this,"measure"))return;const t=Jt(this,"label"),e=Jt(this,"value"),s=Jt(this,"point"),r=Jt(this,"line");if(!(t||e||s||r))return void Yt(this,"measure");if(t){this.ensure(".c-measure__label",()=>{const t=document.createElement("span");return t.className="c-measure__label",t}).textContent=t}else{const t=this.querySelector(".c-measure__label");t&&t.remove()}if(e){this.ensure(".c-measure__readout",()=>{const t=document.createElement("span");return t.className="c-measure__readout",t}).textContent=e}else{const t=this.querySelector(".c-measure__readout");t&&t.remove()}let i=this.querySelector(".c-measure__unit-select");i||(i=document.createElement("select"),i.className="c-measure__unit-select",i.setAttribute("aria-label",k(this,"unit","Unit")),i.setAttribute("data-contour-label","true"),this.appendChild(i)),["m","km","mi","ft"].forEach(t=>{if(!i.querySelector('option[value="'+t+'"]')){const e=document.createElement("option");e.value=t,e.textContent=t,i.appendChild(e)}});const a=void 0!==this._measureUnit?this._measureUnit:this.getAttribute("unit");if(a&&i.querySelector('option[value="'+a+'"]')&&(i.value=a),s){this.ensure(".c-measure__point",()=>{const t=document.createElement("span");return t.className="c-measure__point",t}).textContent=s}else{const t=this.querySelector(".c-measure__point");t&&t.remove()}if(!r){const t=this.querySelector("svg");return void(t&&t.remove())}if(r){this.ensure(".c-measure__line",()=>{const t=document.createElement("span");return t.className="c-measure__line",t}).style.inlineSize=r}else{const t=this.querySelector(".c-measure__line");t&&t.remove()}}enhance(){this._wiredMeasure||(this._wiredMeasure=!0,this.addEventListener("change",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-measure__unit-select"):null;e&&this.contains(e)&&(this._measureUnit=e.value,this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{unit:e.value}})))}))}});c("contour-timeline",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){this.classList.add("c-timeline");let t=this.querySelector(".c-timeline__list");if(t||(t=document.createElement("ol"),t.className="c-timeline__list",t.setAttribute("aria-label",this.getAttribute("aria-label")||"Timeline"),this.appendChild(t)),Zt(this),$t(this,"items"),Xt(this,"timeline"))return;const e=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-timeline__item")),s=Jt(this,"items");if(s&&!e.length){Array.from(t.querySelectorAll(".c-timeline__item")).forEach(t=>t.remove());try{JSON.parse(s).forEach((e,s)=>{const r=document.createElement("li");if(r.className="c-timeline__item",r.setAttribute("tabindex",0===s?"0":"-1"),e.time){const t=document.createElement("time");t.className="c-timeline__time",t.setAttribute("datetime",String(e.time)),t.textContent=e.time,r.appendChild(t)}if(e.title){const t=document.createElement("div");t.className="c-timeline__title",t.textContent=e.title,r.appendChild(t)}if(e.text){const t=document.createElement("div");t.className="c-timeline__text",t.textContent=e.text,r.appendChild(t)}t.appendChild(r)})}catch(t){f(this,"attribute",t)}}else e.length||Yt(this,"timeline")}enhance(){if(this._wiredTimeline)return;this._wiredTimeline=!0;Array.from(this.querySelectorAll(".c-timeline__item")).forEach((t,e)=>t.setAttribute("tabindex",0===e?"0":"-1")),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-timeline__item"):null;if(!e||!this.contains(e))return;const s=Array.from(this.querySelectorAll(".c-timeline__item")).indexOf(e);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:s}}))}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-timeline__item"));e.length&&z(t,e,{wrap:!1,homeEnd:!0,onNavigate:t=>e.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{"Enter"!==t.key&&" "!==t.key||this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:e.indexOf(document.activeElement)}}))}})})}});c("contour-heatmap",class extends T{static get observed(){return["cells","count","legend","brownout","brownout-level","empty","loading","values","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","dir","no-cache"]}static get properties(){return{cells:{attribute:"cells"},count:{attribute:"count"},legend:{attribute:"legend"},src:{attribute:"src"}}}render(){if(this.classList.add("c-heatmap"),this.hasAttribute("role")||this.setAttribute("role","grid"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"heatmap","Heatmap")),Zt(this),$t(this,"cells"),Xt(this,"heatmap"))return;const t=Array.from(this.querySelectorAll(":scope > .c-heatmap__cell"));if(t.length){const e=Math.ceil(Math.sqrt(t.length));this.style.gridTemplateColumns="repeat("+e+", 1fr)",this.style.inlineSize="16rem";let s=null,r=0;const i=()=>{s=document.createElement("div"),s.setAttribute("role","row"),this.appendChild(s),r=0};i(),t.forEach(t=>{t.setAttribute("role","gridcell"),s.appendChild(t),r++,r===e&&i()})}else{Array.from(this.querySelectorAll(".c-heatmap__cell")).forEach(t=>t.remove());const e=Math.min(200,Math.max(0,parseInt(this.getAttribute("cells")||this.getAttribute("count")||"0",10)||0)),s=e>0?Math.ceil(Math.sqrt(e)):1;if(this.style.gridTemplateColumns="repeat("+s+", 1fr)",this.style.inlineSize="16rem",e>0){let t=[];try{t=JSON.parse(this.getAttribute("values")||"[]")}catch(e){t=[]}const r=t.map(t=>{const e=Number(t);return Number.isFinite(e)?e:null}),i=r.filter(t=>null!==t),a=i.length?Math.min.apply(null,i):0,n=(i.length?Math.max.apply(null,i):0)-a,c=t=>null===t?0:n<=0?4:Math.min(7,1+Math.floor((t-a)/n*7));let l=null,u=0;const d=()=>{l=document.createElement("div"),l.setAttribute("role","row"),this.appendChild(l),u=0};d();for(let i=0;i<e;i++){const a=document.createElement("div");a.className="c-heatmap__cell",a.setAttribute("role","gridcell"),a.setAttribute("tabindex",0===i?"0":"-1"),a.dataset.index=String(i);const n=c(r[i]);n&&(a.style.setProperty("--c","var(--chart-seq-"+n+")"),a.dataset.band=String(n)),void 0!==t[i]&&a.setAttribute("data-title",String(t[i])),l.appendChild(a),u++,u===s&&i<e-1&&d()}if(this.shed("tooltip",2)){const t=this.querySelector(".c-heatmap__tooltip");t&&t.remove()}else{this.ensure(".c-heatmap__tooltip",()=>{const t=document.createElement("div");return t.className="c-heatmap__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t.id=o("heatmap-tip"),t}).setAttribute("hidden","")}}else t.length||Yt(this,"heatmap")}if(this.hasAttribute("legend")&&!this.shed("legend",2)){this.ensure(".c-heatmap__legend",()=>{const t=document.createElement("div");t.className="c-heatmap__legend";const e=document.createElement("div");return e.className="c-heatmap__legend-bar",t.appendChild(e),t})}else{const t=this.querySelector(".c-heatmap__legend");t&&t.remove()}}enhance(){if(this._wiredHeatmap)return;this._wiredHeatmap=!0;const t=()=>Array.from(this.querySelectorAll(".c-heatmap__cell")),e=t=>{const e=this.querySelector(".c-heatmap__tooltip");if(!e)return;const s=t.target&&t.target.closest?t.target.closest(".c-heatmap__cell"):null;if(!s||!this.contains(s))return void e.setAttribute("hidden","");const r=s.getAttribute("data-title")||s.getAttribute("title");e.textContent=r||k(this,"cell","Cell")+" "+(s.dataset.index||"");const i=this.getBoundingClientRect(),a=s.getBoundingClientRect();this.style.position=this.style.position||"relative",e.style.setProperty("--chart-tip-inline-start",a.left-i.left+a.width/2+"px"),e.style.setProperty("--chart-tip-block-start",a.top-i.top+"px"),e.removeAttribute("hidden")},s=()=>{const t=this.querySelector(".c-heatmap__tooltip");t&&t.setAttribute("hidden","")};this.addEventListener("mouseover",e),this.addEventListener("mouseout",t=>{t.relatedTarget&&this.contains(t.relatedTarget)||s()}),this.addEventListener("focusin",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-heatmap__cell"):null;if(s&&this.contains(s)){e({target:s});const t=this.querySelector(".c-heatmap__tooltip");t&&t.id&&s.setAttribute("aria-describedby",t.id)}}),this.addEventListener("focusout",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-heatmap__cell"):null;e&&this.contains(e)&&e.removeAttribute("aria-describedby"),this.contains(t.relatedTarget)||s()}),this.addEventListener("keydown",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-heatmap__cell"):null;if(!s||!this.contains(s))return;const r=t(),i=r.indexOf(s);let a=-1;const n="rtl"===(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase();if("ArrowRight"===e.key)a=n?Math.max(i-1,0):Math.min(i+1,r.length-1);else if("ArrowLeft"===e.key)a=n?Math.min(i+1,r.length-1):Math.max(i-1,0);else if("ArrowDown"===e.key)a=Math.min(i+Math.ceil(Math.sqrt(r.length)),r.length-1);else if("ArrowUp"===e.key)a=Math.max(i-Math.ceil(Math.sqrt(r.length)),0);else if("Home"===e.key)a=0;else if("End"===e.key)a=r.length-1;else if("Enter"===e.key||" "===e.key)return e.preventDefault(),void this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:1,index:i}}));if(a>=0&&a!==i){e.preventDefault(),r.forEach((t,e)=>t.setAttribute("tabindex",e===a?"0":"-1"));try{r[a].focus()}catch(e){}}}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-heatmap__cell"):null;if(!s||!this.contains(s))return;const r=t().indexOf(s);r>=0&&this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:1,index:r}}))})}});c("contour-compare",class extends T{static get observed(){return["no","text","yes","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{no:{attribute:"no"},text:{attribute:"text"},yes:{attribute:"yes"},src:{attribute:"src"}}}render(){this.classList.add("c-compare"),this.setAttribute("role","group");const t="Comparison",e=this.getAttribute("aria-label");if(null!==e&&e!==this._lastAutoAria||(this.setAttribute("aria-label",t),this._lastAutoAria=t),Zt(this),$t(this,["no","text","yes"]),Xt(this,"compare"))return;const s=Jt(this,"yes")||this._remoteData&&this._remoteData.yes,r=Jt(this,"no")||this._remoteData&&this._remoteData.no,i=Jt(this,"text")||this._remoteData&&this._remoteData.text;if(Array.from(this.querySelectorAll(".c-compare__yes, .c-compare__no, .c-compare__text")).forEach(t=>t.remove()),s){const t=document.createElement("span");t.className="c-compare__yes",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-check" /></svg>'),this.appendChild(t)}if(r){const t=document.createElement("div");t.className="c-compare__no",t.textContent=r,this.appendChild(t)}if(i){const t=document.createElement("p");t.className="c-compare__text",t.textContent=i,this.appendChild(t)}s||r||i||Yt(this,"compare")}});c("contour-sparkline",class extends T{static get observed(){return["points","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{points:{attribute:"points"},src:{attribute:"src"}}}render(){if(this.classList.add("c-sparkline"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"sparkline","Sparkline")),Zt(this),$t(this,"points"),Xt(this,"sparkline"))return;const t=Jt(this,"points");if(t)try{const e=JSON.parse(t),s=Array.isArray(e)?e.filter(Number.isFinite):[];if(0===s.length)throw new Error("empty");Array.from(this.querySelectorAll(".c-sparkline__dot, .c-sparkline__line, .c-sparkline__area")).forEach(t=>t.remove());const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","c-sparkline__line"),r.setAttribute("viewBox","0 0 100 30"),r.setAttribute("preserveAspectRatio","none"),r.style.inlineSize="100%",r.style.blockSize="100%",r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("title",this.getAttribute("aria-label")||"Sparkline");const i=Math.min(...s),a=Math.max(...s)-i||1,n=t=>30-(t-i)/a*30;this._sparkScale={min:i,range:a};const c=s.length,l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",s.map((t,e)=>(0===e?"M":"L")+" "+(1===c?50:100*e/(c-1))+" "+n(t)).join(" ")),r.appendChild(l);const u=document.createElementNS("http://www.w3.org/2000/svg","circle");u.setAttribute("class","c-sparkline__dot"),u.setAttribute("r","2"),u.setAttribute("cx","0"),u.setAttribute("cy","15"),r.appendChild(u),this.appendChild(r),this._sparkPoints=e;this.ensure(".c-sparkline__tooltip",()=>{const t=document.createElement("div");return t.className="c-sparkline__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t.id=o("sparkline-tip"),t}).setAttribute("hidden","")}catch(t){Array.from(this.querySelectorAll("svg")).forEach(t=>t.remove()),Yt(this,"sparkline")}else Yt(this,"sparkline")}enhance(){if(this._wiredSparkline)return;this._wiredSparkline=!0,this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const t=t=>{const e=this.querySelector("svg"),s=this.querySelector(".c-sparkline__tooltip"),r=this.querySelector(".c-sparkline__dot");if(!s||!e)return;const i=e.getBoundingClientRect(),a=t.clientX-i.left,n=Math.max(0,Math.min(1,a/i.width)),o=this._sparkPoints||[];if(0===o.length)return;const c=Math.round(n*(o.length-1)),l=o[c],u=1===o.length?50:100*c/(o.length-1),d=this._sparkScale||{min:Math.min(...o),range:Math.max(...o)-Math.min(...o)||1},h=30-(l-d.min)/d.range*30;r&&(r.setAttribute("cx",String(u)),r.setAttribute("cy",String(h)),r.removeAttribute("hidden")),s.textContent=String(l);const m=u/100*i.width;s.style.setProperty("--chart-tip-inline-start",m+"px"),s.style.setProperty("--chart-tip-block-start","0px"),s.removeAttribute("hidden")},e=()=>{const t=this.querySelector(".c-sparkline__tooltip"),e=this.querySelector(".c-sparkline__dot");t&&t.setAttribute("hidden",""),e&&e.setAttribute("hidden","")};this.addEventListener("mousemove",t),this.addEventListener("mouseleave",e),this.addEventListener("focusin",()=>{if(!(this._sparkPoints||[]).length)return;const e=this.querySelector("svg");if(!e)return;const s=e.getBoundingClientRect();t({clientX:s.left+s.width-1});const r=this.querySelector(".c-sparkline__tooltip");r&&r.id&&this.setAttribute("aria-describedby",r.id)}),this.addEventListener("focusout",()=>{this.removeAttribute("aria-describedby"),e()}),this.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{series:1}})))})}});c("contour-chart-grid",class extends T{static get updateMode(){return"keyed"}static get observed(){return["title","series","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{title:{attribute:"title"},series:{attribute:"series"},src:{attribute:"src"}}}render(){this.classList.add("c-chart-grid"),this.setAttribute("role","group");const t="Chart grid",e=this.getAttribute("aria-label");if(null!==e&&e!==this._lastAutoAria||(this.setAttribute("aria-label",t),this._lastAutoAria=t),Zt(this),$t(this,"series"),Xt(this,"chart-grid"))return;const s=this.getAttribute("title");if(s){this.ensure(".c-chart-grid__title",()=>{const t=document.createElement("div");return t.className="c-chart-grid__title",t}).textContent=s}const r=Jt(this,"series");let i=[];if(r)try{const t=JSON.parse(r);Array.isArray(t)&&(i=t)}catch(t){}Array.from(this.querySelectorAll(".c-chart-grid__cell")).forEach(t=>t.remove()),i.forEach((t,e)=>{const s=Array.isArray(t)?t:t&&Array.isArray(t.values)?t.values:[],r=!Array.isArray(t)&&t&&t.label?t.label:k(this,"series","Series")+" "+(e+1),i=s.map(Number).filter(Number.isFinite),a=document.createElement("div");a.className="c-chart-grid__cell";const n=document.createElement("span");if(n.className="c-chart-grid__label",n.textContent=r,a.appendChild(n),i.length>1){const t=Math.min(...i),s=Math.max(...i)-t||1,r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","c-chart-grid__spark"),r.setAttribute("viewBox","0 0 100 30"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("aria-hidden","true");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d",i.map((e,r)=>(0===r?"M":"L")+" "+100*r/(i.length-1)+" "+(30-(e-t)/s*30)).join(" ")),n.style.stroke="var(--chart-"+(e%8+1)+")",n.style.fill="none",n.style.strokeWidth="2",r.appendChild(n),a.appendChild(r)}this.appendChild(a)}),i.length||s||Yt(this,"chart-grid")}});c("contour-contour-plot",class extends T{static get observed(){return["values","levels","label","empty"]}static get properties(){return{values:{attribute:"values"},levels:{attribute:"levels"},label:{attribute:"label"}}}render(){this.classList.add("c-contour-plot"),this.hasAttribute("role")||this.setAttribute("role","group");const t=this.getAttribute("label");!t&&this.hasAttribute("aria-label")||this.setAttribute("aria-label",t||"Contour plot");const e=this.getAttribute("values"),s=this.getAttribute("levels");let r=null;if(e)try{r=JSON.parse(e)}catch(t){r=null}let a=[.3,.5,.7];if(s)try{const t=JSON.parse(s);Array.isArray(t)&&t.length&&(a=t)}catch(t){}let n=this.querySelector("svg");if(n||(n=document.createElementNS("http://www.w3.org/2000/svg","svg"),n.setAttribute("class","c-contour-plot__svg"),this.appendChild(n)),n.removeAttribute("aria-hidden"),Array.from(n.querySelectorAll(".c-contour-plot__contour")).forEach(t=>t.remove()),!Array.isArray(r)||0===r.length||!Array.isArray(r[0])||0===r[0].length){const t=document.createElement("div");return t.className="c-contour-plot__empty",t.textContent=this.getAttribute("empty")||Bt(this,"contour"),void this.appendChild(t)}if(Array.isArray(r)&&r.length>1&&Array.isArray(r[0])&&r[0].length>1){const t=()=>{const t=this.clientWidth||300,e=this.clientHeight||300;n.setAttribute("viewBox",`0 0 ${t} ${e}`),n.querySelectorAll(".c-contour-plot__contour").forEach(t=>t.remove());let s=0;G(r,a,t,e).forEach((t,e)=>{if(!t.d)return;const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",t.d),r.setAttribute("class","c-contour-plot__contour"+(e>0?" c-contour-plot__contour--level-"+(e+1):"")),r.setAttribute("tabindex",0===s?"0":"-1"),r.setAttribute("role","button"),r.setAttribute("aria-label",k(this,"level","Level")+" "+(e+1)+": "+t.level),r.dataset.level=String(e+1),r.dataset.value=String(t.level),s+=1,n.appendChild(r)})};t(),"undefined"==typeof ResizeObserver||this._contourResize||(this._contourResize=new ResizeObserver(()=>t()),this._contourResize.observe(this),i(this,()=>{this._contourResize.disconnect(),this._contourResize=null}))}else if(!Array.isArray(r)){const t=document.createElement("div");t.className="c-contour-plot__empty",t.textContent=this.getAttribute("empty")||"No field",this.appendChild(t)}}enhance(){if(this._wiredContourPlot)return;this._wiredContourPlot=!0;const t=()=>Array.from(this.querySelectorAll(".c-contour-plot__contour")),e=e=>{const s=t().indexOf(e);if(s<0)return;const r=Number(e.dataset.level),i=Number(e.dataset.value);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{level:r,value:i,index:s}}))};this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-contour-plot__contour"):null;s&&this.contains(s)&&e(s)}),this.addEventListener("keydown",s=>{const r=s.target&&s.target.closest?s.target.closest(".c-contour-plot__contour"):null;if(r&&this.contains(r))if("Enter"===s.key||" "===s.key)s.preventDefault(),e(r);else{const e=t();z(s,e,{wrap:!1,homeEnd:!0,rtl:I(this),onNavigate:t=>e.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1"))})}})}});c("contour-error-boundary",class extends T{static get observed(){return["fallback","error"]}static get properties(){return{fallback:{attribute:"fallback"},error:{attribute:"error"}}}render(){this.classList.add("c-error-boundary"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite");if(this.getAttribute("error")){this.dataset.state="error",Array.from(this.children).forEach(t=>{t.hasAttribute("data-fallback")||(void 0===t.dataset.contourDisplay&&(t.dataset.contourDisplay=t.style.display),t.style.display="none")});let t=this.querySelector("[data-fallback]");t?("none"===t.style.display&&(t.style.display=""),("1"===t.dataset.contourGenerated||this.hasAttribute("fallback"))&&(t.textContent=this.getAttribute("fallback")||t.textContent||"Something went wrong.")):(t=document.createElement("div"),t.className="c-error-boundary__fallback",t.dataset.fallback="",t.dataset.contourGenerated="1",t.textContent=this.getAttribute("fallback")||"Something went wrong.",this.appendChild(t))}else this.dataset.state="ready",Array.from(this.children).forEach(t=>{t.hasAttribute("data-fallback")?"1"===t.dataset.contourGenerated?t.remove():t.style.display="none":void 0!==t.dataset.contourDisplay?(t.style.display=t.dataset.contourDisplay,delete t.dataset.contourDisplay):"none"===t.style.display&&(t.style.display="")})}enhance(){this._wiredErrorBoundary||(this._wiredErrorBoundary=!0,this.addEventListener("error",t=>{t.stopPropagation();const e=t&&t.error&&t.error.message?t.error.message:t&&t.message?t.message:"Unknown error",s=t&&t.target&&(t.target.src||t.target.href)?t.target.src||t.target.href:void 0;this.setAttribute("error",e),this.dispatchEvent(new CustomEvent("contour:error",{bubbles:!0,composed:!0,detail:s?{message:e,src:s}:{message:e}}))},!0))}});c("contour-data-export",class extends T{static get observed(){return["data","format","filename","label"]}static get properties(){return{data:{attribute:"data"},format:{attribute:"format"},filename:{attribute:"filename"},label:{attribute:"label"}}}render(){this.classList.add("c-data-export"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"data-export","Data export"));const t=(this.getAttribute("format")||"json").toLowerCase(),e="csv"===t||"json"===t?t:"json",s=this.ensure(".c-data-export__btn",()=>{const t=document.createElement("button");return t.className="c-btn c-data-export__btn",t.type="button",t});L(s,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-download" /></svg>'),s.appendChild(document.createTextNode(" "+(this.getAttribute("label")||k(this,"export","Export")+" "+e.toUpperCase()))),s.parentNode!==this&&this.appendChild(s)}enhance(){if(this._wiredDataExport)return;this._wiredDataExport=!0;const t=t=>{let e=null==t?"":String(t);return/^[=+\-@\t\r]/.test(e)&&(e="'"+e),/[",\r\n]/.test(e)?'"'+e.replace(/"/g,'""')+'"':e};this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-data-export__btn"):null;if(!s||!this.contains(s))return;const r=(this.getAttribute("format")||"json").toLowerCase(),i="csv"===r||"json"===r?r:(console.warn("[contour-data-export] unsupported format:",r),"json"),a=this.getAttribute("data")||"[]";let n=a;if("csv"===i)try{const e=JSON.parse(a);if(Array.isArray(e))if(0===e.length)n="";else{const s=Object.keys(e[0]);n=[s.map(t).join(",")].concat(e.map(e=>s.map(s=>t(e[s])).join(","))).join("\r\n")}}catch(t){f(this,"data",t)}const o=new Blob(["csv"===i?"\ufeff"+n:n],{type:"csv"===i?"text/csv":"application/json"}),c=URL.createObjectURL(o),l=document.createElement("a");l.href=c,l.download=this.getAttribute("filename")||"export."+i,document.body.appendChild(l),l.click(),l.remove(),setTimeout(()=>URL.revokeObjectURL(c),0),this.dispatchEvent(new CustomEvent("contour:export",{bubbles:!0,composed:!0,detail:{format:i}}))})}});class ae extends T{static get observed(){return["query","fields"]}static get properties(){return{query:{attribute:"query"},fields:{attribute:"fields"}}}readRules(){const t=[],e=Array.from(this.querySelectorAll(".c-query-builder__row")),s=Array.from(this.querySelectorAll(".c-query-builder__connector__op"));return e.forEach((e,r)=>{const i={field:e.querySelector(".c-query-builder__field")?.value||"",op:e.querySelector(".c-query-builder__op")?.value||"=",value:e.querySelector(".c-query-builder__value")?.value||""};r>0&&s[r-1]&&(i.connector=s[r-1].value||"AND");const a=e.closest(".c-query-builder__group");a&&(i.group=a._groupName||""),t.push(i)}),t}static reindexConnectors(t,e){return t.forEach((t,s)=>{s>0&&e&&e[s]?t.connector=e[s]:delete t.connector}),t}attributeChangedCallback(t,e,s){"query"===t&&this._suppressQueryRender||super.attributeChangedCallback(t,e,s)}commit(t,e=!0){if(e)this.setAttribute("query",JSON.stringify(t));else{this._suppressQueryRender=!0;try{this.setAttribute("query",JSON.stringify(t))}finally{this._suppressQueryRender=!1}}this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{query:t}}))}render(){this.classList.add("c-query-builder");const t=this.getAttribute("fields");let e=[];if(t)try{e=JSON.parse(t)}catch(t){e=[]}const s=this.getAttribute("query");let r=[];if(s)try{r=JSON.parse(s)}catch(t){r=[]}const i=this.ensure(".c-query-builder__list",()=>{const t=document.createElement("div");return t.className="c-query-builder__list",t});Array.from(i.querySelectorAll(".c-query-builder__row, .c-query-builder__connector, .c-query-builder__group")).forEach(t=>t.remove());let a=null;r.forEach((t,s)=>{const n=t&&t.group?String(t.group):"",o=!(!n||!a||a._groupName!==n);let c=null;if(s>0){c=document.createElement("div"),c.className="c-query-builder__connector";const e=document.createElement("select");e.className="c-input c-query-builder__connector__op",e.setAttribute("aria-label",k(this,"connector","Connector")+" "+s),["AND","OR"].forEach(s=>{const r=document.createElement("option");r.value=s,r.textContent=s,s===(t.connector||"AND")&&(r.selected=!0),e.appendChild(r)}),c.appendChild(e)}if(n)if(o)c&&a.appendChild(c);else{c&&i.appendChild(c),a=document.createElement("div"),a.className="c-query-builder__group",a._groupName=n;const t=document.createElement("div");t.className="c-query-builder__group-head";const e=document.createElement("div");e.className="c-query-builder__group-label",e.textContent=n;const s=document.createElement("button");s.type="button",s.className="c-btn c-btn--sm c-btn--ghost c-query-builder__group-remove",s.setAttribute("aria-label",k(this,"remove-group","Remove group")+" "+n),s.setAttribute("data-group",n),s.textContent="×",t.appendChild(e),t.appendChild(s),a.appendChild(t),i.appendChild(a)}else c&&i.appendChild(c),a=null;const l=document.createElement("div");l.className="c-query-builder__row";const u=document.createElement("select");u.className="c-input c-query-builder__field",u.setAttribute("aria-label",k(this,"field","Field")+" "+(s+1)),e.forEach(e=>{const s=document.createElement("option");s.value="string"==typeof e?e:e.value||e.label||"",s.textContent="string"==typeof e?e:e.label||e.value||"",s.value===t.field&&(s.selected=!0),u.appendChild(s)});const d=document.createElement("select");d.className="c-input c-query-builder__op",d.setAttribute("aria-label",k(this,"operator","Operator")+" "+(s+1)),["=","!=",">","<","contains"].forEach(e=>{const s=document.createElement("option");s.value=e,s.textContent=e,e===t.op&&(s.selected=!0),d.appendChild(s)});const h=document.createElement("input");h.className="c-input c-query-builder__value",h.type="text",h.setAttribute("value",t.value||""),h.value=t.value||"",h.setAttribute("aria-label",k(this,"value","Value")+" "+(s+1));const m=document.createElement("button");m.type="button",m.className="c-btn c-btn--sm c-btn--ghost c-query-builder__move c-query-builder__move--up",m.setAttribute("aria-label",k(this,"move-rule","Move rule")+" "+(s+1)+" "+k(this,"up","up")),m.textContent="↑",0===s&&(m.disabled=!0);const b=document.createElement("button");b.type="button",b.className="c-btn c-btn--sm c-btn--ghost c-query-builder__move c-query-builder__move--down",b.setAttribute("aria-label",k(this,"move-rule","Move rule")+" "+(s+1)+" "+k(this,"down","down")),b.textContent="↓",s===r.length-1&&(b.disabled=!0);const p=document.createElement("button");p.type="button",p.className="c-btn c-btn--sm c-btn--ghost c-query-builder__remove",p.setAttribute("aria-label",k(this,"remove-rule","Remove rule")+" "+(s+1)),p.textContent="×",l.appendChild(u),l.appendChild(d),l.appendChild(h),l.appendChild(m),l.appendChild(b),l.appendChild(p),a?a.appendChild(l):i.appendChild(l)});const n=this.ensure(".c-query-builder__add",()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--sm c-query-builder__add",t});L(n,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-plus" /></svg>'),n.appendChild(document.createTextNode(" "+k(this,"add-rule","Add rule"))),n.parentNode!==this&&this.appendChild(n);const o=this.ensure(".c-query-builder__add-group",()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--sm c-btn--ghost c-query-builder__add-group",t});L(o,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-plus" /></svg>'),o.appendChild(document.createTextNode(" "+k(this,"add-group","Add group"))),o.parentNode!==this&&this.appendChild(o)}enhance(){this._wiredQueryBuilder||(this._wiredQueryBuilder=!0,this.addEventListener("change",t=>{const e=t.target;e instanceof Element&&e.matches(".c-query-builder__field, .c-query-builder__op, .c-query-builder__value, .c-query-builder__connector__op")&&this.commit(this.readRules(),!1)}),this.addEventListener("click",t=>{const e=t.target;if(!(e instanceof Element))return;if(e.closest(".c-query-builder__add")){const t=this.readRules().map(t=>t.connector),e=this.readRules();e.push({field:"",op:"=",value:""}),this.commit(ae.reindexConnectors(e,t));const s=this.querySelectorAll(".c-query-builder__row"),r=s[s.length-1],i=r&&r.querySelector(".c-query-builder__field");if(i)try{i.focus()}catch(t){}return}if(e.closest(".c-query-builder__add-group")){const t=this.readRules().map(t=>t.connector),e=this.readRules(),s=new Set(e.map(t=>t.group).filter(Boolean));let r=1;for(;s.has("Group "+r);)r++;e.push({field:"",op:"=",value:"",group:"Group "+r}),this.commit(ae.reindexConnectors(e,t));const i=this.querySelectorAll(".c-query-builder__row"),a=i[i.length-1],n=a&&a.querySelector(".c-query-builder__field");if(n)try{n.focus()}catch(t){}return}const s=e.closest(".c-query-builder__group-remove");if(s){const t=s.getAttribute("data-group")||"",e=this.readRules().map(t=>t.connector),r=this.readRules().filter(e=>(e.group||"")!==t);return void this.commit(ae.reindexConnectors(r,e))}const r=e.closest(".c-query-builder__move");if(r){const t=r.closest(".c-query-builder__row");if(!t)return;const e=r.classList.contains("c-query-builder__move--up"),s=this.readRules().map(t=>t.connector),i=this.readRules(),a=Array.from(this.querySelectorAll(".c-query-builder__row")).indexOf(t);if(a<0)return;const n=e?a-1:a+1;if(n<0||n>=i.length)return;const o=i[n];i[n]=i[a],i[a]=o,this.commit(ae.reindexConnectors(i,s));const c=this.querySelectorAll(".c-query-builder__row")[n],l=c&&c.querySelector(e?".c-query-builder__move--up":".c-query-builder__move--down");if(l&&!l.disabled)try{l.focus()}catch(t){}return}if(e.closest(".c-query-builder__remove")){const t=e.closest(".c-query-builder__row");if(!t)return;const s=this.readRules().map(t=>t.connector),r=this.readRules(),i=Array.from(this.querySelectorAll(".c-query-builder__row")).indexOf(t);i>=0&&r.splice(i,1),this.commit(ae.reindexConnectors(r,s))}}))}}function ne(t,e,s,r){const i=_(t.getAttribute(e));if(i)return i;try{const e=getComputedStyle(t).getPropertyValue(s).trim();if(e)return e}catch(t){}return r}c("contour-query-builder",ae);c("contour-donut-glyph",class extends T{static get observed(){return["size","value","color","stroke-width","bg-color","empty","loading","error","cache-key","no-cache","retry","skeleton","src"]}static get properties(){return{size:{attribute:"size"},value:{attribute:"value"},color:{attribute:"color"},strokeWidth:{attribute:"stroke-width"},bgColor:{attribute:"bg-color"}}}render(){if(this.classList.add("c-donut-glyph"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"donut-glyph","Donut glyph")),Zt(this),Xt(this,"donut-glyph"))return;const t=this.querySelector("canvas");t&&t.remove();const e=Number(this.getAttribute("size"))||24,s=document.createElement("canvas");s.width=e,s.height=e,s.style.inlineSize=e+"px",s.style.blockSize=e+"px";const r=s.getContext("2d");r&&(!function(t,{size:e=24,value:s=0,color:r="#1f77b4",strokeWidth:i,bgColor:a="transparent"}={}){const n=Number(e)||24,o=null!=i?Number(i):Y(n),c=X(s),l=n/2,u=n/2,d=(n-o)/2;a&&"transparent"!==a?(t.fillStyle=a,t.fillRect(0,0,n,n)):t.clearRect(0,0,n,n),t.beginPath(),t.arc(l,u,d,0,2*Math.PI),t.lineWidth=o,t.strokeStyle="rgba(0,0,0,0.12)",t.stroke(),c>0&&(t.beginPath(),t.arc(l,u,d,-Math.PI/2,-Math.PI/2+2*c*Math.PI),t.lineWidth=o,t.strokeStyle=r,t.lineCap="round",t.stroke())}(r,{size:e,value:Number(this.getAttribute("value"))||0,color:ne(this,"color","--color-data","#1f77b4"),strokeWidth:this.getAttribute("stroke-width")?Number(this.getAttribute("stroke-width")):void 0,bgColor:this.getAttribute("bg-color")||"transparent"}),this.appendChild(s))}});c("contour-sparkline-glyph",class extends T{static get observed(){return["size","points","color","stroke-width","bg-color","empty","loading","error","cache-key","no-cache","retry","skeleton","src"]}static get properties(){return{size:{attribute:"size"},points:{attribute:"points"},color:{attribute:"color"},strokeWidth:{attribute:"stroke-width"},bgColor:{attribute:"bg-color"}}}render(){if(this.classList.add("c-sparkline-glyph"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"sparkline-glyph","Sparkline glyph")),Zt(this),Xt(this,"sparkline-glyph"))return;const t=this.querySelector("canvas");t&&t.remove();const e=Number(this.getAttribute("size"))||24,s=document.createElement("canvas");s.width=e,s.height=e,s.style.inlineSize=e+"px",s.style.blockSize=e+"px";const r=s.getContext("2d");if(!r)return;let i=[];const a=this.getAttribute("points");if(a)try{const t=JSON.parse(a);i=Array.isArray(t)?t.filter(Number.isFinite):[]}catch(t){f(this,"points",t)}Q(r,{size:e,values:i,color:ne(this,"color","--color-data","#1f77b4"),strokeWidth:this.getAttribute("stroke-width")?Number(this.getAttribute("stroke-width")):void 0,bgColor:this.getAttribute("bg-color")||"transparent"}),this.appendChild(s)}});c("contour-purity-ring",class extends T{static get observed(){return["size","hue","concentration","color","uncertainty","time-step","time-steps","empty","loading","error","cache-key","no-cache","retry","skeleton","src"]}static get properties(){return{size:{attribute:"size"},hue:{attribute:"hue"},concentration:{attribute:"concentration"},color:{attribute:"color"},uncertainty:{attribute:"uncertainty"},timeStep:{attribute:"time-step"},timeSteps:{attribute:"time-steps"}}}render(){if(this.classList.add("c-purity-ring"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"purity-ring","Purity ring")),Zt(this),Xt(this,"purity-ring"))return;const t=this.querySelector("canvas");t&&t.remove();const e=Number(this.getAttribute("size"))||32,s=document.createElement("canvas");s.width=e,s.height=e,s.style.inlineSize=e+"px",s.style.blockSize=e+"px";const r=s.getContext("2d");r&&(Z(r,{size:e,hue:Number(this.getAttribute("hue"))||0,concentration:Number(this.getAttribute("concentration"))||0,color:ne(this,"color","--color-data",void 0),uncertainty:Number(this.getAttribute("uncertainty"))||0,timeStep:this.getAttribute("time-step")?Number(this.getAttribute("time-step")):void 0,timeSteps:this.getAttribute("time-steps")?Number(this.getAttribute("time-steps")):4}),this.appendChild(s))}});const oe=t=>{const e=String(null==t?"":t).trim();if(!e)return"";if(e.startsWith("#"))return"hash:"+e;try{const t="undefined"!=typeof location?location.href:"http://localhost/",s=new URL(e,t);return"path:"+s.pathname.replace(/\/+$/,"")+s.search}catch(t){return"raw:"+e}};c("contour-docs-nav",class extends T{static get observed(){return["items","title","current","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","empty","no-cache"]}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 t=this.getAttribute("title");if(t?this.setAttribute("aria-label",t):this.setAttribute("aria-label",k(this,"documentation-navigation","Documentation navigation")),Zt(this),$t(this,"items"),Xt(this,"docs-nav"))return;const e=Jt(this,"items"),s=this.hasAttribute("src")?e:e||(this.hasAttribute("items")?this.getAttribute("items"):null),r=this.querySelector(".c-docs-nav__list"),i=r?Array.from(r.children).filter(t=>t.classList&&t.classList.contains("c-docs-nav__group")):[];if(s&&!i.length)try{const t=JSON.parse(s),e=this.ensure(".c-docs-nav__list",()=>{const t=document.createElement("div");return t.className="c-docs-nav__list",t});e.innerHTML="",t.forEach(t=>{const s=document.createElement("div");if(s.className="c-docs-nav__group",t.title){const e=document.createElement("div");e.className="c-docs-nav__group-title",e.textContent=t.title,s.appendChild(e)}const r=document.createElement("div");r.className="c-docs-nav__list",(t.links||t.items||[]).forEach(t=>{const e=document.createElement("a");e.className="c-docs-nav__link",e.href=v("string"==typeof t?"#":t.href||"#");const s="string"==typeof t?t:t.label||t;if("object"==typeof t&&null!==t&&t.badge){const s=document.createElement("span");s.className="c-docs-nav__badge",s.textContent=t.badge,e.appendChild(s)}if(e.appendChild(document.createTextNode(s)),"object"==typeof t&&null!==t&&t.chevron){const t=document.createElement("span");t.className="c-docs-nav__chevron",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),e.appendChild(t)}if("object"==typeof t&&null!==t&&Array.isArray(t.items)){e.classList.add("c-docs-nav__link--nested");const s=document.createElement("div");s.className="c-docs-nav__list c-docs-nav__list--nested",t.items.forEach(t=>{const e=document.createElement("a");e.className="c-docs-nav__link",e.href=v("string"==typeof t?"#":t.href||"#"),e.textContent="string"==typeof t?t:t.label||t,s.appendChild(e)}),r.appendChild(e),r.appendChild(s)}else r.appendChild(e)}),s.appendChild(r),e.appendChild(s)})}catch(t){f(this,"attribute",t)}else!s&&r?(r.remove(),Yt(this,"docs-nav")):s||r||Yt(this,"docs-nav");this.applyCurrent()}applyCurrent(){const t=Array.from(this.querySelectorAll(".c-docs-nav__link"));if(!t.length)return;const e=this.getAttribute("current"),s=(t=>{const e=String(null==t?"":t).trim();return e?oe(e):"undefined"==typeof location?"":"path:"+String(location.pathname||"").replace(/\/+$/,"")+(location.search||"")})(e);t.forEach(t=>{const r=t.getAttribute("href")||"",i=oe(r);Boolean(s)&&(i&&i===s||r.startsWith("#")&&!e&&(t=>{if("undefined"==typeof location)return!1;if(location.hash&&location.hash===t)return!0;const e=String(location.pathname||"").split("/").filter(Boolean).pop()||"";return Boolean(e)&&t==="#"+e})(r))?t.setAttribute("aria-current","page"):t.removeAttribute("aria-current")})}enhance(){if(!this._wiredDocsNav&&(this._wiredDocsNav=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-docs-nav__link"):null;if(e&&this.contains(e)){const t=e.textContent||"";this.dispatchEvent(new CustomEvent("contour:docs-nav-select",{bubbles:!0,composed:!0,detail:{label:t,href:e.getAttribute("href")}}))}}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-docs-nav__link"));e.length&&(e.some(t=>0===t.tabIndex)||e.forEach((t,e)=>t.tabIndex=0===e?0:-1),z(t,e,{wrap:!0,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e){const e=document.activeElement;e&&(t.preventDefault(),e.click())}}}))}),"undefined"!=typeof window&&window.addEventListener)){const t=()=>this.applyCurrent();window.addEventListener("hashchange",t),window.addEventListener("popstate",t),i(this,()=>{window.removeEventListener("hashchange",t),window.removeEventListener("popstate",t)})}}});c("contour-docs-shell",class extends T{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 t=this.getAttribute("title");if(t){this.ensure(".c-docs-shell__title",()=>{const t=document.createElement(E(this,"h2"));return t.className="c-docs-shell__title",t}).textContent=t,this.setAttribute("aria-label",t)}else{const t=this.querySelector(".c-docs-shell__title");t&&t.remove()}const e=this.getAttribute("lede");if(e){this.ensure(".c-docs-shell__lede",()=>{const t=document.createElement("p");return t.className="c-docs-shell__lede",t}).textContent=e}else{const t=this.querySelector(".c-docs-shell__lede");t&&t.remove()}const s=this.getAttribute("article");if(s){L(this.ensure(".c-docs-shell__article",()=>{const t=document.createElement("article");return t.className="c-docs-shell__article",t}),g(s))}else{const t=this.querySelector(".c-docs-shell__article");t&&t.remove()}}});c("contour-file-tree",class extends T{static get updateMode(){return"keyed"}static get observed(){return["items"]}static get properties(){return{items:{attribute:"items"}}}render(){this.classList.add("c-file-tree");const t=this.getAttribute("items");if(t)try{const e=JSON.parse(t),s=(t,e)=>{const r=document.createElement("div");r.className="c-file-tree__row"+(t.dir?" c-file-tree__row--dir":"")+(t.active?" c-file-tree__row--active":""),r.style.setProperty("--depth",String(e));const i=document.createElement("span");L(i,t.dir?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-folder" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-file" /></svg>'),i.appendChild(document.createTextNode(" "+(t.label||t.name||""))),r.appendChild(i),this.appendChild(r),Array.isArray(t.children)&&t.children.forEach(t=>s(t,e+1))};Array.from(this.querySelectorAll(".c-file-tree__row")).forEach(t=>t.remove()),e.forEach(t=>s(t,0))}catch(t){f(this,"attribute",t)}}});function ce(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function le(t){if(!t.hasAttribute("open")||t._modalEngaged)return;t._modalEngaged=!0,t.setAttribute("aria-modal","true"),Ft(t,!0);const e=t.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(e)try{e.focus()}catch(t){}}function ue(t,e,s,r){if("open"===e&&r&&!t._declarativeOpen){t._declarativeOpen=!0;try{null===s||t.hasAttribute("aria-modal")?null===s&&t.hasAttribute("aria-modal")&&t.close():(t.removeAttribute("open"),t.show())}finally{t._declarativeOpen=!1}}}c("contour-changelog",class extends T{static get observed(){return["src","max","loading","error"]}static get properties(){return{src:{attribute:"src"},max:{attribute:"max",type:Number}}}render(){this.classList.add("c-changelog");const t=this.getAttribute("src");if(t){if(this.dataset.loaded===t)return;this.dataset.loaded="";const e=this.ensure(".c-changelog__loading",()=>{const t=document.createElement("div");return t.className="c-changelog__loading",t});e.textContent=k(this,"loading","Loading…"),Array.from(this.querySelectorAll(".c-changelog__entry, .c-changelog__error")).forEach(t=>t.remove()),this.querySelector(".c-changelog__loading")||this.appendChild(e);try{this._changelogAbort&&this._changelogAbort.abort()}catch(t){}this._changelogAbort="undefined"!=typeof AbortController?new AbortController:null,fetch(t,this._changelogAbort?{signal:this._changelogAbort.signal}:void 0).then(t=>{if(!t.ok)throw new Error("HTTP "+t.status);return t.text()}).then(e=>{if(!this.isConnected)return;const s=this.querySelector(".c-changelog__loading");s&&s.remove(),this.dataset.loaded=t;const r=function(t){const e=String(t).split(/\r?\n/),s=[];let r=null;for(const t of e){const e=t.match(/^##\s+\[?([^\]\n]+)\]?\s*[-–—]?\s*(.*)$/);if(e&&t.startsWith("## ")){const t=e[1].trim(),i=e[2].trim();if(/^\d|unreleased/i.test(t)){r&&s.push(r),r={version:t,date:i.replace(/^[-–—]\s*/,"").trim(),body:""};continue}}r&&(r.body+=t+"\n")}r&&s.push(r);return s}(e),i=parseInt(this.getAttribute("max")||"0",10),a=i>0?r.slice(0,i):r;if(!a.length){const t=document.createElement("div");return t.className="c-changelog__empty",t.textContent=k(this,"empty","No releases found."),void this.appendChild(t)}a.forEach(t=>{const e=document.createElement("details");e.className="c-changelog__entry";const s=document.createElement("summary");s.className="c-changelog__summary";const r=document.createElement("span");if(r.className="c-changelog__version",r.textContent=t.version,s.appendChild(r),t.date){const e=document.createElement("span");e.className="c-changelog__date",e.textContent=t.date,s.appendChild(e)}e.appendChild(s);const i=document.createElement("div");i.className="c-changelog__body",L(i,function(t){const e=String(t).trim().split(/\r?\n/),s=[];let r=!1;for(const t of e){const e=t.trimEnd();/^###\s+/.test(e)?(r&&(s.push("</ul>"),r=!1),s.push("<h3>"+ce(e.replace(/^###\s+/,""))+"</h3>")):/^##\s+/.test(e)?(r&&(s.push("</ul>"),r=!1),s.push("<h2>"+ce(e.replace(/^##\s+/,""))+"</h2>")):/^#\s+/.test(e)?(r&&(s.push("</ul>"),r=!1),s.push("<h2>"+ce(e.replace(/^#\s+/,""))+"</h2>")):/^[-*]\s+/.test(e)?(r||(s.push("<ul>"),r=!0),s.push("<li>"+ce(e.replace(/^[-*]\s+/,""))+"</li>")):""===e.trim()?r&&(s.push("</ul>"),r=!1):(r&&(s.push("</ul>"),r=!1),s.push("<p>"+ce(e)+"</p>"))}r&&s.push("</ul>");return s.join("")}(t.body)),e.appendChild(i),this.appendChild(e)})}).catch(t=>{if(!this.isConnected)return;const e=this.querySelector(".c-changelog__loading");e&&e.remove();const s=document.createElement("div");s.className="c-changelog__error",s.textContent=k(this,"load-error","Failed to load changelog")+": "+(t&&t.message?t.message:t),this.appendChild(s)})}}disconnectedCallback(){super.disconnectedCallback();try{this._changelogAbort&&this._changelogAbort.abort()}catch(t){}this._changelogAbort=null}});c("contour-dialog",class extends T{static get observed(){return["title","size","heading","open"]}static get properties(){return{title:{attribute:"title"},size:{attribute:"size"}}}attributeChangedCallback(t,e,s){"open"!==t?super.attributeChangedCallback(t,e,s):ue(this,t,s,this._wiredDialog)}showModal(){this.show()}get open(){return this.hasAttribute("open")}set open(t){t?this.show():this.close()}render(){this.classList.add("c-dialog"),Array.from(this.classList).forEach(t=>{t.startsWith("c-dialog--")&&this.classList.remove(t)});const t=this.getAttribute("size");t&&this.classList.add("c-dialog--"+t),this.hasAttribute("role")||this.setAttribute("role","dialog");const e=this.getAttribute("title");let s=this.querySelector(".c-dialog__head");if(e){if(!s){s=document.createElement("div"),s.className="c-dialog__head";const t=document.createElement(E(this,"h2"));t.className="c-dialog__title",s.appendChild(t);const e=document.createElement("button");e.className="c-btn c-btn--icon c-btn--ghost c-dialog__close",e.setAttribute("type","button"),e.setAttribute("aria-label",k(this,"close","Close")),L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-x" /></svg>'),s.appendChild(e)}const t=s.querySelector(".c-dialog__title");t&&(t.textContent=e,t.id||(t.id=o("contour-dialog-title")),this.setAttribute("aria-labelledby",t.id))}s&&s.parentNode!==this&&this.prepend(s);const r=this.ensure(".c-dialog__body",()=>{const t=document.createElement("div");return t.className="c-dialog__body",t});Array.from(this.childNodes).forEach(t=>{t!==r&&t!==s&&(1===t.nodeType&&t.classList&&t.classList.contains("c-dialog__head")||r.appendChild(t))}),s&&s.parentNode===this?(r.parentNode!==this||s.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_PRECEDING)&&this.insertBefore(r,s.nextSibling):r.parentNode!==this&&this.appendChild(r)}enhance(){this._wiredDialog||(this._wiredDialog=!0,this.returnValue="",i(this,()=>{this.hasAttribute("open")&&Ft(this,!1)}),this.show=()=>{if(this.hasAttribute("open"))return;this._dialogLastFocus=document.activeElement,this._declarativeOpen=!0;try{this.setAttribute("open","")}finally{this._declarativeOpen=!1}this.setAttribute("aria-modal","true");const t=this.querySelector("dialog")||("DIALOG"===this.tagName?this:null);if(t&&"function"==typeof t.showModal)try{t.showModal()}catch(t){}Ft(this,!0);const e=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(e)try{e.focus()}catch(t){}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}))},this.close=()=>{const t=this.hasAttribute("open")||this.hasAttribute("aria-modal"),e=this.querySelector("dialog")||("DIALOG"===this.tagName?this:null);e&&"function"==typeof e.close&&e.close(),this._declarativeOpen=!0;try{this.hasAttribute("open")&&this.removeAttribute("open")}finally{this._declarativeOpen=!1}if(this.removeAttribute("aria-modal"),t){Ft(this,!1),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}));const t=this._dialogLastFocus;if(t&&"function"==typeof t.focus)try{t.focus()}catch(t){}}},this.focus=()=>{const t=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(t)try{t.focus()}catch(t){}else try{HTMLElement.prototype.focus.call(this)}catch(t){}},this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-dialog__close"):null;(e&&this.contains(e)||t.target===this)&&this.close()}),this.addEventListener("keydown",t=>{"Escape"===t.key&&this.hasAttribute("open")&&this.close()}),le(this))}});class de extends T{static get observed(){return["title","body","variant","icon","closable","action","actions","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}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");const t=/^(warning|danger)$/.test(this.getAttribute("variant")||""),e=t?"alert":"status",s=t?"assertive":"polite";if(this.hasAttribute("role")&&this.getAttribute("role")!==this._autoRole||(this.setAttribute("role",e),this._autoRole=e),this.hasAttribute("aria-live")&&this.getAttribute("aria-live")!==this._autoLive||(this.setAttribute("aria-live",s),this._autoLive=s),Zt(this),$t(this,"title"),Xt(this,"alert"))return;const r=this.getAttribute("variant");Array.from(this.classList).forEach(t=>{t.startsWith("c-alert--")&&this.classList.remove(t)}),r&&this.classList.add("c-alert--"+r);const i=this.getAttribute("icon"),a="none"===i?"":i||C(r);if(a){const t=this.ensure(".c-alert__icon",()=>{const t=document.createElement("span");return t.className="c-alert__icon",t});t.parentNode===this&&this.firstChild!==t&&this.prepend(t),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(a).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>')}else{const t=this.querySelector(".c-alert__icon");t&&t.remove()}const n=this.getAttribute("title")||this._remoteData&&this._remoteData.title;if(n){const t=this.ensure(".c-alert__title",()=>{const t=document.createElement("div");return t.className="c-alert__title",t});t.parentNode===this&&this.firstChild!==t&&this.prepend(t),t.textContent=n}else{const t=this.querySelector(".c-alert__title");t&&t.remove()}const o=this.getAttribute("body"),c=Array.from(this.childNodes).filter(t=>(1!==t.nodeType||!t.classList||!(t.classList.contains("c-alert__icon")||t.classList.contains("c-alert__title")||t.classList.contains("c-alert__body")))&&!(3===t.nodeType&&!t.textContent.trim()));if(c.length){const t=this.ensure(".c-alert__body",()=>{const t=document.createElement("div");return t.className="c-alert__body",t});t.textContent="";for(const e of c)t.appendChild(e)}else if(o){this.ensure(".c-alert__body",()=>{const t=document.createElement("div");return t.className="c-alert__body",t}).textContent=o}else{const t=this.querySelector(".c-alert__body");t&&t.remove()}Array.from(this.querySelectorAll(".c-alert__action")).forEach(t=>t.remove());const l=this.getAttribute("actions");let u=[];if(l)try{const t=JSON.parse(l);Array.isArray(t)&&(u=t.map(t=>String(t)))}catch(t){u=[l]}else{const t=this.getAttribute("action");t&&(u=[t])}if(u.forEach(t=>{const e=document.createElement("button");e.className="c-btn c-btn--sm c-alert__action",e.type="button",e.setAttribute("data-alert-action",""),e.textContent=t,this.appendChild(e)}),w(this,"closable"))this.ensure(".c-alert__close",()=>{const t=document.createElement("button");return t.className="c-alert__close",t.type="button",t.setAttribute("aria-label",k(this,"close","Close")),t.textContent="×",t});else{const t=this.querySelector(".c-alert__close");t&&t.remove()}n||o||a||c.length||Yt(this,"alert")}}de.prototype.enhance=function(){this._wiredAlert||(this._wiredAlert=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-alert__action"):null;if(e&&this.contains(e))return t.preventDefault(),void this.dispatchEvent(new CustomEvent("contour:action",{bubbles:!0,composed:!0,detail:{label:e.textContent.trim()}}));const s=t.target&&t.target.closest?t.target.closest(".c-alert__close"):null;s&&this.contains(s)&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})),this.remove())}))},c("contour-alert",de);c("contour-disclosure",class extends T{static get observed(){return["summary","icon"]}static get properties(){return{summary:{attribute:"summary"},icon:{attribute:"icon"}}}disconnectedCallback(){this._disclosureContent=null,super.disconnectedCallback()}connectedCallback(){this.innerHTML.trim()&&!this._disclosureContent&&(this._disclosureContent=this.innerHTML),super.connectedCallback()}attributeChangedCallback(t,e,s){const r=this.querySelector("details");if(r){const t=r.querySelector(".c-disclosure__body");t&&(this._disclosureContent=t.innerHTML)}else this.innerHTML.trim()&&(this._disclosureContent=this.innerHTML);super.attributeChangedCallback(t,e,s)}render(){this.classList.add("c-disclosure");const t=this.getAttribute("summary"),e=this.getAttribute("icon");if(t){let s=this.innerHTML.trim()?this.innerHTML:this._disclosureContent||"";s.trim()&&(this._disclosureContent=s);const r=this.ensure("details",()=>{const r=document.createElement("details"),i=document.createElement("summary");if(i.className="c-disclosure__summary",e){const t=document.createElement("span");t.className="c-disclosure__icon",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(e).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'),i.appendChild(t)}i.appendChild(document.createTextNode(t)),r.appendChild(i);const a=document.createElement("div");return a.className="c-disclosure__body",L(a,s),r.appendChild(a),r}),i=r.querySelector("summary");if(i){const s=i.querySelector(".c-disclosure__icon");if(e&&!s){const t=document.createElement("span");t.className="c-disclosure__icon",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(e).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'),i.insertBefore(t,i.firstChild)}else!e&&s&&s.remove();Array.from(i.childNodes).filter(t=>3===t.nodeType).forEach(t=>t.remove()),i.appendChild(document.createTextNode(t))}const a=r.querySelector(".c-disclosure__body");a&&L(a,s),r.parentNode!==this&&(L(this,""),this.appendChild(r))}else{const t=this.querySelector("details");t&&t.remove()}}enhance(){this._wiredDisclosure||(this._wiredDisclosure=!0,this.addEventListener("toggle",t=>{const e=t.target;e&&"DETAILS"===e.tagName&&this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:e.open},bubbles:!0,composed:!0}))},!0))}});class he extends T{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"),this.hasAttribute("role")||this.setAttribute("role","note"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Callout"),Array.from(this.classList).forEach(t=>{t.startsWith("c-callout--")&&this.classList.remove(t)});const t=this.getAttribute("variant");t&&this.classList.add("c-callout--"+t);const e=this.getAttribute("icon"),s="none"===e?"":e||C(t);if(s){const t=this.ensure(".c-callout__icon",()=>{const t=document.createElement("span");return t.className="c-callout__icon",t});t.parentNode===this&&this.firstChild!==t&&this.prepend(t),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(s).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>')}else{const t=this.querySelector(".c-callout__icon");t&&t.remove()}const r=this.getAttribute("title");if(r){const t=this.ensure(".c-callout__title",()=>{const t=document.createElement("div");return t.className="c-callout__title",t});t.parentNode===this&&this.firstChild!==t&&this.prepend(t),t.textContent=r}else{const t=this.querySelector(".c-callout__title");t&&t.remove()}if(w(this,"closable"))this.ensure(".c-callout__close",()=>{const t=document.createElement("button");return t.className="c-callout__close",t.type="button",t.setAttribute("aria-label",k(this,"close","Close")),t.textContent="×",t});else{const t=this.querySelector(".c-callout__close");t&&t.remove()}}}he.prototype.enhance=function(){this._wiredCallout||(this._wiredCallout=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-callout__close"):null;e&&this.contains(e)&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})),this.remove())}))},c("contour-callout",he);c("contour-empty",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","status");const t=this.getAttribute("state")||"empty",e=this.getAttribute("title")||("filtered"===t?"Nothing matches":"error"===t?"Could not load":"No data yet"),s=this.getAttribute("body")||("filtered"===t?"Try clearing some filters.":"error"===t?"Check your connection and try again.":"There is nothing to show here yet."),r=this.getAttribute("action")||("filtered"===t?"Clear filters":"error"===t?"Retry":""),i=this.getAttribute("icon");if(i){L(this.ensure(".c-empty__icon",()=>{const t=document.createElement("span");return t.className="c-empty__icon",t}),'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(i).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>')}else{const t=this.querySelector(".c-empty__icon");t&&t.remove()}const a=this.getAttribute("illustration");if(a){L(this.ensure(".c-empty__illustration",()=>{const t=document.createElement("div");return t.className="c-empty__illustration",t}),g(a))}else{const t=this.querySelector(".c-empty__illustration");t&&t.remove()}if(e){this.ensure(".c-empty__title",()=>{const t=document.createElement(E(this,"h3"));return t.className="c-empty__title",t}).textContent=e}else{const t=this.querySelector(".c-empty__title");t&&t.remove()}if(s){this.ensure(".c-empty__text",()=>{const t=document.createElement("p");return t.className="c-empty__text",t}).textContent=s}else{const t=this.querySelector(".c-empty__text");t&&t.remove()}if(r){this.ensure("button.c-btn[data-empty-action]",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--primary",t.type="button",t.setAttribute("data-empty-action",""),t}).textContent=r}else{const t=this.querySelector("[data-empty-action]");t&&t.remove()}}enhance(){xt(this)}});c("contour-faq",class extends T{static get observed(){return["question","answer","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{question:{attribute:"question"},answer:{attribute:"answer"},items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-faq"),Zt(this),$t(this,"items"),Xt(this,"faq"))return;const t=Jt(this,"items"),e=this.getAttribute("question"),s=this.getAttribute("answer"),r=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-faq__item"));if(t&&!r.length)try{const e=JSON.parse(t);Array.from(this.querySelectorAll(".c-faq__item")).forEach(t=>t.remove()),e.forEach((t,e)=>{const s=document.createElement("details");s.className="c-faq__item",0===e&&s.setAttribute("open","");const r=document.createElement("summary");r.className="c-faq__question",r.textContent="string"==typeof t?t:t.question||t.q||"";const i=document.createElement("span");i.className="c-faq__sign",i.setAttribute("aria-hidden","true"),L(i,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-plus" /></svg>'),r.appendChild(i),s.appendChild(r);const a=document.createElement("div");a.className="c-faq__answer",a.textContent="string"==typeof t?"":t.answer||t.a||"",s.appendChild(a),this.appendChild(s)})}catch(t){f(this,"attribute",t)}else if(!t)if(e||s){const t=this.ensure("details.c-faq__item",()=>{const t=document.createElement("details");return t.className="c-faq__item",t});t.hasAttribute("open")||t.setAttribute("open","");const r=this.ensure("summary.c-faq__question",()=>{const t=document.createElement("summary");return t.className="c-faq__question",t},t);r.textContent=e||"";const i=this.ensure(".c-faq__sign",()=>{const t=document.createElement("span");return t.className="c-faq__sign",t},r);i.setAttribute("aria-hidden","true"),L(i,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-plus" /></svg>');this.ensure(".c-faq__answer",()=>{const t=document.createElement("div");return t.className="c-faq__answer",t},t).textContent=s||""}else Yt(this,"faq")}});c("contour-accordion",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","exclusive","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},exclusive:{attribute:"exclusive",type:Boolean},src:{attribute:"src"}}}render(){this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"accordion","Accordion"));const t=Array.from(this.children).filter(t=>"DETAILS"===t.tagName);if(Zt(this),$t(this,"items"),Xt(this,"accordion"))return;const e=Jt(this,"items");if(e&&!t.length){Array.from(this.querySelectorAll("details.c-disclosure")).forEach(t=>t.remove());try{JSON.parse(e).forEach(t=>{const e=document.createElement("details");e.className="c-disclosure";const s=document.createElement("summary");s.className="c-disclosure__summary",s.textContent=t.title||t.question||t.q||t.label||"",e.appendChild(s);const r=document.createElement("div");r.className="c-disclosure__body",r.textContent=t.body||t.answer||t.a||t.content||"",e.appendChild(r),this.appendChild(e)})}catch(t){f(this,"attribute",t)}}else e||t.length||Yt(this,"accordion");const s=this.getAttribute("persist");if(s){let t=null;if("storage"===s&&this.id)try{t=localStorage.getItem("contour-accordion:"+this.id)}catch(t){}else if("url"===s)try{t=new URLSearchParams(window.location.search).get("c-accordion")}catch(t){}if(null!==t)try{const e=JSON.parse(t);if(Array.isArray(e)){const t=new Set(e.map(t=>String(t)));Array.from(this.querySelectorAll("details.c-disclosure")).forEach(e=>{const s=e.querySelector("summary"),r=(s?s.textContent:"").trim().slice(0,120);t.has(r)&&(e.open=!0)})}}catch(t){}}}enhance(){this._wiredAccordion||(this._wiredAccordion=!0,this.addEventListener("toggle",t=>{const e=t.target;if(e&&"DETAILS"===e.tagName){e.open&&this.hasAttribute("exclusive")&&Array.from(this.querySelectorAll("details.c-disclosure")).forEach(t=>{t!==e&&(t.open=!1)}),this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:e.open},bubbles:!0,composed:!0}));const s=this.getAttribute("persist");if("storage"===s&&this.id)try{const t=[];Array.from(this.querySelectorAll("details.c-disclosure")).forEach(e=>{if(e.open){const s=e.querySelector("summary");t.push((s?s.textContent:"").trim().slice(0,120))}}),localStorage.setItem("contour-accordion:"+this.id,JSON.stringify(t))}catch(t){}else if("url"===s)try{const t=[];Array.from(this.querySelectorAll("details.c-disclosure")).forEach(e=>{if(e.open){const s=e.querySelector("summary");t.push((s?s.textContent:"").trim().slice(0,120))}});const e=new URL(window.location.href);e.searchParams.set("c-accordion",JSON.stringify(t)),window.history.replaceState(null,"",e.toString())}catch(t){}}},!0))}});c("contour-drawer",class extends T{static get observed(){return["title","body","size","open"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},size:{attribute:"size"}}}attributeChangedCallback(t,e,s){"open"!==t?super.attributeChangedCallback(t,e,s):ue(this,t,s,this._wiredDrawer)}showModal(){this.show()}get open(){return this.hasAttribute("open")}set open(t){t?this.show():this.close()}render(){this.classList.add("c-drawer"),Array.from(this.classList).forEach(t=>{t.startsWith("c-drawer--")&&this.classList.remove(t)});const t=this.getAttribute("size");t&&this.classList.add("c-drawer--"+t),this.hasAttribute("role")||this.setAttribute("role","dialog");const e=this.getAttribute("title");let s=this.querySelector(".c-drawer__head");if(e){if(!s){s=document.createElement("div"),s.className="c-drawer__head";const t=document.createElement("div");t.className="c-drawer__title",s.appendChild(t);const e=document.createElement("button");e.className="c-btn c-btn--icon c-btn--ghost c-drawer__close",e.setAttribute("type","button"),e.setAttribute("aria-label",k(this,"close","Close")),L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-x" /></svg>'),s.appendChild(e)}const t=s.querySelector(".c-drawer__title");t&&(t.textContent=e,t.id||(t.id=o("contour-drawer-title")),this.setAttribute("aria-labelledby",t.id)),s.parentNode!==this&&this.prepend(s)}else if(s){const t=s.querySelector(".c-drawer__title");t&&t.id&&this.getAttribute("aria-labelledby")===t.id&&this.removeAttribute("aria-labelledby"),s.remove()}this.hasAttribute("open")?this.classList.add("is-open"):this.classList.remove("is-open");const r=this.getAttribute("body"),i=Array.from(this.childNodes).filter(t=>(1!==t.nodeType||!t.classList||!t.classList.contains("c-drawer__head")&&!t.classList.contains("c-drawer__body"))&&!(3===t.nodeType&&!t.textContent.trim()));if(i.length){const t=this.ensure(".c-drawer__body",()=>{const t=document.createElement("div");return t.className="c-drawer__body",t});for(const e of i)t.appendChild(e)}else if(r){L(this.ensure(".c-drawer__body",()=>{const t=document.createElement("div");return t.className="c-drawer__body",t}),g(r))}else{const t=this.querySelector(".c-drawer__body");t&&t.remove()}}enhance(){if(this._wiredDrawer)return;this._wiredDrawer=!0,this.returnValue="",i(this,()=>{this.hasAttribute("open")&&Ft(this,!1)}),this._drawerLastFocus=null,this.show=()=>{if(this.hasAttribute("open"))return;this._drawerLastFocus=document.activeElement,this._declarativeOpen=!0;try{this.setAttribute("open","")}finally{this._declarativeOpen=!1}this.setAttribute("aria-modal","true"),this.classList.add("is-open"),Ft(this,!0);const t=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(t)try{t.focus()}catch(t){}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}))},this.close=()=>{if(!this.hasAttribute("open")&&!this.hasAttribute("aria-modal"))return;this._declarativeOpen=!0;try{this.removeAttribute("open")}finally{this._declarativeOpen=!1}this.removeAttribute("aria-modal"),this.classList.remove("is-open"),Ft(this,!1),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}));const t=this._drawerLastFocus;if(t&&"function"==typeof t.focus)try{t.focus()}catch(t){}},this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-drawer__close"):null;(e&&this.contains(e)||t.target===this)&&this.close()}),this.addEventListener("keydown",t=>{"Escape"===t.key&&this.hasAttribute("open")&&this.close()});let t=0,e=0;this.addEventListener("touchstart",s=>{if(!this.hasAttribute("open"))return;const r=s.touches&&s.touches[0];r&&(t=r.clientX,e=r.clientY)},{passive:!0}),this.addEventListener("touchend",s=>{if(!this.hasAttribute("open"))return;const r=s.changedTouches&&s.changedTouches[0];if(!r)return;const i=r.clientX-t,a=r.clientY-e;Math.abs(i)>60&&Math.abs(i)>1.5*Math.abs(a)&&this.close()},{passive:!0}),le(this)}});c("contour-sheet",class extends T{static get observed(){return["title","body","size","open"]}static get properties(){return{title:{attribute:"title"},body:{attribute:"body"},size:{attribute:"size"}}}attributeChangedCallback(t,e,s){"open"!==t?super.attributeChangedCallback(t,e,s):ue(this,t,s,this._wiredSheet)}showModal(){this.show()}get open(){return this.hasAttribute("open")}set open(t){t?this.show():this.close()}render(){this.classList.add("c-sheet"),Array.from(this.classList).forEach(t=>{t.startsWith("c-sheet--")&&this.classList.remove(t)});const t=this.getAttribute("size");t&&this.classList.add("c-sheet--"+t),this.hasAttribute("role")||this.setAttribute("role","dialog");const e=this.getAttribute("title");let s=this.querySelector(".c-sheet__head");if(e){if(!s){s=document.createElement("div"),s.className="c-sheet__head";const t=document.createElement("div");t.className="c-sheet__title",s.appendChild(t);const e=document.createElement("button");e.className="c-btn c-btn--icon c-btn--ghost c-sheet__close",e.setAttribute("type","button"),e.setAttribute("aria-label",k(this,"close","Close")),L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-x" /></svg>'),s.appendChild(e)}const t=s.querySelector(".c-sheet__title");t&&(t.textContent=e,t.id||(t.id=o("contour-sheet-title")),this.setAttribute("aria-labelledby",t.id)),s.parentNode!==this&&this.prepend(s)}else if(s){const t=s.querySelector(".c-sheet__title");t&&t.id&&this.getAttribute("aria-labelledby")===t.id&&this.removeAttribute("aria-labelledby"),s.remove()}this.hasAttribute("open")?this.classList.add("is-open"):this.classList.remove("is-open");const r=this.getAttribute("body"),i=Array.from(this.childNodes).filter(t=>(1!==t.nodeType||!t.classList||!t.classList.contains("c-sheet__head")&&!t.classList.contains("c-sheet__body"))&&!(3===t.nodeType&&!t.textContent.trim()));if(i.length){const t=this.ensure(".c-sheet__body",()=>{const t=document.createElement("div");return t.className="c-sheet__body",t});for(const e of i)t.appendChild(e)}else if(r){L(this.ensure(".c-sheet__body",()=>{const t=document.createElement("div");return t.className="c-sheet__body",t}),g(r))}else{const t=this.querySelector(".c-sheet__body");t&&t.remove()}}enhance(){if(this._wiredSheet)return;this._wiredSheet=!0,this.returnValue="",i(this,()=>{this.hasAttribute("open")&&Ft(this,!1)}),this._sheetLastFocus=null,this.show=()=>{if(this.hasAttribute("open"))return;this._sheetLastFocus=document.activeElement,this._declarativeOpen=!0;try{this.setAttribute("open","")}finally{this._declarativeOpen=!1}this.setAttribute("aria-modal","true"),this.classList.add("is-open"),Ft(this,!0);const t=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(t)try{t.focus()}catch(t){}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}))},this.close=()=>{if(!this.hasAttribute("open")&&!this.hasAttribute("aria-modal"))return;this._declarativeOpen=!0;try{this.removeAttribute("open")}finally{this._declarativeOpen=!1}this.removeAttribute("aria-modal"),this.classList.remove("is-open"),Ft(this,!1),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}));const t=this._sheetLastFocus;if(t&&"function"==typeof t.focus)try{t.focus()}catch(t){}},this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-sheet__close"):null;(e&&this.contains(e)||t.target===this)&&this.close()}),this.addEventListener("keydown",t=>{"Escape"===t.key&&this.hasAttribute("open")&&this.close()});let t=0,e=0;this.addEventListener("touchstart",s=>{if(!this.hasAttribute("open"))return;const r=s.touches&&s.touches[0];r&&(e=r.clientX,t=r.clientY)},{passive:!0}),this.addEventListener("touchend",s=>{if(!this.hasAttribute("open"))return;const r=s.changedTouches&&s.changedTouches[0];if(!r)return;const i=r.clientY-t,a=r.clientX-e;i>60&&Math.abs(i)>1.5*Math.abs(a)&&this.close()},{passive:!0}),le(this)}});c("contour-toast",class extends T{static get observed(){return["message","variant","duration","action","icon"]}static get properties(){return{message:{attribute:"message"},variant:{attribute:"variant"},duration:{attribute:"duration",type:Number},action:{attribute:"action"}}}render(){this.classList.add("c-toast"),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"),this.hasAttribute("aria-atomic")||this.setAttribute("aria-atomic","true");const t=this.getAttribute("message");t&&!this.hasChildNodes()&&(this.textContent=t);const e=this.getAttribute("variant");Array.from(this.classList).forEach(t=>{t.startsWith("c-toast--")&&this.classList.remove(t)}),e&&this.classList.add("c-toast--"+e);const s=this.getAttribute("icon"),r="none"===s?"":s||C(e);let i=this.querySelector(".c-toast__icon");r?(i||(i=document.createElement("span"),i.className="c-toast__icon"),L(i,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(r).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'),this.firstChild!==i&&this.prepend(i)):i&&i.remove();const a=this.getAttribute("action");let n=this.querySelector(".c-toast__action");a?(n||(n=document.createElement("button"),n.className="c-toast__action",n.type="button",this.appendChild(n)),n.textContent=a):n&&n.remove();let o=this.querySelector(".c-toast__close");o||(o=document.createElement("button"),o.className="c-toast__close",o.type="button",o.setAttribute("aria-label",k(this,"close","Close")),o.textContent="×",this.appendChild(o))}enhance(){if(this._wiredToast)return;this._wiredToast=!0,this.addEventListener("click",t=>{(t.target&&t.target.closest?t.target.closest(".c-toast__close"):null)&&(t.preventDefault(),this._dismiss())});const t=()=>{clearTimeout(this._toastTimer),this._toastTimer=null};this.addEventListener("mouseenter",t),this.addEventListener("focusin",t),this.addEventListener("mouseleave",()=>this._arm()),this.addEventListener("focusout",()=>this._arm()),this._arm(),i(this,()=>clearTimeout(this._toastTimer))}_durationMs(){const t=null!=this._toastDuration?Number(this._toastDuration):Number(this.duration);return 0===t?0:t>0?t:4e3}_arm(){clearTimeout(this._toastTimer),this._toastTimer=null;const t=this._durationMs();t>0&&(this._toastTimer=setTimeout(()=>this._dismiss(),t))}_dismiss(){clearTimeout(this._toastTimer),this._toastTimer=null,this.setAttribute("hidden",""),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}))}show(t,e){const s=null!=t?String(t):this.getAttribute("message"),r=e&&e.variant||this.getAttribute("variant"),i=e&&e.action||this.getAttribute("action");s&&!this.hasChildNodes()&&(this.textContent=s),Array.from(this.classList).forEach(t=>{t.startsWith("c-toast--")&&this.classList.remove(t)}),r&&this.classList.add("c-toast--"+r);let a=this.querySelector(".c-toast__action");i?(a||(a=document.createElement("button"),a.className="c-toast__action",a.type="button",this.appendChild(a)),a.textContent=i):a&&a.remove(),e&&null!=e.duration&&(this._toastDuration=Number(e.duration)),this.removeAttribute("hidden"),this._arm()}});c("contour-expandable",class extends T{static get observed(){return["summary"]}static get properties(){return{summary:{attribute:"summary"}}}disconnectedCallback(){this._expandableContent=null,super.disconnectedCallback()}connectedCallback(){this.innerHTML.trim()&&!this._expandableContent&&(this._expandableContent=this.innerHTML),super.connectedCallback()}attributeChangedCallback(t,e,s){const r=this.querySelector("details");if(r){const t=r.querySelector(".c-expandable__body");t&&(this._expandableContent=t.innerHTML)}else this.innerHTML.trim()&&(this._expandableContent=this.innerHTML);super.attributeChangedCallback(t,e,s)}render(){this.classList.add("c-expandable"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("summary")||"Expandable");const t=this.getAttribute("summary");if(t){let e=this.innerHTML.trim()?this.innerHTML:this._expandableContent||"";e.trim()&&(this._expandableContent=e);const s=this.ensure("details",()=>{const s=document.createElement("details"),r=document.createElement("summary");r.className="c-expandable__summary",r.textContent=t,s.appendChild(r);const i=document.createElement("div");return i.className="c-expandable__body",L(i,e),s.appendChild(i),s}),r=s.querySelector("summary");r&&(r.textContent=t);const i=s.querySelector(".c-expandable__body");i&&L(i,e),s.parentNode!==this&&(L(this,""),this.appendChild(s))}else{const t=this.querySelector("details");t&&t.remove()}}enhance(){this._wiredExpandable||(this._wiredExpandable=!0,this.addEventListener("toggle",t=>{const e=t.target;e&&"DETAILS"===e.tagName&&this.dispatchEvent(new CustomEvent("contour:toggle",{detail:{open:e.open},bubbles:!0,composed:!0}))},!0))}});c("contour-toast-host",class extends T{static get observed(){return[]}render(){this.classList.add("c-toast-host"),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"toast-host","Toast host")),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"),this.hasAttribute("aria-atomic")||this.setAttribute("aria-atomic","true")}enhance(){if(this._wiredToastHost)return;this._wiredToastHost=!0,this._toastQueue=[],this._toastActive=null;const t=(t,s)=>{s=s||{};const r=document.createElement("div");r.className="c-toast",r.setAttribute("role","status"),r.setAttribute("aria-live","polite"),r.setAttribute("aria-atomic","true"),s.variant&&r.classList.add("c-toast--"+s.variant);const i=C(s.variant);if(i){const t=document.createElement("span");t.className="c-toast__icon",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+i+'" /></svg>'),r.appendChild(t)}r.dataset.message=null==t?"":String(t);const a=document.createElement("span");if(a.className="c-toast__text",a.textContent=null==t?"":String(t),r.appendChild(a),s.action&&("string"==typeof s.action||s.action.label)){const t="string"==typeof s.action?s.action:s.action.label,i=document.createElement("button");i.type="button",i.className="c-btn c-btn--ghost c-toast__action",i.textContent=t,i.addEventListener("click",t=>{if(t.stopPropagation(),"object"==typeof s.action&&"function"==typeof s.action.onClick)try{s.action.onClick()}catch(t){}e(r)}),r.appendChild(i)}const n=document.createElement("button");return n.type="button",n.className="c-toast__close",n.setAttribute("aria-label",k(this,"close","Close")),n.textContent="×",r.appendChild(n),n.addEventListener("click",t=>{t.stopPropagation(),e(r)}),r._arm=()=>{clearTimeout(r._timer);const t=s.duration,i=0===t?0:t>0?t:4e3;i>0&&(r._timer=setTimeout(()=>e(r),i))},r.addEventListener("mouseenter",()=>clearTimeout(r._timer)),r.addEventListener("focusin",()=>clearTimeout(r._timer)),r.addEventListener("mouseleave",r._arm),r.addEventListener("focusout",r._arm),r},e=t=>{t&&t.parentNode&&(t._timer&&(clearTimeout(t._timer),t._timer=null),t.parentNode.removeChild(t),this._toastActive===t&&(this._toastActive=null),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0,detail:{message:t.textContent}})),s())},s=()=>{for(;this._toastQueue.length;){const e=this._toastQueue.shift();if(e._deduped)continue;const s=t(e.message,e.opts);this._toastActive=s,this.appendChild(s),s._arm()}};this.show=(t,r)=>{r=r||{};const i=String(null==t?"":t),a=this._toastActive;if(a&&a.dataset&&a.dataset.message===i&&""!==i){a._timer&&clearTimeout(a._timer);const t=r.duration&&r.duration>0?r.duration:4e3;return a._timer=setTimeout(()=>e(a),t),a}const n=this._toastQueue.find(t=>String(t.message)===i&&""!==i);if(n)return n.opts=Object.assign({},n.opts,r),null;const o={message:t,opts:r,_deduped:!1};return this._toastQueue.push(o),s(),this._toastActive},this.hide=()=>{this._toastActive&&e(this._toastActive),this._toastQueue.length=0,Array.from(this.querySelectorAll(".c-toast")).forEach(t=>{t._timer&&clearTimeout(t._timer),t.parentNode&&t.parentNode.removeChild(t)}),this._toastActive=null}}});c("contour-combobox",class extends T{static get observed(){return["options","items","placeholder","label","value","multiple","loading","error","retry","src","lazy","refresh","timeout","empty","skeleton","virtual","disabled","required","name","cache-key","no-cache"]}static get formAssociated(){return!0}static get properties(){return{options:{attribute:"options"},items:{attribute:"items"},placeholder:{attribute:"placeholder"},label:{attribute:"label"},value:{attribute:"value"},multiple:{attribute:"multiple",type:Boolean},virtual:{attribute:"virtual",type:Boolean},src:{attribute:"src"},disabled:{attribute:"disabled",type:Boolean},required:{attribute:"required",type:Boolean},name:{attribute:"name"}}}render(){if(this.classList.add("c-combobox"),void 0===this._comboboxDefault&&(this._comboboxDefault=this.getAttribute("value")),Zt(this),$t(this,"options"),Xt(this,"combobox"))return;const t=Jt(this,"options")||this.getAttribute("options")||this.getAttribute("items"),e=Array.from(this.children).filter(t=>!t.classList||!t.classList.contains("c-combobox__input")&&!t.classList.contains("c-combobox__list"));if(t&&!e.length)try{const e=t?JSON.parse(t):[];this._comboboxOptions=e;const s=this.ensure(".c-combobox__input",()=>{const t=document.createElement("input");return t.className="c-input c-combobox__input",t.type="text",t});s.type="text",s.placeholder=this.getAttribute("placeholder")||k(this,"search","Search…"),s.setAttribute("aria-label",this.getAttribute("label")||k(this,"search","Search")),this.hasAttribute("disabled")?(s.setAttribute("disabled",""),this.classList.add("is-disabled")):(s.removeAttribute("disabled"),this.classList.remove("is-disabled")),this.hasAttribute("required")?(s.setAttribute("required",""),s.setAttribute("aria-required","true")):(s.removeAttribute("required"),s.removeAttribute("aria-required")),this.hasAttribute("name")&&s.setAttribute("name",this.getAttribute("name"));const r=this.getAttribute("value");if(null!==r){const t=String(r).split(",").map(t=>t.trim()).filter(Boolean).map(t=>{const s=e.find(e=>String("string"==typeof e?e:e.value)===t);return s?String("string"==typeof s?s:s.label):t});if(this.hasAttribute("multiple"))s.value="",s.placeholder=t.join(", ")||this.getAttribute("placeholder")||k(this,"search","Search…");else{const t=e.find(t=>String("string"==typeof t?t:t.value)===String(r));s.value=t?String("string"==typeof t?t:t.label):r}}const i=this.ensure(".c-combobox__list",()=>{const t=document.createElement("ul");return t.className="c-combobox__list",t.setAttribute("hidden",""),t});i.innerHTML="",i.setAttribute("hidden",""),this._comboboxVirtual=this.hasAttribute("virtual")&&e.length>100,this._comboboxVirtual?(i.classList.add("c-combobox__list--virtual"),i.style.maxBlockSize="20rem",i.style.overflow="auto",this._renderComboboxWindow("",!0)):(i.classList.remove("c-combobox__list--virtual"),i.style.maxBlockSize="",i.style.overflow="",this._renderComboboxWindow("",!0))}catch(t){f(this,"attribute",t)}else if(e.length||t){if(e.length){const t=this.ensure(".c-combobox__input",()=>{const t=document.createElement("input");return t.className="c-input c-combobox__input",t.type="text",t});t.type="text",t.placeholder=this.getAttribute("placeholder")||k(this,"search","Search…"),t.setAttribute("aria-label",this.getAttribute("label")||k(this,"search","Search")),this.hasAttribute("required")?(t.setAttribute("required",""),t.setAttribute("aria-required","true")):(t.removeAttribute("required"),t.removeAttribute("aria-required")),this.hasAttribute("name")&&t.setAttribute("name",this.getAttribute("name"));const s=this.ensure(".c-combobox__list",()=>{const t=document.createElement("ul");return t.className="c-combobox__list",t.setAttribute("hidden",""),t});for(const t of e)"LI"===t.tagName&&(s.appendChild(t),t.setAttribute("role","option"));this._comboboxOptions=Array.from(s.querySelectorAll("li")).map(t=>({label:t.textContent.trim(),value:null!=t.dataset.value?t.dataset.value:t.textContent.trim()}))}}else Yt(this,"combobox");if(this.getAttribute("value"))this.ensure(".c-combobox__clear",()=>{const t=document.createElement("button");return t.className="c-combobox__clear",t.type="button",t.setAttribute("aria-label",k(this,"clear","Clear")),t.textContent="×",t});else{const t=this.querySelector(".c-combobox__clear");t&&t.remove()}}_renderComboboxWindow(t="",e=!1){const s=this.querySelector(".c-combobox__list"),r=this._comboboxOptions||[];if(!s)return;const i=String(t||"").toLowerCase(),a=r.map((t,e)=>({opt:t,index:e,label:"string"==typeof t?t:t.label,value:"string"==typeof t?t:t.value})).filter(t=>!i||String(t.label).toLowerCase().includes(i));this._comboboxFiltered=a;const n=y("--combobox-row-height",32),o=s.scrollTop,c=this._comboboxVirtual&&!e?Math.min(Math.max(0,a.length-20),Math.max(0,Math.floor(o/n)-6)):0;this._comboboxWindowStart=c;const l=this._comboboxVirtual?Math.min(a.length,c+20+12):a.length,u=(this.getAttribute("value")||"").split(",").map(t=>t.trim()).filter(Boolean);s.innerHTML="";const d=t=>{const e=document.createElement("li");e.setAttribute("aria-hidden","true"),e.style.blockSize=`${t}px`,s.appendChild(e)};if(this._comboboxVirtual&&d(c*n),!a.length){const t=document.createElement("li");t.className="c-combobox__empty",t.setAttribute("role","option"),t.setAttribute("aria-disabled","true"),t.setAttribute("aria-selected","false"),t.textContent=this.getAttribute("empty")||k(this,"no-matches","No matches"),s.appendChild(t)}this.hasAttribute("multiple")?s.setAttribute("aria-multiselectable","true"):s.removeAttribute("aria-multiselectable"),a.slice(c,l).forEach(e=>{const r=document.createElement("li");r.className="c-combobox__option",r.dataset.optionIndex=String(e.index),r.dataset.optionValue=String(null!=e.value?e.value:e.label),r.setAttribute("role","option");const i=String(e.label),a=String(t||"").toLowerCase();if(a&&i.toLowerCase().includes(a)){const t=i.toLowerCase().indexOf(a),e=i.slice(0,t),s=i.slice(t,t+a.length),n=i.slice(t+a.length);r.innerHTML="",e&&r.appendChild(document.createTextNode(e));const o=document.createElement("mark");o.className="c-combobox__match",o.textContent=s,r.appendChild(o),n&&r.appendChild(document.createTextNode(n))}else r.textContent=i;const n=this.hasAttribute("multiple")&&u.includes(String(e.value));r.setAttribute("aria-selected",String(n)),n&&r.classList.add("c-combobox__option--selected"),s.appendChild(r)}),this._comboboxVirtual&&d(Math.max(0,a.length-l)*n),this._comboboxVirtual&&!e&&(s.scrollTop=o)}_syncFormValue(){if(!this._internals)return;const t=this.getAttribute("value"),e=null!=t&&""!==t?t:null;this._internals.setFormValue(e),this._syncValidity(this.hasAttribute("required")&&!e)}enhance(){_t(this),this._internals&&!this._wiredComboboxForm&&(this._wiredComboboxForm=!0,this._syncFormValue(),this.addEventListener("contour:select",t=>{const e=t&&t.detail&&(t.detail.value||t.detail.label);null!=e&&this.setAttribute("value",String(e)),this._syncFormValue()})),this._wiredComboboxClear||(this._wiredComboboxClear=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-combobox__clear"):null;if(!e||!this.contains(e))return;t.preventDefault(),this.removeAttribute("value");const s=this.querySelector(".c-combobox__input");s&&(s.value=""),this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{name:this.getAttribute("name"),value:null,checked:null}}))}))}formResetCallback(){this._contourResetting=!0;try{const t=this._comboboxDefault??null;null===t?this.removeAttribute("value"):this.setAttribute("value",t),this._syncFormValue()}finally{this._contourResetting=!1}}});class me extends T{static get observed(){return["label","hint","error","placeholder","type","required","name","value","disabled","custom-error"]}static get formAssociated(){return!0}static get properties(){return{label:{attribute:"label"},hint:{attribute:"hint"},error:{attribute:"error"},placeholder:{attribute:"placeholder"},type:{attribute:"type"},required:{attribute:"required",type:Boolean},name:{attribute:"name"},value:{attribute:"value"},disabled:{attribute:"disabled",type:Boolean},customError:{attribute:"custom-error"}}}render(){this.classList.add("c-field");const t=this.getAttribute("label"),e=this.getAttribute("hint"),s=this.getAttribute("error"),r=this.getAttribute("placeholder")||"";if(t){this.ensure(".c-field__label",()=>{const t=document.createElement("label");return t.className="c-field__label",t}).textContent=t}else{const t=this.querySelector(".c-field__label");t&&t.remove()}const i=Array.from(this.children).find(t=>t.constructor&&t.constructor.formAssociated)?null:this.ensure("input.c-input, textarea, select",()=>{const t=document.createElement("input");return t.className="c-input",t});if(i){i.type=this.getAttribute("type")||"text",i.placeholder=r,i.id||(i.id=this._fieldInputId||(this._fieldInputId=o("contour-field")));const t=this.querySelector(".c-field__label");if(t?(i.id||(i.id=o("contour-field")),t.setAttribute("for",i.id),i.setAttribute("aria-label",t.textContent)):i.hasAttribute("aria-label")||i.setAttribute("aria-label",k(this,"field","Field")),e){this.ensure(".c-field__hint",()=>{const t=document.createElement("span");return t.className="c-field__hint",t}).textContent=e}else{const t=this.querySelector(".c-field__hint");t&&t.remove()}if(s){this.ensure(".c-field__error",()=>{const t=document.createElement("span");return t.className="c-field__error",t}).textContent=s}else{const t=this.querySelector(".c-field__error");t&&t.remove()}const a=this.getAttribute("custom-error");if(null!==a){i.setAttribute("aria-invalid","true"),this.classList.add("is-invalid"),this.setAttribute("data-invalid","");let t=this.querySelector(".c-field__error");t||(t=document.createElement("span"),t.className="c-field__error",this.appendChild(t)),t.textContent=a,t.id||(t.id=o("err")),i.setAttribute("aria-describedby",(i.getAttribute("aria-describedby")||"").split(" ").filter(e=>e&&e!==t.id).concat(t.id).join(" "))}const n=this.querySelector(".c-field__hint"),c=this.querySelector(".c-field__error"),l=[];n&&(n.id||(n.id=o("hint")),l.push(n.id)),c&&(c.id||(c.id=o("err")),l.push(c.id)),l.length&&i.setAttribute("aria-describedby",l.join(" ")),this.hasAttribute("required")?(i.setAttribute("aria-required","true"),i.setAttribute("required","")):(i.removeAttribute("aria-required"),i.removeAttribute("required")),this.hasAttribute("name")&&i.setAttribute("name",this.getAttribute("name")),this.hasAttribute("value")&&(i.value=this.getAttribute("value")),this.hasAttribute("disabled")?(i.setAttribute("disabled",""),this.classList.add("is-disabled")):(i.removeAttribute("disabled"),this.classList.remove("is-disabled"))}}}me.prototype.enhance=function(){if(this._wiredField)return;this._wiredField=!0;const t=()=>{const t=this.querySelector("input, textarea, select");t&&this._internals&&(this._internals.setFormValue(t.value),this._syncValidity(this.hasAttribute("required")&&!t.value))};this.addEventListener("input",e=>{const s=this.querySelector("input, textarea, select");s&&e.target===s&&(t(),this._emitForm("contour:input"))}),this.addEventListener("change",e=>{const s=this.querySelector("input, textarea, select");s&&e.target===s&&(t(),this._emitForm("contour:change"))}),this.addEventListener("focusout",e=>{const s=this.querySelector("input, textarea, select");if(!s||e.target!==s)return;if(s.checkValidity()){if(s.setAttribute("aria-invalid","false"),this.classList.remove("is-invalid"),this.removeAttribute("data-invalid"),!this.getAttribute("error")){const t=this.querySelector(".c-field__error");if(t){const e=t.id;t.remove(),e&&s.setAttribute("aria-describedby",(s.getAttribute("aria-describedby")||"").split(" ").filter(t=>t&&t!==e).join(" "))}}}else{s.setAttribute("aria-invalid","true"),this.classList.add("is-invalid"),this.setAttribute("data-invalid","");const t=new CustomEvent("contour:invalid",{bubbles:!0,composed:!0,cancelable:!0,detail:{field:this,input:s,message:s.validationMessage||"Invalid value"}});if(this.dispatchEvent(t)&&!this.getAttribute("error")&&!this.getAttribute("custom-error")){const t=s.validationMessage||"Invalid value";let e=this.querySelector(".c-field__error");e||(e=document.createElement("span"),e.className="c-field__error",this.appendChild(e)),e.textContent=t,e.id||(e.id=o("err")),s.setAttribute("aria-describedby",(s.getAttribute("aria-describedby")||"").split(" ").filter(t=>t&&t!==e.id).concat(e.id).join(" "))}}t()},!0),t()},c("contour-field",me);c("contour-field-group",class extends T{static get observed(){return["label","hint","error","required"]}static get properties(){return{label:{attribute:"label"},hint:{attribute:"hint"},error:{attribute:"error"},required:{attribute:"required",type:Boolean}}}render(){this.classList.add("c-field-group"),this.setAttribute("role","group");const t=this.getAttribute("label");if(t){this.ensure(".c-field-group__label",()=>{const t=document.createElement("div");return t.className="c-field-group__label",t}).textContent=t}else{const t=this.querySelector(".c-field-group__label");t&&t.remove()}const e=this.getAttribute("hint");if(e){this.ensure(".c-field-group__hint",()=>{const t=document.createElement("span");return t.className="c-field-group__hint",t}).textContent=e}else{const t=this.querySelector(".c-field-group__hint");t&&t.remove()}const s=this.getAttribute("error");if(s){this.ensure(".c-field-group__error",()=>{const t=document.createElement("span");return t.className="c-field-group__error",t}).textContent=s}else{const t=this.querySelector(".c-field-group__error");t&&t.remove()}s?this.classList.add("is-error"):this.classList.remove("is-error");const r=this.hasAttribute("required");this.querySelectorAll("input, select, textarea").forEach(t=>{r?t.hasAttribute("aria-required")||t.setAttribute("aria-required","true"):"true"===t.getAttribute("aria-required")&&t.removeAttribute("aria-required")})}enhance(){this._wiredFieldGroup||(this._wiredFieldGroup=!0)}});c("contour-form",class extends T{static get observed(){return["submitting","error","summary","title","submit-label"]}static get properties(){return{submitting:{attribute:"submitting",type:Boolean},error:{attribute:"error"},summary:{attribute:"summary"},title:{attribute:"title"},submitLabel:{attribute:"submit-label"}}}render(){this.classList.add("c-form"),this.hasAttribute("submitting")?this.classList.add("is-submitting"):this.classList.remove("is-submitting");const t=this.getAttribute("title");let e=this.querySelector(".c-form__title");t?(e||(e=document.createElement("h2"),e.className="c-form__title",this.prepend(e)),e.textContent=t):e&&e.remove();const s=this.getAttribute("summary")||this.getAttribute("error");let r=this.querySelector(".c-form__summary");s?(r||(r=document.createElement("div"),r.className="c-form__summary",r.setAttribute("role","alert"),this.prepend(r)),r.textContent=s,r.removeAttribute("hidden")):r&&r.setAttribute("hidden","");const i=this.getAttribute("submit-label");let a=this.querySelector(".c-form__submit");a||(a=document.createElement("button"),a.type="submit",a.className="c-btn c-btn--primary c-form__submit",this.appendChild(a)),i?(a.textContent=i,a.dataset&&delete a.dataset.contourLabel):q(a,this,"submit","Submit"),this.hasAttribute("submitting")?a.setAttribute("disabled",""):a.removeAttribute("disabled")}enhance(){if(this._wiredForm)return;this._wiredForm=!0;const t=this.closest("form")||this,e=t=>{const e=t.target;if(t.preventDefault(),e&&"function"==typeof e.checkValidity&&!e.checkValidity()){const t=Array.from(e.querySelectorAll(":invalid")).map(t=>t.getAttribute("aria-label")||t.name||t.id||"field").join(", ");let s=this.querySelector(".c-form__summary");return s||(s=document.createElement("div"),s.className="c-form__summary",s.setAttribute("role","alert"),this.prepend(s)),s.textContent=k(this,"validation-summary","Please fix")+": "+(t||k(this,"invalid-fields","invalid fields")),void s.removeAttribute("hidden")}this._submit()};this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-form__submit"):null;e&&this.contains(e)&&(t.target.closest("form")||(t.preventDefault(),this._submit()))}),t.addEventListener("submit",e),i(this,()=>{t!==this&&t.removeEventListener("submit",e)})}_submit(){this.classList.add("is-submitting");const t=this.querySelector("[type='submit'], .c-form__submit");t&&t.setAttribute("disabled",""),this.dispatchEvent(new CustomEvent("contour:submit",{bubbles:!0,composed:!0,detail:{submitting:!0}}))}});class be extends T{static get observed(){return["min","max","value","low","high","range","sparkline","label","disabled","error","help","name","step"]}static get formAssociated(){return!0}static get properties(){return{min:{attribute:"min"},max:{attribute:"max"},value:{attribute:"value"},label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},name:{attribute:"name"},step:{attribute:"step"}}}render(){this.classList.add("c-range");const t=this.getAttribute("min")||"0",e=this.getAttribute("max")||"100",s=this.hasAttribute("range")||this.hasAttribute("low")||this.hasAttribute("high"),r=this.getAttribute("sparkline");if(r){let t=this.querySelector(".c-range__sparkline");t||(t=document.createElement("canvas"),t.className="c-range__sparkline",t.setAttribute("part","sparkline-canvas"),t.setAttribute("aria-hidden","true"),this.insertBefore(t,this.firstChild)),this._drawRangeSpark(t,r)}else{const t=this.querySelector(".c-range__sparkline");t&&t.remove()}if(s){this.querySelector("input.c-range:not(.c-range__low):not(.c-range__high)");let s=this.querySelector("input.c-range__low");s||(s=document.createElement("input"),s.type="range",s.className="c-range c-range__low",s.setAttribute("part","input"),this.appendChild(s));let r=this.querySelector("input.c-range__high");r||(r=document.createElement("input"),r.type="range",r.className="c-range c-range__high",r.setAttribute("part","input"),this.appendChild(r)),s.min=t,s.max=e,r.min=t,r.max=e;const i=this.getAttribute("step");i?(s.step=i,r.step=i):(s.removeAttribute("step"),r.removeAttribute("step")),this.hasAttribute("disabled")?(s.setAttribute("disabled",""),r.setAttribute("disabled","")):(s.removeAttribute("disabled"),r.removeAttribute("disabled"));const a=this.getAttribute("low")||t,n=this.getAttribute("high")||e;null!==this._rangeUserLow&&this._rangeAttrLowAtDirty===(this.getAttribute("low")||t)?s.value=this._rangeUserLow:(s.value=a,this._rangeUserLow=null,this._rangeAttrLowAtDirty=null),null!==this._rangeUserHigh&&this._rangeAttrHighAtDirty===(this.getAttribute("high")||e)?r.value=this._rangeUserHigh:(r.value=n,this._rangeUserHigh=null,this._rangeAttrHighAtDirty=null);const o=this.getAttribute("label");o&&(s.setAttribute("aria-label",o+" low"),r.setAttribute("aria-label",o+" high"))}else{Array.from(this.querySelectorAll("input.c-range__low, input.c-range__high, input[type='hidden'][data-range]")).forEach(t=>t.remove());const s=this.ensure("input.c-range",()=>{const t=document.createElement("input");return t.type="range",t.setAttribute("part","input"),t});s.className="c-range",s.type="range",s.min=t,s.max=e;const r=this.getAttribute("step");r?s.step=r:s.removeAttribute("step"),this.hasAttribute("disabled")?s.setAttribute("disabled",""):s.removeAttribute("disabled");const i=this.getAttribute("value")||"50";null!==this._rangeUserValue&&this._rangeAttrAtDirty===(this.getAttribute("value")||"50")?s.value=this._rangeUserValue:(s.value=i,this._rangeUserValue=null,this._rangeAttrAtDirty=null);const a=this.getAttribute("label");a?s.setAttribute("aria-label",a):s.hasAttribute("aria-label")||s.setAttribute("aria-label",k(this,"range","Range"));const n=()=>{const t=Number(s.min)||0,e=Number(s.max)||100,r=Number(s.value)||0,i=e>t?(r-t)/(e-t)*100:0;s.style.setProperty("--fill",i+"%")};n(),s._fillWired||(s._fillWired=!0,s.addEventListener("input",n))}}_drawRangeSpark(t,e){let s=[];try{const t=JSON.parse(e);Array.isArray(t)&&(s=t.map(Number).filter(Number.isFinite))}catch(t){}if(s.length<2)return;const r=()=>{if(!t.isConnected)return;const e=t.clientWidth,r=t.clientHeight;if(!e||!r)return;const i="undefined"!=typeof window&&window.devicePixelRatio||1;t.width=Math.round(e*i),t.height=Math.round(r*i);const a=t.getContext&&t.getContext("2d");if(!a)return;a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,e,r);const n=Math.min.apply(null,s),o=Math.max.apply(null,s)-n||1;let c="";try{c=getComputedStyle(this).getPropertyValue("--chart-1").trim()}catch(t){}c&&!/^(var|light-dark)\(/.test(c)||(c="#1f77b4"),a.beginPath(),a.lineWidth=1.5,a.strokeStyle=c,s.forEach((t,i)=>{const c=(t=>t/(s.length-1)*(e-4)+2)(i),l=(t=>r-2-(t-n)/o*(r-4))(t);0===i?a.moveTo(c,l):a.lineTo(c,l)}),a.stroke()};"function"==typeof requestAnimationFrame?requestAnimationFrame(r):r()}}be.prototype.render;be.prototype.attributeChangedCallback=function(t,e,s){return"value"===t&&(this._rangeUserValue=null,this._rangeAttrAtDirty=null),"low"===t&&(this._rangeUserLow=null,this._rangeAttrLowAtDirty=null),"high"===t&&(this._rangeUserHigh=null,this._rangeAttrHighAtDirty=null),T.prototype.attributeChangedCallback.call(this,t,e,s)},be.prototype._syncFormValue=function(){if(!this._internals)return;const t=this.querySelector("input.c-range__low"),e=this.querySelector("input.c-range__high");if(t&&e){const s=this.getAttribute("name");if(s){const r=new FormData;r.append(s,t.value),r.append(s,e.value),this._internals.setFormValue(r)}else this._internals.setFormValue(null)}else{const t=this.querySelector("input.c-range:not(.c-range__low):not(.c-range__high)");t&&this._internals.setFormValue(t.value)}},be.prototype.formResetCallback=function(){this._contourResetting=!0;try{this._rangeUserValue=null,this._rangeAttrAtDirty=null,this._rangeUserLow=null,this._rangeAttrLowAtDirty=null,this._rangeUserHigh=null,this._rangeAttrHighAtDirty=null,this.isConnected&&this._contourAuthored&&this.attributeChangedCallback("__rerender__",null,""),this._syncFormValue()}finally{this._contourResetting=!1}},be.prototype.formStateRestoreCallback=function(t){if(!this._internals||null==t)return;const e=this.querySelector("input.c-range__low"),s=this.querySelector("input.c-range__high");if(e&&s&&t instanceof FormData){const r=t.getAll(this.getAttribute("name"));r.length>=2&&(e.value=String(r[0]),s.value=String(r[1]))}else{const e=this.querySelector("input.c-range:not(.c-range__low):not(.c-range__high)");e&&(e.value=String(t))}this._syncFormValue()},be.prototype.enhance=function(){if(this._wiredRange)return;this._wiredRange=!0,this._syncFormValue();const t=()=>{this._syncFormValue()};this.addEventListener("input",e=>{const s=this.querySelector("input.c-range__low"),r=this.querySelector("input.c-range__high"),i=this.querySelector("input.c-range:not(.c-range__low):not(.c-range__high)");s&&r&&(e.target===s||e.target===r)?(this._rangeUserLow=s.value,this._rangeUserHigh=r.value,this._rangeAttrLowAtDirty=this.getAttribute("low")||this.getAttribute("min")||"0",this._rangeAttrHighAtDirty=this.getAttribute("high")||this.getAttribute("max")||"100",t(),this._emitForm("contour:input",{low:Number(s.value),high:Number(r.value)}),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{low:Number(s.value),high:Number(r.value)}}))):i&&e.target===i&&(this._rangeUserValue=i.value,this._rangeAttrAtDirty=this.getAttribute("value")||"50",t(),this._emitForm("contour:input"))}),this.addEventListener("change",e=>{const s=this.querySelector("input.c-range__low"),r=this.querySelector("input.c-range__high"),i=this.querySelector("input.c-range:not(.c-range__low):not(.c-range__high)");s&&r&&(e.target===s||e.target===r)?(t(),this._emitForm("contour:change",{low:Number(s.value),high:Number(r.value)}),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{low:Number(s.value),high:Number(r.value)}}))):i&&e.target===i&&(t(),this._emitForm("contour:change"))}),t()},c("contour-range",be);c("contour-switch",class extends T{static get observed(){return["label","required","checked","disabled","error","help"]}static get properties(){return{label:{attribute:"label"},required:{attribute:"required",type:Boolean},checked:{attribute:"checked",type:Boolean},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"}}}static get formAssociated(){return!0}render(){this.classList.add("c-switch"),void 0===this._switchDefaultChecked&&(this._switchDefaultChecked=this.hasAttribute("checked"));const t=this.getAttribute("label"),e=this.ensure("input.c-switch__input",()=>{const t=document.createElement("input");return t.className="c-switch__input",t.type="checkbox",t});e.checked=this.hasAttribute("checked"),e.setAttribute("role","switch"),e.setAttribute("aria-checked",String(e.checked)),this._setCustomState("data-checked",e.checked),this.hasAttribute("disabled")?(e.setAttribute("disabled",""),this.classList.add("is-disabled")):(e.removeAttribute("disabled"),this.classList.remove("is-disabled"));const s=this.getAttribute("error"),r=this.getAttribute("help");let i=this.querySelector(".c-switch__message");if(s||r?(i||(i=document.createElement("div"),i.className="c-switch__message",this.appendChild(i)),i.textContent=s||r||"",i.classList.toggle("c-switch__message--error",!!s)):i&&i.remove(),s?this.classList.add("is-error"):this.classList.remove("is-error"),t){e.setAttribute("aria-label",t);(this.querySelector(":scope > span:not([class])")||(()=>{const t=document.createElement("span");return this.appendChild(t),t})()).textContent=t}e.hasAttribute("aria-label")||e.setAttribute("aria-label",k(this,"switch","Switch"))}enhance(){const t=this.querySelector("input");t&&this._internals&&(t.setAttribute("aria-checked",String(t.checked)),this._setCustomState("data-checked",t.checked),this._internals.setFormValue(t.checked?t.value||"on":null),this._syncValidity(this.hasAttribute("required")&&!t.checked)),this._wiredSwitch||(this._wiredSwitch=!0,this.addEventListener("click",t=>{if(t.target&&t.target.closest&&t.target.closest("input"))return;const e=this.querySelector("input");e&&!e.disabled&&(t.preventDefault(),e.click())}),this.addEventListener("change",t=>{const e=this.querySelector("input");e&&t.target===e&&this._internals&&(e.setAttribute("aria-checked",String(e.checked)),this._setCustomState("data-checked",e.checked),this._setCustomState("data-indeterminate",!1),this.removeAttribute("indeterminate"),this.toggleAttribute("checked",e.checked),this._internals.setFormValue(e.checked?e.value||"on":null),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.checked))}))}formResetCallback(){this._contourResetting=!0;try{this.toggleAttribute("checked",!!this._switchDefaultChecked);const t=this.querySelector("input");t&&(t.checked=this.hasAttribute("checked")),this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-check",class extends T{static get observed(){return["label","name","value","required","type","checked","indeterminate","disabled","error","help"]}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},indeterminate:{attribute:"indeterminate",type:Boolean},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"}}}static get formAssociated(){return!0}render(){this.classList.add("c-check"),void 0===this._checkDefaultChecked&&(this._checkDefaultChecked=this.hasAttribute("checked"));const t=this.getAttribute("label"),e=this.ensure("input.c-check__input",()=>{const t=document.createElement("input");return t.className="c-check__input",t.type="radio"===this.getAttribute("type")?"radio":"checkbox",t});if(e.checked=this.hasAttribute("checked"),e.indeterminate=this.hasAttribute("indeterminate")&&!e.checked,t){e.setAttribute("aria-label",t);(this.querySelector(":scope > span:not([class])")||(()=>{const t=document.createElement("span");return this.appendChild(t),t})()).textContent=t}e.hasAttribute("aria-label")||e.setAttribute("aria-label",k(this,"checkbox","Checkbox")),this.hasAttribute("name")&&(e.name=this.getAttribute("name")),this.hasAttribute("value")&&(e.value=this.getAttribute("value")),this.hasAttribute("disabled")?(e.setAttribute("disabled",""),this.classList.add("is-disabled")):(e.removeAttribute("disabled"),this.classList.remove("is-disabled"));const s=this.getAttribute("error"),r=this.getAttribute("help");let i=this.querySelector(".c-check__message");s||r?(i||(i=document.createElement("div"),i.className="c-check__message",this.appendChild(i)),i.textContent=s||r||"",i.classList.toggle("c-check__message--error",!!s)):i&&i.remove(),s?this.classList.add("is-error"):this.classList.remove("is-error")}enhance(){const t=this.querySelector("input");t&&this._internals&&(this._setCustomState("data-checked",t.checked),this._setCustomState("data-indeterminate",t.indeterminate),this._internals.setFormValue(t.checked?t.value||"on":null),this._syncValidity(this.hasAttribute("required")&&!t.checked)),this._wiredCheck||(this._wiredCheck=!0,this.addEventListener("click",t=>{if(t.target&&t.target.closest&&t.target.closest("input"))return;const e=this.querySelector("input");e&&!e.disabled&&(t.preventDefault(),e.click())}),this.addEventListener("change",t=>{const e=this.querySelector("input");e&&t.target===e&&this._internals&&(this._setCustomState("data-checked",e.checked),this._setCustomState("data-indeterminate",!1),this.removeAttribute("indeterminate"),this.toggleAttribute("checked",e.checked),this._internals.setFormValue(e.checked?e.value||"on":null),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.checked))}))}formResetCallback(){this._contourResetting=!0;try{this.toggleAttribute("checked",!!this._checkDefaultChecked);const t=this.querySelector("input");t&&(t.checked=this.hasAttribute("checked")),this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-radio",class extends T{static get observed(){return["label","name","value","required","checked","disabled","error","help"]}static get properties(){return{label:{attribute:"label"},name:{attribute:"name"},value:{attribute:"value"},required:{attribute:"required",type:Boolean},checked:{attribute:"checked",type:Boolean},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"}}}static get formAssociated(){return!0}render(){this.classList.add("c-radio");const t=this.getAttribute("label"),e=this.ensure("input.c-radio__input",()=>{const t=document.createElement("input");return t.className="c-radio__input",t.type="radio",t});e.checked=this.hasAttribute("checked"),this.hasAttribute("name")&&(e.name=this.getAttribute("name")),this.hasAttribute("value")&&(e.value=this.getAttribute("value")),this.hasAttribute("disabled")?(e.setAttribute("disabled",""),this.classList.add("is-disabled")):(e.removeAttribute("disabled"),this.classList.remove("is-disabled"));const s=this.getAttribute("error"),r=this.getAttribute("help");let i=this.querySelector(".c-radio__message");if(s||r?(i||(i=document.createElement("div"),i.className="c-radio__message",this.appendChild(i)),i.textContent=s||r||"",i.classList.toggle("c-radio__message--error",!!s)):i&&i.remove(),s?this.classList.add("is-error"):this.classList.remove("is-error"),t){e.setAttribute("aria-label",t);(this.querySelector(":scope > span:not([class])")||(()=>{const t=document.createElement("span");return this.appendChild(t),t})()).textContent=t}e.hasAttribute("aria-label")||e.setAttribute("aria-label",k(this,"radio","Radio"))}enhance(){const t=this.querySelector("input");t&&this._internals&&(this._setCustomState("data-checked",t.checked),this._setCustomState("data-indeterminate",t.indeterminate),this._internals.setFormValue(t.checked?t.value||"on":null),this._syncValidity(this.hasAttribute("required")&&!t.checked)),this._wiredRadio||(this._wiredRadio=!0,this.addEventListener("click",t=>{if(t.target&&t.target.closest&&t.target.closest("input"))return;const e=this.querySelector("input");e&&!e.disabled&&(t.preventDefault(),e.click())}),this.addEventListener("change",t=>{const e=this.querySelector("input");e&&t.target===e&&this._internals&&(this._setCustomState("data-checked",e.checked),this._internals.setFormValue(e.checked?e.value||"on":null),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.checked))}))}});c("contour-select",class extends T{static get observed(){return["options","items","required","label","placeholder","disabled","error","help","value","name","multiple","autocomplete"]}static get properties(){return{options:{attribute:"options"},items:{attribute:"items"},required:{attribute:"required",type:Boolean},label:{attribute:"label"},placeholder:{attribute:"placeholder"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},value:{attribute:"value"},name:{attribute:"name"},multiple:{attribute:"multiple",type:Boolean},autocomplete:{attribute:"autocomplete"}}}static get formAssociated(){return!0}render(){this.classList.add("c-select"),void 0===this._selectDefault&&(this._selectDefault=this.getAttribute("value"));const t=this.getAttribute("options")||this.getAttribute("items"),e=new Set(this._contourGenerated||[]),s=Array.from(this.children).filter(t=>!e.has(t));if(t&&!s.length)try{const e=JSON.parse(t),s=this.ensure("select.c-select",()=>{const t=document.createElement("select");return t.className="c-select",t});s.innerHTML="";const r=this.getAttribute("label");r&&s.setAttribute("aria-label",r);const i=this.getAttribute("placeholder");if(i){const t=document.createElement("option");t.value="",t.textContent=i,t.disabled=!0,t.selected=!0,s.appendChild(t)}const a={};e.forEach(t=>{const e="object"==typeof t&&null!==t?t.group:null;if(e){a[e]||(a[e]=document.createElement("optgroup"),a[e].label=e,s.appendChild(a[e]));const r=document.createElement("option");r.value="string"==typeof t?t:t.value,r.textContent="string"==typeof t?t:t.label,a[e].appendChild(r)}else{const e=document.createElement("option");e.value="string"==typeof t?t:t.value,e.textContent="string"==typeof t?t:t.label,s.appendChild(e)}}),s.parentNode!==this&&this.appendChild(s),this.classList.remove("c-select"),s.classList.add("c-select")}catch(t){f(this,"attribute",t)}const r=this.querySelector("select");r&&!r.classList.contains("c-select")&&(r.classList.add("c-select"),this.classList.remove("c-select"));const i=this.querySelector("select");if(i){this.hasAttribute("disabled")?(i.setAttribute("disabled",""),this.classList.add("is-disabled")):(i.removeAttribute("disabled"),this.classList.remove("is-disabled")),this.hasAttribute("name")&&i.setAttribute("name",this.getAttribute("name")),this.hasAttribute("multiple")?i.setAttribute("multiple",""):i.removeAttribute("multiple"),this.hasAttribute("autocomplete")&&i.setAttribute("autocomplete",this.getAttribute("autocomplete")),this.hasAttribute("required")?i.setAttribute("required",""):i.removeAttribute("required");const t=this.getAttribute("value");if(null!==t)if(i.multiple){const e=new Set(String(t).split(",").map(t=>t.trim()).filter(Boolean));Array.from(i.options).forEach(t=>{t.selected=e.has(t.value)})}else i.value=t}const a=this.getAttribute("label");if(a){let t=this.querySelector("label.c-select__label");t||(t=document.createElement("label"),t.className="c-select__label",this.insertBefore(t,i||this.firstChild)),t.textContent=a,i&&(i.id||(i.id=o("contour-select")),t.setAttribute("for",i.id),i.setAttribute("aria-label",a))}if(!this.querySelector("select")?.hasAttribute("aria-label")){const t=this.querySelector("select");t&&t.setAttribute("aria-label",k(this,"select","Select"))}const n=this.getAttribute("error"),c=this.getAttribute("help");let l=this.querySelector(".c-select__message");n||c?(l||(l=document.createElement("div"),l.className="c-select__message",this.appendChild(l)),l.textContent=n||c||"",l.classList.toggle("c-select__message--error",!!n)):l&&l.remove(),n?this.classList.add("is-error"):this.classList.remove("is-error")}enhance(){this._internals&&this._syncFormValue(),this._wiredSelect||(this._wiredSelect=!0,this.addEventListener("input",t=>{const e=this.querySelector("select");e&&t.target===e&&this._emitForm("contour:input")}),this.addEventListener("change",t=>{const e=this.querySelector("select");if(!e||t.target!==e||!this._internals)return;const s=e.multiple?Array.from(e.selectedOptions).map(t=>t.value).join(","):e.value;this.setAttribute("value",s),this._syncFormValue(),this._emitForm("contour:change")}))}_syncFormValue(){if(!this._internals)return;const t=this.querySelector("select");if(t)if(t.multiple){const e=Array.from(t.selectedOptions).map(t=>t.value),s=this.getAttribute("name");if(s&&e.length){const t=new FormData;for(const r of e)t.append(s,r);this._internals.setFormValue(t)}else this._internals.setFormValue(null);this._syncValidity(this.hasAttribute("required")&&!e.length)}else this._internals.setFormValue(t.value),this._syncValidity(this.hasAttribute("required")&&!t.value)}formResetCallback(){this._contourResetting=!0;try{const t=this._selectDefault??null;null===t?this.removeAttribute("value"):this.setAttribute("value",t),this._syncFormValue()}finally{this._contourResetting=!1}}formStateRestoreCallback(t){const e=this.querySelector("select");if(!e||!this._internals)return;const s=t instanceof FormData?Array.from(t.getAll(this.getAttribute("name"))).map(String):null==t?[]:String(t).split(",").map(t=>t.trim()).filter(Boolean);this._contourResetting=!0;try{if(e.multiple){const t=new Set(s);for(const s of e.options)s.selected=t.has(s.value);this.setAttribute("value",s.join(","))}else e.value=s[0]||"",this.setAttribute("value",e.value);this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-version",class extends T{static get observed(){return["options","items","value","name"]}static get formAssociated(){return!0}static get properties(){return{options:{attribute:"options"},items:{attribute:"items"},value:{attribute:"value"},name:{attribute:"name"}}}render(){this.classList.add("c-version"),void 0===this._versionDefault&&(this._versionDefault=this.getAttribute("value"));const t=this.getAttribute("options")||this.getAttribute("items"),e=new Set(this._contourGenerated||[]),s=Array.from(this.children).filter(t=>!e.has(t));if(t&&!s.length)try{const e=JSON.parse(t),s=this.ensure("select.c-version",()=>{const t=document.createElement("select");return t.className="c-version",t});s.innerHTML="",s.hasAttribute("aria-label")||s.setAttribute("aria-label",k(this,"version","Version")),e.forEach(t=>{const e=document.createElement("option");"string"==typeof t?(e.value=t,e.textContent=t):(e.value=t.value||t.label,e.textContent=t.label||t.value,t.selected&&(e.selected=!0)),s.appendChild(e)}),s.parentNode!==this&&this.appendChild(s),this.classList.remove("c-version"),s.classList.add("c-version")}catch(t){f(this,"attribute",t)}const r=this.querySelector("select");if(r){this.hasAttribute("name")&&r.setAttribute("name",this.getAttribute("name"));const t=this.getAttribute("value");null!==t&&(r.value=t)}}enhance(){const t=()=>{const t=this.querySelector("select");t&&this._internals&&this._internals.setFormValue(t.value)};t(),this._wiredVersion||(this._wiredVersion=!0,this.addEventListener("change",e=>{const s=this.querySelector("select");s&&e.target===s&&(this.setAttribute("value",s.value),t(),this._emitForm("contour:change"))}))}formResetCallback(){this._contourResetting=!0;try{const t=this._versionDefault??null;null===t?this.removeAttribute("value"):this.setAttribute("value",t),this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-textarea",class extends T{static get observed(){return["placeholder","required","disabled","error","help","value","name","label"]}static get properties(){return{placeholder:{attribute:"placeholder"},required:{attribute:"required",type:Boolean},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},value:{attribute:"value"},name:{attribute:"name"},label:{attribute:"label"}}}static get formAssociated(){return!0}render(){const t=this.ensure("textarea",()=>{const t=document.createElement("textarea");return t.className="c-textarea",t});t.className="c-textarea",this.hasAttribute("name")?t.name=this.getAttribute("name"):t.removeAttribute("name"),this.hasAttribute("value")&&(t.value=this.getAttribute("value")),this.hasAttribute("aria-label")&&!t.hasAttribute("aria-label")&&t.setAttribute("aria-label",this.getAttribute("aria-label")),this.hasAttribute("label")&&!t.hasAttribute("aria-label")&&t.setAttribute("aria-label",this.getAttribute("label")),t.hasAttribute("aria-label")||t.setAttribute("aria-label",k(this,"textarea","Textarea")),this.hasAttribute("placeholder")?t.placeholder=this.getAttribute("placeholder"):t.removeAttribute("placeholder"),this.hasAttribute("required")?t.setAttribute("required",""):t.removeAttribute("required"),this.hasAttribute("disabled")?(t.setAttribute("disabled",""),this.classList.add("is-disabled")):(t.removeAttribute("disabled"),this.classList.remove("is-disabled"));const e=this.getAttribute("error"),s=this.getAttribute("help");let r=this.querySelector(".c-textarea__message");e||s?(r||(r=document.createElement("div"),r.className="c-textarea__message",this.appendChild(r)),r.textContent=e||s||"",r.classList.toggle("c-textarea__message--error",!!e)):r&&r.remove(),e?this.classList.add("is-error"):this.classList.remove("is-error")}enhance(){const t=this.querySelector("textarea");t&&this._internals&&(this._internals.setFormValue(t.value),this._syncValidity(this.hasAttribute("required")&&!t.value.trim())),this._wiredTextarea||(this._wiredTextarea=!0,this.addEventListener("input",t=>{const e=this.querySelector("textarea");e&&t.target===e&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:input"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}),this.addEventListener("change",t=>{const e=this.querySelector("textarea");e&&t.target===e&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}))}});c("contour-input",class extends T{static get observed(){return["type","placeholder","required","value","disabled","error","help","label","name"]}static get properties(){return{type:{attribute:"type"},placeholder:{attribute:"placeholder"},required:{attribute:"required",type:Boolean},value:{attribute:"value"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},label:{attribute:"label"},name:{attribute:"name"}}}static get formAssociated(){return!0}render(){this.classList.add("c-input");const t=this.ensure("input",()=>{const t=document.createElement("input");return t.className="c-input",t});t.className="c-input",t.type=this.getAttribute("type")||"text",t.placeholder=this.getAttribute("placeholder")||"",this.hasAttribute("name")?t.name=this.getAttribute("name"):t.removeAttribute("name");let e=this.getAttribute("label");if(!e){const t=this.closest("contour-field");t&&(e=t.getAttribute("label"))}e?t.setAttribute("aria-label",e):t.getAttribute("aria-label")||t.setAttribute("aria-label",k(this,"input","Input")),this.hasAttribute("value")&&(t.value=this.getAttribute("value")),this.hasAttribute("required")?t.setAttribute("required",""):t.removeAttribute("required"),this.hasAttribute("disabled")?(t.setAttribute("disabled",""),this.classList.add("is-disabled")):(t.removeAttribute("disabled"),this.classList.remove("is-disabled"));const s=this.getAttribute("error"),r=this.getAttribute("help");let i=this.querySelector(".c-input__message");s||r?(i||(i=document.createElement("div"),i.className="c-input__message",this.appendChild(i)),i.textContent=s||r||"",i.classList.toggle("c-input__message--error",!!s)):i&&i.remove(),s?this.classList.add("is-error"):this.classList.remove("is-error")}enhance(){const t=this.querySelector("input");t&&this._internals&&(this._internals.setFormValue(t.value),this._syncValidity(this.hasAttribute("required")&&!t.value.trim())),this._wiredInput||(this._wiredInput=!0,this.addEventListener("input",t=>{const e=this.querySelector("input");e&&t.target===e&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:input"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}),this.addEventListener("change",t=>{const e=this.querySelector("input");e&&t.target===e&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}))}});c("contour-input-group",class extends T{static get observed(){return["label","placeholder","clearable","submit","value","name","required","disabled"]}static get properties(){return{label:{attribute:"label"},placeholder:{attribute:"placeholder"},clearable:{attribute:"clearable",type:Boolean},submit:{attribute:"submit",type:Boolean},value:{attribute:"value"},name:{attribute:"name"},required:{attribute:"required",type:Boolean},disabled:{attribute:"disabled",type:Boolean}}}static get formAssociated(){return!0}render(){this.classList.add("c-input-group");this.ensure("svg",()=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true");const e=document.createElementNS("http://www.w3.org/2000/svg","use");return e.setAttribute("href","#i-search"),t.appendChild(e),t});const t=this.ensure("input.c-input",()=>{const t=document.createElement("input");return t.className="c-input",t.type="text",t});t.placeholder=this.getAttribute("placeholder")||this.getAttribute("label")||"",this.hasAttribute("name")?t.name=this.getAttribute("name"):t.removeAttribute("name"),this.hasAttribute("value")&&(t.value=this.getAttribute("value")),this.hasAttribute("required")?t.setAttribute("required",""):t.removeAttribute("required"),this.hasAttribute("disabled")?(t.setAttribute("disabled",""),this.classList.add("is-disabled")):(t.removeAttribute("disabled"),this.classList.remove("is-disabled"));const e=this.getAttribute("label");t.hasAttribute("aria-label")||t.setAttribute("aria-label",e||"Search");const s=this.querySelector(".c-input-group__clear");if(s&&s.remove(),this.hasAttribute("clearable")){const t=document.createElement("button");t.className="c-input-group__clear",t.type="button",t.setAttribute("aria-label",k(this,"clear","Clear")),t.textContent="×",this.appendChild(t)}const r=this.querySelector(".c-input-group__submit");if(r&&r.remove(),this.hasAttribute("submit")){const t=document.createElement("button");t.className="c-input-group__submit",t.type="submit",t.setAttribute("aria-label",k(this,"submit","Submit")),t.textContent="→",this.appendChild(t)}}enhance(){const t=this.querySelector("input.c-input");t&&this._internals&&(this._internals.setFormValue(t.value),this._syncValidity(this.hasAttribute("required")&&!t.value.trim())),this._wiredInputGroup||(this._wiredInputGroup=!0,this.addEventListener("input",t=>{const e=this.querySelector("input.c-input");e&&t.target===e&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:input"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}),this.addEventListener("change",t=>{const e=this.querySelector("input.c-input");e&&t.target===e&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-input-group__clear"):null;if(e&&this.contains(e)){t.preventDefault();const e=this.querySelector("input.c-input");e&&(e.value="",e.focus()),this._internals&&(this._internals.setFormValue(""),this._syncValidity(this.hasAttribute("required"))),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:""}}))}}))}});c("contour-radio-list",class extends T{static get observed(){return["items","options","name","value","required","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","dir","no-cache"]}static get properties(){return{items:{attribute:"items"},options:{attribute:"options"},name:{attribute:"name"},value:{attribute:"value"},required:{attribute:"required",type:Boolean},src:{attribute:"src"}}}static get formAssociated(){return!0}attributeChangedCallback(t,e,s){"value"===t&&this._radioSync||super.attributeChangedCallback(t,e,s)}render(){if(this.classList.add("c-radio-list"),this.setAttribute("role","radiogroup"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("name")||"Options"),this.hasAttribute("required")?this.setAttribute("aria-required","true"):this.removeAttribute("aria-required"),Zt(this),$t(this,"items"),Xt(this,"radio-list"))return;const t=Jt(this,"items")||this.getAttribute("options")||this.getAttribute("items"),e=this.querySelector("input.c-radio__input:checked"),s=this.hasAttribute("value")?this.getAttribute("value"):e?e.value:null;if(Array.from(this.querySelectorAll("label.c-radio")).forEach(t=>t.remove()),t)try{const e=JSON.parse(t),r=this.getAttribute("name")||o("radio-list");e.forEach(t=>{const e=document.createElement("label");e.className="c-radio";const i=document.createElement("input");if(i.type="radio",i.className="c-radio__input",i.name=r,i.tabIndex=-1,"string"==typeof t)i.value=t,t===s&&(i.checked=!0),e.appendChild(i),e.appendChild(document.createTextNode(" "+t));else{i.value=t.value||t.label,(t.checked||null!=s&&String(t.value||t.label)===String(s))&&(i.checked=!0),e.appendChild(i);const r=document.createElement("span");r.textContent=t.label||t.value,e.appendChild(r)}this.appendChild(e)});const i=Array.from(this.querySelectorAll("input.c-radio__input")),a=i.find(t=>t.checked)||i[0];a&&(a.tabIndex=0)}catch(t){f(this,"attribute",t)}else Yt(this,"radio-list")}enhance(){const t=()=>{const t=this.querySelector("input.c-radio__input:checked"),e=t?t.value:null;if(this._internals&&this._internals.setFormValue(e),null!=e&&this.getAttribute("value")!==e){this._radioSync=!0;try{this.setAttribute("value",e)}finally{this._radioSync=!1}}this._syncValidity(this.hasAttribute("required")&&null==e)};t(),this._wiredRadioList||(this._wiredRadioList=!0,this.addEventListener("change",e=>{const s=e.target&&e.target.closest?e.target.closest("input.c-radio__input"):null;s&&this.contains(s)&&(t(),this._emitForm("contour:change"))}),this.addEventListener("keydown",e=>{const s=Array.from(this.querySelectorAll("input.c-radio__input"));if(!s.length)return;const r=s.indexOf(e.target);if(-1===r)return;const i="rtl"===(this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"").toLowerCase();let a=-1;if("ArrowDown"===e.key)a=(r+1)%s.length;else if("ArrowUp"===e.key)a=(r-1+s.length)%s.length;else if("ArrowRight"===e.key)a=i?(r-1+s.length)%s.length:(r+1)%s.length;else if("ArrowLeft"===e.key)a=i?(r+1)%s.length:(r-1+s.length)%s.length;else if("Home"===e.key)a=0;else{if("End"!==e.key)return;a=s.length-1}e.preventDefault();const n=s.find(t=>t.checked);for(const t of s)t.tabIndex=-1;s[a].tabIndex=0,s[a].checked=!0,s[a].focus(),t(),n!==s[a]&&this._emitForm("contour:change")}))}formResetCallback(){this._contourResetting=!0;try{this.isConnected&&this._contourAuthored&&this.attributeChangedCallback("__rerender__",null,""),this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-fieldset",class extends T{static get observed(){return["legend","disabled"]}static get properties(){return{legend:{attribute:"legend"},disabled:{attribute:"disabled",type:Boolean}}}render(){const t=this.ensure("fieldset",()=>{const t=document.createElement("fieldset");return t.className="c-fieldset",t});this.hasAttribute("disabled")?t.setAttribute("disabled",""):t.removeAttribute("disabled");const e=this.getAttribute("legend");let s=t.querySelector("legend");e?(s||(s=document.createElement("legend"),s.className="c-fieldset__legend",t.prepend(s)),s.textContent=e):s&&s.remove();const r=Array.from(this.children).filter(e=>e!==t);r.length&&r.forEach(e=>t.appendChild(e))}});c("contour-checkbox-group",class extends T{static get observed(){return["legend","name","options","items","value","required","disabled"]}static get properties(){return{legend:{attribute:"legend"},name:{attribute:"name"},options:{attribute:"options"},items:{attribute:"items"},value:{attribute:"value"},required:{attribute:"required",type:Boolean},disabled:{attribute:"disabled",type:Boolean}}}static get formAssociated(){return!0}render(){this.classList.add("c-checkbox-group"),void 0===this._checkboxGroupDefault&&(this._checkboxGroupDefault=this.getAttribute("value"));const t=this.ensure("fieldset",()=>{const t=document.createElement("fieldset");return t.className="c-checkbox-group__fieldset",t});this.hasAttribute("disabled")?t.setAttribute("disabled",""):t.removeAttribute("disabled"),this.hasAttribute("required")?t.setAttribute("aria-required","true"):t.removeAttribute("aria-required");const e=this.getAttribute("legend");let s=t.querySelector("legend");e?(s||(s=document.createElement("legend"),s.className="c-checkbox-group__legend",t.prepend(s)),s.textContent=e):s&&s.remove();const r=this.getAttribute("name")||"group",i=this.getAttribute("options")||this.getAttribute("items"),a=(this.getAttribute("value")||"").split(",").map(t=>t.trim()).filter(Boolean);if(i)try{const e=JSON.parse(i);Array.from(t.querySelectorAll(".c-check")).forEach(t=>t.remove()),e.forEach(e=>{const s="string"==typeof e?e:e.label||e.value||"",i="string"==typeof e?e:e.value||e.label||"",n=document.createElement("label");n.className="c-check";const o=document.createElement("input");o.type="checkbox",o.className="c-check__input",o.name=r,o.value=i,o.setAttribute("data-contour-preserve-key",i),a.includes(i)&&(o.checked=!0);const c=document.createElement("span");c.textContent=s,n.appendChild(o),n.appendChild(c),t.appendChild(n)})}catch(t){f(this,"attribute",t)}if(a.length){const t=()=>{if(this.isConnected){for(const t of this.querySelectorAll("input[type=checkbox]"))a.includes(t.value)&&(t.checked=!0);this._internals&&this._syncFormValue()}};t(),"function"==typeof queueMicrotask&&queueMicrotask(t),"function"==typeof requestAnimationFrame&&requestAnimationFrame(t)}}enhance(){this._internals&&this._syncFormValue(),this._wiredCheckboxGroup||(this._wiredCheckboxGroup=!0,this.addEventListener("change",t=>{const e=t.target;if(e&&e.matches&&e.matches("input[type=checkbox]")){const t=Array.from(this.querySelectorAll("input[type=checkbox]:checked")).map(t=>t.value);this.setAttribute("value",t.join(",")),this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t.join(","),values:t}}))}}))}_syncFormValue(){if(!this._internals)return;const t=Array.from(this.querySelectorAll("input[type=checkbox]:checked")),e=this.getAttribute("name");if(e&&t.length){const s=new FormData;for(const r of t)s.append(e,r.value);this._internals.setFormValue(s)}else this._internals.setFormValue(null);this._syncValidity(this.hasAttribute("required")&&!t.length)}formResetCallback(){this._contourResetting=!0;try{const t=this._checkboxGroupDefault??null;null===t?this.removeAttribute("value"):this.setAttribute("value",t),this._syncFormValue()}finally{this._contourResetting=!1}}formStateRestoreCallback(t){const e=t instanceof FormData?Array.from(t.getAll(this.getAttribute("name"))).map(String):null==t?[]:String(t).split(",").map(t=>t.trim()).filter(Boolean);this._contourResetting=!0;try{this.setAttribute("value",e.join(",")),this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-search-field",class extends T{static get observed(){return["value","placeholder","label","name","required","disabled"]}static get properties(){return{value:{attribute:"value"},placeholder:{attribute:"placeholder"},label:{attribute:"label"},name:{attribute:"name"},required:{attribute:"required",type:Boolean},disabled:{attribute:"disabled",type:Boolean}}}static get formAssociated(){return!0}render(){this.classList.add("c-search-field");const t=this.ensure("input",()=>{const t=document.createElement("input");return t.type="search",t.className="c-search-field__input",t});t.placeholder=this.getAttribute("placeholder")||"Search",null!==this.getAttribute("value")&&(t.value=this.getAttribute("value")),this.hasAttribute("name")&&(t.name=this.getAttribute("name")),this.hasAttribute("required")?t.setAttribute("required",""):t.removeAttribute("required"),this.hasAttribute("disabled")?(t.setAttribute("disabled",""),this.classList.add("is-disabled")):(t.removeAttribute("disabled"),this.classList.remove("is-disabled"));const e=this.getAttribute("label");e?t.setAttribute("aria-label",e):t.hasAttribute("aria-label")||t.setAttribute("aria-label",k(this,"search","Search"))}enhance(){const t=this.querySelector("input");t&&this._internals&&(this._internals.setFormValue(t.value),this._syncValidity(this.hasAttribute("required")&&!t.value.trim())),this._wiredSearchField||(this._wiredSearchField=!0,this.addEventListener("input",t=>{const e=t.target;e&&e.matches&&e.matches("input")&&(this._internals&&(this._internals.setFormValue(e.value),this._syncValidity(this.hasAttribute("required")&&!e.value.trim())),this._emitForm("contour:input"))}),this.addEventListener("change",t=>{const e=t.target;e&&e.matches&&e.matches("input")&&this._internals&&(this._internals.setFormValue(e.value),this._emitForm("contour:change"),this._syncValidity(this.hasAttribute("required")&&!e.value.trim()))}))}});c("contour-density-toggle",class extends T{static get observed(){return["value","label"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"}}}render(){this.classList.add("c-density-toggle");const t=this.getAttribute("value")||"comfortable";this.setAttribute("data-density",t);const e=this.ensure("button",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-density-toggle__btn",t.type="button",t}),s=this.getAttribute("label")||("compact"===t?"Compact":"Comfortable");e.textContent=s,e.setAttribute("aria-pressed","compact"===t?"true":"false")}enhance(){this._wiredDensityToggle||(this._wiredDensityToggle=!0,this.addEventListener("click",()=>{const t="compact"===this.getAttribute("data-density")?"comfortable":"compact";this.setAttribute("value",t),this.setAttribute("data-density",t);const e=this.querySelector(".c-density-toggle__btn");e&&(e.textContent="compact"===t?"Compact":"Comfortable",e.setAttribute("aria-pressed","compact"===t?"true":"false")),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t}}))}))}});c("contour-pressable",class extends T{static get observed(){return["disabled","label"]}static get properties(){return{disabled:{attribute:"disabled",type:Boolean}}}render(){this.classList.add("c-pressable"),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Pressable"),this.hasAttribute("disabled")?(this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1")):(this.removeAttribute("aria-disabled"),this.hasAttribute("tabindex")&&"-1"!==this.getAttribute("tabindex")||this.setAttribute("tabindex","0"))}enhance(){if(this._wiredPressable)return;this._wiredPressable=!0;const t=()=>this.hasAttribute("disabled")||"true"===this.getAttribute("aria-disabled");this.addEventListener("click",e=>{t()&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener("keydown",e=>{if(t())return e.preventDefault(),void e.stopImmediatePropagation();"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.click(),this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0})))})}});c("contour-resize-handle",class extends T{render(){this.classList.add("c-resize-handle"),this.hasAttribute("role")||this.setAttribute("role","separator"),this.hasAttribute("aria-valuenow")||this.setAttribute("aria-valuenow","0"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"resize-handle","Resize handle")),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("aria-orientation")||this.setAttribute("aria-orientation","horizontal")}enhance(){this._wiredResizeHandle||(this._wiredResizeHandle=!0,this.addEventListener("keydown",t=>{const e=Number(this.getAttribute("aria-valuenow"))||0;let s=0;if("ArrowLeft"===t.key||"ArrowDown"===t.key)s=-5;else if("ArrowRight"===t.key||"ArrowUp"===t.key)s=5;else if("Home"===t.key)s=-e;else{if("End"!==t.key)return;s=100-e}t.preventDefault();const r=Math.min(100,Math.max(0,e+s));this.setAttribute("aria-valuenow",String(r)),this.dispatchEvent(new CustomEvent("contour:resize",{bubbles:!0,composed:!0,detail:{value:r,delta:s}}))}))}});c("contour-search-trigger",class extends T{static get observed(){return["label","shortcut"]}static get properties(){return{label:{attribute:"label"},shortcut:{attribute:"shortcut"}}}render(){this.classList.add("c-search-trigger");const t=this.getAttribute("label")||"Search";this.hasAttribute("aria-label")||this.setAttribute("aria-label",t);const e=this.ensure(".c-search-trigger__text",()=>{const t=document.createElement("span");return t.className="c-search-trigger__text",t});e.className="c-search-trigger__text",e.textContent.trim()&&e.textContent.trim()===t||(e.textContent=t);const s=this.ensure("kbd.c-search-trigger__kbd",()=>{const t=document.createElement("kbd");return t.className="c-search-trigger__kbd",t});s.className="c-search-trigger__kbd",s.textContent=this.getAttribute("shortcut")||"⌘K"}});c("contour-shortcut-list",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-shortcut-list"),this.setAttribute("role","list");const t=this.getAttribute("title");if(t){this.ensure(".c-shortcut-list__title",()=>{const t=document.createElement("div");return t.className="c-shortcut-list__title",t}).textContent=t}}});c("contour-shortcut-row",class extends T{static get observed(){return["desc","key"]}static get properties(){return{desc:{attribute:"desc"},key:{attribute:"key"}}}render(){this.classList.add("c-shortcut-row"),this.hasAttribute("role")||this.setAttribute("role","listitem");const t=this.getAttribute("key"),e=this.getAttribute("desc");if(t){const e=this.ensure(".c-shortcut-row__keys",()=>{const t=document.createElement("kbd");return t.className="c-shortcut-row__keys",t});e.className="c-shortcut-row__keys",e.textContent=t}else{const t=this.querySelector(".c-shortcut-row__keys");t&&t.remove()}if(e){const t=this.ensure(".c-shortcut-row__label",()=>{const t=document.createElement("span");return t.className="c-shortcut-row__label",t});t.className="c-shortcut-row__label",t.textContent=e}else{const t=this.querySelector(".c-shortcut-row__label");t&&t.remove()}}});c("contour-shortcut-panel",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-shortcut-panel");const t=this.getAttribute("title");if(t){this.ensure(".c-shortcut-panel__title",()=>{const t=document.createElement("div");return t.className="c-shortcut-panel__title",t}).textContent=t}else{const t=this.querySelector(".c-shortcut-panel__title");t&&t.remove()}}});c("contour-shortcut-overlay",class extends T{static get observed(){return["title","open","keybind"]}static get properties(){return{title:{attribute:"title"},open:{attribute:"open",type:Boolean},keybind:{attribute:"keybind"}}}render(){this.classList.add("c-shortcut-overlay"),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("aria-modal")||this.setAttribute("aria-modal","true"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Keyboard shortcuts");const t=this.getAttribute("title");if(t){this.ensure(".c-shortcut-overlay__title",()=>{const t=document.createElement("div");return t.className="c-shortcut-overlay__title",t}).textContent=t}this.hasAttribute("open")?this.removeAttribute("hidden"):this.hasAttribute("hidden")||this.setAttribute("hidden","")}show(){if(this.hasAttribute("open"))return;this._opener=document.activeElement,this.setAttribute("open",""),this.removeAttribute("hidden"),Ft(this,!0),this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}));const t=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");t&&t.focus()}hide(){this.hasAttribute("open")&&(this.removeAttribute("open"),this.setAttribute("hidden",""),Ft(this,!1),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})),this._opener&&"function"==typeof this._opener.focus&&this._opener.focus(),this._opener=null)}toggle(){this.hasAttribute("open")?this.hide():this.show()}enhance(){if(this._wiredShortcutOverlay)return;this._wiredShortcutOverlay=!0;const t=t=>{if("?"!==t.key||!w(this,"keybind")||t.metaKey||t.ctrlKey||t.altKey)"Escape"===t.key&&this.hasAttribute("open")&&this.hide();else{const e=t.target&&t.target.tagName||"";if("INPUT"===e||"TEXTAREA"===e||t.target&&t.target.isContentEditable)return;t.preventDefault(),this.toggle()}};document.addEventListener("keydown",t),i(this,()=>document.removeEventListener("keydown",t)),this.addEventListener("click",t=>{t.target===this&&this.hide()})}});c("contour-row-action",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("disabled")?(this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1")):(this.removeAttribute("aria-disabled"),this.hasAttribute("tabindex")&&"-1"!==this.getAttribute("tabindex")||this.setAttribute("tabindex","0"));const t=this.getAttribute("label");t&&!this.hasChildNodes()&&(this.textContent=t),t&&!this.hasAttribute("aria-label")&&this.setAttribute("aria-label",t)}enhance(){if(this._wiredRowAction)return;this._wiredRowAction=!0;const t=()=>this.hasAttribute("disabled")||"true"===this.getAttribute("aria-disabled");this.addEventListener("click",e=>{t()&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener("keydown",e=>{if(t())return e.preventDefault(),void e.stopImmediatePropagation();"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.click(),this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0})))})}});c("contour-segmented",class extends T{static get observed(){return["options","items","selected","label","value"]}static get properties(){return{options:{attribute:"options"},items:{attribute:"items"},selected:{attribute:"selected"},label:{attribute:"label"},value:{attribute:"value"}}}render(){this.classList.add("c-segmented");const t=this.getAttribute("options")||this.getAttribute("items");if(t){let e=null;try{e=JSON.parse(t)}catch(t){e=null}if(Array.isArray(e)){Array.from(this.querySelectorAll("button.c-segmented__option")).forEach(t=>t.remove());const t=this.getAttribute("selected")||this.getAttribute("value");e.forEach((e,s)=>{const r="string"==typeof e?e:e.label||e.value||"",i="string"==typeof e?e:e.value||e.label||"",a=document.createElement("button");a.className="c-segmented__option",a.type="button",a.textContent=r,a.dataset.value=i,null!==t&&String(i)===String(t)||null===t&&0===s?a.setAttribute("aria-pressed","true"):a.setAttribute("aria-pressed","false"),this.appendChild(a)})}}}enhance(){gt(this)}});c("contour-draggable",class extends T{render(){this.classList.add("c-draggable"),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("draggable")||this.setAttribute("draggable","true"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Draggable item")}_dragValue(){return this.getAttribute("value")||this.getAttribute("label")||(this.textContent||"").trim()||"draggable"}enhance(){this._wiredDraggable||(this._wiredDraggable=!0,this.addEventListener("dragstart",t=>{if(!t.dataTransfer)return;const e=this._dragValue();try{t.dataTransfer.effectAllowed="move"}catch(t){}t.dataTransfer.setData("text/plain",e),this.classList.add("c-draggable--dragging"),this.dispatchEvent(new CustomEvent("contour:dragstart",{bubbles:!0,composed:!0,detail:{value:e}}))}),this.addEventListener("dragend",()=>{this.classList.remove("c-draggable--dragging"),this.dispatchEvent(new CustomEvent("contour:dragend",{bubbles:!0,composed:!0,detail:{value:this._dragValue()}}))}),this.addEventListener("keydown",t=>{if("Enter"===t.key||" "===t.key)return t.preventDefault(),void this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0}));"ArrowUp"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:move",{bubbles:!0,composed:!0,detail:{direction:"ArrowUp"===t.key?"up":"down"}})))}))}});c("contour-drag-handle",class extends T{render(){this.classList.add("c-drag-handle"),this.hasAttribute("role")||this.setAttribute("role","separator");const t=this.getAttribute("min")||"0",e=this.getAttribute("max")||"100";this.hasAttribute("aria-valuenow")||this.setAttribute("aria-valuenow",t),this.hasAttribute("aria-valuemin")||this.setAttribute("aria-valuemin",t),this.hasAttribute("aria-valuemax")||this.setAttribute("aria-valuemax",e),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Drag handle"),this.hasAttribute("aria-orientation")||this.setAttribute("aria-orientation","horizontal");const s=this.getAttribute("controls");s&&!this.hasAttribute("aria-controls")&&this.setAttribute("aria-controls",s);const r=this.ensure(".c-drag-handle__grip",()=>{const t=document.createElement("span");return t.className="c-drag-handle__grip",t.setAttribute("aria-hidden","true"),L(t,'<svg viewBox="0 0 24 24"><use href="#i-drag" /></svg>'),t});r.parentNode!==this&&this.appendChild(r)}enhance(){this._wiredDragHandle||(this._wiredDragHandle=!0,this.addEventListener("keydown",t=>{const e=Number(this.getAttribute("aria-valuenow")||0),s=Number(this.getAttribute("aria-valuemin")||0),r=Number(this.getAttribute("aria-valuemax")||100);let i=0;if("ArrowLeft"===t.key||"ArrowDown"===t.key)i=-1;else if("ArrowRight"===t.key||"ArrowUp"===t.key)i=1;else if("Home"===t.key)i=s-e;else{if("End"!==t.key)return;i=r-e}t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:drag",{bubbles:!0,composed:!0,detail:{key:t.key,delta:i,value:e}}))}))}});c("contour-drop-indicator",class extends T{static get observed(){return["label","open"]}static get properties(){return{label:{attribute:"label"},open:{attribute:"open",type:Boolean}}}render(){this.classList.add("c-drop-indicator"),this.classList.toggle("c-drop-indicator--visible",this.hasAttribute("open")),this.hasAttribute("role")||this.setAttribute("role","presentation"),"presentation"===this.getAttribute("role")&&(this.removeAttribute("aria-label"),this.removeAttribute("aria-labelledby")),Array.from(this.childNodes).forEach(t=>{(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ELEMENT_NODE&&"SPAN"===t.tagName)&&t.remove()});const t=this.getAttribute("label");if(t){this.ensure(".c-drop-indicator__label",()=>{const t=document.createElement("span");return t.className="c-drop-indicator__label",t}).textContent=t}}});c("contour-drop-zone",class extends T{static get observed(){return["label"]}static get properties(){return{label:{attribute:"label"}}}render(){this.classList.add("c-drop-zone"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Drop zone"),Array.from(this.childNodes).forEach(t=>{(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ELEMENT_NODE&&"SPAN"===t.tagName)&&t.remove()});const t=this.getAttribute("label");if(t){const e=this.ensure(".c-drop-zone__label",()=>{const t=document.createElement("p");return t.className="c-drop-zone__label",t});L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-upload" /></svg>'),e.appendChild(document.createTextNode(" "+t))}}enhance(){if(this._wiredDropZone)return;this._wiredDropZone=!0;const t=t=>t.dataTransfer&&Array.from(t.dataTransfer.types).includes("text/plain"),e=()=>{this.classList.remove("c-drop-zone--active","c-drop-zone--reject")};this.addEventListener("dragenter",e=>{e.dataTransfer&&(this.classList.toggle("c-drop-zone--reject",!t(e)),t(e)&&(e.preventDefault(),this.classList.add("c-drop-zone--active")))}),this.addEventListener("dragover",e=>{e.dataTransfer&&(this.classList.toggle("c-drop-zone--reject",!t(e)),t(e)&&(e.preventDefault(),this.classList.add("c-drop-zone--active")))}),this.addEventListener("dragleave",e),this.addEventListener("drop",s=>{if(!t(s))return;s.preventDefault(),e();const r=s.dataTransfer.getData("text/plain")||"";this.dispatchEvent(new CustomEvent("contour:drop",{bubbles:!0,composed:!0,detail:{value:r,label:this.getAttribute("label")}}))})}});c("contour-resizable",class extends T{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 t="vertical"===this.getAttribute("direction");if(this.classList.add(t?"c-resizable--vertical":"c-resizable--horizontal"),!this.querySelector(".c-resizable__pane")){const t=document.createElement("div");t.className="c-resizable__pane";const e=document.createElement("div");e.className="c-resize-handle",e.setAttribute("tabindex","0"),e.setAttribute("role","separator"),e.setAttribute("aria-valuenow","0");const s=document.createElement("div");s.className="c-resizable__pane",this.appendChild(t),this.appendChild(e),this.appendChild(s)}const e=this._splitValue||this.getAttribute("value"),s=this.querySelector(".c-resize-handle");if(s&&(s.setAttribute("role","separator"),s.setAttribute("tabindex","0"),s.setAttribute("aria-valuenow",String(Math.round(parseFloat(e)||50))),s.setAttribute("aria-valuemin","10"),s.setAttribute("aria-valuemax","90"),s.setAttribute("aria-orientation",t?"horizontal":"vertical"),s.setAttribute("aria-label",k(this,"resize-panels","Resize panels"))),e){const t=this.querySelector(".c-resizable__pane");t&&(t.style.flex=`0 0 ${e}%`)}}enhance(){if(this._wiredResizable)return;this._wiredResizable=!0;const t=t=>{const e=this.querySelector(".c-resizable__pane");e&&(e.style.flex=`0 0 ${t}%`),this._splitValue=String(t);const s=this.querySelector(".c-resize-handle");if(s){const e=this.classList.contains("c-resizable--vertical");s.setAttribute("role","separator"),s.setAttribute("aria-valuenow",String(t)),s.setAttribute("aria-valuemin","10"),s.setAttribute("aria-valuemax","90"),s.setAttribute("aria-orientation",e?"horizontal":"vertical"),s.setAttribute("aria-label",k(this,"resize-panels","Resize panels")),s.setAttribute("tabindex","0")}},e=(e,s)=>{const r=this.getBoundingClientRect(),i=this.classList.contains("c-resizable--vertical"),a=i?r.height:r.width,n=i?s-r.top:e-r.left,o=a>0?Math.min(.9,Math.max(.1,n/a)):.5;t(Math.round(100*o))};this.addEventListener("pointerdown",t=>{const e=this.querySelector(".c-resize-handle");if(e&&t.target===e){if(this._resizing=!0,e.classList.add("c-resize-handle--dragging"),e.setPointerCapture)try{e.setPointerCapture(t.pointerId)}catch(t){}t.preventDefault()}}),this.addEventListener("pointermove",t=>{this._resizing&&e(t.clientX,t.clientY)});const s=t=>{if(!this._resizing)return;this._resizing=!1,this._splitValue&&(this.setAttribute("value",this._splitValue),this._splitValue=null);const e=this.getBoundingClientRect();this.dispatchEvent(new CustomEvent("contour:resize",{bubbles:!0,composed:!0,detail:{width:Math.round(e.width),height:Math.round(e.height)}}));const s=this.querySelector(".c-resize-handle");if(s&&(s.classList.remove("c-resize-handle--dragging"),s.hasPointerCapture&&s.hasPointerCapture(t.pointerId)))try{s.releasePointerCapture(t.pointerId)}catch(t){}};this.addEventListener("pointerup",s),this.addEventListener("pointercancel",s),this.addEventListener("keydown",e=>{const s=this.querySelector(".c-resize-handle");if(!s||document.activeElement!==s)return;this.classList.contains("c-resizable--vertical");const r=parseFloat(this.getAttribute("value"))||50;"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),t(Math.max(10,r-5)),this._splitValue=null,this.setAttribute("value",String(Math.max(10,r-5)))):"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),t(Math.min(90,r+5)),this._splitValue=null,this.setAttribute("value",String(Math.min(90,r+5))));const i=this.getBoundingClientRect();this.dispatchEvent(new CustomEvent("contour:resize",{bubbles:!0,composed:!0,detail:{width:Math.round(i.width),height:Math.round(i.height)}}))})}});c("contour-split-view",class extends T{static get observed(){return["direction","value","left-label","right-label"]}static get properties(){return{direction:{attribute:"direction"},value:{attribute:"value"},"left-label":{attribute:"left-label"},"right-label":{attribute:"right-label"}}}render(){this.classList.add("c-split-view"),this.setAttribute("role","region");const t="vertical"===this.getAttribute("direction");if(t?(this.classList.add("c-split-view--vertical"),this.classList.remove("c-split-view--horizontal")):(this.classList.add("c-split-view--horizontal"),this.classList.remove("c-split-view--vertical")),this.getAttribute("left-label")&&this.setAttribute("aria-label",this.getAttribute("left-label")),!this.querySelector(".c-split-view__pane")){const e=document.createElement("div");e.className="c-split-view__pane c-split-view__pane--left",e.setAttribute("role","region"),this.getAttribute("left-label")&&e.setAttribute("aria-label",this.getAttribute("left-label"));const s=document.createElement("div");s.className="c-split-view__divider",s.setAttribute("tabindex","0"),s.setAttribute("role","separator"),s.setAttribute("aria-valuenow",this.getAttribute("value")||"50"),s.setAttribute("aria-valuemin","10"),s.setAttribute("aria-valuemax","90"),s.setAttribute("aria-orientation",t?"horizontal":"vertical"),s.setAttribute("aria-label",k(this,"split-divider","Split divider"));const r=document.createElement("div");r.className="c-split-view__pane c-split-view__pane--right",r.setAttribute("role","region"),this.getAttribute("right-label")&&r.setAttribute("aria-label",this.getAttribute("right-label")),this.appendChild(e),this.appendChild(s),this.appendChild(r)}if(!this.querySelector(".c-split-view__divider")){const e=document.createElement("div");e.className="c-split-view__divider",e.setAttribute("tabindex","0"),e.setAttribute("role","separator"),e.setAttribute("aria-valuenow",this.getAttribute("value")||"50"),e.setAttribute("aria-valuemin","10"),e.setAttribute("aria-valuemax","90"),e.setAttribute("aria-orientation",t?"horizontal":"vertical"),e.setAttribute("aria-label",k(this,"split-divider","Split divider")),this.appendChild(e)}const e=this.getAttribute("value")||"50",s=this.querySelector(".c-split-view__pane--left");s&&(s.style.flex=`0 0 ${e}%`);const r=this.querySelector(".c-split-view__divider");r&&(r.setAttribute("aria-valuenow",e),r.setAttribute("aria-valuemin","10"),r.setAttribute("aria-valuemax","90"),r.setAttribute("aria-orientation",t?"horizontal":"vertical"))}enhance(){if(this._wiredSplitView)return;this._wiredSplitView=!0;const t=()=>"column"===getComputedStyle(this).flexDirection,e=()=>{const e=this.querySelector(".c-split-view__divider");e&&e.setAttribute("aria-orientation",t()?"horizontal":"vertical")};if(e(),"function"==typeof ResizeObserver){const t=new ResizeObserver(e);t.observe(this),i(this,()=>t.disconnect())}const s=(e,s)=>{const r=this.getBoundingClientRect(),i=t(),a=i?r.height:r.width,n=i?s-r.top:e-r.left,o=a>0?Math.min(.9,Math.max(.1,n/a)):.5,c=Math.round(100*o),l=this.querySelector(".c-split-view__pane--left");l&&(l.style.flex=`0 0 ${c}%`);const u=this.querySelector(".c-split-view__divider");u&&u.setAttribute("aria-valuenow",String(c)),this.setAttribute("value",String(c))};this.addEventListener("pointerdown",t=>{const e=this.querySelector(".c-split-view__divider");if(e&&t.target===e){if(this._resizing=!0,e.classList.add("c-split-view__divider--dragging"),e.setPointerCapture)try{e.setPointerCapture(t.pointerId)}catch(t){}t.preventDefault()}}),this.addEventListener("pointermove",t=>{this._resizing&&s(t.clientX,t.clientY)});const r=t=>{if(!this._resizing)return;this._resizing=!1;const e=this.querySelector(".c-split-view__divider");if(e&&(e.classList.remove("c-split-view__divider--dragging"),e.hasPointerCapture&&e.hasPointerCapture(t.pointerId)))try{e.releasePointerCapture(t.pointerId)}catch(t){}const s=this.getBoundingClientRect();this.dispatchEvent(new CustomEvent("contour:split-change",{bubbles:!0,composed:!0,detail:{value:this.getAttribute("value"),width:Math.round(s.width),height:Math.round(s.height)}}))};this.addEventListener("pointerup",r),this.addEventListener("pointercancel",r),this.addEventListener("keydown",t=>{const e=this.querySelector(".c-split-view__divider");if(!e||document.activeElement!==e)return;const s=parseFloat(this.getAttribute("value"))||50;if("ArrowLeft"===t.key||"ArrowDown"===t.key){t.preventDefault();const e=Math.max(10,s-5),r=this.querySelector(".c-split-view__pane--left");r&&(r.style.flex=`0 0 ${e}%`),this.setAttribute("value",String(e));const i=this.querySelector(".c-split-view__divider");i&&i.setAttribute("aria-valuenow",String(e))}else if("ArrowRight"===t.key||"ArrowUp"===t.key){t.preventDefault();const e=Math.min(90,s+5),r=this.querySelector(".c-split-view__pane--left");r&&(r.style.flex=`0 0 ${e}%`),this.setAttribute("value",String(e));const i=this.querySelector(".c-split-view__divider");i&&i.setAttribute("aria-valuenow",String(e))}const r=this.getBoundingClientRect();this.dispatchEvent(new CustomEvent("contour:split-change",{bubbles:!0,composed:!0,detail:{value:this.getAttribute("value"),width:Math.round(r.width),height:Math.round(r.height)}}))})}});c("contour-table-wrap",class extends T{static get observed(){return[]}static get properties(){return{}}render(){this.classList.add("c-table-wrap"),Array.from(this.childNodes).forEach(t=>{(t.nodeType===Node.TEXT_NODE||t.nodeType===Node.ELEMENT_NODE&&"SPAN"===t.tagName)&&t.remove()})}});c("contour-scroll-area",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-scroll-area");const t=this.getAttribute("title");if(t){this.ensure(".c-scroll-area__title",()=>{const t=document.createElement("div");return t.className="c-scroll-area__title",t}).textContent=t}}});c("contour-btn",class extends T{static get observed(){return["variant","size","color","label","disabled","href","loading","title"]}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");for(const t of["variant","size","color"]){const e=this.getAttribute(t);e&&this.classList.add("c-btn--"+e)}this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("disabled")?(this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1")):(this.removeAttribute("aria-disabled"),this.hasAttribute("tabindex")&&"-1"!==this.getAttribute("tabindex")||this.setAttribute("tabindex","0"));const t=this.getAttribute("label")||this.getAttribute("title");t&&!this.hasChildNodes()&&(this.textContent=t),t&&!this.hasAttribute("aria-label")&&this.setAttribute("aria-label",t),this.hasAttribute("loading")?(this.setAttribute("data-loading","true"),this.setAttribute("aria-busy","true")):(this.removeAttribute("data-loading"),this.removeAttribute("aria-busy"))}enhance(){if(this._wiredBtn)return;this._wiredBtn=!0;const t=()=>this.hasAttribute("disabled")||"true"===this.getAttribute("aria-disabled");this.addEventListener("click",e=>{t()&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener("click",e=>{if(t())return;const s=v(this.getAttribute("href"));s&&"#"!==s&&(location.href=s)}),this.addEventListener("keydown",e=>{if(t())return e.preventDefault(),void e.stopImmediatePropagation();"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.click(),this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0})))})}});c("contour-app",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-app");const t=this.ensure(".c-app__header",()=>{const t=document.createElement("header");return t.className="c-app__header",t}),e=this.getAttribute("title");if(e){const s=this.ensure(".c-app__title",()=>{const t=document.createElement("div");return t.className="c-app__title",t});s.textContent=e,s.parentNode!==t&&t.appendChild(s)}const s=this.ensure(".c-app__main",()=>{const t=document.createElement("main");return t.className="c-app__main",t});s.parentNode!==this&&this.appendChild(s),t.parentNode!==this&&this.insertBefore(t,s),Array.from(this.children).forEach(e=>{e!==t&&e!==s&&s.appendChild(e)})}});c("contour-app-body",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-app-body");const t=!!(this.parentElement&&this.parentElement.closest&&this.parentElement.closest("contour-app"))?"div":"main";let e=this.querySelector(":scope > .c-app-body__main");e&&e.tagName.toLowerCase()!==t&&(e.remove(),e=null),e||(e=document.createElement(t),e.className="c-app-body__main",this.appendChild(e));const s=this.getAttribute("title");if(s){const t=this.ensure(".c-app-body__title",()=>{const t=document.createElement("div");return t.className="c-app-body__title",t});t.textContent=s,t.parentNode!==e&&e.appendChild(t)}e.parentNode!==this&&this.appendChild(e)}});c("contour-btn-group",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-btn-group"),this.setAttribute("role","group"),this.getAttribute("title")&&this.setAttribute("aria-label",this.getAttribute("title"))}enhance(){this._wiredBtnGroup||(this._wiredBtnGroup=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-btn"):null;if(e&&this.contains(e)){const t=Array.from(this.querySelectorAll(".c-btn")).indexOf(e);this.dispatchEvent(new CustomEvent("contour:btn-group-change",{bubbles:!0,composed:!0,detail:{index:t,label:e.textContent}}))}}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-btn"));e.length&&z(t,e,{wrap:!1,homeEnd:!0,rtl:I(this)})}))}});c("contour-range-scale",class extends T{static get observed(){return["label","ticks"]}static get properties(){return{label:{attribute:"label"},ticks:{attribute:"ticks"}}}render(){this.classList.add("c-range-scale"),this.setAttribute("role","group"),this.getAttribute("label")&&this.setAttribute("aria-label",this.getAttribute("label"));const t=this.getAttribute("label");if(t){this.ensure(".c-range-scale__label",()=>{const t=document.createElement("span");return t.className="c-range-scale__label",t}).textContent=t}const e=this.getAttribute("ticks");Array.from(this.querySelectorAll(".c-range-scale__tick")).forEach(t=>t.remove()),e&&e.split(",").map(t=>t.trim()).filter(Boolean).forEach(t=>{const e=document.createElement("span");e.className="c-range-scale__tick",e.textContent=t,this.appendChild(e)})}enhance(){this._wiredRangeScale||(this._wiredRangeScale=!0,this.addEventListener("input",t=>{const e=t.target;e&&e.matches&&e.matches("input")&&this.dispatchEvent(new CustomEvent("contour:range-change",{bubbles:!0,composed:!0,detail:{value:e.value}}))}),this.addEventListener("change",t=>{const e=t.target;e&&e.matches&&e.matches("input")&&this.dispatchEvent(new CustomEvent("contour:range-change",{bubbles:!0,composed:!0,detail:{value:e.value}}))}))}});c("contour-time-range",class extends T{static get observed(){return["label","value","ticks","required","disabled"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},ticks:{attribute:"ticks"},required:{attribute:"required",type:Boolean},disabled:{attribute:"disabled",type:Boolean}}}render(){this.classList.add("c-time-range"),this.setAttribute("role","group"),this.getAttribute("label")&&this.setAttribute("aria-label",this.getAttribute("label"));const t=this.getAttribute("label");if(t){this.ensure(".c-time-range__label",()=>{const t=document.createElement("span");return t.className="c-time-range__label",t}).textContent=t}const e=this.querySelector("input");!e||!t||e.hasAttribute("aria-label")||e.labels&&e.labels.length||e.setAttribute("aria-label",t);const s=this.getAttribute("value");null!==s&&e&&e.value!==s&&(e.value=s);const r=this.getAttribute("ticks");Array.from(this.querySelectorAll(".c-time-range__tick")).forEach(t=>t.remove()),r&&r.split(",").map(t=>t.trim()).filter(Boolean).forEach(t=>{const e=document.createElement("span");e.className="c-time-range__tick",e.textContent=t,this.appendChild(e)})}enhance(){this._wiredTimeRange||(this._wiredTimeRange=!0,this.addEventListener("input",t=>{const e=t.target;e&&e.matches&&e.matches("input")&&this.dispatchEvent(new CustomEvent("contour:time-range-change",{bubbles:!0,composed:!0,detail:{value:e.value}}))}),this.addEventListener("change",t=>{const e=t.target;e&&e.matches&&e.matches("input")&&this.dispatchEvent(new CustomEvent("contour:time-range-change",{bubbles:!0,composed:!0,detail:{value:e.value}}))}))}});c("contour-skip-link",class extends T{static get observed(){return["href","label"]}static get properties(){return{href:{attribute:"href"},label:{attribute:"label"}}}render(){Array.from(this.childNodes).forEach(t=>{t.nodeType===Node.TEXT_NODE&&t.remove()});const t=this.ensure("a",()=>{const t=document.createElement("a");return t.className="c-skip-link",t});t.setAttribute("href",v(this.getAttribute("href")||"#main")),t.textContent=this.getAttribute("label")||"Skip to content"}});c("contour-icon",class extends T{static get observed(){return["name","size","label"]}static get properties(){return{name:{attribute:"name"},size:{attribute:"size"},label:{attribute:"label"}}}render(){const t=this.getAttribute("name")||"",e=t.startsWith("i-")?t.slice(2):t,s=this.getAttribute("size"),r=this.getAttribute("label");this.innerHTML="";const i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("class","c-icon"),i.setAttribute("aria-hidden","true"),s&&(i.style.width=s,i.style.height=s);const a=document.createElementNS("http://www.w3.org/2000/svg","use");a.setAttribute("href","#i-"+e),i.appendChild(a),this.appendChild(i),r?(this.setAttribute("role","img"),this.setAttribute("aria-label",r)):(this.removeAttribute("role"),this.removeAttribute("aria-label"))}});c("contour-dashboard-grid",class extends T{static get observed(){return["cols","gap"]}static get properties(){return{cols:{attribute:"cols"},gap:{attribute:"gap"}}}render(){this.classList.add("c-dashboard-grid");const t=this.getAttribute("cols");t&&this.style.setProperty("--dashboard-grid-cols",t);const e=this.getAttribute("gap");e&&this.style.setProperty("--dashboard-grid-gap",e)}});c("contour-analysis-stack",class extends T{static get observed(){return["title","heading"]}static get properties(){return{title:{attribute:"title"},heading:{attribute:"heading"}}}render(){this.classList.add("c-analysis-stack");const t=this.getAttribute("title");let e=this.querySelector(".c-analysis-stack__header");if(t){e||(e=document.createElement("div"),e.className="c-analysis-stack__header",this.prepend(e));let s=e.querySelector(".c-analysis-stack__title");s||(s=document.createElement(E(this,"h3")),s.className="c-analysis-stack__title",e.appendChild(s)),s.textContent=t}else e&&e.remove()}});const pe=new Set(["point","line","polygon","raster","heatmap","symbol"]);function ge(t,e,s){if(t._wiredMapItems)return;t._wiredMapItems=!0;const r=()=>Array.from(t.querySelectorAll(e)),i=r=>{const i=t.querySelector(s);if(!i)return;const a=r&&r.target&&"function"==typeof r.target.closest?r.target.closest(e):null;if(!a||!t.contains(a))return void i.setAttribute("hidden","");const n=a.getAttribute("data-title")||a.getAttribute("title");n&&(i.textContent=n);const o=t.getBoundingClientRect(),c=a.getBoundingClientRect();i.style.setProperty("--chart-tip-inline-start",c.left-o.left+c.width/2+"px"),i.style.setProperty("--chart-tip-block-start",c.top-o.top+"px"),i.removeAttribute("hidden")},a=()=>{const e=t.querySelector(s);e&&e.setAttribute("hidden","")};t.addEventListener("mouseover",i),t.addEventListener("mouseout",e=>{e.relatedTarget&&t.contains(e.relatedTarget)||a()}),t.addEventListener("focusin",s=>{const r=s&&s.target&&"function"==typeof s.target.closest?s.target.closest(e):null;r&&t.contains(r)&&i({target:r})}),t.addEventListener("focusout",e=>{t.contains(e.relatedTarget)||a()}),t.addEventListener("click",s=>{const i=s&&s.target&&"function"==typeof s.target.closest?s.target.closest(e):null;if(!i||!t.contains(i))return;const a=r().indexOf(i);a<0||t.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:a,label:i.getAttribute("data-title")||i.getAttribute("title")||i.textContent.trim()}}))}),t.addEventListener("keydown",s=>{const i=s&&s.target&&"function"==typeof s.target.closest?s.target.closest(e):null;if(i&&t.contains(i))if("Enter"===s.key||" "===s.key){s.preventDefault();const e=r().indexOf(i);e>=0&&t.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:e,label:i.getAttribute("data-title")||i.getAttribute("title")||i.textContent.trim()}}))}else{const e=r();z(s,e,{wrap:!1,homeEnd:!0,rtl:I(t),onNavigate:t=>e.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1"))})}})}c("contour-minimap",class extends T{static get observed(){return["label","viewport","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},viewport:{attribute:"viewport"},src:{attribute:"src"}}}render(){if(this.classList.add("c-minimap"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Minimap"),Zt(this),$t(this,["label","viewport"]),Xt(this,"minimap"))return;const t=Jt(this,"label")||this._remoteData&&this._remoteData.label,e=Jt(this,"viewport")||this._remoteData&&(this._remoteData.viewport||this._remoteData.value);if(t||e){if(t){this.ensure(".c-minimap__label",()=>{const t=document.createElement("span");return t.className="c-minimap__label",t}).textContent=t}else{const t=this.querySelector(".c-minimap__label");t&&t.remove()}if(e){this.ensure(".c-minimap__viewport",()=>{const t=document.createElement("div");return t.className="c-minimap__viewport",t}).textContent=e}else{const t=this.querySelector(".c-minimap__viewport");t&&t.remove()}}else Yt(this,"minimap")}enhance(){if(this._wiredMinimap)return;this._wiredMinimap=!0,this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");let t=!1,e=0,s=0;this.addEventListener("pointerdown",r=>{const i=this.querySelector(".c-minimap__viewport");if(i&&i.contains(r.target)){t=!0,e=r.clientX,s=r.clientY;try{i.setPointerCapture(r.pointerId)}catch(t){}}}),this.addEventListener("pointermove",r=>{if(!t)return;const i=r.clientX-e,a=r.clientY-s;this.dispatchEvent(new CustomEvent("contour:move",{detail:{direction:"drag",dx:i,dy:a},bubbles:!0,composed:!0}))}),this.addEventListener("pointerup",()=>{t=!1}),this.addEventListener("keydown",t=>{let e=null;"ArrowUp"===t.key?e="up":"ArrowDown"===t.key?e="down":"ArrowLeft"===t.key?e="left":"ArrowRight"===t.key?e="right":"Home"===t.key?e="home":"End"===t.key&&(e="end"),e&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:move",{detail:{direction:e},bubbles:!0,composed:!0})))})}});c("contour-coordinate",class extends T{static get observed(){return["value","format","locale","precision","live","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{value:{attribute:"value"},format:{attribute:"format"},locale:{attribute:"locale"},precision:{attribute:"precision"},live:{attribute:"live"},src:{attribute:"src"}}}render(){if(this.classList.add("c-coordinate"),Zt(this),$t(this,"value"),Xt(this,"coordinate"))return;const t=Jt(this,"value")||this._remoteData&&(this._remoteData.value||this._remoteData.coordinate);if(!t)return void Yt(this,"coordinate");const e=this.getAttribute("format")||"decimal";let s=String(t);if("dms"===e){const e=String(t).split(/[,\s]+/).map(Number);if(e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])){const t=parseInt(this.getAttribute("precision")||"1",10),r=Number.isFinite(t)&&t>=0?t:1,i=(t,e)=>{const s=Math.floor(Math.abs(t)),i=Math.floor(60*(Math.abs(t)-s)),a="lat"===e?t<0?"S":"N":t<0?"W":"E";return s+"°"+i+"'"+(60*(60*(Math.abs(t)-s)-i)).toFixed(r)+'"'+a};s=i(e[0],"lat")+" "+i(e[1],"lon")}}else if("web-mercator"===e){const e=String(t).split(/[,\s]+/).map(Number);if(e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])){const t=20037508.34*e[1]/180,r=Math.log(Math.tan((90+e[0])*Math.PI/360))/(Math.PI/180)*20037508.34/180;s=t.toFixed(2)+", "+r.toFixed(2)}}else if("decimal"===e){const e=String(t).split(/[,\s]+/).map(Number),r=parseInt(this.getAttribute("precision")||"",10);s=e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])&&Number.isFinite(r)&&r>=0?e[0].toFixed(r)+", "+e[1].toFixed(r):B(t,this.getAttribute("format"),this.getAttribute("locale"))}else s=B(t,this.getAttribute("format"),this.getAttribute("locale"));const r=this.ensure(".c-coordinate__value",()=>{const t=document.createElement("span");return t.className="c-coordinate__value",t});this.hasAttribute("live")?(r.setAttribute("role","status"),r.setAttribute("aria-live","polite")):(r.removeAttribute("role"),r.removeAttribute("aria-live")),r.textContent=s;let i=this.querySelector(".c-coordinate__copy");function a(t){try{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}catch(t){}}i||(i=document.createElement("button"),i.type="button",i.className="c-btn c-btn--sm c-btn--icon c-coordinate__copy",L(i,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-copy" /></svg>'),i.setAttribute("aria-label",k(this,"copy-coordinate","Copy coordinate")),i.setAttribute("data-contour-label","true"),this.appendChild(i)),i.onclick=()=>{try{navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(s).catch(()=>{a(s)}):a(s)}catch(t){a(s)}this.dispatchEvent(new CustomEvent("contour:copy",{detail:{text:s},bubbles:!0,composed:!0}))}}});c("contour-layer-panel",class extends T{static get observed(){return["label","items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","allow-rename","allow-remove","allow-duplicate","allow-zoom","allow-opacity","allow-reorder","allow-projection","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-layer-panel"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"layer-panel","Layer panel")),this._layerIdSeen=new Set,Zt(this),$t(this,"items"),Xt(this,"layer-panel"))return;const t=Jt(this,"items"),e=this.getAttribute("label");if(e){this.ensure(".c-layer-panel__label",()=>{const t=document.createElement("span");return t.className="c-layer-panel__label",t}).textContent=e}else{const t=this.querySelector(".c-layer-panel__label");t&&t.remove()}const s=Array.from(this.querySelectorAll(":scope > .c-layer-panel__item")),r=new Map,i=new Map;this.querySelectorAll(".c-layer-panel__item").forEach(t=>{const e=t.querySelector(".c-layer-panel__name"),s=t.querySelector(".c-layer-panel__toggle");if(e&&s){const t=s.hasAttribute("aria-pressed")?"true"===s.getAttribute("aria-pressed"):!!s.checked;r.set(e.textContent,t)}const a=t.querySelector(".c-layer-panel__opacity");e&&a&&i.set(e.textContent,a.value)});let a=null;if(s.length)a=s.map(t=>{const e=t.querySelector(".c-layer-panel__name"),s=t.querySelector(".c-layer-panel__toggle"),r=!s||(s.hasAttribute("aria-pressed")?"true"===s.getAttribute("aria-pressed"):!!s.checked),i=t.querySelector(".c-layer-panel__caption");return{name:e?e.textContent:"",visible:r,caption:i?i.textContent:t.dataset.caption||void 0}}),s.forEach(t=>t.remove());else if(t)try{a=JSON.parse(t),Array.from(this.querySelectorAll(".c-layer-panel__item")).forEach(t=>t.remove())}catch(t){f(this,"attribute",t)}a&&a.forEach(t=>{const e="string"==typeof t?t:t.name||t.label||"",s="object"==typeof t&&t&&(t.caption||t.subtitle)||"";null==this._layerIdByName&&(this._layerIdByName=new Map);const a="object"==typeof t&&t&&t.id?String(t.id):"";let n;if(a)n=a;else if(this._layerIdByName.has(e))n=this._layerIdByName.get(e);else{n=(e?e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""):"")||"layer",this._layerIdByName.set(e,n)}if(null==this._layerIdSeen&&(this._layerIdSeen=new Set),this._layerIdSeen.has(n)){let t=2;for(;this._layerIdSeen.has(n+"-"+t);)t++;n=n+"-"+t}this._layerIdSeen.add(n);const o=document.createElement("div");if(o.className="c-layer-panel__item"+(t.dragging?" c-layer-panel__item--dragging":""),o.dataset.layerId=n,"false"!==this.getAttribute("allow-reorder")){const t=document.createElement("button");t.type="button",t.className="c-drag-handle--dots",t.setAttribute("aria-label",k(this,"reorder","Reorder")+" "+(e||k(this,"layer","layer"))),t.setAttribute("tabindex","0"),o.appendChild(t)}const c=document.createElement("button");c.type="button",c.className="c-layer-panel__toggle",c.setAttribute("part","visibility-toggle"),c.setAttribute("aria-label",k(this,"toggle","Toggle")+" "+(e||k(this,"layer","layer")));const l=r.has(e)?r.get(e):"object"==typeof t&&!1!==t.visible;c.setAttribute("aria-pressed",String(!!l)),c.checked=!!l,L(c,l?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-check" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-minus" /></svg>'),o.appendChild(c);const u=document.createElement("span");if(u.className="c-layer-panel__name",u.textContent=e,o.appendChild(u),s){const t=document.createElement("span");t.className="c-layer-panel__caption",t.textContent=s,o.appendChild(t)}if("false"!==this.getAttribute("allow-opacity")){const s=document.createElement("input");s.type="range",s.className="c-layer-panel__opacity",s.min="0",s.max="100",s.setAttribute("aria-label",k(this,"opacity-of","Opacity of")+" "+(e||"layer")),s.value=i.has(e)?i.get(e):"object"==typeof t&&null!=t.opacity?t.opacity:"100",o.appendChild(s)}if("false"!==this.getAttribute("allow-rename")){const t=document.createElement("button");t.type="button",t.className="c-btn c-btn--icon c-btn--ghost c-btn--sm c-layer-panel__rename",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-pen" /></svg>'),t.setAttribute("aria-label",k(this,"rename","Rename")+" "+(e||"layer")),o.appendChild(t)}if("false"!==this.getAttribute("allow-duplicate")){const t=document.createElement("button");t.type="button",t.className="c-btn c-btn--icon c-btn--ghost c-btn--sm c-layer-panel__duplicate",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-copy" /></svg>'),t.setAttribute("aria-label",k(this,"duplicate","Duplicate")+" "+(e||"layer")),o.appendChild(t)}if("false"!==this.getAttribute("allow-zoom")){const t=document.createElement("button");t.type="button",t.className="c-layer-panel__zoom",t.textContent=k(this,"zoom","Zoom"),t.setAttribute("aria-label",k(this,"zoom-to","Zoom to")+" "+(e||"layer")),o.appendChild(t)}if("false"!==this.getAttribute("allow-remove")){const t=document.createElement("button");t.type="button",t.className="c-layer-panel__remove",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-minus" /></svg>'),t.setAttribute("aria-label",k(this,"remove","Remove")+" "+(e||"layer")),o.appendChild(t)}if(this.hasAttribute("allow-projection")&&"false"!==this.getAttribute("allow-projection")){const t=document.createElement("select");t.className="c-select c-layer-panel__projection",t.setAttribute("aria-label",k(this,"projection-of","Projection of")+" "+(e||k(this,"layer","layer"))),["EPSG:4326","EPSG:3857"].forEach(e=>{const s=document.createElement("option");s.value=e,s.textContent=e,t.appendChild(s)}),o.appendChild(t)}this.appendChild(o)}),a||s.length||t||(Array.from(this.querySelectorAll(".c-layer-panel__item")).forEach(t=>t.remove()),Yt(this,"layer-panel"))}enhance(){if(this._wiredLayerPanel)return;this._wiredLayerPanel=!0;const t=t=>t&&t.dataset&&t.dataset.layerId||"";this.addEventListener("change",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-layer-panel__item"):null;if(!s||!this.contains(s))return;const r=s.querySelector(".c-layer-panel__name")?.textContent||"",i=t(s);if(e.target.classList.contains("c-layer-panel__toggle")){const t="boolean"==typeof e.target.checked?e.target.checked:"true"!==e.target.getAttribute("aria-pressed");e.target.checked=t,e.target.setAttribute("aria-pressed",String(t)),L(e.target,t?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-check" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-minus" /></svg>'),this.dispatchEvent(new CustomEvent("contour:layer-visibility",{bubbles:!0,composed:!0,detail:{layerId:i,name:r,visible:t}}))}else e.target.classList.contains("c-layer-panel__opacity")?this.dispatchEvent(new CustomEvent("contour:layer-opacity",{bubbles:!0,composed:!0,detail:{layerId:i,name:r,opacity:Number(e.target.value)}})):e.target.classList.contains("c-layer-panel__projection")&&this.dispatchEvent(new CustomEvent("contour:layer-projection",{bubbles:!0,composed:!0,detail:{layerId:i,name:r,projection:e.target.value}}))}),this.addEventListener("input",e=>{const s=e.target;if(!s||!s.classList||!s.classList.contains("c-layer-panel__opacity"))return;const r=s.closest(".c-layer-panel__item");if(!r||!this.contains(r))return;const i=r.querySelector(".c-layer-panel__name")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:layer-opacity",{bubbles:!0,composed:!0,detail:{layerId:t(r),name:i,opacity:Number(s.value)}}))}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest("button"):null;if(!s||!this.contains(s))return;const r=s.closest(".c-layer-panel__item");if(s.classList.contains("c-layer-panel__toggle")){if(!r)return;const e=r.querySelector(".c-layer-panel__name")?.textContent||"",i=t(r),a="true"!==s.getAttribute("aria-pressed");return s.setAttribute("aria-pressed",String(a)),s.checked=a,L(s,a?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-check" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-minus" /></svg>'),void this.dispatchEvent(new CustomEvent("contour:layer-visibility",{bubbles:!0,composed:!0,detail:{layerId:i,name:e,visible:a}}))}if(!r)return;const i=r.querySelector(".c-layer-panel__name")?.textContent||"",a=t(r);if(s.classList.contains("c-layer-panel__rename")){const t=r.querySelector(".c-layer-panel__name");if(t){const e=document.createElement("input");e.type="text",e.className="c-input c-layer-panel__rename-input",e.value=i,e.setAttribute("aria-label",k(this,"rename-layer","Rename layer")),t.replaceWith(e),e.focus(),e.select();let s=!1;const r=()=>{if(s)return;if(!e.isConnected)return;s=!0;const t=(e.value||"").trim(),r=document.createElement("span");r.className="c-layer-panel__name",r.textContent=t||i,e.replaceWith(r),t&&t!==i&&(null==this._layerIdByName&&(this._layerIdByName=new Map),this._layerIdByName.set(t,a),this.dispatchEvent(new CustomEvent("contour:layer-rename",{bubbles:!0,composed:!0,detail:{layerId:a,name:i,newName:t}})))};e.addEventListener("keydown",t=>{"Enter"===t.key?(t.preventDefault(),r()):"Escape"===t.key&&(t.preventDefault(),e.value=i,r())}),e.addEventListener("blur",r,{once:!0})}}else s.classList.contains("c-layer-panel__duplicate")?this.dispatchEvent(new CustomEvent("contour:layer-duplicate",{bubbles:!0,composed:!0,detail:{layerId:a,name:i}})):s.classList.contains("c-layer-panel__zoom")?this.dispatchEvent(new CustomEvent("contour:layer-zoom",{bubbles:!0,composed:!0,detail:{layerId:a,name:i}})):s.classList.contains("c-layer-panel__remove")&&this.dispatchEvent(new CustomEvent("contour:layer-remove",{bubbles:!0,composed:!0,detail:{layerId:a,name:i}}))}),this.addEventListener("keydown",t=>{if(t.target&&t.target.classList&&t.target.classList.contains("c-layer-panel__toggle")&&("Enter"===t.key||" "===t.key))return t.preventDefault(),void t.target.click();const e=t.target&&t.target.closest?t.target.closest(".c-layer-panel__item"):null;if(!e||!this.contains(e))return;const s=t.target&&t.target.classList&&t.target.classList.contains("c-drag-handle--dots");if(s&&("ArrowUp"===t.key||"ArrowDown"===t.key)||t.altKey&&("ArrowUp"===t.key||"ArrowDown"===t.key)){t.preventDefault();const r=Array.from(this.querySelectorAll(".c-layer-panel__item")),i=r.indexOf(e);if(i<0)return;const a="ArrowUp"===t.key?-1:1,n=i+a;if(n<0||n>=r.length)return;e.classList.add("c-layer-panel__item--dragging"),a<0?this.insertBefore(e,r[n]):this.insertBefore(r[n],e),(s?t.target:e).focus(),setTimeout(()=>e.classList.remove("c-layer-panel__item--dragging"),200);const o=Array.from(this.querySelectorAll(".c-layer-panel__item")).map((t,e)=>t.dataset.layerId||t.getAttribute("data-layer-id")||String(e));this.dispatchEvent(new CustomEvent("contour:layer-reorder",{bubbles:!0,composed:!0,detail:{layerIds:o}}))}})}});c("contour-time-slider",class extends T{static get observed(){return["label","value","min","max","loop","speed","speeds","show-loop","loop-label","current-time","time-format","is-playing","play-label","pause-label","time-label","speed-label"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},min:{attribute:"min"},max:{attribute:"max"},distance:{attribute:"distance"},resolution:{attribute:"resolution"},latitude:{attribute:"latitude"},src:{attribute:"src"},loop:{attribute:"loop",type:Boolean},speed:{attribute:"speed"},speeds:{attribute:"speeds"},showLoop:{attribute:"show-loop",type:Boolean},loopLabel:{attribute:"loop-label"},currentTime:{attribute:"current-time"},timeFormat:{attribute:"time-format"},isPlaying:{attribute:"is-playing",type:Boolean},playLabel:{attribute:"play-label"},pauseLabel:{attribute:"pause-label"},timeLabel:{attribute:"time-label"},speedLabel:{attribute:"speed-label"}}}render(){this.classList.add("c-time-slider"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Time slider");const t=this.ensure(".c-time-slider__play",()=>{const t=document.createElement("button");t.className="c-time-slider__play",t.type="button",t.setAttribute("aria-label",this.getAttribute("play-label")||"Play"),t.setAttribute("data-state","play");const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true");const s=document.createElementNS("http://www.w3.org/2000/svg","use");return s.setAttribute("href","#i-play"),e.appendChild(s),t.appendChild(e),t}),e=this.ensure(".c-time-slider__track",()=>{const t=document.createElement("input");return t.className="c-time-slider__track",t.type="range",t.min="0",t.max="100",t.setAttribute("part","input"),t.setAttribute("aria-label",this.getAttribute("time-label")||"Time"),t});e.min=this.getAttribute("min")||"0",e.max=this.getAttribute("max")||"100";const s=this.getAttribute("value")||"0";this._timeSliderAttrLast!==s&&(e.value=s,this._timeSliderAttrLast=s),e.setAttribute("aria-label",this.getAttribute("label")||this.getAttribute("time-label")||"Time");const r=this.ensure(".c-time-slider__time",()=>{const t=document.createElement("span");return t.className="c-time-slider__time",t}),i=this.getAttribute("current-time"),a=this.getAttribute("time-format");i?(r.textContent=i,e.setAttribute("aria-valuetext",i)):a?(r.textContent=B(String(e.value),a),e.removeAttribute("aria-valuetext")):(r.textContent=String(e.value),e.removeAttribute("aria-valuetext"));const n=this.ensure("datalist",()=>document.createElement("datalist"));n.id||(n.id=o("time-slider-ticks")),L(n,"");const c=Number(e.min)||0,l=Number(e.max)||100;for(let t=0;t<5;t++){const e=document.createElement("option");e.value=String(Math.round(c+t/4*(l-c))),n.appendChild(e)}e.setAttribute("list",n.id),n.parentNode!==this&&this.appendChild(n);let u=null;const d=this.getAttribute("speeds");if(d)try{u=JSON.parse(d)}catch(t){u=null}const h=this.ensure(".c-time-slider__speed",()=>{const t=document.createElement("select");return t.className="c-select c-time-slider__speed",t.setAttribute("aria-label",this.getAttribute("speed-label")||"Speed"),t});L(h,"");(Array.isArray(u)?u:[.5,1,2,5,10]).forEach(t=>{const e=document.createElement("option");e.value=String(t),e.textContent=String(t),String(t)===(this.getAttribute("speed")||"")&&(e.selected=!0),h.appendChild(e)});const m=this.getAttribute("speed");m&&(h.value=m);if(this.hasAttribute("show-loop")){const t=this.ensure(".c-time-slider__loop",()=>{const t=document.createElement("button");return t.className="c-time-slider__loop",t.type="button",t.setAttribute("aria-label",this.getAttribute("loop-label")||"Loop"),t});t.setAttribute("aria-pressed",this.hasAttribute("loop")?"true":"false"),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-refresh" /></svg>')}else{const t=this.querySelector(".c-time-slider__loop");t&&t.remove()}const b=this.hasAttribute("is-playing");t.setAttribute("data-state",b?"pause":"play"),t.setAttribute("aria-label",b?this.getAttribute("pause-label")||"Pause":this.getAttribute("play-label")||"Play");const p=t.querySelector("use");p&&p.setAttribute("href",b?"#i-pause":"#i-play")}enhance(){if(this._timeSliderReconcile&&this._timeSliderReconcile(),this._wiredTimeSlider)return;let t;this._wiredTimeSlider=!0;const e=()=>{void 0!==t&&(clearInterval(t),t=void 0)},s=()=>{const t=this.querySelector(".c-time-slider__track");if(!t)return;const e=this.querySelector(".c-time-slider__time"),s=this.getAttribute("current-time"),r=this.getAttribute("time-format");e&&(e.textContent=s||(r?B(String(t.value),r):String(t.value))),s?t.setAttribute("aria-valuetext",s):t.removeAttribute("aria-valuetext")},r=()=>{const t=this.querySelector(".c-time-slider__track");if(!t)return void e();const r=Number(t.max)||100,i=Number(t.min)||0,a=this.hasAttribute("loop");let n=(Number(t.value)||0)+1;n>r&&(n=a?i:r),t.value=String(n);const o=this.querySelector(".c-time-slider__speed");this._timeSliderScrubbing||o&&document.activeElement===o||this.setAttribute("value",String(n)),s(),this.dispatchEvent(new CustomEvent("contour:time-change",{detail:{value:String(n)},bubbles:!0,composed:!0})),!a&&n>=r&&(e(),this.removeAttribute("is-playing"),this.dispatchEvent(new CustomEvent("contour:pause",{bubbles:!0,composed:!0})))},a=()=>{e();const s=parseFloat(this.getAttribute("speed")||"1")||1;t=setInterval(r,Math.max(100,1e3/s))};this._timeSliderReconcile=()=>{const s=this.hasAttribute("is-playing");s&&void 0===t?(a(),this.dispatchEvent(new CustomEvent("contour:play",{bubbles:!0,composed:!0}))):s||void 0===t||(e(),this.dispatchEvent(new CustomEvent("contour:pause",{bubbles:!0,composed:!0})))},this.addEventListener("click",t=>{if(t.target&&t.target.closest?t.target.closest(".c-time-slider__play"):null)return void this.toggleAttribute("is-playing",!this.hasAttribute("is-playing"));const e=t.target&&t.target.closest?t.target.closest(".c-time-slider__loop"):null;if(e){const t="true"!==e.getAttribute("aria-pressed");e.setAttribute("aria-pressed",String(t)),this.toggleAttribute("loop",t),this.dispatchEvent(new CustomEvent("contour:loop-change",{detail:{loop:t},bubbles:!0,composed:!0}))}}),this.addEventListener("pointerdown",t=>{t.target&&t.target.closest&&t.target.closest(".c-time-slider__track")&&(this._timeSliderScrubbing=!0)},{passive:!0});const n=()=>{this._timeSliderScrubbing=!1};this.addEventListener("pointerup",n,{passive:!0}),this.addEventListener("pointercancel",n,{passive:!0}),this.addEventListener("input",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-time-slider__track"):null;e&&(this._timeSliderScrubbing||this.setAttribute("value",e.value),s(),this.dispatchEvent(new CustomEvent("contour:time-change",{detail:{value:e.value},bubbles:!0,composed:!0})))}),this.addEventListener("change",e=>{const r=e.target&&e.target.closest?e.target.closest(".c-time-slider__speed"):null;if(r){const e=Number(r.value);return this.setAttribute("speed",String(e)),void 0!==t&&a(),void this.dispatchEvent(new CustomEvent("contour:speed-change",{detail:{speed:e},bubbles:!0,composed:!0}))}const i=e.target&&e.target.closest?e.target.closest(".c-time-slider__track"):null;i&&(this.setAttribute("value",i.value),s())}),i(this,e),this._timeSliderReconcile()}disconnectedCallback(){super.disconnectedCallback(),this._wiredTimeSlider=!1,this._timeSliderReconcile=null}});c("contour-hexbin",class extends T{static get observed(){return["label","cells","width","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},cells:{attribute:"cells"},width:{attribute:"width"},src:{attribute:"src"}}}render(){this.classList.add("c-hexbin"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Hexbin");const t=this.getAttribute("label")||this._remoteData&&this._remoteData.label;if(t){this.ensure(".c-hexbin__label",()=>{const t=document.createElement("span");return t.className="c-hexbin__label",t}).textContent=t}else{const t=this.querySelector(".c-hexbin__label");t&&t.remove()}if(Zt(this),$t(this,"cells"),Xt(this,"hexbin"))return;const e=Jt(this,"cells")||(this._remoteData&&this._remoteData.cells?JSON.stringify(this._remoteData.cells):null),s=Array.from(this.querySelectorAll(":scope > .c-hexbin__cell"));this.ensure(".c-hexbin__tooltip",()=>{const t=document.createElement("div");return t.className="c-hexbin__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t}).setAttribute("hidden","");const r=this.getAttribute("width");if(r?this.style.inlineSize=r:this.style.removeProperty("inline-size"),s.length){const t=Math.ceil(Math.sqrt(s.length||1));this.style.gridTemplateColumns="repeat("+t+", minmax(0, 1fr))",s.forEach((t,e)=>t.setAttribute("tabindex",0===e?"0":"-1"))}else{let t=null;if(e)try{t=JSON.parse(e)}catch(e){t=null}if(Array.isArray(t))try{Array.from(this.querySelectorAll(".c-hexbin__cell")).forEach(t=>t.remove());const e=Math.ceil(Math.sqrt(t.length||1));this.style.gridTemplateColumns="repeat("+e+", minmax(0, 1fr))";const s=t.map(t=>Number("object"==typeof t&&null!==t?t.value:t)).filter(t=>Number.isFinite(t)),r=s.length?Math.min(...s):0,i=s.length?Math.max(...s):0,a=i-r;if(t.forEach((t,e)=>{const s=document.createElement("div");s.className="c-hexbin__cell",s.setAttribute("tabindex",0===e?"0":"-1");const i="object"==typeof t&&null!==t&&null!=t.value?t.value:t;null!=i&&""!==i&&(s.textContent=i,s.setAttribute("data-title",String(i)));const n=Number(i);if(Number.isFinite(n)){const t=a>0?(n-r)/a:1,e=Math.round(20+60*t);s.style.background="color-mix(in oklab, var(--color-primary) "+e+"%, var(--color-surface-2))"}this.appendChild(s)}),a>0&&s.length){const t=this.ensure(".c-hexbin__legend",()=>{const t=document.createElement("div");return t.className="c-hexbin__legend",t});t.textContent="";const e=document.createElement("div");e.className="c-hexbin__legend-swatch",e.style.background="color-mix(in oklab, var(--color-primary) 20%, var(--color-surface-2))",e.setAttribute("title",String(r));const s=document.createElement("div");s.className="c-hexbin__legend-swatch",s.style.background="color-mix(in oklab, var(--color-primary) 80%, var(--color-surface-2))",s.setAttribute("title",String(i));const a=document.createElement("span");a.className="c-hexbin__legend-label",a.textContent=String(r);const n=document.createElement("span");n.className="c-hexbin__legend-label",n.textContent=String(i),t.appendChild(e),t.appendChild(a),t.appendChild(s),t.appendChild(n)}}catch(t){f(this,"attribute",t)}else Array.from(this.querySelectorAll(".c-hexbin__cell")).forEach(t=>t.remove()),Yt(this,"hexbin")}}enhance(){this._wiredHexbin||(this._wiredHexbin=!0,ge(this,".c-hexbin__cell",".c-hexbin__tooltip"))}});c("contour-flow-map",class extends T{static get observed(){return["label","nodes","flows","edges","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},nodes:{attribute:"nodes"},flows:{attribute:"flows"},edges:{attribute:"edges"},src:{attribute:"src"}}}render(){this.classList.add("c-flow-map"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Flow map");const t=this.getAttribute("label")||this._remoteData&&this._remoteData.label;if(t){this.ensure(".c-flow-map__label",()=>{const t=document.createElement("span");return t.className="c-flow-map__label",t}).textContent=t}else{const t=this.querySelector(".c-flow-map__label");t&&t.remove()}if(Zt(this),$t(this,"nodes"),Xt(this,"flow-map"))return;const e=Jt(this,"nodes")||(this._remoteData&&this._remoteData.nodes?JSON.stringify(this._remoteData.nodes):null),s=Array.from(this.querySelectorAll(":scope > .c-flow-map__node"));let r=null;if(s.length)r=s.map(t=>t.textContent||t.getAttribute("data-title")||t.getAttribute("title")||""),s.forEach(t=>t.remove());else if(e)try{r=JSON.parse(e)}catch(t){r=null}if(r)try{Array.from(this.querySelectorAll(".c-flow-map__node")).forEach(t=>t.remove()),r.forEach((t,e)=>{const s=document.createElement("span");s.className="c-flow-map__node"+(t.source?" c-flow-map__node--source":"")+(t.target?" c-flow-map__node--target":""),s.setAttribute("tabindex",0===e?"0":"-1"),s.textContent="string"==typeof t?t:t.label||t.name||"","object"==typeof t&&(t.label||t.name)&&s.setAttribute("data-title",t.label||t.name),this.appendChild(s)});this.ensure(".c-flow-map__tooltip",()=>{const t=document.createElement("div");return t.className="c-flow-map__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t}).setAttribute("hidden","")}catch(t){f(this,"attribute",t)}else r||(Array.from(this.querySelectorAll(".c-flow-map__node")).forEach(t=>t.remove()),Yt(this,"flow-map"));const i=null!=this.flows&&""!==this.flows?this.flows:null!=this.edges&&""!==this.edges?this.edges:this._remoteData&&null!=this._remoteData.flows?JSON.stringify(this._remoteData.flows):null;let a=null;if(null!=i)try{const t=JSON.parse(i);Array.isArray(t)?a=t:f(this,"flows",new Error("expected an array"))}catch(t){f(this,"flows",t)}const n=this.querySelector(".c-flow-map__summary");if(a){const t=this.ensure(".c-flow-map__summary",()=>{const t=document.createElement("div");return t.className="c-flow-map__summary c-table-wrap",t});let e=t.querySelector("table");e||(e=document.createElement("table"),e.className="c-table c-flow-map__table",t.appendChild(e)),L(e,"");const s=document.createElement("caption");s.textContent=k(this,"flow-summary","Flow summary"),e.appendChild(s);const r=document.createElement("thead"),i=document.createElement("tr");[["source","Source"],["target","Target"],["magnitude","Magnitude"]].forEach(([t,e])=>{const s=document.createElement("th");s.setAttribute("scope","col"),s.textContent=k(this,t,e),i.appendChild(s)}),r.appendChild(i),e.appendChild(r);const n=document.createElement("tbody"),o=t=>"string"==typeof t?t:t&&"object"==typeof t?String(t.label||t.name||t.id||""):"";a.forEach(t=>{const e=t&&"object"==typeof t?t:{},s=document.createElement("tr"),r=document.createElement("th");r.setAttribute("scope","row"),r.textContent=o(e.source),s.appendChild(r);const i=document.createElement("td");i.textContent=o(e.target),s.appendChild(i);const a=document.createElement("td"),c=null!=e.value?e.value:e.magnitude,l=Number(c);a.textContent=null==c||""===c?"":Number.isFinite(l)?(l>0?"+":"")+l:String(c),s.appendChild(a),n.appendChild(s)}),e.appendChild(n)}else n&&n.remove()}enhance(){this._wiredFlowMap||(this._wiredFlowMap=!0,ge(this,".c-flow-map__node",".c-flow-map__tooltip"))}});c("contour-isochrone",class extends T{static get observed(){return["label","center","rings","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},center:{attribute:"center"},rings:{attribute:"rings"},src:{attribute:"src"}}}render(){this.classList.add("c-isochrone"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Isochrone");const t=this.getAttribute("label")||this._remoteData&&this._remoteData.label;if(t){this.ensure(".c-isochrone__label",()=>{const t=document.createElement("span");return t.className="c-isochrone__label",t}).textContent=t}else{const t=this.querySelector(".c-isochrone__label");t&&t.remove()}const e=this.getAttribute("center")||this._remoteData&&this._remoteData.center;if(e){this.ensure(".c-isochrone__center",()=>{const t=document.createElement("span");return t.className="c-isochrone__center",t}).textContent=e}else{const t=this.querySelector(".c-isochrone__center");t&&t.remove()}if(Zt(this),$t(this,"rings"),Xt(this,"isochrone"))return;const s=Jt(this,"rings")||(this._remoteData&&this._remoteData.rings?JSON.stringify(this._remoteData.rings):null),r=Array.from(this.querySelectorAll(":scope > .c-isochrone__ring"));let i=null;if(r.length)i=r.map(t=>t.textContent||t.getAttribute("data-title")||t.getAttribute("title")||""),r.forEach(t=>t.remove());else if(s)try{i=JSON.parse(s)}catch(t){i=null}if(i)try{Array.from(this.querySelectorAll(".c-isochrone__ring")).forEach(t=>t.remove()),i.forEach((t,e)=>{const s=document.createElement("span"),r="string"==typeof t?t:t&&(t.label||t.name||t.value||t.min),i=null==r?"":String(r),a=i.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");s.className="c-isochrone__ring"+(a?" c-isochrone__ring--"+a:""),s.setAttribute("tabindex",0===e?"0":"-1"),s.setAttribute("aria-label",i||"Isochrone ring "+(e+1)),i&&s.setAttribute("data-title",i),this.appendChild(s)});this.ensure(".c-isochrone__tooltip",()=>{const t=document.createElement("div");return t.className="c-isochrone__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t}).setAttribute("hidden","")}catch(t){f(this,"attribute",t)}else i||(Array.from(this.querySelectorAll(".c-isochrone__ring")).forEach(t=>t.remove()),Yt(this,"isochrone"))}enhance(){this._wiredIsochrone||(this._wiredIsochrone=!0,ge(this,".c-isochrone__ring",".c-isochrone__tooltip"))}});c("contour-catchment",class extends T{static get observed(){return["label","area","center","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},area:{attribute:"area"},center:{attribute:"center"},src:{attribute:"src"}}}render(){this.classList.add("c-catchment"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Catchment");const t=this.getAttribute("label")||this._remoteData&&this._remoteData.label;if(t){this.ensure(".c-catchment__label",()=>{const t=document.createElement("span");return t.className="c-catchment__label",t}).textContent=t}else{const t=this.querySelector(".c-catchment__label");t&&t.remove()}const e=this.getAttribute("area")||this._remoteData&&this._remoteData.area;if(e){this.ensure(".c-catchment__area",()=>{const t=document.createElement("span");return t.className="c-catchment__area",t}).textContent=e}else{const t=this.querySelector(".c-catchment__area");t&&t.remove()}const s=this.getAttribute("center")||this._remoteData&&this._remoteData.center;if(s){this.ensure(".c-catchment__center",()=>{const t=document.createElement("span");return t.className="c-catchment__center",t}).textContent=s}else{const t=this.querySelector(".c-catchment__center");t&&t.remove()}if(Zt(this),$t(this,["label","area","center"]),Xt(this,"catchment"))return;const r=Jt(this,"label")||this._remoteData&&this._remoteData.label,i=Jt(this,"area")||this._remoteData&&this._remoteData.area,a=Jt(this,"center")||this._remoteData&&this._remoteData.center;if(!r&&!i&&!a)return void Yt(this,"catchment");const n=this.ensure(".c-catchment__tooltip",()=>{const t=document.createElement("div");return t.className="c-catchment__tooltip",t.setAttribute("role","tooltip"),t.setAttribute("hidden",""),t});n.setAttribute("hidden",""),i&&(n.textContent=i)}enhance(){if(this._wiredCatchment)return;this._wiredCatchment=!0;const t=()=>{const t=this.querySelector(".c-catchment__tooltip");t&&t.removeAttribute("hidden")},e=()=>{const t=this.querySelector(".c-catchment__tooltip");t&&t.setAttribute("hidden","")};this.addEventListener("mouseenter",t),this.addEventListener("mouseleave",e),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("focusin",t),this.addEventListener("focusout",e),this.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{area:this.getAttribute("area")}})))})}});c("contour-compass",class extends T{static get observed(){return["label","needle","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","empty","no-cache"]}static get properties(){return{label:{attribute:"label"},needle:{attribute:"needle"},src:{attribute:"src"}}}render(){this.classList.add("c-compass"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Compass");const t=this.getAttribute("label")||this._remoteData&&this._remoteData.label;if(Zt(this),$t(this,"needle"),Xt(this,"compass"))return;const e=Jt(this,"needle")||this._remoteData&&(this._remoteData.needle||this._remoteData.value);if(e||t){for(const t of["n","s","e","w"]){const e=".c-compass__label--"+t;let s=this.querySelector(e);s||(s=document.createElement("span"),s.className="c-compass__label "+e.slice(1),s.textContent=t.toUpperCase(),s.setAttribute("role","button"),s.setAttribute("tabindex","0"),this.appendChild(s))}if(t&&"compass"!==t.toLowerCase()){this.ensure(".c-compass__label:not([class*='--'])",()=>{const t=document.createElement("span");return t.className="c-compass__label",t}).textContent=t}if(e){const t=Number(e)||0,s=this.ensure("svg.c-compass__needle",()=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("class","c-compass__needle"),e.setAttribute("viewBox","0 0 40 40"),e.setAttribute("aria-hidden","true");const s=document.createElementNS("http://www.w3.org/2000/svg","path");s.setAttribute("class","c-compass__needle--n"),s.setAttribute("d",U(20,20,16,t)),e.appendChild(s);const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("class","c-compass__needle--s"),r.setAttribute("d",U(20,20,16,t+180)),e.appendChild(r),e}),r=s.querySelector(".c-compass__needle--n");r&&r.setAttribute("d",U(20,20,16,t));const i=s.querySelector(".c-compass__needle--s");i&&i.setAttribute("d",U(20,20,16,t+180))}else{const t=this.querySelector("svg.c-compass__needle, .c-compass__needle");t&&t.remove()}}else Yt(this,"compass")}enhance(){if(this._wiredCompass)return;this._wiredCompass=!0;const t={n:0,e:90,s:180,w:270},e=e=>{const s=t[e];if(void 0===s)return;const r=this.querySelector(".c-compass__needle");if(r){const t=r.querySelector(".c-compass__needle--n");t&&t.setAttribute("d",U(20,20,16,s));const e=r.querySelector(".c-compass__needle--s");e&&e.setAttribute("d",U(20,20,16,s+180))}this.dispatchEvent(new CustomEvent("contour:bearing",{bubbles:!0,composed:!0,detail:{direction:e,degrees:s}}))};this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-compass__label--n, .c-compass__label--e, .c-compass__label--s, .c-compass__label--w"):null;if(!s||!this.contains(s))return;const r=s.className.match(/c-compass__label--([nsew])/);r&&e(r[1])}),this.addEventListener("keydown",t=>{if("Enter"!==t.key&&" "!==t.key)return;const s=t.target&&t.target.closest?t.target.closest(".c-compass__label--n, .c-compass__label--e, .c-compass__label--s, .c-compass__label--w"):null;if(!s||!this.contains(s))return;t.preventDefault();const r=s.className.match(/c-compass__label--([nsew])/);r&&e(r[1])})}});c("contour-layer-switch",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-layer-switch"),this.hasAttribute("role")||this.setAttribute("role","list"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"layer-switch","Layer switch")),Zt(this),$t(this,"items"),Xt(this,"layer-switch"))return;const t=Jt(this,"items"),e=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-layer-switch__item"));if(t&&!e.length){Array.from(this.querySelectorAll(".c-layer-switch__item")).forEach(t=>t.remove());try{const e=JSON.parse(t);(Array.isArray(e)?e.slice(0,50):e).forEach(t=>{const e=document.createElement("div");e.className="c-layer-switch__item",e.setAttribute("role","listitem");const s="string"==typeof t?t:t.name||t.label||"",r="object"==typeof t&&t&&t.id?String(t.id):s?s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""):"";this._layerSwitchSeq=(this._layerSwitchSeq||0)+1,e.dataset.layerId=r||"layer-"+this._layerSwitchSeq;const i=document.createElement("span");i.className="c-layer-switch__swatch";const a="object"==typeof t&&t&&t.shape?String(t.shape):"";if(pe.has(a)&&i.classList.add("c-swatch--"+a),t.color){const e=_(t.color);e&&(pe.has(a)?i.style.color=e:i.style.background=e)}i.setAttribute("aria-hidden","true"),e.appendChild(i);const n=document.createElement("span");if(n.className="c-layer-switch__name",n.textContent="string"==typeof t?t:t.name||t.label||"",e.appendChild(n),null!=t.count){const s=document.createElement("span");s.className="c-layer-switch__count",s.textContent=t.count,e.appendChild(s)}const o=document.createElement("button");o.className="c-layer-switch__toggle",o.type="button",o.setAttribute("aria-label",k(this,"toggle","Toggle")+" "+("string"==typeof t?t:t.name||t.label||k(this,"layer","layer")));const c="object"!=typeof t||!1!==t.visible;o.setAttribute("aria-pressed",String(c)),L(o,c?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-check" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-minus" /></svg>'),e.appendChild(o),this.appendChild(e)})}catch(t){f(this,"attribute",t)}}else t||e.length||(Array.from(this.querySelectorAll(".c-layer-switch__item")).forEach(t=>t.remove()),Yt(this,"layer-switch"))}enhance(){this._wiredLayerSwitch||(this._wiredLayerSwitch=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-layer-switch__toggle"):null;if(!e||!this.contains(e))return;const s=e.closest(".c-layer-switch__item"),r=s&&s.querySelector(".c-layer-switch__name")?.textContent||"",i=s&&s.dataset&&s.dataset.layerId||"",a="true"!==e.getAttribute("aria-pressed");e.setAttribute("aria-pressed",String(a)),this.dispatchEvent(new CustomEvent("contour:layer-toggle",{bubbles:!0,composed:!0,detail:{layerId:i,name:r,visible:a}}))}),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-layer-switch__toggle"):null;e&&this.contains(e)&&("Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click()))}))}});c("contour-basemap-switcher",class extends T{static get observed(){return["items","value","label"]}static get properties(){return{items:{attribute:"items"},value:{attribute:"value"},label:{attribute:"label"}}}render(){this.classList.add("c-basemap-switcher"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||k(this,"basemap","Basemap"));let t=[];try{const e=JSON.parse(this.getAttribute("items")||"[]");Array.isArray(e)&&(t=e)}catch(t){}const e=this.getAttribute("value");Array.from(this.querySelectorAll(".c-basemap-switcher__item")).forEach(t=>t.remove()),t.forEach(t=>{const s="string"==typeof t?t:t.label||t.value||t,r="string"==typeof t?t:t.value||t.label||t,i=document.createElement("button");i.type="button",i.className="c-basemap-switcher__item c-btn c-btn--sm"+(e===r?" is-active":""),i.textContent=s,i.dataset.value=r,e===r&&i.setAttribute("aria-pressed","true"),this.appendChild(i)})}enhance(){this._wiredBasemap||(this._wiredBasemap=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-basemap-switcher__item"):null;if(!e||!this.contains(e))return;const s=e.dataset.value,r=(e.textContent||"").trim();this.setAttribute("value",s),this.dispatchEvent(new CustomEvent("contour:map-style",{bubbles:!0,composed:!0,detail:{style:s,name:r}}))}))}});c("contour-map-slot",class extends T{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 t=this.getAttribute("chrome");if(t){this.ensure(".c-map-slot__chrome",()=>{const t=document.createElement("div");return t.className="c-map-slot__chrome",t}).textContent=t}else{const t=this.querySelector(".c-map-slot__chrome");t&&t.remove()}const e=this.getAttribute("attribution");if(e){this.ensure(".c-map-slot__attribution",()=>{const t=document.createElement("div");return t.className="c-map-slot__attribution",t}).textContent=e}else{const t=this.querySelector(".c-map-slot__attribution");t&&t.remove()}const s=this.getAttribute("scale");if(s){this.ensure(".c-map-slot__scale",()=>{const t=document.createElement("div");return t.className="c-map-slot__scale",t}).textContent=s}else{const t=this.querySelector(".c-map-slot__scale");t&&t.remove()}}});c("contour-map-area",class extends T{static get observed(){return["attribution","attribution-mark","scale","controls","style","style-name","src"]}static get properties(){return{attribution:{attribute:"attribution"},"attribution-mark":{attribute:"attribution-mark"},scale:{attribute:"scale"},controls:{attribute:"controls"},"style-name":{attribute:"style-name"}}}render(){this.classList.add("c-map-area"),this.classList.add("c-map-slot");const t=this.getAttribute("style");if(t&&t!==this._lastMapStyle){this._lastMapStyle=t;const e=this.getAttribute("style-name")||t;this.dispatchEvent(new CustomEvent("contour:map-style",{bubbles:!0,composed:!0,detail:{style:t,name:e}})),"function"==typeof requestAnimationFrame&&requestAnimationFrame(()=>this.dispatchEvent(new CustomEvent("contour:map-ready",{bubbles:!0,composed:!0})))}this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"map-area","Map area"));const e=this.getAttribute("attribution");if(e&&"engine"!==e){this.ensure(".c-map-slot__attribution",()=>{const t=document.createElement("div");return t.className="c-map-slot__attribution",t}).textContent=e}else{const t=this.querySelector(".c-map-slot__attribution");t&&t.remove()}const s=this.getAttribute("attribution-mark");if(s){this.ensure(".c-map-slot__attribution-mark",()=>{const t=document.createElement("span");return t.className="c-map-slot__attribution-mark",t}).textContent=s}else{const t=this.querySelector(".c-map-slot__attribution-mark");t&&t.remove()}const r=this.getAttribute("scale");if(r&&"engine"!==r){this.ensure(".c-map-slot__scale",()=>{const t=document.createElement("div");return t.className="c-map-slot__scale",t}).textContent=r}else{const t=this.querySelector(".c-map-slot__scale");t&&t.remove()}const i=this.getAttribute("controls");if(i)try{const t=JSON.parse(i),e=this.ensure(".c-map-slot__controls",()=>{const t=document.createElement("div");return t.className="c-map-slot__controls",t});L(e,""),t.forEach(t=>{const s=document.createElement("button");s.className="c-map-slot__control",s.type="button";const r="object"==typeof t&&t,i=r?t.label||t.action||"":String(t),a=r&&t.action?{zoomIn:"i-plus",zoomOut:"i-minus",zoomReset:"i-crosshair",zoom:"i-zoom",reset:"i-refresh",locate:"i-crosshair",recenter:"i-crosshair"}[String(t.action)]:null;a&&L(s,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+a+'" /></svg>'),s.appendChild(document.createTextNode((a?" ":"")+i)),r&&t.action&&(s.dataset.mapAction=String(t.action)),r&&t.label&&s.setAttribute("aria-label",String(t.label)),e.appendChild(s)})}catch(t){f(this,"attribute",t)}else{const t=this.querySelector(".c-map-slot__controls");t&&t.remove()}}enhance(){this._wiredMapArea||(this._wiredMapArea=!0,this._map=null,this.getViewport=()=>{const t=this._map;if(!t)return null;try{if("function"==typeof t.getBounds){const e=t.getBounds();return function(t){const e=t||{},s=V(e.west),r=V(e.east),i=Number.isFinite(s)&&Number.isFinite(r)&&s>r;return{west:s,south:P(e.south),east:i?r+360:r,north:P(e.north),crossesAntimeridian:i}}({west:e.getWest(),south:e.getSouth(),east:e.getEast(),north:e.getNorth()})}if(t.transform&&"object"==typeof t.transform)return{zoom:t.transform.zoom,center:t.transform.center}}catch(t){}return null},this._emitViewport=()=>{this.dispatchEvent(new CustomEvent("contour:map-viewport",{bubbles:!0,composed:!0,detail:this.getViewport()}))},this._detachEngine=()=>{const t=this._map;if(t&&"function"==typeof t.off){try{t.off("moveend",this._emitViewport)}catch(t){}try{t.off("idle",this._onMapIdle)}catch(t){}try{t.off("load",this._onMapIdle)}catch(t){}}if(this._mapRO){try{this._mapRO.disconnect()}catch(t){}this._mapRO=null}},this._onMapIdle=()=>{this._mapReadySent||(this._mapReadySent=!0,this.dispatchEvent(new CustomEvent("contour:map-ready",{bubbles:!0,composed:!0})))},this.attachMap=t=>{if(this._detachEngine(),this._map=t||null,this._mapReadySent=!1,this._map){const e=()=>{this.isConnected&&this._map===t&&(this.clientWidth&&this.clientHeight||this.dispatchEvent(new CustomEvent("contour:error",{bubbles:!0,composed:!0,detail:{src:this.getAttribute("src")||"",message:"Map container has zero size; the engine cannot render.",name:"map-zero-size",status:0}})))};"function"==typeof requestAnimationFrame?requestAnimationFrame(e):e()}if(this._map&&"function"==typeof this._map.on){try{this._map.on("moveend",this._emitViewport)}catch(t){}try{this._map.on("idle",this._onMapIdle)}catch(t){}try{this._map.on("load",this._onMapIdle)}catch(t){}}if("undefined"!=typeof ResizeObserver&&this._map)try{let t=0;this._mapRO=new ResizeObserver(()=>{t||(t=requestAnimationFrame(()=>{t=0;const e=this._map;if(e)try{"function"==typeof e.resize?e.resize():"function"==typeof e.invalidateSize&&e.invalidateSize()}catch(t){}}))}),this._mapRO.observe(this)}catch(t){this._mapRO=null}if(this.dispatchEvent(new CustomEvent("contour:map-attach",{bubbles:!0,composed:!0})),this._emitViewport(),this._map&&"function"==typeof this._map.loaded)try{this._map.loaded()&&this._onMapIdle()}catch(t){}},this.detachMap=()=>{this._detachEngine(),this._map=null,this.dispatchEvent(new CustomEvent("contour:map-detach",{bubbles:!0,composed:!0}))},this.hasOwnProperty("map")||Object.defineProperty(this,"map",{get:()=>this._map,set:t=>this.attachMap(t)}),this.fitBounds=(t,e)=>{const s=this._map;if(s&&"function"==typeof s.fitBounds)try{s.fitBounds(t,e)}catch(t){}},this.flyTo=t=>{const e=this._map;if(e&&"function"==typeof e.flyTo)try{e.flyTo(t)}catch(t){}},this.attachChrome=t=>{const e=t||this._map;if(!e||this._chromeMap===e)return;this._chromeMap=e,this._chromeDelegated||(this._chromeDelegated=!0,this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-drag-handle--dots, .c-layer-panel__grip"):null;if(!e||!this.contains(e))return;if("ArrowUp"!==t.key&&"ArrowDown"!==t.key)return;const s=e.closest(".c-layer-panel__item");if(!s)return;const r=s.parentNode,i="ArrowUp"===t.key?s.previousElementSibling:s.nextElementSibling;if(!i||!i.classList||!i.classList.contains("c-layer-panel__item"))return;t.preventDefault(),"ArrowUp"===t.key?r.insertBefore(s,i):r.insertBefore(i,s);try{e.focus()}catch(t){}const a=Array.from(r.querySelectorAll(":scope > .c-layer-panel__item")).map((t,e)=>t.dataset.layerId||t.getAttribute("data-layer-id")||String(e));this.dispatchEvent(new CustomEvent("contour:layer-reorder",{bubbles:!0,composed:!0,detail:{layerIds:a}}))}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-map-slot__control"):null;if(!e||!this.contains(e))return;const s=this._map;if(!s)return;const r=e.dataset.mapAction,i=(e.getAttribute("aria-label")||e.textContent||"").toLowerCase(),a=r?/out|minus|zoomout/i.test(r):/out|minus|−|-/.test(i)&&!/in\b/.test(i);try{a?s.zoomOut():s.zoomIn()}catch(t){}}));const s=this.querySelector(".c-readout");if(s&&"function"==typeof e.getCenter){const t=s.querySelector(".c-readout__value--coord"),r=s.querySelector(".c-readout__row:nth-child(2) .c-readout__value"),i=()=>{const s=this._map||e;if("function"!=typeof s.getCenter)return;const i=s.getCenter();t&&i&&(t.textContent=`${i.lng.toFixed(6)}, ${i.lat.toFixed(6)}`),r&&"function"==typeof s.getZoom&&(r.textContent=s.getZoom().toFixed(1))};try{e.on("move",i)}catch(t){}i()}const r=this.querySelector(".c-compass__needle");if(r&&"function"==typeof e.getBearing){const t=r.querySelector(".c-compass__needle--n"),s=r.querySelector(".c-compass__needle--s"),i=r.closest("contour-compass"),a=t=>{const e=t*Math.PI/180;return[20+16*Math.sin(e),20-16*Math.cos(e)]},n=()=>{const r=this._map||e;if("function"!=typeof r.getBearing)return;const n=-r.getBearing(),[o,c]=a(n),[l,u]=a(n+180);if(t&&t.setAttribute("d",`M ${o} ${c} L 20 20 Z`),s&&s.setAttribute("d",`M ${l} ${u} L 20 20 Z`),i){const t=i.getAttribute("aria-label")||"";if(!t||/^compass\b/i.test(t)){const t=Math.round((n%360+360)%360);i.setAttribute("aria-label",`Compass, bearing ${t} degrees`)}}};try{e.on("rotate",n)}catch(t){}n()}},this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-map-slot__control"):null;e&&this.contains(e)&&this.dispatchEvent(new CustomEvent("contour:map-control",{bubbles:!0,composed:!0,detail:{control:e.textContent}}))}))}});c("contour-map-panel",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-map-panel"),this.hasAttribute("role")||this.setAttribute("role","region");const t=this.getAttribute("title");if(t){const e=this._mapPanelTitle;(!this.hasAttribute("aria-label")||e&&this.getAttribute("aria-label")===e)&&this.setAttribute("aria-label",t),this._mapPanelTitle=t}else this._mapPanelTitle&&this.getAttribute("aria-label")===this._mapPanelTitle&&(this.removeAttribute("aria-label"),this._mapPanelTitle=null)}});c("contour-map-footer",class extends T{static get observed(){return["brand"]}static get properties(){return{brand:{attribute:"brand"}}}render(){this.classList.add("c-map-footer"),this.hasAttribute("role")||this.setAttribute("role","contentinfo");const t=this.getAttribute("brand");if(t){this.ensure(".c-map-footer__brand",()=>{const t=document.createElement("span");return t.className="c-map-footer__brand",t}).textContent=t}else{const t=this.querySelector(".c-map-footer__brand");t&&t.remove()}}});c("contour-scale-bar",class extends T{static get observed(){return["label","value","distance","resolution","latitude","zoom","units","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},value:{attribute:"value"},distance:{attribute:"distance"},resolution:{attribute:"resolution"},latitude:{attribute:"latitude"},zoom:{attribute:"zoom"},src:{attribute:"src"}}}render(){if(this.classList.add("c-scale-bar"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"map-scale","Map scale")),Zt(this),$t(this,["label","value"]),Xt(this,"scale-bar"))return;let t=Jt(this,"value")||this._remoteData&&this._remoteData.value;const e=parseFloat(this.getAttribute("resolution")),s=parseFloat(this.getAttribute("latitude")),r=parseFloat(this.getAttribute("zoom"));let i=e;!Number.isFinite(i)&&Number.isFinite(s)&&Number.isFinite(r)&&(i=function(t,e){const s=P(t);return Number.isFinite(s)?156543.03392*Math.cos(s*Math.PI/180)/Math.pow(2,e):NaN}(s,r));let a=null;if(Number.isFinite(i)&&i>0){const e=parseFloat(this.getAttribute("distance"))||1e3;if(t=String(Math.round(e/i)),!this.getAttribute("label")&&!Jt(this,"label")){a="imperial"===(this.getAttribute("units")||"metric")?e>=1609.34?(e/1609.34).toFixed(1)+" mi":Math.round(3.28084*e)+" ft":e>=1e3?e/1e3+" km":e+" m"}}const n=a||Jt(this,"label")||this._remoteData&&this._remoteData.label;if(n){this.ensure(".c-scale-bar__label",()=>{const t=document.createElement("span");return t.className="c-scale-bar__label",t}).textContent=n}else{const t=this.querySelector(".c-scale-bar__label");t&&t.remove()}const o=this.ensure(".c-scale-bar__units",()=>{const t=document.createElement("button");return t.type="button",t.className="c-scale-bar__units",t}),c=this.getAttribute("units")||"metric";if(o.textContent="imperial"===c?"mi":"km",o.onclick=()=>{this.setAttribute("units","imperial"===(this.getAttribute("units")||"metric")?"metric":"imperial")},!t)return void Yt(this,"scale-bar");const l=this.ensure(".c-scale-bar__line",()=>{const t=document.createElement("span");return t.className="c-scale-bar__line",t});l.style.inlineSize=/^\d+(\.\d+)?$/.test(String(t))?t+"px":t;const u=function(t,e){t=Number(t)||0,e=Math.max(1,Math.round(e||4));const s=[];for(let r=0;r<=e;r++)s.push(t/e*r);return s}(parseFloat(t)||0,4),d=u[u.length-1]||1;Array.from(l.querySelectorAll(".c-scale-bar__tick")).forEach(t=>t.remove()),u.forEach(t=>{const e=document.createElement("span");e.className="c-scale-bar__tick",e.style.insetInlineStart=t/d*100+"%",l.appendChild(e)})}});c("contour-split-map",class extends T{static get observed(){return[]}render(){this.classList.add("c-split-map");const t=this.ensure(".c-split-map__pane--left",()=>{const t=document.createElement("div");return t.className="c-split-map__pane c-split-map__pane--left",t}),e=this.ensure(".c-split-map__pane--right",()=>{const t=document.createElement("div");return t.className="c-split-map__pane c-split-map__pane--right",t});t.parentNode!==this&&this.appendChild(t),e.parentNode!==this&&this.appendChild(e)}});c("contour-map-legend",class extends T{static get observed(){return["items","label","collapsed"]}static get properties(){return{items:{attribute:"items"},label:{attribute:"label"},collapsed:{attribute:"collapsed",type:Boolean}}}render(){this.classList.add("c-map-legend");const t=this.getAttribute("label")||k(this,"legend","Legend"),e=this.ensure(".c-map-legend__head",()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--sm c-map-legend__head",t});L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-layers" /></svg>'),e.appendChild(document.createTextNode(" "+t));const s=this.hasAttribute("collapsed");e.setAttribute("aria-expanded",s?"false":"true");let r=[];try{const t=JSON.parse(this.getAttribute("items")||"[]");Array.isArray(t)&&(r=t)}catch(t){}const i=this.ensure(".c-map-legend__list",()=>{const t=document.createElement("ul");return t.className="c-map-legend__list",t});L(i,""),s||r.forEach(t=>{const e="string"==typeof t?t:t.label||t.name||"",s="object"==typeof t&&t?t.color:null,r=document.createElement("li");r.className="c-map-legend__item";const a="object"==typeof t&&t&&t.shape?String(t.shape):"";if(s||pe.has(a)){const t=document.createElement("span");t.className="c-map-legend__swatch",pe.has(a)&&t.classList.add("c-swatch--"+a),s&&(pe.has(a)?t.style.color=s:t.style.setProperty("--c",s)),r.appendChild(t)}r.appendChild(document.createTextNode(" "+e)),i.appendChild(r)})}enhance(){this._wiredMapLegend||(this._wiredMapLegend=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-map-legend__head"):null;e&&this.contains(e)&&this.toggleAttribute("collapsed")}))}});c("contour-resize-observer",class extends T{static get observed(){return["debounce"]}static get properties(){return{debounce:{attribute:"debounce"}}}render(){this.classList.add("c-resize-observer"),this.setAttribute("aria-hidden","true")}enhance(){if(this._wiredResizeObserver)return;if(this._wiredResizeObserver=!0,"function"!=typeof ResizeObserver)return;const t=parseInt(this.getAttribute("debounce")||"0",10)||0;let e=null;const s=new ResizeObserver(s=>{const r=()=>{const t=s[s.length-1],e=t&&t.contentRect?t.contentRect:this.getBoundingClientRect();this.dispatchEvent(new CustomEvent("contour:resize",{bubbles:!0,composed:!0,detail:{width:e.width,height:e.height}}))};t>0?(clearTimeout(e),e=setTimeout(r,t)):r()});s.observe(this),i(this,()=>{s.disconnect(),clearTimeout(e)})}});c("contour-reserved",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-reserved");const t=this.getAttribute("title");if(t){this.ensure(".c-reserved__title",()=>{const t=document.createElement("div");return t.className="c-reserved__title",t}).textContent=t}}});c("contour-theme-scope",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-theme-scope");const t=this.getAttribute("title");if(t){this.ensure(".c-theme-scope__title",()=>{const t=document.createElement("div");return t.className="c-theme-scope__title",t}).textContent=t}}});c("contour-activity",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-activity"),this.setAttribute("role","group"),Zt(this),$t(this,"items"),Xt(this,"activity"))return;const t=Jt(this,"items");if(t)try{const e=JSON.parse(t);Array.from(this.querySelectorAll(".c-activity__item")).forEach(t=>t.remove()),e.forEach((t,e)=>{const s=document.createElement("div");s.className="c-activity__item",s.setAttribute("role","button"),s.setAttribute("tabindex",0===e?"0":"-1");const r=document.createElement("span");r.className="c-activity__dot c-activity__dot--"+(t.variant||"primary"),r.setAttribute("aria-hidden","true"),s.appendChild(r);const i=document.createElement("span");i.className="c-activity__glyph",i.setAttribute("aria-hidden","true"),L(i,'<svg viewBox="0 0 24 24"><use href="#'+({primary:"i-info",success:"i-check-circle",warning:"i-alert",danger:"i-x"}[t.variant]||"i-info")+'" /></svg>'),s.appendChild(i);const a=document.createElement("span");if(a.className="c-activity__text",a.textContent="string"==typeof t?t:t.text||t.label||"",s.hasAttribute("aria-label")||s.setAttribute("aria-label",a.textContent),s.appendChild(a),t.time){const e=document.createElement("span");e.className="c-activity__time",e.textContent=t.time,s.appendChild(e)}this.appendChild(s)})}catch(t){f(this,"attribute",t)}else Yt(this,"activity")}enhance(){this._wiredActivity||(this._wiredActivity=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-activity__item"):null;if(e&&this.contains(e)){const t=Array.from(this.querySelectorAll(".c-activity__item")).indexOf(e),s=e.querySelector(".c-activity__text")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:activity-select",{bubbles:!0,composed:!0,detail:{index:t,text:s}}))}}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-activity__item"));e.length&&z(t,e,{wrap:!1,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:()=>{if("Enter"===t.key||" "===t.key){const t=e.indexOf(document.activeElement);this.dispatchEvent(new CustomEvent("contour:activity-select",{bubbles:!0,composed:!0,detail:{index:t,text:document.activeElement.querySelector(".c-activity__text")?.textContent||""}}))}}})}))}});c("contour-activity-feed",class extends T{static get observed(){return["items","filter","unread-only","empty","loading","error","labels","src","lazy","refresh","timeout","skeleton","cache-key","no-cache","retry"]}static get properties(){return{items:{attribute:"items"},filter:{attribute:"filter"},"unread-only":{attribute:"unread-only",type:Boolean}}}render(){if(this.classList.add("c-activity-feed"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"title","Activity feed")),Zt(this),$t(this,"items"),Xt(this,"activity-feed"))return;const t=Jt(this,"items"),e=this.getAttribute("filter"),s=this.hasAttribute("unread-only");let r=this.querySelector(".c-activity-feed__header");r||(r=document.createElement("div"),r.className="c-activity-feed__header",this.insertBefore(r,this.firstChild));let i=r.querySelector(".c-activity-feed__title");i||(i=document.createElement("div"),i.className="c-activity-feed__title",r.appendChild(i)),i.textContent=k(this,"title","Activity feed");let a=this.querySelector(".c-activity-feed__toolbar");a||(a=document.createElement("div"),a.className="c-activity-feed__toolbar",this.appendChild(a));a.querySelector("[data-activity-clear]")||(()=>{const t=document.createElement("button");t.type="button",t.className="c-btn c-btn--ghost c-btn--sm",t.setAttribute("data-activity-clear",""),L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-x" /></svg>'),t.appendChild(document.createTextNode(" "+k(this,"clear","Clear all"))),a.appendChild(t)})();(a.querySelector("[data-activity-unread]")||(()=>{const t=document.createElement("button");return t.type="button",t.className="c-btn c-btn--ghost c-btn--sm",t.setAttribute("data-activity-unread",""),t.textContent=k(this,"unread","Unread only"),a.appendChild(t),t})()).setAttribute("aria-pressed",s?"true":"false");let n=this.querySelector(".c-activity-feed__list");if(n||(n=document.createElement("ol"),n.className="c-activity-feed__list",this.appendChild(n)),t)try{let r=JSON.parse(t);if(e&&(r=r.filter(t=>String(t.severity||t.type||"").toLowerCase()===e.toLowerCase())),s&&(r=r.filter(t=>!t.read)),Array.from(n.querySelectorAll(".c-activity-feed__item")).forEach(t=>t.remove()),0===r.length){let t=n.querySelector(".c-activity-feed__empty");t||(t=document.createElement("div"),t.className="c-activity-feed__empty",t.textContent=k(this,"empty","No activity"),n.appendChild(t))}else{const t=n.querySelector(".c-activity-feed__empty");t&&t.remove(),r.forEach((t,e)=>{const s=document.createElement("li");s.className="c-activity-feed__item"+(t.read?"":" c-activity-feed__item--unread"),s.setAttribute("role","listitem"),s.setAttribute("tabindex",0===e?"0":"-1");const r=document.createElement("span");r.className="c-activity-feed__dot c-activity-feed__dot--"+(t.severity||"info"),r.setAttribute("aria-hidden","true"),s.appendChild(r);const i=document.createElement("span");i.className="c-activity-feed__text",i.textContent="string"==typeof t?t:t.text||t.label||"",s.appendChild(i);const a=document.createElement("time");a.className="c-activity-feed__time",t.time&&a.setAttribute("datetime",String(t.time)),a.textContent=t.time||"",s.appendChild(a);const o=document.createElement("span");o.className="c-activity-feed__severity",o.textContent=t.severity||"",s.appendChild(o),n.appendChild(s)})}}catch(t){f(this,"attribute",t)}}enhance(){this._wiredActivityFeed||(this._wiredActivityFeed=!0,this.addEventListener("click",t=>{const e=t.target.closest(".c-activity-feed__item");if(e&&this.contains(e)){const t=Array.from(this.querySelectorAll(".c-activity-feed__item")).indexOf(e),s=e.querySelector(".c-activity-feed__text")?.textContent||"";return e.classList.remove("c-activity-feed__item--unread"),void this.dispatchEvent(new CustomEvent("contour:activity-select",{bubbles:!0,composed:!0,detail:{index:t,text:s}}))}const s=t.target&&t.target.closest?t.target.closest("button"):null;s&&this.contains(s)&&(s.hasAttribute("data-activity-clear")?this.dispatchEvent(new CustomEvent("contour:activity-clear",{bubbles:!0,composed:!0,detail:{}})):s.hasAttribute("data-activity-unread")&&(this.toggleAttribute("unread-only"),this.dispatchEvent(new CustomEvent("contour:activity-filter",{bubbles:!0,composed:!0,detail:{unread:this.hasAttribute("unread-only")}}))))}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-activity-feed__item"));e.length&&z(t,e,{wrap:!1,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:()=>{if("Enter"===t.key||" "===t.key){const t=e.indexOf(document.activeElement);this.dispatchEvent(new CustomEvent("contour:activity-select",{bubbles:!0,composed:!0,detail:{index:t,text:document.activeElement.querySelector(".c-activity-feed__text")?.textContent||""}}))}}})}))}});c("contour-advanced",class extends T{static get observed(){return["title"]}static get properties(){return{title:{attribute:"title"}}}render(){this.classList.add("c-advanced"),this.setAttribute("role","region");const t=this.getAttribute("title");if(t){this.ensure(".c-advanced__title",()=>{const t=document.createElement("div");return t.className="c-advanced__title",t}).textContent=t,this.setAttribute("aria-label",t)}}enhance(){this._wiredAdvanced||(this._wiredAdvanced=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-advanced__title"):null;if(!e||!this.contains(e))return;const s=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:advanced-toggle",{bubbles:!0,composed:!0,detail:{title:s}}))}),this.addEventListener("keydown",t=>{if(t.target===this&&("Enter"===t.key||" "===t.key)){t.preventDefault();const e=this.getAttribute("title")||"";this.dispatchEvent(new CustomEvent("contour:advanced-toggle",{bubbles:!0,composed:!0,detail:{title:e}}))}}))}});c("contour-affordance",class extends T{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 t=this.getAttribute("name");if(t){this.ensure(".c-affordance__name",()=>{const t=document.createElement("div");return t.className="c-affordance__name",t}).textContent=t,this.setAttribute("aria-label",t)}else{const t=this.querySelector(".c-affordance__name");t&&t.remove()}const e=this.getAttribute("note");if(e){this.ensure(".c-affordance__note",()=>{const t=document.createElement("div");return t.className="c-affordance__note",t}).textContent=e}else{const t=this.querySelector(".c-affordance__note");t&&t.remove()}const s=this.getAttribute("demo");if(s){this.ensure(".c-affordance__demo",()=>{const t=document.createElement("div");return t.className="c-affordance__demo",t}).textContent=s}else{const t=this.querySelector(".c-affordance__demo");t&&t.remove()}}enhance(){this._wiredAffordance||(this._wiredAffordance=!0,this.addEventListener("click",t=>{const e=this.getAttribute("name")||"";this.dispatchEvent(new CustomEvent("contour:affordance-activate",{bubbles:!0,composed:!0,detail:{name:e}}))}),this.addEventListener("keydown",t=>{if("Enter"===t.key||" "===t.key){t.preventDefault();const e=this.getAttribute("name")||"";this.dispatchEvent(new CustomEvent("contour:affordance-activate",{bubbles:!0,composed:!0,detail:{name:e}}))}}))}});c("contour-affordances",class extends T{static get observed(){return["name","title"]}static get properties(){return{name:{attribute:"name"},title:{attribute:"title"}}}render(){if(this.classList.add("c-affordances"),this.setAttribute("role","group"),!this.querySelector(".c-affordance")){const t=document.createElement("div");t.className="c-affordance";const e=this.getAttribute("name")||this.getAttribute("title")||k(this,"affordance","Affordance"),s=document.createElement("div");s.className="c-affordance__name",s.textContent=e,t.appendChild(s);const r=document.createElement("div");r.className="c-affordance__demo",r.textContent=k(this,"demo","Demo"),t.appendChild(r),this.appendChild(t)}}});c("contour-menu",class extends T{static get observed(){return["items","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-menu"),this.hasAttribute("role")||this.setAttribute("role","menu"),Zt(this),$t(this,"items"),Xt(this,"menu"))return;const t=Jt(this,"items"),e=Array.from(this.querySelectorAll("li[role='menuitem'], li.c-menu__item, [role='menuitem']")),s=this.querySelector("ul.c-menu");if(e.length){if(s)for(const t of e)t.classList.contains("c-menu__item")||t.classList.add("c-menu__item"),t.getAttribute("role")||t.setAttribute("role","menuitem"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1");else{const t=document.createElement("ul");t.className="c-menu",t.setAttribute("role","menu");for(const s of e)s.parentElement===this&&t.appendChild(s);this.appendChild(t)}const t=e.find(t=>"true"!==t.getAttribute("aria-disabled"));return t&&t.setAttribute("tabindex","0"),this.classList.remove("c-menu"),void(s&&s.classList.add("c-menu"))}if(!s)if(t)try{const e=JSON.parse(t),s=this.ensure("ul.c-menu",()=>{const t=document.createElement("ul");return t.className="c-menu",t.setAttribute("role","menu"),t});s.innerHTML="",s.setAttribute("role","menu"),e.forEach(t=>{if("---"===t||"separator"===t){const t=document.createElement("li");t.className="c-menu__separator",t.setAttribute("role","separator"),s.appendChild(t)}else if("string"==typeof t){const e=document.createElement("li");e.className="c-menu__item",e.setAttribute("role","menuitem"),e.textContent=t,s.appendChild(e)}else if(t.group){const e=document.createElement("li");e.className="c-menu__group",e.setAttribute("role","group"),t.group&&e.setAttribute("aria-label",String(t.group));const r=document.createElement("div");if(r.className="c-menu__group-label",r.textContent=String(t.group),e.appendChild(r),Array.isArray(t.items)){const s=document.createElement("ul");s.className="c-menu",s.setAttribute("role","menu"),t.items.forEach(t=>{const e=document.createElement("li");if(e.className="c-menu__item"+(t.danger?" c-menu__item--danger":"")+(t.disabled?" c-menu__item--disabled":""),e.setAttribute("role","menuitem"),t.disabled&&e.setAttribute("aria-disabled","true"),t.label||t.title){const s=document.createElement("span");s.className="c-menu__label",s.textContent=t.label||t.title||"",e.appendChild(s)}s.appendChild(e)}),e.appendChild(s)}s.appendChild(e)}else{const e=document.createElement("li");e.className="c-menu__item"+(t.danger?" c-menu__item--danger":"")+(t.disabled?" c-menu__item--disabled":"");const r="checkbox"===t.type?"menuitemcheckbox":"radio"===t.type?"menuitemradio":"menuitem";if(e.setAttribute("role",r),"checkbox"!==t.type&&"radio"!==t.type||e.setAttribute("aria-checked",String(!!t.checked)),t.disabled&&e.setAttribute("aria-disabled","true"),t.items&&Array.isArray(t.items)&&(e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","false")),t.label||t.title){const s=document.createElement("span");s.className="c-menu__label",s.textContent=t.label||t.title||"",e.appendChild(s)}if(t.shortcut){const s=document.createElement("span");s.className="c-menu__shortcut",s.textContent=t.shortcut,e.appendChild(s)}if(t.items&&Array.isArray(t.items)){const s=document.createElement("ul");s.className="c-menu",s.setAttribute("role","menu"),t.items.forEach(t=>{const e=document.createElement("li");if(e.className="c-menu__item"+(t.danger?" c-menu__item--danger":"")+(t.disabled?" c-menu__item--disabled":""),e.setAttribute("role","menuitem"),t.disabled&&e.setAttribute("aria-disabled","true"),t.label||t.title){const s=document.createElement("span");s.className="c-menu__label",s.textContent=t.label||t.title||"",e.appendChild(s)}s.appendChild(e)}),e.appendChild(s)}s.appendChild(e)}}),s.parentNode!==this&&this.appendChild(s),this.classList.remove("c-menu"),s.classList.add("c-menu")}catch(t){f(this,"attribute",t)}else Yt(this,"menu")}enhance(){At(this)}});c("contour-tabs",class extends T{static get observed(){return["tabs","items","autoplay","pause","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","orientation","closable","cache-key","no-cache"]}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(){if(this.classList.add("c-tabs"),Zt(this),$t(this,"tabs"),Xt(this,"tabs"))return;const t=Jt(this,"tabs")||Jt(this,"items")||this.getAttribute("tabs")||this.getAttribute("items"),e=Array.from(this.querySelectorAll("[role='tab']")),s=this.querySelector(".c-tabs__list"),r=Array.from(this.querySelectorAll(".c-tabs__panel"));if(e.length){if(!s){const t=document.createElement("div");t.className="c-tabs__list",t.setAttribute("role","tablist");const s="vertical"===this.getAttribute("orientation")?"vertical":"horizontal";t.setAttribute("aria-orientation",s),"vertical"===s?this.classList.add("c-tabs--vertical"):this.classList.remove("c-tabs--vertical");for(const s of e)s.parentElement===this&&t.appendChild(s);this.prepend(t)}const t="vertical"===this.getAttribute("orientation")?"vertical":"horizontal";s&&s.setAttribute("aria-orientation",t),"vertical"===t?this.classList.add("c-tabs--vertical"):this.classList.remove("c-tabs--vertical");const i=e.findIndex(t=>"true"===t.getAttribute("aria-selected"));return void e.forEach((t,e)=>{t.classList.contains("c-tabs__tab")||t.classList.add("c-tabs__tab"),t.getAttribute("role")||t.setAttribute("role","tab");let s=t.getAttribute("aria-controls");if(s){let t=r.find(t=>t.id===s);t||(t=document.createElement("div"),t.className="c-tabs__panel",t.id=s,t.setAttribute("role","tabpanel"),this.appendChild(t))}else{const i=r[e];i&&(s=i.id||o("c-tabs-panel"),i.id=s,t.setAttribute("aria-controls",s))}const a=i>=0?e===i:0===e;t.setAttribute("aria-selected",String(a)),t.tabIndex=a?0:-1;const n=t.getAttribute("aria-controls"),c=n?document.getElementById(n):null;c&&(c.hidden=!a)})}if(t&&!e.length)try{const e=JSON.parse(t),s=this.ensure(".c-tabs__list",()=>{const t=document.createElement("div");return t.className="c-tabs__list",t.setAttribute("role","tablist"),t});s.setAttribute("role","tablist");const r="vertical"===this.getAttribute("orientation")?"vertical":"horizontal";s.setAttribute("aria-orientation",r),"vertical"===r?this.classList.add("c-tabs--vertical"):this.classList.remove("c-tabs--vertical");const i=Array.from(s.querySelectorAll("[role='tab']")).findIndex(t=>"true"===t.getAttribute("aria-selected")),a=i>=0?i:0;s.innerHTML="",Array.from(this.querySelectorAll(".c-tabs__panel")).forEach(t=>t.remove()),e.forEach((t,e)=>{const r="string"==typeof t?t:t.label||t.title||"",i=o("c-tabs-panel"),n=document.createElement(this.hasAttribute("closable")?"div":"button");n.className="c-tabs__tab","BUTTON"===n.tagName&&(n.type="button"),n.setAttribute("role","tab"),n.setAttribute("aria-selected",String(e===a)),n.setAttribute("aria-controls",i),n.tabIndex=e===a?0:-1;const c=document.createElement("span");if(c.textContent=r,n.textContent="",n.appendChild(c),this.hasAttribute("closable")){const t=document.createElement("button");t.type="button",t.className="c-tabs__close",t.setAttribute("aria-label",k(this,"close","Close")+" "+r),t.textContent="×",t.addEventListener("click",t=>{t.stopPropagation();const e=Array.from(s.querySelectorAll("[role='tab']")).indexOf(n),i=n.getAttribute("aria-controls"),a=i?document.getElementById(i):null;n.remove(),a&&a.remove(),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0,detail:{index:e,label:r}}));const o=s.querySelectorAll("[role='tab']");o.length&&o[0].click()}),n.appendChild(t)}s.appendChild(n);const l=document.createElement("div");l.className="c-tabs__panel",l.id=i,l.setAttribute("role","tabpanel"),"object"==typeof t&&null!==t&&void 0!==t.content&&(l.textContent=String(t.content)),e!==a&&(l.hidden=!0),this.appendChild(l)}),s.parentNode!==this&&this.prepend(s)}catch(t){f(this,"attribute",t)}else if(!t&&!e.length){const t=this.querySelector(".c-tabs__list");t&&t.remove(),Yt(this,"tabs")}}enhance(){pt(this);const t=()=>{const t=parseFloat(this.getAttribute("autoplay")||""),e=this.hasAttribute("pause")||this._tabsHover||this._tabsFocus,s="function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,r=Number.isFinite(t)&&t>0&&!e&&!s;r!==this._tabsAutoplayRunning&&(this._tabsAutoplayRunning=r,void 0!==this._tabsTimer&&(clearInterval(this._tabsTimer),this._tabsTimer=void 0),r&&(this._tabsTimer=setInterval(()=>{if(!this.isConnected||this.hasAttribute("pause")||this._tabsHover||this._tabsFocus)return;const t=this.querySelector(".c-tabs__list"),e=t?Array.from(t.querySelectorAll("[role='tab']")):[];if(!e.length)return;const s=e.findIndex(t=>"true"===t.getAttribute("aria-selected")),r=e[(s+1)%e.length];r&&r.click()},Math.max(1e3,1e3*t))))};t(),this._wiredTabsAutoplay||(this._wiredTabsAutoplay=!0,this.addEventListener("pointerenter",()=>{this._tabsHover=!0,t()}),this.addEventListener("pointerleave",()=>{this._tabsHover=!1,t()}),this.addEventListener("focusin",()=>{this._tabsFocus=!0,t()}),this.addEventListener("focusout",()=>{this._tabsFocus=!1,t()}),i(this,()=>{void 0!==this._tabsTimer&&(clearInterval(this._tabsTimer),this._tabsTimer=void 0)}))}});c("contour-code-tabs",class extends T{static get observed(){return["tabs","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","cache-key","no-cache"]}static get properties(){return{tabs:{attribute:"tabs"},src:{attribute:"src"}}}render(){if(this.classList.add("c-code-tabs"),Zt(this),$t(this,"tabs"),Xt(this,"code-tabs"))return;const t=Jt(this,"tabs"),e=this.querySelector(".c-code-tabs__list"),s=e?Array.from(e.children).filter(t=>t.getAttribute&&"tab"===t.getAttribute("role")):[];if(t&&!s.length)try{const e=JSON.parse(t),s=this.ensure(".c-code-tabs__list",()=>{const t=document.createElement("div");return t.className="c-code-tabs__list",t.setAttribute("role","tablist"),t});s.setAttribute("role","tablist");const r=Array.from(s.querySelectorAll("[role='tab']")).findIndex(t=>"true"===t.getAttribute("aria-selected")),i=r>=0?r:0;s.innerHTML="",Array.from(this.querySelectorAll(".c-code-tabs__panel")).forEach(t=>t.remove()),e.forEach((t,e)=>{const r="string"==typeof t?t:t.label||t.title||"",a=o("c-code-tabs-panel"),n=document.createElement("button");n.className="c-code-tabs__tab",n.type="button",n.setAttribute("role","tab"),n.setAttribute("aria-selected",String(e===i)),n.setAttribute("aria-controls",a),n.tabIndex=e===i?0:-1,n.textContent=r,s.appendChild(n);const c=document.createElement("div");if(c.className="c-code-tabs__panel",c.id=a,c.setAttribute("role","tabpanel"),"object"==typeof t&&null!==t&&void 0!==t.content){const e=document.createElement("pre"),s=document.createElement("code");s.textContent=String(t.content),e.appendChild(s),c.appendChild(e);const r=document.createElement("button");r.className="c-btn c-btn--ghost c-btn--sm c-code-tabs__copy",r.type="button",r.textContent=k(this,"copy","Copy"),r.setAttribute("aria-label",k(this,"copy-code","Copy code")),r.dataset.copy=String(t.content),c.appendChild(r)}e!==i&&(c.hidden=!0),this.appendChild(c)}),s.parentNode!==this&&this.prepend(s)}catch(t){f(this,"attribute",t)}else!t&&e?(e.remove(),Yt(this,"code-tabs")):t||e||Yt(this,"code-tabs")}enhance(){pt(this),this._wiredCodeTabs||(this._wiredCodeTabs=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-code-tabs__copy"):null;if(!e||!this.contains(e))return;const s=e.dataset.copy||"";if(s)try{navigator.clipboard.writeText(s),e.textContent=k(this,"copied","Copied!"),setTimeout(()=>{e.textContent=k(this,"copy","Copy")},2e3)}catch(t){}}))}});c("contour-breadcrumb",class extends T{static get observed(){return["items","separator","max","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache"]}static get properties(){return{items:{attribute:"items"},separator:{attribute:"separator"},max:{attribute:"max",type:Number},src:{attribute:"src"}}}render(){if(this.classList.add("c-breadcrumb"),this.hasAttribute("role")||this.setAttribute("role","navigation"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"breadcrumb","Breadcrumb")),Zt(this),$t(this,"items"),Xt(this,"breadcrumb"))return;const t=Jt(this,"items"),e=this.querySelector("nav"),s=e?e.querySelector("ol"):null,r=s?Array.from(s.children).filter(t=>"LI"===t.tagName):[];if(t&&!r.length)try{const e=JSON.parse(t),s=this.ensure("nav",()=>{const t=document.createElement("nav");return t.setAttribute("aria-label",k(this,"breadcrumb","Breadcrumb")),t});s.setAttribute("aria-label",k(this,"breadcrumb","Breadcrumb")),s.id||(s.id=o("contour-breadcrumb-list")),s.innerHTML="";const r=document.createElement("ol");r.className="c-breadcrumb__list",s.appendChild(r);const i=this.getAttribute("separator")||"/",a=this._overflowExpanded?null:this.max,n=Number.isFinite(a)&&a>1&&e.length>a?e.slice(-a):e;if(Number.isFinite(a)&&a>1&&e.length>a){const t=document.createElement("button");t.type="button",t.className="c-breadcrumb__overflow",t.setAttribute("aria-label",`Show ${e.length-n.length+1} more items`),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-controls",s.id),t.textContent="…",t.addEventListener("click",()=>{this._overflowExpanded=!0,this.requestRender(),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{expanded:!0}}))});const i=document.createElement("li");i.appendChild(t),r.appendChild(i)}n.forEach((t,e)=>{const s=document.createElement("li");if(e<n.length-1){const e=document.createElement("a");e.href=v(t.href||"#"),e.textContent=t.label||t,s.appendChild(e);const r=document.createElement("span");r.className="c-breadcrumb__sep",r.setAttribute("aria-hidden","true"),r.textContent=i,s.appendChild(r)}else{const e=document.createElement("span");e.textContent=t.label||t,e.setAttribute("aria-current","page"),s.appendChild(e)}r.appendChild(s)})}catch(t){f(this,"attribute",t)}else!t&&e?e.remove():t||e||Yt(this,"breadcrumb")}});c("contour-pagination",class extends T{static get observed(){return["pages","current","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","cache-key","no-cache"]}static get properties(){return{pages:{attribute:"pages"},current:{attribute:"current"},src:{attribute:"src"}}}render(){if(this.classList.add("c-pagination"),this.hasAttribute("role")||this.setAttribute("role","navigation"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"pagination","Pagination")),Zt(this),$t(this,"pages"),Xt(this,"pagination"))return;const t=Jt(this,"pages");Array.from(this.querySelectorAll(".c-pagination__link")).forEach(t=>t.remove());let e=this.getAttribute("current")||"1";if("storage"===this.getAttribute("persist")&&this.id)try{const t=localStorage.getItem("contour-pagination:"+this.id);null!==t&&(e=t)}catch(t){}else if("url"===this.getAttribute("persist"))try{const t=new URLSearchParams(window.location.search).get("c-pagination");null!==t&&(e=t)}catch(t){}const s=parseInt(e,"10")||1;if(this.setAttribute("page",String(s)),t){let e=parseInt(t,10);if(!Number.isFinite(e)||e<1)try{const s=JSON.parse(t);Array.isArray(s)&&(e=s.length)}catch(t){}const r=document.createElement("button");r.type="button",r.className="c-pagination__link c-pagination__prev",r.setAttribute("data-action","prev"),L(r,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-left" /></svg>'),r.setAttribute("aria-label",k(this,"prev","Previous page")),s<=1&&r.setAttribute("disabled",""),this.appendChild(r);const i=new Set([1,e,s]);s>1&&i.add(s-1),s<e&&i.add(s+1);const a=[...i].filter(t=>t>=1&&t<=e).sort((t,e)=>t-e);let n=0;for(const t of a){if(n&&t-n>1){const t=document.createElement("span");t.className="c-pagination__ellipsis",t.textContent="…",t.setAttribute("aria-hidden","true"),this.appendChild(t)}const e=document.createElement("button");e.type="button",e.className="c-pagination__link",e.textContent=String(t),t===s&&e.setAttribute("aria-current","page"),this.appendChild(e),n=t}const o=document.createElement("button");o.type="button",o.className="c-pagination__link c-pagination__next",o.setAttribute("data-action","next"),L(o,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),o.setAttribute("aria-label",k(this,"next","Next page")),s>=e&&o.setAttribute("disabled",""),this.appendChild(o)}else Yt(this,"pagination")}enhance(){Et(this)}});c("contour-pager",class extends T{static get observed(){return["prev","next"]}static get properties(){return{prev:{attribute:"prev"},next:{attribute:"next"}}}render(){this.classList.add("c-pager"),this.hasAttribute("role")||this.setAttribute("role","navigation"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"pagination","Pagination")),Array.from(this.querySelectorAll(".c-pager__link")).forEach(t=>t.remove());const t=this.getAttribute("prev"),e=this.getAttribute("next");if(t){const e=document.createElement("a");e.className="c-pager__link",e.href=v(t.split("|")[1]||"#");const s=document.createElement("span");s.className="c-pager__dir",s.textContent=k(this,"previous","← Previous"),e.appendChild(s);const r=document.createElement("span");r.className="c-pager__title",r.textContent=t.split("|")[0],e.appendChild(r),this.appendChild(e)}if(e){const t=document.createElement("a");t.className="c-pager__link c-pager__link--next",t.href=v(e.split("|")[1]||"#");const s=document.createElement("span");s.className="c-pager__dir",s.textContent=k(this,"next","Next")+" →",t.appendChild(s);const r=document.createElement("span");r.className="c-pager__title",r.textContent=e.split("|")[0],t.appendChild(r),this.appendChild(t)}}});c("contour-toc",class extends T{static get observed(){return["title","items","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","empty","no-cache"]}static get properties(){return{title:{attribute:"title"},items:{attribute:"items"},src:{attribute:"src"}}}render(){if(this.classList.add("c-toc"),this.setAttribute("role","group"),Zt(this),$t(this,"items"),Xt(this,"toc"))return;const t=Jt(this,"items"),e=this.getAttribute("title")||"On this page";this.ensure(".c-toc__title",()=>{const t=document.createElement("div");return t.className="c-toc__title",t}).textContent=e;const s=this.querySelector(".c-toc__list"),r=s?Array.from(s.children).filter(t=>"A"===t.tagName):[];if(t&&!r.length)try{const s=JSON.parse(t),r=this.ensure(".c-toc__list",()=>{const t=document.createElement("nav");return t.className="c-toc__list",t});r.className="c-toc__list",r.setAttribute("aria-label",e),r.innerHTML="",s.forEach((t,e)=>{const s=document.createElement("a");s.className="c-toc__link"+(t.sub?" c-toc__link--sub":""),s.href=v(t.href||"#"),s.textContent=t.label||t,s.tabIndex=0===e?0:-1,t.current&&s.setAttribute("aria-current","true"),r.appendChild(s)})}catch(t){f(this,"attribute",t)}else!t&&s?(s.remove(),Yt(this,"toc")):t||s||Yt(this,"toc")}enhance(){if(this._wiredTocSpy)return;const t=()=>Array.from(this.querySelectorAll(".c-toc__link")),e=()=>t().map(t=>{const e=t.getAttribute("href")||"";if(!e.startsWith("#")||e.length<2)return null;const s=document.getElementById(e.slice(1));return s?{a:t,el:s}:null}).filter(Boolean);if(!e().length)return;this._wiredTocSpy=!0;const s=()=>{const s=e();if(!s.length)return;const r=(()=>{const t=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--header-height"));return(Number.isFinite(t)?t:0)+Math.min(120,.2*window.innerHeight)})();let i=s[0];for(const t of s)t.el.getBoundingClientRect().top<=r&&(i=t);document.documentElement.scrollHeight>window.innerHeight+2&&window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-2&&(i=s[s.length-1]);const a=i.el.id;t().forEach(t=>{t.getAttribute("href")==="#"+a?"true"!==t.getAttribute("aria-current")&&t.setAttribute("aria-current","true"):t.hasAttribute("aria-current")&&t.removeAttribute("aria-current")})};let r=0;const a=()=>{r||(r=requestAnimationFrame(()=>{r=0,s()}))};window.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",a),window.addEventListener("hashchange",a),s(),i(this,()=>{window.removeEventListener("scroll",a),window.removeEventListener("resize",a),window.removeEventListener("hashchange",a),r&&cancelAnimationFrame(r)}),this._wiredTocScroll||(this._wiredTocScroll=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-toc__link"):null;if(!e||!this.contains(e))return;const s=e.getAttribute("href")||"";if(!s.startsWith("#")||s.length<2)return;const r=document.getElementById(s.slice(1));if(r){t.preventDefault();try{r.scrollIntoView({behavior:"smooth",block:"start"})}catch(t){r.scrollIntoView()}this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{href:s}}))}}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-toc__link"));e.length&&z(t,e,{wrap:!0,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e){const e=document.activeElement;e&&(t.preventDefault(),e.click())}}})}))}});c("contour-header",class extends T{static get observed(){return["brand","brand-href","links"]}static get properties(){return{brand:{attribute:"brand"},"brand-href":{attribute:"brand-href"},links:{attribute:"links"}}}render(){this.classList.add("c-header"),this.hasAttribute("role")||this.setAttribute("role","banner"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("brand")||"Header");const t=this.getAttribute("brand"),e=this.getAttribute("links"),s=this.ensure(".c-header__inner",()=>{const t=document.createElement("div");return t.className="container c-header__inner",t});s.className="container c-header__inner";let r=s.querySelector(".c-brand");if(t){if(!r){r=document.createElement("a"),r.className="c-brand",r.setAttribute("data-contour-generated",""),r.href=v(this.getAttribute("brand-href")||"#"),L(r,'<span class="c-mark"><svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-mark" /></svg></span>');const t=document.createElement("span");t.className="c-brand__name",r.appendChild(t),s.insertBefore(r,s.firstChild)}const e=r.querySelector(".c-brand__name");e&&(e.textContent=t)}else r&&r.hasAttribute("data-contour-generated")&&r.remove();let i=s.querySelector(".c-header__nav");const a=i?Array.from(i.children).filter(t=>"A"===t.tagName):[];if(e&&!a.length)try{const t=JSON.parse(e);i||(i=document.createElement("nav"),i.className="c-header__nav",i.setAttribute("aria-label",k(this,"main","Main")),i.setAttribute("data-contour-generated",""),s.appendChild(i)),i.innerHTML="",t.forEach(t=>{const e=document.createElement("a");e.href=v(t.href||"#"),e.textContent=t.label||t,i.appendChild(e)})}catch(t){}else e&&a.length||i&&!e&&!a.length&&i.hasAttribute("data-contour-generated")&&i.remove();if(!s.querySelector(".c-header__actions")){const t=document.createElement("div");t.className="c-header__actions",s.appendChild(t)}const n=s.querySelector(".c-header__nav");if(n){n.id||(n.id=o("header-nav"));const t=s.querySelector(".c-header__actions");if(t&&!t.querySelector(".c-header__toggle")){const e=document.createElement("button");e.type="button",e.className="c-header__toggle",e.setAttribute("aria-label",k(this,"toggle-navigation","Toggle navigation")),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",n.id),L(e,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-menu" /></svg>'),t.appendChild(e)}}s.parentNode!==this&&this.appendChild(s)}enhance(){if(this._wiredHeader)return;this._wiredHeader=!0;const t=()=>{const t=window.scrollY||document.documentElement.scrollTop||0;this.classList.toggle("c-header--scrolled",t>8)};t(),window.addEventListener("scroll",t,{passive:!0}),i(this,()=>window.removeEventListener("scroll",t)),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-header__toggle"):null;if(!e||!this.contains(e))return;const s=this.querySelector("#"+CSS.escape(e.getAttribute("aria-controls")||""));if(!s)return;const r=s.classList.toggle("is-open");e.setAttribute("aria-expanded",String(r)),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{open:r}}))}),this.addEventListener("keydown",t=>{if("Escape"!==t.key)return;const e=this.querySelector(".c-header__toggle"),s=e&&this.querySelector("#"+CSS.escape(e.getAttribute("aria-controls")||""));e&&s&&s.classList.contains("is-open")&&(s.classList.remove("is-open"),e.setAttribute("aria-expanded","false"))})}});c("contour-footer",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","contentinfo");const t=this.getAttribute("brand");if(t){this.ensure(".c-footer__brand",()=>{const t=document.createElement("div");return t.className="c-footer__brand",t}).textContent=t}else{const t=this.querySelector(".c-footer__brand");t&&t.remove()}const e=this.getAttribute("note");if(e){this.ensure(".c-footer__note",()=>{const t=document.createElement("p");return t.className="c-footer__note",t}).textContent=e}else{const t=this.querySelector(".c-footer__note");t&&t.remove()}const s=this.getAttribute("links");if(s)try{const t=JSON.parse(s),e=this.ensure(".c-footer__links",()=>{const t=document.createElement("div");return t.className="c-footer__links",t});e.innerHTML="",t.forEach(t=>{const s=document.createElement("a");s.href=v("string"==typeof t?"#":t.href||"#"),s.textContent="string"==typeof t?t:t.label||t,e.appendChild(s)})}catch(t){f(this,"attribute",t)}else{const t=this.querySelector(".c-footer__links");t&&t.remove()}const r=this.getAttribute("cols");if(r)try{const t=JSON.parse(r);this.querySelectorAll(".c-footer__col").forEach(t=>t.remove()),t.forEach(t=>{const e=document.createElement("div");if(e.className="c-footer__col",t.title){const s=document.createElement(E(this,"h3"));s.textContent=t.title,e.appendChild(s)}(t.links||[]).forEach(t=>{const s=document.createElement("a");s.href=v("string"==typeof t?"#":t.href||"#"),s.textContent="string"==typeof t?t:t.label||t,e.appendChild(s)}),this.appendChild(e)})}catch(t){f(this,"attribute",t)}else this.querySelectorAll(".c-footer__col").forEach(t=>t.remove())}});c("contour-scheme-toggle",class extends T{static get observed(){return[]}_stored(){try{return localStorage.getItem("contour-scheme")??"light dark"}catch(t){return"light dark"}}_resolved(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}_rendered(){const t=this._stored();return"light dark"===t?this._resolved():t}render(){if(this.classList.add("c-scheme-toggle"),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),!this.querySelector(".c-scheme-toggle__icons")&&!this.querySelector(".c-scheme-toggle__glyph")){const t=document.createElement("span");t.className="c-scheme-toggle__glyph",t.setAttribute("aria-hidden","true"),this.appendChild(t)}this._sync()}_sync(){const t=this._rendered(),e="dark"===t?"light":"dark";this.setAttribute("aria-pressed",String("dark"===t)),this.setAttribute("aria-label","dark"===e?"Switch to dark theme":"Switch to light theme");const s=this.querySelector(".c-scheme-toggle__glyph");s&&(s.textContent="dark"===t?"☀":"☾")}_apply(t){const e=document.documentElement,s="light dark"===t?this._resolved():t;e.classList.add("is-theme-switching");const r=document.querySelector('meta[name="color-scheme"]');r&&r.setAttribute("content",t),e.setAttribute("data-theme",s);try{"light dark"===t?localStorage.removeItem("contour-scheme"):localStorage.setItem("contour-scheme",t)}catch(t){}requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove("is-theme-switching"))),this._sync(),this.dispatchEvent(new CustomEvent("contour:theme-change",{detail:{theme:s},bubbles:!0,composed:!0}))}enhance(){if(this._wiredScheme)return;this._wiredScheme=!0,this.addEventListener("click",()=>{const t="dark"===this._rendered()?"light":"dark";this._apply(t===this._resolved()?"light dark":t)}),this.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.click())});const t=window.matchMedia("(prefers-color-scheme: dark)");t.addEventListener&&t.addEventListener("change",()=>{"light dark"===this._stored()&&(document.documentElement.setAttribute("data-theme",this._resolved()),this._sync())});try{const t=localStorage.getItem("contour-theme");t&&(localStorage.getItem("contour-scheme")||"dark"!==t&&"light"!==t||localStorage.setItem("contour-scheme",t),localStorage.removeItem("contour-theme"))}catch(t){}const e=this._stored();"light dark"!==e?this._apply(e):this._sync()}});c("contour-sidebar",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","navigation"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Sidebar"),this.hasAttribute("collapsed")?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed");const t=this.getAttribute("title");if(t){this.ensure(".c-sidebar__title",()=>{const t=document.createElement("div");return t.className="c-sidebar__title",t}).textContent=t}else{const t=this.querySelector(".c-sidebar__title");t&&t.remove()}const e=this.hasAttribute("collapsed"),s=this.ensure(".c-sidebar__toggle",()=>{const t=document.createElement("button");return t.className="c-sidebar__toggle",t.type="button",t});s.setAttribute("aria-label",e?"Expand sidebar":"Collapse sidebar"),s.setAttribute("aria-pressed",String(e)),L(s,e?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-down" /></svg>');const r=this.getAttribute("items");if(r)try{const t=JSON.parse(r),e=this.ensure("nav.c-sidebar__nav",()=>{const t=document.createElement("nav");return t.className="c-sidebar__nav",t});e.innerHTML="",t.forEach((t,s)=>{const r=document.createElement("a");r.className="c-sidebar__link",r.href=v(t&&t.href||"#"),r.textContent=t&&(t.label||t)||"",r.tabIndex=0===s?0:-1,e.appendChild(r)})}catch(t){f(this,"attribute",t)}}enhance(){this._wiredSidebar||(this._wiredSidebar=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-sidebar__toggle"):null;e&&this.contains(e)&&(this.toggleAttribute("collapsed"),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{collapsed:this.hasAttribute("collapsed")}})))}),this.addEventListener("keydown",t=>{const e=this.querySelector("nav.c-sidebar__nav");if(!e)return;const s=Array.from(e.querySelectorAll(".c-sidebar__link"));s.length&&z(t,s,{wrap:!0,homeEnd:!0,onNavigate:t=>{s.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e){const e=document.activeElement;e&&(t.preventDefault(),e.click())}}})}))}});c("contour-toolbar",class extends T{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 t=this.getAttribute("title");this.setAttribute("role","toolbar"),t&&this.setAttribute("aria-label",t);const e=this.getAttribute("actions");if(e)try{const t=JSON.parse(e),s=this.overflow&&this.overflow>0?this.overflow:t.length,r=t.slice(0,s),i=t.slice(s);if(r.forEach((t,e)=>{const s=document.createElement("button");s.className="c-toolbar__btn",s.type="button",s.tabIndex=0===e?0:-1,s.textContent="string"==typeof t?t:t.label||t,("string"==typeof t||t&&t.label)&&s.classList.add("c-toolbar__btn--text"),this.appendChild(s)}),i.length){const t=document.createElement("div");t.className="c-toolbar__overflow";const e=document.createElement("button");e.className="c-toolbar__btn c-toolbar__overflow-btn",e.type="button",e.tabIndex=-1,e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","false"),e.textContent="…",e.setAttribute("aria-label",k(this,"more-options","More options")),t.appendChild(e);const s=document.createElement("div");s.className="c-toolbar__overflow-menu",s.setAttribute("role","menu"),s.setAttribute("hidden",""),i.forEach(t=>{const e=document.createElement("button");e.className="c-toolbar__btn",e.type="button",e.setAttribute("role","menuitem"),e.textContent="string"==typeof t?t:t.label||t,s.appendChild(e)}),t.appendChild(s),this.appendChild(t)}}catch(t){f(this,"attribute",t)}}enhance(){this._wiredToolbar||(this._wiredToolbar=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-toolbar__overflow-btn"):null;if(e&&this.contains(e)){const t=e.parentElement&&e.parentElement.querySelector(".c-toolbar__overflow-menu");if(t){const s=t.hasAttribute("hidden");s?t.removeAttribute("hidden"):t.setAttribute("hidden",""),e.setAttribute("aria-expanded",String(s)),e.tabIndex=s?-1:0;const r=Array.from(t.querySelectorAll("[role='menuitem']"));if(r.forEach((t,e)=>t.tabIndex=s&&0===e?0:-1),s)try{r[0]?.focus()}catch(t){}}return}const s=t.target&&t.target.closest?t.target.closest(".c-toolbar__btn"):null;s&&this.contains(s)&&this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0,detail:{label:s.textContent.trim()}}))}),this.addEventListener("keydown",t=>{if("Escape"===t.key){const e=this.querySelector(".c-toolbar__overflow-menu:not([hidden])");if(e){e.setAttribute("hidden","");const s=this.querySelector(".c-toolbar__overflow-btn");return s&&(s.setAttribute("aria-expanded","false"),s.tabIndex=0,s.focus()),void t.preventDefault()}}const e=this.querySelector(".c-toolbar__overflow-menu:not([hidden])");if(e){const s=Array.from(e.querySelectorAll("[role='menuitem']"));if(s.length)return void z(t,s,{wrap:!0,homeEnd:!0,onNavigate:t=>{s.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e||" "===e){const e=document.activeElement;e&&(t.preventDefault(),e.click())}}})}const s=Array.from(this.querySelectorAll(":scope > .c-toolbar__btn"));s.length&&z(t,s,{wrap:!0,homeEnd:!0,onNavigate:t=>{s.forEach((e,s)=>e.tabIndex=s===t?0:-1)},onKey:e=>{if("Enter"===e||" "===e){const e=document.activeElement;if(e)if(t.preventDefault(),e.classList.contains("c-toolbar__overflow-btn")){const t=e.parentElement&&e.parentElement.querySelector(".c-toolbar__overflow-menu");if(t){const s=t.hasAttribute("hidden");s?t.removeAttribute("hidden"):t.setAttribute("hidden",""),e.setAttribute("aria-expanded",String(s)),e.tabIndex=s?-1:0;const r=Array.from(t.querySelectorAll("[role='menuitem']"));if(r.forEach((t,e)=>t.tabIndex=s&&0===e?0:-1),s)try{r[0]?.focus()}catch(t){}}}else e.click()}}})}),this.addEventListener("focusout",t=>{if(!this.contains(t.relatedTarget)){const t=this.querySelector(".c-toolbar__overflow-menu:not([hidden])");if(t){t.setAttribute("hidden","");const e=this.querySelector(".c-toolbar__overflow-btn");e&&e.setAttribute("aria-expanded","false")}}}))}});c("contour-tree",class extends T{static get updateMode(){return"keyed"}static get observed(){return["items","virtual","item-height","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","persist","selectable","cache-key","no-cache","density"]}static get properties(){return{items:{attribute:"items"},src:{attribute:"src"},"item-height":{attribute:"item-height"}}}_itemHeight(){const t=Number(this.getAttribute("item-height"));return Number.isFinite(t)&&t>0?t:y("--virtual-list-item-height",28)}_labelToPaths(t,e,s){(t||[]).forEach((t,r)=>{const i=e+"."+r,a=String(t.label||t).trim().slice(0,120);s.has(a)||s.set(a,[]),s.get(a).push(i),Array.isArray(t.children)&&this._labelToPaths(t.children,i,s)})}_restoreExpanded(){const t=this.getAttribute("persist");if(!t||!this._treeData)return;let e=null;try{if("storage"===t&&this.id){const t=localStorage.getItem("contour-tree:"+this.id);null!==t&&(e=JSON.parse(t))}else if("url"===t){const t=new URLSearchParams(window.location.search).get("c-tree");null!==t&&(e=JSON.parse(t))}}catch(t){e=null}if(!Array.isArray(e))return;const s=new Set(e.map(t=>String(t))),r=new Map;this._labelToPaths(this._treeData,"",r);const i=this._expanded||(this._expanded=new Set);for(const t of s){const e=r.get(t);e&&e.forEach(t=>i.add(t))}}_persistExpanded(){const t=this.getAttribute("persist");if(!t||!this._expanded)return;const e=new Map,s=(t,r)=>{(t||[]).forEach((t,i)=>{const a=r+"."+i;e.set(a,t),Array.isArray(t.children)&&s(t.children,a)})};s(this._treeData,"");const r=[];for(const t of this._expanded){const s=e.get(t);s&&r.push(String(s.label||s).trim().slice(0,120))}try{if("storage"===t&&this.id)localStorage.setItem("contour-tree:"+this.id,JSON.stringify(r));else if("url"===t){const t=new URL(window.location.href);t.searchParams.set("c-tree",JSON.stringify(r)),window.history.replaceState(null,"",t.toString())}}catch(t){}}_flatten(t,e,s,r,i){(t||[]).forEach((t,a)=>{const n=e+"."+a,o=Array.isArray(t.children)&&t.children.length>0,c=r.has(n);i.push({node:t,path:n,depth:s,hasChildren:o,expanded:c}),o&&c&&this._flatten(t.children,n,s+1,r,i)})}_renderNodeFlat(t,e,s,r){const i=e.node,a=e.depth,n=document.createElement("div");if(n.className="c-tree__node",n.setAttribute("role","treeitem"),n.setAttribute("aria-level",String(a)),n.setAttribute("aria-setsize",String(s)),n.setAttribute("aria-posinset",String(r)),n.dataset.path=e.path,e.hasChildren){n.setAttribute("aria-expanded",String(e.expanded));const t=document.createElement("div");t.className="c-tree__row"+(i.active?" c-tree__row--active":"")+(i.dir?" c-tree__row--dir":""),t.style.paddingInlineStart=`calc(${a-1} * 1rem * var(--density, 1))`;const s=document.createElement("button");s.className="c-tree__toggle",s.setAttribute("type","button"),s.setAttribute("aria-expanded",String(e.expanded)),s.setAttribute("aria-label",k(this,"toggle","Toggle")),L(s,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),t.appendChild(s);const r=document.createElement("span");r.textContent=i.label,t.appendChild(r),n.appendChild(t)}else{const t=document.createElement("div");if(t.className="c-tree__leaf"+(i.active?" c-tree__row--active":"")+(i.dir?" c-tree__row--dir":""),t.style.paddingInlineStart=`calc(${a} * 1rem * var(--density, 1))`,this.hasAttribute("selectable")){const s=document.createElement("input");s.type="checkbox",s.className="c-tree__select",s.setAttribute("aria-label",k(this,"select","Select")+" "+(i.label||i)),this._selectedTree&&this._selectedTree.has(e.path)&&(s.checked=!0),t.insertBefore(s,t.firstChild)}t.appendChild(document.createTextNode(i.label||i)),n.appendChild(t)}return n}_renderWindow(t,e){if(!this._treeData)return;const s=this._itemHeight(),r=this._expanded||(this._expanded=new Set),i=[];this._flatten(this._treeData,"",1,r,i);const a=i.length,n=t.clientHeight||320,o=Math.ceil(n/s)+6;let c=Math.floor((e||0)/s);c<0&&(c=0),c>Math.max(0,a-o)&&(c=Math.max(0,a-o));const l=Math.min(a,c+o),u=c*s,d=Math.max(0,(a-l)*s);L(t,"");const h=document.createElement("div");h.className="c-tree__spacer c-tree__spacer--top",h.style.height=u+"px",t.appendChild(h);const m=new Map;i.forEach((t,e)=>{const s=t.path.includes(".")?t.path.slice(0,t.path.lastIndexOf(".")):"";let r=m.get(s);r||(r=[],m.set(s,r)),r.push(e)});for(let e=c;e<l;e++){const s=i[e],r=s.path.includes(".")?s.path.slice(0,s.path.lastIndexOf(".")):"",a=m.get(r);t.appendChild(this._renderNodeFlat(t,s,a.length,a.indexOf(e)+1))}const b=document.createElement("div");b.className="c-tree__spacer c-tree__spacer--bottom",b.style.height=d+"px",t.appendChild(b)}render(){this.classList.add("c-tree");const t=Array.from(this.children).filter(t=>!t.classList||!t.classList.contains("c-tree"));if(Zt(this),$t(this,"items"),Xt(this,"tree"))return;const e=Jt(this,"items");if(e&&!t.length)try{const t=JSON.parse(e),s=this.ensure("div.c-tree",()=>{const t=document.createElement("div");return t.className="c-tree",t.setAttribute("role","tree"),t});L(s,""),s.className="c-tree",s.setAttribute("role","tree");if(this.hasAttribute("virtual")){this._treeData=t,this._expanded=this._expanded||new Set,this._treeRoot=s,this._restoreExpanded(),s.style.maxHeight=s.style.maxHeight||"24rem",s.style.overflow="auto";const e=this._treeScrollTop||0;this._renderWindow(s,e);try{s.scrollTop=e}catch(t){}}else{this._treeData=null;const e=(t,r,i,a)=>{const n=r?document.createElement("div"):s;r&&(n.className="c-tree__children",n.setAttribute("role","group"),R()?n.setAttribute("hidden","until-found"):n.setAttribute("hidden","")),t.forEach((s,r)=>{const o=(a||"")+"."+r,c=document.createElement("div");if(c.className="c-tree__node",c.setAttribute("role","treeitem"),c.setAttribute("aria-level",String(i)),c.setAttribute("aria-setsize",String(t.length)),c.setAttribute("aria-posinset",String(r+1)),c.dataset.path=o,s.children){c.setAttribute("aria-expanded","false");const t=document.createElement("div");if(t.className="c-tree__row"+(s.active?" c-tree__row--active":"")+(s.dir?" c-tree__row--dir":""),s.indent){const e=document.createElement("span");e.className="c-tree__indent",e.style.inlineSize=1*s.indent+"rem",t.appendChild(e)}const r=document.createElement("button");r.className="c-tree__toggle",r.setAttribute("type","button"),r.setAttribute("aria-expanded","false"),r.setAttribute("aria-label",k(this,"toggle","Toggle")),L(r,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),t.appendChild(r);const a=document.createElement("span");a.textContent=s.label,t.appendChild(a),c.appendChild(t),e(s.children,c,i+1,o)}else{const t=document.createElement("div");if(t.className="c-tree__leaf"+(s.active?" c-tree__row--active":"")+(s.dir?" c-tree__row--dir":""),s.indent){const e=document.createElement("span");e.className="c-tree__indent",e.style.inlineSize=1*s.indent+"rem",t.appendChild(e)}if(this.hasAttribute("selectable")){const e=document.createElement("input");e.type="checkbox",e.className="c-tree__select",e.setAttribute("aria-label",k(this,"select","Select")+" "+(s.label||s)),this._selectedTree&&this._selectedTree.has(o)&&(e.checked=!0),t.insertBefore(e,t.firstChild)}t.appendChild(document.createTextNode(s.label||s)),c.appendChild(t)}n.appendChild(c)}),r&&r.appendChild(n)};e(t,null,1,"")}this.classList.remove("c-tree"),s.classList.add("c-tree"),s.parentNode!==this&&this.appendChild(s)}catch(t){f(this,"attribute",t)}else e||t.length||Yt(this,"tree")}enhance(){if(this._wiredTreeToggle||(this._wiredTreeToggle=!0,this.addEventListener("click",t=>{if(!this.hasAttribute("virtual"))return;let e=t.target&&t.target.closest?t.target.closest(".c-tree__toggle"):null;if(!e){const s=t.target&&t.target.closest?t.target.closest(".c-tree__row"):null;s&&(e=s.querySelector(":scope > .c-tree__toggle"))}if(!e||!this.contains(e))return;t.stopPropagation();const s=e.closest(".c-tree__node"),r=s&&s.dataset?s.dataset.path:null,i="true"===e.getAttribute("aria-expanded");r&&this._expanded&&(i?this._expanded.delete(r):this._expanded.add(r)),e.setAttribute("aria-expanded",String(!i));const a=e.closest(".c-tree__row");if(a&&a.setAttribute("aria-expanded",String(!i)),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{path:r,expanded:!i}})),this.hasAttribute("virtual")&&this._treeRoot){const t=this._treeRoot;this._treeScrollTop=t.scrollTop||0,this._renderWindow(t,this._treeScrollTop);try{t.scrollTop=this._treeScrollTop}catch(t){}this._persistExpanded()}})),this.hasAttribute("virtual")&&!this._wiredTreeScroll){this._wiredTreeScroll=!0;const t=()=>{const t=this.querySelector(".c-tree");if(!t||t._treeScrollWired)return;t._treeScrollWired=!0;let e=0;const s=()=>{e||(e=requestAnimationFrame(()=>{e=0,this._treeScrollTop=t.scrollTop||0,this._renderWindow(t,this._treeScrollTop);try{t.scrollTop=this._treeScrollTop}catch(t){}}))};t.addEventListener("scroll",s,{passive:!0}),i(this,()=>{t.removeEventListener("scroll",s),e&&cancelAnimationFrame(e)})};if(t(),!this.querySelector(".c-tree")){const e=new MutationObserver(()=>{this.querySelector(".c-tree")&&(t(),e.disconnect())});e.observe(this,{childList:!0,subtree:!0}),i(this,()=>e.disconnect())}}if(this.hasAttribute("virtual")&&!this._wiredTreeDragScroll){this._wiredTreeDragScroll=!0;let t=0,e=0;const s=()=>{if(!e)return void(t=0);const r=this._treeRoot;r&&(r.scrollTop+=8*e,this._treeScrollTop=r.scrollTop,this._renderWindow(r,this._treeScrollTop)),t=requestAnimationFrame(s)};this.addEventListener("dragover",r=>{const i=this._treeRoot;if(!i)return;const a=i.getBoundingClientRect();e=r.clientY<a.top+40?-1:r.clientY>a.bottom-40?1:0,e&&!t&&(t=requestAnimationFrame(s))});const r=()=>{e=0,t&&(cancelAnimationFrame(t),t=0)};this.addEventListener("dragend",r),this.addEventListener("drop",r)}ft(this)}});c("contour-filter-bar",class extends T{static get observed(){return["label","divider","items","input","placeholder","mode","modes","scope","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","count","clearable","cache-key","no-cache"]}static get properties(){return{label:{attribute:"label"},divider:{attribute:"divider"},items:{attribute:"items"},src:{attribute:"src"},count:{attribute:"count"},clearable:{attribute:"clearable"},scope:{attribute:"scope"}}}render(){if(this.classList.add("c-filter-bar"),Zt(this),$t(this,"items"),Xt(this,"filter-bar"))return;const t=this.getAttribute("label");if(t){this.ensure(".c-filter-bar__label",()=>{const t=document.createElement("span");return t.className="c-filter-bar__label",t}).textContent=t}else{const t=this.querySelector(".c-filter-bar__label");t&&t.remove()}if(this.hasAttribute("divider"))this.ensure(".c-filter-bar__divider",()=>{const t=document.createElement("span");return t.className="c-filter-bar__divider",t});else{const t=this.querySelector(".c-filter-bar__divider");t&&t.remove()}if(this.hasAttribute("input")||this.hasAttribute("placeholder")){let t=this.querySelector(".c-filter-bar__input");t||(t=document.createElement("input"),t.type="search",t.className="c-filter-bar__input",this.appendChild(t));const e=this.getAttribute("placeholder");e&&t.setAttribute("placeholder",e)}else{const t=this.querySelector(".c-filter-bar__input");t&&t.remove()}const e=this.getAttribute("modes");let s=null;if(e)try{s=JSON.parse(e)}catch(t){s=e.split(",").map(t=>t.trim())}if(s||this.hasAttribute("mode")){let e=this.querySelector(".c-filter-bar__modes");e||(e=document.createElement("div"),e.className="c-filter-bar__modes",e.setAttribute("role","toolbar"),e.setAttribute("aria-label",t||"Filter modes"),this.appendChild(e)),L(e,"");const r=this.getAttribute("mode");(Array.isArray(s)?s:["draw","erase","select"]).forEach(t=>{const s="string"==typeof t?t:t.label||t.value||t,i="string"==typeof t?t:t.value||t.label||t,a=document.createElement("button");a.type="button",a.className="c-filter-bar__mode",a.textContent=s,a.dataset.mode=i,r&&r===i&&a.setAttribute("aria-pressed","true"),e.appendChild(a)})}else{const t=this.querySelector(".c-filter-bar__modes");t&&t.remove()}const r=this.getAttribute("scope");if("viewport"===r||"global"===r){Array.from(this.querySelectorAll(".c-filter-bar__scope")).forEach(t=>t.remove());const t=document.createElement("div");t.className="c-filter-bar__modes c-filter-bar__scope",t.setAttribute("role","toolbar"),t.setAttribute("aria-label",k(this,"data-scope","Data scope")),["viewport","global"].forEach(e=>{const s=document.createElement("button");s.type="button",s.className="c-filter-bar__mode c-filter-bar__scope-btn",s.textContent="viewport"===e?"Viewport":"Global",s.dataset.scope=e,r===e&&s.setAttribute("aria-pressed","true"),t.appendChild(s)}),this.appendChild(t)}else{const t=this.querySelector(".c-filter-bar__scope");t&&t.remove()}Array.from(this.querySelectorAll(".c-filter-pill")).forEach(t=>t.remove());const i=Jt(this,"items"),a=Array.from(this.querySelectorAll(":scope > .c-filter-pill"));let n=null;if(a.length)n=a.map(t=>t.textContent.trim()),a.forEach(t=>t.remove());else if(i)try{n=JSON.parse(i)}catch(t){n=null}if(Array.isArray(n)&&n.forEach(t=>{const e=document.createElement("span");e.className="c-filter-pill";const s="object"==typeof t&&null!==t,r="string"==typeof t?t:t.label||t.value||"",i=s?t.key:null,a=s?t.value:t;if(null!=i&&""!==i&&e.setAttribute("key",String(i)),null!=a&&""!==a&&e.setAttribute("value",String(a)),e.textContent=r,!s||!1!==t.removable){const t=document.createElement("button");t.className="c-filter-pill__remove",t.type="button",t.setAttribute("aria-label",k(this,"remove","Remove")+" "+r),t.textContent="×",e.appendChild(t)}this.appendChild(e)}),Array.from(this.querySelectorAll(".c-filter-bar__clear-all")).forEach(t=>t.remove()),this.hasAttribute("clearable")){const t=document.createElement("button");t.type="button",t.className="c-btn c-btn--ghost c-btn--sm c-filter-bar__clear-all";const e=this.getAttribute("count");L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-x" /></svg>'),t.appendChild(document.createTextNode(" "+(e?k(this,"clear-all","Clear all")+" ("+e+")":k(this,"clear-all","Clear all")))),this.appendChild(t)}n||t||Yt(this,"filter-bar")}enhance(){if(xt(this),this._wiredFilterBar)return;this._wiredFilterBar=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-filter-bar__mode"):null;if(e&&this.contains(e))if(e.classList.contains("c-filter-bar__scope-btn")){const t=e.dataset.scope||null;Array.from(this.querySelectorAll(".c-filter-bar__scope-btn")).forEach(t=>t.setAttribute("aria-pressed",String(t===e))),t&&this.setAttribute("scope",t),this.dispatchEvent(new CustomEvent("contour:scope-change",{bubbles:!0,composed:!0,detail:{scope:t}}))}else{const t=e.dataset.mode||e.textContent.trim();Array.from(this.querySelectorAll(".c-filter-bar__mode:not(.c-filter-bar__scope-btn)")).forEach(t=>t.setAttribute("aria-pressed",String(t===e))),this.dispatchEvent(new CustomEvent("contour:mode-change",{bubbles:!0,composed:!0,detail:{mode:t}}))}}),this.addEventListener("keydown",t=>{z(t,Array.from(this.querySelectorAll(".c-filter-bar__mode")),{wrap:!1,onKey:()=>{document.activeElement.click()}})});const t=this.querySelector(".c-filter-bar__input");t&&!t._wiredFilterInput&&(t._wiredFilterInput=!0,t.addEventListener("input",()=>{this.dispatchEvent(new CustomEvent("contour:input",{bubbles:!0,composed:!0,detail:{value:t.value}}))}),t.addEventListener("change",()=>{this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t.value}}))})),this._wiredClearAll||(this._wiredClearAll=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-filter-bar__clear-all"):null;e&&this.contains(e)&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:clear-all",{bubbles:!0,composed:!0,detail:{}})))}))}});c("contour-command",class extends T{static get observed(){return["placeholder","items","recent","empty","loading","error","retry","src","lazy","refresh","timeout","skeleton","cache-key","no-cache","anchor"]}static get properties(){return{placeholder:{attribute:"placeholder"},items:{attribute:"items"},recent:{attribute:"recent"},empty:{attribute:"empty"},src:{attribute:"src"}}}render(){if(this.classList.add("c-command"),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"command-palette","Command palette")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),Zt(this),$t(this,"items"),Xt(this,"command"))return;const t=this.getAttribute("placeholder")||"Search…",e=this.ensure(".c-command__input",()=>{const t=document.createElement("div");return t.className="c-command__input",t}),s=this.ensure(".c-command__field",()=>{const t=document.createElement("input");return t.className="c-command__field",t.type="text",t});e.contains(s)||e.appendChild(s),s.type="text",s.placeholder=t,s.setAttribute("aria-label",k(this,"command","Command")),s.setAttribute("role","combobox"),s.setAttribute("aria-autocomplete","list"),s.setAttribute("aria-expanded","true");const r=this.querySelector(".c-command__list");r&&!r.id&&(r.id=o("c-command-list")),r&&r.id&&s.setAttribute("aria-controls",r.id),this._applyCommandAnchor();const i=Jt(this,"items"),a=this.querySelector(".c-command__list"),n=a?Array.from(a.children).filter(t=>t.classList&&t.classList.contains("c-command__item")||t.classList&&t.classList.contains("c-command__group")):[];if(i&&!n.length)try{const t=JSON.parse(i),e=this.ensure(".c-command__list",()=>{const t=document.createElement("div");return t.className="c-command__list",t.setAttribute("role","listbox"),t.id=o("c-command-list"),t});e.setAttribute("role","listbox"),L(e,"");const s=this.getAttribute("recent");if(s)try{const t=JSON.parse(s),r=document.createElement("div");r.className="c-command__group";const i=document.createElement("div");i.className="c-command__group-title",i.textContent=k(this,"recent","Recent"),r.appendChild(i),t.forEach(t=>{const e=document.createElement("div");e.className="c-command__item",e.setAttribute("role","option");const s=document.createElement("div");s.className="c-command__item-body";const i=document.createElement("div");i.className="c-command__item-title",i.textContent="string"==typeof t?t:t.title||t.label||"",s.appendChild(i),e.appendChild(s),r.appendChild(e)}),e.appendChild(r)}catch(t){}t.forEach(t=>{if(t.group){const s=document.createElement("div");s.className="c-command__group";const r=document.createElement("div");r.className="c-command__group-title",r.textContent=t.group,s.appendChild(r);const i=document.createElement("div");if(i.className="c-command__item",i.setAttribute("role","option"),t.icon){const e=document.createElement("span");e.className="c-command__item-icon",e.textContent=t.icon,i.appendChild(e)}const a=document.createElement("div");if(a.className="c-command__item-body",t.title||t.label){const e=document.createElement("div");e.className="c-command__item-title",e.textContent=t.title||t.label,a.appendChild(e)}if(t.hint){const e=document.createElement("span");e.className="c-command__item-hint",e.textContent=t.hint,a.appendChild(e)}if(t.shortcut){const e=document.createElement("kbd");e.className="c-command__item-shortcut",e.textContent=t.shortcut,i.appendChild(e)}i.appendChild(a),s.appendChild(i),e.appendChild(s)}else{const s=document.createElement("div");if(s.className="c-command__item",s.setAttribute("role","option"),t.icon){const e=document.createElement("span");e.className="c-command__item-icon",e.textContent=t.icon,s.appendChild(e)}const r=document.createElement("div");if(r.className="c-command__item-body",t.title||t.label){const e=document.createElement("div");e.className="c-command__item-title",e.textContent=t.title||t.label,r.appendChild(e)}if(t.hint){const e=document.createElement("span");e.className="c-command__item-hint",e.textContent=t.hint,r.appendChild(e)}if(t.shortcut){const e=document.createElement("kbd");e.className="c-command__item-shortcut",e.textContent=t.shortcut,s.appendChild(e)}s.appendChild(r),e.appendChild(s)}})}catch(t){f(this,"attribute",t)}else!i&&r&&r.remove();const c=this.getAttribute("empty");if(c){const t=this.ensure(".c-command__empty",()=>{const t=document.createElement("div");return t.className="c-command__empty",t});t.textContent=c,t.hidden=this.querySelectorAll(".c-command__item").length>0}else{const t=this.querySelector(".c-command__empty");t&&t.remove()}this.ensure(".c-command__status",()=>{const t=document.createElement("div");return t.className="c-command__status",t.setAttribute("role","status"),t}).textContent="",i||r||Yt(this,"command")}_applyCommandAnchor(){const t=this.getAttribute("anchor"),e=t?t.startsWith("#")?document.getElementById(t.slice(1)):document.querySelector(t):null;if(this._commandAnchorEl&&this._commandAnchorEl!==e&&(this._commandAnchorEl.style.removeProperty("anchor-name"),this._commandAnchorEl.removeAttribute("aria-controls"),this._commandAnchorEl.removeAttribute("aria-expanded")),this._commandAnchorEl=e||null,e){const t="--command-"+this.id;e.style.setProperty("anchor-name",t),this.style.setProperty("position-anchor",t),e.setAttribute("aria-controls",this.id),this._commandAnchorDispose||(this._commandAnchorDispose=!0,i(this,()=>{this._commandAnchorEl&&(this._commandAnchorEl.style.removeProperty("anchor-name"),this._commandAnchorEl.removeAttribute("aria-controls"),this._commandAnchorEl.removeAttribute("aria-expanded")),this._commandAnchorDispose=!1}))}else this.style.removeProperty("position-anchor")}show(){if(this.matches(":popover-open"))return void(this.hasAttribute("open")||this.setAttribute("open",""));if("function"==typeof this.showPopover)try{this.showPopover()}catch(t){}this.classList.add("is-open");const t=this.querySelector(".c-command__field");t&&t.setAttribute("aria-expanded","true"),this.hasAttribute("open")||this.setAttribute("open",""),this._setCommandTriggerExpanded(!0)}hide(){if(!this.matches(":popover-open"))return void(this.hasAttribute("open")&&this.removeAttribute("open"));if("function"==typeof this.hidePopover)try{this.hidePopover()}catch(t){}this.classList.remove("is-open");const t=this.querySelector(".c-command__field");t&&t.setAttribute("aria-expanded","false"),this.hasAttribute("open")&&this.removeAttribute("open"),this._setCommandTriggerExpanded(!1)}toggle(){this.matches(":popover-open")?this.hide():this.show()}_setCommandTriggerExpanded(t){const e=this._commandAnchorEl;e&&(e.setAttribute("aria-controls",this.id),e.setAttribute("aria-expanded",String(!!t)))}enhance(){if(this._wiredCommand)return;this._wiredCommand=!0,this.addEventListener("beforetoggle",t=>{if("open"===t.newState){this.classList.add("is-open"),S(this,"contour:open",{});const e=this.querySelector(".c-command__field");if(e){e.setAttribute("aria-expanded","true");try{e.focus()}catch(t){}}this._setCommandTriggerExpanded(!0)}else this.classList.remove("is-open"),S(this,"contour:close",{}),this._setCommandTriggerExpanded(!1)}),this.addEventListener("toggle",t=>{"open"===t.newState&&requestAnimationFrame(()=>{this._applyCommandAnchor()})});const t=()=>this.querySelector(".c-command__field"),e=()=>Array.from(this.querySelectorAll(".c-command__item")),s=()=>e().filter(t=>!t.hidden&&!t.closest("[hidden]"));let r=-1;const i=()=>{if(s().forEach((e,s)=>{if(e.classList.toggle("c-command__item--active",s===r),e.setAttribute("aria-selected",String(s===r)),s===r){e.id||(e.id=o("contour-command-option"));const s=t();s&&s.setAttribute("aria-activedescendant",e.id)}}),r<0){const e=t();e&&e.removeAttribute("aria-activedescendant")}};this.addEventListener("keydown",a=>{const n=t();if(!n||a.target!==n)return;const o=s();if(o.length)if("ArrowDown"===a.key)a.preventDefault(),r=Math.min(r+1,o.length-1),i();else if("ArrowUp"===a.key)a.preventDefault(),r=Math.max(r-1,0),i();else if("Home"===a.key)a.preventDefault(),r=0,i();else if("End"===a.key)a.preventDefault(),r=o.length-1,i();else if("Enter"===a.key){if(a.preventDefault(),r>=0&&o[r]){const t=o[r],s=e().indexOf(t);this.dispatchEvent(new CustomEvent("contour:select",{detail:{index:s,label:t.textContent.trim()},bubbles:!0,composed:!0})),this.hide()}}else"Escape"===a.key&&this.hide()}),this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-command__item"):null;if(s&&this.contains(s)){const t=e().indexOf(s);this.dispatchEvent(new CustomEvent("contour:select",{detail:{index:t,label:s.textContent.trim()},bubbles:!0,composed:!0})),this.hide()}}),this.addEventListener("input",s=>{const a=t();if(!a||s.target!==a)return;const n=a.value.trim().toLowerCase(),o=e();let c=0;o.forEach(t=>{const e=!n||(t.textContent||"").toLowerCase().includes(n);t.hidden=!e,e&&(c+=1)}),this.querySelectorAll(".c-command__group").forEach(t=>{const e=Array.from(t.querySelectorAll(".c-command__item")).some(t=>!t.hidden);t.hidden=!e});const l=o.findIndex(t=>!t.hidden);r=l>=0?0:-1,i();const u=this.querySelector(".c-command__empty");u&&(u.hidden=0!==c);const d=this.querySelector(".c-command__status");d&&(d.textContent=n?`${c} of ${o.length}`:"")})}});c("contour-spatial-filter",class extends T{static get observed(){return["modes","mode","active","bounds","operator","loading","error","retry","cache-key","skeleton","src"]}static get properties(){return{modes:{attribute:"modes"},mode:{attribute:"mode"},active:{attribute:"active"},bounds:{attribute:"bounds"},operator:{attribute:"operator"}}}render(){if(this.classList.add("c-spatial-filter"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"spatial-filter","Spatial filter")),Zt(this),Xt(this,"spatial-filter"))return;const t=this.getAttribute("modes");let e=null;if(t)try{e=JSON.parse(t)}catch(s){e=t.split(",").map(t=>t.trim())}const s=Array.isArray(e)?e:["rect","circle","polygon","clear"];let r=this.querySelector(".c-spatial-filter__modes");r||(r=document.createElement("div"),r.className="c-spatial-filter__modes",r.setAttribute("role","toolbar"),r.setAttribute("aria-label",k(this,"spatial-filter-modes","Spatial filter modes")),this.appendChild(r)),L(r,"");const i=this.getAttribute("mode");i!==this._spatialSeenMode&&(this._spatialMode=null,this._spatialSeenMode=i);const a=null!=this._spatialMode?this._spatialMode:i;s.forEach(t=>{const e="string"==typeof t?t:t.label||t.value||t,s="string"==typeof t?t:t.value||t.label||t,i=document.createElement("button");i.type="button",i.className="c-spatial-filter__mode c-btn c-btn--ghost c-btn--sm";const n={rect:"i-square",circle:"i-circle",polygon:"i-triangle",lasso:"i-lasso",clear:"i-x"}[s];n&&L(i,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+n+'" /></svg>'),i.appendChild(document.createTextNode((n?" ":"")+e)),i.dataset.mode=s,a&&a===s&&i.setAttribute("aria-pressed","true"),r.appendChild(i)});let n=this.querySelector(".c-spatial-filter__operator");n||(n=document.createElement("div"),n.className="c-spatial-filter__operator",this.appendChild(n));const o=this.getAttribute("operator")||"intersects";L(n,"");const c=document.createElement("span");c.textContent=k(this,"operator","Operator")+":",n.appendChild(c);const l=document.createElement("select");l.className="c-spatial-filter__operator-select",l.setAttribute("aria-label",k(this,"operator","Operator")),l.setAttribute("data-contour-label","true"),["intersects","contains","within","disjoint"].forEach(t=>{const e=document.createElement("option");e.value=t,e.textContent=t,t===o&&e.setAttribute("selected",""),l.appendChild(e)}),n.appendChild(l);let u=this.querySelector(".c-spatial-filter__readout");u||(u=document.createElement("div"),u.className="c-spatial-filter__readout",this.appendChild(u));const d=this.getAttribute("bounds");u.textContent=d||"—";let h=this.querySelector(".c-spatial-filter__clear-all");h||(h=document.createElement("button"),h.type="button",h.className="c-spatial-filter__clear-all",this.appendChild(h)),q(h,this,"clear-all","Clear all");const m=this.hasAttribute("active");m!==this._spatialSeenActive&&(this._spatialActive=null,this._spatialSeenActive=m),(null!=this._spatialActive?this._spatialActive:m)?this.classList.add("c-spatial-filter--active"):this.classList.remove("c-spatial-filter--active")}enhance(){this._wiredSpatialFilter||(this._wiredSpatialFilter=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("button"):null;if(!e||!this.contains(e))return;if(e.classList.contains("c-spatial-filter__clear-all"))return this.classList.remove("c-spatial-filter--active"),Array.from(this.querySelectorAll(".c-spatial-filter__mode")).forEach(t=>t.setAttribute("aria-pressed","false")),this._spatialActive=!1,this._spatialMode=null,this.dispatchEvent(new CustomEvent("contour:clear",{bubbles:!0,composed:!0,detail:{}})),void this.dispatchEvent(new CustomEvent("contour:spatial-filter",{bubbles:!0,composed:!0,detail:{action:"clear-all"}}));const s=e.closest(".c-spatial-filter__mode");if(!s)return;const r=s.dataset.mode||s.textContent.trim();if("clear"===r)return this.classList.remove("c-spatial-filter--active"),Array.from(this.querySelectorAll(".c-spatial-filter__mode")).forEach(t=>t.setAttribute("aria-pressed","false")),this._spatialActive=!1,this._spatialMode=null,void this.dispatchEvent(new CustomEvent("contour:clear",{bubbles:!0,composed:!0,detail:{}}));this.classList.add("c-spatial-filter--active"),Array.from(this.querySelectorAll(".c-spatial-filter__mode")).forEach(t=>t.setAttribute("aria-pressed",String(t===s))),this._spatialActive=!0,this._spatialMode=r,this.dispatchEvent(new CustomEvent("contour:draw-start",{bubbles:!0,composed:!0,detail:{mode:r}})),this.dispatchEvent(new CustomEvent("contour:spatial-filter",{bubbles:!0,composed:!0,detail:{action:"draw-start",mode:r}}))}),this.addEventListener("change",t=>{const e=t.target;e&&e.classList.contains("c-spatial-filter__operator-select")&&(this.setAttribute("operator",e.value),this.dispatchEvent(new CustomEvent("contour:spatial-filter",{bubbles:!0,composed:!0,detail:{action:"operator",operator:e.value}})))}),this.addEventListener("keydown",t=>{z(t,Array.from(this.querySelectorAll(".c-spatial-filter__mode")),{wrap:!1,onKey:()=>{document.activeElement.click()}})}))}});c("contour-avatar",class extends T{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(t=>{t.startsWith("c-avatar--")&&this.classList.remove(t)});const t=this.getAttribute("name"),e=this.getAttribute("size");e&&this.classList.add("c-avatar--"+e);const s=this.getAttribute("variant");s&&this.classList.add("c-avatar--"+s);const r=this.querySelector("img.c-avatar__img");r&&r.remove();const i=this.querySelector(".c-avatar__status");i&&i.remove();const a=this.getAttribute("src");if(a){this.textContent="";const e=document.createElement("img");e.className="c-avatar__img",e.src=a,e.alt=t||"",e.loading="lazy",e.decoding="async",e.addEventListener("error",()=>{if(e.remove(),t){const e=t.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2);this.textContent=e}}),this.appendChild(e)}else if(t){const e=t.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2);this.querySelector("img.c-avatar__img"),this.textContent=e}const n=this.getAttribute("status");if(n){const t=document.createElement("span");t.className="c-avatar__status c-avatar__status--"+n,t.setAttribute("aria-hidden","true"),this.appendChild(t)}}});c("contour-badge",class extends T{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(t=>{t.startsWith("c-badge--")&&this.classList.remove(t)});const t=this.getAttribute("variant");t&&this.classList.add("c-badge--"+t);const e=this.getAttribute("size");e&&this.classList.add("c-badge--"+e);const s=this.getAttribute("label");if(s){let t=null;for(const e of this.childNodes)if(3===e.nodeType){t=e;break}t?t.nodeValue=s:this.insertBefore(document.createTextNode(s),this.firstChild)}if(w(this,"removable"))this.ensure(".c-badge__remove",()=>{const t=document.createElement("button");return t.className="c-badge__remove",t.type="button",t.setAttribute("aria-label",k(this,"remove","Remove")),t.textContent="×",t});else{const t=this.querySelector(".c-badge__remove");t&&t.remove()}}enhance(){xt(this)}});c("contour-chip",class extends T{static get observed(){return["variant","key","value","live"]}static get properties(){return{variant:{attribute:"variant"},key:{attribute:"key"},value:{attribute:"value"},live:{attribute:"live",type:Boolean}}}render(){this.classList.add("c-chip"),w(this,"live")&&!this.hasAttribute("role")?this.setAttribute("role","status"):!w(this,"live")&&"status"===this.getAttribute("role")&&this._autoChipRole&&this.removeAttribute("role"),this._autoChipRole=w(this,"live"),Array.from(this.classList).forEach(t=>{t.startsWith("c-chip--")&&this.classList.remove(t)});const t=this.getAttribute("variant");t&&this.classList.add("c-chip--"+t);const e=this.getAttribute("key"),s=this.getAttribute("value");if(e){this.ensure(".c-chip__key",()=>{const t=document.createElement("span");return t.className="c-chip__key",t}).textContent=e}else{const t=this.querySelector(".c-chip__key");t&&t.remove()}if(s){this.ensure(".c-chip__value",()=>{const t=document.createElement("span");return t.className="c-chip__value",t}).textContent=s}else{const t=this.querySelector(".c-chip__value");t&&t.remove()}}});c("contour-tag",class extends T{static get observed(){return["label","removable","variant","live"]}static get properties(){return{label:{attribute:"label"},removable:{attribute:"removable",type:Boolean},variant:{attribute:"variant"},live:{attribute:"live",type:Boolean}}}render(){this.classList.add("c-tag"),w(this,"live")&&!this.hasAttribute("role")?this.setAttribute("role","status"):!w(this,"live")&&"status"===this.getAttribute("role")&&this._autoTagRole&&this.removeAttribute("role"),this._autoTagRole=w(this,"live"),Array.from(this.classList).forEach(t=>{t.startsWith("c-tag--")&&this.classList.remove(t)});const t=this.getAttribute("variant");t&&this.classList.add("c-tag--"+t);const e=this.getAttribute("label");if(e){let t=null;for(const e of this.childNodes)if(3===e.nodeType){t=e;break}t?t.nodeValue=e+" ":this.insertBefore(document.createTextNode(e+" "),this.firstChild)}if(w(this,"removable"))this.ensure(".c-tag__remove",()=>{const t=document.createElement("button");return t.className="c-tag__remove",t.type="button",t.setAttribute("aria-label",k(this,"remove","Remove")),t.textContent="×",t});else{const t=this.querySelector(".c-tag__remove");t&&t.remove()}}enhance(){xt(this)}});c("contour-dot",class extends T{static get observed(){return["variant","live"]}static get properties(){return{variant:{attribute:"variant"},live:{attribute:"live",type:Boolean}}}render(){this.classList.add("c-dot"),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","status indicator"),Array.from(this.classList).forEach(t=>{t.startsWith("c-dot--")&&this.classList.remove(t)});const t=this.getAttribute("variant");t&&this.classList.add("c-dot--"+t),w(this,"live")?this.classList.add("c-dot--live"):this.classList.remove("c-dot--live")}});c("contour-pill",class extends T{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"),w(this,"live")&&!this.hasAttribute("role")?this.setAttribute("role","status"):!w(this,"live")&&"status"===this.getAttribute("role")&&this._autoPillRole&&this.removeAttribute("role"),this._autoPillRole=w(this,"live"),Array.from(this.classList).forEach(t=>{t.startsWith("c-pill--")&&this.classList.remove(t)});const t=this.getAttribute("variant");t&&this.classList.add("c-pill--"+t);const e=this.getAttribute("label");e&&(this.textContent=e),w(this,"live")?this.classList.add("c-pill--live"):this.classList.remove("c-pill--live")}});c("contour-kbd",class extends T{static get observed(){return["key"]}static get properties(){return{key:{attribute:"key"}}}render(){this.classList.add("c-kbd");const t=this.getAttribute("key");t&&(this.textContent=t)}});c("contour-spinner",class extends T{static get observed(){return["size"]}static get properties(){return{size:{attribute:"size"}}}render(){this.classList.add("c-spinner"),Array.from(this.classList).forEach(t=>{t.startsWith("c-spinner--")&&this.classList.remove(t)});const t=this.getAttribute("size");t&&this.classList.add("c-spinner--"+t),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"loading","Loading"))}});c("contour-skeleton",class extends T{static get observed(){return["size","shimmer"]}static get properties(){return{size:{attribute:"size"},shimmer:{attribute:"shimmer",type:Boolean}}}render(){this.classList.add("c-skeleton"),Array.from(this.classList).forEach(t=>{t.startsWith("c-skeleton--")&&this.classList.remove(t)});const t=this.getAttribute("size");t&&this.classList.add("c-skeleton--"+t),this.hasAttribute("aria-hidden")||this.setAttribute("aria-hidden","true");const e=this.getAttribute("shimmer");w(this,"shimmer")&&"off"!==e?this.classList.remove("c-skeleton--static"):this.classList.add("c-skeleton--static")}});c("contour-mark",class extends T{static get observed(){return["src","icon","label"]}static get properties(){return{src:{attribute:"src"},icon:{attribute:"icon"},label:{attribute:"label"}}}render(){this.classList.add("c-mark");const t=this.getAttribute("src")||this.getAttribute("icon");if(t){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),L(e,'<use href="'+v(t)+'" />'),this.appendChild(e)}const e=this.getAttribute("label");if(e&&!this.querySelector("[data-mark-label]")){const t=document.createElement("span");t.className="c-mark__label",t.setAttribute("data-mark-label",""),t.textContent=e,this.appendChild(t)}}});c("contour-loading",class extends T{static get observed(){return["label"]}static get properties(){return{label:{attribute:"label"}}}render(){this.classList.add("c-loading"),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"),this.ensure(".c-spinner",()=>{const t=document.createElement("span");return t.className="c-spinner",t.setAttribute("aria-hidden","true"),t});const t=this.getAttribute("label")||"Loading";let e=this.querySelector("[data-loading-label]");e||(e=document.createElement("span"),e.className="visually-hidden",e.setAttribute("data-loading-label",""),this.appendChild(e)),e.textContent=t,this.hasAttribute("aria-label")||this.setAttribute("aria-label",t)}});c("contour-elevation",class extends T{render(){this.classList.add("c-elevation")}});c("contour-filter-pill",class extends T{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 t=this.getAttribute("key"),e=this.getAttribute("value");if(t){this.ensure(".c-filter-pill__key",()=>{const t=document.createElement("span");return t.className="c-filter-pill__key",t}).textContent=t}else{const t=this.querySelector(".c-filter-pill__key");t&&t.remove()}if(e){this.ensure(".c-filter-pill__value",()=>{const t=document.createElement("span");return t.className="c-filter-pill__value",t}).textContent=e}else{const t=this.querySelector(".c-filter-pill__value");t&&t.remove()}if(w(this,"removable"))this.ensure(".c-filter-pill__remove",()=>{const t=document.createElement("button");return t.className="c-filter-pill__remove",t.type="button",t.setAttribute("aria-label",k(this,"remove-filter","Remove filter")),t.textContent="×",t});else{const t=this.querySelector(".c-filter-pill__remove");t&&t.remove()}}enhance(){xt(this)}});c("contour-datamark",class extends T{static get observed(){return["value","unit","label","format","locale"]}static get properties(){return{value:{attribute:"value"},unit:{attribute:"unit"},label:{attribute:"label"},format:{attribute:"format"},locale:{attribute:"locale"}}}render(){this.classList.add("c-datamark");const t=this.getAttribute("value"),e=this.getAttribute("unit"),s=this.getAttribute("label"),r=this.getAttribute("format"),i=this.getAttribute("locale"),a=t||s;if(a){const s=t?B(t,r,i,e):a;if(this.textContent=s,e&&t){const t=document.createElement("span");t.className="u-subtle",t.textContent=" "+e,this.appendChild(t)}}}});c("contour-destructive-hint",class extends T{static get observed(){return["text"]}static get properties(){return{text:{attribute:"text"}}}render(){this.classList.add("c-destructive-hint");const t=this.getAttribute("text");t&&(this.textContent=t)}});c("contour-icon-badge",class extends T{static get observed(){return["icon"]}static get properties(){return{icon:{attribute:"icon"}}}render(){this.classList.add("c-icon-badge");const t=this.getAttribute("icon");if(t){const e=String(t).replace(/[^a-zA-Z0-9_-]/g,"");e&&!e.startsWith("i-")&&"undefined"!=typeof console&&console.warn&&console.warn("ContourIconBadge: icon '"+t+"' may not exist in the sprite (expected i-* name).");const s=this.querySelector("svg"),r=s||document.createElementNS("http://www.w3.org/2000/svg","svg");if(s){const t=r.querySelector("use");t&&t.setAttribute("href","#"+e)}else{r.setAttribute("aria-hidden","true");const t=document.createElementNS("http://www.w3.org/2000/svg","use");t.setAttribute("href","#"+e),r.appendChild(t),this.appendChild(r)}}else{const t=this.querySelector("svg");t&&t.remove()}}});c("contour-live-badge",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","status"),Array.from(this.classList).forEach(t=>{t.startsWith("c-live-badge--")&&this.classList.remove(t)});const t=this.getAttribute("state");t?this.classList.add("c-live-badge--"+t):w(this,"live")&&this.classList.add("c-live-badge--connected");const e=this.getAttribute("label");e&&!this.hasChildNodes()&&(this.textContent=e)}});c("contour-skeleton-group",class extends T{static get observed(){return["count","size","shimmer"]}static get properties(){return{count:{attribute:"count",type:Number},size:{attribute:"size"},shimmer:{attribute:"shimmer",type:Boolean}}}render(){this.classList.add("c-skeleton-group");const t=Math.max(0,parseInt(this.getAttribute("count")||"3",10)||3),e=this.getAttribute("size"),s=this.getAttribute("shimmer");Array.from(this.querySelectorAll(".c-skeleton")).forEach(t=>t.remove());for(let r=0;r<t;r++){const t=document.createElement("div");t.className="c-skeleton",e&&t.classList.add("c-skeleton--"+e),t.setAttribute("aria-hidden","true"),w(this,"shimmer")&&"off"!==s?t.classList.remove("c-skeleton--static"):t.classList.add("c-skeleton--static"),this.appendChild(t)}}});c("contour-avatar-group",class extends T{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 t=this.getAttribute("items"),e=parseInt(this.getAttribute("max")||"4",10)||4;if(Array.from(this.querySelectorAll(".c-avatar, .c-avatar-group__overflow")).forEach(t=>t.remove()),t)try{const s=JSON.parse(t);if(s.slice(0,e).forEach(t=>{const e=document.createElement("span");e.className="c-avatar";const s="string"==typeof t?t:t.name||t.label||"";if(e.textContent=s.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2),"object"==typeof t&&t.color){const s=_(t.color);s&&(e.style.background=s,e.dataset.color=s)}this.appendChild(e)}),s.length>e){const t=document.createElement("span");t.className="c-avatar c-avatar-group__overflow";const r=s.length-e;t.textContent="+"+r,t.setAttribute("aria-label","+"+r+" more"),this.appendChild(t)}}catch(t){f(this,"attribute",t)}}});c("contour-divider",class extends T{static get observed(){return["label","orientation"]}static get properties(){return{label:{attribute:"label"},orientation:{attribute:"orientation"}}}render(){this.classList.add("c-divider"),this.hasAttribute("role")||this.setAttribute("role","separator");const t=this.getAttribute("orientation")||"horizontal";this.classList.add("c-divider--"+t);const e=this.getAttribute("label");if(e){this.ensure(".c-divider__label",()=>{const t=document.createElement("span");return t.className="c-divider__label",t}).textContent=e}}});c("contour-status-light",class extends T{static get observed(){return["status","label"]}static get properties(){return{status:{attribute:"status"},label:{attribute:"label"}}}render(){this.classList.add("c-status-light");const t=this.getAttribute("status")||"neutral";this.classList.add("c-status-light--"+t),this.hasAttribute("role")||this.setAttribute("role","img");const e=this.getAttribute("label");if(e&&!this.hasAttribute("aria-label")?this.setAttribute("aria-label",e):e||this.hasAttribute("aria-label")||this.setAttribute("aria-label",t),e){this.ensure(".c-status-light__label",()=>{const t=document.createElement("span");return t.className="c-status-light__label",t}).textContent=e}}});c("contour-badge-overflow",class extends T{static get observed(){return["count","max"]}static get properties(){return{count:{attribute:"count"},max:{attribute:"max"}}}render(){this.classList.add("c-badge-overflow");const t=Number(this.getAttribute("count")||0),e=Number(this.getAttribute("max")||3),s=Math.max(0,t-e),r=this.querySelector(".c-badge-overflow__more");if(r&&r.remove(),s>0){const t=document.createElement("span");t.className="c-badge c-badge-overflow__more",t.textContent="+"+s,this.appendChild(t)}}});c("contour-tooltip",class extends T{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"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"tooltip","Tooltip")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),this.hasAttribute("role")||this.setAttribute("role","tooltip"),this.id||(this.id=o("tip"));const t=this.getAttribute("text");null===t||this.hasChildNodes()||(this.textContent=t)}enhance(){if(this._wiredTooltip)return;this._wiredTooltip=!0;const t=this.getAttribute("anchor");if(t){let e=null;e=t.startsWith("#")?document.getElementById(t.slice(1)):document.querySelector(t),e&&(e.setAttribute("popovertarget",this.id||(this.id=o("tip"))),e.setAttribute("aria-describedby",this.id))}const e=this.delay&&this.delay>0?this.delay:0,s=this.getAttribute("anchor");let r=null;s&&(r=s.startsWith("#")?document.getElementById(s.slice(1)):document.querySelector(s));const a="--tooltip-"+(this.id||(this.id=o("tip")));(()=>{r&&(r.style.setProperty("anchor-name",a),this.style.setProperty("position-anchor",a),this.style.setProperty("position-area","top"))})();const n="function"==typeof this.showPopover;let c=null,l=null;const u=()=>{if(n)try{this.showPopover()}catch(t){}else this.classList.add("is-open"),this.style.zIndex="var(--z-tooltip)";try{requestAnimationFrame(x)}catch(t){x()}},d=()=>{if(l&&(clearTimeout(l),l=null),n)try{this.hidePopover()}catch(t){}else this.classList.remove("is-open"),this.style.removeProperty("z-index")},h=()=>{c&&clearTimeout(c),e>0?c=setTimeout(u,e):u()},m=()=>{c&&(clearTimeout(c),c=null),l&&clearTimeout(l),l=setTimeout(d,300)};this.addEventListener("pointerenter",()=>{l&&(clearTimeout(l),l=null)}),this.addEventListener("pointerleave",m),i(this,()=>{r&&r.style.removeProperty("anchor-name")});const b=this.getAttribute("trigger")||"hover",p=s?s.startsWith("#")?document.getElementById(s.slice(1)):document.querySelector(s):null,g=p||this,_=()=>{"click"!==b&&h()},v=()=>{"click"!==b&&m()},y=()=>{"click"!==b&&h()},f=()=>{"click"!==b&&m()},A=t=>{p&&p.hasAttribute("popovertarget")?"click"!==b&&t&&t.preventDefault&&t.preventDefault():"click"!==b&&"hover"!==b||(this.matches(":popover-open")?m():h())},E=()=>{"click"!==b&&h()},w=()=>{"click"!==b&&setTimeout(m,1500)};g.addEventListener("mouseenter",_),g.addEventListener("mouseleave",v),g.addEventListener("focus",y),g.addEventListener("blur",f),g.addEventListener("click",A),g.addEventListener("touchstart",E,{passive:!0}),g.addEventListener("touchend",w,{passive:!0});const x=()=>{try{const t=this.getBoundingClientRect();t.right>window.innerWidth?this.classList.add("c-tooltip--flip-x"):this.classList.remove("c-tooltip--flip-x"),t.bottom>window.innerHeight?this.classList.add("c-tooltip--flip-y"):this.classList.remove("c-tooltip--flip-y")}catch(t){}};i(this,()=>{g.removeEventListener("mouseenter",_),g.removeEventListener("mouseleave",v),g.removeEventListener("focus",y),g.removeEventListener("blur",f),g.removeEventListener("click",A),g.removeEventListener("touchstart",E),g.removeEventListener("touchend",w),c&&clearTimeout(c)}),this.addEventListener("toggle",t=>{const e=t.target;if(e&&e===this){const t=this.matches(":popover-open");S(this,t?"contour:open":"contour:close",{open:t})}})}});c("contour-progress",class extends T{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 t=this.getAttribute("value"),e=this.getAttribute("min"),s=this.getAttribute("max"),r=null!==e?Number(e):0,i=null!==s?Number(s):100,a=i-r||1;if(null===t)this.style.removeProperty("--progress"),this.classList.add("c-progress--indeterminate"),this.getAttribute("aria-valuenow")===this._progressAriaValue&&this.removeAttribute("aria-valuenow"),this._progressAriaValue=null;else{this.classList.remove("c-progress--indeterminate");const e=Number(t);let s;s=Number.isFinite(e)?e<=1&&t.includes(".")?100*e:(e-r)/a*100:0,s=Math.max(0,Math.min(100,s)),this.style.setProperty("--progress",s+"%"),this.classList.toggle("c-progress--complete",s>=100);const n=Number.isFinite(e)?Math.max(r,Math.min(i,e)):r,o=this._progressAriaValue;this.hasAttribute("aria-valuenow")&&this.getAttribute("aria-valuenow")!==o||(this.setAttribute("aria-valuenow",String(n)),this._progressAriaValue=String(n))}this.ensure(".c-progress__bar",()=>{const t=document.createElement("span");return t.className="c-progress__bar",t}),this.hasAttribute("role")||this.setAttribute("role","progressbar");const n=this.getAttribute("label");if(this.hasAttribute("aria-label")||this.setAttribute("aria-label",n||"Progress"),null!==e?this.setAttribute("aria-valuemin",e):this.hasAttribute("aria-valuemin")||this.setAttribute("aria-valuemin","0"),null!==s?this.setAttribute("aria-valuemax",s):this.hasAttribute("aria-valuemax")||this.setAttribute("aria-valuemax","100"),this.hasAttribute("aria-valuenow")){const t=Number(this.getAttribute("aria-valuenow"));Number.isFinite(t)&&this.setAttribute("aria-valuenow",String(Math.max(r,Math.min(i,t))))}if(w(this,"paused")?this.classList.add("c-progress--paused"):Array.from(this.classList).forEach(t=>{"c-progress--paused"===t&&this.classList.remove(t)}),w(this,"pausable")){const t=w(this,"paused"),e=this.ensure(".c-progress__pause",()=>{const t=document.createElement("button");return t.className="c-progress__pause",t.type="button",t});e.setAttribute("aria-label",t?"Resume":"Pause"),e.textContent=t?"▶":"⏸"}else{const t=this.querySelector(".c-progress__pause");t&&t.remove()}}enhance(){this._wiredProgress||(this._wiredProgress=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-progress__pause"):null;if(!e||!this.contains(e))return;t.preventDefault();const s=!w(this,"paused");this.toggleAttribute("paused",s),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{paused:s}}))}))}});c("contour-version-banner",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("message")||"Version banner"),Array.from(this.children).forEach(t=>t.remove());const t=this.getAttribute("message");if(t){const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true"),L(e,'<use href="#i-info" />'),this.appendChild(e);const s=document.createElement("span");s.textContent=t,this.appendChild(s)}const e=this.getAttribute("link"),s=this.getAttribute("href");if(e&&s){const t=document.createElement("a");t.className="c-version-banner__link",t.href=v(s),t.textContent=e,this.appendChild(t)}if(w(this,"dismissible")){const t=document.createElement("button");t.className="c-version-banner__dismiss",t.type="button",t.setAttribute("aria-label",k(this,"dismiss","Dismiss")),t.textContent="×",this.appendChild(t)}}enhance(){this._wiredVersionBanner||(this._wiredVersionBanner=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-version-banner__dismiss"):null;e&&this.contains(e)&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})),this.remove())}))}});c("contour-banner",class extends T{static get observed(){return["message","variant"]}static get properties(){return{message:{attribute:"message"},variant:{attribute:"variant"}}}render(){this.classList.add("c-banner");const t=this.getAttribute("variant");Array.from(this.classList).forEach(t=>{t.startsWith("c-banner--")&&this.classList.remove(t)}),t&&["info","success","warning","danger","error"].includes(t)&&this.classList.add("c-banner--"+t);const e=C(t);let s=this.querySelector(".c-banner__icon");e?(s||(s=document.createElement("span"),s.className="c-banner__icon"),L(s,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#'+String(e).replace(/[^a-zA-Z0-9_-]/g,"")+'" /></svg>'),this.firstChild!==s&&this.prepend(s)):s&&s.remove();const r=this.getAttribute("message");if(r){this.ensure(".c-banner__message",()=>{const t=document.createElement("span");return t.className="c-banner__message",t}).textContent=r}}});function _e(t){return!!t&&"function"==typeof t.showPopover&&"function"==typeof t.hidePopover}function ve(t,e,s,r){if(!t||!e)return;const i=e.getBoundingClientRect(),a=t.offsetWidth||0,n=t.offsetHeight||0;let o=i.bottom+s;o+n>window.innerHeight&&i.top-s-n>=0&&(o=i.top-s-n);let c=r?i.right-a:i.left;c=Math.max(0,Math.min(c,Math.max(0,window.innerWidth-a))),t.style.position="fixed",t.style.inset="auto",t.style.margin="0",t.style.top=o+"px",t.style.left=c+"px"}function ye(t){const e=t._menuReposition;e&&(window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e),t._menuReposition=null)}function fe(t,e,s,r,i){if(e)if(r){if(e.hidden=!1,_e(e)){e.style.removeProperty("margin");const r=getComputedStyle(e),a=parseFloat(r.marginBlockStart||r.marginTop)||0;try{e.showPopover()}catch(t){}ve(e,s(),a,i),function(t,e,s,r,i){ye(t);const a=()=>{e.hidden||ve(e,s(),r,i)};t._menuReposition=a,window.addEventListener("scroll",a,!0),window.addEventListener("resize",a)}(t,e,s,a,i)}}else{if(_e(e)&&e.matches(":popover-open"))try{e.hidePopover()}catch(t){}ye(t),e.hidden=!0}}c("contour-pull-to-refresh",class extends T{static get observed(){return["threshold"]}static get properties(){return{threshold:{attribute:"threshold"}}}render(){this.classList.add("c-pull-to-refresh"),this.hasAttribute("role")||this.setAttribute("role","region"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"label","Pull to refresh"));const t=this.ensure(".c-pull-to-refresh__indicator",()=>{const t=document.createElement("div");return t.className="c-pull-to-refresh__indicator",t});t.innerHTML="";const e=document.createElement("span");e.className="c-pull-to-refresh__label",e.setAttribute("aria-live","polite"),e.textContent=this._ptrError?this._ptrError:this._ptrRefreshing?k(this,"refreshing","Refreshing…"):k(this,"label","Pull to refresh"),t.appendChild(e);const s=document.createElement("button");s.type="button",s.className="c-pull-to-refresh__btn",s.textContent=k(this,"refresh","Refresh"),t.appendChild(s),t.parentNode!==this&&this.prepend(t),this.classList.toggle("is-refreshing",!!this._ptrRefreshing),this.classList.toggle("has-error",!!this._ptrError),this.setAttribute("aria-busy",String(!!this._ptrRefreshing))}complete(){this._ptrRefreshing=!1,this._ptrError=null,this.style.removeProperty("--ptr-offset"),this.requestRender()}fail(t){this._ptrRefreshing=!1,this._ptrError=String(t||k(this,"error","Refresh failed")),this.style.removeProperty("--ptr-offset"),this.requestRender(),this.dispatchEvent(new CustomEvent("contour:error",{bubbles:!0,composed:!0,detail:{message:this._ptrError}}))}_refresh(){this._ptrRefreshing||(this._ptrRefreshing=!0,this._ptrError=null,this.style.removeProperty("--ptr-offset"),this.requestRender(),this.dispatchEvent(new CustomEvent("contour:refresh",{bubbles:!0,composed:!0})))}enhance(){if(this._wiredPullToRefresh)return;this._wiredPullToRefresh=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-pull-to-refresh__btn"):null;e&&this.contains(e)&&this._refresh()});let t=0,e=!1,s=0;this.addEventListener("pointerdown",r=>{if(!(this._ptrRefreshing||this.scrollTop>0||r.target&&r.target.closest&&r.target.closest(".c-pull-to-refresh__btn"))){t=r.clientY,e=!0,s=0;try{this.setPointerCapture(r.pointerId)}catch(t){}}}),this.addEventListener("pointermove",r=>{if(!e)return;const i=r.clientY-t;i>0&&(s=Math.min(120,.6*i),this.style.setProperty("--ptr-offset",s+"px"))});const r=()=>{if(!e)return;e=!1;const t=Number(this.getAttribute("threshold"))||60;s>=t?this._refresh():this.style.removeProperty("--ptr-offset"),s=0};this.addEventListener("pointerup",r),this.addEventListener("pointercancel",r)}});c("contour-dropdown",class extends T{static get observed(){return["label","items","empty"]}static get properties(){return{label:{attribute:"label"},items:{attribute:"items"}}}render(){this.classList.add("c-dropdown"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"dropdown","Dropdown"));const t=this.ensure(".c-dropdown__trigger",()=>{const t=document.createElement("button");return t.className="c-dropdown__trigger c-btn c-btn--sm",t.type="button",t});t.textContent=this.getAttribute("label")||"Menu",t.setAttribute("aria-haspopup","menu"),t.setAttribute("aria-expanded","false");const e=this.ensure(".c-dropdown__menu",()=>{const t=document.createElement("div");return t.className="c-dropdown__menu c-menu",t.setAttribute("role","menu"),t.hidden=!0,_e(t)&&t.setAttribute("popover","manual"),t});e.id||(e.id=(this.id||o("dd"))+"-menu"),t.setAttribute("aria-controls",e.id);const s=Array.from(this.querySelectorAll(":scope > .c-menu__item")),r=this.getAttribute("items");if(s.length)e.innerHTML="",s.forEach(t=>{e.appendChild(t)});else if(r){const t=Qt(this,"items",f);e.innerHTML="",0===t.length?Yt(this,"dropdown"):t.forEach(t=>{const s=document.createElement("button");s.className="c-menu__item",s.type="button",s.setAttribute("role","menuitem"),s.textContent="string"==typeof t?t:t.label||t.title||"",e.appendChild(s)})}e.parentNode!==this&&this.appendChild(e),t.parentNode!==this&&this.insertBefore(t,e)}enhance(){if(this._wiredDropdown)return;this._wiredDropdown=!0;const t=()=>this.querySelector(".c-dropdown__trigger"),e=()=>this.querySelector(".c-dropdown__menu");this.addEventListener("click",s=>{const r=t(),i=e(),a=s.target&&s.target.closest?s.target.closest(".c-menu__item"):null;if(a&&i&&i.contains(a)&&!i.hidden){const e=Array.from(i.querySelectorAll(".c-menu__item")).indexOf(a);if(this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:e,value:a.textContent}})),fe(this,i,t,!1,!1),r){r.setAttribute("aria-expanded","false");try{r.focus()}catch(t){}}return}if((s.target===r||r&&r.contains(s.target))&&i){const e=i.hidden;if(fe(this,i,t,e,!1),r.setAttribute("aria-expanded",String(e)),e){i.id||(i.id=(this.id||o("dd"))+"-menu"),r.setAttribute("aria-controls",i.id);const t=i.querySelector(".c-menu__item");if(t)try{t.focus()}catch(t){}}}});const s=s=>{const r=e(),i=t();!r||r.hidden||this.contains(s.target)||(fe(this,r,t,!1,!1),i&&i.setAttribute("aria-expanded","false"))};document.addEventListener("click",s),i(this,()=>document.removeEventListener("click",s)),i(this,()=>ye(this));const r=s=>{const r=e(),i=t();if("Escape"===s.key&&r&&!r.hidden){if(s.preventDefault(),fe(this,r,t,!1,!1),i){i.setAttribute("aria-expanded","false");try{i.focus()}catch(t){}}return}if("ArrowDown"===s.key&&s.target===i&&r&&r.hidden){s.preventDefault(),fe(this,r,t,!0,!1),i.setAttribute("aria-expanded","true"),r.id||(r.id=(this.id||o("dd"))+"-menu"),i.setAttribute("aria-controls",r.id);const e=r.querySelector(".c-menu__item");if(e)try{e.focus()}catch(t){}return}if(!r||r.hidden)return;const a=Array.from(r.querySelectorAll(".c-menu__item"));if(1===s.key.length&&!s.ctrlKey&&!s.metaKey&&!s.altKey){const t=(this._ddTypeaheadQuery||"")+s.key.toLowerCase();this._ddTypeaheadQuery=t,clearTimeout(this._ddTypeaheadTimer),this._ddTypeaheadTimer=setTimeout(()=>{this._ddTypeaheadQuery=""},800);const e=a.find(e=>e.textContent.toLowerCase().startsWith(t));e&&e.focus()}z(s,a,{wrap:!0,enter:!1,onKey:t=>{"Enter"!==t&&" "!==t||document.activeElement.click()}})},a=s=>{const r=e();if(r&&!r.hidden&&!this.contains(s.relatedTarget)){fe(this,r,t,!1,!1);const e=t();e&&e.setAttribute("aria-expanded","false")}};this.addEventListener("focusout",a),i(this,()=>this.removeEventListener("focusout",a)),document.addEventListener("keydown",r),i(this,()=>document.removeEventListener("keydown",r))}});c("contour-split-button",class extends T{static get observed(){return["label","menu","empty"]}static get properties(){return{label:{attribute:"label"},menu:{attribute:"menu"}}}render(){this.classList.add("c-split-button");const t=this.ensure(".c-split-button__main",()=>{const t=document.createElement("button");return t.className="c-btn c-split-button__main",t.type="button",t});t.textContent=this.getAttribute("label")||k(this,"action","Action");const e=this.ensure(".c-split-button__toggle",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--icon c-split-button__toggle",t.type="button",t.setAttribute("aria-label",k(this,"more-options","More options")),t.textContent="▾",t}),s=this.ensure(".c-split-button__menu",()=>{const t=document.createElement("div");return t.className="c-menu c-split-button__menu",t.setAttribute("role","menu"),t.hidden=!0,_e(t)&&t.setAttribute("popover","manual"),t});s.id||(s.id=(this.id||o("split"))+"-menu"),e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-controls",s.id),e.setAttribute("aria-expanded",String(!s.hidden));if(this.getAttribute("menu")){const t=Qt(this,"menu",f);s.innerHTML="",0===t.length?Yt(this,"split-button"):t.forEach(t=>{const e=document.createElement("button");e.className="c-menu__item",e.type="button",e.setAttribute("role","menuitem"),e.textContent="string"==typeof t?t:t.label||t.title||"",s.appendChild(e)})}t.parentNode!==this&&this.appendChild(t),e.parentNode!==this&&this.appendChild(e),s.parentNode!==this&&this.appendChild(s)}enhance(){if(this._wiredSplitButton)return;this._wiredSplitButton=!0;const t=()=>this.querySelector(".c-split-button__toggle"),e=()=>this.querySelector(".c-split-button__menu"),s=()=>Array.from(e()?.querySelectorAll(".c-menu__item")||[]),r=(r,i)=>{const a=e(),n=t();if(!a)return;const o=!a.hidden;if(fe(this,a,t,r,!0),n&&n.setAttribute("aria-expanded",String(r)),r&&i){const t=s()[0];if(t)try{t.focus()}catch(t){}}o!==r&&this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{open:r}}))};i(this,()=>ye(this)),this.addEventListener("click",i=>{const a=i.target&&i.target.closest?i.target.closest(".c-split-button__main"):null;if(a&&this.contains(a))return void this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0,detail:{label:a.textContent}}));const n=t();if(i.target===n||n&&n.contains(i.target)){const t=e();return void r(!!t&&t.hidden,!0)}const o=i.target&&i.target.closest?i.target.closest(".c-menu__item"):null;if(o&&this.contains(o)){const e=s().indexOf(o);r(!1,!1);try{t()?.focus()}catch(t){}this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{label:o.textContent,index:e}}))}}),this.addEventListener("keydown",i=>{const a=t(),n=e(),o=s(),c=i.target===a||a&&a.contains(i.target),l=o.indexOf(i.target);if(!c||"Enter"!==i.key&&" "!==i.key&&"ArrowDown"!==i.key){if(c&&"ArrowUp"===i.key){i.preventDefault(),r(!0,!1);const t=o[o.length-1];if(t)try{t.focus()}catch(t){}}else if(l>=0){if("ArrowDown"===i.key)i.preventDefault(),o[(l+1)%o.length]?.focus();else if("ArrowUp"===i.key)i.preventDefault(),o[(l-1+o.length)%o.length]?.focus();else if("Home"===i.key)i.preventDefault(),o[0]?.focus();else if("End"===i.key)i.preventDefault(),o[o.length-1]?.focus();else if("Escape"===i.key){i.preventDefault(),r(!1,!1);try{a?.focus()}catch(t){}}}else if("Escape"===i.key&&n&&!n.hidden){r(!1,!1);try{a?.focus()}catch(t){}}}else i.preventDefault(),r(!0,!0);if(1===i.key.length&&!i.ctrlKey&&!i.metaKey&&!i.altKey){const t=(this._sbTypeaheadQuery||"")+i.key.toLowerCase();this._sbTypeaheadQuery=t,clearTimeout(this._sbTypeaheadTimer),this._sbTypeaheadTimer=setTimeout(()=>{this._sbTypeaheadQuery=""},800);const e=o.find(e=>e.textContent.toLowerCase().startsWith(t));e&&e.focus()}});const a=t=>{const s=e();!s||s.hidden||this.contains(t.relatedTarget)||r(!1,!1)};this.addEventListener("focusout",a),i(this,()=>this.removeEventListener("focusout",a));const n=t=>{const s=e();!s||s.hidden||this.contains(t.target)||r(!1,!1)};document.addEventListener("click",n),i(this,()=>document.removeEventListener("click",n))}});c("contour-map-popup",class extends T{static get observed(){return["title","content","cluster-count","cluster-expanded","cluster-items","anchor"]}static get properties(){return{title:{attribute:"title"},content:{attribute:"content"},"cluster-count":{attribute:"cluster-count",type:Number},"cluster-expanded":{attribute:"cluster-expanded",type:Boolean},"cluster-items":{attribute:"cluster-items"}}}render(){this.classList.add("c-map-popup"),this.setAttribute("role","dialog"),this.hasAttribute("popover")||this.setAttribute("popover","auto"),this.id||(this.id=o("map-popup"));const t=this.getAttribute("title");if(t){this.ensure(".c-map-popup__title",()=>{const t=document.createElement("div");return t.className="c-map-popup__title",t}).textContent=t}const e=Array.from(this.childNodes).filter(t=>(1!==t.nodeType||!t.classList||!t.classList.contains("c-map-popup__title")&&!t.classList.contains("c-map-popup__body"))&&!(3===t.nodeType&&!t.textContent.trim())),s=this.getAttribute("content");if(e.length){const t=this.ensure(".c-map-popup__body",()=>{const t=document.createElement("div");return t.className="c-map-popup__body",t});for(const s of e)t.appendChild(s)}else if(s){this.ensure(".c-map-popup__body",()=>{const t=document.createElement("div");return t.className="c-map-popup__body",t}).textContent=s}const r=Number(this.getAttribute("cluster-count"));if(Number.isFinite(r)&&r>1){const t=this.ensure(".c-map-popup__cluster",()=>{const t=document.createElement("button");return t.className="c-map-popup__cluster c-btn c-btn--sm",t.type="button",t}),e=this.hasAttribute("cluster-expanded");t.textContent=e?"Hide locations":`${r} locations`,t.setAttribute("aria-expanded",String(e)),t.setAttribute("aria-label",e?"Hide locations":`Show ${r} locations`)}else{const t=this.querySelector(".c-map-popup__cluster");t&&t.remove()}const i=this.hasAttribute("cluster-expanded");let a=Qt(this,"cluster-items",f);const n=this.querySelector(".c-map-popup__cluster-list");if(i&&Array.isArray(a)&&a.length){const t=n||document.createElement("ul");t.className="c-map-popup__cluster-list",L(t,""),a.forEach(e=>{const s=document.createElement("li");s.className="c-map-popup__cluster-item",s.textContent="string"==typeof e?e:e.label||e.name||JSON.stringify(e),t.appendChild(s)}),t.parentNode!==this&&this.appendChild(t)}else n&&n.remove();this.hasAttribute("aria-label")||this.setAttribute("aria-label",t||"Map popup");const c=this.getAttribute("anchor");let l=null;c&&(l=c.startsWith("#")?document.getElementById(c.slice(1)):document.querySelector(c)),this._mapPopupAnchorEl=l;const u="--map-popup-"+this.id;l&&(l.style.setProperty("anchor-name",u),this.style.setProperty("position-anchor",u))}enhance(){if(this._wiredMapPopup)return;this._wiredMapPopup=!0;const t=()=>{try{this.hidePopover()}catch(t){}this.classList.remove("is-open"),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}))},e=e=>{"Escape"===e.key&&(this.classList.contains("is-open")||this.matches(":popover-open"))&&(e.preventDefault(),t())};document.addEventListener("keydown",e),i(this,()=>document.removeEventListener("keydown",e)),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-map-popup__close"):null;s&&this.contains(s)&&t();const r=e.target&&e.target.closest?e.target.closest(".c-map-popup__cluster"):null;if(r&&this.contains(r)){const t=!this.hasAttribute("cluster-expanded");this.toggleAttribute("cluster-expanded",t),this.dispatchEvent(new CustomEvent("contour:cluster-toggle",{bubbles:!0,composed:!0,detail:{count:Number(this.getAttribute("cluster-count")),expanded:t}}))}});const s="--map-popup-"+this.id,r=()=>{const t=this._mapPopupAnchorEl;t&&(t.style.setProperty("anchor-name",s),this.style.setProperty("position-anchor",s))},a=()=>{try{const t=this.getBoundingClientRect(),e=t.right>window.innerWidth||t.left<0,s=t.bottom>window.innerHeight||t.top<0,r=e||s;this.classList.toggle("c-map-popup--flip-x",e&&!s),this.classList.toggle("c-map-popup--flip-y",s&&!e),this.classList.toggle("c-map-popup--flip-both",e&&s),r&&this.dispatchEvent(new CustomEvent("contour:map-popup-reposition",{bubbles:!0,composed:!0,detail:{anchor:this.getAttribute("anchor")||"",flippedX:e,flippedY:s,left:Math.round(t.left),top:Math.round(t.top)}}))}catch(t){}};this.addEventListener("toggle",t=>{"open"===t.newState&&requestAnimationFrame(()=>{r(),a()})});const n=()=>a();window.addEventListener("resize",n),i(this,()=>{window.removeEventListener("resize",n),this._mapPopupAnchorEl&&this._mapPopupAnchorEl.style.removeProperty("anchor-name")})}});c("contour-animation-controls",class extends T{static get observed(){return["playing","speed","progress","min","max","caption","show-thumb","show-thumb-caption","loop","step","markers"]}static get properties(){return{playing:{attribute:"playing",type:Boolean},speed:{attribute:"speed"},progress:{attribute:"progress"},min:{attribute:"min"},max:{attribute:"max"},loop:{attribute:"loop",type:Boolean},step:{attribute:"step"},markers:{attribute:"markers"}}}render(){this.classList.add("c-animation-controls"),this.setAttribute("role","toolbar"),this.setAttribute("aria-label",k(this,"animation-controls","Animation controls"));const t=this.ensure(".c-animation-controls__play",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-btn--icon c-animation-controls__play",t.type="button",t});L(t,this.hasAttribute("playing")?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-pause" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-play" /></svg>'),t.setAttribute("aria-label",this.hasAttribute("playing")?k(this,"pause","Pause"):k(this,"play","Play"));const e=this.getAttribute("speed")||"1x",s=this.ensure(".c-animation-controls__speed",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-animation-controls__speed",t.type="button",t});s.textContent=e,s.setAttribute("aria-label",k(this,"playback-speed","Playback speed")+" "+e);const r=this.ensure(".c-animation-controls__loop",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-btn--icon c-animation-controls__loop",t.type="button",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-refresh" /></svg>'),t});r.setAttribute("aria-label",k(this,"loop","Loop")),r.setAttribute("aria-pressed",String(this.hasAttribute("loop"))),t.tabIndex=0,s.tabIndex=-1,r.tabIndex=-1;const i=this.ensure(".c-animation-controls__scrubber",()=>{const t=document.createElement("input");return t.className="c-range c-animation-controls__scrubber",t.type="range",t});"false"===this.getAttribute("show-thumb")?i.classList.remove("c-animation-controls__scrubber--thumb"):i.classList.add("c-animation-controls__scrubber--thumb"),i.min=this.getAttribute("min")||"0",i.max=this.getAttribute("max")||"100",i.step=this.getAttribute("step")||"1",i.value=this.getAttribute("progress")||"0";{const t=Number(i.min)||0,e=Number(i.max)||100,s=Number(i.value)||0,r=e===t?0:(s-t)/(e-t)*100;i.style.setProperty("--fill",r+"%")}const a=Number(i.min)||0,n=Number(i.max)||100,c=Number(i.value)||a;i.setAttribute("aria-valuenow",String(c)),i.setAttribute("aria-valuetext",String(Math.round(c))),i.setAttribute("aria-valuemin",String(a)),i.setAttribute("aria-valuemax",String(n));const l=this.getAttribute("caption");l?i.setAttribute("aria-label",l):i.getAttribute("aria-label")||i.setAttribute("aria-label",k(this,"playhead","Playhead"));const u=this.getAttribute("markers");let d=[];if(u)try{const t=JSON.parse(u);d=Array.isArray(t)?t:[]}catch(t){f(this,"markers",t)}const h=this.querySelector("datalist.c-animation-controls__markers");if(d.length){const t=this.ensure("datalist.c-animation-controls__markers",()=>{const t=document.createElement("datalist");return t.className="c-animation-controls__markers",t});t.id||(t.id=this._animMarkersId||(this._animMarkersId=o("anim-markers"))),L(t,""),d.forEach(e=>{const s=document.createElement("option"),r="object"==typeof e&&null!==e?e.value:e;s.value=String(r),"object"==typeof e&&null!==e&&e.label&&(s.label=String(e.label)),t.appendChild(s)}),i.setAttribute("list",t.id)}else h&&h.remove(),i.removeAttribute("list");const m=this.hasAttribute("show-thumb-caption")||this.hasAttribute("show-thumb");if(l&&m){this.ensure(".c-animation-controls__caption",()=>{const t=document.createElement("span");return t.className="c-animation-controls__caption",t}).textContent=l}else{const t=this.querySelector(".c-animation-controls__caption");t&&t.remove()}this.hasAttribute("loop")&&this.setAttribute("aria-label",k(this,"animation-controls-loop","Animation controls, loop"))}enhance(){if(this._wiredAnimControls)return;this._wiredAnimControls=!0;const t=[.5,1,2,4],e=t=>{this._animScrubbing||this.setAttribute("progress",String(t))};this.addEventListener("pointerdown",t=>{t.target&&t.target.closest&&t.target.closest(".c-animation-controls__scrubber")&&(this._animScrubbing=!0)},{passive:!0});const s=()=>{this._animScrubbing=!1};this.addEventListener("pointerup",s,{passive:!0}),this.addEventListener("pointercancel",s,{passive:!0}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-animation-controls__play"):null;if(s&&this.contains(s)){const t=!this.hasAttribute("playing");return this.toggleAttribute("playing",t),void this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{playing:t}}))}const r=e.target&&e.target.closest?e.target.closest(".c-animation-controls__speed"):null;if(r&&this.contains(r)){const e=parseFloat(this.getAttribute("speed")||"1x"),s=t.indexOf(Number.isFinite(e)?e:1),r=t[(s+1)%t.length];return this.setAttribute("speed",r+"x"),void this.dispatchEvent(new CustomEvent("contour:speed-change",{bubbles:!0,composed:!0,detail:{speed:r}}))}const i=e.target&&e.target.closest?e.target.closest(".c-animation-controls__loop"):null;if(i&&this.contains(i)){const t=!this.hasAttribute("loop");this.toggleAttribute("loop",t),this.dispatchEvent(new CustomEvent("contour:loop-change",{bubbles:!0,composed:!0,detail:{loop:t}}))}}),this.addEventListener("input",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-animation-controls__scrubber"):null;if(s&&this.contains(s)){const t=Number(s.value),r=Number(s.min)||0,i=Number(s.max)||100,a=i===r?0:(t-r)/(i-r)*100;s.style.setProperty("--fill",a+"%"),e(t),this.dispatchEvent(new CustomEvent("contour:seek",{bubbles:!0,composed:!0,detail:{progress:t,value:t}}))}}),this.addEventListener("change",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-animation-controls__scrubber"):null;e&&this.contains(e)&&this.setAttribute("progress",e.value)}),this.addEventListener("keydown",t=>{if(t.target&&t.target.closest&&t.target.closest(".c-animation-controls__scrubber"))return;const e=Array.from(this.querySelectorAll(".c-animation-controls__play, .c-animation-controls__speed, .c-animation-controls__loop"));e.includes(t.target)&&z(t,e,{wrap:!0,homeEnd:!0,onNavigate:t=>{e.forEach((e,s)=>{e.tabIndex=s===t?0:-1})},onKey:(t,e,s)=>{"Enter"!==t&&" "!==t||s.click()}})});let r=null;const a=()=>{const t=this.getAttribute("speed")||"1x",e=parseFloat(t);return Number.isFinite(e)&&e>0?e:1},n=()=>{const t=this.querySelector(".c-animation-controls__scrubber");if(!t)return;const s=Number(t.min||0),r=Number(t.max||100);let i=Number(t.value||0)+a(),n=!1;i>r&&(this.hasAttribute("loop")?i=s:(i=r,c(),n=!0)),t.value=String(i),e(i),this.dispatchEvent(new CustomEvent("contour:time-change",{bubbles:!0,composed:!0,detail:{progress:i,value:i}})),n&&(this.removeAttribute("playing"),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{playing:!1}})))},o=()=>{r||(r=setInterval(n,100))},c=()=>{r&&(clearInterval(r),r=null)};this.hasAttribute("playing")&&o();const l=new MutationObserver(()=>{this.hasAttribute("playing")?o():c()});l.observe(this,{attributes:!0,attributeFilter:["playing"]}),i(this,()=>{c(),l.disconnect()})}});c("contour-annotation",class extends T{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"),this.setAttribute("role","note"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const t=this.getAttribute("label");if(t&&this.setAttribute("aria-label",t),t){this.ensure(".c-annotation__label",()=>{const t=document.createElement("span");return t.className="c-annotation__label",t}).textContent=t}const e=this.getAttribute("x"),s=this.getAttribute("y");null!==e&&this.style.setProperty("--annotation-x",e),null!==s&&this.style.setProperty("--annotation-y",s)}enhance(){if(this._wiredAnnotation)return;this._wiredAnnotation=!0;const t=(t,e)=>{const s=parseFloat(t);return Number.isFinite(s)?Math.min(100,Math.max(0,s)):e},e=(t,e,s)=>{this.batch(()=>{this.setAttribute("x",t+"%"),this.setAttribute("y",e+"%")}),this.dispatchEvent(new CustomEvent("contour:drag",{bubbles:!0,composed:!0,detail:{delta:s?1:0,key:s||"pointer",value:t+","+e}}))};let s=null;this.addEventListener("pointerdown",e=>{if(void 0!==e.button&&0!==e.button)return;const r=this.offsetParent||this.parentElement;if(!r)return;const i=r.getBoundingClientRect();s={px:e.clientX,py:e.clientY,x:t(this.getAttribute("x"),50),y:t(this.getAttribute("y"),50),w:i.width||1,h:i.height||1};try{this.setPointerCapture(e.pointerId)}catch(t){}try{this.focus()}catch(t){}e.preventDefault()}),this.addEventListener("pointermove",t=>{if(!s)return;const r=Math.round(10*(s.x+(t.clientX-s.px)/s.w*100))/10,i=Math.round(10*(s.y+(t.clientY-s.py)/s.h*100))/10;e(Math.min(100,Math.max(0,r)),Math.min(100,Math.max(0,i)))});const r=()=>{s&&(s=null,this.dispatchEvent(new CustomEvent("contour:dragend",{bubbles:!0,composed:!0,detail:{value:(this.getAttribute("x")||"")+","+(this.getAttribute("y")||"")}})))};this.addEventListener("pointerup",r),this.addEventListener("pointercancel",r),this.addEventListener("keydown",s=>{const r=s.shiftKey?10:1;let i=0,a=0;if("ArrowLeft"===s.key)i=-r;else if("ArrowRight"===s.key)i=r;else if("ArrowUp"===s.key)a=-r;else{if("ArrowDown"!==s.key)return;a=r}s.preventDefault();const n=Math.min(100,Math.max(0,t(this.getAttribute("x"),50)+i)),o=Math.min(100,Math.max(0,t(this.getAttribute("y"),50)+a));e(n,o,s.key),this.dispatchEvent(new CustomEvent("contour:dragend",{bubbles:!0,composed:!0,detail:{value:n+","+o}}))})}});c("contour-style-switcher",class extends T{static get observed(){return["items","value"]}static get properties(){return{items:{attribute:"items"},value:{attribute:"value"}}}render(){this.classList.add("c-style-switcher"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"style-switcher","Style switcher"));const t=this.getAttribute("items"),e=this.getAttribute("value"),s=Array.from(this.children).filter(t=>t.classList&&t.classList.contains("c-style-switcher__option"));if(t&&!s.length){Array.from(this.querySelectorAll(".c-style-switcher__option")).forEach(t=>t.remove());try{JSON.parse(t).forEach(t=>{const e="string"==typeof t?t:t.name||t.label||"",s=document.createElement("button");s.className="c-style-switcher__option c-btn c-btn--sm",s.type="button",s.textContent=e,s.dataset.value=e,this.appendChild(s)})}catch(t){f(this,"attribute",t)}}const r=Array.from(this.querySelectorAll(".c-style-switcher__option"));let i=null;r.forEach(t=>{const s=(null!=t.dataset.value?t.dataset.value:t.textContent.trim())===e;t.classList.toggle("c-style-switcher__option--active",s),t.setAttribute("aria-pressed",String(s)),t.tabIndex=-1,s&&!i&&(i=t)}),(i||r[0])?.setAttribute("tabindex","0")}enhance(){if(this._wiredStyleSwitcher)return;this._wiredStyleSwitcher=!0;const t=t=>{const e=null!=t.dataset.value?t.dataset.value:t.textContent.trim();this.setAttribute("value",e),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:e}}))};this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-style-switcher__option"):null;s&&this.contains(s)&&t(s)}),this.addEventListener("keydown",e=>{z(e,Array.from(this.querySelectorAll(".c-style-switcher__option")),{onKey:e=>{if("Enter"===e||" "===e){const e=document.activeElement;e&&e.classList.contains("c-style-switcher__option")&&t(e)}}})})}});c("contour-style-panel",class extends T{static get observed(){return["title","layers","layer","single","classification","palette","breaks","opacity","n","colors","property"]}static get properties(){return{title:{attribute:"title"},layers:{attribute:"layers"},classification:{attribute:"classification"},palette:{attribute:"palette"},breaks:{attribute:"breaks"},opacity:{attribute:"opacity"}}}render(){if(this.classList.add("c-style-panel"),!this._stylePanelDefault){this._stylePanelDefault={};for(const t of["property","classification","palette","breaks","opacity","n","colors"])this._stylePanelDefault[t]=this.getAttribute(t)}this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"style-panel","Style panel"));const t=this.getAttribute("title");if(t){this.ensure(".c-style-panel__title",()=>{const t=document.createElement("div");return t.className="c-style-panel__title",t}).textContent=t}if(this.hasAttribute("single")||!!this.getAttribute("layer")){const t=this.ensure(".c-style-panel__body",()=>{const t=document.createElement("div");return t.className="c-style-panel__body",t});L(t,"");const e=o("style-panel"),s=e+"-property",r=e+"-policy",i=e+"-palette",a=e+"-n",n=document.createElement("label");n.textContent=k(this,"colour-field","Colour field"),n.setAttribute("for",s),t.appendChild(n);const c=document.createElement("input");c.type="text",c.id=s,c.className="c-style-panel__property c-input",c.setAttribute("aria-label",k(this,"colour-field","Colour field"));const l=this.getAttribute("property");l&&(c.value=l),t.appendChild(c);const u=document.createElement("label");u.textContent=k(this,"classification","Classification"),u.setAttribute("for",r),t.appendChild(u);const d=document.createElement("select");d.id=r,d.className="c-style-panel__classification c-input",d.setAttribute("aria-label",k(this,"classification-method","Classification method")),["equal","quantile","jenks","manual"].forEach(t=>{const e=document.createElement("option");e.value=t,e.textContent=t,d.appendChild(e)});const h=this.getAttribute("classification");h&&(d.value=h),t.appendChild(d);const m=document.createElement("label");m.textContent=k(this,"palette","Palette"),m.setAttribute("for",i),t.appendChild(m);const b=document.createElement("input");b.type="text",b.id=i,b.className="c-style-panel__palette c-input",b.placeholder=k(this,"palette","Palette"),b.setAttribute("aria-label",k(this,"palette","Palette"));const p=this.getAttribute("palette");p&&(b.value=p),t.appendChild(b);const g=document.createElement("label");g.textContent=k(this,"classes","Classes"),g.setAttribute("for",a),t.appendChild(g);const _=document.createElement("input");_.type="number",_.id=a,_.className="c-style-panel__n c-input",_.min="2",_.max="12",_.setAttribute("aria-label",k(this,"class-count","Class count"));const v=this.getAttribute("n");_.value=v||"5",t.appendChild(_);const y=document.createElement("input");y.type="range",y.className="c-style-panel__opacity",y.setAttribute("aria-label",k(this,"opacity","Opacity")),y.min="0",y.max="100";const f=this.getAttribute("opacity");y.value=null!=f?f:"100",t.appendChild(y);const A=this.getAttribute("breaks");let E=null;if(A)try{E=JSON.parse(A)}catch(t){E=A.split(",").map(t=>t.trim())}if(Array.isArray(E)&&E.length){const e=document.createElement("div");e.className="c-style-panel__breaks",E.forEach((t,s)=>{const r=document.createElement("div");r.className="break";const i=document.createElement("span");i.textContent=String(t),r.appendChild(i);const a=document.createElement("input");a.type="number",a.className="c-style-panel__breaks c-input",a.setAttribute("aria-label",k(this,"class-lower-bound","Class lower bound")),a.value=String(t),r.appendChild(a),e.appendChild(r)}),t.appendChild(e)}const w=this.getAttribute("colors");let x=null;if(w)try{x=JSON.parse(w)}catch(t){x=w.split(",").map(t=>t.trim())}if(Array.isArray(x)){const e=document.createElement("div");e.className="c-style-panel__colors",x.forEach((t,s)=>{const r=document.createElement("input");r.type="color",r.className="c-style-panel__color c-input",r.setAttribute("aria-label",k(this,"colour-for-class","Colour for class")+" "+(s+1)),r.value=t,e.appendChild(r)}),t.appendChild(e)}const C=document.createElement("div");C.className="c-style-panel__actions c-btn-group";const S=document.createElement("button");S.type="button",S.className="c-btn c-btn--primary",S.textContent=k(this,"apply","Apply"),S.dataset.action="apply";const N=document.createElement("button");return N.type="button",N.className="c-btn",N.textContent=k(this,"revert","Revert"),N.dataset.action="revert",C.appendChild(S),C.appendChild(N),void t.appendChild(C)}const e=this.getAttribute("layers"),s=this.ensure(".c-style-panel__body",()=>{const t=document.createElement("div");return t.className="c-style-panel__body",t}),r=Array.from(this.querySelectorAll(":scope > .c-style-panel__row"));let i=null;if(r.length)i=r.map(t=>({name:t.querySelector(".c-style-panel__name")?.textContent||"",color:t.querySelector(".c-style-panel__color")?.value,classification:t.querySelector(".c-style-panel__classification")?.value,palette:t.querySelector(".c-style-panel__palette")?.value,breaks:t.querySelector(".c-style-panel__breaks")?.value,opacity:t.querySelector(".c-style-panel__opacity")?.value})),r.forEach(t=>t.remove());else if(e)try{i=JSON.parse(e)}catch(t){f(this,"layers",t),i=null}i&&(L(s,""),i.forEach(t=>{const e=document.createElement("div");e.className="c-style-panel__row";const r=document.createElement("span");r.className="c-style-panel__name",r.textContent="string"==typeof t?t:t.name||t.label||"",e.appendChild(r);const i=document.createElement("input");i.type="color",i.className="c-style-panel__color",i.setAttribute("aria-label",k(this,"colour-for","Colour for")+" "+("string"==typeof t?t:t.name||t.label||k(this,"layer","layer"))),"object"==typeof t&&t.color&&(i.value=t.color),e.appendChild(i);const a=document.createElement("select");a.className="c-style-panel__classification",a.setAttribute("aria-label",k(this,"classification-method","Classification method")),["equal","quantile","jenks","manual"].forEach(t=>{const e=document.createElement("option");e.value=t,e.textContent=t,a.appendChild(e)}),"object"==typeof t&&t.classification&&(a.value=t.classification),e.appendChild(a);const n=document.createElement("input");n.type="text",n.className="c-style-panel__palette",n.setAttribute("aria-label",k(this,"palette","Palette")),n.placeholder="palette","object"==typeof t&&t.palette&&(n.value=t.palette),e.appendChild(n);const o=document.createElement("input");o.type="text",o.className="c-style-panel__breaks",o.placeholder="breaks",o.setAttribute("aria-label",k(this,"class-breaks","Class breaks")),"object"==typeof t&&t.breaks&&(o.value=Array.isArray(t.breaks)?t.breaks.join(","):t.breaks),e.appendChild(o);const c=document.createElement("input");c.type="range",c.className="c-style-panel__opacity",c.setAttribute("aria-label",k(this,"opacity","Opacity")),c.min="0",c.max="100",c.value="object"==typeof t&&null!=t.opacity?t.opacity:"100",e.appendChild(c),s.appendChild(e)}))}enhance(){this._wiredStylePanel||(this._wiredStylePanel=!0,this.addEventListener("change",t=>{const e=t.target;if(!e||!this.contains(e))return;const s=e.closest(".c-style-panel__row"),r=s&&s.querySelector(".c-style-panel__name")?.textContent||"";if(e.classList.contains("c-style-panel__color"))this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:e.value,layer:r,property:"color"},bubbles:!0,composed:!0}));else if(e.classList.contains("c-style-panel__classification"))this.dispatchEvent(new CustomEvent("contour:break-change",{detail:{value:e.value,layer:r},bubbles:!0,composed:!0}));else if(e.classList.contains("c-style-panel__opacity")){const t=r?r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""):"";this.dispatchEvent(new CustomEvent("contour:layer-opacity",{detail:{layerId:t,name:r,opacity:Number(e.value)},bubbles:!0,composed:!0}))}else e.classList.contains("c-style-panel__property")?this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:e.value,layer:r,property:"property"},bubbles:!0,composed:!0})):e.classList.contains("c-style-panel__n")&&this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:Number(e.value),layer:r,property:"n"},bubbles:!0,composed:!0}))}),this.addEventListener("input",t=>{const e=t.target;if(e&&this.contains(e)&&(e.classList.contains("c-style-panel__color")&&e.setAttribute("data-edited","true"),e.classList.contains("c-style-panel__palette")||e.classList.contains("c-style-panel__breaks"))){const t=e.closest(".c-style-panel__row"),s=t&&t.querySelector(".c-style-panel__name")?.textContent||"";this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{value:e.value,layer:s,property:e.classList.contains("c-style-panel__palette")?"palette":"breaks"},bubbles:!0,composed:!0}))}}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest("button"):null;if(e&&this.contains(e))if("apply"===e.dataset.action){const t=this.querySelector(".c-style-panel__body"),e={applied:!0};if(t){const s=t.querySelector(".c-style-panel__property"),r=t.querySelector(".c-style-panel__classification"),i=t.querySelector(".c-style-panel__palette"),a=t.querySelector(".c-style-panel__n"),n=Array.from(t.querySelectorAll(".c-style-panel__color")).map(t=>t.value);s&&(e.property=s.value),r&&(e.classification=r.value),i&&(e.palette=i.value),a&&(e.n=Number(a.value)),n.length&&(e.colors=n)}this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:e,bubbles:!0,composed:!0}))}else if("revert"===e.dataset.action){const t=this._stylePanelDefault||{};this._contourResetting=!0;try{for(const e of["property","classification","palette","breaks","opacity","n","colors"])null===t[e]||void 0===t[e]?this.removeAttribute(e):this.setAttribute(e,t[e]);this.attributeChangedCallback("__rerender__",null,"")}finally{this._contourResetting=!1}this.dispatchEvent(new CustomEvent("contour:style-resolved",{detail:{applied:!1},bubbles:!0,composed:!0}))}}))}});c("contour-popover",class extends T{static get observed(){return["title","content","anchor"]}static get properties(){return{title:{attribute:"title"},content:{attribute:"content"}}}render(){this.classList.add("c-popover"),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"popover","Popover")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),this.id||(this.id=o("popover"));const t=this.getAttribute("title");if(t){this.ensure(".c-popover__title",()=>{const t=document.createElement("div");return t.className="c-popover__title",t}).textContent=t}const e=Array.from(this.childNodes).filter(t=>(1!==t.nodeType||!t.classList||!t.classList.contains("c-popover__title")&&!t.classList.contains("c-popover__body"))&&!(3===t.nodeType&&!t.textContent.trim())),s=this.getAttribute("content");if(e.length){const t=this.ensure(".c-popover__body",()=>{const t=document.createElement("div");return t.className="c-popover__body",t});for(const s of e)t.appendChild(s)}else if(s){this.ensure(".c-popover__body",()=>{const t=document.createElement("div");return t.className="c-popover__body",t}).textContent=s}this._applyPopoverAnchor()}_applyPopoverAnchor(){const t=this.getAttribute("anchor"),e=t?t.startsWith("#")?document.getElementById(t.slice(1)):document.querySelector(t):null;if(this._popoverAnchorEl&&this._popoverAnchorEl!==e&&(this._popoverAnchorEl.style.removeProperty("anchor-name"),this._popoverAnchorEl.removeAttribute("aria-controls"),this._popoverAnchorEl.removeAttribute("aria-expanded")),this._popoverAnchorEl=e||null,e){const t="--popover-"+this.id;e.style.setProperty("anchor-name",t),this.style.setProperty("position-anchor",t),e.setAttribute("aria-controls",this.id),this._popoverAnchorDispose||(this._popoverAnchorDispose=!0,i(this,()=>{this._popoverAnchorEl&&this._popoverAnchorEl.style.removeProperty("anchor-name"),this._popoverAnchorDispose=!1}))}else this.style.removeProperty("position-anchor")}_setPopoverTriggerExpanded(t){const e=this._popoverAnchorEl;e&&(e.setAttribute("aria-controls",this.id),e.setAttribute("aria-expanded",String(!!t)))}enhance(){if(this._wiredPopover)return;this._wiredPopover=!0;const t=()=>{try{this.hidePopover()}catch(t){}this.classList.remove("is-open"),S(this,"contour:close",{}),this._setPopoverTriggerExpanded(!1)},e=e=>{if(this.classList.contains("is-open")||this.matches(":popover-open")){if("Escape"===e.key)return e.preventDefault(),void t();if("Tab"===e.key){const t=Array.from(this.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(!t.length)return void e.preventDefault();const s=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===s?(e.preventDefault(),r.focus()):e.shiftKey||document.activeElement!==r||(e.preventDefault(),s.focus())}}};document.addEventListener("keydown",e),i(this,()=>document.removeEventListener("keydown",e));const s=()=>{this.classList.add("is-open"),S(this,"contour:open",{});const t=this.querySelector('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])');if(t)try{t.focus()}catch(t){}else try{this.focus()}catch(t){}this._setPopoverTriggerExpanded(!0)};this.addEventListener("beforetoggle",t=>{"open"===t.newState&&s()});const r=t=>{t.target&&t.target!==this&&this.contains(t.target)&&this.classList.add("is-parent")};this.addEventListener("contour:open",r),this.addEventListener("contour:show",r),this.addEventListener("contour:close",t=>{t.target&&t.target!==this&&this.classList.remove("is-parent")}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-popover__close"):null;s&&this.contains(s)&&t()})}});c("contour-hover-card",class extends T{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"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"hover-card","Hover card")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),this.id||(this.id=o("hover-card"));const t=this.getAttribute("title");if(t){this.ensure(".c-hover-card__title",()=>{const t=document.createElement("div");return t.className="c-hover-card__title",t}).textContent=t}const e=Array.from(this.childNodes).filter(t=>(1!==t.nodeType||!t.classList||!t.classList.contains("c-hover-card__title")&&!t.classList.contains("c-hover-card__body"))&&!(3===t.nodeType&&!t.textContent.trim())),s=this.getAttribute("content");if(e.length){const t=this.ensure(".c-hover-card__body",()=>{const t=document.createElement("div");return t.className="c-hover-card__body",t});for(const s of e)t.appendChild(s)}else if(s){this.ensure(".c-hover-card__body",()=>{const t=document.createElement("div");return t.className="c-hover-card__body",t}).textContent=s}if(!this.hasAttribute("role")){const t=!!this.querySelector("a[href], button, input, select, textarea");this.setAttribute("role",t?"dialog":"tooltip")}"function"==typeof this._wireHoverAnchor&&this._wireHoverAnchor()}enhance(){if(this._wiredHoverCard)return;this._wiredHoverCard=!0;let t=null,e=null;const s="function"==typeof this.showPopover,r=()=>{t&&(clearTimeout(t),t=null),e&&(clearTimeout(e),e=null)},a=t=>{if(r(),s)try{this.showPopover(t?{source:t}:void 0)}catch(t){try{this.showPopover()}catch(t){}}else this.classList.add("is-open");this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}))},n=()=>{if(r(),s)try{this.hidePopover()}catch(t){}else this.classList.remove("is-open");this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}))},o=()=>{e&&clearTimeout(e),e=setTimeout(n,300)};this.addEventListener("mouseenter",r),this.addEventListener("mouseleave",o),this.addEventListener("focusin",r),this.addEventListener("focusout",t=>{this.contains(t.relatedTarget)||o()}),this._wireHoverAnchor=()=>{const e=this.getAttribute("anchor")||"";if(this._hoverAnchorSel===e&&this._hoverAnchorCleanup)return;if(this._hoverAnchorCleanup&&(this._hoverAnchorCleanup(),this._hoverAnchorCleanup=null),this._hoverAnchorSel=e,!e)return;const s=e.startsWith("#")?document.getElementById(e.slice(1)):document.querySelector(e);if(!s)return;s.setAttribute("popovertarget",this.id),s.setAttribute("aria-describedby",this.id);const i="--hover-card-"+this.id;s.style.setProperty("anchor-name",i),this.style.setProperty("position-anchor",i);const n=()=>{r(),t=setTimeout(()=>a(s),300)},c=()=>{o()},l=()=>a(s),u=()=>{o()},d=t=>{t&&t.preventDefault&&t.preventDefault()};s.addEventListener("mouseenter",n),s.addEventListener("mouseleave",c),s.addEventListener("focus",l),s.addEventListener("blur",u),s.addEventListener("click",d),this._hoverAnchorCleanup=()=>{s.removeEventListener("mouseenter",n),s.removeEventListener("mouseleave",c),s.removeEventListener("focus",l),s.removeEventListener("blur",u),s.removeEventListener("click",d),s.style.removeProperty("anchor-name"),s.getAttribute("aria-describedby")===this.id&&s.removeAttribute("aria-describedby")}},this._wireHoverAnchor();const c=t=>{"Escape"===t.key&&(this.classList.contains("is-open")||this.matches(":popover-open"))&&(t.preventDefault(),n())};document.addEventListener("keydown",c),i(this,()=>{r(),this._hoverAnchorCleanup&&(this._hoverAnchorCleanup(),this._hoverAnchorCleanup=null),this._hoverAnchorSel=null,document.removeEventListener("keydown",c)})}});c("contour-context-menu",class extends T{static get observed(){return["items","trigger"]}static get properties(){return{items:{attribute:"items"},trigger:{attribute:"trigger"}}}render(){this.classList.add("c-context-menu"),this.hasAttribute("role")||this.setAttribute("role","menu"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"context-menu","Context menu")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),this.id||(this.id=o("context-menu"));const t=this.getAttribute("items");if(t)try{const e=JSON.parse(t);Array.from(this.querySelectorAll("[data-contour-generated='1']")).forEach(t=>t.remove()),e.forEach(t=>{const e=document.createElement("button");e.className="c-menu__item",e.type="button",e.setAttribute("role","menuitem"),e.dataset.contourGenerated="1",e.textContent="string"==typeof t?t:t.label||t.title||"",this.appendChild(e)})}catch(t){f(this,"attribute",t)}}enhance(){if(this._wiredContextMenu)return;this._wiredContextMenu=!0;const t=t=>{if("function"==typeof this.hidePopover)try{this.hidePopover()}catch(t){}if(this.classList.remove("is-open"),t&&this._ctxOpener&&this._ctxOpener.isConnected&&"function"==typeof this._ctxOpener.focus)try{this._ctxOpener.focus()}catch(t){}this._ctxOpener=null},e=(t,e)=>{if(this._ctxOpener=document.activeElement,"function"==typeof this.showPopover)try{this.showPopover()}catch(t){}else this.classList.add("is-open");if(Number.isFinite(t)&&Number.isFinite(e)){this.style.position="fixed",this.style.left=t+"px",this.style.top=e+"px";const s=this.getBoundingClientRect(),r=window.innerWidth||document.documentElement.clientWidth,i=window.innerHeight||document.documentElement.clientHeight,a=Math.max(8,Math.min(t,Math.max(8,r-s.width-8))),n=Math.max(8,Math.min(e,Math.max(8,i-s.height-8)));this.style.left=a+"px",this.style.top=n+"px"}const s=this.querySelector(".c-menu__item:not([disabled])");if(s&&"function"==typeof s.focus)try{s.focus()}catch(t){}},s=this.getAttribute("trigger");if(s){const t=document.querySelector(s);if(t){t.hasAttribute("aria-haspopup")||t.setAttribute("aria-haspopup","menu");const s=t=>{t.preventDefault(),e(t.clientX,t.clientY)};t.addEventListener("contextmenu",s),i(this,()=>t.removeEventListener("contextmenu",s))}}this.addEventListener("contextmenu",t=>{t.preventDefault(),e(t.clientX,t.clientY)}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-menu__item"):null;s&&this.contains(s)&&(this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{label:s.textContent.trim()}})),t(!1))}),this.addEventListener("keydown",e=>{const s=Array.from(this.querySelectorAll(".c-menu__item"));z(e,s,{wrap:!0,onKey:()=>{"Enter"!==e.key&&" "!==e.key||document.activeElement.click()}}),"Escape"===e.key&&(e.preventDefault(),t(!0))})}});c("contour-fab",class extends T{static get observed(){return["label","icon"]}static get properties(){return{label:{attribute:"label"},icon:{attribute:"icon"}}}render(){this.classList.add("c-fab"),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const t=this.getAttribute("label");t&&this.setAttribute("aria-label",t);const e=this.getAttribute("icon");if(e&&!this.querySelector("svg")){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("aria-hidden","true"),t.setAttribute("viewBox","0 0 24 24");const s=document.createElementNS("http://www.w3.org/2000/svg","use");s.setAttribute("href",e.startsWith("#")?e:"#"+e),t.appendChild(s),this.appendChild(t)}}enhance(){this._wiredFab||(this._wiredFab=!0,this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0}))}),this.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0})))}))}});c("contour-command-palette",class extends T{static get observed(){return["open","items"]}static get properties(){return{open:{attribute:"open",type:Boolean},items:{attribute:"items"}}}attributeChangedCallback(t,e,s){super.attributeChangedCallback(t,e,s),"open"===t&&this.isConnected&&e!==s&&(null!==s?this.show():this.hide())}_recentsKey(){return"contour-command-palette:"+(this.id||"default")+":recents"}_recents(){try{const t=JSON.parse(localStorage.getItem(this._recentsKey())||"[]");return Array.isArray(t)?t:[]}catch(t){return f(this,"recents",t),[]}}_remember(t){try{const e=this._recents().filter(e=>e!==t);e.unshift(t),localStorage.setItem(this._recentsKey(),JSON.stringify(e.slice(0,5)))}catch(t){}}_cmdRow(t,e,s){const r=document.createElement("div");return r.className="c-command-palette__item",r.setAttribute("role","option"),r.id=this.id+"-opt-"+(s?"r":"")+e,r.textContent=t,r.dataset.index=String(e),r.dataset.label=t,s&&(r.dataset.recent="true"),r}render(){this.classList.add("c-command-palette"),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("aria-modal")||this.setAttribute("aria-modal","true"),this.hasAttribute("aria-label")||this.hasAttribute("aria-labelledby")||this.setAttribute("aria-label",k(this,"command-palette","Command palette")),this.hasAttribute("popover")||this.setAttribute("popover","auto"),this.id||(this.id=o("cmd-palette"));const t=this.ensure(".c-command__input",()=>{const t=document.createElement("div");return t.className="c-command__input",t}),e=this.ensure(".c-command__field",()=>{const t=document.createElement("input");return t.className="c-command__field",t.type="search",t.placeholder=k(this,"search","Search…"),t.setAttribute("aria-label",k(this,"search-commands","Search commands")),t.setAttribute("role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded","false"),t}),s=this.hasAttribute("open")||this.classList.contains("is-open")||"function"==typeof this.matches&&this.matches(":popover-open");e.setAttribute("aria-expanded",String(s)),t.contains(e)||t.appendChild(e);const r=this.ensure(".c-command-palette__list",()=>{const t=document.createElement("div");return t.className="c-command-palette__list",t.setAttribute("role","listbox"),t});r.hasAttribute("aria-label")||r.hasAttribute("aria-labelledby")||r.setAttribute("aria-label",k(this,"commands","Commands")),r.id||(r.id=this.id+"-list"),e.setAttribute("aria-controls",r.id);let i=[];const a=this.getAttribute("items");if(a)try{i=JSON.parse(a)}catch(t){f(this,"items",t)}Array.isArray(i)||(i=[]);const n=t=>"string"==typeof t?t:t.label||t.title||"";L(r,"");const c=(this._cmdQuery||"").toLowerCase().trim()?[]:this._recents().filter(t=>i.some(e=>n(e)===t));if(c.length){const t=document.createElement("div");t.className="c-command-palette__group",t.setAttribute("role","presentation"),t.textContent=k(this,"recent","Recent"),r.appendChild(t),c.forEach(t=>r.appendChild(this._cmdRow(t,i.findIndex(e=>n(e)===t),!0)))}let l=null;i.forEach((t,e)=>{const s="object"==typeof t&&null!==t&&t.group||null;if(s&&s!==l){const t=document.createElement("div");t.className="c-command-palette__group",t.setAttribute("role","presentation"),t.textContent=s,r.appendChild(t),l=s}r.appendChild(this._cmdRow(n(t),e,!1))}),this._cmdQuery&&(e.value=this._cmdQuery),this._cmdFilter?this._cmdFilter(this._cmdQuery||""):this._cmdSetActive&&this._cmdSetActive(this._cmdCursor||0)}show(){if(this.classList.contains("is-open")||this.matches(":popover-open"))return void(this.hasAttribute("open")||this.setAttribute("open",""));if("function"==typeof this.showPopover)try{this.showPopover()}catch(t){}this.classList.add("is-open"),Ft(this,!0);const t=this.querySelector(".c-command__field");if(t){t.setAttribute("aria-expanded","true");try{t.focus()}catch(t){}}this.hasAttribute("open")||this.setAttribute("open","")}hide(){if(!(this.classList.contains("is-open")||this.matches(":popover-open")))return void(this.hasAttribute("open")&&this.removeAttribute("open"));if("function"==typeof this.hidePopover)try{this.hidePopover()}catch(t){}this.classList.remove("is-open"),Ft(this,!1);const t=this.querySelector(".c-command__field");t&&t.setAttribute("aria-expanded","false"),this.hasAttribute("open")&&this.removeAttribute("open")}toggle(){this.classList.contains("is-open")||this.matches(":popover-open")?this.hide():this.show()}enhance(){if(this._cmdSetActive&&this._cmdSetActive(this._cmdCursor||0),this._wiredCmdPalette)return;this._wiredCmdPalette=!0;const t=()=>this.querySelector(".c-command__field"),e=()=>this.querySelector(".c-command-palette__list"),s=()=>Array.from(this.querySelectorAll(".c-command-palette__item")),r=()=>s().filter(t=>!t.hidden),a=e=>{const s=r();if(!s.length)return void(this._cmdCursor=0);this._cmdCursor=Math.max(0,Math.min(e,s.length-1)),s.forEach((t,e)=>t.classList.toggle("is-active",e===this._cmdCursor));const i=s[this._cmdCursor],a=t();a&&i?a.setAttribute("aria-activedescendant",i.id):a&&a.removeAttribute("aria-activedescendant")},n=t=>{const r=(t||"").toLowerCase().trim();s().forEach(t=>{const e=(t.dataset.label||t.textContent||"").toLowerCase();t.hidden=""!==r&&!e.includes(r)}),Array.from(e().querySelectorAll(".c-command-palette__group")).forEach(t=>{let e=t.nextElementSibling,s=!1;for(;e&&!e.classList.contains("c-command-palette__group");)!e.hidden&&e.classList.contains("c-command-palette__item")&&(s=!0),e=e.nextElementSibling;t.hidden=!s});let i=e().querySelector(".c-command-palette__empty");s().some(t=>!t.hidden)?i&&(i.hidden=!0):(i||(i=document.createElement("div"),i.className="c-command-palette__empty",i.setAttribute("role","status"),e().appendChild(i)),i.textContent=k(this,"no-matches","No matches"),i.hidden=!1),a(0)},o=t=>{if(!t)return;const e={index:Number(t.dataset.index),label:t.dataset.label||t.textContent};this.value=e,this._remember(e.label),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:e})),this.hide()};this._cmdSetActive=a,this._cmdFilter=n,this.addEventListener("input",e=>{const s=t();s&&e.target===s&&(this._cmdQuery=s.value,n(s.value))}),this.addEventListener("keydown",e=>{const s=t();if(!s||e.target!==s)return;const i=r();if("Escape"===e.key)return e.preventDefault(),void this.hide();i.length&&("ArrowDown"===e.key?(e.preventDefault(),a(this._cmdCursor+1)):"ArrowUp"===e.key?(e.preventDefault(),a(this._cmdCursor-1)):"Home"===e.key?(e.preventDefault(),a(0)):"End"===e.key?(e.preventDefault(),a(i.length-1)):"Enter"===e.key&&(e.preventDefault(),o(i[this._cmdCursor])))}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-command-palette__item"):null;e&&this.contains(e)&&!e.hidden&&o(e)});let c=null;this.addEventListener("beforetoggle",t=>{if("open"===t.newState)c=document.activeElement,this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}));else if(Ft(this,!1),c&&"function"==typeof c.focus){this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}));try{c.focus()}catch(t){}}}),i(this,()=>{(this.classList.contains("is-open")||this.matches(":popover-open"))&&Ft(this,!1)}),a(0)}});c("contour-side-sheet",class extends T{static get observed(){return["open","side","title","mode","size"]}static get properties(){return{open:{attribute:"open",type:Boolean},side:{attribute:"side"},title:{attribute:"title"},mode:{attribute:"mode"},size:{attribute:"size"}}}show(){this.setAttribute("open","")}showModal(){this._sheetForceModal=!0,this.show()}close(){this.removeAttribute("open")}get open(){return this.hasAttribute("open")}set open(t){t?this.show():this.close()}_modal(){return this._sheetForceModal||"non-modal"!==(this.getAttribute("mode")||"modal")}render(){this.classList.add("c-side-sheet"),this.setAttribute("role","dialog"),this._modal()?this.setAttribute("aria-modal","true"):this.removeAttribute("aria-modal"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("title")||"Side sheet");for(const t of Array.from(this.classList))/^c-side-sheet--(start|end|sm|md|lg)$/.test(t)&&this.classList.remove(t);const t="start"===this.getAttribute("side")?"start":"end";this.classList.add("c-side-sheet--"+t);const e=this.getAttribute("size");"sm"!==e&&"md"!==e&&"lg"!==e||this.classList.add("c-side-sheet--"+e),this.hasAttribute("open")?(this.classList.add("is-open"),this.removeAttribute("inert")):(this.classList.remove("is-open"),this.setAttribute("inert",""));const s=this.getAttribute("title");if(s){this.ensure(".c-side-sheet__title",()=>{const t=document.createElement("div");return t.className="c-side-sheet__title",t}).textContent=s}}enhance(){if(this._wiredSideSheet)return;this._wiredSideSheet=!0;let t=null;const e=t=>{if("Escape"===t.key&&this.hasAttribute("open"))return t.preventDefault(),void this.close();if("Tab"===t.key&&this.hasAttribute("open")&&this._modal()){const e=Array.from(this.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])")).filter(t=>!t.hasAttribute("disabled"));if(!e.length)return void t.preventDefault();const s=e[0],r=e[e.length-1];t.shiftKey&&document.activeElement===s?(t.preventDefault(),r.focus()):t.shiftKey||document.activeElement!==r||(t.preventDefault(),s.focus())}};document.addEventListener("keydown",e),i(this,()=>document.removeEventListener("keydown",e)),this.addEventListener("click",t=>{t.target===this&&this.close()});let s=!1;const r=()=>{const e=this.hasAttribute("open");if(e&&!s){s=!0,t=document.activeElement,this._modal()&&Ft(this,!0);const e=this.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(e)try{e.focus()}catch(t){}this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}))}else if(!e&&s){if(s=!1,this._modal()&&Ft(this,!1),this._sheetForceModal=!1,t&&"function"==typeof t.focus)try{t.focus()}catch(t){}t=null,this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}))}},a=new MutationObserver(r);a.observe(this,{attributes:!0,attributeFilter:["open"]}),this.hasAttribute("open")&&r(),i(this,()=>{a.disconnect(),this.hasAttribute("open")&&this._modal()&&Ft(this,!1)})}});c("contour-tour",class extends T{static get observed(){return["steps","current","open","persist","id"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current"},open:{attribute:"open",type:Boolean},persist:{attribute:"persist",type:Boolean}}}_steps(){let t=[];try{const e=this.getAttribute("steps");t=e?JSON.parse(e):[]}catch(e){f(this,"steps",e),t=[]}return Array.isArray(t)?t:[]}_current(t){const e=Number(this.getAttribute("current")||0);return Number.isFinite(e)?Math.min(Math.max(0,e),Math.max(0,t-1)):0}_storageKey(){return this.id?"contour-tour:"+this.id:(this.hasAttribute("persist")&&!this._tourWarnedNoId&&(this._tourWarnedNoId=!0,console.warn("[contour-tour] persist requires an id attribute")),null)}_completed(){if(!this.hasAttribute("persist"))return!1;const t=this._storageKey();try{return!!t&&"done"===localStorage.getItem(t)}catch(t){return!1}}_markCompleted(){if(!this.hasAttribute("persist"))return;const t=this._storageKey();try{t&&localStorage.setItem(t,"done")}catch(t){}}show(){this.setAttribute("open","")}close(){this.hasAttribute("open")&&(this.removeAttribute("open"),this._markCompleted(),this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})))}render(){this.classList.add("c-tour"),this.setAttribute("role","dialog"),this.setAttribute("aria-label",k(this,"tour","Tour"));const t=this._steps();this._tourInitialized||(this._tourInitialized=!0,!t.length||this.hasAttribute("open")||this._completed()||this.setAttribute("open",""));const e=this.hasAttribute("open")&&t.length>0;e?this.removeAttribute("hidden"):this.setAttribute("hidden","");const s=this._current(t.length),r=t[s]||{},i=this.ensure(".c-tour__step",()=>{const t=document.createElement("div");return t.className="c-tour__step",t});i.textContent=k(this,"step","Step")+" "+(s+1)+" / "+t.length;const a=this.ensure(".c-tour__tip",()=>{const t=document.createElement("div");return t.className="c-tour__tip",t});a.setAttribute("aria-live","polite"),a.textContent="string"==typeof r?r:r.text||r.title||"",i.nextSibling!==a&&this.insertBefore(i,a);const n=this.ensure(".c-tour__nav",()=>{const t=document.createElement("div");return t.className="c-tour__nav c-btn-group",t}),o=this.ensure(".c-tour__back",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-tour__back",t.type="button",t},n);o.textContent=k(this,"back","Back"),o.disabled=0===s;const c=this.ensure(".c-tour__next",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-tour__next",t.type="button",t},n);c.textContent=s>=t.length-1?k(this,"done","Done"):k(this,"next","Next");const l=this.ensure(".c-tour__close",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-tour__close",t.type="button",t},n);l.textContent=k(this,"close","Close"),n.firstChild!==o&&n.insertBefore(o,n.firstChild),o.nextSibling!==c&&n.insertBefore(c,o.nextSibling),c.nextSibling!==l&&n.insertBefore(l,c.nextSibling),this._tourTarget&&this._tourTarget.classList&&this._tourTarget.classList.remove("c-tour__target"),this._tourTarget=null;const u=e&&"object"==typeof r&&r?r.target:null;if(u){const t=document.querySelector(u);if(t&&t.classList&&(t.classList.add("c-tour__target"),this._tourTarget=t,"function"==typeof t.scrollIntoView))try{t.scrollIntoView({block:"nearest"})}catch(t){}}e&&this._positionTour(),e?this._tourFocusStep===s&&this._tourOpen||(this._tourFocusStep=s,queueMicrotask(()=>{if(!this.isConnected||!this.hasAttribute("open"))return;const t=this._tourTarget,e=t&&t.isConnected&&"function"==typeof t.focus&&!t.disabled&&t.matches("a[href], button, input, select, textarea, [tabindex]:not([tabindex='-1'])")?t:this.querySelector(".c-tour__next");if(e)try{e.focus({preventScroll:!0})}catch(t){try{e.focus()}catch(t){}}})):this._tourFocusStep=null,this._tourOpen=e}_positionTour(){const t=window.innerWidth,e=window.innerHeight,s=this.offsetWidth||280,r=this.offsetHeight||120,i=this._tourTarget;if(i&&i.getBoundingClientRect){const a=i.getBoundingClientRect();let n=a.bottom+8;n+r>e-8&&(n=Math.max(8,a.top-r-8));const o=Math.min(Math.max(8,a.left),Math.max(8,t-s-8));this.style.insetBlockStart=n+"px",this.style.insetInlineStart=o+"px",this.style.insetBlockEnd="auto",this.style.transform=""}else this.style.insetBlockStart="auto",this.style.insetBlockEnd="1rem",this.style.insetInlineStart="50%",this.style.transform="translateX(-50%)"}enhance(){if(this._wiredTour)return;this._wiredTour=!0;const t=t=>{const e=this._steps();if(!e.length||!this.hasAttribute("open"))return;const s=this._current(e.length);if("next"===t){if(s>=e.length-1)return void this.close();this.setAttribute("current",String(s+1)),this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:!0,composed:!0,detail:{direction:"next",index:s+1}}))}else{if(0===s)return;this.setAttribute("current",String(s-1)),this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:!0,composed:!0,detail:{direction:"prev",index:s-1}}))}};this._tourStep=t,this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target:null;s&&(s.closest(".c-tour__next")?t("next"):s.closest(".c-tour__back")?t("prev"):s.closest(".c-tour__close")&&this.close())});const e=e=>{if(!this.hasAttribute("open"))return;const s=e.target&&e.target.tagName;if("INPUT"===s||"TEXTAREA"===s||"SELECT"===s)return;if("Escape"===e.key)return void this.close();(this.contains(e.target)||this._tourTarget&&(e.target===this._tourTarget||this._tourTarget.contains(e.target)))&&("ArrowRight"===e.key?(e.preventDefault(),t("next")):"ArrowLeft"===e.key&&(e.preventDefault(),t("prev")))};document.addEventListener("keydown",e);const s=()=>{this.hasAttribute("open")&&this._positionTour()};window.addEventListener("scroll",s,{passive:!0,capture:!0}),window.addEventListener("resize",s,{passive:!0}),i(this,()=>{document.removeEventListener("keydown",e),window.removeEventListener("scroll",s,{capture:!0}),window.removeEventListener("resize",s),this._tourTarget&&this._tourTarget.classList&&this._tourTarget.classList.remove("c-tour__target")})}});c("contour-responsive-content",class extends T{static get observed(){return["breakpoint"]}static get properties(){return{breakpoint:{attribute:"breakpoint"}}}render(){this.classList.add("c-responsive-content");const t=this.getAttribute("breakpoint")||"md";this.dataset.breakpoint=t}});c("contour-palette-editor",class extends T{static get observed(){return["colors"]}static get properties(){return{colors:{attribute:"colors"}}}_palette(){let t=[];try{const e=this.getAttribute("colors");t=e?JSON.parse(e):[]}catch(t){f(this,"colors",t)}return Array.isArray(t)||(t=[]),t.map(t=>"string"==typeof t?{color:t,name:t}:{color:String(t.color||t.value||"#000000"),name:String(t.name||t.label||t.color||t.value||"color")})}_writePalette(t){this.setAttribute("colors",JSON.stringify(t.map(t=>t.name===t.color?t.color:{color:t.color,name:t.name})))}render(){this.classList.add("c-palette-editor"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"palette-editor","Palette editor"));const t=this._palette();Array.from(this.querySelectorAll(".c-palette-editor__swatch, .c-palette-editor__edit, .c-palette-editor__remove, .c-palette-editor__add, .c-palette-editor__contrast")).forEach(t=>t.remove()),t.forEach((t,e)=>{const s=document.createElement("button");s.className="c-palette-editor__swatch c-swatch"+(this._paletteSelected===e?" is-selected":""),s.type="button",s.style.background=_(t.color),s.dataset.color=t.color,s.dataset.index=String(e),s.setAttribute("aria-label",t.name),s.setAttribute("aria-pressed",String(this._paletteSelected===e)),this.appendChild(s);const r=document.createElement("input");r.type="color",r.className="c-palette-editor__edit",r.value=/^#[0-9a-f]{6}$/i.test(t.color)?t.color:"#000000",r.dataset.index=String(e),r.setAttribute("aria-label",k(this,"edit","Edit")+" "+t.name),this.appendChild(r);const i=document.createElement("button");i.type="button",i.className="c-palette-editor__remove",i.dataset.index=String(e),i.setAttribute("aria-label",k(this,"remove","Remove")+" "+t.name),i.textContent="×",this.appendChild(i)});const e=document.createElement("button");e.type="button",e.className="c-palette-editor__add",e.setAttribute("aria-label",k(this,"add-color","Add color")),e.textContent="+",this.appendChild(e);const s=t[this._paletteSelected];if(s){const t=(t=>{const e=/^#([0-9a-f]{6})$/i.exec(t);if(!e)return null;const s=parseInt(e[1],16),r=[s>>16&255,s>>8&255,255&s].map(t=>(t/=255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4));return.2126*r[0]+.7152*r[1]+.0722*r[2]})(s.color),e=document.createElement("span");if(e.className="c-palette-editor__contrast",null===t)e.textContent=s.color;else{const r=(t,e)=>(Math.max(t,e)+.05)/(Math.min(t,e)+.05),i=r(t,1),a=r(t,0),n=Math.max(i,a);e.textContent=s.name+": "+i.toFixed(1)+":1 on white, "+a.toFixed(1)+":1 on black — "+(n>=4.5?"AA":"below AA")}this.appendChild(e)}}enhance(){this._wiredPaletteEditor||(this._wiredPaletteEditor=!0,this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target:null;if(!e)return;const s=e.closest(".c-palette-editor__swatch");if(s&&this.contains(s))return this._paletteSelected=Number(s.dataset.index),this.requestRender(),void this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{color:s.dataset.color}}));const r=e.closest(".c-palette-editor__remove");if(r&&this.contains(r)){const t=this._palette(),e=Number(r.dataset.index),[s]=t.splice(e,1);return this._paletteSelected>=t.length&&(this._paletteSelected=t.length-1),this._writePalette(t),void this.dispatchEvent(new CustomEvent("contour:remove",{bubbles:!0,composed:!0,detail:{value:s?s.color:""}}))}if(e.closest(".c-palette-editor__add")){const t=this._palette(),e="#888888";t.push({color:e,name:e}),this._paletteSelected=t.length-1,this._writePalette(t),this.dispatchEvent(new CustomEvent("contour:add",{bubbles:!0,composed:!0,detail:{value:e}}))}}),this.addEventListener("change",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-palette-editor__edit"):null;if(!e||!this.contains(e))return;const s=this._palette(),r=Number(e.dataset.index);s[r]&&(s[r].color=e.value,(s[r].name===s[r].color||/^#[0-9a-f]{6}$/i.test(s[r].name))&&(s[r].name=e.value),this._writePalette(s),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{color:e.value,values:s.map(t=>t.color)}})))}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-palette-editor__swatch"));e.includes(t.target)&&z(t,e,{wrap:!0,enter:!0,onKey:(t,e,s)=>{"Enter"!==t&&" "!==t||s.click()}})}))}});c("contour-date-range",class extends T{static get observed(){return["start","end","label","time","min","max","locale","name","required","disabled"]}static get properties(){return{start:{attribute:"start"},end:{attribute:"end"},label:{attribute:"label"},time:{attribute:"time",type:Boolean},min:{attribute:"min"},max:{attribute:"max"},locale:{attribute:"locale"},name:{attribute:"name"},required:{attribute:"required",type:Boolean},disabled:{attribute:"disabled",type:Boolean}}}static get formAssociated(){return!0}render(){this.classList.add("c-date-range"),void 0===this._dateRangeDefaultStart&&(this._dateRangeDefaultStart=this.getAttribute("start"),this._dateRangeDefaultEnd=this.getAttribute("end")),this.setAttribute("role","group"),this.setAttribute("aria-label",this.getAttribute("label")||"Date range");const t=this.getAttribute("label");if(t){this.ensure(".c-date-range__label",()=>{const t=document.createElement("span");return t.className="c-date-range__label",t}).textContent=t}const e=this.ensure(".c-date-range__start",()=>{const t=document.createElement("input");return t.className="c-input c-date-range__start",t});e.type=this.hasAttribute("time")?"datetime-local":"date",e.value=this.getAttribute("start")||"",e.setAttribute("aria-label",t?t+" — start":"Start date");const s=this.ensure(".c-date-range__end",()=>{const t=document.createElement("input");return t.className="c-input c-date-range__end",t});s.type=e.type,s.value=this.getAttribute("end")||"",s.setAttribute("aria-label",t?t+" — end":"End date");const r=this.getAttribute("min"),i=this.getAttribute("max");[e,s].forEach(t=>{r?t.min=r:t.removeAttribute("min"),i?t.max=i:t.removeAttribute("max"),this.getAttribute("locale")&&(t.lang=this.getAttribute("locale")),this.hasAttribute("disabled")?t.setAttribute("disabled",""):t.removeAttribute("disabled")}),e.value&&(s.min=r&&r>e.value?r:e.value),s.value&&(e.max=i&&i<s.value?i:s.value),this.hasAttribute("required")?this.setAttribute("aria-required","true"):this.removeAttribute("aria-required"),this._internals&&this._syncFormValue()}enhance(){this._wiredDateRange||(this._wiredDateRange=!0,this.addEventListener("change",t=>{const e=t.target;if(e&&(e.classList.contains("c-date-range__start")||e.classList.contains("c-date-range__end"))){const t=this.querySelector(".c-date-range__start"),e=this.querySelector(".c-date-range__end");this.batch(()=>{t&&this.setAttribute("start",t.value),e&&this.setAttribute("end",e.value)}),this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{start:t?.value,end:e?.value}}))}}))}_syncFormValue(){if(!this._internals)return;const t=this.querySelector(".c-date-range__start")?.value||"",e=this.querySelector(".c-date-range__end")?.value||"",s=this.getAttribute("name");if(s&&(t||e)){const r=new FormData;t&&r.append(s,t),e&&r.append(s,e),this._internals.setFormValue(r)}else this._internals.setFormValue(null);const r=this.hasAttribute("required")&&(!t||!e),i=!!(t&&e&&t>e);r?this._internals.setValidity({valueMissing:!0},"Both dates are required."):i?this._internals.setValidity({customError:!0},"Start must be on or before end."):this._internals.setValidity({}),this._setCustomState("data-invalid",r||i);for(const t of this.querySelectorAll("input"))t.setAttribute("aria-invalid",String(r||i))}formResetCallback(){this._contourResetting=!0;try{null===this._dateRangeDefaultStart?this.removeAttribute("start"):this.setAttribute("start",this._dateRangeDefaultStart),null===this._dateRangeDefaultEnd?this.removeAttribute("end"):this.setAttribute("end",this._dateRangeDefaultEnd),this._syncFormValue()}finally{this._contourResetting=!1}}formStateRestoreCallback(t){if(!this._internals||null==t)return;const e=t instanceof FormData?Array.from(t.getAll(this.getAttribute("name"))).map(String):String(t).split(",");this._contourResetting=!0;try{this.setAttribute("start",e[0]||""),this.setAttribute("end",e[1]||""),this._syncFormValue()}finally{this._contourResetting=!1}}});c("contour-shortcut",class extends T{static get observed(){return["key","label"]}static get properties(){return{key:{attribute:"key"},label:{attribute:"label"}}}render(){this.classList.add("c-shortcut"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"Keyboard shortcut");const t=this.getAttribute("key")||"",e=this.getAttribute("label")||"";if(t){this.ensure(".c-shortcut__key",()=>{const t=document.createElement("kbd");return t.className="c-shortcut__key",t}).textContent=t}if(e){this.ensure(".c-shortcut__label",()=>{const t=document.createElement("span");return t.className="c-shortcut__label",t}).textContent=e}}enhance(){if(this._wiredShortcut)return;this._wiredShortcut=!0;const t=t=>{const e=this.getAttribute("key");e&&t.key===e&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:activate",{bubbles:!0,composed:!0})))};document.addEventListener("keydown",t),i(this,()=>document.removeEventListener("keydown",t))}});c("contour-date-picker",class extends T{static get formAssociated(){return!0}static get observed(){return["value","range","range-start","range-end","label","disabled","error","help","time","min","max","locale","required","name"]}static get properties(){return{value:{attribute:"value"},range:{attribute:"range",type:Boolean},rangeStart:{attribute:"range-start"},rangeEnd:{attribute:"range-end"},label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},time:{attribute:"time",type:Boolean},min:{attribute:"min"},max:{attribute:"max"},locale:{attribute:"locale"}}}render(){this.classList.add("c-date-picker"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"date-picker","Date picker"));const t=this.getAttribute("label");if(t){this.ensure(".c-date-picker__label",()=>{const t=document.createElement("label");return t.className="c-date-picker__label",t}).textContent=t}const e=this.keepNode(this.ensure(".c-date-picker__input",()=>{const t=document.createElement("input");return t.className="c-input c-date-picker__input",t})),s=this.hasAttribute("range"),r=this.hasAttribute("time")?"datetime-local":"date",i=(t,e,s)=>{t.type=r;const i=e||"";document.activeElement!==t&&t.value!==i&&(t.value=i),t.setAttribute("aria-label",s),this.hasAttribute("min")?t.min=this.getAttribute("min"):t.removeAttribute("min"),this.hasAttribute("max")?t.max=this.getAttribute("max"):t.removeAttribute("max"),this.hasAttribute("locale")?t.lang=this.getAttribute("locale"):t.removeAttribute("lang"),this.hasAttribute("disabled")?t.setAttribute("disabled",""):t.removeAttribute("disabled")};i(e,s?this.getAttribute("range-start"):this.getAttribute("value"),s?"Start date":t||"Date");let a=this.querySelector(".c-date-picker__end");s?(a=this.keepNode(a||document.createElement("input")),a.className="c-input c-date-picker__input c-date-picker__end",i(a,this.getAttribute("range-end"),"End date"),a.parentNode!==this&&this.appendChild(a)):a&&a.remove();const n=this.getAttribute("min"),c=this.getAttribute("max"),l=t=>{if(!n&&!c)return;const e=t.value;if(!e)return;let s=e;n&&s<n&&(s=n),c&&s>c&&(s=c),s!==e&&document.activeElement!==t&&(t.value=s)};l(e),a&&l(a),this.hasAttribute("disabled")?this.classList.add("is-disabled"):this.classList.remove("is-disabled");const u=this.getAttribute("error"),d=this.getAttribute("help");let h=this.querySelector(".c-date-picker__message");u||d?(h||(h=document.createElement("div"),h.className="c-date-picker__message",h.id||(h.id=o("c-date-picker-message")),this.appendChild(h)),h.textContent=u||d||"",h.classList.toggle("c-date-picker__message--error",!!u)):h&&h.remove(),u?this.classList.add("is-error"):this.classList.remove("is-error");let m=!!u;this.hasAttribute("range")&&(m=m||this._validateRange());const b=h?h.id:"",p=t=>{m?t.setAttribute("aria-invalid","true"):t.removeAttribute("aria-invalid"),b?t.setAttribute("aria-describedby",b):t.removeAttribute("aria-describedby")};p(e);const g=this.querySelector(".c-date-picker__end");g&&p(g);this.keepNode(this.ensure(".c-date-picker__calendar-toggle",()=>{const t=document.createElement("button");t.className="c-btn c-btn--sm c-date-picker__calendar-toggle",t.type="button",t.setAttribute("aria-label",k(this,"open-calendar","Open calendar")),t.setAttribute("aria-expanded","false");const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("aria-hidden","true");const s=document.createElementNS("http://www.w3.org/2000/svg","use");return s.setAttribute("href","#i-chevron-down"),e.appendChild(s),t.appendChild(e),t}));let _=this.querySelector(".c-date-picker__calendar");_||(_=document.createElement("div"),_.className="c-date-picker__calendar",_.setAttribute("hidden",""),_.setAttribute("role","dialog"),_.setAttribute("aria-label",k(this,"calendar","Calendar")),this.appendChild(_)),this.keepNode(_),this._internals&&this._syncFormValue()}_renderCalendar(){const t=this.querySelector(".c-date-picker__calendar");if(!t)return;const e=this.querySelector(".c-date-picker__input"),s=e&&e.value?(t=>{const e=/^(\d{4})-(\d{2})-(\d{2})/.exec(t||"");return e?new Date(Number(e[1]),Number(e[2])-1,Number(e[3])):new Date})(e.value):new Date,r=this._calMonth||new Date(s.getFullYear(),s.getMonth(),1);this._calMonth=r;const i=r.getFullYear(),a=r.getMonth(),n=this.getAttribute("locale")||void 0,o=this._datePickerFirstDayOfWeek(n),c=(new Date(i,a,1).getDay()-o+7)%7,l=new Date(i,a+1,0).getDate();L(t,"");const u=document.createElement("div");u.className="c-date-picker__calendar-header";const d=document.createElement("button");d.type="button",d.className="c-btn c-btn--sm c-btn--icon",L(d,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-left" /></svg>'),d.setAttribute("aria-label",k(this,"previous-month","Previous month"));const h=document.createElement("span");h.className="c-date-picker__calendar-title",h.textContent=r.toLocaleString(this.getAttribute("locale")||void 0,{month:"long",year:"numeric"});const m=document.createElement("button");m.type="button",m.className="c-btn c-btn--sm c-btn--icon",L(m,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),m.setAttribute("aria-label",k(this,"next-month","Next month")),u.appendChild(d),u.appendChild(h),u.appendChild(m),t.appendChild(u);const b=document.createElement("div");b.className="c-date-picker__calendar-grid",b.setAttribute("role","grid"),b.setAttribute("aria-label",h.textContent);const p=()=>{const t=document.createElement("div");return t.className="c-date-picker__calendar-row",t.setAttribute("role","row"),b.appendChild(t),t};let g=p(),_=0;const v=t=>{7===_&&(g=p(),_=0),g.appendChild(t),_++},y=["Su","Mo","Tu","We","Th","Fr","Sa"],f=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];for(let t=0;t<7;t++){const e=(o+t)%7,s=document.createElement("div");s.className="c-date-picker__calendar-weekday",s.setAttribute("role","columnheader");const r=new Date(2026,0,e+1);s.setAttribute("aria-label",r.toLocaleDateString(n,{weekday:"long"})||f[e]),s.textContent=r.toLocaleDateString(n,{weekday:"short"})||y[e],v(s)}for(let t=0;t<c;t++){const t=document.createElement("div");t.className="c-date-picker__calendar-day c-date-picker__calendar-day--empty",t.setAttribute("role","gridcell"),t.setAttribute("aria-hidden","true"),v(t)}const A=e?e.value:"",E=A&&A.slice(0,7)===`${i}-${String(a+1).padStart(2,"0")}`&&parseInt(A.slice(8,10),10)||1,w=this.getAttribute("min"),x=this.getAttribute("max");for(let s=1;s<=l;s++){const r=document.createElement("button");r.type="button",r.className="c-date-picker__calendar-day",r.textContent=String(s),r.setAttribute("role","gridcell"),r.setAttribute("tabindex",s===E?"0":"-1"),r.setAttribute("aria-label",new Date(i,a,s).toLocaleDateString(this.getAttribute("locale")||void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric"}));const n=`${i}-${String(a+1).padStart(2,"0")}-${String(s).padStart(2,"0")}`;A&&A.startsWith(n)&&(r.classList.add("is-selected"),r.setAttribute("aria-selected","true"));const o=w&&n<w||x&&n>x;r.disabled=o,o&&r.setAttribute("aria-disabled","true"),r.setAttribute("tabindex",o?"-1":s===E?"0":"-1"),o?v(r):(r.addEventListener("click",()=>{if(!e)return;if(this.hasAttribute("range")){const t=this.querySelector(".c-date-picker__end");!1!==this._rangeStartNext?(this.setAttribute("range-start",n),this._rangeStartNext=!1):t&&(this.setAttribute("range-end",n),this._rangeStartNext=!0)}else this.setAttribute("value",n);t.setAttribute("hidden","");const s=this.querySelector(".c-date-picker__calendar-toggle");s&&s.setAttribute("aria-expanded","false"),this._validateRange(),this._internals&&this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:this.getAttribute("value")}}))}),v(r))}t.appendChild(b),d.addEventListener("click",()=>{this._calMonth=new Date(i,a-1,1),this._renderCalendar()}),m.addEventListener("click",()=>{this._calMonth=new Date(i,a+1,1),this._renderCalendar()}),this._internals&&this._syncFormValue()}_syncFormValue(){if(!this._internals)return;const t=this.querySelector(".c-date-picker__input"),e=this.querySelector(".c-date-picker__end");if(this.hasAttribute("range")&&e){const s=t?t.value:"",r=e.value||"",i=this.getAttribute("name");if(i&&(s||r)){const t=new FormData;s&&t.append(i,s),r&&t.append(i,r),this._internals.setFormValue(t)}else this._internals.setFormValue(null)}else this._internals.setFormValue(t&&t.value?t.value:null);this._syncValidity(this.hasAttribute("required")&&!(t&&t.value))}formResetCallback(){const t=()=>{const t=this.querySelector(".c-date-picker__input"),e=this.querySelector(".c-date-picker__end");t&&(t.value=this.getAttribute("range-start")||this.getAttribute("value")||""),e&&(e.value=this.getAttribute("range-end")||""),this._syncFormValue()};t(),"function"==typeof queueMicrotask&&queueMicrotask(t)}_datePickerFirstDayOfWeek(t){return["en-US","en-CA","en-PH","ja-JP","ko-KR","th-TH","ar-SA","he-IL"].includes(String(t||"").toLowerCase())?0:1}_validateRange(){if(!this.hasAttribute("range"))return!1;const t=this.querySelector(".c-date-picker__input"),e=this.querySelector(".c-date-picker__end");if(!t||!e)return!1;const s=!!t.value&&!!e.value&&t.value>e.value;return this.getAttribute("error")||(s?(t.setAttribute("aria-invalid","true"),e.setAttribute("aria-invalid","true")):(t.removeAttribute("aria-invalid"),e.removeAttribute("aria-invalid"))),s}enhance(){if(this._wiredDatePicker)return;this._wiredDatePicker=!0,this._syncFormValue(),this.addEventListener("change",()=>{this._syncFormValue()}),this.addEventListener("change",t=>{const e=t.target;if(e&&e.classList.contains("c-date-picker__input")){const t=this.querySelector(".c-date-picker__end"),s=t?{start:this.querySelector(".c-date-picker__input").value,end:t.value}:{value:e.value};this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:s}))}});const t=()=>{const t=this.querySelector(".c-date-picker__calendar"),e=this.querySelector(".c-date-picker__calendar-toggle");if(!t)return;t.hasAttribute("hidden")?(t.removeAttribute("hidden"),e&&e.setAttribute("aria-expanded","true"),this._renderCalendar()):(t.setAttribute("hidden",""),e&&e.setAttribute("aria-expanded","false"))};this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-date-picker__calendar-toggle"):null;s&&this.contains(s)&&(e.preventDefault(),t());const r=this.querySelector(".c-date-picker__calendar");if(r&&!r.hasAttribute("hidden")&&!r.contains(e.target)&&!s){r.setAttribute("hidden","");const t=this.querySelector(".c-date-picker__calendar-toggle");t&&t.setAttribute("aria-expanded","false")}}),this.addEventListener("keydown",t=>{const e=this.querySelector(".c-date-picker__calendar");if(!e||e.hasAttribute("hidden"))return;if("Escape"===t.key){t.preventDefault(),e.setAttribute("hidden","");const s=this.querySelector(".c-date-picker__calendar-toggle");return void(s&&(s.setAttribute("aria-expanded","false"),s.focus()))}const s=Array.from(e.querySelectorAll('[role="gridcell"]:not([aria-hidden="true"])')),r=s.indexOf(document.activeElement);if(r<0)return;if("PageUp"===t.key||"PageDown"===t.key){t.preventDefault();const e=this.querySelector("PageUp"===t.key?".c-date-picker__calendar-header button:first-child":".c-date-picker__calendar-header button:last-child");return void(e&&e.click())}let i=-1;if("ArrowRight"===t.key)i=r+1;else if("ArrowLeft"===t.key)i=r-1;else if("ArrowDown"===t.key)i=r+7;else if("ArrowUp"===t.key)i=r-7;else if("Home"===t.key)i=0;else{if("End"!==t.key)return;i=s.length-1}t.preventDefault(),i<0||i>=s.length||(s.forEach((t,e)=>t.setAttribute("tabindex",e===i?"0":"-1")),s[i].focus())})}});c("contour-rating",class extends T{static get observed(){return["value","max","color","readonly","disabled","name"]}static get properties(){return{value:{attribute:"value",type:Number},max:{attribute:"max",type:Number},color:{attribute:"color"},readonly:{attribute:"readonly",type:Boolean},disabled:{attribute:"disabled",type:Boolean},name:{attribute:"name"}}}static get formAssociated(){return!0}render(){this.classList.add("c-rating"),this.hasAttribute("role")||this.setAttribute("role","radiogroup"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"rating","Rating"));const t=parseInt(this.getAttribute("max")||"5",10)||5,e=parseInt(this.getAttribute("value")||"0",10)||0,s=this.getAttribute("color"),r=w(this,"readonly"),i=w(this,"disabled");Array.from(this.querySelectorAll(".c-rating__star")).forEach(t=>t.remove());const a=e>=1&&e<=t?e:1;for(let n=1;n<=t;n++){const t=document.createElement("button");if(t.className="c-rating__star"+(n<=e?" c-rating__star--filled":""),t.type="button",t.setAttribute("role","radio"),t.setAttribute("aria-checked",String(n===e)),t.setAttribute("aria-label",n+(1===n?" star":" stars")),t.setAttribute("tabindex",String(n===a?0:-1)),(r||i)&&(t.setAttribute("aria-disabled","true"),t.disabled=!0,t.tabIndex=-1),L(t,'<span class="c-rating__swatch'+(n<=e?" c-rating__swatch--filled":"")+'" aria-hidden="true"></span>'),s&&n<=e){const e=t.firstChild,r=_(s);e&&r&&(e.style.backgroundColor=r,e.style.borderColor=r)}t.dataset.value=String(n),t.setAttribute("aria-label",n+" star"+(n>1?"s":"")),this.appendChild(t)}this._internals&&this._syncFormValue()}_syncFormValue(){if(!this._internals)return;const t=this.getAttribute("name"),e=this.getAttribute("value");t&&e?this._internals.setFormValue(e):this._internals.setFormValue(null)}enhance(){if(this._wiredRating)return;this._wiredRating=!0;const t=()=>Array.from(this.querySelectorAll(".c-rating__star")),e=e=>{w(this,"readonly")||w(this,"disabled")||(t().forEach(t=>{const s=parseInt(t.dataset.value,10)===e;t.setAttribute("aria-checked",String(s)),t.setAttribute("tabindex",s?"0":"-1"),t.classList.toggle("c-rating__star--filled",parseInt(t.dataset.value,10)<=e);const r=t.querySelector(".c-rating__swatch");r&&r.classList.toggle("c-rating__swatch--filled",parseInt(t.dataset.value,10)<=e)}),this.setAttribute("value",String(e)),this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:e}})))};this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-rating__star"):null;s&&this.contains(s)&&e(parseInt(s.dataset.value,10))}),this.addEventListener("keydown",s=>{const r=t();r.length&&z(s,r,{wrap:!1,homeEnd:!0,onNavigate:t=>{e(parseInt(r[t].dataset.value,10))},onKey:(t,s)=>{"Enter"!==t&&" "!==t||e(parseInt(r[s].dataset.value,10))}})})}});c("contour-time-picker",class extends T{static get formAssociated(){return!0}static get observed(){return["value","label","disabled","error","help"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"}}}render(){this.classList.add("c-time-picker"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"time-picker","Time picker"));const t=this.getAttribute("label");if(t){this.ensure(".c-time-picker__label",()=>{const t=document.createElement("label");return t.className="c-time-picker__label",t}).textContent=t}const e=this.ensure(".c-time-picker__input",()=>{const t=document.createElement("input");return t.className="c-input c-time-picker__input",t.type="time",t.setAttribute("aria-label",this.getAttribute("label")||"Time picker"),t});e.value=this.getAttribute("value")||"",this.hasAttribute("disabled")?(e.setAttribute("disabled",""),this.classList.add("is-disabled")):(e.removeAttribute("disabled"),this.classList.remove("is-disabled"));const s=this.getAttribute("error"),r=this.getAttribute("help");let i=this.querySelector(".c-time-picker__message");s||r?(i||(i=document.createElement("div"),i.className="c-time-picker__message",i.id||(i.id=o("c-time-picker-message")),this.appendChild(i)),i.textContent=s||r||"",i.classList.toggle("c-time-picker__message--error",!!s)):i&&i.remove(),s?this.classList.add("is-error"):this.classList.remove("is-error");const a=i?i.id:"";s?e.setAttribute("aria-invalid","true"):e.removeAttribute("aria-invalid"),a?e.setAttribute("aria-describedby",a):e.removeAttribute("aria-describedby"),this._internals&&this._syncFormValue()}enhance(){this._wiredTimePicker||(this._wiredTimePicker=!0,this._syncFormValue(),this.addEventListener("change",()=>{this._syncFormValue()}),this.addEventListener("change",t=>{const e=t.target;e&&e.classList.contains("c-time-picker__input")&&this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:e.value}}))}))}});c("contour-color-picker",class extends T{static get formAssociated(){return!0}static get observed(){return["value","label","disabled","required","error","help","alpha","presets"]}static get properties(){return{value:{attribute:"value"},label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean},required:{attribute:"required",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},alpha:{attribute:"alpha",type:Boolean},presets:{attribute:"presets"}}}render(){this.classList.add("c-color-picker"),this.setAttribute("role","group"),this.setAttribute("aria-label",k(this,"color-picker","Color picker"));const t=this.getAttribute("label");if(t){this.ensure(".c-color-picker__label",()=>{const t=document.createElement("label");return t.className="c-color-picker__label",t}).textContent=t}const e=this.ensure(".c-color-picker__input",()=>{const t=document.createElement("input");return t.className="c-color-picker__input",t.type="color",t}),s=this.getAttribute("value")||"",r=/^#?[0-9a-f]{6}([0-9a-f]{2})?$/i.test(s);if(r?(e.value=s.slice(0,7),this.removeAttribute("data-empty")):(e.value="",this.setAttribute("data-empty","")),e.hasAttribute("aria-label")||e.setAttribute("aria-label",t||"Color"),this.hasAttribute("required")?e.setAttribute("required",""):e.removeAttribute("required"),this.hasAttribute("disabled")?(e.setAttribute("disabled",""),this.classList.add("is-disabled")):(e.removeAttribute("disabled"),this.classList.remove("is-disabled")),this.hasAttribute("alpha")){const t=this.ensure(".c-color-picker__alpha",()=>{const t=document.createElement("input");return t.className="c-color-picker__alpha",t.type="range",t.min="0",t.max="1",t.step="0.01",t}),e=r&&9===s.length?parseInt(s.slice(7,9),16)/255:1;t.value=String(e),t.setAttribute("aria-label",k(this,"alpha","Alpha"))}else{const t=this.querySelector(".c-color-picker__alpha");t&&t.remove()}const i=this.getAttribute("presets");let a=[];if(i)try{a=JSON.parse(i)}catch(t){f(this,"presets",t),a=[]}const n=this.querySelector(".c-color-picker__presets");if(n&&n.remove(),Array.isArray(a)&&a.length){const t=document.createElement("div");t.className="c-color-picker__presets",a.forEach(e=>{const s=document.createElement("button");s.type="button",s.className="c-color-picker__preset";const r=_(e);r&&(s.style.background=r,s.dataset.color=r,s.setAttribute("aria-label",k(this,"preset","Preset")+" "+e),t.appendChild(s))}),this.appendChild(t)}if("undefined"!=typeof window&&"EyeDropper"in window){const t=this.ensure(".c-color-picker__eyedropper",()=>{const t=document.createElement("button");return t.className="c-color-picker__eyedropper",t.type="button",t.textContent=k(this,"pick","Pick"),t.setAttribute("aria-label",k(this,"pick-color","Pick color from screen")),t});this.hasAttribute("disabled")?t.setAttribute("disabled",""):t.removeAttribute("disabled")}else{const t=this.querySelector(".c-color-picker__eyedropper");t&&t.remove()}const c=this.getAttribute("error"),l=this.getAttribute("help");let u=this.querySelector(".c-color-picker__message");c||l?(u||(u=document.createElement("div"),u.className="c-color-picker__message",u.id||(u.id=o("c-color-picker-message")),this.appendChild(u)),u.textContent=c||l||"",u.classList.toggle("c-color-picker__message--error",!!c)):u&&u.remove(),c?this.classList.add("is-error"):this.classList.remove("is-error");const d=u?u.id:"";c?e.setAttribute("aria-invalid","true"):e.removeAttribute("aria-invalid"),d?e.setAttribute("aria-describedby",d):e.removeAttribute("aria-describedby"),this._internals&&this._syncFormValue()}enhance(){this._wiredColorPicker||(this._wiredColorPicker=!0,this._syncFormValue(),this.addEventListener("change",()=>{this._syncFormValue()}),this.addEventListener("contour:change",()=>{this._syncFormValue()}),this.addEventListener("change",t=>{const e=t.target;if(e&&e.classList.contains("c-color-picker__input")){const t=this.getAttribute("value")||"",s=9===t.length?t.slice(7,9):"",r=e.value.slice(0,7)+s;this.setAttribute("value",r),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:r}}))}if(e&&e.classList.contains("c-color-picker__alpha")){const t=(this.getAttribute("value")||"#000000").slice(0,7)+Math.round(255*parseFloat(e.value)).toString(16).padStart(2,"0");this.setAttribute("value",t),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t}}))}}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-color-picker__preset"):null;if(e&&this.contains(e)){const t=e.dataset.color;if(t){this.setAttribute("value",t);const e=this.querySelector(".c-color-picker__input");e&&(e.value=t.slice(0,7)),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t}}))}}const s=t.target&&t.target.closest?t.target.closest(".c-color-picker__eyedropper"):null;if(s&&this.contains(s)&&"undefined"!=typeof window&&"EyeDropper"in window){t.preventDefault();(new window.EyeDropper).open().then(t=>{if(t&&t.sRGBHex){this.setAttribute("value",t.sRGBHex);const e=this.querySelector(".c-color-picker__input");e&&(e.value=t.sRGBHex),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:t.sRGBHex}}))}}).catch(()=>{})}}))}});c("contour-number-field",class extends T{static get formAssociated(){return!0}static get observed(){return["value","min","max","step","label","disabled","error","help"]}static get properties(){return{value:{attribute:"value"},min:{attribute:"min"},max:{attribute:"max"},step:{attribute:"step"},label:{attribute:"label"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"}}}render(){this.classList.add("c-number-field");const t=this.getAttribute("label");if(t){this.ensure(".c-number-field__label",()=>{const t=document.createElement("label");return t.className="c-number-field__label",t}).textContent=t}const e=this.ensure(".c-number-field__input",()=>{const t=document.createElement("input");return t.className="c-input c-number-field__input",t.type="number",t.setAttribute("role","spinbutton"),t});e.id||(e.id=o("nf-input"));const s=this.querySelector(".c-number-field__label");s&&s.setAttribute("for",e.id),null!==this.getAttribute("value")&&(e.value=this.getAttribute("value")),null!==this.getAttribute("min")&&(e.min=this.getAttribute("min")),null!==this.getAttribute("max")&&(e.max=this.getAttribute("max")),null!==this.getAttribute("step")&&(e.step=this.getAttribute("step"));const r=e.value;e.setAttribute("aria-valuenow",""===r?"":r),""!==e.min&&e.setAttribute("aria-valuemin",e.min),""!==e.max&&e.setAttribute("aria-valuemax",e.max),e.hasAttribute("aria-label")||e.setAttribute("aria-label",t||"Number"),this.hasAttribute("disabled")?(e.setAttribute("disabled",""),this.classList.add("is-disabled")):(e.removeAttribute("disabled"),this.classList.remove("is-disabled"));const i=this.getAttribute("error"),a=this.getAttribute("help");let n=this.querySelector(".c-number-field__message");i||a?(n||(n=document.createElement("div"),n.className="c-number-field__message",this.appendChild(n)),n.id||(n.id=o("nf-msg")),n.textContent=i||a||"",n.classList.toggle("c-number-field__message--error",!!i),i?n.setAttribute("role","alert"):n.removeAttribute("role"),e.setAttribute("aria-describedby",n.id)):(n&&n.remove(),e.removeAttribute("aria-describedby")),i?(this.classList.add("is-error"),e.setAttribute("aria-invalid","true")):(this.classList.remove("is-error"),e.removeAttribute("aria-invalid")),this._internals&&this._syncFormValue()}enhance(){this._wiredNumberField||(this._wiredNumberField=!0,this._syncFormValue(),this.addEventListener("change",()=>{this._syncFormValue()}),this.addEventListener("change",t=>{const e=t.target;e&&e.classList.contains("c-number-field__input")&&this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:e.value}}))}),this.addEventListener("keydown",t=>{const e=this.querySelector(".c-number-field__input");if(!e||document.activeElement!==e)return;const s=Number(e.step)||1,r=""===e.min?-1/0:Number(e.min),i=""===e.max?1/0:Number(e.max);let a=null;"ArrowUp"===t.key?a=(Number(e.value)||0)+s:"ArrowDown"===t.key?a=(Number(e.value)||0)-s:"Home"===t.key?a=r===-1/0?0:r:"End"===t.key&&(a=i===1/0?Number(e.value)||0:i),null!==a&&(t.preventDefault(),a=Math.min(i,Math.max(r,a)),e.value=String(a),e.setAttribute("aria-valuenow",String(a)),this.setAttribute("value",String(a)),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{value:e.value}})))}))}});c("contour-file-upload",class extends T{static get formAssociated(){return!0}static get observed(){return["label","accept","multiple","progress","name"]}static get properties(){return{label:{attribute:"label"},accept:{attribute:"accept"},multiple:{attribute:"multiple",type:Boolean},progress:{attribute:"progress"},name:{attribute:"name"}}}render(){this.classList.add("c-file-upload"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||"File upload");const t=this.getAttribute("label")||"Drop files here or click to browse";this.ensure(".c-file-upload__dropzone",()=>{const t=document.createElement("div");return t.className="c-file-upload__dropzone",t.setAttribute("role","button"),t.tabIndex=0,t}).textContent=t;const e=this.ensure(".c-file-upload__input",()=>{const t=document.createElement("input");return t.className="c-file-upload__input",t.type="file",t.hidden=!0,t});this.keepNode(e),e.accept=this.getAttribute("accept")||"",e.multiple=this.hasAttribute("multiple");const s=this.getAttribute("progress");if(null!==s){const t=this.ensure(".c-file-upload__progress",()=>{const t=document.createElement("progress");return t.className="c-file-upload__progress",t});t.value=Number(s)||0,t.max=100}else{const t=this.querySelector(".c-file-upload__progress");t&&t.remove()}this.ensure(".c-file-upload__preview",()=>{const t=document.createElement("div");return t.className="c-file-upload__preview",t});this._internals&&this._syncFormValue()}enhance(){if(this._wiredFileUpload)return;this._wiredFileUpload=!0,this._syncFormValue(),this.addEventListener("change",()=>{this._syncFormValue()});const t=()=>this.querySelector(".c-file-upload__dropzone"),e=()=>this.querySelector(".c-file-upload__input"),s=()=>{const t=e();t&&t.click()},r=(t,e)=>{try{const s=new DataTransfer;Array.from(e||[]).forEach(t=>s.items.add(t)),t.files=s.files}catch(t){}};this.addEventListener("click",e=>{const r=t();(e.target===r||r&&r.contains(e.target))&&s()}),this.addEventListener("keydown",e=>{const r=t();!(e.target===r||r&&r.contains(e.target))||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())});const i=t=>{const e=this.querySelector(".c-file-upload__preview");e&&(this._revokeObjectUrls(),L(e,""),Array.from(t||[]).forEach(t=>{const s=document.createElement("div");if(s.className="c-file-upload__preview-item",t.type&&t.type.startsWith("image/")){const e=document.createElement("img");e.className="c-file-upload__preview-thumb",e.alt=t.name,e.loading="lazy",e.decoding="async";try{const s=URL.createObjectURL(t);e.src=s,(this._objectUrls||(this._objectUrls=[])).push(s)}catch(t){}s.appendChild(e)}else{const e=document.createElement("span");e.className="c-file-upload__preview-name",e.textContent=t.name,s.appendChild(e)}e.appendChild(s)}))};this.addEventListener("change",t=>{const e=t.target;e&&e.classList.contains("c-file-upload__input")&&(i(e.files),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{files:e.files}})))}),this.addEventListener("dragover",t=>{t.preventDefault(),this.classList.add("is-dragover")}),this.addEventListener("dragleave",()=>this.classList.remove("is-dragover")),this.addEventListener("drop",t=>{t.preventDefault(),this.classList.remove("is-dragover");const s=e();if(s&&t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length){const e=this.getAttribute("accept");if(e){const a=e.split(",").map(t=>t.trim().toLowerCase()),n=Array.from(t.dataTransfer.files).filter(t=>{const e=t.name.toLowerCase();return a.some(s=>s.startsWith(".")?e.endsWith(s):s.endsWith("/*")?t.type.toLowerCase().startsWith(s.slice(0,-1)):t.type.toLowerCase()===s)});if(0===n.length)return;r(s,n),i(n),this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{files:n}}))}else r(s,t.dataTransfer.files),i(t.dataTransfer.files),this._syncFormValue(),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{files:t.dataTransfer.files}}))}})}disconnectedCallback(){super.disconnectedCallback(),this._revokeObjectUrls()}_revokeObjectUrls(){this._objectUrls&&(this._objectUrls.forEach(t=>{try{URL.revokeObjectURL(t)}catch(t){}}),this._objectUrls=[])}_syncFormValue(){if(!this._internals)return;const t=this.querySelector(".c-file-upload__input");if(t&&t.files&&t.files.length){const e=new FormData,s=this.getAttribute("name")||"file";Array.from(t.files).forEach(t=>e.append(s,t)),this._internals.setFormValue(e)}else this._internals.setFormValue(null)}});c("contour-tags-input",class extends T{static get formAssociated(){return!0}static get observed(){return["value","placeholder","disabled","error","help","required","max"]}static get properties(){return{value:{attribute:"value"},placeholder:{attribute:"placeholder"},disabled:{attribute:"disabled",type:Boolean},error:{attribute:"error"},help:{attribute:"help"},required:{attribute:"required",type:Boolean},max:{attribute:"max"}}}render(){this.classList.add("c-tags-input"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"tags-input","Tags input"));const t=this.ensure(".c-tags-input__input",()=>{const t=document.createElement("input");return t.className="c-input c-tags-input__input",t.type="text",t.setAttribute("aria-label",k(this,"add-tag","Add tag")),t});t.placeholder=this.getAttribute("placeholder")||"Add tag…",this.hasAttribute("disabled")?(t.setAttribute("disabled",""),this.classList.add("is-disabled")):(t.removeAttribute("disabled"),this.classList.remove("is-disabled"));const e=this.getAttribute("error"),s=this.getAttribute("help");let r=this.querySelector(".c-tags-input__message");e||s?(r||(r=document.createElement("div"),r.className="c-tags-input__message",this.appendChild(r)),r.id||(r.id=o("ti-msg")),r.textContent=e||s||"",r.classList.toggle("c-tags-input__message--error",!!e),e?r.setAttribute("role","alert"):r.removeAttribute("role"),t.setAttribute("aria-describedby",r.id)):(r&&r.remove(),t.removeAttribute("aria-describedby")),e?(this.classList.add("is-error"),t.setAttribute("aria-invalid","true")):(this.classList.remove("is-error"),t.removeAttribute("aria-invalid"));const i=this.getAttribute("value");let a=[];try{a=i?JSON.parse(i):[]}catch(t){a=i?i.split(",").map(t=>t.trim()).filter(Boolean):[]}Array.from(this.querySelectorAll(".c-tags-input__tag")).forEach(t=>t.remove()),a.forEach(e=>{const s=document.createElement("span");s.className="c-tag c-tags-input__tag",s.textContent=e;const r=document.createElement("button");r.className="c-tags-input__remove",r.type="button",r.textContent="×",r.setAttribute("aria-label",k(this,"remove","Remove")+" "+e),r.dataset.value=e,s.appendChild(r),this.insertBefore(s,t)}),this._internals&&this._syncFormValue()}enhance(){if(this._wiredTagsInput)return;this._wiredTagsInput=!0,this._syncFormValue(),this.addEventListener("contour:add",()=>{this._syncFormValue()}),this.addEventListener("contour:remove",()=>{this._syncFormValue()});const t=t=>{let e=this.querySelector(".c-tags-input__live");e||(e=document.createElement("span"),e.className="c-tags-input__live visually-hidden",e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),this.appendChild(e)),e.textContent=t},e=()=>{const t=this.getAttribute("value")||"";let e=[];try{e=JSON.parse(t)}catch(s){e=t.split(",").map(t=>t.trim()).filter(Boolean)}return Array.isArray(e)?e.map(String):[]},s=s=>{if(this.hasAttribute("disabled"))return;const r=e(),i=Number(this.getAttribute("max")),a=[],n=[];let o=!1;for(const t of s){const e=String(t).trim();if(e)if(r.includes(e))n.push(e);else{if(Number.isFinite(i)&&i>0&&r.length>=i){o=!0;break}r.push(e),a.push(e)}}if(a.length){this.setAttribute("value",JSON.stringify(r));for(const t of a)this.dispatchEvent(new CustomEvent("contour:add",{bubbles:!0,composed:!0,detail:{value:t}}))}const c=[];a.length&&c.push("Added "+a.join(", ")),n.length&&c.push(n.join(", ")+" already added"),o&&c.push("Tag limit reached ("+i+")"),c.length&&t(c.join(". "))};this.addEventListener("keydown",r=>{const i=this.querySelector(".c-tags-input__input");if(i&&!this.hasAttribute("disabled"))if("Enter"===r.key&&r.target===i){r.preventDefault();const t=i.value;i.value="",s([t])}else if("Backspace"===r.key&&r.target===i&&""===i.value){const s=e();if(s.length){const e=s.pop();this.setAttribute("value",JSON.stringify(s)),t("Removed "+e),this.dispatchEvent(new CustomEvent("contour:remove",{bubbles:!0,composed:!0,detail:{value:e}}))}}}),this.addEventListener("input",t=>{const e=this.querySelector(".c-tags-input__input");if(e&&t.target===e&&!this.hasAttribute("disabled")&&e.value.includes(",")){const t=e.value.split(",");e.value=t.pop(),s(t)}}),this.addEventListener("paste",t=>{const e=this.querySelector(".c-tags-input__input");if(!e||t.target!==e||this.hasAttribute("disabled"))return;const r=t.clipboardData&&t.clipboardData.getData("text/plain");r&&/[,;\n]/.test(r)&&(t.preventDefault(),s(r.split(/[,;\n]+/)))}),this.addEventListener("click",s=>{const r=s.target&&s.target.closest?s.target.closest(".c-tags-input__remove"):null;if(r&&this.contains(r)&&!this.hasAttribute("disabled")){const s=r.dataset.value,i=e().filter(t=>t!==s);this.setAttribute("value",JSON.stringify(i)),t("Removed "+s),this.dispatchEvent(new CustomEvent("contour:remove",{bubbles:!0,composed:!0,detail:{value:s}}))}})}_syncFormValue(){if(!this._internals)return;this._internals.setFormValue(this.getAttribute("value")||"[]");let t=0;try{const e=JSON.parse(this.getAttribute("value")||"[]");t=Array.isArray(e)?e.length:0}catch(e){t=(this.getAttribute("value")||"").split(",").filter(t=>t.trim()).length}this._syncValidity(this.hasAttribute("required")&&0===t)}});c("contour-swatch",class extends T{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"),this.hasAttribute("role")||this.setAttribute("role","button"),"button"!==this.getAttribute("role")||this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",this.getAttribute("label")||this.getAttribute("color")||"Swatch");const t=_(this.getAttribute("color"))||"var(--color-surface-3)";if(this.style.setProperty("--swatch-color",t),this.hasAttribute("selected")?this.classList.add("is-selected"):this.classList.remove("is-selected"),"button"===this.getAttribute("role")&&this.setAttribute("aria-pressed",String(this.hasAttribute("selected"))),!this.hasAttribute("aria-label")){const e=this.getAttribute("label")||t;this.setAttribute("aria-label",e)}if(!this.querySelector("button")&&!this.querySelector("span")){const t=document.createElement("span");t.className="c-swatch__btn",t.setAttribute("aria-hidden","true"),this.appendChild(t)}}enhance(){this._wiredSwatch||(this._wiredSwatch=!0,this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{value:this.getAttribute("color")}}))}),this.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{value:this.getAttribute("color")}})))}))}});c("contour-calendar",class extends T{static get observed(){return["value","month","year","range","start","end"]}static get properties(){return{value:{attribute:"value"},month:{attribute:"month"},year:{attribute:"year"},range:{attribute:"range",type:Boolean},start:{attribute:"start"},end:{attribute:"end"}}}_attrNum(t,e){const s=this.getAttribute(t),r=Number(s);return null!==s&&Number.isFinite(r)?r:e}_ym(){const t=new Date;return{year:this._attrNum("year",t.getFullYear()),month:this._attrNum("month",t.getMonth())}}render(){this.classList.add("c-calendar");const t=new Date,{year:e,month:s}=this._ym(),r=this.ensure(".c-calendar__header",()=>{const t=document.createElement("div");return t.className="c-calendar__header",t});L(r,"");const i=(t,e,s)=>{const r=document.createElement("button");return r.type="button",r.className="c-btn c-btn--sm "+t,r.textContent=e,r.setAttribute("aria-label",s),r},a=i("c-calendar__prev-year","","Previous year");L(a,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevrons-left" /></svg>');const n=i("c-calendar__prev","","Previous month");L(n,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-left" /></svg>');const o=document.createElement("span");o.className="c-calendar__title",o.textContent=new Date(e,s,1).toLocaleString(void 0,{month:"long",year:"numeric"});const c=i("c-calendar__next","","Next month");L(c,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>');const l=i("c-calendar__next-year","","Next year");L(l,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevrons-right" /></svg>'),r.append(a,n,o,c,l);const u=this.ensure(".c-calendar__grid",()=>{const t=document.createElement("div");return t.className="c-calendar__grid",t.setAttribute("role","grid"),t});u.setAttribute("aria-label",o.textContent),L(u,"");const d=new Date(e,s,1).getDay(),h=new Date(e,s+1,0).getDate(),m=this.hasAttribute("range"),b=this.getAttribute("value"),p=this.getAttribute("start"),g=this.getAttribute("end");let _=null,v=0;const y=()=>{_=document.createElement("div"),_.className="c-calendar__row",_.setAttribute("role","row"),u.appendChild(_),v=0},f=new Intl.DateTimeFormat(void 0,{weekday:"short"});y();for(let t=0;t<7;t++){const e=document.createElement("div");e.className="c-calendar__weekday",e.setAttribute("role","columnheader"),e.textContent=f.format(new Date(2023,0,1+t)),_.appendChild(e)}y();for(let t=0;t<d;t++){const t=document.createElement("div");t.className="c-calendar__day c-calendar__day--empty",_.appendChild(t),v++,7===v&&y()}const A=t.getFullYear()+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0"),E=b&&b.startsWith(e+"-"+String(s+1).padStart(2,"0"))?b:A.startsWith(e+"-"+String(s+1).padStart(2,"0"))?A:e+"-"+String(s+1).padStart(2,"0")+"-01";for(let t=1;t<=h;t++){const r=document.createElement("button");r.className="c-calendar__day",r.type="button",r.setAttribute("role","gridcell"),r.textContent=String(t);const i=e+"-"+String(s+1).padStart(2,"0")+"-"+String(t).padStart(2,"0"),a=m?i===p||i===g:i===b;a&&r.classList.add("is-selected"),m&&p&&g&&i>p&&i<g&&r.classList.add("is-in-range"),r.setAttribute("aria-selected",String(a)),i===A&&r.setAttribute("aria-current","date"),r.setAttribute("tabindex",i===E?"0":"-1"),r.dataset.value=i,_.appendChild(r),v++,7===v&&y()}r.parentNode!==this&&this.insertBefore(r,u)}enhance(){if(this._wiredCalendar)return;this._wiredCalendar=!0;const t=(t,e)=>{this.batch(()=>{this.setAttribute("month",String(t)),this.setAttribute("year",String(e))}),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{month:t,year:e}}))},e=t=>{const e=this.querySelector('.c-calendar__day[data-value="'+t+'"]');if(e)try{e.focus()}catch(t){}};this.addEventListener("focusin",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-calendar__day:not(.c-calendar__day--empty)"):null;if(e&&this.contains(e)){for(const t of this.querySelectorAll(".c-calendar__day"))t.tabIndex=-1;e.tabIndex=0}}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target:null;if(!s)return;const{year:r,month:i}=this._ym();if(s.closest(".c-calendar__prev")){const e=new Date(r,i-1,1);return void t(e.getMonth(),e.getFullYear())}if(s.closest(".c-calendar__next")){const e=new Date(r,i+1,1);return void t(e.getMonth(),e.getFullYear())}if(s.closest(".c-calendar__prev-year"))return void t(i,r-1);if(s.closest(".c-calendar__next-year"))return void t(i,r+1);const a=s.closest(".c-calendar__day");if(a&&this.contains(a)&&a.dataset.value){const t=a.dataset.value;if(this.hasAttribute("range")){const e=this.getAttribute("start"),s=this.getAttribute("end");let r,i;!e||e&&s?(r=t,i=null):(r=t<e?t:e,i=t<e?e:t),this.batch(()=>{this.setAttribute("start",r),null===i?this.removeAttribute("end"):this.setAttribute("end",i)}),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{value:t,range:i?[r,i]:[r]}}))}else this.setAttribute("value",t),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{value:t}}))}}),this.addEventListener("keydown",s=>{const r=s.target&&s.target.closest?s.target.closest(".c-calendar__day:not(.c-calendar__day--empty)"):null;if(!r||!this.contains(r)||!r.dataset.value)return;const[i,a,n]=r.dataset.value.split("-").map(Number),{year:o,month:c}=(new Date(i,a-1,n),this._ym()),l=new Date(o,c+1,0).getDate();let u=null;if("ArrowRight"===s.key)u=new Date(i,a-1,n+1);else if("ArrowLeft"===s.key)u=new Date(i,a-1,n-1);else if("ArrowDown"===s.key)u=new Date(i,a-1,n+7);else if("ArrowUp"===s.key)u=new Date(i,a-1,n-7);else if("PageUp"===s.key)u=s.shiftKey?new Date(i-1,a-1,Math.min(n,new Date(i-1,a,0).getDate())):new Date(i,a-2,Math.min(n,new Date(i,a-1,0).getDate()));else if("PageDown"===s.key)u=s.shiftKey?new Date(i+1,a-1,Math.min(n,new Date(i+1,a,0).getDate())):new Date(i,a,Math.min(n,new Date(i,a+1,0).getDate()));else if("Home"===s.key)u=new Date(o,c,1);else{if("End"!==s.key)return;u=new Date(o,c,l)}s.preventDefault();const d=(h=u).getFullYear()+"-"+String(h.getMonth()+1).padStart(2,"0")+"-"+String(h.getDate()).padStart(2,"0");var h;u.getFullYear()===o&&u.getMonth()===c||t(u.getMonth(),u.getFullYear()),e(d)})}});c("contour-notification-center",class extends T{static get observed(){return["count","items","color"]}static get properties(){return{count:{attribute:"count"},items:{attribute:"items"},color:{attribute:"color"}}}render(){this.classList.add("c-notification-center"),this.setAttribute("role","group");const t=this.ensure(".c-notification-center__trigger",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-btn--icon c-notification-center__trigger",t.type="button",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-bell" /></svg><span class="c-notification-center__bullet" aria-hidden="true"></span>'),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-label",k(this,"notifications","Notifications")),t}),e=this.getAttribute("color"),s=t.querySelector(".c-notification-center__bullet");s&&e&&(s.style.background=_(e),s.dataset.color=e);const r=this.ensure(".c-notification-center__panel",()=>{const t=document.createElement("div");return t.className="c-notification-center__panel",t.hidden=!0,t.setAttribute("role","dialog"),t.setAttribute("aria-label",k(this,"notifications","Notifications")),t});r.hidden=!this._notifOpen,t.setAttribute("aria-expanded",String(!!this._notifOpen));const i=Array.from(this.querySelectorAll(":scope > .c-notification-center__item")),a=this.getAttribute("items");if(i.length){L(r,"");const t=document.createElement("div");t.setAttribute("role","list"),t.setAttribute("aria-label",k(this,"notifications","Notifications")),this._notifAuthored||(this._notifAuthored=[]),i.forEach(e=>{t.appendChild(e),this._notifAuthored.push(e)}),r.appendChild(t)}else if(a){let t=null;try{t=JSON.parse(a)}catch(t){f(this,"items",t)}if(L(r,""),Array.isArray(t)){const e=document.createElement("div");e.setAttribute("role","list"),e.setAttribute("aria-label",k(this,"notifications","Notifications"));const s=this._notifShown||50;t.slice(0,s).forEach(t=>{const s=document.createElement("div");s.className="c-notification-center__item"+(t&&t.read?" is-read":""),s.setAttribute("tabindex","-1"),s.setAttribute("role","listitem"),t&&t.current&&s.setAttribute("aria-current","true"),s.dataset.read=t&&t.read?"true":"false";const r=document.createElement("span");r.className="c-notification-center__item-label",r.textContent="string"==typeof t?t:t.text||t.title||"",s.appendChild(r);const i=document.createElement("button");i.type="button",i.className="c-notification-center__archive",i.setAttribute("aria-label",k(this,"archive","Archive notification")),i.textContent="⤓",i.tabIndex=-1,s.appendChild(i);const a=document.createElement("button");a.type="button",a.className="c-notification-center__dismiss",a.setAttribute("aria-label",k(this,"dismiss","Dismiss notification")),a.textContent="×",a.tabIndex=-1,s.appendChild(a),e.appendChild(s)});const i=e.querySelector(".c-notification-center__item");if(i&&(i.tabIndex=0),r.appendChild(e),t.length){if(t.length>s){const e=document.createElement("button");e.type="button",e.className="c-btn c-btn--sm c-notification-center__more",e.textContent=k(this,"more","Show more")+" ("+(t.length-s)+")",r.appendChild(e)}}else{const t=document.createElement("div");t.className="c-notification-center__empty",t.textContent=k(this,"empty","No notifications"),r.appendChild(t)}}else{const t=document.createElement("div");t.className="c-notification-center__error",t.setAttribute("role","alert"),t.textContent=k(this,"error","Could not load notifications"),r.appendChild(t)}}this._syncNotifBadge()}_syncNotifBadge(){const t=this.querySelector(".c-notification-center__trigger");if(!t)return;const e=Array.from(this.querySelectorAll(".c-notification-center__item"));let s;s=this._notifInteracted||!this.hasAttribute("count")?e.filter(t=>"true"!==t.dataset.read).length:Number(this.getAttribute("count"))||0;let r=t.querySelector(".c-notification-center__badge");s>0?(r||(r=document.createElement("span"),r.className="c-notification-center__badge c-badge c-badge--dot",t.appendChild(r)),r.textContent=String(s)):r&&r.remove()}enhance(){if(this._wiredNotifCenter)return;this._wiredNotifCenter=!0;const t=t=>{"true"!==t.dataset.read&&(t.dataset.read="true",t.classList.add("is-read"),this._notifInteracted=!0,this._syncNotifBadge(),this.dispatchEvent(new CustomEvent("contour:read",{bubbles:!0,composed:!0,detail:{label:t.querySelector(".c-notification-center__item-label")?.textContent||t.textContent}})));for(const e of this.querySelectorAll(".c-notification-center__item"))e===t?e.setAttribute("aria-current","true"):e.removeAttribute("aria-current");this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{label:t.querySelector(".c-notification-center__item-label")?.textContent||t.textContent}}))},e=(t,e)=>{const s=t.querySelector(".c-notification-center__item-label")?.textContent||t.textContent;t.remove(),this._notifInteracted=!0,this._syncNotifBadge(),this.dispatchEvent(new CustomEvent("archive"===e?"contour:remove":"contour:dismiss",{bubbles:!0,composed:!0,detail:{label:s}}))};this.addEventListener("click",s=>{const r=this.querySelector(".c-notification-center__trigger"),i=this.querySelector(".c-notification-center__panel");if(r&&(s.target===r||r.contains(s.target)))return void(i&&(i.hidden=!i.hidden,this._notifOpen=!i.hidden,r.setAttribute("aria-expanded",String(!i.hidden)),this.dispatchEvent(new CustomEvent(i.hidden?"contour:close":"contour:open",{bubbles:!0,composed:!0}))));const a=s.target&&s.target.closest?s.target.closest(".c-notification-center__more"):null;if(a&&this.contains(a))return this._notifShown=(this._notifShown||50)+50,void this.requestRender();const n=s.target&&s.target.closest?s.target.closest(".c-notification-center__archive"):null;if(n&&this.contains(n)){const t=n.closest(".c-notification-center__item");return void(t&&e(t,"archive"))}const o=s.target&&s.target.closest?s.target.closest(".c-notification-center__dismiss"):null;if(o&&this.contains(o)){const t=o.closest(".c-notification-center__item");return void(t&&e(t,"dismiss"))}const c=s.target&&s.target.closest?s.target.closest(".c-notification-center__item"):null;c&&this.contains(c)&&t(c)});const s=t=>{const e=this.querySelector(".c-notification-center__panel"),s=this.querySelector(".c-notification-center__trigger");!e||e.hidden||this.contains(t.target)||(e.hidden=!0,this._notifOpen=!1,s&&s.setAttribute("aria-expanded","false"))};document.addEventListener("click",s),i(this,()=>document.removeEventListener("click",s));const r=s=>{const r=this.querySelector(".c-notification-center__panel"),i=this.querySelector(".c-notification-center__trigger");if("Escape"===s.key&&r&&!r.hidden){if(r.hidden=!0,this._notifOpen=!1,i){i.setAttribute("aria-expanded","false");try{i.focus()}catch(t){}}return}if(!r||r.hidden)return;const a=Array.from(r.querySelectorAll(".c-notification-center__item"));if(a.length){if(("Enter"===s.key||" "===s.key)&&a.includes(s.target))return s.preventDefault(),void t(s.target);if(("Delete"===s.key||"Backspace"===s.key)&&a.includes(s.target)){s.preventDefault();const t=a.indexOf(s.target);e(s.target,"dismiss");const r=a[t+1]||a[t-1];if(r&&r.isConnected)try{r.focus()}catch(t){}return}z(s,a,{wrap:!0,onNavigate:t=>{a.forEach((e,s)=>{e.tabIndex=s===t?0:-1})}})}};document.addEventListener("keydown",r),i(this,()=>document.removeEventListener("keydown",r))}});c("contour-stepper",class extends T{static get observed(){return["steps","current"]}static get properties(){return{steps:{attribute:"steps"},current:{attribute:"current"}}}render(){this.classList.add("c-stepper"),this.hasAttribute("role")||this.setAttribute("role","group"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"stepper","Stepper"));const t=this.getAttribute("steps"),e=Number(this.getAttribute("current")||0),s=this.ensure(".c-stepper__list",()=>{const t=document.createElement("ol");return t.className="c-stepper__list",t});L(s,"");const r=Array.from(this.querySelectorAll(":scope > .c-stepper__step"));let i=[];if(r.length)i=r.map(t=>t.textContent.trim()),this._stepperAuthored=i,r.forEach(t=>t.remove());else if(t)try{i=JSON.parse(t)}catch(t){f(this,"steps",t),i=this._stepperAuthored||[]}else i=this._stepperAuthored||[];i.forEach((t,r)=>{const i=document.createElement("li");i.className="c-stepper__step"+(r===e?" is-current":"")+(r<e?" is-done":""),r===e&&i.setAttribute("aria-current","step"),i.setAttribute("tabindex",r===e?"0":"-1");const a=document.createElement("span");a.className="c-stepper__marker",a.setAttribute("aria-hidden","true"),r<e?L(a,'<svg viewBox="0 0 24 24"><use href="#i-check" /></svg>'):a.textContent=String(r+1),i.appendChild(a);const n=document.createElement("span");n.className="c-stepper__label",n.textContent="string"==typeof t?t:t.title||t.label||"",i.appendChild(n),s.appendChild(i)});const a=this.ensure(".c-stepper__nav",()=>{const t=document.createElement("div");return t.className="c-stepper__nav c-btn-group",t}),n=this.ensure(".c-stepper__prev",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-stepper__prev",t.type="button",t});n.textContent=k(this,"prev","Back"),e<=0?n.setAttribute("disabled",""):n.removeAttribute("disabled");const o=this.ensure(".c-stepper__next",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-stepper__next",t.type="button",t});o.textContent=k(this,"next","Next"),e>=i.length-1?o.setAttribute("disabled",""):o.removeAttribute("disabled"),a.contains(n)||a.appendChild(n),a.contains(o)||a.appendChild(o),a.parentNode!==this&&this.appendChild(a)}enhance(){if(this._wiredStepper)return;this._wiredStepper=!0;const t=t=>{const e=this.querySelector(".c-stepper__list"),s=e?e.querySelectorAll(".c-stepper__step").length:0;if(!s)return;let r=Number(this.getAttribute("current")||0);r="prev"===t?Math.max(0,r-1):Math.min(s-1,r+1),this.setAttribute("current",String(r)),this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:!0,composed:!0,detail:{direction:t,index:r}}))};this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest(".c-stepper__prev"):null,r=e.target&&e.target.closest?e.target.closest(".c-stepper__next"):null;if(s&&this.contains(s))return void t("prev");if(r&&this.contains(r))return void t("next");const i=e.target&&e.target.closest?e.target.closest(".c-stepper__step"):null;if(i&&this.contains(i)){const t=Array.from(this.querySelectorAll(".c-stepper__step")).indexOf(i);t>=0&&t!==Number(this.getAttribute("current")||0)&&(this.setAttribute("current",String(t)),this.dispatchEvent(new CustomEvent("contour:step-change",{bubbles:!0,composed:!0,detail:{direction:"jump",index:t}})))}}),this.addEventListener("keydown",e=>{"ArrowLeft"===e.key?(e.preventDefault(),t("prev")):"ArrowRight"===e.key&&(e.preventDefault(),t("next"))})}});c("contour-virtual-list",class extends T{static get updateMode(){return"keyed"}static get observed(){return["items","item-height","orientation","sticky"]}static get properties(){return{items:{attribute:"items"},"item-height":{attribute:"item-height"},orientation:{attribute:"orientation"},sticky:{attribute:"sticky",type:Boolean}}}_items(){const t=this.getAttribute("items");let e=[];try{e=t?JSON.parse(t):[]}catch(t){f(this,"items",t),e=[]}return Array.isArray(e)?e:[]}_itemHeight(){const t=Number(this.getAttribute("item-height"));return Number.isFinite(t)&&t>0?t:y("--virtual-list-item-height",28)}_autoHeight(){return"auto"===this.getAttribute("item-height")}render(){this.classList.add("c-virtual-list"),this.setAttribute("role","list"),this.hasAttribute("aria-label")||this.setAttribute("aria-label",k(this,"virtual-list","Virtual list"));const t=this.ensure(".c-virtual-list__scroller",()=>{const t=document.createElement("div");return t.className="c-virtual-list__scroller",t});t.setAttribute("role","presentation");const e="horizontal"===this.getAttribute("orientation");t.style.overflowX=e?"auto":"hidden",t.style.overflowY=e?"hidden":"auto";const s=this.ensure(".c-virtual-list__inner",()=>{const t=document.createElement("div");return t.className="c-virtual-list__inner",t.style.position="relative",t});s.parentNode!==t&&t.appendChild(s),this._renderWindow(t,s,e?t.scrollLeft||0:t.scrollTop||0)}_measureHeights(t,e){return Array.from(t.querySelectorAll(".c-virtual-list__item")).map(t=>e?t.getBoundingClientRect().width||this._itemHeight():t.getBoundingClientRect().height||this._itemHeight())}_renderWindow(t,e,s){const r=this._items(),i=this._itemHeight(),a="horizontal"===this.getAttribute("orientation"),n=this._autoHeight(),o=a?t.clientWidth||320:t.clientHeight||320,c=r.length;this._vlItemCount!==c&&(this._vlHeights=null,this._vlItemCount=c);let l=n?this._vlHeights:null,u=null;if(n&&l&&l.length===c){u=[0];for(let t=0;t<c;t++)u.push(u[t]+(l[t]||this._itemHeight()))}const d=n&&!u?c:n?Math.ceil(o/this._itemHeight())+6:Math.ceil(o/i)+4;let h=0;if(n&&u){let t=0,e=c;for(;t<e;){const r=t+e>>1;u[r]<(s||0)?t=r+1:e=r}h=Math.max(0,t-3)}else n||(h=Math.floor((s||0)/i));h<0&&(h=0);const m=Math.min(c,h+d);h>Math.max(0,c-d)&&!n&&(h=Math.max(0,c-d));const b=n&&u?u[h]:n?0:h*i,p=n&&u?Math.max(0,u[c]-u[m]):n?0:Math.max(0,(c-m)*i);e.style.display=a?"flex":"block",e.style.width=a&&n?"max-content":"",e.style.height=a||n?"":c*i+"px",L(e,"");const g=document.createElement("div");g.className="c-virtual-list__spacer c-virtual-list__spacer--top",g.style[a?"width":"height"]=b+"px",e.appendChild(g);for(let t=h;t<m;t++){const s=document.createElement("div");s.className="c-virtual-list__item",s.setAttribute("role","listitem"),s.setAttribute("aria-setsize",String(c)),s.setAttribute("aria-posinset",String(t+1)),s.setAttribute("tabindex",0===t?"0":"-1"),s.textContent="string"==typeof r[t]?r[t]:r[t].label||r[t].text||JSON.stringify(r[t]),this.hasAttribute("sticky")&&r[t]&&r[t].sticky&&(s.style.position="sticky",s.style.insetBlockStart="0",s.style.zIndex="1"),a&&!n&&(s.style.flex="0 0 "+i+"px"),s.dataset.index=String(t),e.appendChild(s)}const _=document.createElement("div");_.className="c-virtual-list__spacer c-virtual-list__spacer--bottom",_.style[a?"width":"height"]=p+"px",e.appendChild(_),a&&!n&&(e.style.width=c*i+"px"),n&&!this._vlHeights&&requestAnimationFrame(()=>{this._vlHeights=this._measureHeights(e,a);const s=t,r=e;s&&r&&this._renderWindow(s,r,s.scrollTop||0)})}enhance(){if(this._wiredVirtualList)return;this._wiredVirtualList=!0;const t=()=>this.querySelector(".c-virtual-list__scroller"),e=()=>this.querySelector(".c-virtual-list__inner");let s=0;const r=()=>{s||(s=requestAnimationFrame(()=>{s=0;const r=t(),i=e();r&&i&&this._renderWindow(r,i,"horizontal"===this.getAttribute("orientation")?r.scrollLeft:r.scrollTop)}))};this.addEventListener("scroll",r,{passive:!0,capture:!0}),i(this,()=>{this.removeEventListener("scroll",r,{capture:!0}),s&&cancelAnimationFrame(s)}),this.addEventListener("keydown",t=>{const e=Array.from(this.querySelectorAll(".c-virtual-list__item"));if(!e.length)return;const s="horizontal"===this.getAttribute("orientation"),r=s?"ArrowRight":"ArrowDown",i=s?"ArrowLeft":"ArrowUp",a=document.activeElement,n=e.indexOf(a),o=this.querySelector(".c-virtual-list__scroller"),c=this.querySelector(".c-virtual-list__inner");if(t.key===r&&n===e.length-1||t.key===i&&0===n&&Number(a&&a.dataset.index)>0){if(t.preventDefault(),o&&c){const e=(t.key===r?1:-1)*this._itemHeight();s?o.scrollLeft+=e:o.scrollTop+=e,this._renderWindow(o,c,s?o.scrollLeft:o.scrollTop);const i=Number(a&&a.dataset.index)+(t.key===r?1:-1);requestAnimationFrame(()=>{const t=this.querySelector(`.c-virtual-list__item[data-index="${i}"]`),e=Array.from(this.querySelectorAll(".c-virtual-list__item"));if(t){e.forEach(t=>t.setAttribute("tabindex","-1")),t.setAttribute("tabindex","0");try{t.focus()}catch(t){}}})}}else z(t,e,{wrap:!1,homeEnd:!0,onNavigate:t=>e.forEach((e,s)=>e.setAttribute("tabindex",s===t?"0":"-1")),onKey:()=>{if("Enter"===t.key||" "===t.key){const t=Number(document.activeElement.dataset.index);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:t,value:document.activeElement.textContent}}))}}})}),this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-virtual-list__item"):null;if(!e||!this.contains(e))return;const s=Number(e.dataset.index);this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{index:s,value:e.textContent}}))})}});c("contour-sortable-list",class extends T{static get observed(){return["items","order"]}static get properties(){return{items:{attribute:"items"},order:{attribute:"order"}}}render(){this.classList.add("c-sortable-list");const t=this.ensure(".c-sortable-list__list",()=>{const t=document.createElement("ul");return t.className="c-sortable-list__list",t}),e=this.getAttribute("items");let s=[];try{s=e?JSON.parse(e):[]}catch(t){s=[]}Array.isArray(s)||(s=[]);let r=Array.from({length:s.length},(t,e)=>e);const i=this.getAttribute("order");if(i)try{const t=JSON.parse(i);Array.isArray(t)&&t.length===s.length&&t.every(t=>Number.isInteger(t)&&t>=0&&t<s.length)&&(r=t.slice(),s=t.map(t=>s[t]))}catch(t){}this._sortableSourceOrder=r,this._sortableItems=s,L(t,""),s.forEach((e,s)=>{const r=document.createElement("li");r.className="c-sortable-list__item",r.setAttribute("draggable","true"),r.dataset.index=String(s);const i="string"==typeof e?e:e.label||e.text||"",a=document.createElement("span");a.className="c-sortable-list__handle",a.textContent="⋮⋮",a.setAttribute("role","button"),a.setAttribute("aria-label",k(this,"reorder","Reorder")+" "+(i||String(s+1))),a.setAttribute("data-contour-preserve-key",i||String(s)),a.tabIndex=0,r.appendChild(a);const n=document.createElement("span");n.className="c-sortable-list__label",n.textContent=i,r.appendChild(n),t.appendChild(r)})}enhance(){if(this._wiredSortableList)return;this._wiredSortableList=!0;const t=()=>this.querySelector(".c-sortable-list__list"),e=t=>{let e=this.querySelector(".c-sortable-list__live");e||(e=document.createElement("span"),e.className="c-sortable-list__live visually-hidden",e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),this.appendChild(e)),e.textContent=t},s=e=>Array.from(t().children).indexOf(e),r=(t,e)=>{const s=(this._sortableItems||[]).length,r=Array.isArray(this._sortableSourceOrder)&&this._sortableSourceOrder.length===s?this._sortableSourceOrder.slice():Array.from({length:s},(t,e)=>e),[i]=r.splice(t,1);r.splice(e,0,i),this.setAttribute("order",JSON.stringify(r))};let i=null;this.addEventListener("dragstart",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-sortable-list__item"):null;if(e&&this.contains(e)){if(i=s(e),t.dataTransfer){t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",String(i))}catch(t){}}e.classList.add("is-dragging")}}),this.addEventListener("dragover",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-sortable-list__item"):null;e&&this.contains(e)&&null!==i&&(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect="move"))}),this.addEventListener("drop",a=>{const n=a.target&&a.target.closest?a.target.closest(".c-sortable-list__item"):null;if(!n||!this.contains(n)||null===i)return;a.preventDefault();const o=s(n),c=t(),l=c.children[i];if(l&&i!==o){i<o?c.insertBefore(l,c.children[o+1]||null):c.insertBefore(l,c.children[o]);const t=l.querySelector(".c-sortable-list__label");e((t?t.textContent:"Item")+" moved to position "+(o+1));const s=i;r(s,o),this.dispatchEvent(new CustomEvent("contour:reorder",{bubbles:!0,composed:!0,detail:{from:s,to:o}}))}i=null,Array.from(c.children).forEach(t=>t.classList.remove("is-dragging"))}),this.addEventListener("dragend",()=>{i=null;const e=t();e&&Array.from(e.children).forEach(t=>t.classList.remove("is-dragging"))}),this.addEventListener("click",t=>{const s=t.target&&t.target.closest?t.target.closest(".c-sortable-list__handle"):null;if(!s||!this.contains(s))return;const r="true"===s.getAttribute("aria-pressed");s.setAttribute("aria-pressed",String(!r)),s.classList.toggle("is-grabbed",!r);const i=s.closest(".c-sortable-list__item"),a=i&&i.querySelector(".c-sortable-list__label"),n=a?a.textContent:"Item";e(r?`${n} released`:`${n} grabbed; use Up or Down arrows to reorder`)}),this.addEventListener("keydown",i=>{const a=i.target&&i.target.closest?i.target.closest(".c-sortable-list__handle"):null;if(!a)return;if("Enter"===i.key||" "===i.key)return i.preventDefault(),void a.click();const n=a.closest(".c-sortable-list__item");if(!n)return;const o=t(),c=s(n),l=(t,s)=>{const i=n.querySelector(".c-sortable-list__label");e((i?i.textContent:"Item")+" moved to position "+(s+1)),r(c,s),this.dispatchEvent(new CustomEvent("contour:move",{bubbles:!0,composed:!0,detail:{direction:t,from:c,to:s}})),this.dispatchEvent(new CustomEvent("contour:reorder",{bubbles:!0,composed:!0,detail:{from:c,to:s}}))};"ArrowUp"===i.key&&n.previousElementSibling?(i.preventDefault(),o.insertBefore(n,n.previousElementSibling),l("up",s(n))):"ArrowDown"===i.key&&n.nextElementSibling?(i.preventDefault(),o.insertBefore(n.nextElementSibling,n),l("down",s(n))):"Home"===i.key&&c>0?(i.preventDefault(),o.insertBefore(n,o.firstElementChild),l("up",0)):"End"===i.key&&c<o.children.length-1&&(i.preventDefault(),o.appendChild(n),l("down",o.children.length-1))})}});c("contour-carousel",class extends T{static get observed(){return["items","index","autoplay","paused"]}static get properties(){return{items:{attribute:"items"},index:{attribute:"index"},autoplay:{attribute:"autoplay"},paused:{attribute:"paused",type:Boolean}}}_items(){const t=this.getAttribute("items");let e=[];try{e=t?JSON.parse(t):[]}catch(t){e=[]}return Array.isArray(e)?e:[]}_index(){const t=Number(this.getAttribute("index")),e=this._items();return Number.isFinite(t)&&t>=0&&t<e.length?t:0}render(){this.classList.add("c-carousel"),this.setAttribute("role","region"),this.setAttribute("aria-roledescription","carousel"),Array.from(this.children).forEach(t=>{t.classList&&t.classList.contains("c-carousel__slide")&&t.parentElement===this&&t.remove()});const t=this.ensure(".c-carousel__track",()=>{const t=document.createElement("div");return t.className="c-carousel__track",t.setAttribute("role","group"),t.setAttribute("aria-roledescription","slide container"),t}),e=this._items();L(t,"");const s=this._index();e.forEach((r,i)=>{const a=document.createElement("div");a.className="c-carousel__slide"+(i===s?" is-active":""),a.setAttribute("role","group"),a.setAttribute("aria-roledescription","slide"),a.setAttribute("aria-label",i+1+" of "+e.length),a.setAttribute("aria-hidden",i===s?"false":"true");const n="object"==typeof r&&r?r.src||r.image||r.video:null;if(n){const t=!("object"!=typeof r||!r)&&("video"===r.type||!!r.video);a.classList.add("c-carousel__slide--media");const e=document.createElement(t?"video":"img");e.src=n,t?(e.controls=!0,r.poster&&(e.poster=r.poster)):e.alt="object"==typeof r&&(r.alt||r.label)||"",a.appendChild(e)}else a.textContent="string"==typeof r?r:r.label||r.text||"";a.dataset.index=String(i),t.appendChild(a)});this.ensure(".c-carousel__prev",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-btn--icon c-carousel__prev",t.type="button",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-left" /></svg>'),t.setAttribute("aria-label",k(this,"previous-slide","Previous slide")),t}),this.ensure(".c-carousel__next",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-btn--icon c-carousel__next",t.type="button",L(t,'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-chevron-right" /></svg>'),t.setAttribute("aria-label",k(this,"next-slide","Next slide")),t});const r=this.ensure(".c-carousel__status",()=>{const t=document.createElement("span");return t.className="c-carousel__status",t}),i=Number(this.getAttribute("autoplay")),a=Number.isFinite(i)&&i>0&&!this.hasAttribute("paused")&&!this._reducedMotion();r.setAttribute("aria-live",a?"off":"polite"),r.textContent=e.length?s+1+" of "+e.length:"0 of 0";const n=this.ensure(".c-carousel__dots",()=>{const t=document.createElement("div");return t.className="c-carousel__dots",t.setAttribute("role","group"),t.setAttribute("aria-label",k(this,"slide-controls","Slide controls")),t});n.setAttribute("role","group"),n.setAttribute("aria-label",k(this,"slide-controls","Slide controls")),L(n,""),e.forEach((t,e)=>{const r=document.createElement("button");r.type="button",r.className="c-carousel__dot"+(e===s?" is-active":""),r.setAttribute("aria-label",k(this,"go-to-slide","Go to slide")+" "+(e+1)),r.setAttribute("aria-current",e===s?"true":"false"),r.tabIndex=e===s?0:-1,r.dataset.index=String(e),n.appendChild(r)});const o=i;if(Number.isFinite(o)&&o>0){const t=this.hasAttribute("paused")||this._reducedMotion(),e=this.ensure(".c-carousel__pause",()=>{const t=document.createElement("button");return t.className="c-btn c-btn--sm c-btn--icon c-carousel__pause",t.type="button",t});L(e,t?'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-play" /></svg>':'<svg aria-hidden="true" viewBox="0 0 24 24"><use href="#i-pause" /></svg>'),e.setAttribute("aria-label",t?k(this,"play-slides","Play slides automatically"):k(this,"pause-slides","Pause automatic slides")),e.setAttribute("aria-pressed",String(t)),e.disabled=this._reducedMotion()}else{const t=this.querySelector(".c-carousel__pause");t&&t.remove()}}_reducedMotion(){try{return"function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches}catch(t){return!1}}enhance(){const t=Number(this.getAttribute("autoplay")),e=Number.isFinite(t)&&t>0&&!this.hasAttribute("paused")&&!this._reducedMotion()&&this._items().length>1;if(e&&!this._carouselTimer?this._carouselTimer=setInterval(()=>{const t=this._items();if(!t.length)return;const e=(this._index()+1)%t.length;this.setAttribute("index",String(e)),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{index:e,direction:"next"}}))},Math.max(500,t)):!e&&this._carouselTimer&&(clearInterval(this._carouselTimer),this._carouselTimer=null),this._wiredCarousel)return;this._wiredCarousel=!0,i(this,()=>{this._carouselTimer&&(clearInterval(this._carouselTimer),this._carouselTimer=null)});const s=t=>{const e=this._items();if(!e.length)return;let s=this._index();s="prev"===t?(s-1+e.length)%e.length:(s+1)%e.length,this.setAttribute("index",String(s)),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{index:s,direction:t}}))};this.addEventListener("click",t=>{const e=t.target&&t.target.closest?t.target.closest(".c-carousel__pause"):null;if(e&&this.contains(e)){if(this._reducedMotion())return;const t=!this.hasAttribute("paused");return this.toggleAttribute("paused",t),void this.dispatchEvent(new CustomEvent(t?"contour:pause":"contour:play",{bubbles:!0,composed:!0}))}const r=t.target&&t.target.closest?t.target.closest(".c-carousel__prev"):null,i=t.target&&t.target.closest?t.target.closest(".c-carousel__next"):null;if(r&&this.contains(r))return void s("prev");if(i&&this.contains(i))return void s("next");const a=t.target&&t.target.closest?t.target.closest(".c-carousel__dot"):null;if(a&&this.contains(a)){const t=Number(a.dataset.index);Number.isFinite(t)&&t!==this._index()&&(this.setAttribute("index",String(t)),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{index:t,direction:"jump"}})))}});let r=null;this.addEventListener("pointerdown",t=>{r=t.clientX}),this.addEventListener("pointerup",t=>{if(null===r)return;const e=t.clientX-r;r=null,Math.abs(e)>40&&s(e<0?"next":"prev")}),this.addEventListener("pointercancel",()=>{r=null}),this.addEventListener("keydown",t=>{if("ArrowLeft"===t.key)t.preventDefault(),s("prev");else if("ArrowRight"===t.key)t.preventDefault(),s("next");else if("Home"===t.key)t.preventDefault(),this.setAttribute("index","0"),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{index:0,direction:"home"}}));else if("End"===t.key){t.preventDefault();const e=this._items().length-1;e>=0&&(this.setAttribute("index",String(e)),this.dispatchEvent(new CustomEvent("contour:change",{bubbles:!0,composed:!0,detail:{index:e,direction:"end"}})))}})}});c("contour-data-grid",class extends T{static get updateMode(){return"keyed"}static get observed(){return["columns","rows","page","filter","page-size","resizable","virtual","row-height","selected","loading","error","empty"]}static get properties(){return{columns:{attribute:"columns"},rows:{attribute:"rows"},page:{attribute:"page"},filter:{attribute:"filter"},"page-size":{attribute:"page-size"},resizable:{attribute:"resizable",type:Boolean},virtual:{attribute:"virtual",type:Boolean},"row-height":{attribute:"row-height"},loading:{attribute:"loading"},error:{attribute:"error"},empty:{attribute:"empty"}}}get selected(){return Array.from(this._dgSelectedKeys||[])}set selected(t){this._dgPushedSelection=Array.isArray(t)?t.map(String):[],this._dgSelectionControlled=!0,this.requestRender()}_dgRowKey(t){if(t&&"object"==typeof t&&!Array.isArray(t)){if(void 0!==t.id&&null!==t.id)return String(t.id);if(void 0!==t.key&&null!==t.key)return String(t.key)}const e=this._dgCols||[],s=e.findIndex(t=>t&&"object"==typeof t&&!0===t.key);if(s>=0&&t){const r="string"==typeof e[s].label?e[s].label:"",i=r&&null!=t[r]?String(t[r]):"";if(""!==i)return i}return JSON.stringify(void 0===t?null:t)}_dgReadSelection(){if(this._dgPushedSelection)return void(this._dgSelectedKeys=new Set(this._dgPushedSelection));const t=this.getAttribute("selected");if(null!==t&&t!==this._dgLastSelectedRaw){this._dgLastSelectedRaw=t,this._dgSelectionControlled=!0;try{const e=JSON.parse(t);this._dgSelectedKeys=new Set(Array.isArray(e)?e.map(String):[])}catch(t){this._dgSelectedKeys=new Set}}else this._dgSelectedKeys=this._dgSelectedKeys||new Set}_dgApplySelection(t){if(!t)return;const e=this._dgSelectedKeys||new Set;t.querySelectorAll("tr[data-row-key]").forEach(t=>{t.setAttribute("aria-selected",String(e.has(t.dataset.rowKey)))})}render(){if(this.classList.add("c-data-grid"),this.hasAttribute("loading")||this.hasAttribute("error")||this.hasAttribute("empty")){const t=this.ensure(".c-data-grid__table",()=>{const t=document.createElement("table");return t.className="c-table c-data-grid__table",t.setAttribute("role","grid"),t}),e=this.ensure("tbody",()=>document.createElement("tbody"));e.parentNode!==t&&t.appendChild(e),L(e,"");const s=document.createElement("tr"),r=document.createElement("td");r.colSpan=1,r.style.textAlign="center",r.style.color="var(--color-text-muted)",this.hasAttribute("loading")?r.textContent=this.getAttribute("loading")||"Loading…":this.hasAttribute("error")?r.textContent=this.getAttribute("error")||"Error":r.textContent=this.getAttribute("empty")||"No data",s.appendChild(r),e.appendChild(s);let i=this.querySelector(".c-data-grid__wrap");return i||(i=document.createElement("div"),i.className="c-table-wrap c-data-grid__wrap"),t.parentNode!==i&&i.appendChild(t),void(i.parentNode!==this&&this.appendChild(i))}const t=this.ensure(".c-data-grid__table",()=>{const t=document.createElement("table");return t.className="c-table c-data-grid__table",t.setAttribute("role","grid"),t}),e=this.ensure("thead",()=>document.createElement("thead")),s=this.ensure("tbody",()=>document.createElement("tbody"));e.parentNode!==t&&t.appendChild(e),s.parentNode!==t&&t.appendChild(s);const r=this.getAttribute("columns");let i=[];try{i=r?JSON.parse(r):[]}catch(t){i=[]}if(i.length&&!e.querySelector("tr")){const t=document.createElement("tr");i.forEach(e=>{const s=document.createElement("th");s.setAttribute("role","columnheader"),s.setAttribute("aria-sort","none"),s.setAttribute("tabindex","0"),s.textContent="string"==typeof e?e:e.label||e.key||"",t.appendChild(s)}),e.appendChild(t)}this.hasAttribute("resizable")&&Array.from(e.querySelectorAll("th")).forEach(t=>{t.style.position="relative",t.setAttribute("data-resizable","true")});const a=this.getAttribute("rows");let n=[];try{n=a?JSON.parse(a):[]}catch(t){n=[]}t.setAttribute("aria-rowcount",String(n.length)),t.setAttribute("aria-colcount",String(i.length));const o=this.getAttribute("filter");if(o){const t=o.toLowerCase();n=n.filter(e=>JSON.stringify(e).toLowerCase().includes(t))}if(null!=this._dgSortCol&&this._dgSortCol>=0&&this._dgSortCol<i.length){const t=this._dgSortCol,s=this._dgSortDir||"asc",r=i[t],a=r?"string"==typeof r?r:r.key||r.label||"":String(t);n=n.slice().sort((e,r)=>{const i=Array.isArray(e)?e[t]??"":e&&null!=e[a]?e[a]:"",n=Array.isArray(r)?r[t]??"":r&&null!=r[a]?r[a]:"",o=Number(i),c=Number(n),l=""===i||""===n||isNaN(o)||isNaN(c)?String(i).localeCompare(String(n)):o-c;return"asc"===s?l:-l}),Array.from(e.querySelectorAll("th")).forEach((e,r)=>{e.setAttribute("aria-sort",r===t?"asc"===s?"ascending":"descending":"none")})}this._dgFilteredRows=n;const c=Number(this.getAttribute("page")||1),l=Number(this.getAttribute("page-size")||0);if(l>0){const t=(c-1)*l;n=n.slice(t,t+l)}this._dgCols=i,this._dgRows=n,this._dgReadSelection();if(this.hasAttribute("virtual")&&!(Number(this.getAttribute("page-size"))>0)){const t=this.querySelector(".c-data-grid__wrap");this._renderDataGridWindow(t?t.scrollTop:0)}else{L(s,"");const t=l>0?(c-1)*l:0;n.forEach((e,r)=>{const a=document.createElement("tr");a.dataset.rowKey=this._dgRowKey(e),a.dataset.index=String(t+r),i.forEach((t,s)=>{const r="string"==typeof t?t:t.key||t.label||"",i=document.createElement("td");i.setAttribute("role","gridcell"),i.setAttribute("tabindex","-1");const n=Array.isArray(e)?e[s]:e?e[r]:void 0;i.textContent=null!=n?n:"",String(i.textContent).trim()||i.setAttribute("aria-label",k(this,"empty","Empty")),a.appendChild(i)}),s.appendChild(a)}),this._dgApplySelection(s)}let u=this.querySelector(".c-data-grid__wrap");if(u||(u=document.createElement("div"),u.className="c-table-wrap c-data-grid__wrap"),t.parentNode!==u&&u.appendChild(t),u.parentNode!==this&&this.appendChild(u),!t.querySelector('[tabindex="0"]')){const e=t.querySelector("tbody td, thead th");e&&e.setAttribute("tabindex","0")}}_rowHeight(){const t=Number(this.getAttribute("row-height"));return Number.isFinite(t)&&t>0?t:this._measuredRowHeight>0?this._measuredRowHeight:y("--data-grid-row-height",32)}_renderDataGridWindow(t){const e=this.querySelector(".c-data-grid__table"),s=e&&e.querySelector("tbody");if(!s)return;const r=this._dgCols||[],i=this._dgRows||[],a=this._rowHeight(),n=Math.ceil(400/a)+6;let o=Math.floor((t||0)/a);o<0&&(o=0),o>Math.max(0,i.length-n)&&(o=Math.max(0,i.length-n));const c=Math.min(i.length,o+n);if(L(s,""),o>0){const t=document.createElement("tr"),e=document.createElement("td");e.colSpan=Math.max(1,r.length),e.style.blockSize=o*a+"px",e.style.padding="0",t.appendChild(e),s.appendChild(t)}for(let t=o;t<c;t++){const e=i[t],a=document.createElement("tr");a.dataset.index=String(t),a.dataset.rowKey=this._dgRowKey(e),r.forEach((t,s)=>{const r="string"==typeof t?t:t.key||t.label||"",i=document.createElement("td");i.setAttribute("role","gridcell"),i.setAttribute("tabindex","-1");const n=Array.isArray(e)?e[s]:e?e[r]:void 0;i.textContent=null!=n?n:"",String(i.textContent).trim()||i.setAttribute("aria-label",k(this,"empty","Empty")),a.appendChild(i)}),s.appendChild(a)}if(c<i.length){const t=document.createElement("tr"),e=document.createElement("td");e.colSpan=Math.max(1,r.length),e.style.blockSize=(i.length-c)*a+"px",e.style.padding="0",t.appendChild(e),s.appendChild(t)}if(!s.querySelector('[tabindex="0"]')){const t=s.querySelector("tr[data-index] td");t&&t.setAttribute("tabindex","0")}this._dgApplySelection(s)}enhance(){if(this._wiredDataGrid)return;this._wiredDataGrid=!0;const t=()=>this.querySelector(".c-data-grid__wrap");this.addEventListener("scroll",t=>{const e=t.target&&t.target.classList&&t.target.classList.contains("c-data-grid__wrap")?t.target:null;e&&this.hasAttribute("virtual")&&this._renderDataGridWindow(e.scrollTop)},!0),this.addEventListener("keydown",t=>{const e=t.target&&t.target.closest?t.target.closest("[role='gridcell'], [role='columnheader']"):null;if(!e||!this.contains(e))return;const s=e.parentElement,r=this.querySelector(".c-data-grid__table");if(!r)return;if(t.altKey&&("ArrowLeft"===t.key||"ArrowRight"===t.key)&&e.hasAttribute("data-resizable")){t.preventDefault();const i=Array.from(s.children).indexOf(e),a=e.getBoundingClientRect().width||100,n=Math.max(48,a+("ArrowRight"===t.key?16:-16));return Array.from(r.rows).forEach(t=>{t.children[i]&&(t.children[i].style.inlineSize=n+"px")}),void this.dispatchEvent(new CustomEvent("contour:resize",{bubbles:!0,composed:!0,detail:{column:i,width:n}}))}if("Enter"===t.key||" "===t.key)return t.preventDefault(),void("columnheader"===e.getAttribute("role")?e.click():s&&s.click());const i=Array.from(r.querySelectorAll("tr")),a=i.indexOf(s),n=Array.from(s.children).indexOf(e);let o=null;if("ArrowRight"===t.key?o=s.children[n+1]:"ArrowLeft"===t.key?o=s.children[n-1]:"ArrowDown"===t.key?o=i[a+1]&&i[a+1].children[n]:"ArrowUp"===t.key&&(o=i[a-1]&&i[a-1].children[n]),o){t.preventDefault(),r.querySelectorAll('[tabindex="0"]').forEach(t=>t.setAttribute("tabindex","-1")),o.setAttribute("tabindex","0");try{o.focus()}catch(t){}}}),this.addEventListener("click",e=>{const s=e.target&&e.target.closest?e.target.closest("tr"):null,r=e.target&&e.target.closest?e.target.closest("th"):null;if(s&&this.contains(s)&&!r&&void 0!==s.dataset.rowKey){const t=s.dataset.rowKey,e=Number(s.dataset.index),r=this._dgSelectedKeys||(this._dgSelectedKeys=new Set);r.has(t)?r.delete(t):r.add(t),this._dgApplySelection(s.parentElement),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{row:e,key:t,index:e}}))}if(r&&this.contains(r)){const e=Array.from(r.parentElement.children).indexOf(r);this._dgSortCol===e?this._dgSortDir="asc"===this._dgSortDir?"desc":"asc":(this._dgSortCol=e,this._dgSortDir="asc");const s=this._dgSortDir,i=this.querySelector(".c-data-grid__table"),a=i&&i.querySelector("tbody"),n=i&&i.querySelector("thead"),o=this._dgCols||[],c=o[e]?"string"==typeof o[e]?o[e]:o[e].key||o[e].label||"":String(e),l=(this._dgFilteredRows||[]).slice();if(l.sort((t,r)=>{const i=Array.isArray(t)?t[e]??"":t&&null!=t[c]?t[c]:"",a=Array.isArray(r)?r[e]??"":r&&null!=r[c]?r[c]:"",n=Number(i),o=Number(a),l=""===i||""===a||isNaN(n)||isNaN(o)?String(i).localeCompare(String(a)):n-o;return"asc"===s?l:-l}),this._dgFilteredRows=l,!this.hasAttribute("virtual")||Number(this.getAttribute("page-size"))>0){if(a){const t=Number(this.getAttribute("page")||1),e=Number(this.getAttribute("page-size")||0);let s=l;if(e>0){const r=(t-1)*e;s=l.slice(r,r+e)}L(a,"");const r=e>0?(t-1)*e:0;s.forEach((t,e)=>{const s=document.createElement("tr");s.dataset.rowKey=this._dgRowKey(t),s.dataset.index=String(r+e),o.forEach((e,r)=>{const i="string"==typeof e?e:e.key||e.label||"",a=document.createElement("td");a.setAttribute("role","gridcell"),a.setAttribute("tabindex","-1");const n=Array.isArray(t)?t[r]:t?t[i]:void 0;a.textContent=null!=n?n:"",s.appendChild(a)}),a.appendChild(s)}),this._dgApplySelection(a)}}else{this._dgRows=l;const e=t();this._renderDataGridWindow(e?e.scrollTop:0)}n&&Array.from(n.querySelectorAll("th")).forEach((t,r)=>{t.setAttribute("aria-sort",r===e?"asc"===s?"ascending":"descending":"none")}),this.dispatchEvent(new CustomEvent("contour:sort",{bubbles:!0,composed:!0,detail:{column:e,direction:s}}))}}),this.addEventListener("pointerdown",t=>{if(!this.hasAttribute("resizable"))return;const e=t.target&&t.target.closest?t.target.closest("th[data-resizable]"):null;if(!e||!this.contains(e)||e.getBoundingClientRect().right-t.clientX>10)return;t.preventDefault();const s=t.clientX,r=e.getBoundingClientRect().width,a=Array.from(e.parentElement.children).indexOf(e);let n=r;const o=t=>{n=Math.max(48,r+t.clientX-s);const e=this.querySelector(".c-data-grid__table");e&&Array.from(e.rows).forEach(t=>{t.children[a]&&(t.children[a].style.inlineSize=n+"px")})},c=()=>{window.removeEventListener("pointermove",o),this.dispatchEvent(new CustomEvent("contour:resize",{bubbles:!0,composed:!0,detail:{column:a,width:n}}))};window.addEventListener("pointermove",o),window.addEventListener("pointerup",c,{once:!0}),i(this,c)}),this._dgApplySelection(this.querySelector(".c-data-grid__table tbody"))}});c("contour-tree-grid",class extends T{static get updateMode(){return"keyed"}static get observed(){return["items","rows","expanded","loading","error","empty"]}static get properties(){return{items:{attribute:"items"},rows:{attribute:"rows"},expanded:{attribute:"expanded"},loading:{attribute:"loading"},error:{attribute:"error"},empty:{attribute:"empty"}}}_expandedSet(){const t=this.getAttribute("expanded");if(!t)return new Set;try{return new Set(JSON.parse(t))}catch(e){return new Set([t])}}render(){this.classList.add("c-tree-grid");const t=this.ensure(".c-tree-grid__table",()=>{const t=document.createElement("table");return t.className="c-table c-tree-grid__table",t.setAttribute("role","treegrid"),t});t.setAttribute("aria-label",k(this,"tree-grid","Tree grid"));const e=this.ensure("tbody",()=>document.createElement("tbody"));if(e.parentNode!==t&&t.appendChild(e),L(e,""),this.hasAttribute("loading")||this.hasAttribute("error")||this.hasAttribute("empty")){const t=document.createElement("tr"),s=document.createElement("td");s.style.textAlign="center",s.style.color="var(--color-text-muted)",this.hasAttribute("loading")?s.textContent=this.getAttribute("loading")||"Loading…":this.hasAttribute("error")?s.textContent=this.getAttribute("error")||"Error":s.textContent=this.getAttribute("empty")||"No data",t.appendChild(s),e.appendChild(t)}else{const t=this.getAttribute("items")||this.getAttribute("rows");let s=[];try{s=t?JSON.parse(t):[]}catch(t){s=[]}Array.isArray(s)||(s=[]);const r=this._expandedSet(),i=[],a=(t,s,n,o,c)=>{const l=document.createElement("tr");l.setAttribute("role","row"),l.setAttribute("tabindex",0===i.length?"0":"-1"),l.setAttribute("aria-level",String(s+1)),l.setAttribute("aria-posinset",String(o)),l.setAttribute("aria-setsize",String(c)),l.dataset.path=n,this._tgSelectedPath===n&&l.setAttribute("aria-selected","true");const u=!!(t&&Array.isArray(t.children)&&t.children.length);u&&l.setAttribute("aria-expanded",r.has(n)?"true":"false");const d=document.createElement("td");d.setAttribute("role","gridcell"),d.style.setProperty("--tree-depth",String(s));const h=t&&(t.label||t.text||t.name)||"";if(u){const t=document.createElement("button");t.type="button",t.className="c-tree-grid__toggle",t.tabIndex=-1,t.textContent=r.has(n)?"▾":"▸",t.setAttribute("aria-label",(r.has(n)?"Collapse":"Expand")+" "+h),d.appendChild(t)}const m=document.createElement("span");m.className="c-tree-grid__label",m.textContent=h,d.appendChild(m),l.appendChild(d),e.appendChild(l),i.push(l),u&&r.has(n)&&t.children.forEach((e,r)=>a(e,s+1,n+"."+r,r+1,t.children.length))};s.forEach((t,e)=>a(t,0,String(e),e+1,s.length))}let s=this.querySelector(".c-tree-grid__wrap");s||(s=document.createElement("div"),s.className="c-table-wrap c-tree-grid__wrap"),t.parentNode!==s&&s.appendChild(t),s.parentNode!==this&&this.appendChild(s)}enhance(){if(this._wiredTreeGrid)return;this._wiredTreeGrid=!0;const t=()=>Array.from(this.querySelectorAll("tr[role='row']")),e=e=>{if(e){t().forEach(t=>t.setAttribute("tabindex",t===e?"0":"-1"));try{e.focus()}catch(t){}}};this.addEventListener("click",s=>{const r=s.target&&s.target.closest?s.target.closest(".c-tree-grid__toggle"):null,i=s.target&&s.target.closest?s.target.closest("tr[role='row']"):null;if(!i||!this.contains(i))return;const a=i.dataset.path;if(e(i),r){s.preventDefault();const t=this._expandedSet();t.has(a)?t.delete(a):t.add(a),this.setAttribute("expanded",JSON.stringify([...t])),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{path:a,expanded:t.has(a)}}))}else this._tgSelectedPath=a,t().forEach(t=>t.setAttribute("aria-selected",String(t===i))),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{path:a}}))}),this.addEventListener("keydown",s=>{const r=s.target&&s.target.closest?s.target.closest("tr[role='row']"):null;if(!r||!this.contains(r))return;const i=t(),a=i.indexOf(r),n=r.dataset.path||"",o=null!==r.getAttribute("aria-expanded"),c=this._expandedSet();if("ArrowRight"===s.key)s.preventDefault(),o&&!c.has(n)?(c.add(n),this.setAttribute("expanded",JSON.stringify([...c])),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{path:n,expanded:!0}}))):o&&c.has(n)&&i[a+1]&&e(i[a+1]);else if("ArrowLeft"===s.key){if(s.preventDefault(),o&&c.has(n))c.delete(n),this.setAttribute("expanded",JSON.stringify([...c])),this.dispatchEvent(new CustomEvent("contour:toggle",{bubbles:!0,composed:!0,detail:{path:n,expanded:!1}}));else if(n.includes(".")){const t=n.slice(0,n.lastIndexOf(".")),s=i.find(e=>e.dataset.path===t);s&&e(s)}}else if("ArrowDown"===s.key)s.preventDefault(),i[a+1]&&e(i[a+1]);else if("ArrowUp"===s.key)s.preventDefault(),i[a-1]&&e(i[a-1]);else if("Enter"===s.key||" "===s.key){s.preventDefault();const t=r.querySelector(".c-tree-grid__toggle");"Enter"===s.key&&t?t.click():(this._tgSelectedPath=n,i.forEach(t=>t.setAttribute("aria-selected",String(t===r))),this.dispatchEvent(new CustomEvent("contour:select",{bubbles:!0,composed:!0,detail:{path:n}})))}})}}),c("contour-box",F(["c-box"])),c("contour-cluster",F(["c-cluster"])),c("contour-container",F(["c-container"])),c("contour-row",F(["c-row"])),c("contour-scrim",F(["c-scrim"])),c("contour-stack",F(["c-stack"]));const Ae=t=>{const e=t.querySelector("slot");return(e?e.assignedElements({flatten:!0}):[]).map(t=>(t.textContent||"").trim()).join(" ").trim()||(t.textContent||"").trim()};let Ee=null,we="";const xe=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return(e>>>0).toString(36)},Ce="undefined"!=typeof HTMLElement?HTMLElement:Object;class Se extends Ce{static get observedAttributes(){return l.concat("labels")}constructor(){super();let t=this.shadowRoot;t||(t=this.attachShadow({mode:"open"}),this.constructor.contourTemplate&&t.appendChild(this.constructor.contourTemplate.content.cloneNode(!0)));const e=(()=>{let t=document.styleSheets.length+":";for(const e of document.styleSheets){let s="-1";try{const t=e.cssRules;let r="";for(let e=0;e<t.length;e++)r+=t[e].cssText+"\n";s=t.length+":"+xe(r)}catch(t){}t+=(e.href||"inline")+"~"+s+"|"}if(Ee&&t===we)return Ee;we=t,Ee=[];const e=(t,s)=>{let r;try{r=t.cssRules}catch(t){return}if(r)for(const t of r)if(t instanceof CSSImportRule)t.styleSheet&&e(t.styleSheet,s);else try{s.push(t.cssText)}catch(t){}};for(const t of document.styleSheets)try{if(!t.href||new URL(t.href).origin===location.origin){const s=[];e(t,s);const r=new CSSStyleSheet;s.length&&r.replaceSync(s.join("\n")),Ee.push(r)}}catch(t){}return Ee})();if(e.length)try{t.adoptedStyleSheets=e}catch(t){}this._shadowBase=t.firstElementChild?t.firstElementChild.className:""}enhance(t){t||(t=this.shadowRoot),t&&(t.querySelectorAll("details").forEach(t=>{const e=t.querySelector("summary");e&&!e.hasAttribute("aria-expanded")&&(e.setAttribute("aria-expanded",String(t.open)),t.addEventListener("toggle",()=>{e.setAttribute("aria-expanded",String(t.open))}))}),t.querySelectorAll("[data-live]").forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","status"),t.hasAttribute("aria-live")||t.setAttribute("aria-live","polite")}),t.querySelectorAll(".c-spinner").forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","status"),t.hasAttribute("aria-live")||t.setAttribute("aria-live","polite")}),t.querySelectorAll(".c-toast, .c-toast-host").forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","status"),t.hasAttribute("aria-live")||t.setAttribute("aria-live","polite"),t.hasAttribute("aria-atomic")||t.setAttribute("aria-atomic","true")}),t.querySelectorAll("[role='tab']").forEach(e=>{const s=e.getAttribute("aria-controls");if(s){const r=t.querySelector("#"+CSS.escape(s))||document.getElementById(s);r&&!r.hasAttribute("aria-labelledby")&&(e.id||(e.id=o("tab")),r.setAttribute("aria-labelledby",e.id))}}),t.querySelectorAll("input, textarea, select").forEach(t=>{if(t.hasAttribute("aria-describedby"))return;const e=t.closest(".c-field");if(e){const s=e.querySelector(".c-field__hint");s&&(s.id||(s.id=o("hint")),t.setAttribute("aria-describedby",s.id));const r=e.querySelector(".c-field__error");if(r){r.id||(r.id=o("err"));const e=t.getAttribute("aria-describedby")||"";t.setAttribute("aria-describedby",(e+" "+r.id).trim())}}}),t.querySelectorAll(".c-alert").forEach(t=>{const e=t.classList.contains("c-alert--warning")||t.classList.contains("c-alert--danger"),s=e?"alert":"status",r=e?"assertive":"polite";t.hasAttribute("role")&&!t.dataset.contourAutoRole||(t.setAttribute("role",s),t.dataset.contourAutoRole=s),t.hasAttribute("aria-live")&&!t.dataset.contourAutoLive||(t.setAttribute("aria-live",r),t.dataset.contourAutoLive=r)}),t.querySelectorAll("input[required], textarea[required], select[required]").forEach(t=>{t.hasAttribute("aria-required")||t.setAttribute("aria-required","true")}),this._wireLabels(t),this._wireClose(t))}_wireClose(t){if(!t||this._wiredShadowClose)return;const e=t.querySelectorAll(".c-callout__close, .c-alert__close, .c-tag__remove, .c-filter-pill__remove");if(e.length){this._wiredShadowClose=!0;for(const t of e)t.addEventListener("click",()=>{this.hidden=!0,this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0}))})}}_wireLabels(t){t&&t.querySelectorAll("label").forEach(t=>{const e=t.querySelector("slot"),s=t.closest(".c-field")||t.parentElement,r=[];if(e)for(const t of e.assignedElements({flatten:!0}))t.matches("input, textarea, select")&&r.push(t);if(!r.length&&s){const t=s.querySelector('slot[name="input"]');if(t)for(const e of t.assignedElements({flatten:!0}))e.matches("input, textarea, select")&&r.push(e)}for(const e of r){if(e.id||(e.id=o("shadow-input")),t.hasAttribute("for")||t.setAttribute("for",e.id),!e.hasAttribute("aria-label")&&!e.hasAttribute("aria-labelledby")){const s=Ae(t);s&&e.setAttribute("aria-label",s)}if(e._contourLabelWired||(e._contourLabelWired=!0,t.addEventListener("click",t=>{if(!t.target.closest("a, button, input, textarea, select"))try{e.click()}catch(t){}})),s&&!e.hasAttribute("aria-describedby")){const t=s.querySelector(".c-field__hint"),r=s.querySelector(".c-field__error"),i=[];t&&(t.id||(t.id=o("hint")),i.push(t.id)),r&&(r.id||(r.id=o("err")),i.push(r.id)),i.length&&e.setAttribute("aria-describedby",i.join(" "))}}})}connectedCallback(){this.applyMods();try{this.enhance(this.shadowRoot)}catch(t){}this._applyLabels();try{(t=>{tt.delete(t);const e=et.get(t);if(e){for(const{target:t,type:s,fn:r,options:i}of e)try{t.removeEventListener(s,r,i)}catch(t){}et.delete(t)}})(this),pt(this),gt(this),_t(this),ft(this),At(this),Et(this),wt(this),xt(this)}catch(t){}this.shadowRoot&&!this._wiredSlotchange&&(this._wiredSlotchange=!0,this.shadowRoot.addEventListener("slotchange",()=>{try{this.enhance(this.shadowRoot),this._applyLabels(),pt(this),gt(this),_t(this),ft(this),At(this),Et(this),wt(this),xt(this)}catch(t){}}))}attributeChangedCallback(){this.applyMods(),this._applyLabels()}_applyLabels(){const t=this.shadowRoot;if(!t)return;const e=(e,s,r)=>{const i=t.querySelector(e);i&&i.setAttribute("aria-label",k(this,s,r))};e(".c-callout__close","close","Close"),e(".c-alert__close","close","Close"),e(".c-tag__remove","remove","Remove"),e(".c-filter-pill__remove","remove-filter","Remove filter"),e(".c-breadcrumb","breadcrumb","Breadcrumb"),e(".c-spinner","loading","Loading"),e(".c-install__copy","copy-command","Copy command");const s=t.querySelector(".c-install__copy, .c-code__copy");s&&"Copy"===s.textContent.trim()&&(s.textContent=k(this,"copy","Copy"))}applyMods(){const t=this.shadowRoot.firstElementChild;if(!t||!this._shadowBase)return;const e=[];for(const t of l){const s=this.getAttribute(t);if(s)for(const t of this._shadowBase.split(/\s+/))t&&e.push("c-"+t.replace(/^c-/,"")+"--"+s)}if(t.className=(this._shadowBase+" "+e.join(" ")).trim(),t.classList.contains("c-alert")){const e=t.classList.contains("c-alert--warning")||t.classList.contains("c-alert--danger"),s=e?"alert":"status",r=e?"assertive":"polite";t.hasAttribute("role")&&!t.dataset.contourAutoRole||(t.setAttribute("role",s),t.dataset.contourAutoRole=s),t.hasAttribute("aria-live")&&!t.dataset.contourAutoLive||(t.setAttribute("aria-live",r),t.dataset.contourAutoLive=r)}}}const ke={},Ne={},Le=(t,e)=>{ke[t]=[...e.matchAll(/part="([^"]+)"/g)].flatMap(t=>t[1].split(/\s+/)).filter(Boolean)},qe=(t,e)=>{if(Ne[t]=e,Le(t,e),"undefined"==typeof document)return;const s=document.createElement("template");L(s,e);const r=class extends Se{};r.contourTemplate=s,c(t,r)},De=(t,e,s)=>"<"+t+' class="c-'+e+'" part="'+(s||e)+'"'+("button"===t?' type="button"':"")+"><slot></slot></"+t+">",Me={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"],span:["avatar","badge","chip","dot","flag","live-badge","mark","pill"],a:["link","linkish"],kbd:["kbd"],label:["check","radio","switch"],nav:["docs-nav"]},Te={"version-banner":"banner","contour-plot":"plot"};for(const[t,e]of Object.entries(Me))for(const s of e){qe("contour-shadow-"+s,De(t,s,Te[s]||s))}qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("contour-shadow-brownout",'<div class="c-brownout" part="brownout" data-level="0"><slot></slot></div>'),qe("contour-shadow-widget-state",'<div class="c-widget-state" part="widget-state"><slot></slot></div>'),qe("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>'),qe("contour-shadow-axis",'<div class="c-axis" part="axis"><slot></slot></div>'),qe("contour-shadow-brush",'<div class="c-brush" part="brush"><div class="c-brush__selection" part="selection"></div></div>'),qe("contour-shadow-stacked-bar",'<div class="c-stacked-bar" part="bar"><slot></slot></div>'),qe("contour-shadow-category",'<div class="c-category" part="category" role="listbox"><slot></slot></div>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("contour-shadow-coordinate",'<div class="c-coordinate" part="coordinate"><span class="c-coordinate__value" part="value"><slot name="value"></slot></span></div>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("contour-shadow-loading",'<div class="c-loading" part="loading"><span class="c-spinner" part="spinner"></span><slot></slot></div>'),qe("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>'),qe("contour-shadow-breadcrumb",'<nav class="c-breadcrumb" part="breadcrumb" aria-label="Breadcrumb"><ol><slot></slot></ol></nav>'),qe("contour-shadow-menu",'<div class="c-menu" part="menu" role="menu"><slot></slot></div>'),qe("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>'),qe("contour-shadow-chart",'<div class="c-chart" part="chart"><div class="c-chart__plot" part="plot"><slot></slot></div></div>'),qe("contour-shadow-bivariate",'<div class="c-bivariate" part="bivariate"><div class="c-bivariate__matrix" part="matrix"><slot></slot></div></div>'),qe("contour-shadow-bivariate-legend",'<div class="c-bivariate-legend" part="legend"><div class="c-bivariate-legend__matrix" part="matrix"><slot></slot></div></div>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("contour-shadow-container",'<div class="container" part="container"><slot></slot></div>'),qe("contour-shadow-spinner",'<span class="c-spinner" part="spinner" aria-label="Loading"></span>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>'),qe("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>');const Fe='<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" viewBox="0 0 24 24"><path d="m18 6-12 12M6 6l12 12" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></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>';Ne["contour-shadow-dialog"]=Fe,Le("contour-shadow-dialog",Fe);class Re extends Se{static contourTemplate="undefined"!=typeof document?(()=>{const t=document.createElement("template");return L(t,Fe),t})():null;enhance(t){if(super.enhance(t),this._wiredShadowDialog)return;this._wiredShadowDialog=!0;const e=t.querySelector("dialog"),s=t.querySelector('[part="close"]');if(s&&s.addEventListener("click",()=>e?.close()),e){let t=null;e.addEventListener("beforetoggle",s=>{if("open"===s.newState){t=document.activeElement,this._syncingOpenAttr=!0,this.hasAttribute("open")||this.setAttribute("open",""),this._syncingOpenAttr=!1,this.dispatchEvent(new CustomEvent("contour:open",{bubbles:!0,composed:!0}));const r=e.querySelector("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(r)try{r.focus()}catch(s){}}else if("closed"===s.newState&&(this._syncingOpenAttr=!0,this.hasAttribute("open")&&this.removeAttribute("open"),this._syncingOpenAttr=!1,this.dispatchEvent(new CustomEvent("contour:close",{bubbles:!0,composed:!0})),t&&"function"==typeof t.focus))try{t.focus()}catch(s){}});const s=()=>{const t="button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])",s=Array.from(e.querySelectorAll(t));for(const r of e.querySelectorAll("slot"))for(const e of r.assignedElements({flatten:!0})){e.matches(t)&&s.push(e);for(const r of e.querySelectorAll(t))s.push(r)}return s},r=()=>this.shadowRoot&&this.shadowRoot.activeElement||document.activeElement;e.addEventListener("keydown",t=>{if("Tab"!==t.key)return;const e=s();if(!e.length)return;const i=e[0],a=e[e.length-1];t.shiftKey&&r()===i?(t.preventDefault(),a.focus()):t.shiftKey||r()!==a||(t.preventDefault(),i.focus())})}}static get observedAttributes(){return[...super.observedAttributes,"open"]}attributeChangedCallback(t,e,s){if(super.attributeChangedCallback(t,e,s),"open"===t&&this.shadowRoot&&!this._syncingOpenAttr){const t=this.shadowRoot.querySelector("dialog");t&&(null===s||t.open?null===s&&t.open&&this.close():this.show())}}connectedCallback(){super.connectedCallback(),this.hasAttribute("open")&&this.show()}show(){if(!this.isConnected)return void(this.hasAttribute("open")||this.setAttribute("open",""));const t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}close(){const t=this.shadowRoot?.querySelector("dialog");t&&t.open&&t.close()}showModal(){this.show()}get open(){return!!this.shadowRoot?.querySelector("dialog")?.open}set open(t){t?this.show():this.close()}get returnValue(){return this.shadowRoot?.querySelector("dialog")?.returnValue??""}set returnValue(t){const e=this.shadowRoot?.querySelector("dialog");e&&(e.returnValue=String(t))}}c("contour-shadow-dialog",Re);const Be=Object.freeze({...Ne});if("undefined"!=typeof globalThis&&(globalThis.ContourShadowTemplates=Be),"undefined"!=typeof window){window.ContourShadowParts=Object.freeze(Object.fromEntries(Object.entries(ke).map(([t,e])=>[t,Object.freeze([...new Set(e)])]))),window.Contour||(window.Contour={});try{window.Contour.shadowTemplates=Be}catch{}}"undefined"!=typeof window&&(window.ContourVersion=t,window.Contour||(window.Contour={format:{value:B,number:(t,e,s)=>B(t,e,s),time:(t,e)=>{try{return new Intl.DateTimeFormat(e||void 0).format(new Date(t))}catch(e){return String(t)}},locale:t=>t||("undefined"!=typeof navigator?navigator.language:"en")},markers:{shapes:K,styles:function(t){return{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%)"}[t]||""},assign:function(t){return(t||[]).map((t,e)=>({...t,marker:K[e%K.length]}))}}}),queueMicrotask(()=>{try{window.dispatchEvent(new CustomEvent("contour:ready",{detail:{version:t,count:e.length}}))}catch(t){}}))}();