tyrell-components 1.0.0-TC57 → 1.0.0-TC58
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.
- package/dist/tyrell.js +1 -1
- package/dist/tyrell.js.map +1 -0
- package/lib/base/ty-component.d.ts +12 -3
- package/lib/base/ty-component.js +21 -17
- package/lib/components/button.d.ts +4 -0
- package/lib/components/button.js +33 -6
- package/lib/components/calendar-month.js +3 -10
- package/lib/components/calendar.d.ts +3 -1
- package/lib/components/calendar.js +19 -34
- package/lib/components/checkbox.d.ts +1 -1
- package/lib/components/checkbox.js +2 -1
- package/lib/components/date-picker.d.ts +60 -8
- package/lib/components/date-picker.js +268 -134
- package/lib/components/file-upload.d.ts +2 -1
- package/lib/components/file-upload.js +2 -1
- package/lib/components/input.d.ts +13 -6
- package/lib/components/input.js +58 -60
- package/lib/components/modal.js +37 -1
- package/lib/components/option.js +2 -5
- package/lib/components/popup.js +43 -6
- package/lib/components/radio.d.ts +2 -1
- package/lib/components/radio.js +2 -1
- package/lib/components/resize-observer.js +2 -0
- package/lib/components/scroll-container.js +2 -0
- package/lib/components/select.d.ts +32 -3
- package/lib/components/select.js +123 -11
- package/lib/components/switch.d.ts +3 -1
- package/lib/components/switch.js +2 -1
- package/lib/components/textarea.d.ts +44 -4
- package/lib/components/textarea.js +54 -10
- package/lib/styles/button.js +20 -19
- package/lib/styles/date-picker.js +17 -0
- package/lib/styles/select-base.js +26 -0
- package/lib/styles/textarea.d.ts +1 -1
- package/lib/styles/textarea.js +7 -0
- package/lib/utils/error-flavor.d.ts +8 -0
- package/lib/utils/error-flavor.js +1 -0
- package/lib/utils/upgrade-properties.d.ts +21 -0
- package/lib/utils/upgrade-properties.js +47 -0
- package/lib/utils/validity.d.ts +63 -5
- package/lib/utils/validity.js +145 -24
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -1
- package/lib/base/ty-component.d.ts.map +0 -1
- package/lib/base/ty-component.js.map +0 -1
- package/lib/components/button.d.ts.map +0 -1
- package/lib/components/button.js.map +0 -1
- package/lib/components/calendar-month.d.ts.map +0 -1
- package/lib/components/calendar-month.js.map +0 -1
- package/lib/components/calendar-navigation.d.ts.map +0 -1
- package/lib/components/calendar-navigation.js.map +0 -1
- package/lib/components/calendar.d.ts.map +0 -1
- package/lib/components/calendar.js.map +0 -1
- package/lib/components/checkbox.d.ts.map +0 -1
- package/lib/components/checkbox.js.map +0 -1
- package/lib/components/copy.d.ts.map +0 -1
- package/lib/components/copy.js.map +0 -1
- package/lib/components/date-picker.d.ts.map +0 -1
- package/lib/components/date-picker.js.map +0 -1
- package/lib/components/dropdown.d.ts +0 -403
- package/lib/components/dropdown.d.ts.map +0 -1
- package/lib/components/dropdown.js +0 -1315
- package/lib/components/dropdown.js.map +0 -1
- package/lib/components/icon.d.ts.map +0 -1
- package/lib/components/icon.js.map +0 -1
- package/lib/components/input.d.ts.map +0 -1
- package/lib/components/input.js.map +0 -1
- package/lib/components/modal.d.ts.map +0 -1
- package/lib/components/modal.js.map +0 -1
- package/lib/components/multiselect.d.ts +0 -389
- package/lib/components/multiselect.d.ts.map +0 -1
- package/lib/components/multiselect.js +0 -1301
- package/lib/components/multiselect.js.map +0 -1
- package/lib/components/option.d.ts.map +0 -1
- package/lib/components/option.js.map +0 -1
- package/lib/components/popup.d.ts.map +0 -1
- package/lib/components/popup.js.map +0 -1
- package/lib/components/resize-observer.d.ts.map +0 -1
- package/lib/components/resize-observer.js.map +0 -1
- package/lib/components/scroll-container.d.ts.map +0 -1
- package/lib/components/scroll-container.js.map +0 -1
- package/lib/components/step.d.ts.map +0 -1
- package/lib/components/step.js.map +0 -1
- package/lib/components/tab.d.ts.map +0 -1
- package/lib/components/tab.js.map +0 -1
- package/lib/components/tabs.d.ts.map +0 -1
- package/lib/components/tabs.js.map +0 -1
- package/lib/components/tag.d.ts.map +0 -1
- package/lib/components/tag.js.map +0 -1
- package/lib/components/textarea.d.ts.map +0 -1
- package/lib/components/textarea.js.map +0 -1
- package/lib/components/tooltip.d.ts.map +0 -1
- package/lib/components/tooltip.js.map +0 -1
- package/lib/components/wizard.d.ts.map +0 -1
- package/lib/components/wizard.js.map +0 -1
- package/lib/icons/fontawesome/brands.d.ts.map +0 -1
- package/lib/icons/fontawesome/brands.js.map +0 -1
- package/lib/icons/fontawesome/regular.d.ts.map +0 -1
- package/lib/icons/fontawesome/regular.js.map +0 -1
- package/lib/icons/fontawesome/solid.d.ts.map +0 -1
- package/lib/icons/fontawesome/solid.js.map +0 -1
- package/lib/icons/heroicons/micro.d.ts.map +0 -1
- package/lib/icons/heroicons/micro.js.map +0 -1
- package/lib/icons/heroicons/mini.d.ts.map +0 -1
- package/lib/icons/heroicons/mini.js.map +0 -1
- package/lib/icons/heroicons/outline.d.ts.map +0 -1
- package/lib/icons/heroicons/outline.js.map +0 -1
- package/lib/icons/heroicons/solid.d.ts.map +0 -1
- package/lib/icons/heroicons/solid.js.map +0 -1
- package/lib/icons/lucide.d.ts.map +0 -1
- package/lib/icons/lucide.js.map +0 -1
- package/lib/icons/material/filled.d.ts.map +0 -1
- package/lib/icons/material/filled.js.map +0 -1
- package/lib/icons/material/outlined.d.ts.map +0 -1
- package/lib/icons/material/outlined.js.map +0 -1
- package/lib/icons/material/round.d.ts.map +0 -1
- package/lib/icons/material/round.js.map +0 -1
- package/lib/icons/material/sharp.d.ts.map +0 -1
- package/lib/icons/material/sharp.js.map +0 -1
- package/lib/icons/material/two-tone.d.ts.map +0 -1
- package/lib/icons/material/two-tone.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/styles/button.d.ts.map +0 -1
- package/lib/styles/button.js.map +0 -1
- package/lib/styles/calendar-month.d.ts.map +0 -1
- package/lib/styles/calendar-month.js.map +0 -1
- package/lib/styles/calendar-navigation.d.ts.map +0 -1
- package/lib/styles/calendar-navigation.js.map +0 -1
- package/lib/styles/calendar.d.ts.map +0 -1
- package/lib/styles/calendar.js.map +0 -1
- package/lib/styles/copy.d.ts.map +0 -1
- package/lib/styles/copy.js.map +0 -1
- package/lib/styles/date-picker.d.ts.map +0 -1
- package/lib/styles/date-picker.js.map +0 -1
- package/lib/styles/dropdown.d.ts +0 -12
- package/lib/styles/dropdown.d.ts.map +0 -1
- package/lib/styles/dropdown.js +0 -725
- package/lib/styles/dropdown.js.map +0 -1
- package/lib/styles/icon.d.ts.map +0 -1
- package/lib/styles/icon.js.map +0 -1
- package/lib/styles/input.d.ts.map +0 -1
- package/lib/styles/input.js.map +0 -1
- package/lib/styles/modal.d.ts.map +0 -1
- package/lib/styles/modal.js.map +0 -1
- package/lib/styles/multiselect.d.ts +0 -6
- package/lib/styles/multiselect.d.ts.map +0 -1
- package/lib/styles/multiselect.js +0 -568
- package/lib/styles/multiselect.js.map +0 -1
- package/lib/styles/option.d.ts.map +0 -1
- package/lib/styles/option.js.map +0 -1
- package/lib/styles/popup.d.ts.map +0 -1
- package/lib/styles/popup.js.map +0 -1
- package/lib/styles/resize-observer.d.ts.map +0 -1
- package/lib/styles/resize-observer.js.map +0 -1
- package/lib/styles/scroll-container.d.ts.map +0 -1
- package/lib/styles/scroll-container.js.map +0 -1
- package/lib/styles/step.d.ts.map +0 -1
- package/lib/styles/step.js.map +0 -1
- package/lib/styles/tab.d.ts.map +0 -1
- package/lib/styles/tab.js.map +0 -1
- package/lib/styles/tabs.d.ts.map +0 -1
- package/lib/styles/tabs.js.map +0 -1
- package/lib/styles/tag.d.ts.map +0 -1
- package/lib/styles/tag.js.map +0 -1
- package/lib/styles/textarea.d.ts.map +0 -1
- package/lib/styles/textarea.js.map +0 -1
- package/lib/styles/tooltip.d.ts.map +0 -1
- package/lib/styles/tooltip.js.map +0 -1
- package/lib/styles/wizard.d.ts.map +0 -1
- package/lib/styles/wizard.js.map +0 -1
- package/lib/types/common.d.ts.map +0 -1
- package/lib/types/common.js.map +0 -1
- package/lib/utils/calendar-utils.d.ts.map +0 -1
- package/lib/utils/calendar-utils.js.map +0 -1
- package/lib/utils/icon-registry.d.ts.map +0 -1
- package/lib/utils/icon-registry.js.map +0 -1
- package/lib/utils/locale.d.ts.map +0 -1
- package/lib/utils/locale.js.map +0 -1
- package/lib/utils/number-format.d.ts.map +0 -1
- package/lib/utils/number-format.js.map +0 -1
- package/lib/utils/parse-boolean.d.ts +0 -39
- package/lib/utils/parse-boolean.d.ts.map +0 -1
- package/lib/utils/parse-boolean.js +0 -23
- package/lib/utils/parse-boolean.js.map +0 -1
- package/lib/utils/positioning.d.ts.map +0 -1
- package/lib/utils/positioning.js.map +0 -1
- package/lib/utils/property-capture.d.ts.map +0 -1
- package/lib/utils/property-capture.js.map +0 -1
- package/lib/utils/property-manager.d.ts.map +0 -1
- package/lib/utils/property-manager.js.map +0 -1
- package/lib/utils/resize-observer.d.ts.map +0 -1
- package/lib/utils/resize-observer.js.map +0 -1
- package/lib/utils/scroll-lock.d.ts.map +0 -1
- package/lib/utils/scroll-lock.js.map +0 -1
- package/lib/utils/styles.d.ts.map +0 -1
- package/lib/utils/styles.js.map +0 -1
- package/lib/version.d.ts.map +0 -1
- package/lib/version.js.map +0 -1
package/dist/tyrell.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! Tyrell Components | Components Only (NO Icons) | MIT License | https://github.com/gersak/tyrell */
|
|
2
|
-
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).Tyrell={})}(this,function(t){"use strict";const n=["primary","success","danger","warning","neutral"],e="sm";function i(t){if("string"==typeof t){const n=t.toLowerCase().trim();return"false"!==n&&"0"!==n}return!!t}function o(t){return"function"==typeof t.default?t.default():t.default}class r{constructor(t){this.t=new Map,this.i=t,this.o()}o(){for(const[t,n]of Object.entries(this.i))void 0!==n.default&&this.t.set(t,o(n))}hasConfig(t){return t in this.i}updateProperty(t,n,e="property"){const i=this.i[t];if(!i)return null;const o=this.t.get(t),r=this.l(t,n,i);return this.h(t,r,i)?this.u(o,r)?null:(this.t.set(t,r),{name:t,oldValue:o,newValue:r,source:e}):null}l(t,n,e){if(e.coerce)return e.coerce(n);if(null==n)return o(e)??null;switch(e.type){case"boolean":if("string"==typeof n){if(""===n)return!0;const t=n.toLowerCase().trim();return"false"!==t&&"0"!==t}return!!n;case"number":const t=+n;return isNaN(t)?o(e)??0:t;case"string":return n+"";case"object":case"array":if("string"==typeof n)try{return JSON.parse(n)}catch{return o(e)??("array"===e.type?[]:{})}return n;default:return n}}h(t,n,e){return!e.validate||e.validate(n)}u(t,n){if("object"!=typeof t||"object"!=typeof n)return t===n;if(null===t||null===n)return t===n;try{return JSON.stringify(t)===JSON.stringify(n)}catch{return!1}}get(t){return this.t.get(t)}getAll(){return Object.fromEntries(this.t)}getConfig(t){return this.i[t]}isVisual(t){return this.i[t]?.visual??!1}isFormValue(t){return this.i[t]?.formValue??!1}shouldEmitChange(t){return this.i[t]?.emitChange??!1}handleAlias(t,n){for(const[e,i]of Object.entries(this.i))if(i.aliases&&t in i.aliases)return this.updateProperty(e,null===n?o(i):i.aliases[t],"attribute");return null}}let s=!1,a=!1;const l=new Set;let c=!1;class d{constructor(t,n){this.host=t,this.internals=n,this.own={flags:{}},this.custom="",this.errorFromReport=!1,function(){if(c)return;c=!0;const t=()=>{s=!0,setTimeout(()=>{s=!1})};document.addEventListener("click",n=>{const e=n.target?.closest?.("button:not([type=button]):not([type=reset]), input[type=submit], input[type=image], ty-button:not([type=button]):not([type=reset])");e&&t()},!0),document.addEventListener("keydown",n=>{"Enter"===n.key&&t()},!0),document.addEventListener("pointerdown",()=>{a=!0},!0);const n=()=>{if(a=!1,0===l.size)return;const t=[...l];l.clear(),setTimeout(()=>t.forEach(t=>t.reveal()))};document.addEventListener("pointerup",n,!0),document.addEventListener("pointercancel",n,!0)}(),t.addEventListener("invalid",n=>{if(!("error"in t))return;if(n.preventDefault(),this.showError(),!s)return;const e=this.internals.form;e&&function(t){return Array.from(t.elements).find(t=>{const n=t.validity;return n&&!n.valid&&!t.disabled})}(e)!==t||t.focus()})}reveal(){a?l.add(this):"error"in this.host&&!this.internals.validity.valid&&this.showError()}showError(){this.host.setAttribute("error",this.internals.validationMessage),this.errorFromReport=!0}set(t,n,e){this.own={flags:t,message:n,anchor:e},this.sync()}setCustom(t){this.custom=t||"",this.sync()}report(){return!!this.internals.checkValidity()||("error"in this.host?(this.showError(),this.host.focus()):this.internals.reportValidity(),!1)}sync(){const{flags:t,message:n,anchor:e}=this.own,i=Object.values(t).some(Boolean);this.custom?this.internals.setValidity({...t,customError:!0},this.custom,e):i?this.internals.setValidity(t,n||"Invalid value",e):this.internals.setValidity({}),this.errorFromReport&&(this.internals.validity.valid?(this.host.removeAttribute("error"),this.errorFromReport=!1):this.host.getAttribute("error")!==this.internals.validationMessage&&this.host.setAttribute("error",this.internals.validationMessage))}}const h=class extends HTMLElement{constructor(){super(),this.p=!1,this.v=!1,this.m=!1,this.k=null,this.props=new r(this.constructor.properties),this.$=this.attachInternals(),this.C=new d(this,this.$),this.shadowRoot||this.attachShadow({mode:"open"})}static get observedAttributes(){const t=[];for(const[n,e]of Object.entries(this.properties))if(t.push(n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()),e.aliases)for(const i of Object.keys(e.aliases))t.push(i);return t}setProperty(t,n){const e=this.props.updateProperty(t,n,"property");e&&(this.M(e),this.S([e]))}getProperty(t){return this.props.get(t)}M(t){const{name:n,newValue:e}=t,i=this.props.getConfig(n);if(!i)return;const o=this.T(n);"boolean"===i.type?e?this.setAttribute(o,""):this.removeAttribute(o):null==e?this.removeAttribute(o):this.setAttribute(o,"object"==typeof e?JSON.stringify(e):e+"")}T(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}_(t){return t.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}attributeChangedCallback(t,n,e){if(n===e)return;let i=this.props.handleAlias(t,e);if(!i){const n=this._(t),o=this.props.hasConfig(t)?t:n;i=this.props.updateProperty(o,e,"attribute")}i&&this.S([i])}connectedCallback(){if(this.p=!0,!this.k){this.k=new Map;const t=this.constructor;for(const[n,e]of Object.entries(t.properties)){if(!e.formValue)continue;const t=this.getAttribute(this.T(n));this.k.set(n,t??("function"==typeof e.default?e.default():e.default)??null)}}const t=this.q();t.length>0&&this.S(t),this.onConnect(),this.v||(this.render(),this.v=!0)}disconnectedCallback(){this.p=!1,this.onDisconnect()}q(){const t=[],n=this.constructor;for(const e of Object.keys(n.properties)){const n=Object.getOwnPropertyDescriptor(this,e);if(n&&void 0!==n.value){const i=this.props.updateProperty(e,n.value,"property");i&&t.push(i)}}return t}S(t){0!==t.length&&(this.onPropertiesChanged(t),t.some(t=>this.props.isFormValue(t.name))&&this.updateFormValue(),t.some(t=>this.props.isVisual(t.name))&&this.p&&this.render(),this.D(t))}D(t){for(const n of t)this.props.shouldEmitChange(n.name)&&this.dispatchEvent(new CustomEvent("prop:change",{detail:{property:n.name,oldValue:n.oldValue,newValue:n.newValue},bubbles:!0,composed:!0}))}updateFormValue(){const t=this.getFormValue();this.$.setFormValue(t)}getFormValue(){return this.props.get("value")??null}onPropertiesChanged(t){}onConnect(){}onDisconnect(){}get form(){return this.$.form}get A(){return!0===this.constructor.formAssociated}applyValidity(t,n,e){this.C.set(t,n,e)}revealValidity(){this.A&&this.C.reveal()}get validity(){return this.A?this.$.validity:void 0}get validationMessage(){return this.A?this.$.validationMessage:""}get willValidate(){return!!this.A&&this.$.willValidate}checkValidity(){return!this.A||this.$.checkValidity()}reportValidity(){return!this.A||this.C.report()}setCustomValidity(t){this.A&&this.C.setCustom(t)}applyLabelName(t){let n=Array.from(this.$.labels??[]).map(t=>t.textContent?.trim()).filter(Boolean).join(" ");if(!n){const t=this.closest("label");if(t){const e=t.cloneNode(!0);e.querySelectorAll(this.tagName.toLowerCase()).forEach(t=>t.remove()),n=e.textContent?.trim()??""}}n?t.setAttribute("aria-label",n):t.removeAttribute("aria-label")}isDuplicateActivationClick(){return!!this.m||(this.m=!0,queueMicrotask(()=>{this.m=!1}),!1)}formResetCallback(){for(const[t,n]of this.k??[])this.setProperty(t,n);this.onFormReset()}onFormReset(){}};h.formAssociated=!0,h.properties={};let u=h;const p=new Map;function b(t,n){const{css:e,id:i}=n;let o;i&&p.has(i)?o=p.get(i):(o=new CSSStyleSheet,o.replaceSync(e),i&&p.set(i,o));const r=t.adoptedStyleSheets||[];r.includes(o)||(t.adoptedStyleSheets=[...r,o])}const v=(t,n,e,i)=>i?`var(${t}-${n}${e}, var(${t}-${i}${e}))`:`var(${t}-${n}${e})`,m=(t,n)=>`oklch(from ${t} calc(l + var(--ty-${n})) c h)`,g=(t,n)=>`oklch(from ${t} calc(l + sign(0.5 - l) * abs(var(--ty-${n}))) c h)`,y=(t,n)=>{const e=e=>v("--ty-solid",t,e,n),i="neutral"===t?" --_border-l: var(--ty-button-border-l-neutral, var(--ty-button-border-l, -0.15));":" --_border-l: var(--_muted-border-l, var(--ty-button-border-l, -0.15));",o="neutral"===t?g:m;return`\nbutton.solid.${t} { --_ring: ${v("--ty-color",t,"",n)}; --_solid-bg: var(--ty-button-bg, var(--_muted-solid-bg, ${e("")})); --_solid-rest: var(--ty-button-bg, var(--_muted-solid-bg, ${e("")}));${i} color: var(--ty-button-color, var(--_muted-solid-fg, ${e("-fg")})); }\nbutton.solid.${t}.tone-plus { --_solid-bg: var(--ty-button-bg, var(--_muted-solid-bg, ${e("-strong")})); --_solid-rest: var(--ty-button-bg, var(--_muted-solid-bg, ${e("-strong")})); color: var(--ty-button-color, var(--_muted-solid-fg, ${e("-strong-fg")})); }\nbutton.solid.${t}.tone-minus { --_solid-bg: var(--ty-button-bg, var(--_muted-solid-bg, ${e("-soft")})); --_solid-rest: var(--ty-button-bg, var(--_muted-solid-bg, ${e("-soft")})); color: var(--ty-button-color, var(--_muted-solid-fg, ${e("-soft-fg")})); }\nbutton.solid.${t}:hover:not(:disabled) { --_solid-bg: var(--ty-button-bg-hover, ${e("-hover")}); }\nbutton.solid.${t}:active:not(:disabled) { --_solid-bg: ${e("-active")}; }\nbutton.solid.${t}.tone-plus:hover:not(:disabled) { --_solid-bg: var(--ty-button-bg-hover, ${o(e("-strong"),"solid-hover-l")}); }\nbutton.solid.${t}.tone-plus:active:not(:disabled) { --_solid-bg: ${o(e("-strong"),"solid-active-l")}; }\nbutton.solid.${t}.tone-minus:hover:not(:disabled) { --_solid-bg: var(--ty-button-bg-hover, ${m(e("-soft"),"solid-hover-l")}); }\nbutton.solid.${t}.tone-minus:active:not(:disabled) { --_solid-bg: ${m(e("-soft"),"solid-active-l")}; }\n`},f=(t,n)=>{const e=e=>"neutral"===t&&"-strong"===e?`var(--ty-solid-neutral${e})`:(e=>v("--ty-color",t,e,n))(e);return`\nbutton.outlined.${t} {\ncolor: var(--ty-button-color, var(--_muted-outlined-line, ${e("")}));\nborder-color: var(--ty-button-border, var(--_muted-outlined-line, ${e("")}));\n}\nbutton.outlined.${t}.tone-plus {\ncolor: var(--ty-button-color, var(--_muted-outlined-line, ${e("-strong")}));\nborder-color: var(--ty-button-border, var(--_muted-outlined-line, ${e("-strong")}));\n}\nbutton.outlined.${t}.tone-minus {\ncolor: var(--ty-button-color, var(--_muted-outlined-line, ${e("-soft")}));\nborder-color: var(--ty-button-border, var(--_muted-outlined-line, ${e("-soft")}));\n}\nbutton.outlined.${t}:hover:not(:disabled) {\nbackground: var(--ty-button-bg-hover, ${v("--ty-bg",t,"-soft",n)});\n}\nbutton.outlined.${t}:not(.muted):hover:not(:disabled),\nbutton.outlined.${t}:active:not(:disabled),\nbutton.outlined.${t}:focus-visible {\ncolor: var(--ty-button-color, ${e("-strong")});\nborder-color: var(--ty-button-border, ${e("-strong")});\n}\n`},w=(t,n)=>{const e=e=>"neutral"===t&&"-strong"===e?`var(--ty-solid-neutral${e})`:(e=>v("--ty-color",t,e,n))(e);return`\nbutton.ghost.${t} { color: var(--ty-button-color, var(--_muted-ghost-fg, ${e("")})); }\nbutton.ghost.${t}.tone-plus { color: var(--ty-button-color, var(--_muted-ghost-fg, ${e("-strong")})); }\nbutton.ghost.${t}.tone-minus { color: var(--ty-button-color, var(--_muted-ghost-fg, ${e("-soft")})); }\nbutton.ghost.${t}:hover:not(:disabled) {\nbackground: var(--ty-button-bg-hover, ${v("--ty-bg",t,"-soft",n)});\n}\nbutton.ghost.${t}:not(.muted):hover:not(:disabled),\nbutton.ghost.${t}:active:not(:disabled),\nbutton.ghost.${t}:focus-visible {\ncolor: var(--ty-button-color, ${e("-strong")});\n}\n`},x=`\n:host {\ndisplay: inline-block;\nfont-family: inherit;\n}\n:host([wide]) {\ndisplay: flex;\nflex-grow: 1;\n}\n:host {\n--ty-button-height: 1.75rem; \n--ty-button-min-width: 4rem;\n--ty-button-pad-x: var(--ty-spacing-2);\n--ty-button-pad-y: 0px;\n--ty-button-font: var(--ty-font-xs);\n--ty-button-leading: var(--ty-leading-xs);\n--ty-button-tracking: var(--ty-tracking-xs);\n--ty-button-gap: var(--ty-spacing-1);\n--ty-button-action-size: 1.5rem;\n--ty-button-action-icon: 0.875rem;\n}\n:host([size="xs"]) {\n--ty-button-height: 1.5rem; \n--ty-button-pad-x: var(--ty-spacing-2);\n--ty-button-pad-y: 0px;\n--ty-button-font: var(--ty-font-xs);\n--ty-button-leading: var(--ty-leading-xs);\n--ty-button-tracking: var(--ty-tracking-xs);\n--ty-button-gap: var(--ty-spacing-1);\n--ty-button-action-size: 1.375rem;\n--ty-button-action-icon: 0.75rem;\n}\n:host([size="md"]) {\n--ty-button-height: 2rem; \n--ty-button-pad-x: var(--ty-spacing-3);\n--ty-button-pad-y: 0.375rem;\n--ty-button-font: var(--ty-font-sm);\n--ty-button-leading: var(--ty-leading-sm);\n--ty-button-tracking: var(--ty-tracking-sm);\n--ty-button-gap: var(--ty-spacing-2);\n--ty-button-action-size: 2rem;\n--ty-button-action-icon: 1rem;\n}\n:host([size="lg"]) {\n--ty-button-height: 2.25rem; \n--ty-button-pad-x: var(--ty-spacing-4);\n--ty-button-pad-y: 0.375rem;\n--ty-button-font: var(--ty-font-sm);\n--ty-button-leading: var(--ty-leading-sm);\n--ty-button-tracking: var(--ty-tracking-sm);\n--ty-button-gap: var(--ty-spacing-2);\n--ty-button-action-size: 2.25rem;\n--ty-button-action-icon: 1.125rem;\n}\n:host([size="xl"]) {\n--ty-button-height: 2.5rem; \n--ty-button-pad-x: var(--ty-spacing-6);\n--ty-button-pad-y: var(--ty-spacing-2);\n--ty-button-font: var(--ty-font-base);\n--ty-button-leading: var(--ty-leading-base);\n--ty-button-tracking: var(--ty-tracking-base);\n--ty-button-gap: var(--ty-spacing-2);\n--ty-button-action-size: 2.5rem;\n--ty-button-action-icon: 1.25rem;\n}\nbutton {\nfont-family: inherit;\nposition: relative;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\ngap: var(--ty-button-gap);\nheight: var(--ty-button-height);\npadding: var(--ty-button-pad-y) var(--ty-button-pad-x);\nfont-size: var(--ty-button-font);\nline-height: var(--ty-button-leading);\nletter-spacing: var(--ty-button-tracking);\nfont-weight: var(--ty-weight-action, var(--ty-font-medium));\nwhite-space: nowrap;\ncursor: pointer;\nuser-select: none;\ntransition: var(--ty-local-transition, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease);\nbackground: transparent;\ncolor: var(--ty-color-neutral);\nborder: 1px solid transparent;\n}\nbutton:not(.action) {\nmin-width: var(--ty-button-min-width);\n}\nbutton:not(.pill) {\nborder-radius: var(--ty-radius-md);\n}\nbutton.xs:not(.pill) { border-radius: var(--ty-button-radius-xs, var(--ty-radius-md)); }\nbutton.sm:not(.pill) { border-radius: var(--ty-button-radius-sm, var(--ty-radius-md)); }\nbutton.md:not(.pill) { border-radius: var(--ty-button-radius-md, var(--ty-radius-md)); }\nbutton.lg:not(.pill) { border-radius: var(--ty-button-radius-lg, var(--ty-radius-md)); }\nbutton.xl:not(.pill) { border-radius: var(--ty-button-radius-xl, var(--ty-radius-md)); }\nbutton:focus-visible {\noutline: none;\n}\nbutton:disabled {\ncursor: not-allowed;\nopacity: 0.6;\n}\n.loader-icon {\ndisplay: none;\nalign-items: center;\njustify-content: center;\nflex-shrink: 0;\nwidth: 1em;\nheight: 1em;\ncolor: currentColor;\n}\n.loader-icon svg {\nwidth: 100%;\nheight: 100%;\n}\nbutton.loading {\ncursor: wait;\n}\nbutton.loading > *:not(.loader-icon) {\nvisibility: hidden;\n}\nbutton.loading > .loader-icon {\ndisplay: inline-flex;\nposition: absolute;\ntop: 50%;\nleft: 50%;\ntransform: translate(-50%, -50%);\nanimation: ty-button-spin 0.7s linear infinite;\n}\n@keyframes ty-button-spin {\nto { transform: translate(-50%, -50%) rotate(360deg); }\n}\n@media (prefers-reduced-motion: reduce) {\nbutton.loading > .loader-icon {\nanimation-duration: 1.6s;\n}\n}\n::slotted(*) {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\n}\n::slotted(ty-icon) {\nflex-shrink: 0;\n}\n:host([wide]) button {\nflex-grow: 1;\n}\nbutton.action {\ngap: 0px !important;\nheight: var(--ty-button-action-size);\nwidth: var(--ty-button-action-size);\npadding: 0px !important;\n}\nbutton.action ::slotted(ty-icon) {\nheight: var(--ty-button-action-icon);\nwidth: var(--ty-button-action-icon);\n}\nbutton.muted {\n--_muted-solid-bg: var(--ty-solid-neutral);\n--_muted-solid-fg: var(--ty-solid-neutral-fg);\n--_muted-outlined-line: var(--ty-color-neutral);\n--_muted-ghost-fg: var(--ty-color-neutral);\n--_muted-border-l: var(--ty-button-border-l-neutral, var(--ty-button-border-l, -0.15));\n}\nbutton.muted.tone-plus {\n--_muted-solid-bg: var(--ty-solid-neutral-strong);\n--_muted-solid-fg: var(--ty-solid-neutral-strong-fg);\n--_muted-outlined-line: var(--ty-solid-neutral-strong);\n--_muted-ghost-fg: var(--ty-solid-neutral-strong);\n}\nbutton.muted.tone-minus {\n--_muted-solid-bg: var(--ty-solid-neutral-soft);\n--_muted-solid-fg: var(--ty-solid-neutral-soft-fg);\n--_muted-outlined-line: var(--ty-color-neutral-soft);\n--_muted-ghost-fg: var(--ty-color-neutral-soft);\n}\n@media (hover: hover) and (pointer: fine) {\nbutton.muted:hover:not(:disabled) {\n--_muted-solid-bg: unset;\n--_muted-solid-fg: unset;\n--_muted-outlined-line: unset;\n--_muted-ghost-fg: unset;\n--_muted-border-l: unset;\n}\n}\nbutton.muted:active:not(:disabled),\nbutton.muted:focus-visible:not(:disabled) {\n--_muted-solid-bg: unset;\n--_muted-solid-fg: unset;\n--_muted-outlined-line: unset;\n--_muted-ghost-fg: unset;\n--_muted-border-l: unset;\n}\nbutton.pill {\nborder-radius: 9999px;\npadding-left: 1.25em;\npadding-right: 1.25em;\n}\nbutton.pill.xs { padding-left: 1em; padding-right: 1em; }\nbutton.pill.sm { padding-left: 1.125em; padding-right: 1.125em; }\nbutton.pill.lg { padding-left: 1.5em; padding-right: 1.5em; }\nbutton.pill.xl { padding-left: 1.75em; padding-right: 1.75em; }\nbutton.pill:has(ty-icon:only-child),\nbutton.pill:has(slot[name="start"]:only-child),\nbutton.pill:has(slot[name="end"]:only-child) {\npadding: 0;\naspect-ratio: 1;\nmin-width: var(--ty-size-md);\n}\nbutton.pill.xs:has(ty-icon:only-child) { min-width: 1.375rem; min-height: 1.375rem; }\nbutton.pill.sm:has(ty-icon:only-child) { min-width: 1.5rem; min-height: 1.5rem; }\nbutton.pill.md:has(ty-icon:only-child) { min-width: 2rem; min-height: 2rem; }\nbutton.pill.lg:has(ty-icon:only-child) { min-width: 2.25rem; min-height: 2.25rem; }\nbutton.pill.xl:has(ty-icon:only-child) { min-width: 2.5rem; min-height: 2.5rem; }\nbutton.solid {\n--_ring: var(--ty-color-neutral);\n--_solid-bg: var(--ty-button-bg, var(--ty-solid-neutral));\n--_solid-rest: var(--ty-button-bg, var(--ty-solid-neutral));\n--_border-l: var(--ty-button-border-l-neutral, var(--ty-button-border-l, -0.15));\nbackground: var(--_solid-bg);\ncolor: var(--ty-button-color, var(--ty-solid-neutral-fg));\nborder: var(--ty-solid-border-width, 1px) solid\nvar(--ty-solid-border-color,\noklch(from var(--_solid-rest, var(--_solid-bg)) calc(l + var(--_border-l, -0.15) * var(--ty-button-depth, 0.35)) c h));\nbox-shadow: 0 1px 2px oklch(0 0 0 / calc(0.4 * var(--ty-button-depth, 0.35)));\n}\nbutton.solid.tone-plus { --_solid-bg: var(--ty-button-bg, var(--ty-solid-neutral-strong)); --_solid-rest: var(--ty-button-bg, var(--ty-solid-neutral-strong)); color: var(--ty-button-color, var(--ty-solid-neutral-strong-fg)); }\nbutton.solid.tone-minus { --_solid-bg: var(--ty-button-bg, var(--ty-solid-neutral-soft)); --_solid-rest: var(--ty-button-bg, var(--ty-solid-neutral-soft)); color: var(--ty-button-color, var(--ty-solid-neutral-soft-fg)); }\nbutton.solid:hover:not(:disabled) { --_solid-bg: var(--ty-button-bg-hover, var(--ty-solid-neutral-hover)); }\nbutton.solid:active:not(:disabled) { --_solid-bg: var(--ty-solid-neutral-active); }\nbutton.solid.tone-plus:hover:not(:disabled) {\n--_solid-bg: var(--ty-button-bg-hover, oklch(from var(--ty-solid-neutral-strong) calc(l + sign(0.5 - l) * abs(var(--ty-solid-hover-l))) c h));\n}\nbutton.solid.tone-plus:active:not(:disabled) {\n--_solid-bg: oklch(from var(--ty-solid-neutral-strong) calc(l + sign(0.5 - l) * abs(var(--ty-solid-active-l))) c h);\n}\nbutton.solid.tone-minus:hover:not(:disabled) {\n--_solid-bg: var(--ty-button-bg-hover, oklch(from var(--ty-solid-neutral-soft) calc(l + var(--ty-solid-hover-l)) c h));\n}\nbutton.solid.tone-minus:active:not(:disabled) {\n--_solid-bg: oklch(from var(--ty-solid-neutral-soft) calc(l + var(--ty-solid-active-l)) c h);\n}\n${n.map(t=>y(t)).join("")}\nbutton.solid:focus-visible {\nbox-shadow: 0 0 0 2px var(--ty-focus-ring-gap), 0 0 0 4px var(--_ring);\n}\nbutton.outlined {\nbackground: transparent;\ncolor: var(--ty-button-border, var(--ty-button-color, var(--ty-color-neutral)));\nborder-color: var(--ty-button-border, var(--ty-button-color, var(--ty-color-neutral)));\n}\nbutton.outlined:hover:not(:disabled) {\nbackground: var(--ty-button-bg-hover, var(--ty-bg-neutral-soft));\n}\n${n.map(t=>f(t)).join("")}\nbutton.ghost {\nbackground: transparent;\nborder: none;\ncolor: var(--ty-button-color, var(--ty-color-neutral));\n}\nbutton.ghost:hover:not(:disabled) {\nbackground: var(--ty-button-bg-hover, var(--ty-bg-neutral-soft));\n}\n${n.map(t=>w(t)).join("")}`;function k(t,e,i,o){const r=(i||"")+"",s=r.replace(/[+-]$/,"");return n.includes(s)||!/^[A-Za-z][A-Za-z0-9_-]*$/.test(s)?(e&&(t.adoptedStyleSheets=t.adoptedStyleSheets.filter(t=>t!==e)),null):(e||(e=new CSSStyleSheet,t.adoptedStyleSheets=[...t.adoptedStyleSheets,e]),e.replaceSync(o({flavor:r,base:s,shade:r.slice(s.length)})),e)}let z=null;function $(t){z=t&&t.trim()?t:null}function C(){return z??'<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="3" stroke-opacity="0.25"/><path d="M22 12a10 10 0 0 1-10 10" stroke="currentColor" stroke-width="3" stroke-linecap="round"/></svg>'}function E(){z=null}const M=class extends u{constructor(){super(),this.L=!1,this.j=null,b(this.shadowRoot,{css:x,id:"ty-button"})}onConnect(){this.F()}onDisconnect(){}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.F()}F(){const{base:t}=this.parseFlavor();this.j=k(this.shadowRoot,this.j,t,()=>(t=>y(t,"neutral")+f(t,"neutral")+w(t,"neutral"))(t))}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get appearance(){return this.getProperty("appearance")}set appearance(t){this.setProperty("appearance",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get loading(){return this.getProperty("loading")}set loading(t){this.setProperty("loading",t)}get type(){return this.getProperty("type")}set type(t){this.setProperty("type",t)}get pill(){return this.getProperty("pill")}set pill(t){this.setProperty("pill",t)}get action(){return this.getProperty("action")}set action(t){this.setProperty("action",t)}get muted(){return this.getProperty("muted")}set muted(t){this.setProperty("muted",t)}get wide(){return this.getProperty("wide")}set wide(t){this.setProperty("wide",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}parseFlavor(){const t=this.flavor||"";return t.length>1&&t.endsWith("+")?{base:t.slice(0,-1),tone:"+"}:t.length>1&&t.endsWith("-")?{base:t.slice(0,-1),tone:"-"}:{base:t,tone:""}}buildClasses(){const{base:t,tone:n}=this.parseFlavor();return function(...t){return t.filter(Boolean).join(" ")}(t,this.size,this.appearance,this.pill&&"pill",this.action&&"action",this.muted&&"muted","+"===n&&"tone-plus","-"===n&&"tone-minus")}handleFormAction(){const t=this.$.form;if(t)switch(this.type){case"submit":this.name&&this.value&&this.$.setFormValue(this.value);try{t.requestSubmit()}finally{this.name&&this.value&&this.$.setFormValue(null)}break;case"reset":t.reset()}}initializeButtonStructure(){const t=this.shadowRoot,n=this.buildClasses(),e=document.createElement("button");e.disabled=this.disabled,e.className=n,e.setAttribute("part","button");const i=document.createElement("span");i.className="loader-icon",i.setAttribute("aria-hidden","true"),i.innerHTML=C();const o=document.createElement("slot");o.name="start",o.className="start";const r=document.createElement("slot"),s=document.createElement("slot");s.name="end",s.className="end",e.appendChild(i),e.appendChild(o),e.appendChild(r),e.appendChild(s),e.addEventListener("click",t=>{this.disabled||this.loading||(t.stopPropagation(),this.handleFormAction(),this.dispatchEvent(new CustomEvent("click",{bubbles:!0,composed:!0,detail:{originalEvent:t}})))}),this.applyLoadingState(e),t.appendChild(e),this.L=!0}applyLoadingState(t){const n=this.loading;if(t.classList.toggle("loading",n),n){t.setAttribute("aria-busy","true");const n=t.querySelector(".loader-icon");n&&(n.innerHTML=C())}else t.removeAttribute("aria-busy")}render(){const t=this.shadowRoot;if(!this.L)return void this.initializeButtonStructure();const n=this.buildClasses(),e=t.querySelector("button");e&&(e.disabled=this.disabled,e.className=n,this.applyLoadingState(e))}};M.formAssociated=!0,M.properties={flavor:{type:"string",visual:!0,default:"neutral"},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},appearance:{type:"string",visual:!0,default:"solid",validate:t=>["solid","outlined","ghost"].includes(t),coerce:t=>["solid","outlined","ghost"].includes(t)?t:"solid"},disabled:{type:"boolean",visual:!0,default:!1},loading:{type:"boolean",visual:!0,default:!1},type:{type:"string",visual:!1,default:"submit"},pill:{type:"boolean",visual:!0,default:!1},action:{type:"boolean",visual:!0,default:!1},muted:{type:"boolean",visual:!0,default:!1},wide:{type:"boolean",visual:!1,default:!1},name:{type:"string",default:""},value:{type:"string",default:""}};let S=M;customElements.get("ty-button")||customElements.define("ty-button",S);const T="1.0.0-TC57",_=new Map,q=new Map,D=new Map;let A=null,L=null;const j="ty-icons-v"+T,F="https://ty-icons.local/",V=new Map;let I=!1;function O(t){const n=new Set;Object.entries(t).forEach(([t,e])=>{_.set(t,e),n.add(t)}),n.size>0&&R(n)}function H(t){return _.get(t)}function N(t){return _.has(t)}async function B(){const t=new Set(_.keys());if(_.clear(),"caches"in window)try{await caches.delete(j),I=!1}catch(n){}R(t)}function P(t,n,e){q.set(t,e),n&&D.set(t,n)}function W(t){q.delete(t),D.delete(t)}function R(t){A||(A=new Set),t.forEach(t=>A.add(t)),null!==L&&clearTimeout(L);const n="undefined"!=typeof requestIdleCallback?requestIdleCallback:t=>setTimeout(t,0);L=n(()=>{const t=A;A=null,L=null,t&&t.size>0&&function(t){q.forEach((n,e)=>{const i=D.get(e);i?t.has(i)&&n(new Set([i])):n(t)})}(t)})}function Y(){return Array.from(_.keys())}async function U(){const t={version:T,cacheName:j,available:"caches"in window};if(!t.available)return t;try{const n=await caches.open(j),e=(await n.keys()).filter(t=>t.url.startsWith(F));return{...t,iconCount:e.length}}catch(n){return t}}const X=Object.freeze(Object.defineProperty({__proto__:null,addWatcher:P,clearIcons:B,getCacheInfo:U,getCachedIcon:async function(t){const n=V.get(t);if(n)return n;const e=(async()=>{try{await async function(){if(!I&&"caches"in window){I=!0;try{const t=(await caches.keys()).filter(t=>t.startsWith("ty-icons-v")&&t!==j);await Promise.all(t.map(t=>caches.delete(t)))}catch(t){}}}();const n=await caches.open(j),e=await n.match(`${F}${t}`);if(e)return await e.text()}catch(n){}return null})();return V.set(t,e),e.finally(()=>{V.delete(t)}),e},getIcon:H,getIconNames:Y,hasIcon:N,registerIcons:O,removeWatcher:W},Symbol.toStringTag,{value:"Module"}));let K=0;const Z='<svg xmlns="http://www.w3.org/2000/svg"\nviewBox="0 0 512 512"\nfill="currentColor"\nopacity="0.2">\n<path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512z"/>\n</svg>',J=class extends u{constructor(){super(),this.V=null,this.I="",this.O=null,b(this.shadowRoot,{css:"\n:host {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nline-height: 0;\nwidth: var(--ty-icon-size, 1em);\nheight: var(--ty-icon-size, 1em);\naspect-ratio: 1 / 1;\ncolor: inherit;\ntransition: color 150ms cubic-bezier(0.4, 0, 0.2, 1);\nflex-shrink: 0;\nvisibility: visible !important;\nopacity: 1;\nwill-change: contents;\ntransform: translateZ(0);\n-webkit-font-smoothing: antialiased;\n}\n:host svg {\nwidth: 100%;\nheight: 100%;\ndisplay: block;\nwill-change: auto;\ntransform: translateZ(0);\n}\n::slotted(svg),\n::slotted(img) {\nwidth: 100%;\nheight: 100%;\ndisplay: block;\n}\n:host([slot]) {\ndisplay: inline-flex;\n}\n:host(.icon-xs) {\nwidth: 0.75em;\nheight: 0.75em;\n}\n:host(.icon-sm) {\nwidth: 0.875em;\nheight: 0.875em;\n}\n:host(.icon-md) {\nwidth: 1em;\nheight: 1em;\n}\n:host(.icon-lg) {\nwidth: 1.25em;\nheight: 1.25em;\n}\n:host(.icon-xl) {\nwidth: 1.5em;\nheight: 1.5em;\n}\n:host(.icon-2xl) {\nwidth: 2em;\nheight: 2em;\n}\n:host(.icon-12) {\nwidth: 12px;\nheight: 12px;\n}\n:host(.icon-14) {\nwidth: 14px;\nheight: 14px;\n}\n:host(.icon-16) {\nwidth: 16px;\nheight: 16px;\n}\n:host(.icon-18) {\nwidth: 18px;\nheight: 18px;\n}\n:host(.icon-20) {\nwidth: 20px;\nheight: 20px;\n}\n:host(.icon-24) {\nwidth: 24px;\nheight: 24px;\n}\n:host(.icon-32) {\nwidth: 32px;\nheight: 32px;\n}\n:host(.icon-48) {\nwidth: 48px;\nheight: 48px;\n}\n:host(.icon-64) {\nwidth: 64px;\nheight: 64px;\n}\n:host(.icon-80) {\nwidth: 80px;\nheight: 80px;\n}\n:host(.icon-96) {\nwidth: 96px;\nheight: 96px;\n}\n:host(.icon-spin) {\nanimation: icon-spin 1s linear infinite;\n}\n:host(.icon-spin.icon-tempo-slow) {\nanimation: icon-spin 2s linear infinite;\n}\n:host(.icon-spin.icon-tempo-fast) {\nanimation: icon-spin 0.5s linear infinite;\n}\n@keyframes icon-spin {\nfrom {\ntransform: rotate(0deg);\n}\nto {\ntransform: rotate(360deg);\n}\n}\n:host(.icon-pulse) {\nanimation: icon-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n:host(.icon-pulse.icon-tempo-slow) {\nanimation: icon-pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n:host(.icon-pulse.icon-tempo-fast) {\nanimation: icon-pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n@keyframes icon-pulse {\n0%,\n100% {\nopacity: 1;\n}\n50% {\nopacity: 0.5;\n}\n}\n:host {\n-webkit-user-select: none;\nuser-select: none;\n}\n:host(:not(.icon-clickable)) {\npointer-events: none;\n}\n:host(.icon-clickable) {\ncursor: pointer;\npointer-events: auto;\ntransition: color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n:host(.icon-clickable:hover) {\ntransform: scale(1.1);\n}\n:host(.icon-clickable:active) {\ntransform: scale(0.95);\n}\n:host(.icon-disabled) {\nopacity: 0.5;\ncursor: not-allowed;\n}\n:host(.icon-block) {\ndisplay: block;\n}\n",id:"ty-icon"}),this.O=document.createElement("slot"),this.O.innerHTML=Z,this.I=Z,this.shadowRoot.appendChild(this.O)}onConnect(){this.V="ty-icon-"+ ++K,this.name&&P(this.V,this.name,t=>{this.name&&t.has(this.name)&&this.render()}),this.updateClasses()}onDisconnect(){this.V&&(W(this.V),this.V=null)}onPropertiesChanged(t){for(const n of t)if("name"===n.name){this.V&&W(this.V);const t=n.newValue||"";t&&this.isConnected&&(this.V="ty-icon-"+ ++K,P(this.V,t,t=>{this.name&&t.has(this.name)&&this.render()}))}this.updateClasses()}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get size(){return this.getProperty("size")||void 0}set size(t){this.setProperty("size",t||"")}get spin(){return this.getProperty("spin")}set spin(t){this.setProperty("spin",t)}get pulse(){return this.getProperty("pulse")}set pulse(t){this.setProperty("pulse",t)}get tempo(){return this.getProperty("tempo")||void 0}set tempo(t){this.setProperty("tempo",t||"")}buildClasses(){const t=[],n=this.getProperty("size");n&&t.push("icon-"+n),this.getProperty("spin")&&t.push("icon-spin"),this.getProperty("pulse")&&t.push("icon-pulse");const e=this.getProperty("tempo");e&&(this.getProperty("spin")||this.getProperty("pulse"))&&t.push("icon-tempo-"+e);const i=this.className.split(/\s+/).filter(t=>t&&!t.startsWith("icon-")&&"icon-spin"!==t&&"icon-pulse"!==t);return[...t,...i]}updateClasses(){const t=this.buildClasses().join(" ");this.className!==t&&(this.className=t)}render(){const t=this.getProperty("name");if(!t)return void this.renderSvg(Z);const n=H(t);this.renderSvg(n||Z)}renderSvg(t){this.I!==t&&this.O&&(this.O.innerHTML=t,this.I=t)}};J.formAssociated=!1,J.properties={name:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:""},spin:{type:"boolean",visual:!0,default:!1},pulse:{type:"boolean",visual:!0,default:!1},tempo:{type:"string",visual:!0,default:""}};let G=J;customElements.get("ty-icon")||customElements.define("ty-icon",G);const Q=`\n:host([hidden]) {\ndisplay: none !important;\n}\n.tag-container {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\ngap: var(--ty-spacing-1);\nborder-radius: var(--ty-radius-full);\nfont-weight: var(--ty-weight-label, 440);\ntext-align: center;\nwhite-space: nowrap;\nuser-select: none;\nbox-sizing: border-box;\npadding: 0 0.625rem; \nfont-size: var(--ty-font-xs); \nline-height: var(--ty-leading-xs); \nletter-spacing: var(--ty-tracking-xs); \nmin-height: 28px;\ntransition: var(--ty-transition-all);\nbackground: var(--tag-bg, transparent);\ncolor: var(--tag-color, var(--ty-text));\nborder: 1px solid;\nborder-color: var(--tag-border-color, var(--ty-border));\n}\n:host([no-pill]) .tag-container {\nborder-radius: var(--ty-radius-md);\n}\n:host([value]:not([selected])) .tag-container:not([aria-disabled="true"]) {\ncursor: pointer;\n}\n:host([selected]) .tag-container:not([aria-disabled="true"]) {\ncursor: initial;\n}\n.tag-container[tabindex]:not([aria-disabled="true"]):hover {\nbackground: var(--ty-bg-neutral-soft);\ntransform: translateY(-1px);\nbox-shadow: var(--ty-shadow-sm);\n}\n.tag-container[tabindex]:not([aria-disabled="true"]):active {\ntransform: translateY(0);\nbox-shadow: var(--ty-shadow-sm);\n}\n.tag-container[tabindex]:focus {\noutline: none;\n}\n.tag-container[aria-disabled="true"] {\nopacity: 0.6;\ncursor: not-allowed;\npointer-events: none;\n}\n.tag-start,\n.tag-content,\n.tag-end {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nflex-shrink: 0;\n}\n.tag-content {\nflex: 1;\nmin-width: 0;\n}\n.tag-dismiss {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\npadding: 0;\nbackground: none;\nborder: none;\ncolor: currentColor;\ncursor: pointer;\nborder-radius: var(--ty-radius-full);\ntransition: var(--ty-transition-all);\nopacity: 0.7;\nflex-shrink: 0;\nwidth: var(--ty-spacing-4);\nheight: var(--ty-spacing-4);\n}\n.tag-dismiss:hover {\nopacity: 1;\nbackground: rgba(0, 0, 0, 0.1);\n}\n.tag-dismiss svg {\nwidth: 100%;\nheight: 100%;\n}\n:host([size="xs"]) .tag-container {\npadding: 0 0.375rem; \nfont-size: var(--ty-font-xs); \nline-height: var(--ty-leading-xs);\nletter-spacing: var(--ty-tracking-xs);\nmin-height: 20px;\n}\n:host([size="xs"]) .tag-dismiss {\nwidth: var(--ty-spacing-3);\nheight: var(--ty-spacing-3);\nmargin-left: var(--ty-spacing-2);\n}\n:host([size="sm"]) .tag-container {\npadding: 0 var(--ty-spacing-2); \nfont-size: var(--ty-font-xs); \nline-height: var(--ty-leading-xs);\nletter-spacing: var(--ty-tracking-xs);\nmin-height: 24px;\n}\n:host([size="sm"]) .tag-dismiss {\nwidth: var(--ty-spacing-3);\nheight: var(--ty-spacing-3);\nmargin-left: var(--ty-spacing-2);\n}\n:host([size="lg"]) .tag-container {\npadding: 0 var(--ty-spacing-3); \nfont-size: var(--ty-font-sm); \nline-height: var(--ty-leading-sm); \nletter-spacing: var(--ty-tracking-sm); \nmin-height: 32px;\n}\n:host([size="lg"]) .tag-dismiss {\nwidth: var(--ty-spacing-5);\nheight: var(--ty-spacing-5);\nmargin-left: var(--ty-spacing-4);\n}\n:host([size="xl"]) .tag-container {\npadding: 0 0.875rem; \nfont-size: var(--ty-font-sm); \nline-height: var(--ty-leading-sm); \nletter-spacing: var(--ty-tracking-sm); \nmin-height: 36px;\n}\n:host([size="xl"]) .tag-dismiss {\nwidth: var(--ty-spacing-5);\nheight: var(--ty-spacing-5);\nmargin-left: var(--ty-spacing-4);\n}\n${n.filter(t=>"neutral"!==t).map(t=>`\n:host([flavor="${t}"]) {\n--tag-bg: var(--ty-bg-${t});\n--tag-color: var(--ty-color-${t});\n--tag-border-color: var(--ty-border-${t});\n}\n:host([flavor="${t}+"]) {\n--tag-bg: var(--ty-bg-${t}-bold);\n--tag-color: var(--ty-color-${t}-strong);\n--tag-border-color: var(--ty-color-${t});\n}\n:host([flavor="${t}-"]) {\n--tag-bg: var(--ty-bg-${t}-soft);\n--tag-color: var(--ty-color-${t});\n--tag-border-color: var(--ty-border-${t});\n}\n:host([flavor="${t}"]) .tag-container[tabindex]:hover,\n:host([flavor="${t}+"]) .tag-container[tabindex]:hover,\n:host([flavor="${t}-"]) .tag-container[tabindex]:hover {\nbackground: var(--ty-bg-${t}-bold);\n}\n:host([flavor="${t}"]) .tag-container[tabindex]:focus,\n:host([flavor="${t}+"]) .tag-container[tabindex]:focus,\n:host([flavor="${t}-"]) .tag-container[tabindex]:focus {\nbox-shadow: 0 0 0 3px var(--ty-color-${t}-faint);\n}\n`).join("")}\n:host([flavor="neutral"]) {\n--tag-color: var(--ty-text-bold);\n--tag-bg: var(--ty-bg-neutral-soft);\n--tag-border-color: var(--ty-border-bold);\n}\n:host([flavor="neutral+"]) {\n--tag-bg: var(--ty-bg-neutral-bold);\n--tag-color: var(--ty-text-bold);\n--tag-border-color: var(--ty-border-strong);\n}\n:host([flavor="neutral-"]) {\n--tag-bg: var(--ty-bg-neutral-soft);\n--tag-color: var(--ty-text-soft);\n--tag-border-color: var(--ty-border);\n}\n:host([flavor="neutral"]) .tag-container[tabindex]:hover,\n:host([flavor="neutral+"]) .tag-container[tabindex]:hover,\n:host([flavor="neutral-"]) .tag-container[tabindex]:hover {\nbackground: var(--ty-bg-neutral-soft);\n}\n:host([flavor="neutral"]) .tag-container[tabindex]:focus,\n:host([flavor="neutral+"]) .tag-container[tabindex]:focus,\n:host([flavor="neutral-"]) .tag-container[tabindex]:focus {\nbox-shadow: 0 0 0 3px var(--ty-border-soft);\n}\n.tag-start ::slotted(*),\n.tag-content ::slotted(*),\n.tag-end ::slotted(*) {\ndisplay: flex;\nalign-items: center;\n}\n.tag-start ::slotted(ty-icon),\n.tag-end ::slotted(ty-icon) {\nwidth: 1em;\nheight: 1em;\nflex-shrink: 0;\n}\n.tag-end ::slotted(.count) {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nmin-width: var(--ty-spacing-6);\nheight: var(--ty-spacing-5);\npadding: 0 var(--ty-spacing-2);\nbackground: rgba(0, 0, 0, 0.1);\nborder-radius: var(--ty-radius-full);\nfont-size: var(--ty-font-xs);\nfont-weight: var(--ty-font-semibold);\nline-height: var(--ty-line-height-none);\nflex-shrink: 0;\n}\n.tag-content {\noverflow: hidden;\ntext-overflow: ellipsis;\n}\n:host([data-type="user"]) .tag-container {\nmin-width: var(--ty-spacing-20);\n}\n`,tt=class extends u{constructor(){super(),this.H=null,this.j=null,this.handleClick=t=>{this.clickable&&!this.disabled&&(t.preventDefault(),t.stopPropagation(),this.dispatchTagEvent("click",{target:this}),this.dispatchTagEvent("pointerdown",{target:this}))},this.handleDismiss=t=>{this.dismissible&&!this.disabled&&(t.preventDefault(),t.stopPropagation(),this.dispatchTagEvent("dismiss",{target:this}))},this.handleKeydown=t=>{const n=t;if(!this.disabled)switch(n.keyCode){case 13:case 32:this.clickable&&(n.preventDefault(),this.dispatchTagEvent("click",{target:this}));break;case 8:case 46:this.dismissible&&(n.preventDefault(),this.dispatchTagEvent("dismiss",{target:this}))}},b(this.shadowRoot,{css:Q,id:"ty-tag"})}onConnect(){this.F(),queueMicrotask(()=>{this.setupEventListeners()})}F(){this.j=k(this.shadowRoot,this.j,this.flavor,({flavor:t,base:n,shade:e})=>`\n:host([flavor="${t}"]) {\n--tag-bg: var(${"+"===e?`--ty-bg-${n}-bold`:"-"===e?`--ty-bg-${n}-soft`:"--ty-bg-"+n});\n--tag-color: var(${"+"===e?`--ty-color-${n}-strong`:"--ty-color-"+n});\n--tag-border-color: var(--ty-border-${n}, var(--ty-color-${n}));\n}\n:host([flavor="${t}"]) .tag-container[tabindex]:hover {\nbackground: var(--ty-bg-${n}-bold, var(--tag-bg));\n}\n:host([flavor="${t}"]) .tag-container[tabindex]:focus {\nbox-shadow: 0 0 0 3px var(--ty-color-${n}-faint, var(--tag-color));\n}`)}onDisconnect(){this.cleanupEventListeners()}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.F()}dispatchTagEvent(t,n){this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}cleanupEventListeners(){this.H&&(this.H(),this.H=null)}setupEventListeners(){this.cleanupEventListeners();const t=this.shadowRoot,n=t.querySelector(".tag-container"),e=t.querySelector(".tag-dismiss");n&&(n.addEventListener("click",this.handleClick),n.addEventListener("keydown",this.handleKeydown),e&&e.addEventListener("click",this.handleDismiss),this.H=()=>{n.removeEventListener("click",this.handleClick),n.removeEventListener("keydown",this.handleKeydown),e&&e.removeEventListener("click",this.handleDismiss)})}render(){this.shadowRoot.innerHTML=`\n<div class="tag-container" part="container"${this.clickable?' tabindex="0"':""}${this.disabled?' aria-disabled="true"':""}${this.value?` data-value="${this.value}"`:""}>\n<div class="tag-start">\n<slot name="start" class="tag-start"></slot>\n</div>\n<div class="tag-content">\n<slot></slot>\n</div>\n<div class="tag-end">\n<slot name="end"></slot>\n${this.dismissible?'\n<button class="tag-dismiss" type="button" aria-label="Remove tag">\n<svg viewBox="0 0 20 20" fill="currentColor">\n<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" />\n</svg>\n</button>\n':""}\n</div>\n</div>\n`,this.p&&this.setupEventListeners()}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get selected(){return this.getProperty("selected")}set selected(t){this.setProperty("selected",t)}get noPill(){return this.getProperty("noPill")}set noPill(t){this.setProperty("noPill",t)}get clickable(){return this.getProperty("clickable")}set clickable(t){this.setProperty("clickable",t)}get dismissible(){return this.getProperty("dismissible")}set dismissible(t){this.setProperty("dismissible",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}};tt.formAssociated=!0,tt.properties={flavor:{type:"string",visual:!0,default:"neutral"},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},value:{type:"string",visual:!0,default:""},selected:{type:"boolean",visual:!0,default:!1},noPill:{type:"boolean",visual:!0,default:!1},clickable:{type:"boolean",visual:!0,default:!1},dismissible:{type:"boolean",visual:!0,default:!1},disabled:{type:"boolean",visual:!0,default:!1}};let nt=tt;customElements.get("ty-tag")||customElements.define("ty-tag",nt);class TyOption extends HTMLElement{constructor(){super(),this.N=void 0,this.B=!1,this.P=!1,this.W=!1,this.R=!1,b(this.attachShadow({mode:"open"}),{css:"\n.option-content {\ndisplay: flex;\nalign-items: center;\njustify-content: space-between;\ngap: var(--ty-spacing-2);\nbox-sizing: border-box;\nwidth: 100%;\ncursor: pointer;\nuser-select: none;\ntransition: var(--ty-transition-all);\ncolor: var(--ty-text);\nfont-family: inherit;\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\npadding: var(--ty-spacing-2) var(--ty-spacing-3);\nborder-radius: var(--ty-radius-md);\n}\n:host([cloned]) {\ndisplay: block;\nmin-width: 0;\noverflow: hidden;\n}\n:host([cloned]) .option-content {\ndisplay: block;\npadding: 0px;\nbackground: transparent;\nmin-width: 0;\noverflow: hidden;\nwhite-space: nowrap;\ntext-overflow: ellipsis;\nfont-size: var(--ty-field-font, var(--ty-font-sm));\nline-height: var(--ty-field-leading, var(--ty-leading-sm));\nletter-spacing: var(--ty-field-tracking, var(--ty-tracking-sm));\n}\n.option-content:hover {\nbackground: var(--ty-bg-neutral-soft);\n}\n.option-content[highlighted] {\nbackground: var(--ty-bg-neutral-soft);\ncolor: var(--ty-text-strong);\n}\n.option-content[selected] {\nbackground: transparent;\ncolor: var(--ty-text-bold);\n}\n.option-check {\ndisplay: block;\nvisibility: hidden;\nflex-shrink: 0;\nwidth: 14px;\nheight: 14px;\nmargin-left: auto;\ncolor: var(--ty-color-primary);\n}\n.option-content[selected] .option-check {\nvisibility: visible;\n}\n:host([cloned]) .option-check {\ndisplay: none;\n}\n.option-content[selected]:hover {\nbackground: var(--ty-bg-neutral-soft);\n}\n.option-content[disabled] {\nopacity: 0.5;\ncursor: not-allowed;\n}\n.option-content[hidden] {}\n.option-content * {\npointer-events: none;\n}\n",id:"ty-option"}),this.render()}static get observedAttributes(){return["value","disabled","selected","highlighted","hidden"]}connectedCallback(){const t=Object.getOwnPropertyDescriptor(this,"value");t&&(this.N=t.value,delete this.value),this.render()}attributeChangedCallback(t,n,e){if(n!==e){switch(t){case"value":this.N=e||void 0;break;case"selected":this.B=null!==e;break;case"disabled":this.P=null!==e;break;case"highlighted":this.W=null!==e;break;case"hidden":this.R=null!==e}this.render()}}getOptionValue(){if(void 0!==this.N)return this.N;const t=this.getAttribute("value");return null!==t?t:this.textContent?.trim()||""}get value(){return this.getOptionValue()}set value(t){this.N!==t&&(this.N=t,void 0!==t?this.setAttribute("value",t):this.removeAttribute("value"),this.render())}get selected(){return this.B}set selected(t){t=i(t),this.B!==t&&(this.B=t,t?this.setAttribute("selected",""):this.removeAttribute("selected"),this.render())}get disabled(){return this.P}set disabled(t){t=i(t),this.P!==t&&(this.P=t,t?this.setAttribute("disabled",""):this.removeAttribute("disabled"),this.render())}get highlighted(){return this.W}set highlighted(t){t=i(t),this.W!==t&&(this.W=t,t?this.setAttribute("highlighted",""):this.removeAttribute("highlighted"),this.render())}get hidden(){return this.R}set hidden(t){t=i(t),this.R!==t&&(this.R=t,t?this.setAttribute("hidden",""):this.removeAttribute("hidden"),this.render())}render(){const t=this.shadowRoot;t.querySelector(".option-content")||(t.innerHTML='<div class="option-content"><slot></slot>\n<svg class="option-check" viewBox="0 0 24 24" fill="none" stroke="currentColor"\nstroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">\n<path d="M20 6 9 17l-5-5" />\n</svg>\n</div>');const n=t.querySelector(".option-content");n&&(this.P?n.setAttribute("disabled",""):n.removeAttribute("disabled"),this.B?n.setAttribute("selected",""):n.removeAttribute("selected"),this.W?n.setAttribute("highlighted",""):n.removeAttribute("highlighted"),this.R?n.setAttribute("hidden",""):n.removeAttribute("hidden"))}}customElements.get("ty-option")||customElements.define("ty-option",TyOption);const et='\n:host {\n--ty-field-height: var(--ty-size-sm, 2rem);\n--ty-field-pad-x: 10px;\n--ty-field-font: var(--ty-font-sm);\n--ty-field-leading: 20px;\n--ty-field-tracking: var(--ty-tracking-sm);\n--ty-field-label-font: var(--ty-font-xs);\n--ty-field-label-leading: var(--ty-leading-xs);\n--ty-field-label-gap: 5px;\n--ty-field-outer-pad-x: calc(var(--ty-field-pad-x) + 1px);\n--ty-field-control: 24px;\n--ty-field-icon: 16px;\n}\n:host([size="xs"]) {\n--ty-field-height: var(--ty-size-xs, 1.75rem);\n--ty-field-pad-x: 8px;\n--ty-field-font: var(--ty-font-xs);\n--ty-field-leading: 16px;\n--ty-field-tracking: var(--ty-tracking-xs);\n--ty-field-label-font: var(--ty-font-xs);\n--ty-field-label-leading: var(--ty-leading-xs);\n--ty-field-label-gap: 4px;\n--ty-field-control: 20px;\n--ty-field-icon: 14px;\n}\n:host([size="md"]) {\n--ty-field-height: var(--ty-size-md, 2.25rem);\n--ty-field-pad-x: 12px;\n--ty-field-font: var(--ty-font-sm);\n--ty-field-leading: 20px;\n--ty-field-tracking: var(--ty-tracking-sm);\n--ty-field-label-font: var(--ty-font-sm);\n--ty-field-label-leading: var(--ty-leading-sm);\n--ty-field-label-gap: 6px;\n--ty-field-control: 28px;\n--ty-field-icon: 18px;\n}\n:host([size="lg"]) {\n--ty-field-height: var(--ty-size-lg, 2.5rem);\n--ty-field-pad-x: 14px;\n--ty-field-font: var(--ty-font-base);\n--ty-field-leading: 24px;\n--ty-field-tracking: var(--ty-tracking-base);\n--ty-field-label-font: var(--ty-font-sm);\n--ty-field-label-leading: var(--ty-leading-sm);\n--ty-field-label-gap: 6px;\n--ty-field-control: 32px;\n--ty-field-icon: 20px;\n}\n:host([size="xl"]) {\n--ty-field-height: var(--ty-size-xl, 2.75rem);\n--ty-field-pad-x: 16px;\n--ty-field-font: var(--ty-font-lg);\n--ty-field-leading: 28px;\n--ty-field-tracking: var(--ty-tracking-base);\n--ty-field-label-font: var(--ty-font-base);\n--ty-field-label-leading: var(--ty-leading-base);\n--ty-field-label-gap: 8px;\n--ty-field-control: 36px;\n--ty-field-icon: 22px;\n}\n@media (max-width: 640px) {\n:host([size="lg"]) {\n--ty-field-height: var(--ty-size-md, 2.25rem);\n--ty-field-pad-x: 12px;\n--ty-field-font: var(--ty-font-sm);\n--ty-field-leading: 20px;\n--ty-field-control: 28px;\n--ty-field-icon: 18px;\n}\n:host([size="xl"]) {\n--ty-field-height: var(--ty-size-lg, 2.5rem);\n--ty-field-pad-x: 14px;\n--ty-field-font: var(--ty-font-base);\n--ty-field-leading: 24px;\n--ty-field-control: 32px;\n--ty-field-icon: 20px;\n}\n}\n@media (max-width: 480px) {\n:host([size="xl"]) {\n--ty-field-height: var(--ty-size-md, 2.25rem);\n--ty-field-pad-x: 12px;\n--ty-field-font: var(--ty-font-sm);\n--ty-field-leading: 20px;\n--ty-field-control: 28px;\n--ty-field-icon: 18px;\n}\n}\n',it=(t,n)=>{const e=e=>n?e?`var(--ty-color-${t}${e}, var(--ty-color-${t}, var(--ty-color-${n}${e})))`:`var(--ty-color-${t}, var(--ty-color-${n}))`:e?`var(--ty-color-${t}${e}, var(--ty-color-${t}))`:`var(--ty-color-${t})`;return`\n:host([flavor="${t}"]) {\n--input-accent: var(--ty-input-${t}-border, ${e("-soft")});\n--input-accent-bold: ${e("")};\n--input-ring: color-mix(in oklab, ${e("")} 15%, transparent);\n}\n:host([flavor="${t}+"]) {\n--input-accent: ${e("")};\n--input-accent-bold: ${e("-strong")};\n--input-ring: color-mix(in oklab, ${e("-strong")} 15%, transparent);\n}\n:host([flavor="${t}-"]) {\n--input-accent: ${e("-faint")};\n--input-accent-bold: ${e("-soft")};\n--input-ring: color-mix(in oklab, ${e("-soft")} 15%, transparent);\n}\n`},ot=`\n${et}\n:host {\ndisplay: block;\nfont-family: inherit;\nwidth: 100%;\n}\n.input-container {\ndisplay: flex;\nflex-direction: column;\nwidth: 100%;\nbox-sizing: border-box;\n}\n.ty-field-label {\nfont-size: var(--ty-field-label-font);\nline-height: var(--ty-field-label-leading);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-medium);\ncolor: var(--ty-label-color);\nmargin-bottom: var(--ty-field-label-gap);\npadding-left: var(--ty-field-outer-pad-x);\ndisplay: flex;\nalign-items: center;\n}\n.required-icon {\ndisplay: inline-flex;\nalign-items: center;\ncolor: var(--ty-color-danger);\nwidth: 12px;\nheight: 12px;\nmargin-left: 4px;\nvertical-align: middle;\n}\n.required-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n.input-wrapper {\ndisplay: flex;\nalign-items: center;\ngap: 0.5rem;\nwidth: 100%;\nbox-sizing: border-box;\nborder: 1px solid var(--input-accent, var(--input-border, var(--ty-input-border)));\nborder-radius: var(--ty-radius-base);\nbackground: var(--input-bg, var(--input-bg, var(--ty-input-bg)));\ntransition: var(--ty-local-transition, all 0.15s ease-in-out);\nmin-height: var(--ty-field-height);\npadding: 0 var(--ty-field-pad-x);\n}\n.input-wrapper:hover:not(.disabled):not(.focused) {\nborder-color: var(--input-accent-bold, var(--input-border-hover, var(--ty-input-border-hover)));\n}\n.input-wrapper.focused {\nborder-color: var(--input-accent-bold, var(--input-border-focus, var(--ty-input-border-focus)));\nbox-shadow: 0 0 0 3px var(--input-ring, var(--input-shadow-focus, var(--ty-input-shadow-focus)));\n}\n.input-wrapper.disabled {\ncursor: not-allowed;\nopacity: 0.5;\nbackground: var(--input-disabled-bg, var(--ty-input-disabled-bg));\nborder-color: var(--input-disabled-border, var(--ty-input-disabled-border));\n}\n::slotted([slot="start"]),\n::slotted([slot="end"]) {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nflex-shrink: 0;\ncolor: var(--ty-text-soft);\n}\n.password-toggle {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nflex-shrink: 0;\nwidth: 1.25rem;\nheight: 1.25rem;\npadding: 0;\nborder: none;\nbackground: none;\ncursor: pointer;\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\ntransition: var(--ty-local-transition, color 0.15s ease-in-out);\n}\n.password-toggle:hover {\ncolor: var(--input-color, var(--ty-input-color));\n}\n.password-toggle:focus-visible {\noutline: 2px solid var(--input-accent, var(--ty-color-primary));\noutline-offset: 2px;\nborder-radius: 2px;\n}\n.password-toggle svg {\nwidth: 1rem;\nheight: 1rem;\n}\n::slotted(ty-icon) {\nwidth: 1em;\nheight: 1em;\nflex-shrink: 0;\n}\n.error-message {\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\nletter-spacing: var(--ty-tracking-xs);\ncolor: var(--ty-color-danger);\nmargin-top: 4px;\npadding-left: var(--ty-field-outer-pad-x);\n}\n.input-wrapper.error {\nborder-color: var(--ty-color-danger);\nbackground: var(--ty-bg-danger-soft);\n}\n.input-wrapper.error.focused {\nborder-color: var(--ty-color-danger-bold);\nbox-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\ninput {\nflex: 1;\nmin-width: 0;\nbox-sizing: border-box;\nborder: none;\noutline: none;\nbackground: transparent;\ncolor: var(--input-color, var(--ty-input-color));\nfont-family: inherit;\nfont-size: var(--ty-field-font);\nline-height: var(--ty-field-leading);\nletter-spacing: var(--ty-field-tracking);\nfont-weight: var(--ty-font-normal);\npadding: 0;\nmargin: 0;\n}\ninput[type="number"]::-webkit-outer-spin-button,\ninput[type="number"]::-webkit-inner-spin-button {\n-webkit-appearance: none;\nmargin: 0;\n}\ninput[type="number"] {\n-moz-appearance: textfield;\n}\ninput:disabled {\ncursor: not-allowed;\ncolor: var(--input-disabled-color, var(--ty-input-disabled-color));\n}\ninput::placeholder {\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\nfont-weight: 400;\n}\n${n.filter(t=>"neutral"!==t).map(t=>it(t)).join("")}\ninput:focus-visible {\noutline: none;\n}\n@media (prefers-contrast: high) {\n.input-wrapper {\nborder-width: 2px;\n}\n}\n@media (prefers-reduced-motion: reduce) {\n.input-wrapper {\ntransition: none;\n}\n}\n`;function rt(t){return["number","currency","percent","compact"].includes(t)}function st(t,n){if(n)return n;const e=t.closest("[lang]");if(e){const t=e.getAttribute("lang");if(t)return t}return document.documentElement.lang?document.documentElement.lang:navigator.language?navigator.language:"en-US"}function at(t,n){let e=st(t);const i=new MutationObserver(i=>{for(const o of i)if("attributes"===o.type&&"lang"===o.attributeName){const i=st(t);i!==e&&(e=i,n(i))}});return i.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}),()=>i.disconnect()}const lt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/></svg>',ct='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/></svg>',dt=class extends u{constructor(){super(),this.Y=null,this.U=!1,this.X=!1,this.K=!1,this.Z=!1,this.j=null,this.J=null,this.G=null,this.tt=null,this.nt=null,this.et=null,this.it=null,this.ot=t=>{if("Enter"!==t.key||t.isComposing||t.defaultPrevented)return;const n=this.$.form;if(!n)return;const e=Array.from(n.elements),i=e.find(t=>t instanceof HTMLButtonElement&&"submit"===t.type||t instanceof HTMLInputElement&&("submit"===t.type||"image"===t.type)||"TY-BUTTON"===t.tagName&&!["button","reset"].includes(t.getAttribute("type")??""));if(i){if(i.disabled||i.hasAttribute("disabled"))return;return t.preventDefault(),void("TY-BUTTON"===i.tagName?i.shadowRoot?.querySelector("button")??i:i).click()}1===e.filter(t=>"TY-INPUT"===t.tagName||t instanceof HTMLInputElement&&!["button","checkbox","radio","file","hidden","image","reset","submit","range","color"].includes(t.type)).length&&(t.preventDefault(),n.requestSubmit())},b(this.shadowRoot,{css:ot,id:"ty-input"})}onConnect(){this.initializeShadowValue(),this.rt=at(this,()=>{this.render()}),this.F()}F(){this.j=k(this.shadowRoot,this.j,this.flavor,({base:t})=>(t=>it(t,"neutral"))(t))}onDisconnect(){this.removeEventListeners(),this.rt&&(this.rt(),this.rt=void 0),null!==this.et&&(clearTimeout(this.et),this.et=null),null!==this.it&&(clearTimeout(this.it),this.it=null)}onPropertiesChanged(t){for(const{name:n,newValue:e}of t)switch(n){case"flavor":this.F();break;case"value":this.Y=this.parseShadowValue(e||"");break;case"type":const t=this.getProperty("value")||"";this.Y=this.parseShadowValue(t);break;case"error":e?"neutral"===this.getProperty("flavor")&&(this.setProperty("flavor","danger"),this.Z=!0):this.Z&&("danger"===this.getProperty("flavor")&&this.setProperty("flavor","neutral"),this.Z=!1)}}onFormReset(){this.Y=null,this.initializeShadowValue(),this.U=!1,null!==this.et&&(clearTimeout(this.et),this.et=null),null!==this.it&&(clearTimeout(this.it),this.it=null),this.render()}getFormValue(){return null!==this.Y?this.Y+"":""}initializeShadowValue(){const t=this.getProperty("value");t?(this.Y=this.parseShadowValue(t),this.$.setFormValue(null!==this.Y?this.Y+"":"")):this.$.setFormValue("")}parseShadowValue(t){if(!t||"string"!=typeof t||""===t.trim())return null;if(rt(this.type)){const n=function(t){if(!t||""===t.trim())return null;let n=t.replace(/[^\d.,-]/g,"").trim();if(""===n||"-"===n)return null;const e=n.lastIndexOf(","),i=n.lastIndexOf("."),o=Math.max(e,i);if(-1===o){const t=parseFloat(n);return isNaN(t)?null:t}const r=n[o],s=n.slice(0,o),a=n.slice(o+1);if(s.includes(r)){const t=parseFloat(n.replace(/[.,]/g,""));return isNaN(t)?null:t}const l=s.replace(/[.,]/g,""),c=parseFloat(l+"."+a);return isNaN(c)?null:c}(t);return null!==n&&0===this.precision?Math.round(n):n}return t}shouldFormat(){return rt(this.type)&&!this.U&&null!==this.Y&&"number"==typeof this.Y}getFormatConfig(){return{type:this.type,locale:this.locale,currency:this.currency,precision:this.precision}}getDisplayValue(){if(this.shouldFormat()){let t=this.Y;return"percent"===this.type&&(t/=100),function(t,n){const{type:e,locale:i="en-US",currency:o="USD",precision:r}=n,s={};switch(void 0!==r&&(s.minimumFractionDigits=r,s.maximumFractionDigits=r),e){case"currency":s.style="currency",s.currency=o;break;case"percent":s.style="percent";break;case"compact":s.notation="compact",s.compactDisplay="short";break;default:s.style="decimal"}return new Intl.NumberFormat(i,s).format(t).replace(/\u202F/g," ").replace(/\u2009/g," ")}(t,this.getFormatConfig())}return null!==this.Y?this.Y+"":""}get type(){return this.getProperty("type")}set type(t){this.setProperty("type",t)}get value(){return null!==this.Y?this.Y+"":""}set value(t){this.setProperty("value",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get placeholder(){return this.getProperty("placeholder")}set placeholder(t){this.setProperty("placeholder",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}focus(t){this.shadowRoot?.querySelector("input")?.focus(t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get pattern(){return this.getProperty("pattern")}set pattern(t){this.setProperty("pattern",t??"")}get minLength(){return vt(this.getProperty("minlength"))??-1}set minLength(t){this.setProperty("minlength",null==t||0>t?"":t+"")}get maxLength(){return vt(this.getProperty("maxlength"))??-1}set maxLength(t){this.setProperty("maxlength",null==t||0>t?"":t+"")}get min(){return this.getProperty("min")}set min(t){this.setProperty("min",null==t?"":t+"")}get max(){return this.getProperty("max")}set max(t){this.setProperty("max",null==t?"":t+"")}get tooShortMessage(){return this.getProperty("tooShortMessage")}set tooShortMessage(t){this.setProperty("tooShortMessage",t??"")}get tooLongMessage(){return this.getProperty("tooLongMessage")}set tooLongMessage(t){this.setProperty("tooLongMessage",t??"")}get error(){return this.getProperty("error")}set error(t){this.setProperty("error",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get currency(){return this.getProperty("currency")}set currency(t){this.setProperty("currency",t)}get locale(){return st(this,this.getProperty("locale"))}set locale(t){this.setProperty("locale",t)}get precision(){return this.getProperty("precision")}set precision(t){this.setProperty("precision",t)}get debounce(){return this.getProperty("debounce")}set debounce(t){this.setProperty("debounce",t)}get form(){return this.$.form}buildClassList(){const t=[];return this.disabled&&t.push("disabled"),this.required&&t.push("required"),this.error&&t.push("error"),t.join(" ")}dispatchInputEvent(t,n){this.dispatchEvent(new CustomEvent("input",{detail:{value:this.Y,formattedValue:this.shouldFormat()?this.getDisplayValue():null,rawValue:t,originalEvent:n},bubbles:!0,composed:!0}))}dispatchChangeEvent(t,n){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.Y,formattedValue:this.shouldFormat()?this.getDisplayValue():null,rawValue:t,originalEvent:n},bubbles:!0,composed:!0}))}removeEventListeners(){if(!this.K)return;const t=this.shadowRoot;if(!t)return;const n=t.querySelector("input");n&&(this.J&&(n.removeEventListener("input",this.J),this.J=null),this.G&&(n.removeEventListener("change",this.G),this.G=null),this.tt&&(n.removeEventListener("focus",this.tt),this.tt=null),this.nt&&(n.removeEventListener("blur",this.nt),this.nt=null),n.removeEventListener("keydown",this.ot),this.K=!1)}setupEventListeners(){if(this.K)return;const t=this.shadowRoot,n=t.querySelector("input"),e=t.querySelector(".input-wrapper");n&&e&&(this.J=t=>{this.X=!0,t.stopPropagation(),t.stopImmediatePropagation();const e=t.target.value;this.Y=this.parseShadowValue(e),this.$.setFormValue(null!==this.Y?this.Y+"":""),this.updateValidity(),null!==this.et&&clearTimeout(this.et),this.debounce>0?this.et=window.setTimeout(()=>{this.dispatchInputEvent(n.value,t),this.et=null},this.debounce):this.dispatchInputEvent(e,t)},this.G=t=>{t.stopPropagation(),t.stopImmediatePropagation();const e=t.target.value;this.Y=this.parseShadowValue(e),this.$.setFormValue(null!==this.Y?this.Y+"":""),this.updateValidity(),null!==this.it&&clearTimeout(this.it),this.debounce>0?this.it=window.setTimeout(()=>{this.dispatchChangeEvent(n.value,t),this.it=null},this.debounce):this.dispatchChangeEvent(e,t)},this.tt=t=>{this.U=!0,e.classList.add("focused"),rt(this.type)&&null!==this.Y&&(n.value=this.Y+""),this.dispatchEvent(new CustomEvent("focus",{detail:{originalEvent:t},bubbles:!0,composed:!0}))},this.nt=t=>{const i=t.target.value;null!==this.et&&(clearTimeout(this.et),this.et=null,this.dispatchInputEvent(i,t)),null!==this.it&&(clearTimeout(this.it),this.it=null,this.dispatchChangeEvent(i,t)),this.U=!1,e.classList.remove("focused"),this.X&&this.revealValidity(),this.shouldFormat()&&(n.value=this.getDisplayValue()),this.dispatchEvent(new CustomEvent("blur",{detail:{originalEvent:t},bubbles:!0,composed:!0}))},n.addEventListener("input",this.J),n.addEventListener("change",this.G),n.addEventListener("focus",this.tt),n.addEventListener("blur",this.nt),n.addEventListener("keydown",this.ot),this.K=!0)}render(){const t=this.shadowRoot,n=t.querySelector("input"),e=t.querySelector(".input-wrapper"),i=t.querySelector(".ty-field-label"),o=t.querySelector(".error-message"),r=this.buildClassList(),s=["password","email","tel","url"].includes(this.type)?this.type:"text",a=rt(this.type)?"decimal":"email"===this.type?"email":"tel"===this.type?"tel":"url"===this.type?"url":void 0,l=this.getDisplayValue();if(n&&e){if(n.type=s,n.value=l,n.placeholder=this.placeholder,n.name=this.name,a?n.inputMode=a:n.removeAttribute("inputmode"),e.className="input-wrapper "+r,n.disabled=this.disabled,this.disabled?n.setAttribute("disabled",""):n.removeAttribute("disabled"),n.required=this.required,this.required?n.setAttribute("required",""):n.removeAttribute("required"),this.syncConstraintAttributes(n),this.label?n.setAttribute("aria-label",this.label):n.removeAttribute("aria-label"),this.label)if(i)i.innerHTML=`${this.label}${this.required?`<span class="required-icon">${lt}</span>`:""}`,i.style.display="flex";else{const n=document.createElement("label");n.className="ty-field-label",n.innerHTML=`${this.label}${this.required?`<span class="required-icon">${lt}</span>`:""}`;const i=t.querySelector(".input-container");i&&i.insertBefore(n,e)}else i&&(i.style.display="none");if(this.error)if(o)o.textContent=this.error;else{const n=document.createElement("div");n.className="error-message",n.textContent=this.error,t.querySelector(".input-container")?.appendChild(n)}else o&&o.remove()}else{t.innerHTML=`\n<div class="input-container">\n${this.label?`\n<label class="ty-field-label">\n${this.label}\n${this.required?`<span class="required-icon">${lt}</span>`:""}\n</label>\n`:""}\n<div class="input-wrapper ${r}">\n<slot name="start"></slot>\n<input\ntype="${s}"\nvalue="${l}"\nplaceholder="${this.placeholder}"\nname="${this.name}"\n${a?`inputmode="${a}"`:""}\n/>\n<slot name="end"></slot>\n${"password"===s?`\n<button class="password-toggle" type="button"\naria-label="Show password" aria-pressed="false">\n${ct}\n</button>`:""}\n</div>\n${this.error?`\n<div class="error-message">${this.error}</div>\n`:""}\n</div>\n`;const n=t.querySelector("input");n.disabled=this.disabled,n.required=this.required,this.syncConstraintAttributes(n),this.label&&n.setAttribute("aria-label",this.label),this.setupPasswordToggle(),this.setupEventListeners()}this.updateValidity()}setupPasswordToggle(){const t=this.shadowRoot,n=t.querySelector(".password-toggle"),e=t.querySelector("input");n&&e&&(n.addEventListener("mousedown",t=>t.preventDefault()),n.addEventListener("click",()=>{const t="password"===e.type;e.type=t?"text":"password",n.innerHTML=t?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"/><path d="m2 2 20 20"/></svg>':ct,n.setAttribute("aria-label",t?"Hide password":"Show password"),n.setAttribute("aria-pressed",t+"")}))}syncConstraintAttributes(t){const n=!rt(this.type),e=(e,i)=>n&&""!==i?t.setAttribute(e,i):t.removeAttribute(e);e("pattern",this.pattern),e("maxlength",null!=vt(this.getProperty("maxlength"))?this.maxLength+"":"")}updateValidity(){const t=this.shadowRoot?.querySelector("input");if(this.disabled)return void this.applyValidity({});const n=t?t.value:(this.getProperty("value")??"")+"";if(""===n.trim())return void(this.required?this.applyValidity({valueMissing:!0},pt("text",{required:""},""),t??void 0):this.applyValidity({}));const e={},i=[],o=(t,n)=>{e[t]=!0,i.push(n)};if(rt(this.type)){const t="number"==typeof this.Y?this.Y:null,n=mt(this.min),e=mt(this.max),i=n=>o(n,pt("number",{step:"any",min:this.min,max:this.max},t+""));null!==t&&null!==n&&n>t&&i("rangeUnderflow"),null!==t&&null!==e&&t>e&&i("rangeOverflow")}else{t?.validity.typeMismatch&&o("typeMismatch",t.validationMessage),t?.validity.patternMismatch&&o("patternMismatch",t.validationMessage);const e=n.length,i=vt(this.getProperty("minlength")),r=vt(this.getProperty("maxlength")),s={minlength:i,maxlength:r,length:e};null!==i&&i>e&&o("tooShort",bt(this.tooShortMessage||"Use at least {minlength} characters (now {length})",s)),null!==r&&e>r&&o("tooLong",bt(this.tooLongMessage||"Use at most {maxlength} characters (now {length})",s))}this.applyValidity(e,i[0],t??void 0)}};dt.formAssociated=!0,dt.properties={type:{type:"string",visual:!0,default:"text",validate:t=>["text","email","password","number","tel","url","currency","percent","compact"].includes(t),coerce:t=>["text","email","password","number","tel","url","currency","percent","compact"].includes(t)?t:"text"},value:{type:"string",visual:!0,formValue:!0,emitChange:!0,default:""},name:{type:"string",default:""},placeholder:{type:"string",visual:!0,default:""},label:{type:"string",visual:!0,default:""},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},pattern:{type:"string",visual:!0,default:""},minlength:{type:"string",visual:!0,default:""},maxlength:{type:"string",visual:!0,default:""},min:{type:"string",visual:!0,default:""},max:{type:"string",visual:!0,default:""},tooShortMessage:{type:"string",visual:!0,default:""},tooLongMessage:{type:"string",visual:!0,default:""},error:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},flavor:{type:"string",visual:!0,default:"neutral"},currency:{type:"string",visual:!0,default:"USD"},locale:{type:"string",visual:!0,default:"en-US"},precision:{type:"number",visual:!0,default:void 0,validate:t=>null==t||"number"==typeof t&&t>=0&&10>=t,coerce:t=>{if(null==t)return;const n=+t;return isNaN(n)?void 0:Math.max(0,Math.min(10,Math.floor(n)))}},debounce:{type:"number",default:0,validate:t=>{const n=+t;return!isNaN(n)&&n>=0&&5e3>=n},coerce:t=>{const n=+t;return isNaN(n)?0:Math.max(0,Math.min(5e3,Math.floor(n)))}}};let ht=dt,ut=null;function pt(t,n,e){ut??(ut=document.createElement("input"));for(const i of Array.from(ut.getAttributeNames()))ut.removeAttribute(i);ut.type=t;for(const[i,o]of Object.entries(n))""===o&&"required"!==i||ut.setAttribute(i,o);return ut.value=e,ut.validationMessage}function bt(t,n){return t.replace(/\{(\w+)\}/g,(t,e)=>null!=n[e]?n[e]+"":t)}function vt(t){if(null==t||""===(t+"").trim())return null;const n=+t;return Number.isInteger(n)&&n>=0?n:null}function mt(t){if(null==t||""===(t+"").trim())return null;const n=+t;return Number.isFinite(n)?n:null}customElements.get("ty-input")||customElements.define("ty-input",ht);const gt=(t,n)=>{const e=e=>n?`var(--ty-color-${t}${e}, var(--ty-color-${n}${e}))`:`var(--ty-color-${t}${e})`;return`\n:host([flavor="${t}"]) { --checkbox-color: ${e("-strong")}; --checkbox-ring: color-mix(in oklab, ${e("")} 25%, transparent); }\n:host([flavor="${t}+"]) { --checkbox-color: ${e("-strong")}; --checkbox-ring: color-mix(in oklab, ${e("-strong")} 25%, transparent); }\n:host([flavor="${t}-"]) { --checkbox-color: ${e("")}; --checkbox-ring: color-mix(in oklab, ${e("")} 25%, transparent); }\n`},yt=`\n:host {\ndisplay: inline-flex;\nwidth: auto;\nvertical-align: middle;\n}\n.checkbox-container {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nmin-height: 1.25em;\nmin-height: 1lh;\noutline: none;\ntransition: var(--ty-local-transition, all 0.15s ease-in-out);\nuser-select: none;\ncursor: pointer;\nborder-radius: 6px;\ngap: var(--ty-spacing-1);\ncolor: var(--checkbox-color-off, color-mix(in oklab, var(--ty-text) 30%, transparent));\nbox-sizing: border-box;\npadding: 2px;\nborder-radius: 5px;\n}\n.checkbox-container:hover {\nbackground: var(--checkbox-hover-bg, color-mix(in oklab, var(--ty-text) 8%, transparent));\n}\n.checkbox-container:not([aria-checked="true"]):not([aria-checked="mixed"]):hover {\ncolor: var(--checkbox-color-off-hover, color-mix(in oklab, var(--ty-text) 50%, transparent));\n}\n.checkbox-container[aria-checked="true"] {\ncolor: var(--checkbox-color, var(--ty-text));\n}\n.checkbox-container.focused,\n.checkbox-container:focus-visible {\nbox-shadow: 0 0 0 3px var(--checkbox-ring, color-mix(in oklab, var(--ty-color-primary) 25%, transparent));\n}\n.checkbox-icon {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\ncolor: inherit;\ntransition: var(--ty-local-transition, color 0.15s ease-in-out);\npointer-events: none;\n}\n.checkbox-container svg {\nwidth: 16px;\nheight: 16px;\n}\n.checkbox-container.xs svg {\nwidth: 12px;\nheight: 12px;\n}\n.checkbox-container.sm svg {\nwidth: 14px;\nheight: 14px;\n}\n.checkbox-container.lg svg {\nwidth: 20px;\nheight: 20px;\n}\n.checkbox-container.xl svg {\nwidth: 24px;\nheight: 24px;\n}\n${n.map(t=>gt(t)).join("")}\n.checkbox-container[aria-checked="mixed"] {\ncolor: var(--checkbox-color, var(--ty-text));\n}\n.checkbox-container.disabled {\npointer-events: none;\ncursor: not-allowed;\nopacity: 0.5;\nfilter: grayscale(1);\n}\n.checkbox-container.disabled:not([aria-checked="true"]) {\nopacity: 0.45;\n}\n.checkbox-container.disabled:hover {\nbackground: none;\n}\n.checkbox-container.error .checkbox-icon {\ncolor: var(--ty-color-danger);\n}\n.checkbox-container.error:focus {\nbox-shadow: 0 0 0 3px color-mix(in oklab, var(--ty-color-danger) 15%, transparent);\n}\n`,ft=class extends u{constructor(){super(),this.j=null,this.K=!1,this.st=null,this.lt=null,this.tt=null,this.nt=null,b(this.shadowRoot,{css:yt,id:"ty-checkbox"})}onConnect(){this.setupEventListeners(),this.F()}F(){this.j=k(this.shadowRoot,this.j,this.flavor,({base:t})=>(t=>gt(t,"neutral"))(t))}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.F()}getFormValue(){return this.checked?this.value:null}buildClassList(){const t=[this.size];return this.disabled&&t.push("disabled"),this.required&&t.push("required"),t.join(" ")}handleCheckboxClick(t){if(this.disabled)return;if(this.isDuplicateActivationClick())return;const n=!!this.indeterminate||!this.checked;this.indeterminate&&(this.indeterminate=!1),this.checked=n,setTimeout(()=>{const e={value:n,checked:n,formValue:n?this.value:null,originalEvent:t};this.dispatchEvent(new CustomEvent("input",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0,composed:!0}))},0)}handleCheckboxKeydown(t){this.disabled||["Space"," ","Enter"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this.handleCheckboxClick(t))}removeEventListeners(){if(!this.K)return;this.st&&(this.removeEventListener("click",this.st),this.st=null);const t=this.shadowRoot;if(!t)return;const n=t.querySelector(".checkbox-container");n?(this.lt&&(n.removeEventListener("keydown",this.lt),this.lt=null),this.tt&&(n.removeEventListener("focus",this.tt),this.tt=null),this.nt&&(n.removeEventListener("blur",this.nt),this.nt=null),this.K=!1):this.K=!1}setupEventListeners(){if(this.K)return;const t=this.shadowRoot.querySelector(".checkbox-container");t&&(this.st=t=>{this.handleCheckboxClick(t)},this.lt=t=>{this.handleCheckboxKeydown(t)},this.tt=()=>{t.classList.add("focused")},this.nt=()=>{t.classList.remove("focused")},this.addEventListener("click",this.st),t.addEventListener("keydown",this.lt),t.addEventListener("focus",this.tt),t.addEventListener("blur",this.nt),this.K=!0)}render(){const t=this.shadowRoot;let n=t.querySelector(".checkbox-container");const e=this.buildClassList(),i=this.indeterminate?"mixed":this.checked+"";if(n)n.className="checkbox-container "+e,n.tabIndex=this.disabled?-1:0,n.setAttribute("aria-checked",i),n.setAttribute("aria-disabled",this.disabled+""),n.setAttribute("aria-required",this.required+"");else{n=document.createElement("div"),n.className="checkbox-container "+e,n.tabIndex=this.disabled?-1:0,n.setAttribute("role","checkbox"),n.setAttribute("aria-checked",i),n.setAttribute("aria-disabled",this.disabled+""),n.setAttribute("aria-required",this.required+"");const o=document.createElement("div");o.className="checkbox-icon",n.appendChild(o),t.appendChild(n)}n.querySelector(".checkbox-icon").innerHTML=this.indeterminate?'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/></svg>':'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>',this.setupEventListeners(),this.applyLabelName(n),this.updateValidity()}focus(t){const n=this.shadowRoot?.querySelector(".checkbox-container");n?n.focus(t):super.focus(t)}updateValidity(){const t=this.shadowRoot?.querySelector(".checkbox-container");this.disabled?this.applyValidity({}):this.required&&!this.checked?this.applyValidity({valueMissing:!0},"Please check this box",t??void 0):this.applyValidity({})}get checked(){return this.getProperty("checked")}set checked(t){this.setProperty("checked",t)}get indeterminate(){return this.getProperty("indeterminate")}set indeterminate(t){this.setProperty("indeterminate",t)}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get form(){return this.$.form}};ft.formAssociated=!0,ft.properties={checked:{type:"boolean",visual:!0,formValue:!0,emitChange:!0,default:!1},indeterminate:{type:"boolean",visual:!0,default:!1},value:{type:"string",default:"on"},name:{type:"string",default:""},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},flavor:{type:"string",visual:!0,default:"neutral"}};let wt=ft;customElements.get("ty-checkbox")||customElements.define("ty-checkbox",wt);const xt=(t,n)=>{const e=e=>n?`var(--ty-color-${t}${e}, var(--ty-color-${n}${e}))`:`var(--ty-color-${t}${e})`;return`\n:host([flavor="${t}"]) { --switch-track: ${e("")}; }\n:host([flavor="${t}+"]) { --switch-track: ${e("-strong")}; }\n:host([flavor="${t}-"]) { --switch-track: ${e("-soft")}; }\n`},kt=`\n${ot}\n:host {\ndisplay: inline-flex;\nwidth: auto;\nvertical-align: middle;\n}\n.switch-container {\ndisplay: inline-flex;\nalign-items: center;\nmin-height: 1.25em;\nmin-height: 1lh;\ncursor: pointer;\nuser-select: none;\noutline: none;\nvertical-align: middle;\n}\n.switch-container.disabled {\ncursor: not-allowed;\nopacity: 0.55;\n}\n.switch-container:focus-visible .switch-track,\n.switch-container.focused .switch-track {\nbox-shadow: 0 0 0 3px var(--ty-input-shadow-focus);\n}\n.switch-track {\nposition: relative;\nflex-shrink: 0;\nwidth: 36px;\nheight: 20px;\nborder-radius: var(--ty-radius-full, 999px);\nbackground: var(--ty-color-neutral-soft, var(--ty-input-border));\ntransition: var(--ty-local-transition, background-color 0.18s ease-in-out);\nbox-sizing: border-box;\n}\n.switch-thumb {\nposition: absolute;\ntop: 2px;\nleft: 2px;\nwidth: 16px;\nheight: 16px;\nborder-radius: min(50%, var(--ty-radius-full, 50%));\nbackground: white;\nbox-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);\ntransition: var(--ty-local-transition, transform 0.18s ease-in-out, background-color 0.18s ease-in-out);\n}\n.switch-container[aria-checked="true"] .switch-track {\nbackground: var(--switch-track, var(--ty-color-primary));\n}\n.switch-container[aria-checked="true"] .switch-thumb {\ntransform: translateX(16px);\n}\n.switch-container.xs .switch-track { width: 26px; height: 14px; }\n.switch-container.xs .switch-thumb { width: 10px; height: 10px; }\n.switch-container.xs[aria-checked="true"] .switch-thumb { transform: translateX(12px); }\n.switch-container.sm .switch-track { width: 30px; height: 16px; }\n.switch-container.sm .switch-thumb { width: 12px; height: 12px; }\n.switch-container.sm[aria-checked="true"] .switch-thumb { transform: translateX(14px); }\n.switch-container.lg .switch-track { width: 44px; height: 24px; }\n.switch-container.lg .switch-thumb { width: 20px; height: 20px; }\n.switch-container.lg[aria-checked="true"] .switch-thumb { transform: translateX(20px); }\n.switch-container.xl .switch-track { width: 52px; height: 28px; }\n.switch-container.xl .switch-thumb { width: 24px; height: 24px; }\n.switch-container.xl[aria-checked="true"] .switch-thumb { transform: translateX(24px); }\n${n.map(t=>xt(t)).join("")}\n`,zt=class extends u{constructor(){super(),this.j=null,this.K=!1,this.st=null,this.lt=null,this.tt=null,this.nt=null,b(this.shadowRoot,{css:kt,id:"ty-switch"})}onConnect(){this.setupEventListeners(),this.F()}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.F()}F(){this.j=k(this.shadowRoot,this.j,this.flavor,({base:t})=>(t=>xt(t,"neutral"))(t))}getFormValue(){return this.checked?this.value:null}buildClassList(){const t=[this.size];return this.disabled&&t.push("disabled"),this.required&&t.push("required"),t.join(" ")}handleSwitchClick(t){if(this.disabled)return;if(this.isDuplicateActivationClick())return;const n=!this.checked;this.checked=n,setTimeout(()=>{const e={value:n,checked:n,formValue:n?this.value:null,originalEvent:t};this.dispatchEvent(new CustomEvent("input",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0,composed:!0}))},0)}handleSwitchKeydown(t){this.disabled||["Space"," ","Enter"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this.handleSwitchClick(t))}removeEventListeners(){if(!this.K)return;this.st&&(this.removeEventListener("click",this.st),this.st=null);const t=this.shadowRoot;if(!t)return;const n=t.querySelector(".switch-container");n?(this.lt&&(n.removeEventListener("keydown",this.lt),this.lt=null),this.tt&&(n.removeEventListener("focus",this.tt),this.tt=null),this.nt&&(n.removeEventListener("blur",this.nt),this.nt=null),this.K=!1):this.K=!1}setupEventListeners(){if(this.K)return;const t=this.shadowRoot.querySelector(".switch-container");t&&(this.st=t=>this.handleSwitchClick(t),this.lt=t=>this.handleSwitchKeydown(t),this.tt=()=>t.classList.add("focused"),this.nt=()=>t.classList.remove("focused"),this.addEventListener("click",this.st),t.addEventListener("keydown",this.lt),t.addEventListener("focus",this.tt),t.addEventListener("blur",this.nt),this.K=!0)}render(){const t=this.shadowRoot;let n=t.querySelector(".switch-container");const e=this.buildClassList();if(n)n.className="switch-container "+e,n.tabIndex=this.disabled?-1:0,n.setAttribute("aria-checked",this.checked?"true":"false"),n.setAttribute("aria-disabled",this.disabled?"true":"false"),n.setAttribute("aria-required",this.required?"true":"false");else{n=document.createElement("div"),n.className="switch-container "+e,n.tabIndex=this.disabled?-1:0,n.setAttribute("role","switch"),n.setAttribute("aria-checked",this.checked?"true":"false"),n.setAttribute("aria-disabled",this.disabled?"true":"false"),n.setAttribute("aria-required",this.required?"true":"false");const i=document.createElement("div");i.className="switch-track";const o=document.createElement("div");o.className="switch-thumb",i.appendChild(o),n.appendChild(i),t.appendChild(n)}this.setupEventListeners(),this.applyLabelName(n),this.updateValidity()}focus(t){const n=this.shadowRoot?.querySelector(".switch-container");n?n.focus(t):super.focus(t)}updateValidity(){const t=this.shadowRoot?.querySelector(".switch-container");this.disabled?this.applyValidity({}):this.required&&!this.checked?this.applyValidity({valueMissing:!0},"Please turn this on",t??void 0):this.applyValidity({})}get checked(){return this.getProperty("checked")}set checked(t){this.setProperty("checked",t)}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get form(){return this.$.form}};zt.formAssociated=!0,zt.properties={checked:{type:"boolean",visual:!0,formValue:!0,emitChange:!0,default:!1},value:{type:"string",default:"on"},name:{type:"string",default:""},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},flavor:{type:"string",visual:!0,default:"primary"}};let $t=zt;customElements.get("ty-switch")||customElements.define("ty-switch",$t);const Ct=(t,n)=>{const e=e=>n?`var(--ty-color-${t}${e}, var(--ty-color-${n}${e}))`:`var(--ty-color-${t}${e})`;return`\n:host([flavor="${t}"]) { --radio-color: ${e("")}; }\n:host([flavor="${t}+"]) { --radio-color: ${e("-strong")}; }\n:host([flavor="${t}-"]) { --radio-color: ${e("-soft")}; }\n`},Et=`\n${ot}\n:host(ty-radio) {\ndisplay: inline-flex;\nwidth: auto;\nvertical-align: middle;\n}\n:host(ty-radio-group) {\ndisplay: block;\nwidth: 100%;\n}\n.radio-group-container {\ndisplay: flex;\nflex-direction: column;\ngap: 0.4rem;\nfont-family: inherit;\ncolor: var(--ty-text);\n}\n.radio-group-label {\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nfont-weight: var(--ty-font-medium);\ncolor: var(--ty-text);\ndisplay: flex;\nalign-items: center;\ngap: 0.25rem;\n}\n.radio-group-list {\ndisplay: flex;\ngap: 0.6rem;\nalign-items: flex-start;\n}\n.radio-group-list.vertical {\nflex-direction: column;\nalign-items: flex-start;\n}\n.radio-group-list.horizontal {\nflex-direction: row;\nflex-wrap: wrap;\nalign-items: center;\n}\n.radio-group-error {\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\ncolor: var(--ty-color-danger);\n}\n.radio-group-container .required-icon {\nwidth: 0.65em;\nheight: 0.65em;\ncolor: var(--ty-color-danger);\n}\n.radio-group-container .required-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n.radio-container {\ndisplay: inline-flex;\nalign-items: center;\nmin-height: 1.25em;\nmin-height: 1lh;\ncursor: pointer;\nuser-select: none;\noutline: none;\nvertical-align: middle;\n}\n.radio-container:not(.disabled):not([aria-checked="true"]):hover .radio-circle {\nborder-color: var(--radio-ring-off-hover, color-mix(in oklab, var(--ty-text) 80%, transparent));\n}\n.radio-container.disabled {\ncursor: not-allowed;\nopacity: 0.55;\n}\n.radio-container:focus-visible .radio-circle,\n.radio-container.focused .radio-circle {\nbox-shadow: 0 0 0 3px var(--ty-input-shadow-focus);\n}\n.radio-circle {\nposition: relative;\nflex-shrink: 0;\nwidth: 18px;\nheight: 18px;\nborder-radius: 50%;\nborder: 2px solid var(--radio-ring-off, color-mix(in oklab, var(--ty-text) 45%, transparent));\nbackground: var(--ty-input-bg);\nbox-sizing: border-box;\ntransition: var(--ty-local-transition, border-color 0.15s ease-in-out);\n}\n.radio-circle::after {\ncontent: "";\nposition: absolute;\ntop: 50%;\nleft: 50%;\nwidth: 8px;\nheight: 8px;\nborder-radius: 50%;\nbackground: var(--radio-color, var(--ty-color-primary));\ntransform: translate(-50%, -50%) scale(0);\ntransition: transform 0.15s ease-in-out;\n}\n.radio-container[aria-checked="true"] .radio-circle {\nborder-color: var(--radio-color, var(--ty-color-primary));\n}\n.radio-container[aria-checked="true"] .radio-circle::after {\ntransform: translate(-50%, -50%) scale(1);\n}\n.radio-container.xs .radio-circle { width: 14px; height: 14px; }\n.radio-container.xs .radio-circle::after { width: 6px; height: 6px; }\n.radio-container.sm .radio-circle { width: 16px; height: 16px; }\n.radio-container.sm .radio-circle::after { width: 7px; height: 7px; }\n.radio-container.lg .radio-circle { width: 22px; height: 22px; }\n.radio-container.lg .radio-circle::after { width: 10px; height: 10px; }\n.radio-container.xl .radio-circle { width: 26px; height: 26px; }\n.radio-container.xl .radio-circle::after { width: 12px; height: 12px; }\n${n.map(t=>Ct(t)).join("")}\n`,Mt=class extends u{constructor(){super(),this.j=null,this.K=!1,this.st=null,this.tt=null,this.nt=null,this.ct=!0,b(this.shadowRoot,{css:Et,id:"ty-radio"})}setTabStop(t){this.ct=t;const n=this.shadowRoot?.querySelector(".radio-container");n&&(n.tabIndex=this.disabled||!t?-1:0)}focus(t){const n=this.shadowRoot?.querySelector(".radio-container");n?n.focus(t):super.focus(t)}onConnect(){this.setupEventListeners(),this.dispatchEvent(new CustomEvent("ty-radio-connected",{bubbles:!0})),this.F()}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.F()}F(){this.j=k(this.shadowRoot,this.j,this.flavor,({base:t})=>(t=>Ct(t,"neutral"))(t))}buildClassList(){const t=[this.size];return this.disabled&&t.push("disabled"),t.join(" ")}handleClick(t){this.disabled||(t.stopPropagation(),this.dispatchEvent(new CustomEvent("ty-radio-select",{detail:{value:this.value},bubbles:!0,composed:!0})))}removeEventListeners(){if(!this.K)return;this.st&&(this.removeEventListener("click",this.st),this.st=null);const t=this.shadowRoot?.querySelector(".radio-container");t?(this.tt&&(t.removeEventListener("focus",this.tt),this.tt=null),this.nt&&(t.removeEventListener("blur",this.nt),this.nt=null),this.K=!1):this.K=!1}setupEventListeners(){if(this.K)return;const t=this.shadowRoot.querySelector(".radio-container");t&&(this.st=t=>this.handleClick(t),this.tt=()=>t.classList.add("focused"),this.nt=()=>t.classList.remove("focused"),this.addEventListener("click",this.st),t.addEventListener("focus",this.tt),t.addEventListener("blur",this.nt),this.K=!0)}render(){const t=this.shadowRoot;let n=t.querySelector(".radio-container");const e=this.buildClassList();if(n)n.className="radio-container "+e,n.tabIndex=this.disabled||!this.ct?-1:0,n.setAttribute("aria-checked",this.checked+""),n.setAttribute("aria-disabled",this.disabled+"");else{n=document.createElement("div"),n.className="radio-container "+e,n.tabIndex=this.disabled||!this.ct?-1:0,n.setAttribute("role","radio"),n.setAttribute("aria-checked",this.checked+""),n.setAttribute("aria-disabled",this.disabled+"");const i=document.createElement("div");i.className="radio-circle",n.appendChild(i),t.appendChild(n)}this.setupEventListeners(),this.applyLabelName(n)}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get checked(){return this.getProperty("checked")}set checked(t){this.setProperty("checked",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}};Mt.properties={value:{type:"string",default:""},checked:{type:"boolean",visual:!0,default:!1},disabled:{type:"boolean",visual:!0,default:!1},size:{type:"string",visual:!0,default:e},flavor:{type:"string",visual:!0,default:"primary"}};let St=Mt;customElements.get("ty-radio")||customElements.define("ty-radio",St);const Tt=class extends u{constructor(){super(),this.K=!1,this.dt=null,this.lt=null,this.ht=null,b(this.shadowRoot,{css:Et,id:"ty-radio-group"})}onConnect(){this.setupEventListeners(),queueMicrotask(()=>this.syncChildren())}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){t.some(t=>"value"===t.name||"size"===t.name||"flavor"===t.name||"disabled"===t.name||"required"===t.name)&&this.syncChildren()}getFormValue(){return this.value||null}focus(t){const n=this.getRadios().filter(t=>!t.disabled),e=n.find(t=>t.checked)??n[0];e?e.focus(t):super.focus(t)}getRadios(){return Array.from(this.querySelectorAll("ty-radio")).filter(t=>"function"==typeof t.setTabStop)}syncChildren(){const t=this.getRadios();for(const i of t)i.checked=i.value===this.value,this.disabled?i.disabled||(i.disabled=!0,i.dataset.tyGroupDisabled=""):"tyGroupDisabled"in i.dataset&&(i.disabled=!1,delete i.dataset.tyGroupDisabled),i.size=this.size,i.flavor=this.flavor;const n=t.filter(t=>!t.disabled),e=n.find(t=>t.checked)??n[0];for(const i of t)i.setTabStop(i===e);this.updateValidity()}updateValidity(){if(!this.required||this.disabled||this.value)this.applyValidity({});else{const t=this.getRadios().find(t=>!t.disabled),n=t?.shadowRoot?.querySelector(".radio-container");this.applyValidity({valueMissing:!0},"Please select an option",n??void 0)}}handleRadioSelect(t){if(this.disabled)return;const n=t.detail,e=n?.value;"string"==typeof e&&e!==this.value&&(this.value=e,this.syncChildren(),setTimeout(()=>{const n={value:e,formValue:e,originalEvent:t};this.dispatchEvent(new CustomEvent("input",{detail:n,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},0))}handleKeydown(t){if(this.disabled)return;const n=this.getRadios().filter(t=>!t.disabled);if(0===n.length)return;const e=document.activeElement,i=n.find(t=>t===e||t.contains(e));let o=-1;if(["ArrowDown","ArrowRight"].includes(t.key))t.preventDefault(),o=i?(n.indexOf(i)+1)%n.length:0;else{if(!["ArrowUp","ArrowLeft"].includes(t.key)){if(["Space"," ","Enter"].includes(t.key)){if(i){t.preventDefault(),this.value=i.value,this.syncChildren();const n={value:i.value,formValue:i.value,originalEvent:t};setTimeout(()=>{this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},0)}return}return}t.preventDefault(),o=i?(n.indexOf(i)-1+n.length)%n.length:n.length-1}const r=n[o];if(r){r.focus(),this.value=r.value,this.syncChildren();const n={value:r.value,formValue:r.value,originalEvent:t};setTimeout(()=>{this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},0)}}removeEventListeners(){this.K&&(this.dt&&(this.removeEventListener("ty-radio-select",this.dt),this.dt=null),this.lt&&(this.removeEventListener("keydown",this.lt),this.lt=null),this.ht&&(this.removeEventListener("ty-radio-connected",this.ht),this.ht=null),this.K=!1)}setupEventListeners(){this.K||(this.dt=t=>this.handleRadioSelect(t),this.lt=t=>this.handleKeydown(t),this.ht=()=>this.syncChildren(),this.addEventListener("ty-radio-select",this.dt),this.addEventListener("keydown",this.lt),this.addEventListener("ty-radio-connected",this.ht),this.K=!0)}render(){const t=this.shadowRoot;let n=t.querySelector(".radio-group-container");if(n){let t=n.querySelector(".radio-group-label");if(this.label)if(t||(t=document.createElement("div"),t.className="radio-group-label",n.insertBefore(t,n.firstChild)),t.textContent=this.label,this.required&&!t.querySelector(".required-icon")){const n=document.createElement("span");n.className="required-icon",n.innerHTML=lt,t.appendChild(n)}else this.required||t.querySelector(".required-icon")?.remove();else t&&t.remove();const e=n.querySelector(".radio-group-list");e&&(e.className="radio-group-list "+this.orientation);let i=n.querySelector(".radio-group-error");this.error?(i||(i=document.createElement("div"),i.className="radio-group-error",n.appendChild(i)),i.textContent=this.error):i&&i.remove(),n.setAttribute("aria-disabled",this.disabled+"")}else{if(n=document.createElement("div"),n.className="radio-group-container",n.setAttribute("role","radiogroup"),n.setAttribute("aria-disabled",this.disabled+""),this.label){const t=document.createElement("div");if(t.className="radio-group-label",t.textContent=this.label,this.required){const n=document.createElement("span");n.className="required-icon",n.innerHTML=lt,t.appendChild(n)}n.appendChild(t)}const e=document.createElement("div");e.className="radio-group-list "+this.orientation;const i=document.createElement("slot");if(e.appendChild(i),n.appendChild(e),this.error){const t=document.createElement("div");t.className="radio-group-error",t.textContent=this.error,n.appendChild(t)}t.appendChild(n),this.setupEventListeners()}this.syncChildren()}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get error(){return this.getProperty("error")}set error(t){this.setProperty("error",t)}get orientation(){return this.getProperty("orientation")}set orientation(t){this.setProperty("orientation",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get form(){return this.$.form}};Tt.formAssociated=!0,Tt.properties={value:{type:"string",visual:!0,formValue:!0,emitChange:!0,default:""},name:{type:"string",default:""},label:{type:"string",visual:!0,default:""},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},error:{type:"string",visual:!0,default:""},orientation:{type:"string",visual:!0,default:"vertical"},size:{type:"string",visual:!0,default:e},flavor:{type:"string",visual:!0,default:"primary"}};let _t=Tt;customElements.get("ty-radio-group")||customElements.define("ty-radio-group",_t);const qt=(t,n)=>{const e=e=>n?`var(--ty-color-${t}${e}, var(--ty-color-${n}${e}))`:`var(--ty-color-${t}${e})`,i=e=>n?`var(--ty-bg-${t}${e}, var(--ty-bg-${n}${e}))`:`var(--ty-bg-${t}${e})`;return`\n:host([flavor="${t}"]) { --copy-color: ${e("")}; --copy-color-hover: ${e("-strong")}; --copy-bg-hover: ${i("-soft")}; }\n:host([flavor="${t}+"]) { --copy-color: ${e("-strong")}; --copy-color-hover: ${e("-strong")}; --copy-bg-hover: ${i("-soft")}; }\n:host([flavor="${t}-"]) { --copy-color: ${e("-soft")}; --copy-color-hover: ${e("")}; --copy-bg-hover: ${i("-soft")}; }\n`},Dt=`\n.copy-field-value {\nflex: 1;\nfont-size: var(--ty-field-font);\nline-height: var(--ty-field-leading);\nletter-spacing: var(--ty-field-tracking);\noverflow: hidden;\ntext-overflow: ellipsis;\nwhite-space: nowrap;\nuser-select: none;\npadding: 0;\nmargin: 0;\nbackground: transparent;\nborder: none;\ncolor: var(--input-color, var(--ty-input-color));\nfont-family: inherit;\n}\ncode.copy-field-value {\nfont-family: var(--ty-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);\nfont-size: calc(var(--ty-field-font) * 0.93);\n}\n.copy-field-value.multiline {\nwhite-space: pre-wrap;\nword-break: break-word;\nmax-height: 200px;\noverflow-y: auto;\n}\n.input-wrapper:has(.copy-field-value.multiline) {\nalign-items: flex-start;\npadding-top: 8px;\npadding-bottom: 8px;\n}\n.copy-field-value.horizontal-scroll {\noverflow-x: auto;\noverflow-y: hidden;\ntext-overflow: clip;\nwhite-space: nowrap;\n}\n.copy-field-value.multiline.horizontal-scroll {\nwhite-space: pre;\nword-break: normal;\noverflow-y: auto;\n}\n.copy-field-value.multiline,\n.copy-field-value.horizontal-scroll {\nscrollbar-width: none; \n}\n.copy-field-value.multiline::-webkit-scrollbar,\n.copy-field-value.horizontal-scroll::-webkit-scrollbar {\ndisplay: none; \n}\n.input-wrapper:not(.disabled):hover {\nbackground: var(--copy-bg-hover, var(--ty-bg-primary-soft));\ntransition: var(--ty-local-transition, background 0.2s ease);\n}\n.copy-button {\nflex-shrink: 0;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nwidth: var(--ty-field-control);\nheight: var(--ty-field-control);\ncursor: pointer;\nborder: none;\nbackground: transparent;\ncolor: var(--copy-color, var(--ty-text-soft));\ntransition: var(--ty-local-transition, color 0.2s ease, transform 0.2s ease);\npadding: 0;\nmargin: 0;\n}\n.copy-button:hover:not(.disabled) {\ncolor: var(--copy-color-hover, var(--ty-text));\ntransform: scale(1.1);\n}\n.copy-button.success {\ncolor: var(--ty-color-success);\nanimation: copy-feedback 0.3s ease;\n}\n.copy-button.error {\ncolor: var(--ty-color-danger);\nanimation: copy-feedback 0.3s ease;\n}\n@keyframes copy-feedback {\n0%, 100% { transform: scale(1); }\n50% { transform: scale(1.2); }\n}\n.copy-button svg {\nwidth: var(--ty-field-icon);\nheight: var(--ty-field-icon);\n}\n.input-wrapper.disabled .copy-button {\ncursor: not-allowed;\nopacity: 0.5;\n}\n.input-wrapper.disabled {\ncursor: not-allowed;\n}\n${n.map(t=>qt(t)).join("")}\n`,At='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>',Lt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>',jt=class extends u{constructor(){super(),this.ut=null,this.bt=!1,this.j=null,b(this.shadowRoot,{css:ot,id:"ty-input"}),b(this.shadowRoot,{css:Dt,id:"ty-copy"})}onConnect(){this.F()}F(){this.j=k(this.shadowRoot,this.j,this.flavor,({base:t})=>(t=>qt(t,"neutral"))(t))}onDisconnect(){null!==this.ut&&(clearTimeout(this.ut),this.ut=null)}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.F()}buildClassList(){const t=[];return this.disabled&&t.push("disabled"),this.required&&t.push("required"),t.join(" ")}async copyToClipboard(){if(this.disabled||!this.value)return;const t=this.value;try{await navigator.clipboard.writeText(t),this.dispatchEvent(new CustomEvent("copy-success",{detail:{value:t},bubbles:!0,composed:!0}))}catch(n){try{const n=document.createElement("textarea");n.value=t,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),this.dispatchEvent(new CustomEvent("copy-success",{detail:{value:t},bubbles:!0,composed:!0}))}catch(e){return this.dispatchEvent(new CustomEvent("copy-error",{detail:{error:e},bubbles:!0,composed:!0})),void this.showCopyError()}}this.showCopySuccess()}showCopySuccess(){null!==this.ut&&clearTimeout(this.ut),this.bt=!0;const t=this.shadowRoot.querySelector(".copy-button");t&&(t.classList.add("success"),t.innerHTML=Lt,t.setAttribute("aria-label","Copied!")),this.ut=window.setTimeout(()=>{this.bt=!1;const t=this.shadowRoot.querySelector(".copy-button");t&&(t.classList.remove("success"),t.innerHTML=At,t.setAttribute("aria-label","Copy to clipboard")),this.ut=null},2e3)}showCopyError(){null!==this.ut&&clearTimeout(this.ut),this.bt=!1;const t=this.shadowRoot.querySelector(".copy-button");t&&(t.classList.add("error"),t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',t.setAttribute("aria-label","Copy failed")),this.ut=window.setTimeout(()=>{const t=this.shadowRoot.querySelector(".copy-button");t&&(t.classList.remove("error"),t.innerHTML=At,t.setAttribute("aria-label","Copy to clipboard")),this.ut=null},2e3)}setupEventListeners(){const t=this.shadowRoot,n=t.querySelector(".input-wrapper"),e=t.querySelector(".copy-button");if(n&&!this.disabled){const t=n;t.addEventListener("click",t=>{t.target===e||t.target.closest(".copy-button")||this.copyToClipboard()}),t.style.cursor="pointer"}e&&e.addEventListener("click",()=>{this.copyToClipboard()})}render(){const t=this.shadowRoot,n=this.buildClassList(),e=["copy-field-value",this.multiline?"multiline":"",this.horizontalScroll?"horizontal-scroll":""].filter(Boolean).join(" "),i=(this.value||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");t.innerHTML=`\n<div class="input-container">\n${this.label?`\n<label class="ty-field-label">\n${this.label}\n${this.required?`<span class="required-icon">${lt}</span>`:""}\n</label>\n`:""}\n<div class="input-wrapper ${n}">\n${"code"===this.format?`<code class="${e}">${i}</code>`:`<div class="${e}">${i}</div>`}\n<button class="copy-button${this.bt?" success":""}" type="button" aria-label="${this.bt?"Copied!":"Copy to clipboard"}" ${this.disabled?"disabled":""}>\n${this.bt?Lt:At}\n</button>\n</div>\n</div>\n`,this.setupEventListeners()}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get format(){return this.getProperty("format")}set format(t){this.setProperty("format",t)}get multiline(){return this.getProperty("multiline")}set multiline(t){this.setProperty("multiline",t)}get horizontalScroll(){return this.getProperty("horizontalScroll")}set horizontalScroll(t){this.setProperty("horizontalScroll",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}};jt.formAssociated=!0,jt.properties={value:{type:"string",visual:!0,formValue:!0,default:""},label:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},flavor:{type:"string",visual:!0,default:"neutral"},format:{type:"string",visual:!0,default:"text",coerce:t=>"code"===t?"code":"text"},multiline:{type:"boolean",visual:!0,default:!1},horizontalScroll:{type:"boolean",visual:!0,default:!1},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1}};let Ft=jt;function Vt(t){return 1024>t?t+" B":1048576>t?(t/1024).toFixed(1)+" KB":1073741824>t?(t/1024/1024).toFixed(1)+" MB":(t/1024/1024/1024).toFixed(1)+" GB"}customElements.get("ty-copy")||customElements.define("ty-copy",Ft),customElements.get("ty-copy-field")||customElements.define("ty-copy-field",class extends Ft{});const It=class extends u{constructor(){super(),this.vt=[],this.gt=!1,this.K=!1,this.yt=null,this.ft=null,this.wt=null,this.xt=null,this.kt=null,this.zt=null,this.$t=null,this.Ct=null,b(this.shadowRoot,{css:"\n:host {\ndisplay: block;\nfont-family: inherit;\nwidth: 100%;\n}\n.file-upload-container {\ndisplay: flex;\nflex-direction: column;\nwidth: 100%;\nbox-sizing: border-box;\n}\n.upload-label {\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-medium);\ncolor: var(--ty-label-color);\nmargin-bottom: 6px;\npadding-left: 4px;\ndisplay: flex;\nalign-items: center;\n}\n.required-icon {\ncolor: var(--ty-color-danger);\nmargin-left: 4px;\nfont-size: 0.75rem;\nline-height: 1;\n}\n.drop-zone {\nborder: 2px dashed var(--ty-border);\nborder-radius: var(--ty-radius-base);\npadding: 2rem 1.5rem;\ntext-align: center;\ncursor: pointer;\ntransition: var(--ty-local-transition, border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease);\noutline: none;\ndisplay: flex;\nflex-direction: column;\nalign-items: center;\njustify-content: center;\ngap: 0.5rem;\nmin-height: 140px;\nuser-select: none;\n}\n.drop-zone:hover:not(.disabled) {\nborder-color: var(--ty-input-border-hover);\nbackground: var(--ty-surface-content);\n}\n.drop-zone.focused {\nborder-color: var(--ty-input-border-focus);\nbox-shadow: 0 0 0 3px var(--ty-input-shadow-focus);\n}\n.drop-zone.drag-active {\nborder-color: var(--ty-color-primary);\nborder-style: solid;\nbackground: var(--ty-bg-primary-soft);\n}\n.drop-zone.drag-active .upload-icon {\ncolor: var(--ty-color-primary);\ntransform: translateY(-2px);\n}\n.drop-zone.has-files {\nmin-height: 80px;\npadding: 1.25rem 1.5rem;\n}\n.drop-zone.disabled {\nopacity: 0.5;\ncursor: not-allowed;\npointer-events: none;\n}\n.drop-zone.error {\nborder-color: var(--ty-color-danger);\n}\n.drop-zone.error:not(.disabled) {\nbackground: var(--ty-bg-danger-soft);\n}\n.upload-icon {\ncolor: var(--ty-text-faint);\nwidth: 2.5rem;\nheight: 2.5rem;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\ntransition: var(--ty-local-transition, color 0.15s ease, transform 0.15s ease);\npointer-events: none;\n}\n.upload-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n.upload-hint {\ncolor: var(--ty-text-soft);\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\npointer-events: none;\n}\n.browse-link {\ncolor: var(--ty-color-primary);\nfont-weight: var(--ty-font-medium);\n}\n.upload-sub-hint {\ncolor: var(--ty-text-faint);\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\npointer-events: none;\n}\n.file-list {\ndisplay: flex;\nflex-direction: column;\ngap: 0.375rem;\nmargin-top: 0.5rem;\n}\n.file-item {\ndisplay: flex;\nalign-items: center;\ngap: 0.5rem;\npadding: 0.5rem 0.75rem;\nborder-radius: var(--ty-radius-base);\nbackground: var(--ty-surface-content);\nborder: 1px solid var(--ty-border-soft);\n}\n.file-icon {\ncolor: var(--ty-text-faint);\nflex-shrink: 0;\nwidth: 1rem;\nheight: 1rem;\ndisplay: flex;\nalign-items: center;\n}\n.file-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n.file-name {\nflex: 1;\nfont-size: var(--ty-font-sm);\ncolor: var(--ty-text);\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\nmin-width: 0;\n}\n.file-size {\nfont-size: var(--ty-font-xs);\ncolor: var(--ty-text-faint);\nflex-shrink: 0;\nfont-variant-numeric: tabular-nums;\n}\n.file-remove {\nflex-shrink: 0;\ncursor: pointer;\ncolor: var(--ty-text-faint);\nwidth: 1.25rem;\nheight: 1.25rem;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nborder-radius: 50%;\ntransition: var(--ty-local-transition, color 0.15s ease, background-color 0.15s ease);\nborder: none;\nbackground: none;\npadding: 0;\noutline: none;\n}\n.file-remove:hover {\ncolor: var(--ty-color-danger);\nbackground: var(--ty-bg-danger-soft);\n}\n.file-remove:focus-visible {\nbox-shadow: 0 0 0 2px var(--ty-color-danger);\n}\n.file-remove svg {\nwidth: 12px;\nheight: 12px;\n}\n.error-message {\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\ncolor: var(--ty-color-danger);\nmargin-top: 4px;\npadding-left: 4px;\n}\n@media (prefers-reduced-motion: reduce) {\n.drop-zone,\n.upload-icon,\n.file-remove {\ntransition: none;\n}\n}\n@media (prefers-contrast: high) {\n.drop-zone {\nborder-width: 3px;\n}\n}\n",id:"ty-file-upload"})}onConnect(){this.updateFormValue()}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){}onFormReset(){this.vt=[],this.updateFormValue(),this.p&&this.render();const t=this.shadowRoot?.querySelector(".file-input");t&&(t.value="")}updateFormValue(){super.updateFormValue(),this.updateValidity()}updateValidity(){if(this.required&&!this.disabled&&0===this.vt.length){const t=this.shadowRoot?.querySelector(".drop-zone");this.applyValidity({valueMissing:!0},"Please select a file",t??void 0)}else this.applyValidity({})}getFormValue(){if(!this.name)return null;const t=new FormData;0===this.vt.length&&t.append(this.name,new File([],"",{type:"application/octet-stream"}));for(const n of this.vt)t.append(this.name,n);return t}focus(t){const n=this.shadowRoot?.querySelector(".drop-zone");n?n.focus(t):super.focus(t)}matchesAccept(t){const n=this.accept?.trim();return!n||n.split(",").some(n=>{const e=n.trim().toLowerCase();if(!e)return!1;if(e.startsWith("."))return t.name.toLowerCase().endsWith(e);const i=t.type.toLowerCase();return e.endsWith("/*")?i.startsWith(e.slice(0,-1)):i===e})}get files(){return[...this.vt]}get multiple(){return this.getProperty("multiple")}set multiple(t){this.setProperty("multiple",t)}get accept(){return this.getProperty("accept")}set accept(t){this.setProperty("accept",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get placeholder(){return this.getProperty("placeholder")}set placeholder(t){this.setProperty("placeholder",t)}get error(){return this.getProperty("error")}set error(t){this.setProperty("error",t)}get form(){return this.$.form}setFiles(t){this.vt=this.multiple?t:t.slice(0,1),this.updateFormValue(),this.render();const n={value:this.vt,files:this.vt,names:this.vt.map(t=>t.name)};setTimeout(()=>{this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0})),this.revealValidity()},0)}removeFile(t){const n=[...this.vt];n.splice(t,1),this.setFiles(n);const e=this.shadowRoot?.querySelector(".file-input");e&&(e.value="")}setupEventListeners(){if(this.K)return;const t=this.shadowRoot,n=t.querySelector(".drop-zone"),e=t.querySelector(".file-input");this.yt=t=>{this.disabled||t.target.closest(".file-remove")||e.click()},this.ft=t=>{this.disabled||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())},this.wt=()=>{n.classList.add("focused")},this.xt=()=>{n.classList.remove("focused")},this.kt=t=>{this.disabled||(t.preventDefault(),t.stopPropagation(),this.gt||(this.gt=!0,n.classList.add("drag-active")))},this.zt=t=>{n.contains(t.relatedTarget)||(this.gt=!1,n.classList.remove("drag-active"))},this.$t=t=>{if(this.disabled)return;t.preventDefault(),t.stopPropagation(),this.gt=!1,n.classList.remove("drag-active");const e=Array.from(t.dataTransfer?.files??[]).filter(t=>this.matchesAccept(t));e.length>0&&this.setFiles(e)},this.Ct=t=>{const n=t.target;n.files&&n.files.length>0&&this.setFiles(Array.from(n.files))},n.addEventListener("click",this.yt),n.addEventListener("keydown",this.ft),n.addEventListener("focus",this.wt),n.addEventListener("blur",this.xt),n.addEventListener("dragover",this.kt),n.addEventListener("dragleave",this.zt),n.addEventListener("drop",this.$t),e.addEventListener("change",this.Ct),this.K=!0}removeEventListeners(){if(!this.K)return;const t=this.shadowRoot;if(!t)return;const n=t.querySelector(".drop-zone"),e=t.querySelector(".file-input");n&&e&&(this.yt&&n.removeEventListener("click",this.yt),this.ft&&n.removeEventListener("keydown",this.ft),this.wt&&n.removeEventListener("focus",this.wt),this.xt&&n.removeEventListener("blur",this.xt),this.kt&&n.removeEventListener("dragover",this.kt),this.zt&&n.removeEventListener("dragleave",this.zt),this.$t&&n.removeEventListener("drop",this.$t),this.Ct&&e.removeEventListener("change",this.Ct),this.K=!1)}buildDropZoneClasses(){const t=["drop-zone"];return this.gt&&t.push("drag-active"),this.vt.length>0&&t.push("has-files"),this.disabled&&t.push("disabled"),this.error&&t.push("error"),t.join(" ")}renderFileList(t){t.innerHTML="";for(let n=0;this.vt.length>n;n++){const e=this.vt[n],i=document.createElement("div");i.className="file-item";const o=document.createElement("span");o.className="file-icon",o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>';const r=document.createElement("span");r.className="file-name",r.textContent=e.name,r.title=e.name;const s=document.createElement("span");s.className="file-size",s.textContent=Vt(e.size);const a=document.createElement("button");a.className="file-remove",a.type="button",a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',a.setAttribute("aria-label","Remove "+e.name);const l=n;a.addEventListener("click",t=>{t.stopPropagation(),this.removeFile(l)}),i.appendChild(o),i.appendChild(r),i.appendChild(s),i.appendChild(a),t.appendChild(i)}}render(){const t=this.shadowRoot;let n=t.querySelector(".file-upload-container");if(!n){n=document.createElement("div"),n.className="file-upload-container";const e=document.createElement("div");e.className="upload-label",n.appendChild(e);const i=document.createElement("div");i.className="drop-zone",i.setAttribute("role","button");const o=document.createElement("input");o.type="file",o.className="file-input",o.style.display="none",i.appendChild(o);const r=document.createElement("div");r.className="upload-icon",r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>',i.appendChild(r);const s=document.createElement("div");s.className="upload-hint",i.appendChild(s);const a=document.createElement("div");a.className="upload-sub-hint",i.appendChild(a),n.appendChild(i);const l=document.createElement("div");l.className="file-list",n.appendChild(l);const c=document.createElement("div");c.className="error-message",n.appendChild(c),t.appendChild(n),this.setupEventListeners()}const e=n.querySelector(".upload-label");if(this.label){if(e.style.display="",e.innerHTML="",e.appendChild(document.createTextNode(this.label)),this.required){const t=document.createElement("span");t.className="required-icon",t.textContent="*",t.setAttribute("aria-hidden","true"),e.appendChild(t)}}else e.style.display="none";const i=n.querySelector(".drop-zone");i.className=this.buildDropZoneClasses(),i.tabIndex=this.disabled?-1:0,i.setAttribute("aria-disabled",this.disabled+""),i.setAttribute("aria-label",this.placeholder||"Upload files");const o=n.querySelector(".file-input");o.multiple=this.multiple,o.accept=this.accept,o.disabled=this.disabled,n.querySelector(".upload-icon").style.display=this.vt.length>0?"none":"",n.querySelector(".upload-hint").innerHTML=this.vt.length>0?`<strong>${this.vt.length} file${1!==this.vt.length?"s":""} selected</strong>`:'Drop files here or <span class="browse-link">click to browse</span>';const r=n.querySelector(".upload-sub-hint");this.accept&&0===this.vt.length?(r.textContent="Accepted: "+this.accept,r.style.display=""):r.style.display="none";const s=n.querySelector(".file-list");this.renderFileList(s);const a=n.querySelector(".error-message");a.textContent=this.error,a.style.display=this.error?"":"none",this.updateValidity()}};It.formAssociated=!0,It.properties={multiple:{type:"boolean",visual:!0,default:!1},accept:{type:"string",visual:!0,default:""},name:{type:"string",default:""},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},label:{type:"string",visual:!0,default:""},placeholder:{type:"string",visual:!0,default:"Drop files here or click to browse"},error:{type:"string",visual:!0,default:""}};let Ot=It;customElements.get("ty-file-upload")||customElements.define("ty-file-upload",Ot);const Ht=`\n${et}\n:host {\ndisplay: block;\nfont-family: inherit;\nwidth: 100%;\n}\n.textarea-container {\ndisplay: flex;\nflex-direction: column;\nwidth: 100%;\nbox-sizing: border-box;\nposition: relative;\n}\n.textarea-wrapper {\nposition: relative;\nwidth: 100%;\ndisplay: flex;\nflex-direction: column;\nbox-sizing: border-box;\nborder: 1px solid var(--input-border, var(--ty-input-border));\nborder-radius: var(--ty-radius-base);\nbackground: var(--input-bg, var(--ty-input-bg));\ntransition: var(--ty-local-transition, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out);\n}\n.textarea-wrapper:has(textarea:focus) {\nborder-color: var(--input-border-focus, var(--ty-input-border-focus));\nbox-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\n.textarea-wrapper:has(textarea.error) {\nborder-color: var(--ty-color-danger);\nbackground: var(--ty-bg-danger-soft);\n}\n.textarea-wrapper:has(textarea.error):has(textarea:focus) {\nborder-color: var(--ty-color-danger-bold);\n}\n.textarea-wrapper:has(textarea:disabled) {\nopacity: 0.5;\nbackground: var(--input-disabled-bg, var(--ty-input-disabled-bg));\nborder-color: var(--input-disabled-border, var(--ty-input-disabled-border));\n}\n.textarea-scroll {\nposition: relative;\nflex: 1 1 auto;\nmin-height: 0;\ndisplay: flex;\n}\n.textarea-scroll .ty-scrollbar-track-y {\ntop: 2px;\nright: 2px;\nbottom: 2px;\nborder-radius: 0 4px 4px 0;\n}\n.textarea-header,\n.textarea-footer {\ndisplay: flex;\nalign-items: center;\ngap: 0.5rem;\n}\n.textarea-footer { justify-content: space-between; }\n.textarea-header.has-content {\npadding: 6px 10px;\nborder-bottom: 1px solid var(--ty-textarea-divider, var(--input-border, var(--ty-input-border)));\n}\n.textarea-footer.has-content {\npadding: 6px 10px;\nborder-top: 1px solid var(--ty-textarea-divider, var(--input-border, var(--ty-input-border)));\n}\n.ty-field-label {\nfont-size: var(--ty-field-label-font);\nline-height: var(--ty-field-label-leading);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-medium);\ncolor: var(--ty-label-color);\nmargin-bottom: var(--ty-field-label-gap);\npadding-left: var(--ty-field-outer-pad-x);\n}\n.required-icon {\ndisplay: inline-flex;\nalign-items: center;\ncolor: var(--ty-color-danger);\nwidth: 12px;\nheight: 12px;\nvertical-align: middle;\n}\n.error-message {\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\nletter-spacing: var(--ty-tracking-xs);\ncolor: var(--ty-color-danger);\nmargin-top: 4px;\npadding-left: var(--ty-field-outer-pad-x);\n}\ntextarea {\nfont-family: inherit;\nbox-sizing: border-box;\nwidth: 100%;\nflex: 1 1 auto;\nborder: none;\nbackground: transparent;\ncolor: var(--input-color, var(--ty-input-color));\nfont-family: inherit;\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-normal);\noutline: none;\nmin-height: 80px;\npadding: 12px 12px;\noverflow: hidden;\nresize: none;\nwhite-space: pre-wrap;\nword-wrap: break-word;\n}\n:host([data-custom-scroll]) textarea::-webkit-scrollbar {\ndisplay: none;\n}\ntextarea:disabled {\ncursor: not-allowed;\ncolor: var(--input-disabled-color, var(--ty-input-disabled-color));\n}\ntextarea::placeholder {\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\nfont-weight: 400;\n}\ntextarea.resize-both {\nresize: both;\n}\ntextarea.resize-horizontal {\nresize: horizontal;\n}\ntextarea.resize-vertical {\nresize: vertical;\n}\ntextarea.resize-none {\nresize: none;\n}\ntextarea:not(.resize-both):not(.resize-horizontal):not(.resize-vertical) {\nresize: none;\n}\n.textarea-dummy {\nposition: absolute !important;\ntop: 0 !important;\nleft: 0 !important;\nvisibility: hidden !important;\nwhite-space: pre-wrap !important;\nword-break: break-word !important;\nbox-sizing: border-box !important;\noverflow: hidden !important;\npointer-events: none !important;\nz-index: -1 !important;\nword-wrap: break-word !important;\noverflow-wrap: break-word !important;\n}\ntextarea.xs {\nmin-height: 64px;\npadding: 8px var(--ty-field-pad-x);\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\nletter-spacing: var(--ty-tracking-xs);\n}\ntextarea.sm {\nmin-height: 72px;\npadding: 10px var(--ty-field-pad-x);\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\n}\ntextarea.md {\nmin-height: 80px;\npadding: 12px var(--ty-field-pad-x);\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\n}\ntextarea.lg {\nmin-height: 96px;\npadding: 14px var(--ty-field-pad-x);\nfont-size: var(--ty-font-base);\nline-height: var(--ty-leading-base);\nletter-spacing: var(--ty-tracking-base);\n}\ntextarea.xl {\nmin-height: 112px;\npadding: 16px var(--ty-field-pad-x);\nfont-size: var(--ty-font-lg);\nline-height: var(--ty-leading-lg);\nletter-spacing: var(--ty-tracking-lg);\n}\ntextarea:focus-visible {\noutline: none;\n}\n@media (prefers-contrast: high) {\ntextarea {\nborder-width: 2px;\n}\n}\n@media (prefers-reduced-motion: reduce) {\ntextarea {\ntransition: none;\n}\n.textarea-dummy {\ntransition: none;\n}\n}\n@container (max-width: 480px) {\ntextarea.lg {\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\npadding: 12px var(--ty-field-pad-x);\nmin-height: 80px;\n}\ntextarea.xl {\nfont-size: var(--ty-font-base);\nline-height: var(--ty-leading-base);\nletter-spacing: var(--ty-tracking-base);\npadding: 14px var(--ty-field-pad-x);\nmin-height: 96px;\n}\n}\n@container (max-width: 320px) {\ntextarea.xl {\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\npadding: 12px var(--ty-field-pad-x);\nmin-height: 80px;\n}\n}\n@media (max-width: 640px) {\ntextarea.lg {\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\npadding: 12px var(--ty-field-pad-x);\nmin-height: 80px;\n}\ntextarea.xl {\nfont-size: var(--ty-font-base);\nline-height: var(--ty-leading-base);\nletter-spacing: var(--ty-tracking-base);\npadding: 14px var(--ty-field-pad-x);\nmin-height: 96px;\n}\n}\n@media (max-width: 480px) {\ntextarea.xl {\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\npadding: 12px var(--ty-field-pad-x);\nmin-height: 80px;\n}\n}\ntextarea {\ntransition: var(--ty-local-transition,\nborder-color 0.15s ease-in-out,\nbox-shadow 0.15s ease-in-out,\nbackground-color 0.15s ease-in-out,\nheight 0.1s ease-out);\n}\ntextarea:focus {\ntransition: var(--ty-local-transition,\nborder-color 0.15s ease-in-out,\nbox-shadow 0.15s ease-in-out,\nbackground-color 0.15s ease-in-out);\n}\n@media (prefers-reduced-motion: reduce) {\ntextarea {\ntransition: none;\n}\n}\n`;function Nt(){return"native"!==document.documentElement.getAttribute("data-ty-scrollbar")}class Bt{constructor(t,n={}){this.trackY=null,this.thumbY=null,this.trackX=null,this.thumbX=null,this.gt=!1,this.Et="y",this.Mt=0,this.St=0,this.Tt=null,this._t=null,this.qt=null,this.Dt=t,this.At=!1!==n.vertical,this.Lt=n.horizontal??!1,this.jt=n.autoHideDelay??1e3,this.Ft=this.Vt.bind(this),this.It=this.Ot.bind(this),this.Ht=this.Nt.bind(this),this.Bt=this.Pt.bind(this),this.Wt=this.Rt.bind(this),this.Yt=this.Ut.bind(this),this.Xt=this.Kt.bind(this),this.At&&(this.trackY=this.Zt("y"),this.thumbY=this.Jt("y"),this.trackY.appendChild(this.thumbY)),this.Lt&&(this.trackX=this.Zt("x"),this.thumbX=this.Jt("x"),this.trackX.appendChild(this.thumbX)),this.Dt.addEventListener("scroll",this.Ft,{passive:!0}),this.thumbY&&this.thumbY.addEventListener("pointerdown",this.It),this.trackY&&this.trackY.addEventListener("pointerdown",this.Bt),this.thumbX&&this.thumbX.addEventListener("pointerdown",this.Ht),this.trackX&&this.trackX.addEventListener("pointerdown",this.Wt),this.qt=new ResizeObserver(()=>this.update()),this.qt.observe(this.Dt),this.update()}Zt(t){const n=document.createElement("div");return n.className="ty-scrollbar-track-"+t,n}Jt(t){const n=document.createElement("div");return n.className="ty-scrollbar-thumb-"+t,n}update(){this.Gt(),this.Qt()}scrollToTop(t=!1){this.Dt.scrollTo({top:0,behavior:t?"smooth":"auto"})}scrollToBottom(t=!1){this.Dt.scrollTo({top:this.Dt.scrollHeight,behavior:t?"smooth":"auto"})}scrollToLeft(t=!1){this.Dt.scrollTo({left:0,behavior:t?"smooth":"auto"})}scrollToRight(t=!1){this.Dt.scrollTo({left:this.Dt.scrollWidth,behavior:t?"smooth":"auto"})}destroy(){this.Dt.removeEventListener("scroll",this.Ft),this.thumbY&&this.thumbY.removeEventListener("pointerdown",this.It),this.trackY&&this.trackY.removeEventListener("pointerdown",this.Bt),this.thumbX&&this.thumbX.removeEventListener("pointerdown",this.Ht),this.trackX&&this.trackX.removeEventListener("pointerdown",this.Wt),this.qt&&(this.qt.disconnect(),this.qt=null),null!==this.Tt&&(cancelAnimationFrame(this.Tt),this.Tt=null),null!==this._t&&(clearTimeout(this._t),this._t=null)}Vt(){null===this.Tt&&(this.Tt=requestAnimationFrame(()=>{this.Tt=null,this.tn(),this.nn()}))}Gt(){if(!this.trackY||!this.thumbY)return;const{scrollHeight:t,clientHeight:n}=this.Dt,e=t>n+2;this.trackY.classList.toggle("has-overflow",e),e&&(this.thumbY.style.height=Math.max(n/t*100,0)+"%"),this.en()}Qt(){if(!this.trackX||!this.thumbX)return;const{scrollWidth:t,clientWidth:n}=this.Dt,e=t>n+2;this.trackX.classList.toggle("has-overflow",e),e&&(this.thumbX.style.width=Math.max(n/t*100,0)+"%"),this.rn()}tn(){this.en(),this.rn()}en(){if(!this.trackY||!this.thumbY)return;const{scrollTop:t,scrollHeight:n,clientHeight:e}=this.Dt,i=n-e;i>0&&(this.thumbY.style.top=t/i*(this.trackY.clientHeight-this.thumbY.offsetHeight)+"px")}rn(){if(!this.trackX||!this.thumbX)return;const{scrollLeft:t,scrollWidth:n,clientWidth:e}=this.Dt,i=n-e;i>0&&(this.thumbX.style.left=t/i*(this.trackX.clientWidth-this.thumbX.offsetWidth)+"px")}nn(){this.gt||(this.trackY?.classList.add("scrolling"),this.trackX?.classList.add("scrolling"),null!==this._t&&clearTimeout(this._t),this._t=setTimeout(()=>{this.trackY?.classList.remove("scrolling"),this.trackX?.classList.remove("scrolling"),this._t=null},this.jt))}Ot(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this.gt=!0,this.Et="y",this.Mt=t.clientY,this.St=this.Dt.scrollTop,this.thumbY.setPointerCapture(t.pointerId),this.trackY?.classList.add("dragging"),this.thumbY.addEventListener("pointermove",this.Yt),this.thumbY.addEventListener("pointerup",this.Xt),this.thumbY.addEventListener("pointercancel",this.Xt))}Nt(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this.gt=!0,this.Et="x",this.Mt=t.clientX,this.St=this.Dt.scrollLeft,this.thumbX.setPointerCapture(t.pointerId),this.trackX?.classList.add("dragging"),this.thumbX.addEventListener("pointermove",this.Yt),this.thumbX.addEventListener("pointerup",this.Xt),this.thumbX.addEventListener("pointercancel",this.Xt))}Ut(t){if(this.gt)if("y"===this.Et){const n=t.clientY-this.Mt,{scrollHeight:e,clientHeight:i}=this.Dt,o=this.trackY.clientHeight-this.thumbY.offsetHeight;if(0>=o)return;this.Dt.scrollTop=this.St+n*((e-i)/o)}else{const n=t.clientX-this.Mt,{scrollWidth:e,clientWidth:i}=this.Dt,o=this.trackX.clientWidth-this.thumbX.offsetWidth;if(0>=o)return;this.Dt.scrollLeft=this.St+n*((e-i)/o)}}Kt(t){const n="y"===this.Et?this.thumbY:this.thumbX,e="y"===this.Et?this.trackY:this.trackX;this.gt=!1,n.releasePointerCapture(t.pointerId),e?.classList.remove("dragging"),n.removeEventListener("pointermove",this.Yt),n.removeEventListener("pointerup",this.Xt),n.removeEventListener("pointercancel",this.Xt),this.nn()}Pt(t){if(t.target===this.thumbY||0!==t.button)return;t.preventDefault();const n=this.trackY.getBoundingClientRect(),e=(t.clientY-n.top)/n.height,{scrollHeight:i,clientHeight:o}=this.Dt;this.Dt.scrollTo({top:e*(i-o),behavior:"smooth"})}Rt(t){if(t.target===this.thumbX||0!==t.button)return;t.preventDefault();const n=this.trackX.getBoundingClientRect(),e=(t.clientX-n.left)/n.width,{scrollWidth:i,clientWidth:o}=this.Dt;this.Dt.scrollTo({left:e*(i-o),behavior:"smooth"})}}const Pt="\n.ty-scrollbar-track-y {\nposition: absolute;\ntop: 0;\nright: 0;\nbottom: 0;\nwidth: var(--ty-scrollbar-width, 8px);\nz-index: 3;\nopacity: 0;\npointer-events: none;\ntransition: opacity 0.25s ease-out;\ncursor: pointer;\n}\n.ty-scrollbar-track-y.has-overflow {\npointer-events: auto;\n}\n.ty-scrollbar-track-y.has-overflow:hover,\n.ty-scrollbar-track-y.has-overflow.scrolling,\n.ty-scrollbar-track-y.dragging {\nopacity: 1;\n}\n.ty-scrollbar-track-y::before {\ncontent: '';\nposition: absolute;\ninset: 0;\nbackground: var(--ty-scrollbar-track, transparent);\nborder-radius: var(--ty-scrollbar-radius, 4px);\nopacity: 0;\ntransition: opacity 0.15s ease-out;\n}\n.ty-scrollbar-track-y:hover::before,\n.ty-scrollbar-track-y.dragging::before {\nopacity: 1;\nbackground: var(--ty-scrollbar-track-hover, color-mix(in oklab, var(--ty-color-neutral-bold) 8%, transparent));\n}\n.ty-scrollbar-thumb-y {\nposition: absolute;\nright: 0;\nwidth: 100%;\nmin-height: var(--ty-scrollbar-thumb-min-height, 30px);\nbackground: var(--ty-scrollbar-thumb, color-mix(in oklab, var(--ty-color-neutral-bold) 40%, transparent));\nborder-radius: var(--ty-scrollbar-radius, 4px);\ntransition: var(--ty-local-transition, background 0.15s ease-out);\nbox-sizing: border-box;\nborder: 1px solid transparent;\n}\n.ty-scrollbar-thumb-y:hover,\n.ty-scrollbar-track-y.dragging .ty-scrollbar-thumb-y {\nbackground: var(--ty-scrollbar-thumb-hover, color-mix(in oklab, var(--ty-color-neutral-bold) 55%, transparent));\n}\n.ty-scrollbar-thumb-y:active,\n.ty-scrollbar-track-y.dragging .ty-scrollbar-thumb-y {\nbackground: var(--ty-scrollbar-thumb-active, color-mix(in oklab, var(--ty-color-neutral-bold) 70%, transparent));\n}\n.ty-scrollbar-track-x {\nposition: absolute;\nbottom: 0;\nleft: 0;\nright: 0;\nheight: var(--ty-scrollbar-width, 8px);\nz-index: 3;\nopacity: 0;\npointer-events: none;\ntransition: opacity 0.25s ease-out;\ncursor: pointer;\n}\n.ty-scrollbar-track-x.has-overflow {\npointer-events: auto;\n}\n.ty-scrollbar-track-x.has-overflow:hover,\n.ty-scrollbar-track-x.has-overflow.scrolling,\n.ty-scrollbar-track-x.dragging {\nopacity: 1;\n}\n.ty-scrollbar-track-x::before {\ncontent: '';\nposition: absolute;\ninset: 0;\nbackground: var(--ty-scrollbar-track, transparent);\nborder-radius: var(--ty-scrollbar-radius, 4px);\nopacity: 0;\ntransition: opacity 0.15s ease-out;\n}\n.ty-scrollbar-track-x:hover::before,\n.ty-scrollbar-track-x.dragging::before {\nopacity: 1;\nbackground: var(--ty-scrollbar-track-hover, color-mix(in oklab, var(--ty-color-neutral-bold) 8%, transparent));\n}\n.ty-scrollbar-thumb-x {\nposition: absolute;\nbottom: 0;\nheight: 100%;\nmin-width: var(--ty-scrollbar-thumb-min-height, 30px);\nbackground: var(--ty-scrollbar-thumb, color-mix(in oklab, var(--ty-color-neutral-bold) 40%, transparent));\nborder-radius: var(--ty-scrollbar-radius, 4px);\ntransition: var(--ty-local-transition, background 0.15s ease-out);\nbox-sizing: border-box;\nborder: 1px solid transparent;\n}\n.ty-scrollbar-thumb-x:hover,\n.ty-scrollbar-track-x.dragging .ty-scrollbar-thumb-x {\nbackground: var(--ty-scrollbar-thumb-hover, color-mix(in oklab, var(--ty-color-neutral-bold) 55%, transparent));\n}\n.ty-scrollbar-thumb-x:active,\n.ty-scrollbar-track-x.dragging .ty-scrollbar-thumb-x {\nbackground: var(--ty-scrollbar-thumb-active, color-mix(in oklab, var(--ty-color-neutral-bold) 70%, transparent));\n}\n@media (pointer: coarse) and (hover: none) {\n.ty-scrollbar-track-y,\n.ty-scrollbar-track-x {\ndisplay: none !important;\n}\n}\n@media (prefers-reduced-motion: reduce) {\n.ty-scrollbar-track-y,\n.ty-scrollbar-track-x,\n.ty-scrollbar-thumb-y,\n.ty-scrollbar-thumb-x {\ntransition-duration: 0ms !important;\n}\n}\n",Wt='<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>',Rt=class extends u{constructor(){super(),this.sn=null,this.an=null,this.ln=null,this.U=!1,this.handleInputEvent=t=>{this.X=!0,this.value=t.target.value,this.sn&&this.an&&this.resizeTextarea(this.sn,this.an),this.$.setFormValue(this.value||""),this.updateValidity(),this.emitValueEvent("input",t)},this.X=!1,this.cn=null,this.handleFocusEvent=()=>{this.U=!0,this.cn=this.value},this.handleBlurEvent=t=>{this.U=!1,this.X&&this.revealValidity(),null!==this.cn&&this.value!==this.cn&&this.emitValueEvent("change",t),this.cn=null};const t=this.shadowRoot;b(t,{css:Ht,id:"ty-textarea"}),Nt()&&b(t,{css:Pt,id:"ty-custom-scrollbar"})}onConnect(){}onDisconnect(){if(this.dn(),this.sn){const t=this.sn.cloneNode(!0);this.sn.parentNode?.replaceChild(t,this.sn),this.sn=null}this.an=null}onPropertiesChanged(t){}getFormValue(){return this.getProperty("value")||null}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get placeholder(){return this.getProperty("placeholder")}set placeholder(t){this.setProperty("placeholder",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}focus(t){this.shadowRoot?.querySelector("textarea")?.focus(t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get error(){return this.getProperty("error")}set error(t){this.setProperty("error",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get rows(){return this.getProperty("rows")}set rows(t){this.setProperty("rows",t)}get cols(){return this.getProperty("cols")}set cols(t){this.setProperty("cols",t)}get resize(){return this.getProperty("resize")}set resize(t){this.setProperty("resize",t)}get minHeight(){return this.getProperty("minHeight")}set minHeight(t){this.setProperty("minHeight",t)}get maxHeight(){return this.getProperty("maxHeight")}set maxHeight(t){this.setProperty("maxHeight",t)}getFontStyle(t){const n=window.getComputedStyle(t);return{fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,fontStyle:n.fontStyle}}getSpacingStyle(t){const n=window.getComputedStyle(t);return{padding:n.padding,paddingTop:n.paddingTop,paddingRight:n.paddingRight,paddingBottom:n.paddingBottom,paddingLeft:n.paddingLeft,margin:n.margin,borderWidth:n.borderWidth}}setupDummyElement(t){const n=this.shadowRoot,e=n.querySelector(".textarea-dummy");e&&e.remove();const i=document.createElement("pre"),o=this.getFontStyle(t),r=this.getSpacingStyle(t);i.className="textarea-dummy";const s=i.style;return s.position="absolute",s.top="0",s.left="0",s.visibility="hidden",s.whiteSpace="pre-wrap",s.wordBreak="break-word",s.boxSizing="border-box",s.overflow="hidden",s.pointerEvents="none",Object.entries(o).forEach(([t,n])=>{s[t]=n}),Object.entries(r).forEach(([t,n])=>{s[t]=n}),n.appendChild(i),this.an=i,i}resizeTextarea(t,n){if(!t||!n)return;const e=this.value,i=this.placeholder,o=t.clientHeight;n.textContent=""===e&&i?i:e+" ",n.style.width=t.clientWidth+"px";const r=n.scrollHeight,s=this.minHeight?parseInt(this.minHeight.replace("px",""),10):null,a=this.maxHeight?parseInt(this.maxHeight.replace("px",""),10):null;let l=r;null!==s&&(l=Math.max(l,s)),null!==a&&(l=Math.min(l,a)),Math.abs(l-o)>2&&(t.style.height=l+"px",null===a||a>r?(t.style.overflowY="hidden",this.dn()):(t.style.overflowY="auto",this.hn(t))),this.ln?.update()}hn(t){if(this.ln||!Nt())return;t.style.scrollbarWidth="none",this.setAttribute("data-custom-scroll",""),this.ln=new Bt(t,{vertical:!0,horizontal:!1});const n=this.shadowRoot.querySelector(".textarea-scroll");n&&this.ln.trackY&&n.appendChild(this.ln.trackY)}dn(){this.ln&&(this.ln.trackY?.remove(),this.ln.destroy(),this.ln=null,this.removeAttribute("data-custom-scroll"),this.sn&&(this.sn.style.scrollbarWidth=""))}emitValueEvent(t,n){const e={bubbles:!0,composed:!0,detail:{value:this.value,originalEvent:n}};setTimeout(()=>this.dispatchEvent(new CustomEvent(t,e)),0)}buildClassList(){const t=[this.size];this.disabled&&t.push("disabled"),this.required&&t.push("required"),this.error&&t.push("error"),"none"!==this.resize&&t.push("resize-"+this.resize);const n=this.getAttribute("class");return n&&t.push(n),t.join(" ")}applyHeightConstraints(t){this.minHeight&&(t.style.minHeight=this.minHeight),this.maxHeight&&(t.style.maxHeight=this.maxHeight)}setupTextareaEvents(t){t.addEventListener("input",this.handleInputEvent),t.addEventListener("focus",this.handleFocusEvent),t.addEventListener("blur",this.handleBlurEvent)}render(){const t=this.shadowRoot,n=t.querySelector(".textarea-container"),e=t.querySelector("label"),i=t.querySelector("textarea"),o=t.querySelector(".error-message");if(n&&i){if(this.label?e&&(e.innerHTML=this.label+(this.required?` <span class="required-icon">${Wt}</span>`:""),e.style.display="block"):e&&(e.style.display="none"),i.value=this.value||"",i.placeholder=this.placeholder||"",i.disabled=this.disabled,i.required=this.required,i.className=this.buildClassList(),this.label?i.setAttribute("aria-label",this.label):i.removeAttribute("aria-label"),this.name?i.setAttribute("name",this.name):i.removeAttribute("name"),this.rows&&i.setAttribute("rows",this.rows),this.cols&&i.setAttribute("cols",this.cols),this.applyHeightConstraints(i),this.error){if(!o){const t=document.createElement("div");t.className="error-message",n.appendChild(t)}const e=t.querySelector(".error-message");e&&(e.textContent=this.error)}else o&&o.remove();const r=this.setupDummyElement(i);setTimeout(()=>this.resizeTextarea(i,r),0),this.sn=i}else{const n=document.createElement("div");n.className="textarea-container";const e=document.createElement("label");e.className="ty-field-label",this.label?(e.innerHTML=this.label+(this.required?` <span class="required-icon">${Wt}</span>`:""),e.style.display="block"):e.style.display="none";const i=document.createElement("textarea");i.value=this.value||"",i.placeholder=this.placeholder||"",i.disabled=this.disabled,i.required=this.required,i.className=this.buildClassList(),this.label&&i.setAttribute("aria-label",this.label),this.name&&i.setAttribute("name",this.name),i.setAttribute("rows",this.rows||"3"),this.cols&&i.setAttribute("cols",this.cols),this.applyHeightConstraints(i),this.setupTextareaEvents(i);const o=document.createElement("div");o.className="textarea-wrapper";const r=document.createElement("div");r.className="textarea-header";const s=document.createElement("slot");s.setAttribute("name","header"),r.appendChild(s);const a=document.createElement("div");a.className="textarea-scroll",a.appendChild(i);const l=document.createElement("div");l.className="textarea-footer";const c=document.createElement("slot");c.setAttribute("name","footer"),l.appendChild(c),o.appendChild(r),o.appendChild(a),o.appendChild(l);const d=(t,n)=>{const e=()=>n.classList.toggle("has-content",t.assignedNodes({flatten:!0}).length>0);t.addEventListener("slotchange",e),e()};if(d(s,r),d(c,l),n.appendChild(e),n.appendChild(o),this.error){const t=document.createElement("div");t.className="error-message",t.textContent=this.error,n.appendChild(t)}t.appendChild(n);const h=this.setupDummyElement(i);setTimeout(()=>this.resizeTextarea(i,h),0),this.sn=i}this.updateValidity()}updateValidity(){const t=this.shadowRoot?.querySelector("textarea");this.disabled?this.applyValidity({}):this.required&&""===(t?t.value:(this.value??"")+"").trim()?this.applyValidity({valueMissing:!0},"Please fill out this field",t??void 0):this.applyValidity({})}};Rt.formAssociated=!0,Rt.properties={value:{type:"string",visual:!0,formValue:!0,emitChange:!0,default:""},name:{type:"string",default:""},placeholder:{type:"string",visual:!0,default:""},label:{type:"string",visual:!0,default:""},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},error:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},rows:{type:"string",visual:!0,default:"3",coerce:t=>t+""},cols:{type:"string",visual:!0,default:"",coerce:t=>t?t+"":""},resize:{type:"string",visual:!0,default:"none",validate:t=>["none","both","horizontal","vertical"].includes(t),coerce:t=>["none","both","horizontal","vertical"].includes(t)?t:"none"},minHeight:{type:"string",visual:!0,default:""},maxHeight:{type:"string",visual:!0,default:""}};let Yt=Rt;customElements.get("ty-textarea")||customElements.define("ty-textarea",Yt);const Ut={"top-start":{vertical:"top",horizontal:"start"},top:{vertical:"top",horizontal:"center"},"top-end":{vertical:"top",horizontal:"end"},"right-start":{vertical:"start",horizontal:"end",orientation:"vertical"},right:{vertical:"center",horizontal:"end",orientation:"vertical"},"right-end":{vertical:"end",horizontal:"end",orientation:"vertical"},"bottom-start":{vertical:"bottom",horizontal:"start"},bottom:{vertical:"bottom",horizontal:"center"},"bottom-end":{vertical:"bottom",horizontal:"end"},"left-start":{vertical:"start",horizontal:"start",orientation:"vertical"},left:{vertical:"center",horizontal:"start",orientation:"vertical"},"left-end":{vertical:"end",horizontal:"start",orientation:"vertical"}},Xt={default:["bottom-start","bottom-end","top-start","top-end","bottom","top","left","right"]},Kt={top:"bottom",bottom:"top",left:"right",right:"left"};function Zt(t){const[n,e]=t.split("-");return{side:n,align:e}}function Jt(t){const{side:n,align:e}=Zt(t),i=Kt[n],o="top"===n||"bottom"===n?["right","left"]:["bottom","top"],r=t=>e?`${t}-${e}`:t,s=t=>e?[t,`${t}-${"start"===e?"end":"start"}`]:[t+"-start",t+"-end"];return[r(n),r(i),...s(n),...s(i),...o.flatMap(t=>[r(t),...s(t)])]}function Gt(t){if(!t)return{side:"auto",align:"start"};const{side:n,align:e}=Zt(t);return{side:"top"===n||"bottom"===n?n:"auto",align:e??"start"}}function Qt(t){const n=t.getBoundingClientRect();return{top:n.top,left:n.left,right:n.right,bottom:n.bottom,width:n.width,height:n.height,centerX:n.left+n.width/2,centerY:n.top+n.height/2}}function tn(t){const{targetEl:n,floatingEl:e,preferences:i=Xt.default,offset:o=8,padding:r=8,containerPadding:s=0}=t,a=Qt(n),l=Qt(e),c=i.map(t=>function(t){const{targetRect:n,floatingRect:e,placement:i,offset:o,padding:r,scrollbarWidth:s,containerPadding:a}=t,l=Ut[i],{vertical:c,horizontal:d,orientation:h}=l,u=window.innerWidth,p=window.innerHeight;let b,v;window,window,b="vertical"===h?"start"===d?n.left-e.width-o+a:n.right+o-a:"start"===d?n.left-a:"center"===d?n.centerX-e.width/2:n.right-e.width+a,v="vertical"===h?"center"===c?n.centerY-e.height/2:"end"===c?n.bottom-e.height+a:n.top-a:"top"===c?n.top-e.height-o+a:n.bottom+o-a;const m={top:Math.min(0,v-r),left:Math.min(0,b-r),bottom:Math.min(0,p-(v+e.height+r)),right:Math.min(0,u-(b+e.width+r+s))},g=Object.values(m).reduce((t,n)=>t+Math.abs(n),0);return{x:Math.round(b),y:Math.round(v),placement:i,overflow:m,overflowAmount:g,fits:0===g}}({targetRect:a,floatingRect:l,placement:t,offset:o,padding:r,containerPadding:s,scrollbarWidth:15})),d=c.find(t=>t.fits)||c.reduce((t,n)=>t.overflowAmount>n.overflowAmount?n:t);return 0>d.overflow.right&&(d.x+=d.overflow.right),d}function nn(t){const n=t.gap??4,e=t.padding??8,i=window.innerWidth,o=window.innerHeight,r=o-t.anchorRect.bottom,s=t.anchorRect.top,a=t.popupHeight+n+e,l=r>=a,c=s>=a,d=t.side??"auto",h="bottom"===d?!(!l&&c):"top"===d?!(c||!l):l||r>=s;return{x:Math.max(e,Math.min("end"===t.align?t.anchorRect.right-t.popupWidth:"center"===t.align?t.anchorRect.left+(t.anchorRect.width-t.popupWidth)/2:t.anchorRect.left,i-t.popupWidth-e)),topY:t.anchorRect.bottom+n,bottomY:o-t.anchorRect.top+n,below:h}}const en={id:"ty-tooltip",css:"\n:host {\ndisplay: contents;\n}\n"},on=new WeakMap,rn=new WeakMap,sn=new WeakMap,an=new WeakMap,ln=new WeakMap;function cn(t){const n=t||"neutral",e=n.replace(/[+-]$/,"");return/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?n:"neutral"}function dn(t){let n=sn.get(t);return n||(n={showTimeout:null,hideTimeout:null},sn.set(t,n)),n}function hn(t,n){return t.hasAttribute(n)}function un(t,n,e){const i=t.getAttribute(n);if(null===i)return e;const o=parseInt(i,10);return isNaN(o)?e:o}function pn(t){return{placement:t.getAttribute("placement")||"top",offset:un(t,"offset",8),delay:un(t,"delay",600),disabled:hn(t,"disabled"),flavor:cn(t.getAttribute("flavor"))}}function bn(t){return t.parentElement}function vn(t){!function(){if(document.getElementById("ty-tooltip-motion"))return;const t=document.createElement("style");t.id="ty-tooltip-motion",t.textContent='\n.ty-tooltip-popover:popover-open {\ntransition:\nopacity var(--ty-tooltip-duration, 120ms) ease-out,\ntranslate var(--ty-tooltip-duration, 120ms) ease-out;\n}\n@starting-style {\n.ty-tooltip-popover:popover-open { opacity: 0; translate: 0 4px; }\n.ty-tooltip-popover:popover-open[data-side="bottom"] { translate: 0 -4px; }\n.ty-tooltip-popover:popover-open[data-side="left"] { translate: 4px 0; }\n.ty-tooltip-popover:popover-open[data-side="right"] { translate: -4px 0; }\n}\n',document.head.appendChild(t)}();let n=an.get(t);if(!n){n=document.createElement("div"),n.id="ty-tooltip-"+Math.random().toString(36).slice(2,11),n.setAttribute("popover","manual"),n.setAttribute("role","tooltip"),n.className="ty-tooltip-popover",n.style.cssText="\nposition: fixed;\nmargin: 0;\npadding: 8px 12px;\nbackground: var(--ty-tooltip-bg, #262626);\ncolor: var(--ty-tooltip-color, #f5f5f5);\nborder: none;\nborder-radius: 6px;\nfont-size: var(--ty-font-xs, 12px);\nfont-weight: var(--ty-font-semibold, 600);\nline-height: 1.5;\nmax-width: 250px;\ntext-align: center;\nbox-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\nuser-select: none;\npointer-events: none;\n",document.body.appendChild(n),an.set(t,n);const e=ln.get(t);e&&function(t,n){const e=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);e.includes(n)||(e.push(n),t.setAttribute("aria-describedby",e.join(" ")))}(e,n.id)}const{flavor:e}=pn(t);return n.setAttribute("data-flavor",e),n.innerHTML=t.innerHTML,mn(n,e),n}function mn(t,n){t.style.removeProperty("background"),t.style.removeProperty("color"),t.style.removeProperty("border-color");const e=n.replace(/[+-]$/,""),i=n.slice(e.length);if(("neutral"===e||"dark"===e)&&""===i)return t.style.background="var(--ty-tooltip-bg, #262626)",t.style.color="var(--ty-tooltip-color, #f5f5f5)",void(t.style.borderColor="var(--ty-tooltip-border, #404040)");const o="dark"===e?"neutral":e,r="+"===i?"-strong":"-"===i?"-soft":"";t.style.background=`var(--ty-solid-${o}${r}, var(--ty-tooltip-bg, #262626))`,t.style.color=`var(--ty-solid-${o}${r}-fg, var(--ty-solid-${o}-fg, var(--ty-tooltip-color, #f5f5f5)))`,t.style.borderColor="transparent"}function gn(t){const{placement:n,offset:e}=pn(t),i=bn(t),o=an.get(t);if(!i||!o)return;const r=tn({targetEl:i,floatingEl:o,preferences:Jt(n),offset:e});o.style.left=r.x+"px",o.style.top=r.y+"px",o.dataset.side=r.placement.split("-")[0]}function yn(t){const n=on.get(t);n&&(n(),on.delete(t))}function fn(t){const n=dn(t);null!==n.showTimeout&&(clearTimeout(n.showTimeout),n.showTimeout=null),null!==n.hideTimeout&&(clearTimeout(n.hideTimeout),n.hideTimeout=null)}const wn=new WeakMap;function xn(t){const n=wn.get(t);n&&(document.removeEventListener("keydown",n,!0),wn.delete(t))}function kn(t){xn(t);const n=an.get(t);if(n)try{n.hidePopover(),t.un=!1,yn(t)}catch(e){}}function zn(t){const n=dn(t),{delay:e}=pn(t);fn(t),n.showTimeout=window.setTimeout(()=>function(t){const{disabled:n}=pn(t);if(n)return;const e=vn(t);try{e.showPopover(),t.un=!0,gn(t),function(t){const n=bn(t),e=an.get(t);if(!n||!e)return;let i=null;const o=()=>{null!==i&&clearTimeout(i),i=window.setTimeout(()=>{i=null,gn(t)},10)},r=new ResizeObserver(o);r.observe(n),r.observe(e);let s=null;const a=()=>{null===s&&(s=requestAnimationFrame(()=>{s=null,gn(t)}))};window.addEventListener("scroll",a,!0),window.addEventListener("resize",o),on.set(t,()=>{r.disconnect(),window.removeEventListener("scroll",a,!0),window.removeEventListener("resize",o),null!==i&&clearTimeout(i),null!==s&&cancelAnimationFrame(s)})}(t),function(t){if(wn.has(t))return;const n=n=>{"Escape"===n.key&&(fn(t),kn(t))};wn.set(t,n),document.addEventListener("keydown",n,!0)}(t)}catch(i){}}(t),e)}function $n(t){const n=dn(t);fn(t),n.hideTimeout=window.setTimeout(()=>kn(t),200)}class TyTooltip extends HTMLElement{constructor(){super(),this.un=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["placement","offset","delay","disabled","flavor"]}connectedCallback(){this.un=!1,b(this.shadowRoot,en),function(t){const n=bn(t);if(!n)return;ln.set(t,n);const e=()=>zn(t),i=()=>$n(t),o=()=>zn(t),r=()=>$n(t);n.addEventListener("mouseenter",e),n.addEventListener("mouseleave",i),n.addEventListener("focusin",o),n.addEventListener("focusout",r),rn.set(t,()=>{n.removeEventListener("mouseenter",e),n.removeEventListener("mouseleave",i),n.removeEventListener("focusin",o),n.removeEventListener("focusout",r)})}(this),vn(this)}disconnectedCallback(){!function(t){fn(t),yn(t),xn(t);const n=rn.get(t);n&&(n(),rn.delete(t));const e=an.get(t),i=ln.get(t);e&&i&&function(t,n){const e=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(t=>t&&t!==n);e.length>0?t.setAttribute("aria-describedby",e.join(" ")):t.removeAttribute("aria-describedby")}(i,e.id),e&&(e.remove(),an.delete(t)),ln.delete(t),sn.delete(t)}(this)}attributeChangedCallback(t,n,e){if("flavor"===t){const t=an.get(this);t&&mn(t,cn(e))}"disabled"===t&&null!==e&&kn(this)}}customElements.get("ty-tooltip")||customElements.define("ty-tooltip",TyTooltip);const Cn={locked:!1,scrollY:0,activeLocks:new Set};function En(){return document.documentElement}function Mn(){if(!Cn.locked)return;const t=En();window,t.classList.remove("ty-scroll-locked"),t.style.overflow="",t.style.paddingRight="",Cn.locked=!1}function Sn(t){Cn.activeLocks.has(t)||(Cn.activeLocks.add(t),1===Cn.activeLocks.size&&function(){if(Cn.locked)return;const t=window.innerWidth-En().clientWidth,n=En();window,Cn.scrollY=window.scrollY||En().scrollTop||0,Cn.locked=!0,n.style.overflow="hidden",t>0&&(n.style.paddingRight=t+"px"),n.classList.add("ty-scroll-locked")}())}function Tn(t){Cn.activeLocks.has(t)&&(Cn.activeLocks.delete(t),0===Cn.activeLocks.size&&Mn())}const _n=new WeakMap,qn=new WeakMap,Dn=new WeakMap,An=new WeakMap,Ln=new WeakMap,jn=new WeakMap,Fn=new WeakMap;function Vn(t,n){return t.hasAttribute(n)}function In(t,n,e){const i=t.getAttribute(n);if(null===i)return e;const o=parseInt(i,10);return isNaN(o)?e:o}function On(t){return{manual:Vn(t,"manual"),disableClose:Vn(t,"disable-close"),placement:t.getAttribute("placement")||"bottom",offset:In(t,"offset",8)}}function Hn(t){return t.parentElement}function Nn(t){return t.querySelector(".popup-dialog")}function Bn(t){let n=Fn.get(t);return n||(n="popup-"+(t.id||Math.random().toString(36).substr(2,9)),Fn.set(t,n)),n}function Pn(t,n=!1){const{disableClose:e}=On(t);if(!n&&e)return;const i=t.shadowRoot,o=i?Nn(i):null;if(!o)return;o.classList.remove("open"),o.classList.remove("preparing-animation");const r=Hn(t);r?.hasAttribute("aria-haspopup")&&r.setAttribute("aria-expanded","false");const s=Math.max(0,...getComputedStyle(o).transitionDuration.split(",").map(t=>parseFloat(t)*(t.trim().endsWith("ms")?1:1e3)));clearTimeout(An.get(t)),An.set(t,setTimeout(()=>{An.delete(t),o.classList.remove("position-calculated"),o.close()},s+20))}function Wn(t){const n=t.shadowRoot,e=n?Nn(n):null;if(!e)return;if(e.open){const n=An.get(t);return void(void 0!==n&&(clearTimeout(n),An.delete(t),e.classList.add("open")))}Sn(Bn(t)),e.showModal();const i=Hn(t);i?.hasAttribute("aria-haspopup")&&i.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>{!function(t){const{placement:n,offset:e}=On(t),i=t.shadowRoot,o=Hn(t),r=i?Nn(i):null;if(!o||!r)return;const s=tn({targetEl:o,floatingEl:r,preferences:Jt(n),offset:e,padding:8,containerPadding:16});t.style.setProperty("--popup-x",s.x+"px"),t.style.setProperty("--popup-y",s.y+"px"),r.dataset.side=s.placement.split("-")[0],r.classList.add("position-calculated")}(t),e.classList.add("preparing-animation"),requestAnimationFrame(()=>{e.classList.add("open"),t.dispatchEvent(new CustomEvent("open"))})})}function Rn(t){const n=t.shadowRoot,e=n?Nn(n):null;e&&(e.classList.contains("open")?Pn(t):Wn(t))}function Yn(t,n){n.preventDefault(),n.stopPropagation(),Rn(t)}function Un(t){const{manual:n}=On(t),e=Hn(t);if(!e||n)return;e.setAttribute("aria-haspopup","dialog"),e.hasAttribute("aria-expanded")||e.setAttribute("aria-expanded","false");const i=_n.get(t);i&&e.removeEventListener("pointerdown",i);const o=qn.get(t);o&&e.removeEventListener("click",o);const r=n=>Yn(t,n);_n.set(t,r),e.addEventListener("pointerdown",r);const s=n=>{0===n.detail&&Yn(t,n)};qn.set(t,s),e.addEventListener("click",s)}function Xn(t){const n=Hn(t),e=_n.get(t);n&&e&&(n.removeEventListener("pointerdown",e),_n.delete(t));const i=qn.get(t);n&&i&&(n.removeEventListener("click",i),qn.delete(t)),n?.removeAttribute("aria-haspopup"),n?.removeAttribute("aria-expanded")}function Kn(t){const n=t.shadowRoot;if(!n)return;const e=Nn(n);if(b(n,{css:'\n.popup-dialog {\nposition: fixed;\ntop: 0;\nleft: 0;\nmargin: 0;\nborder: none;\nbackground: transparent;\nmax-width: none;\nmax-height: none;\npadding: var(--popup-padding, 16px);\nvisibility: hidden;\nopacity: 0;\ntransition:\nopacity var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\nvisibility var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\ntransform var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1));\npointer-events: none;\n}\n.popup-dialog.position-calculated {\ntop: var(--popup-y, 0px);\nleft: var(--popup-x, 0px);\n}\n.popup-dialog.preparing-animation {\ntransform: scale(var(--ty-popup-scale, 0.96));\n}\n.popup-dialog.preparing-animation:not(.open) {\ntransition: none;\n}\n.popup-dialog[data-side="bottom"].preparing-animation:not(.open) {\ntransform: translateY(-6px) scale(var(--ty-popup-scale, 0.96));\n}\n.popup-dialog[data-side="top"].preparing-animation:not(.open) {\ntransform: translateY(6px) scale(var(--ty-popup-scale, 0.96));\n}\n.popup-dialog[data-side="left"].preparing-animation:not(.open) {\ntransform: translateX(6px) scale(var(--ty-popup-scale, 0.96));\n}\n.popup-dialog[data-side="right"].preparing-animation:not(.open) {\ntransform: translateX(-6px) scale(var(--ty-popup-scale, 0.96));\n}\n.popup-dialog.open {\nvisibility: visible;\nopacity: 1;\ntransform: scale(1);\npointer-events: auto;\n}\n.popup-dialog::backdrop {\nbackground: transparent;\n}\n.popup-container {\ndisplay: contents;\n}\n#popup-content {\ndisplay: contents;\n}\n#popup-content ::slotted(*) {\nposition: relative;\nmax-width: min(400px, 90vw);\nmax-height: min(500px, 80vh);\noverflow: auto;\n}\n',id:"ty-popup"}),!e){const e=document.createElement("dialog"),i=document.createElement("div"),o=document.createElement("slot");e.className="popup-dialog",i.className="popup-container",o.id="popup-content",n.appendChild(e),e.appendChild(i),i.appendChild(o),t.style.setProperty("--popup-x","0px"),t.style.setProperty("--popup-y","0px");const r=n=>function(t,n){n.stopPropagation();const e=t.shadowRoot,i=e?Nn(e):null;i&&n.target===i&&(n.preventDefault(),Pn(t))}(t,n);Dn.set(t,r),e.addEventListener("pointerdown",r);const s=n=>function(t,n){if(n.stopPropagation(),"Escape"===n.key){const{disableClose:e}=On(t);e?n.preventDefault():Pn(t)}}(t,n);Ln.set(t,s),t.addEventListener("keydown",s),e.addEventListener("close",()=>{Tn(Bn(t)),e.classList.remove("open"),e.classList.remove("preparing-animation"),t.dispatchEvent(new CustomEvent("close"))})}t.closePopup=()=>Pn(t,!0),t.openPopup=()=>Wn(t),t.togglePopup=()=>Rn(t);const i=n=>function(t,n){n.stopPropagation(),Pn(t,!0)}(t,n);jn.set(t,i),t.addEventListener("ty:close-popup",i),Un(t)}class TyPopup extends HTMLElement{static get observedAttributes(){return["manual","disable-close","placement","offset"]}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){Kn(this)}disconnectedCallback(){!function(t){const n=Fn.get(t);n&&(Tn(n),Fn.delete(t)),Xn(t);const e=t.shadowRoot,i=e?Nn(e):null;if(i){const n=Dn.get(t);n&&(i.removeEventListener("pointerdown",n),Dn.delete(t))}const o=Ln.get(t);o&&(t.removeEventListener("keydown",o),Ln.delete(t));const r=jn.get(t);r&&(t.removeEventListener("ty:close-popup",r),jn.delete(t))}(this)}attributeChangedCallback(t,n,e){switch(Kn(this),t){case"placement":case"offset":Kn(this);break;case"manual":case"disable-close":Xn(this),Un(this)}}}customElements.get("ty-popup")||customElements.define("ty-popup",TyPopup);const Zn=new WeakMap,Jn=new WeakMap,Gn=new WeakMap,Qn=new WeakMap,te=new WeakMap,ne=new WeakMap,ee=new WeakMap;function ie(t,n){if(!t.hasAttribute(n))return!1;const e=t.getAttribute(n);return null===e||"false"!==e.toLowerCase()}function oe(t){return{open:ie(t,"open"),backdrop:!ie(t,"no-backdrop"),closeOnOutsideClick:!ie(t,"prevent-outside-click"),closeOnEscape:!ie(t,"prevent-escape")}}function re(t){return t.querySelector(".ty-modal-dialog")}function se(t,n,e){const i=new CustomEvent(n,{detail:e,cancelable:!0});t.dispatchEvent(i)}function ae(t,n="programmatic",e){const i=t.shadowRoot,o=i?re(i):null;if(o&&o.open){if(!e?.force){const e=new CustomEvent("beforeclose",{detail:{reason:n},cancelable:!0});if(t.dispatchEvent(e),e.defaultPrevented)return}ee.set(t,n),t.removeAttribute("open")}}function le(t){const n=t.shadowRoot;if(!n)return;const e=oe(t),i=function(t){let n=re(t);if(!n){n=document.createElement("dialog");const e=document.createElement("button"),i=document.createElement("div"),o=document.createElement("slot");n.className="ty-modal-dialog",e.className="close-button",e.type="button",e.setAttribute("aria-label","Close modal"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',i.className="modal-content",i.appendChild(o),n.appendChild(e),n.appendChild(i),t.appendChild(n)}return n}(n),o=function(t){let n=ne.get(t);return n||(n="modal-"+(t.id||Math.random().toString(36).slice(2,11)),ne.set(t,n)),n}(t);b(n,{css:"\n:host {\ndisplay: contents;\n}\n.close-button {\nposition: absolute;\ntop: -8px;\nright: -8px;\nbackground: transparent;\nborder: none;\ncursor: pointer;\npadding: 4px;\nborder-radius: 4px;\ntransition: var(--ty-transition-colors);\nz-index: 1;\ncolor: #d8d8d8;\noutline: none;\nbox-shadow: none;\n-webkit-appearance: none;\n-moz-appearance: none;\nappearance: none;\n-webkit-tap-highlight-color: transparent;\n-webkit-touch-callout: none;\n-webkit-user-select: none;\n-moz-user-select: none;\n-ms-user-select: none;\nuser-select: none;\n}\n.close-button:hover {\ncolor: white;\n}\n.close-button:focus,\n.close-button:focus-visible,\n.close-button:focus-within,\n.close-button:active {\noutline: none !important;\nbox-shadow: none !important;\nborder: none !important;\nbackground: transparent !important;\n}\n.close-button:hover,\n.close-button:focus:hover,\n.close-button:active:hover {\ncolor: white;\n}\n.close-button.hide {\nvisibility: hidden;\n}\n.ty-modal-dialog {\npadding: 18px;\nborder: none;\nmargin: 0;\nbackground: transparent;\nposition: fixed;\ntop: 50%;\nleft: 50%;\ntransform: translate(-50%, -50%);\nz-index: 1000;\noverflow: hidden;\nmax-width: 85vw;\nmax-height: 90vh;\noutline: none;\n}\n.ty-modal-dialog[open] {\nanimation: ty-modal-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n@keyframes ty-modal-enter {\nfrom {\nopacity: 0;\ntransform: translate(-50%, -50%) scale(0.93);\n}\nto {\nopacity: 1;\ntransform: translate(-50%, -50%) scale(1);\n}\n}\n.ty-modal-dialog::backdrop {\nbackground: var(--ty-modal-backdrop, rgba(0, 0, 0, 0.5));\nbackdrop-filter: var(--ty-modal-backdrop-blur, blur(2px));\nanimation: ty-modal-backdrop-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n.ty-modal-dialog:not([data-backdrop])::backdrop {\nbackground: transparent;\nbackdrop-filter: none;\n}\n.modal-content {\ncolor: var(--ty-text);\n}\n@keyframes ty-modal-backdrop-enter {\nfrom {\nopacity: 0;\n}\nto {\nopacity: 1;\n}\n}\n",id:"ty-modal"}),i.className="ty-modal-dialog",e.backdrop?i.setAttribute("data-backdrop","true"):i.removeAttribute("data-backdrop");const r=t.getAttribute("label");if(r?i.setAttribute("aria-label",r):i.removeAttribute("aria-label"),function(t,n,e){const i=Zn.get(t);if(i&&(n.removeEventListener("click",i),Zn.delete(t)),e){const e=n=>function(t,n){n.stopPropagation();const e=t.shadowRoot,i=e?re(e):null;i&&n.target===i&&(n.preventDefault(),ae(t,"backdrop"))}(t,n);Zn.set(t,e),n.addEventListener("click",e)}}(t,i,e.closeOnOutsideClick),function(t,n,e){const i=Jn.get(t);if(i&&(n.removeEventListener("keydown",i),Jn.delete(t)),e){const e=n=>function(t,n){n.stopPropagation(),"Escape"===n.key&&(n.preventDefault(),ae(t,"escape"))}(t,n);Jn.set(t,e),n.addEventListener("keydown",e)}else{const e=t=>{"Escape"===t.key&&t.preventDefault()};Jn.set(t,e),n.addEventListener("keydown",e)}}(t,i,e.closeOnEscape),i.oncancel=n=>{n.preventDefault(),oe(t).closeOnEscape&&ae(t,"escape")},function(t,n,e){const i=n.querySelector(".close-button");if(!i)return;i.style.display=e?"":"none";const o=Gn.get(t);if(o&&(i.removeEventListener("click",o),Gn.delete(t)),e){const n=n=>function(t,n){n.preventDefault(),n.stopPropagation(),ae(t,"close-button")}(t,n);Gn.set(t,n),i.addEventListener("click",n)}}(t,i,e.closeOnOutsideClick),function(t,n){const e=n.querySelector(".modal-content");if(!e)return;const i=Qn.get(t),o=te.get(t);if(i&&(e.removeEventListener("mouseenter",i),Qn.delete(t)),o&&(e.removeEventListener("mouseleave",o),te.delete(t)),window.innerWidth>=768&&0>=navigator.maxTouchPoints){const n=t=>function(t,n){const e=n.currentTarget.closest(".ty-modal-dialog");if(e){const t=e.querySelector(".close-button");t&&t.classList.add("hide")}}(0,t),i=t=>function(t,n){const e=n.currentTarget.closest(".ty-modal-dialog");if(e){const t=e.querySelector(".close-button");t&&t.classList.remove("hide")}}(0,t);Qn.set(t,n),te.set(t,i),e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",i)}}(t,i),e.open)i.open||(Sn(o),e.backdrop?i.showModal():i.show(),ce(),se(t,"open",{}));else if(i.open){Tn(o),i.close(),ce();const n=ee.get(t)??"programmatic";ee.delete(t),se(t,"close",{reason:n})}ce(),i.onclose=n=>{n.target===i&&(Tn(o),t.hasAttribute("open")&&(t.removeAttribute("open"),se(t,"close",{reason:"native",returnValue:i.returnValue||void 0})),ce())}}function ce(){const t=Array.from(document.querySelectorAll("ty-modal[open], ty-dialog[open]")).some(t=>ie(t,"open")&&!ie(t,"no-zoom"));document.documentElement.classList.toggle("ty-modal-zoom",t)}class TyModal extends HTMLElement{static get observedAttributes(){return["open","no-backdrop","no-zoom","prevent-outside-click","prevent-escape","label"]}get open(){return ie(this,"open")}set open(t){i(t)?this.setAttribute("open","true"):this.removeAttribute("open")}get noBackdrop(){return ie(this,"no-backdrop")}set noBackdrop(t){i(t)?this.setAttribute("no-backdrop",""):this.removeAttribute("no-backdrop")}get noZoom(){return ie(this,"no-zoom")}set noZoom(t){i(t)?this.setAttribute("no-zoom",""):this.removeAttribute("no-zoom")}get preventOutsideClick(){return ie(this,"prevent-outside-click")}set preventOutsideClick(t){i(t)?this.setAttribute("prevent-outside-click",""):this.removeAttribute("prevent-outside-click")}get preventEscape(){return ie(this,"prevent-escape")}set preventEscape(t){i(t)?this.setAttribute("prevent-escape",""):this.removeAttribute("prevent-escape")}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){le(this),this.show=()=>{this.setAttribute("open","true")},this.hide=t=>ae(this,"programmatic",t)}disconnectedCallback(){!function(t){const n=ne.get(t),e=t.shadowRoot,i=e?re(e):null;if(n&&(Tn(n),ne.delete(t)),ce(),!i)return;const o=Zn.get(t);o&&(i.removeEventListener("click",o),Zn.delete(t));const r=Jn.get(t);r&&(i.removeEventListener("keydown",r),Jn.delete(t));const s=i.querySelector(".close-button");if(s){const n=Gn.get(t);n&&(s.removeEventListener("click",n),Gn.delete(t))}const a=i.querySelector(".modal-content");if(a){const n=Qn.get(t),e=te.get(t);n&&(a.removeEventListener("mouseenter",n),Qn.delete(t)),e&&(a.removeEventListener("mouseleave",e),te.delete(t))}}(this)}attributeChangedCallback(t,n,e){this.isConnected&&le(this)}}customElements.get("ty-modal")||customElements.define("ty-modal",TyModal),customElements.get("ty-dialog")||customElements.define("ty-dialog",class extends TyModal{});const de=(t,n)=>{const e=e=>n?e?`var(--ty-color-${t}${e}, var(--ty-color-${t}, var(--ty-color-${n}${e})))`:`var(--ty-color-${t}, var(--ty-color-${n}))`:e?`var(--ty-color-${t}${e}, var(--ty-color-${t}))`:`var(--ty-color-${t})`;return`\n:host([flavor="${t}"]) {\n--select-accent: var(--ty-input-${t}-border, ${e("-soft")});\n--select-accent-bold: ${e("")};\n--select-ring: color-mix(in oklab, ${e("")} 15%, transparent);\n}\n:host([flavor="${t}+"]) {\n--select-accent: ${e("")};\n--select-accent-bold: ${e("-strong")};\n--select-ring: color-mix(in oklab, ${e("-strong")} 15%, transparent);\n}\n:host([flavor="${t}-"]) {\n--select-accent: ${e("-faint")};\n--select-accent-bold: ${e("-soft")};\n--select-ring: color-mix(in oklab, ${e("-soft")} 15%, transparent);\n}\n`},he=`\n${et}\n:host {\ndisplay: block;\nwidth: 100%;\nfont-family: inherit;\n--mobile-border-color: var(--ty-border, #5858587d);\n}\n:host([compact]) {\ndisplay: inline-block;\nwidth: auto;\n}\n:host([has-trigger]) {\ndisplay: inline-block;\nwidth: auto;\n}\n.dropdown-dialog {\nposition: fixed;\nwidth: var(--dropdown-width, 200px);\nmax-width: 100vw;\nmargin: 0;\npadding: 0;\nborder: none;\nbackground: transparent;\nbox-sizing: border-box;\npadding: var(--dropdown-padding, 20px);\nopacity: 0;\nscale: 0.96;\ntranslate: 0 -6px;\ntransform-origin: top center;\ntransition:\nopacity var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\nscale var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\ntranslate var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1));\ntransform: translate(var(--dropdown-offset-x, 0px), var(--dropdown-offset-y, 0px));\ntop: -1000px;\nleft: -1000px;\n}\n.dropdown-dialog[open] {\ndisplay: flex;\nflex-direction: column;\n}\n.dropdown-dialog.position-below {\nleft: var(--dropdown-x);\ntop: var(--dropdown-y);\n}\n.dropdown-dialog.position-above {\nleft: var(--dropdown-x);\nbottom: var(--dropdown-y);\ntop: auto;\nflex-direction: column-reverse;\ntranslate: 0 6px;\ntransform-origin: bottom center;\n}\n.dropdown-dialog.position-above .dropdown-header {\nmargin-top: 4px;\n}\n.dropdown-dialog.position-below .dropdown-header {\nmargin-bottom: 4px;\n}\n.dropdown-dialog.position-below .dropdown-options {\nbox-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1), var(--ty-shadow-md);\n}\n.dropdown-dialog.position-above .dropdown-options {\ntransform: translateY(6px) scale(0.96);\ntransform-origin: bottom center;\n}\n.dropdown-dialog.open {\nopacity: 1;\nscale: 1;\ntranslate: 0 0;\n}\n.dropdown-dialog.open .dropdown-options {\nopacity: 1;\ntransform: translateY(0) scale(1);\n}\n@starting-style {\n.dropdown-dialog.open {\nopacity: 0;\nscale: 0.96;\ntranslate: 0 -6px;\n}\n.dropdown-dialog.open.position-above {\ntranslate: 0 6px;\n}\n.dropdown-dialog.open .dropdown-options {\nopacity: 0;\ntransform: translateY(-6px) scale(0.96);\n}\n.dropdown-dialog.open.position-above .dropdown-options {\ntransform: translateY(6px) scale(0.96);\n}\n}\n.dropdown-dialog::backdrop {\nbackground: transparent;\n}\n.dropdown-header {\ndisplay: flex;\nalign-items: center;\ngap: var(--ty-spacing-2);\nposition: relative;\n}\n.dropdown-search-input {\nfont-family: inherit;\nwidth: 100%;\nmin-width: 0;\nbox-sizing: border-box;\nbackground: var(--input-bg, var(--ty-input-bg));\ncolor: var(--input-color, var(--ty-input-color));\nborder: 1px solid var(--input-border, var(--ty-input-border));\nborder-radius: var(--ty-radius-md);\nfont-family: inherit;\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-normal);\nmin-height: var(--ty-size-md);\npadding: var(--ty-spacing-2) var(--ty-spacing-3);\npadding-right: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\ntransition: var(--ty-transition-all);\noutline: none;\n}\n.dropdown-search-input:focus {\nborder-color: var(--input-border-focus, var(--ty-input-border-focus));\nbox-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\n.dropdown-search-input:disabled {\nbackground-color: var(--input-disabled-bg, var(--ty-input-disabled-bg));\ncolor: var(--input-disabled-color, var(--ty-input-disabled-color));\ncursor: not-allowed;\nopacity: 0.6;\n}\n.dropdown-search-input::placeholder {\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\n}\n.dropdown-search-chevron {\nposition: absolute;\ntop: 50%;\nright: var(--ty-spacing-3);\ntransform: translateY(-50%);\nwidth: 1rem;\nheight: 1rem;\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\ntransition: var(--ty-transition-transform);\npointer-events: none;\n}\n.dropdown-search-chevron.open {\ntransform: translateY(-50%) rotate(180deg);\n}\n.dropdown-search-chevron svg {\nwidth: 100%;\nheight: 100%;\n}\n.select-stub {\nmin-height: var(--ty-size-md);\ndisplay: flex;\nflex-wrap: wrap;\ngap: 0.25rem;\nalign-items: center;\npadding: 0 2.5rem 0 0.75rem;\ntransition: var(--ty-transition-all), opacity 0.2s ease;\noutline: none;\nbackground: var(--input-bg, var(--ty-input-bg));\ncolor: var(--input-color, var(--ty-input-color));\nborder: 1px solid var(--select-accent, var(--input-border, var(--ty-input-border)));\nborder-radius: var(--ty-radius-md);\nfont-family: inherit;\nfont-size: var(--ty-field-font);\nline-height: var(--ty-field-leading);\nletter-spacing: var(--ty-field-tracking);\ncursor: pointer;\nposition: relative;\nwidth: 100%;\nbox-sizing: border-box;\n}\n.select-stub {\nmin-height: var(--ty-field-height);\npadding: 0 2.5rem 0 var(--ty-field-pad-x);\n}\n.select-stub:hover {\nborder-color: var(--select-accent-bold, var(--input-border-hover, var(--ty-input-border-hover)));\n}\n.select-stub[disabled] {\nbackground-color: var(--input-disabled-bg, var(--ty-input-disabled-bg));\ncolor: var(--input-disabled-color, var(--ty-input-disabled-color));\ncursor: not-allowed;\nopacity: 0.6;\n}\n.dropdown-wrapper:has(.dropdown-chevron.open) .select-stub {\nopacity: 0;\npointer-events: none;\n}\n.dropdown-wrapper:has(.dropdown-chevron.open):not(:has(.dropdown-search-input:focus)) .select-stub:not(.custom-trigger),\n.select-stub:focus,\n.select-stub:focus-visible {\nborder-color: var(--select-accent-bold, var(--input-border-focus, var(--ty-input-border-focus)));\nbox-shadow: 0 0 0 3px var(--select-ring, var(--input-shadow-focus, var(--ty-input-shadow-focus)));\n}\n.select-stub.custom-trigger {\nmin-height: 0;\npadding: 0;\nborder: none;\nbackground: transparent;\n}\n.select-stub.custom-trigger:hover,\n.dropdown-wrapper:has(.dropdown-chevron.open) .select-stub.custom-trigger,\n.select-stub.custom-trigger:focus,\n.select-stub.custom-trigger:focus-visible {\nborder-color: transparent;\nbox-shadow: none;\n}\n.dropdown-mode-mobile .dropdown-wrapper:has(.mobile-dialog[open]) .select-chips {\ndisplay: none;\n}\n.select-stub.has-tags {\npadding: 0.25rem 2.5rem 0.25rem 0.5rem;\nwidth: 100%;\n}\n.select-stub.has-tags slot[name="selected"] {\ndisplay: flex;\nflex-wrap: wrap;\ngap: 0.25rem;\n}\n.dropdown-chevron {\nposition: absolute;\ntop: 50%;\nright: var(--ty-spacing-3);\ntransform: translateY(-50%);\nwidth: 1rem;\nheight: 1rem;\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\ntransition: var(--ty-transition-transform);\npointer-events: none;\n}\n.dropdown-chevron.open {\ntransform: translateY(-50%) rotate(180deg);\n}\n.dropdown-chevron svg {\nwidth: 100%;\nheight: 100%;\n}\n.select-chips {\ndisplay: flex;\nflex-wrap: wrap;\ngap: 0.5rem;\nalign-items: center;\nmin-width: 0;\n}\n.dropdown-placeholder {\ncolor: var(--input-placeholder, var(--ty-input-placeholder, #9ca3af));\nfont-size: var(--ty-field-font);\nline-height: var(--ty-field-leading);\nletter-spacing: var(--ty-field-tracking);\nfont-weight: var(--ty-font-light);\nfont-style: italic;\n}\n.dropdown-placeholder.hidden {\ndisplay: none;\n}\n.dropdown-options {\nopacity: 0;\nbackground: var(--ty-surface-floating);\nborder: 1px solid var(--ty-floating-border);\nborder-radius: var(--ty-radius-lg);\nmax-height: 16rem;\nwidth: 100%;\nmax-width: 100%;\noverflow-x: hidden;\noverflow-y: auto;\nscroll-behavior: smooth;\nbox-sizing: border-box;\nposition: relative;\nbox-shadow:\n0 20px 25px -5px rgba(0, 0, 0, 0.1),\n0 10px 10px -5px rgba(0, 0, 0, 0.04);\ntransform: translateY(-6px) scale(0.96);\ntransform-origin: top center;\ntransition:\nopacity var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\ntransform var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1));\ndisplay: flex;\nflex-wrap: wrap;\npadding: 0.5rem;\ngap: 0.5rem;\n}\n.dropdown-options.ty-custom-scroll {\nscrollbar-width: none;\n-ms-overflow-style: none;\n}\n.dropdown-options.ty-custom-scroll::-webkit-scrollbar {\ndisplay: none;\n}\n.dropdown-options-wrapper {\nposition: relative;\n}\n.dropdown-options-wrapper:hover .ty-scrollbar-track-y.has-overflow {\nopacity: 1;\n}\n.dropdown-options ty-tag {\nuser-select: none;\ntransition: transform 0.1s ease;\n}\n.dropdown-options ty-tag:hover {\ntransform: scale(1.02);\n}\n.dropdown-options ty-tag:active {\ntransform: scale(0.98);\n}\n.dropdown-options ty-tag[selected] {\nopacity: 0.5;\n}\n.select-chips ty-tag {\nmax-width: 150px;\n}\n@media (max-width: 640px) {\n.select-chips ty-tag {\nmax-width: 100px;\n}\n}\n.select-container {\ndisplay: flex;\nflex-direction: column;\n}\n.dropdown-wrapper {\nposition: relative;\ndisplay: block;\nwidth: 100%;\n}\n.ty-field-label {\nfont-size: var(--ty-field-label-font);\nline-height: var(--ty-field-label-leading);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-medium);\ncolor: var(--ty-label-color);\nmargin-bottom: var(--ty-field-label-gap);\npadding-left: var(--ty-field-outer-pad-x);\ndisplay: flex;\nalign-items: center;\n}\n.required-icon {\ndisplay: inline-flex;\nalign-items: center;\ncolor: #ef4444;\nwidth: 12px;\nheight: 12px;\nvertical-align: middle;\nmargin-left: 4px;\n}\n.required-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n:host([disabled]) .select-container {\npointer-events: none;\n}\n.dropdown-mode-mobile .mobile-dialog {\nposition: fixed;\ntop: 0;\nleft: 0;\nright: 0;\nbottom: 0;\nwidth: 100vw;\nheight: 100dvh; \nmax-width: 100vw;\nmax-height: 100dvh;\nmargin: 0;\npadding: 0;\npadding-top: 6dvh; \nborder: none;\nbackground: transparent; \nalign-items: flex-start;\njustify-content: center;\nopacity: 0;\ntransition: opacity 300ms ease;\n}\n.dropdown-mode-mobile .mobile-dialog[open] {\ndisplay: flex;\n}\n.dropdown-mode-mobile .mobile-dialog.open {\nopacity: 1;\n}\n.dropdown-mode-mobile .mobile-dialog::backdrop {\nbackground: rgba(0, 0, 0, 0.65); \nbackdrop-filter: blur(8px);\n-webkit-backdrop-filter: blur(8px);\n}\n.dropdown-mode-mobile .mobile-dialog-content {\nposition: relative;\ndisplay: flex;\nflex-direction: column;\nwidth: calc(100% - 32px); \nmax-width: 400px;\nmin-height: 200px;\nmax-height: 90dvh; \nopacity: 0;\ntransform: scale(0.95);\ntransition: \nopacity 300ms cubic-bezier(0.16, 1, 0.3, 1),\ntransform 300ms cubic-bezier(0.16, 1, 0.3, 1);\n}\n.dropdown-mode-mobile .mobile-dialog.open .mobile-dialog-content {\nopacity: 1;\ntransform: scale(1);\n}\n.dropdown-mode-mobile .mobile-search-input:focus {\nborder-color: var(--ty-border);\n}\n.dropdown-mode-mobile .mobile-search-header {\nflex-shrink: 0;\ndisplay: flex;\nflex-direction: column;\nmargin-bottom: 16px;\npadding: 0;\nbackground: transparent;\nposition: relative;\n}\n.dropdown-mode-mobile .mobile-header-content {\ndisplay: flex;\nalign-items: center;\ngap: 12px;\nwidth: 100%;\njustify-content: flex-end;\n}\n.dropdown-mode-mobile .mobile-header-label {\nposition: absolute;\nbottom: 100%;\nleft: 2px;\nmargin-bottom: 8px; \nfont-size: var(--ty-font-base); \nline-height: var(--ty-leading-base);\nletter-spacing: var(--ty-tracking-base);\nfont-weight: 600; \ncolor: #ffffff;\npointer-events: none;\n}\n.dropdown-mode-mobile .mobile-close-button {\nflex-shrink: 0;\nwidth: 32px;\nheight: 32px;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nbackground: transparent;\nborder: none;\nborder-radius: 50%;\ncolor: #ffffff;\ncursor: pointer;\ntransition: var(--ty-transition-all);\npadding: 0;\n}\n.dropdown-mode-mobile .mobile-close-button:hover {\nbackground: rgba(255, 255, 255, 0.15);\ncolor: #ffffff;\n}\n.dropdown-mode-mobile .mobile-close-button:active {\ntransform: scale(0.9);\nbackground: rgba(255, 255, 255, 0.25);\n}\n.dropdown-mode-mobile .mobile-close-button svg {\nwidth: 18px;\nheight: 18px;\n}\n.dropdown-mode-mobile .mobile-search-input {\nfont-family: inherit;\nflex: 1;\nmin-width: 0;\nbox-sizing: border-box;\nbackground: var(--ty-surface-floating);\ncolor: var(--ty-text);\nborder: 2px solid;\nborder-color: var(--mobile-border-color);\nborder-radius: var(--ty-radius-md);\nfont-family: inherit;\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-normal);\npadding: var(--ty-spacing-2) var(--ty-spacing-3);\nheight: 40px;\ntransition: var(--ty-transition-all);\noutline: none;\n}\n.dropdown-mode-mobile .mobile-search-input::placeholder {\ncolor: var(--ty-text-faint);\n}\n.dropdown-mode-mobile .mobile-search-input:focus {\nborder-color: var(--ty-border);\n}\n.dropdown-mode-mobile .mobile-body {\nposition: relative;\ndisplay: flex;\nflex-direction: column;\nheight: var(--body-height, 350px);\nmax-height: 350px;\noverflow: hidden;\nbackground: var(--ty-surface-floating);\nborder-radius: var(--ty-radius-lg);\nbox-shadow: \n0 20px 25px -5px rgba(0, 0, 0, 0.1),\n0 10px 10px -5px rgba(0, 0, 0, 0.04);\nborder: 2px solid;\nborder-color: var(--mobile-border-color);\n}\n.dropdown-mode-mobile .section-header {\ndisplay: flex;\nalign-items: center;\njustify-content: space-between;\nheight: 36px;\nflex-shrink: 0;\npadding: 0 16px;\nfont-size: 11px;\nfont-weight: 600;\ntext-transform: uppercase;\nletter-spacing: 0.06em;\ncolor: var(--ty-text-bold);\nbackground: transparent;\ncursor: default;\nuser-select: none;\n}\n.dropdown-mode-mobile .section-header .section-title {\nflex: 1;\n}\n.dropdown-mode-mobile .section-header .section-count {\nfont-weight: 500;\ncolor: var(--ty-text-faint);\nmargin-left: 0.25rem;\n}\n.dropdown-mode-mobile .mobile-body .section-header {\nheight: 36px;\nflex: 0 0 36px;\n}\n.dropdown-mode-mobile .mobile-selected-section,\n.dropdown-mode-mobile .mobile-available-section {\ndisplay: flex;\nflex-direction: column;\nbackground: var(--ty-input-bg);\noverflow: hidden;\nmin-height: 36px;\nflex: 0 1 36px;\ntransition: flex-grow 220ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n.dropdown-mode-mobile .mobile-body[data-expanded="selected"] .mobile-selected-section,\n.dropdown-mode-mobile .mobile-body[data-expanded="available"] .mobile-available-section {\nflex-grow: 1;\n}\n.dropdown-mode-mobile .mobile-selected-section[data-empty="true"] {\nflex-grow: 0;\n}\n.dropdown-mode-mobile .mobile-selected-section .section-content {\nflex: 1;\nmin-height: 0;\noverflow-y: auto;\noverscroll-behavior: contain;\npadding: 0.75rem 1rem;\ndisplay: flex;\nflex-wrap: wrap;\ngap: 0.5rem;\nalign-content: flex-start;\n-webkit-mask-image: linear-gradient(to bottom, black calc(100% - 12px), transparent);\nmask-image: linear-gradient(to bottom, black calc(100% - 12px), transparent);\n}\n.dropdown-mode-mobile .mobile-available-section .section-content {\nflex: 1;\nmin-height: 0;\noverflow-y: auto;\noverscroll-behavior: contain;\npadding: 0.75rem 1rem;\ndisplay: flex;\nflex-wrap: wrap;\ngap: 0.5rem;\nalign-content: flex-start;\n}\n@media (prefers-reduced-motion: reduce) {\n.dropdown-mode-mobile .mobile-selected-section,\n.dropdown-mode-mobile .mobile-available-section {\ntransition: none;\n}\n}\n.dropdown-mode-mobile .mobile-body .section-header {\ndisplay: flex;\nalign-items: center;\njustify-content: space-between;\nwidth: 100%;\nborder: none;\nbackground: transparent;\nfont: inherit;\ntext-align: left;\ncursor: pointer;\n-webkit-tap-highlight-color: transparent;\n}\n.dropdown-mode-mobile .mobile-body .section-header svg {\nwidth: 1rem;\nheight: 1rem;\nflex-shrink: 0;\nopacity: 0.5;\ntransition: transform 180ms ease;\n}\n.dropdown-mode-mobile .mobile-body .section-header[aria-expanded="true"] svg {\ntransform: rotate(180deg);\n}\n.dropdown-mode-mobile .mobile-selected-section[data-empty="true"] .section-header {\ncursor: default;\n}\n.dropdown-mode-mobile .mobile-selected-section[data-empty="true"] .section-header svg {\ndisplay: none;\n}\n.dropdown-mode-mobile .mobile-selected-chip {\ndisplay: inline-flex;\nalign-items: center;\ngap: 0.375rem;\npadding: 0.25rem 0.5rem 0.25rem 0.625rem;\nborder: 1px solid var(--ty-border);\nborder-radius: 9999px;\nbackground: var(--ty-surface-content);\ncolor: var(--ty-text);\nfont: inherit;\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\ncursor: pointer;\ntransition: transform 0.1s ease, border-color 0.15s ease;\nanimation: ty-select-tag-enter 180ms cubic-bezier(0.16, 1, 0.3, 1);\n}\n.dropdown-mode-mobile .mobile-selected-chip svg {\nwidth: 0.875rem;\nheight: 0.875rem;\nflex-shrink: 0;\nopacity: 0.6;\n}\n@media (hover: hover) {\n.dropdown-mode-mobile .mobile-selected-chip:hover {\nborder-color: var(--ty-text-soft);\n}\n.dropdown-mode-mobile .mobile-selected-chip:hover svg {\nopacity: 1;\n}\n}\n.dropdown-mode-mobile .mobile-selected-chip:active {\ntransform: scale(0.96);\n}\n.dropdown-mode-mobile .empty-state {\ndisplay: none;\nwidth: 100%;\npadding: 2rem 1rem;\ntext-align: center;\ncolor: var(--ty-text-faint);\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\nfont-style: italic;\n}\n.dropdown-mode-mobile .mobile-available-section[data-empty="true"] .empty-state {\ndisplay: block;\n}\n.dropdown-mode-mobile .mobile-selected-section[data-empty="true"] .section-content,\n.dropdown-mode-mobile .mobile-available-section[data-empty="true"] slot {\ndisplay: none;\n}\n.dropdown-mode-mobile .section-content ::slotted(ty-tag) {\ncursor: pointer;\nuser-select: none;\ntransition: transform 0.1s ease;\nmargin: 2px 0;\nanimation: ty-select-tag-enter 180ms cubic-bezier(0.16, 1, 0.3, 1);\n}\n@media (hover: hover) {\n.dropdown-mode-mobile .section-content ::slotted(ty-tag:hover) {\ntransform: scale(1.02);\n}\n}\n.dropdown-mode-mobile .section-content ::slotted(ty-tag:active) {\ntransform: scale(0.96);\n}\n.dropdown-mode-mobile .section-content ::slotted(ty-tag[hidden]) {\ndisplay: none !important;\n}\n@keyframes ty-select-tag-enter {\nfrom { opacity: 0; transform: scale(0.85); }\nto { opacity: 1; transform: scale(1); }\n}\n@media (prefers-reduced-motion: reduce) {\n.dropdown-mode-mobile .section-content ::slotted(ty-tag) {\nanimation: none;\n}\n}\n.dropdown-loading {\ndisplay: none;\nalign-items: center;\njustify-content: center;\ngap: var(--ty-spacing-2);\npadding: var(--ty-spacing-4) var(--ty-spacing-3);\ncolor: var(--ty-text-soft);\nfont-size: var(--ty-font-sm);\nmin-height: 4rem;\nbackground: var(--ty-loader-bg, var(--ty-surface-floating));\nborder: 1px solid var(--ty-loader-border, var(--ty-floating-border));\nborder-radius: var(--ty-loader-radius, var(--ty-radius-lg));\nbox-shadow: var(--ty-loader-shadow, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04));\nbox-sizing: border-box;\n}\n.dropdown-options-wrapper.loading .dropdown-loading {\ndisplay: flex;\n}\n.dropdown-loading > slot[name="loading"] {\ndisplay: contents;\n}\n.dropdown-mode-mobile .dropdown-loading {\nbackground: transparent;\nborder: none;\nbox-shadow: none;\nflex: 1;\nflex-direction: column;\ngap: var(--ty-spacing-3);\npadding: var(--ty-spacing-8) var(--ty-spacing-4);\nmin-height: 12rem;\n}\n.dropdown-mode-mobile .dropdown-loading-spinner {\nwidth: 2rem;\nheight: 2rem;\n}\n.dropdown-mode-mobile .dropdown-loading-text {\nfont-size: var(--ty-font-base);\n}\n.dropdown-options-wrapper.loading .dropdown-options,\n.dropdown-options-wrapper.loading > slot#options-slot,\n.dropdown-options-wrapper.loading .empty-state {\ndisplay: none;\n}\n.dropdown-loading-spinner {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nwidth: 1.125rem;\nheight: 1.125rem;\nflex-shrink: 0;\nanimation: ty-select-spin 0.7s linear infinite;\ncolor: var(--select-accent-bold, var(--ty-color-primary));\n}\n.dropdown-loading-spinner svg {\nwidth: 100%;\nheight: 100%;\n}\n.dropdown-loading-text {\ncolor: var(--ty-text-soft);\n}\n@keyframes ty-select-spin {\nto { transform: rotate(360deg); }\n}\n@media (prefers-reduced-motion: reduce) {\n.dropdown-loading-spinner {\nanimation-duration: 1.6s;\n}\n}\n${Pt}\n${n.filter(t=>"neutral"!==t).map(t=>de(t)).join("")}\n`;function ue(t=768){return window.matchMedia(`(pointer: coarse) and (max-width: ${t}px)`).matches}let pe=0;const be=new WeakMap;function ve(t){let n=be.get(t);return void 0===n&&(n=++pe,be.set(t,n)),n}const me='<svg viewBox="0 0 20 20" fill="currentColor">\n<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />\n</svg>',ge='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>\n</svg>',ye='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n<line x1="18" y1="6" x2="6" y2="18"></line>\n<line x1="6" y1="6" x2="18" y2="18"></line>\n</svg>',fe=class extends u{constructor(){super(),this.pn="",this.bn=!1,this.vn=!1,this.mn="Select...",this.gn="",this.P=!1,this.yn=!1,this.fn=!1,this.wn=!0,this.xn=!1,this.kn=!1,this.zn="none",this.$n=!1,this.Cn=!1,this.En=null,this.Mn=e,this.Sn="Available",this.Tn="Selected",this._n="No options available",this.qn={open:!1,search:"",highlightedIndex:-1,filteredTags:[],selectedValues:[],mode:"desktop"},this.Dn=null,this.An=null,this.Ln=null,this.jn=null,this.Fn=null,this.Vn=0,this.In=null,this.On=null,this.Hn=null,this.Nn=null,this.j=null;const t=this.shadowRoot;b(t,{css:he,id:"ty-select-base"}),b(t,{css:'\n.select-stub.compact {\ndisplay: inline-flex;\nflex-wrap: nowrap;\nwidth: auto;\ngap: 0.5rem;\npadding: 0.5rem 2.25rem 0.5rem 0.875rem;\n}\n.select-stub.custom-trigger {\ndisplay: inline-block;\nwidth: auto;\nborder: none;\nbackground: none;\npadding: 0;\nmin-height: 0;\nborder-radius: 0;\n}\n.select-stub.custom-trigger:hover {\nborder: none;\n}\n.select-count {\nflex-shrink: 0;\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nmin-width: 1.25rem;\nheight: 1.25rem;\npadding: 0 0.375rem;\nborder-radius: 9999px;\nbackground: color-mix(in oklab, var(--select-accent, var(--ty-color-primary)) 15%, transparent);\ncolor: var(--select-accent-bold, var(--ty-color-primary-strong));\nfont-size: var(--ty-font-xs);\nfont-weight: var(--ty-font-semibold);\nfont-style: normal;\n}\n.select-count[hidden] {\ndisplay: none;\n}\n.select-clear {\nflex-shrink: 0;\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nwidth: 1rem;\nheight: 1rem;\npadding: 0;\nborder: none;\nbackground: none;\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\ncursor: pointer;\nborder-radius: var(--ty-radius-sm);\ntransition: var(--ty-local-transition, all 0.15s ease);\n}\n.select-stub .select-clear {\nmargin-right: -0.375rem;\n}\n.select-stub.compact .select-clear {\nmargin-right: -0.125rem;\n}\n.select-clear[hidden] {\ndisplay: none;\n}\n.select-clear:hover {\ncolor: var(--ty-color-danger);\nbackground-color: var(--ty-bg-danger-soft);\n}\n.select-clear svg {\nwidth: 100%;\nheight: 100%;\n}\n.select-stub .dropdown-placeholder {\nfont-style: normal;\nflex: 1 1 0%;\nmin-width: 0;\noverflow: hidden;\ntext-overflow: ellipsis;\nwhite-space: nowrap;\ncolor: var(--input-color, var(--ty-input-color));\n}\n.select-stub .dropdown-placeholder.placeholder-shown {\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\n}\n.select-stub .dropdown-placeholder[hidden] {\ndisplay: none;\n}\n.select-stub slot[name="selected"] {\ndisplay: none;\n}\n.select-stub.has-clone slot[name="selected"] {\ndisplay: block;\nflex: 1 1 0%;\nmin-width: 0;\noverflow: hidden;\n}\n.select-stub.compact.has-clone slot[name="selected"] {\nflex: 0 1 auto;\n}\n.select-stub ::slotted([slot="start"]),\n.select-stub ::slotted([slot="end"]) {\nflex-shrink: 0;\ncolor: var(--ty-text-soft);\n}\n.select-stub.compact .dropdown-placeholder {\nflex: 0 1 auto;\ncolor: var(--ty-text);\n}\n.dropdown-wrapper:has(.dropdown-chevron.open) .select-stub {\nopacity: 1;\npointer-events: auto;\n}\n.dropdown-dialog.open {\nfilter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.14)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.08));\n}\n.dropdown-header {\nbackground: var(--ty-surface-floating);\nborder: 1px solid var(--ty-floating-border);\nborder-bottom: none;\nborder-radius: var(--ty-radius-lg) var(--ty-radius-lg) 0 0;\npadding: var(--ty-spacing-2) var(--ty-spacing-2) var(--ty-spacing-1);\n}\n.dropdown-dialog.position-below .dropdown-header {\nmargin-bottom: 0;\n}\n.dropdown-dialog.position-above .dropdown-header {\nmargin-top: 0;\nborder-top: none;\nborder-bottom: 1px solid var(--ty-floating-border);\nborder-radius: 0 0 var(--ty-radius-lg) var(--ty-radius-lg);\npadding: var(--ty-spacing-1) var(--ty-spacing-2) var(--ty-spacing-2);\n}\n.dropdown-search-icon {\nposition: absolute;\ntop: 50%;\nleft: calc(var(--ty-spacing-2) + var(--ty-spacing-3));\ntransform: translateY(-50%);\nwidth: 1rem;\nheight: 1rem;\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\npointer-events: none;\n}\n.dropdown-search-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n.dropdown-mode-mobile .mobile-header-content .dropdown-search-icon {\nposition: static;\ntransform: none;\nflex-shrink: 0;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nwidth: 32px;\nheight: 32px;\ncolor: #ffffff;\n}\n.dropdown-mode-mobile .mobile-header-content .dropdown-search-icon svg {\nwidth: 18px;\nheight: 18px;\n}\n.dropdown-search-input {\nmin-height: 2.25rem;\npadding-right: var(--ty-spacing-2);\npadding-left: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n}\n.dropdown-search-chevron {\ndisplay: none;\n}\n.dropdown-dialog:focus,\n.dropdown-dialog:focus-visible {\noutline: none;\n}\n.dropdown-header[hidden] {\ndisplay: none;\n}\n.dropdown-header[hidden] ~ .dropdown-options-wrapper .dropdown-options {\nborder-top: 1px solid var(--ty-floating-border);\nborder-radius: var(--ty-radius-lg);\n}\n.mobile-search-input[hidden],\n.mobile-header-content .dropdown-search-icon[hidden] {\ndisplay: none;\n}\n.dropdown-options {\nflex-direction: column;\nflex-wrap: nowrap;\nalign-items: stretch;\ngap: 0;\npadding: var(--ty-spacing-1);\nborder-top: none;\nborder-radius: 0 0 var(--ty-radius-lg) var(--ty-radius-lg);\nbox-shadow: none;\ntransform: none;\ntransition: none;\nmax-height: 24rem;\n}\n.dropdown-dialog.position-below .dropdown-options {\nbox-shadow: none;\n}\n.dropdown-dialog.position-above .dropdown-options {\nborder-top: 1px solid var(--ty-floating-border);\nborder-bottom: none;\nborder-radius: var(--ty-radius-lg) var(--ty-radius-lg) 0 0;\n}\n.dropdown-loading {\nborder-top: none;\nborder-radius: 0 0 var(--ty-radius-lg) var(--ty-radius-lg);\nbox-shadow: none;\n}\n.dropdown-dialog.position-above .dropdown-loading {\nborder-top: 1px solid var(--ty-floating-border);\nborder-bottom: none;\nborder-radius: var(--ty-radius-lg) var(--ty-radius-lg) 0 0;\n}\n.dropdown-mode-mobile .section-content ::slotted(ty-option) {\ndisplay: block;\nwidth: 100%;\n}\n',id:"ty-select"})}onConnect(){this.shadowRoot.querySelectorAll("dialog").forEach(t=>{t.open&&t.close()}),this.render(),this.initializeState(),this.updateFormValue(),this.Hn=new MutationObserver(()=>{this.ensureOptionRoles(),this.qn.selectedValues.length>0&&this.syncSelectedTags(this.qn.selectedValues),this.updateSearchVisibility(),this.updateSelectionDisplay(),this.updateMobileSelectedState()}),this.Hn.observe(this,{childList:!0}),this.ensureOptionRoles(),this.F()}F(){this.j=k(this.shadowRoot,this.j,this.getProperty("flavor"),({base:t})=>(t=>de(t,"neutral"))(t))}onDisconnect(){this.shadowRoot.querySelectorAll("dialog").forEach(t=>{t.open&&t.close()}),this.Fn&&(document.removeEventListener("keydown",this.Fn),this.Fn=null),null!==this.In&&(clearTimeout(this.In),this.In=null),this.Bn(),this.Hn&&(this.Hn.disconnect(),this.Hn=null)}onPropertiesChanged(t){for(const{name:n,newValue:e}of t)switch(n){case"value":const t=this.parseValue(e);this.qn.selectedValues=t,this.isConnected&&this.shadowRoot&&(this.syncSelectedTags(t),this.updateSelectionDisplay(),this.updateMobileSelectedState());break;case"name":this.pn=e||"";break;case"flavor":this.F();break;case"multiple":this.bn=e,!e&&this.qn.selectedValues.length>1&&this.updateComponentValue([this.qn.selectedValues[0]],!1,"set",null);break;case"compact":this.vn=e;break;case"placeholder":this.mn=e||"Select...",this.isConnected&&this.shadowRoot&&this.updateSelectionDisplay();break;case"label":this.gn=e||"";break;case"disabled":this.P=e;break;case"readonly":this.yn=e;break;case"required":this.fn=e;break;case"noClear":this.wn=!e,this.isConnected&&this.shadowRoot&&this.updateSelectionDisplay();break;case"externalSearch":this.xn=e;break;case"notSearchable":this.$n=e,this.isConnected&&this.shadowRoot&&this.updateSearchVisibility();break;case"allowCreate":this.kn=e,this.isConnected&&this.shadowRoot&&this.updateSearchVisibility();break;case"createTransform":this.zn=e;break;case"size":this.Mn=e;break;case"debounce":this.Vn=e;break;case"available-label":this.Sn=e||"Available";break;case"selected-label":this.Tn=e||"Selected";break;case"no-options-message":this._n=e||"No options available";break;case"loading":this.Cn=e,this.applyLoadingState()}}applyLoadingState(){const t=this.shadowRoot;if(!t)return;const n=this.Cn?C():null;t.querySelectorAll(".dropdown-options-wrapper").forEach(t=>{if(t.classList.toggle("loading",this.Cn),this.Cn){t.setAttribute("aria-busy","true");const e=t.querySelector(".dropdown-loading-spinner");e&&n&&(e.innerHTML=n)}else t.removeAttribute("aria-busy")})}getFormValue(){const t=this.qn.selectedValues;if(this.pn&&t.length>0){if(!this.bn)return t[0];const n=new FormData;return t.forEach(t=>{n.append(this.pn,t)}),n}return this.pn&&!this.bn?"":null}focus(t){const n=this.querySelector(':scope > [slot="trigger"]'),e=this.shadowRoot?.querySelector(".select-stub"),i=n??e;i?i.focus(t):super.focus(t)}parseValue(t){return t&&"string"==typeof t&&""!==t.trim()?t.split(",").map(t=>t.trim()).filter(t=>""!==t):[]}initializeState(){const t=this.getProperty("value")||"";if(t){const n=this.parseValue(t);this.qn.selectedValues=n,this.syncSelectedTags(n),this.updateSelectionDisplay(),this.updateMobileSelectedState()}else this.resolveDeclarativeSelection()}resolveDeclarativeSelection(){if(this.getAttribute("value")||this.qn.selectedValues.length>0)return;const t=this.getTagElements().filter(t=>t.hasAttribute("selected")).map(t=>this.getTagData(t).value);t.length>0?this.updateComponentValue(t,!1):"loading"===document.readyState&&document.addEventListener("DOMContentLoaded",()=>{this.isConnected&&this.resolveDeclarativeSelection()},{once:!0})}getTagElements(){return Array.from(this.querySelectorAll("ty-option:not([cloned]), ty-tag:not([cloned])"))}getTagData(t){return{value:t.value||t.getAttribute("value")||t.textContent||"",text:t.getAttribute("label")||t.textContent||"",element:t}}selectTag(t){t.setAttribute("selected","")}deselectTag(t){t.removeAttribute("selected")}getSelectedValues(){return[...this.qn.selectedValues]}syncSelectedTags(t){const n=new Set(t);this.getTagElements().forEach(t=>{const e=this.getTagData(t).value,i=n.has(e),o=t.hasAttribute("selected");i&&!o?this.selectTag(t):!i&&o&&this.deselectTag(t),t.setAttribute("aria-selected",i+"")})}ensureOptionRoles(){this.getTagElements().forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","option"),t.hasAttribute("aria-selected")||t.setAttribute("aria-selected","false")})}updateComponentValue(t,n=!1,e="set",i=null){const o=this.getSelectedValues(),r=t.join(",");JSON.stringify(t.sort())!==JSON.stringify(o.sort())&&(this.setProperty("value",r),this.updateValidity(),n&&this.dispatchChangeEvent({value:this.bn?[...t]:t[0]??null,values:t,items:this.getSelectedItems(t),action:e,item:i}))}getSelectedItems(t){const n=new Map(this.getTagElements().map(t=>[this.getTagData(t).value,t]));return t.map(t=>{const e=n.get(t);return{value:t,label:e?.getAttribute("label")||e?.textContent?.trim()||t,flavor:e?.getAttribute("flavor")??null}})}calculatePosition(){const t=this.shadowRoot,n=t.querySelector(".select-stub"),e=t.querySelector(".dropdown-dialog");if(!n||!e)return;const i=n.getBoundingClientRect(),o=e.getBoundingClientRect(),r=Math.min(o.height||200,440),s=parseFloat(getComputedStyle(this).getPropertyValue("--ty-select-popup-width")),a=isNaN(s)?Math.max(i.width,320):s,l=this.getProperty("placement"),c=l?Gt(l):{side:"auto",align:this.getProperty("align")},d=nn({anchorRect:i,popupWidth:a,popupHeight:r,align:c.align,side:c.side,gap:8}),h=d.below,u=(h?d.topY:d.bottomY)-20,p=a+20+20;this.style.setProperty("--dropdown-x",d.x-20+"px"),this.style.setProperty("--dropdown-y",u+"px"),this.style.setProperty("--dropdown-width",p+"px"),this.style.setProperty("--dropdown-offset-x","0px"),this.style.setProperty("--dropdown-offset-y","0px"),this.style.setProperty("--dropdown-padding","20px"),h?(e.classList.add("position-below"),e.classList.remove("position-above")):(e.classList.add("position-above"),e.classList.remove("position-below")),this.style.setProperty("--dropdown-direction",h?"below":"above")}Pn(){if(!Nt())return;const t=this.shadowRoot,n=t.querySelector(".dropdown-options"),e=t.querySelector(".dropdown-options-wrapper");n&&e&&(this.Bn(),n.classList.add("ty-custom-scroll"),this.On=new Bt(n,{vertical:!0}),this.On.trackY&&e.appendChild(this.On.trackY))}Bn(){this.On&&(this.On.trackY?.remove(),this.On.destroy(),this.On=null)}openDropdown(){const t=this.shadowRoot,n=t.querySelector(".dropdown-dialog");if(!n)return;const e=t.querySelector(".select-stub");e&&e.setAttribute("aria-expanded","true");const i=`select-${this.id||"anon"}-${ve(this)}`;this.En=i,Sn(i),n.showModal(),this.calculatePosition(),n.classList.add("open"),this.qn.open=!0;const o=t.querySelector(".dropdown-chevron");o&&o.classList.add("open");const r=t.querySelector(".dropdown-search-chevron");r&&r.classList.add("open");const s=this.getTagElements().map(t=>this.getTagData(t));this.qn.filteredTags=s,this.qn.highlightedIndex=-1,this.updateOptionsVisibility(!0),this.Pn();const a=t.querySelector(".dropdown-search-input");a&&this.shouldShowSearch()&&setTimeout(()=>a.focus(),100),this.fireOpenEvent()}closeDropdown(){const t=this.shadowRoot,n=t.querySelector(".dropdown-dialog");if(!n)return;const e=t.querySelector(".select-stub");e&&e.setAttribute("aria-expanded","false"),this.Bn(),n.classList.remove("open"),n.classList.remove("position-above"),n.classList.remove("position-below"),n.close(),this.En&&(Tn(this.En),this.En=null),this.qn.open=!1,this.qn.highlightedIndex=-1;const i=t.querySelector(".dropdown-chevron");i&&i.classList.remove("open");const o=t.querySelector(".dropdown-search-chevron");o&&o.classList.remove("open");const r=""!==this.qn.search;this.qn.search="";const s=t.querySelector(".dropdown-search-input");if(s&&(s.value=""),this.xn)r&&(null!==this.In&&(clearTimeout(this.In),this.In=null),this.fireSearchEvent(""));else{const t=this.getTagElements().map(t=>this.getTagData(t));this.qn.filteredTags=t,this.updateTagVisibility(t,t),this.clearHighlights(t)}this.fireCloseEvent()}openMobileModal(){const t=this.shadowRoot,n=t.querySelector(".mobile-dialog");if(!n)return;const e=t.querySelector(".select-stub");e&&e.setAttribute("aria-expanded","true");const i=`select-${this.id||"anon"}-${ve(this)}`;this.En=i,Sn(i),n.showModal(),n.getBoundingClientRect(),n.classList.add("open"),this.qn.open=!0;const o=this.getTagElements().map(t=>this.getTagData(t));this.qn.filteredTags=o,this.updateTagVisibility(o,o),requestAnimationFrame(()=>{this.updateMobileSelectedState()}),this.fireOpenEvent()}closeMobileModal(){const t=this.shadowRoot,n=t.querySelector(".mobile-dialog");if(!n)return;const e=t.querySelector(".select-stub");e&&e.setAttribute("aria-expanded","false"),n.classList.remove("open"),n.close(),this.En&&(Tn(this.En),this.En=null),this.qn.open=!1,this.qn.highlightedIndex=-1;const i=""!==this.qn.search;this.qn.search="";const o=t.querySelector(".mobile-search-input");o&&(o.value=""),this.xn?i&&(null!==this.In&&(clearTimeout(this.In),this.In=null),this.fireSearchEvent("")):this.getTagElements().forEach(t=>t.removeAttribute("hidden")),this.fireCloseEvent()}handleStubClick(t){t.preventDefault(),t.stopPropagation(),this.P||this.yn||this.openDropdown()}handleClearClick(t){t.preventDefault(),t.stopPropagation(),this.P||this.yn||this.clear()}handleStubKeydown(t){this.P||this.yn||this.qn.open||"Enter"!==t.key&&" "!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.openDropdown())}handleTagClick(t){const n=t.target.closest("ty-option, ty-tag");n&&!n.hasAttribute("disabled")&&(t.preventDefault(),t.stopPropagation(),this.selectByTag(n))}selectByTag(t){const n=this.getTagData(t).value,e=this.getSelectedValues();if(!this.bn)return this.updateComponentValue([n],!0,"set",n),void("mobile"===this.qn.mode?this.closeMobileModal():this.closeDropdown());if(e.includes(n)){const t=e.filter(t=>t!==n);this.updateComponentValue(t,!0,"remove",n)}else this.updateComponentValue([...e,n],!0,"add",n)}tryCreateFromSearch(){if(!this.kn)return!1;const t=(this.qn.search||"").trim();if(!t)return!1;const n=t.toLowerCase(),e=this.getTagElements().map(t=>this.getTagData(t)).find(t=>t.value.toLowerCase()===n||t.text.toLowerCase()===n);if(e)return this.selectByTag(e.element),!0;const i=t,o="slug"===this.zn?i.trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"").replace(/_+/g,"_").replace(/^_|_$/g,""):i;if(!o)return!0;const r={value:o,label:i},s=new CustomEvent("create",{detail:r,bubbles:!0,composed:!0,cancelable:!0});if(this.dispatchEvent(s),s.defaultPrevented)return!0;const a=r.value,l=document.createElement("ty-option");if(l.setAttribute("value",a),l.textContent=i,this.appendChild(l),!this.bn)return this.updateComponentValue([a],!0,"create",a),"mobile"===this.qn.mode?this.closeMobileModal():this.closeDropdown(),!0;const c=this.getSelectedValues();return this.updateComponentValue([...c,a],!0,"create",a),this.clearSearchAfterCreate(),!0}clearSearchAfterCreate(){this.qn.search="",this.qn.highlightedIndex=-1;const t=this.shadowRoot;if(!t)return;const n=t.querySelector(".dropdown-search-input"),e=t.querySelector(".mobile-search-input");n&&(n.value=""),e&&(e.value="");const i=this.getTagElements().map(t=>this.getTagData(t));this.qn.filteredTags=i,this.updateTagVisibility(i,i),this.updateOptionsVisibility(!0),this.clearHighlights(i),this.updateMobileSelectedState(),(n??e)?.focus()}blockSearchClick(t){t.stopPropagation(),t.preventDefault()}handleSearchInput(t){"mobile"===this.qn.mode&&this.expandMobileSection("available");const n=t.target.value;if(this.qn.search=n,this.xn)return void this.dispatchSearchEvent(n);const e=this.getTagElements().map(t=>this.getTagData(t)),i=this.filterTags(e,n);this.qn.filteredTags=i,this.qn.highlightedIndex=-1,this.updateTagVisibility(i,e),this.updateOptionsVisibility(i.length>0),this.updateMobileSelectedState(),this.clearHighlights(e)}handleKeyboard(t){if(!this.qn.open)return;const n=this.shadowRoot.querySelector(".dropdown-search-input");if(t.target!==n&&document.activeElement===n)return;const e=this.qn.filteredTags,i=e.length,o=this.qn.highlightedIndex;switch(t.key){case"Escape":t.preventDefault(),t.stopPropagation(),"mobile"===this.qn.mode?this.closeMobileModal():this.closeDropdown();break;case"Enter":t.preventDefault(),t.stopPropagation(),o>=0&&i>o?this.selectByTag(e[o].element):this.tryCreateFromSearch();break;case"ArrowUp":t.preventDefault(),t.stopPropagation();const n=this.nextEnabledTagIndex(e,o,-1);this.qn.highlightedIndex=n,this.highlightTag(e,n);break;case"ArrowDown":t.preventDefault(),t.stopPropagation();const r=this.nextEnabledTagIndex(e,o,1);this.qn.highlightedIndex=r,this.highlightTag(e,r)}}nextEnabledTagIndex(t,n,e){const i=t.length;if(0===i)return-1;let o=-1===n?1===e?0:i-1:(n+e+i)%i;for(let r=0;i>r;r++){if(!t[o].element.hasAttribute("disabled"))return o;o=(o+e+i)%i}return-1}filterTags(t,n){if(!n||""===n.trim())return t;const e=n.toLowerCase();return t.filter(({text:t})=>t.toLowerCase().includes(e))}updateTagVisibility(t,n){const e=new Set(t.map(t=>t.value));n.forEach(({value:t,element:n})=>{e.has(t)?n.removeAttribute("hidden"):n.setAttribute("hidden","")})}updateOptionsVisibility(t){const n=this.shadowRoot.querySelector(".dropdown-options");n&&(n.style.display=t?"":"none")}clearHighlights(t){t.forEach(({element:t})=>{t.removeAttribute("highlighted")})}highlightTag(t,n){if(this.clearHighlights(t),n>=0&&t.length>n){const{element:e}=t[n];e.setAttribute("highlighted",""),e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}dispatchSearchEvent(t){null!==this.In&&(clearTimeout(this.In),this.In=null),this.Vn>0?this.In=window.setTimeout(()=>{this.fireSearchEvent(t),this.In=null},this.Vn):this.fireSearchEvent(t)}fireSearchEvent(t){this.dispatchEvent(new CustomEvent("search",{detail:{query:t,element:this},bubbles:!0,composed:!0}))}fireOpenEvent(){this.dispatchEvent(new CustomEvent("open",{detail:{mode:this.qn.mode,element:this}})),this.xn&&this.fireSearchEvent("")}fireCloseEvent(){this.dispatchEvent(new CustomEvent("close",{detail:{mode:this.qn.mode,element:this}}))}dispatchChangeEvent(t){this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,cancelable:!0}))}render(){this.qn.mode=ue()?"mobile":"desktop","mobile"===this.qn.mode?this.renderMobile():this.renderDesktop(),this.updateSearchVisibility(),this.applyLoadingState(),this.syncFieldChrome(),this.updateValidity()}syncFieldChrome(){const t=this.shadowRoot,n=t?.querySelector(".select-container");if(!t||!n)return;const e="select-label-"+ve(this);let i=n.querySelector(":scope > .ty-field-label");this.gn?(i||(i=document.createElement("label"),i.className="ty-field-label",i.id=e,n.prepend(i)),i.innerHTML=`${this.gn}${this.fn?`<span class="required-icon">${lt}</span>`:""}`):i?.remove();const o=t.querySelector(".select-stub");o&&(o.classList.toggle("disabled",this.P),o.classList.toggle("compact",this.vn),o.tabIndex=this.P?-1:0,o.toggleAttribute("disabled",this.P),this.P?o.setAttribute("aria-disabled","true"):o.removeAttribute("aria-disabled"),this.gn?o.setAttribute("aria-labelledby",e):o.removeAttribute("aria-labelledby")),t.querySelectorAll(".dropdown-search-input, .mobile-search-input").forEach(t=>t.disabled=this.P)}updateValidity(){if(this.disabled)this.applyValidity({});else if(this.required&&0===this.getSelectedValues().length){const t=this.shadowRoot?.querySelector(".select-stub");this.applyValidity({valueMissing:!0},"Please select a value",t??void 0)}else this.applyValidity({})}setupTriggerSlot(){const t=this.shadowRoot,n=t.querySelector(".select-stub"),e=t.querySelector('slot[name="trigger"]');if(!n||!e)return;const i=()=>{const t=e.assignedElements().length>0;n.classList.toggle("custom-trigger",t),this.toggleAttribute("has-trigger",t)};e.addEventListener("slotchange",i),i()}setupEventListeners(){const t=this.shadowRoot,n=t.querySelector(".select-stub"),e=t.querySelector("#options-slot"),i=t.querySelector(".dropdown-search-input");n&&(this.Dn=this.handleStubClick.bind(this),n.addEventListener("click",this.Dn),n.addEventListener("keydown",this.handleStubKeydown.bind(this)));const o=t.querySelector(".select-clear");o?.addEventListener("click",this.handleClearClick.bind(this)),this.setupTriggerSlot(),e&&(this.An=this.handleTagClick.bind(this),e.addEventListener("click",this.An)),i&&(this.Ln=this.handleSearchInput.bind(this),this.jn=this.blockSearchClick.bind(this),i.addEventListener("input",this.Ln),i.addEventListener("click",this.jn));const r=t.querySelector(".dropdown-dialog");r&&r.addEventListener("click",t=>{t.target===r&&this.closeDropdown()}),this.Fn=this.handleKeyboard.bind(this),document.addEventListener("keydown",this.Fn)}buildStubClasses(){const t=[];return this.P&&t.push("disabled"),this.vn&&t.push("compact"),t.join(" ")}renderDesktop(){const t=this.shadowRoot;if(!t.querySelector(".select-container")){const n=this.buildStubClasses(),e="select-listbox-"+ve(this),i="select-label-"+ve(this);t.innerHTML=`\n<div class="select-container dropdown-mode-desktop">\n${this.gn?`\n<label class="ty-field-label" id="${i}">\n${this.gn}\n${this.fn?`<span class="required-icon">${lt}</span>`:""}\n</label>\n`:""}\n<div class="dropdown-wrapper">\n<div class="dropdown-stub select-stub ${n}"\nrole="combobox"\naria-haspopup="listbox"\naria-expanded="false"\naria-controls="${e}"\n${this.gn?`aria-labelledby="${i}"`:""}\ntabindex="${this.P?"-1":"0"}"\n${this.P?'disabled aria-disabled="true"':""}>\n<slot name="trigger">\n<slot name="start"></slot>\n<slot name="selected"></slot>\n<span class="dropdown-placeholder">${this.mn}</span>\n<span class="select-count" hidden></span>\n<slot name="end"></slot>\n<button class="select-clear" type="button" aria-label="Clear selection" hidden>\n${ye}\n</button>\n<div class="dropdown-chevron">\n${me}\n</div>\n</slot>\n</div>\n<dialog class="dropdown-dialog">\n<div class="dropdown-header">\n<div class="dropdown-search-icon" aria-hidden="true">\n${ge}\n</div>\n<input\nclass="dropdown-search-input"\ntype="text"\nplaceholder="Search..."\n${this.P?"disabled":""}\n/>\n<div class="dropdown-search-chevron">\n${me}\n</div>\n</div>\n<div class="dropdown-options-wrapper">\n<div class="dropdown-options" id="${e}" role="listbox" ${this.bn?'aria-multiselectable="true"':""}>\n<slot id="options-slot"></slot>\n</div>\n<div class="dropdown-loading" aria-hidden="true">\n<slot name="loading">\n<span class="dropdown-loading-spinner"></span>\n<span class="dropdown-loading-text">Searching…</span>\n</slot>\n</div>\n</div>\n</dialog>\n</div>\n</div>\n`,this.setupEventListeners()}this.updateSelectionDisplay()}renderMobile(){const t=this.shadowRoot;if(!t.querySelector(".select-container")){const n=this.buildStubClasses(),e="select-listbox-"+ve(this),i="select-label-"+ve(this);t.innerHTML=`\n<div class="select-container dropdown-mode-mobile">\n${this.gn?`\n<label class="ty-field-label" id="${i}">\n${this.gn}\n${this.fn?`<span class="required-icon">${lt}</span>`:""}\n</label>\n`:""}\n<div class="dropdown-wrapper">\n<div class="dropdown-stub select-stub ${n}"\nrole="combobox"\naria-haspopup="listbox"\naria-expanded="false"\naria-controls="${e}"\n${this.gn?`aria-labelledby="${i}"`:""}\ntabindex="${this.P?"-1":"0"}"\n${this.P?'disabled aria-disabled="true"':""}>\n<slot name="trigger">\n<slot name="start"></slot>\n<slot name="selected"></slot>\n<span class="dropdown-placeholder">${this.mn}</span>\n<span class="select-count" hidden></span>\n<slot name="end"></slot>\n<button class="select-clear" type="button" aria-label="Clear selection" hidden>\n${ye}\n</button>\n<div class="dropdown-chevron">\n${me}\n</div>\n</slot>\n</div>\n<dialog class="mobile-dialog">\n<div class="mobile-dialog-content">\n\x3c!-- HEADER (matches dropdown.ts) --\x3e\n\n<div class="mobile-search-header">\n${this.gn?`<span class="mobile-header-label">${this.gn}</span>`:""}\n<div class="mobile-header-content">\n<div class="dropdown-search-icon" aria-hidden="true">\n${ge}\n</div>\n<input\nclass="mobile-search-input"\ntype="text"\nplaceholder="${this.gn?`Search ${this.gn}...`:"Search..."}"\nautofocus\n${this.P?"disabled":""}\n/>\n<button class="mobile-close-button" type="button" aria-label="Close">\n<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n<line x1="18" y1="6" x2="6" y2="18"></line>\n<line x1="6" y1="6" x2="18" y2="18"></line>\n</svg>\n</button>\n</div>\n</div>\n\n\x3c!-- BODY: options list with toggleable selected state --\x3e\n<div class="mobile-body" data-expanded="available">\n\x3c!-- SELECTED STRIP (pinned above the list, collapses when empty) --\x3e\n<div class="mobile-selected-section" data-empty="true">\n<button class="section-header" type="button" data-section="selected" aria-expanded="false">\n<span class="section-title">${this.Tn} <span class="section-count">(0)</span></span>\n${me}\n</button>\n<div class="section-content mobile-selected-chips"></div>\n</div>\n\x3c!-- AVAILABLE LIST (always visible, takes remaining space) --\x3e\n<div class="mobile-available-section" data-empty="false">\n<button class="section-header" type="button" data-section="available" aria-expanded="true">\n<span class="section-title">${this.Sn} <span class="section-count"></span></span>\n${me}\n</button>\n<div class="section-content dropdown-options-wrapper" id="${e}" role="listbox" ${this.bn?'aria-multiselectable="true"':""}>\n<slot id="options-slot"></slot>\n<div class="empty-state">${this._n}</div>\n<div class="dropdown-loading" aria-hidden="true">\n<slot name="loading">\n<span class="dropdown-loading-spinner"></span>\n<span class="dropdown-loading-text">Searching…</span>\n</slot>\n</div>\n</div>\n</div>\n</div>\n</div>\n</dialog>\n</div>\n</div>\n`,this.setupMobileEventListeners()}this.updateSelectionDisplay()}setupMobileEventListeners(){this.Fn||(this.Fn=this.handleKeyboard.bind(this),document.addEventListener("keydown",this.Fn));const t=this.shadowRoot,n=t.querySelector(".select-stub"),e=t.querySelector("#options-slot"),i=t.querySelector(".mobile-search-input"),o=t.querySelector(".mobile-close-button"),r=t.querySelector(".mobile-dialog");n&&(n.addEventListener("click",t=>this.handleMobileStubClick(t)),n.addEventListener("keydown",t=>this.handleMobileStubKeydown(t)));const s=t.querySelector(".select-clear");s?.addEventListener("click",this.handleClearClick.bind(this)),this.setupTriggerSlot(),e&&e.addEventListener("click",t=>this.handleMobileTagClick(t)),i&&i.addEventListener("input",t=>this.handleSearchInput(t)),t.querySelectorAll(".mobile-body .section-header").forEach(t=>{t.addEventListener("click",()=>this.expandMobileSection("selected"===t.dataset.section?"selected":"available"))}),o&&o.addEventListener("click",()=>this.closeMobileModal()),r&&(r.addEventListener("click",t=>{t.target===r&&this.closeMobileModal()}),r.addEventListener("cancel",t=>{t.preventDefault(),this.closeMobileModal()}))}handleMobileStubClick(t){t.preventDefault(),t.stopPropagation(),this.P||this.yn||this.openMobileModal()}handleMobileStubKeydown(t){this.P||this.yn||this.qn.open||"Enter"!==t.key&&" "!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.openMobileModal())}handleMobileTagClick(t){this.handleTagClick(t)}updateMobileSelectedState(){if("mobile"!==this.qn.mode)return;const t=this.shadowRoot;this.renderMobileSelectedChips();const n=t.querySelector(".mobile-available-section");if(n){const t=this.getTagElements().filter(t=>!t.hasAttribute("hidden")&&!t.hasAttribute("selected")).length;n.setAttribute("data-empty",(0===t)+""),this.setMobileSectionTitle(n,this.Sn,t)}}setMobileSectionTitle(t,n,e){const i=t.querySelector(".section-title");if(!i)return;const o=document.createElement("span");o.className="section-count",o.textContent=`(${e})`,i.replaceChildren(n+" ",o)}expandMobileSection(t){const n=this.shadowRoot,e=n?.querySelector(".mobile-body");e&&("selected"===t&&0===this.qn.selectedValues.length||(e.dataset.expanded=t,n.querySelectorAll(".mobile-body .section-header").forEach(n=>{n.setAttribute("aria-expanded",(n.dataset.section===t)+"")})))}renderMobileSelectedChips(){const t=this.shadowRoot,n=t.querySelector(".mobile-selected-section"),e=t.querySelector(".mobile-selected-chips");if(!n||!e)return;const i=this.qn.selectedValues;n.setAttribute("data-empty",(0===i.length)+""),this.setMobileSectionTitle(n,this.Tn,i.length),0===i.length&&this.expandMobileSection("available");const o=t=>{const n=this.getTagElements().find(n=>this.getTagData(n).value===t);return n?this.getTagData(n).text:t};e.textContent="";for(const r of i){const t=document.createElement("button");t.type="button",t.className="mobile-selected-chip",t.dataset.value=r,t.setAttribute("aria-label","Remove "+o(r)),t.innerHTML='<span class="chip-label"></span>'+ye,t.querySelector(".chip-label").textContent=o(r),t.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.deselectValue(r)}),e.appendChild(t)}}shouldShowSearch(){return!!this.xn||!!this.kn||!this.$n&&this.getTagElements().length>7}updateSearchVisibility(){const t=this.shadowRoot;if(!t)return;const n=this.shouldShowSearch(),e=t.querySelector(".dropdown-header");e&&(e.hidden=!n);const i=t.querySelector(".mobile-search-input");i&&(i.hidden=!n);const o=t.querySelector(".mobile-header-content .dropdown-search-icon");o&&(o.hidden=!n)}updateSelectionDisplay(){const t=this.shadowRoot.querySelector(".select-stub");if(!t)return;const n=this.qn.selectedValues,e=n.length;t.classList.toggle("has-selection",e>0),t.classList.toggle("compact",this.vn);const i=t.querySelector(".select-count");i&&(i.textContent=e+"",i.hidden=0===e||!this.bn||!this.vn);const o=t.querySelector(".select-clear");o&&(o.hidden=!(e>0&&this.wn&&!this.P&&!this.yn));const r=!this.bn&&e>0?n[0]:null;this.syncSelectedClone(r);const s=null!==this.Nn;t.classList.toggle("has-clone",s);const a=t.querySelector(".dropdown-placeholder");a&&(a.hidden=s,e>0&&this.bn&&!this.vn?(a.textContent=this.getSelectedItems(n).map(t=>t.label).join(", "),a.classList.remove("placeholder-shown")):null!==r?(a.textContent=n.join(", "),a.classList.remove("placeholder-shown")):(a.textContent=this.mn,a.classList.add("placeholder-shown")))}syncSelectedClone(t){const n=this.querySelector(':scope > [cloned][slot="selected"]');if(n?.getAttribute("value")===t&&(null===t||0!==n.childNodes.length||0>=(this.getTagElements().find(n=>this.getTagData(n).value===t)?.childNodes.length??0)))return void(this.Nn=n);if(n?.remove(),null===t)return void(this.Nn=null);const e=this.getTagElements().find(n=>this.getTagData(n).value===t);if(e){const t=e.cloneNode(!0);t.removeAttribute("selected"),t.setAttribute("slot","selected"),t.setAttribute("cloned","true"),this.appendChild(t),this.Nn=t,0===e.childNodes.length&&"loading"===document.readyState&&document.addEventListener("DOMContentLoaded",()=>{this.isConnected&&this.updateSelectionDisplay()},{once:!0})}else if(this.Nn?.getAttribute("value")===t){const t=this.Nn.cloneNode(!0);this.appendChild(t),this.Nn=t}}deselectValue(t){const n=this.getSelectedValues();n.includes(t)&&this.updateComponentValue(n.filter(n=>n!==t),!0,"remove",t)}clear(){this.updateComponentValue([],!0,"clear",null)}get value(){return this.getSelectedValues().join(",")}set value(t){this.setProperty("value",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get multiple(){return this.getProperty("multiple")}set multiple(t){this.setProperty("multiple",t)}get compact(){return this.getProperty("compact")}set compact(t){this.setProperty("compact",t)}get placeholder(){return this.getProperty("placeholder")}set placeholder(t){this.setProperty("placeholder",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get loading(){return this.getProperty("loading")}set loading(t){this.setProperty("loading",t)}get readonly(){return this.getProperty("readonly")}set readonly(t){this.setProperty("readonly",t)}get noClear(){return this.getProperty("noClear")}set noClear(t){this.setProperty("noClear",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get notSearchable(){return this.getProperty("notSearchable")}set notSearchable(t){this.setProperty("notSearchable",t)}get externalSearch(){return this.getProperty("externalSearch")}set externalSearch(t){this.setProperty("externalSearch",t)}get debounce(){return this.getProperty("debounce")}set debounce(t){this.setProperty("debounce","string"==typeof t?parseInt(t,10):t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get align(){return this.getProperty("align")}set align(t){this.setProperty("align",t)}get placement(){return this.getProperty("placement")}set placement(t){this.setProperty("placement",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get form(){return this.$.form}};fe.properties={value:{type:"string",visual:!0,formValue:!0,emitChange:!1,default:"",coerce:t=>Array.isArray(t)?t.join(","):null==t?"":t+""},name:{type:"string",default:""},multiple:{type:"boolean",visual:!0,default:!1},compact:{type:"boolean",visual:!0,default:!1},placeholder:{type:"string",visual:!0,default:"Select..."},label:{type:"string",visual:!0,default:""},disabled:{type:"boolean",visual:!0,default:!1},readonly:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},noClear:{type:"boolean",visual:!0,default:!1},externalSearch:{type:"boolean",visual:!0,default:!1,aliases:{"external-search":!0}},allowCreate:{type:"boolean",visual:!0,default:!1,aliases:{"allow-create":!0}},createTransform:{type:"string",visual:!1,default:"none",aliases:{"create-transform":!0},coerce:t=>"slug"===t?"slug":"none"},notSearchable:{type:"boolean",visual:!0,default:!1},align:{type:"string",visual:!0,default:"start",validate:t=>["start","center","end"].includes(t),coerce:t=>"end"===t?"end":"center"===t?"center":"start"},placement:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},debounce:{type:"number",default:0,validate:t=>t>=0&&5e3>=t,coerce:t=>{const n=+t;return isNaN(n)?0:Math.max(0,Math.min(5e3,n))}},"available-label":{type:"string",visual:!0,default:"Available"},"selected-label":{type:"string",visual:!0,default:"Selected"},"no-options-message":{type:"string",visual:!0,default:"No options available"},loading:{type:"boolean",visual:!0,default:!1},flavor:{type:"string",visual:!0,default:"neutral"}};let we=fe;function xe(t,n){return t.replace(/\{([\w-]+)\}/g,(t,e)=>n[e]??t)}customElements.get("ty-select")||customElements.define("ty-select",we);class TySelectedOptions extends HTMLElement{constructor(){super(...arguments),this.Wn=null,this.Rn=()=>this.renderChips(),this.Hn=null,this.Yn=null,this.Un=null,this.Xn=!1,this.Kn=()=>{this.Xn=!0},this.Zn=()=>{this.Xn=!1,this.renderChips()}}static get observedAttributes(){return["for"]}connectedCallback(){this.style.display||(this.style.display="contents"),this.bind(),this.renderChips(),"loading"===document.readyState&&document.addEventListener("DOMContentLoaded",()=>{this.isConnected&&this.renderChips()},{once:!0}),this.Hn=new MutationObserver(()=>{this.template()!==this.Un&&this.renderChips()}),this.Hn.observe(this,{childList:!0})}disconnectedCallback(){this.unbind(),this.Hn?.disconnect(),this.Hn=null}attributeChangedCallback(){this.isConnected&&(this.bind(),this.renderChips())}resolvePicker(){const t=this.getAttribute("for");return(t?document.getElementById(t):this.previousElementSibling)??null}bind(){const t=this.resolvePicker();t!==this.Wn&&(this.unbind(),this.Wn=t,this.Wn?.addEventListener("change",this.Rn),this.Wn?.addEventListener("open",this.Kn),this.Wn?.addEventListener("close",this.Zn),this.Wn&&(this.Yn=new MutationObserver(()=>this.renderChips()),this.Yn.observe(this.Wn,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["selected"]})))}unbind(){this.Wn?.removeEventListener("change",this.Rn),this.Wn?.removeEventListener("open",this.Kn),this.Wn?.removeEventListener("close",this.Zn),this.Yn?.disconnect(),this.Yn=null,this.Wn=null,this.Xn=!1}values(){return(this.Wn?.value??"").split(",").map(t=>t.trim()).filter(Boolean)}template(){return this.querySelector(":scope > template")}option(t){return this.Wn?.querySelector(`[value="${CSS.escape(t)}"]:not([cloned])`)}context(t){const n=this.option(t),e={value:t,label:n?.getAttribute("label")||n?.textContent?.trim()||t,flavor:n?.getAttribute("flavor")??""};if(n)for(const i of Array.from(n.attributes))i.name.startsWith("data-")&&(e[i.name]=i.value);return e}templateSource(t){if(t.content.hasChildNodes())return t.content;const n=document.createDocumentFragment();return t.childNodes.forEach(t=>n.appendChild(t.cloneNode(!0))),n}stampTemplate(t,n){const e=this.context(n),i=this.templateSource(t).cloneNode(!0),o=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(let r=o.nextNode();r;r=o.nextNode())if(r.nodeType===Node.TEXT_NODE)r.textContent?.includes("{")&&(r.textContent=xe(r.textContent,e));else{const t=r;for(const n of Array.from(t.attributes)){if(!n.value.includes("{"))continue;const i=xe(n.value,e);!/^\{[\w-]+\}$/.test(n.value)||""!==i&&i!==n.value?t.setAttribute(n.name,i):t.removeAttribute(n.name)}}for(const r of Array.from(i.children))r.addEventListener("dismiss",t=>{t.stopPropagation(),this.deselect(n)});return i}defaultChip(t){const n=this.context(t),e=this.option(t),i=document.createElement("ty-tag");return i.setAttribute("value",t),i.setAttribute("dismissible","true"),n.flavor&&i.setAttribute("flavor",n.flavor),e&&!e.hasAttribute("label")&&e.hasChildNodes()?e.childNodes.forEach(t=>i.appendChild(t.cloneNode(!0))):i.textContent=n.label,i.addEventListener("dismiss",()=>this.deselect(t)),i}renderChips(){if(this.Xn)return;const t=this.template();if(this.Un=t,!this.Wn)return void this.replaceChildren(...t?[t]:[]);const n=document.createDocumentFragment();t&&n.appendChild(t);for(const e of this.values())n.appendChild(t?this.stampTemplate(t,e):this.defaultChip(e));this.replaceChildren(n)}deselect(t){if(!this.Wn)return;const n=this.Wn;"function"==typeof n.deselectValue?n.deselectValue(t):(n.value=this.values().filter(n=>n!==t).join(","),this.renderChips())}}customElements.get("ty-selected-options")||customElements.define("ty-selected-options",TySelectedOptions),customElements.get("ty-selected-tags")||customElements.define("ty-selected-tags",class extends TySelectedOptions{});const ke=new WeakMap,ze=new WeakMap,$e=new WeakMap,Ce=new WeakMap,Ee=new WeakMap;let Me=0;const Se=()=>{Me++};addEventListener("pointerdown",Se,{capture:!0,passive:!0}),addEventListener("keydown",Se,{capture:!0,passive:!0});const Te=new WeakMap;let _e=0;function qe(t){return{placement:t.getAttribute("placement")||"top",fixed:t.hasAttribute("fixed")}}function De(t){return Array.from(t.querySelectorAll(":scope > ty-tab"))}function Ae(t){return t.getAttribute("id")}function Le(t,n){return t.querySelector(`:scope > [slot='label-${n}']`)}function je(t,n){const e=Ae(n);return e&&function(t,n){return null!==Le(t,n)}(t,e)?"slot":"text"}function Fe(t){return t.hasAttribute("disabled")}function Ve(t,n){const e=t.findIndex(t=>Ae(t)===n);return 0>e?void 0:e}function Ie(t){return $e.get(t)??null}function Oe(t,n){const e=n.map(Ae).filter(t=>!!t),i=t.getAttribute("active");if(i&&e.includes(i))return i;const o=$e.get(t);return o&&e.includes(o)?o:e[0]??null}function He(t,n){t.setAttribute("active",n),Ze(t,!0)}function Ne(t,n,e){e.preventDefault(),e.stopPropagation(),He(t,n)}function Be(t){const n=ke.get(t);if(!n)return;const e=t.shadowRoot;e&&(n.tabClickHandlers.forEach((t,n)=>{const i=e.querySelector(`[data-tab-id='${n}']`);i&&i.removeEventListener("click",t)}),n.tabKeydownHandlers.forEach((t,n)=>{const i=e.querySelector(`[data-tab-id='${n}']`);i&&i.removeEventListener("keydown",t)}),n.tabClickHandlers.clear(),n.tabKeydownHandlers.clear())}function Pe(t,n,e){Be(t);const i={tabClickHandlers:new Map,tabKeydownHandlers:new Map};e.forEach(e=>{const o=Ae(e);if(!o)return;const r=n.querySelector(`[data-tab-id='${o}']`);if(r){const e=n=>Ne(t,o,n),s=e=>function(t,n,e,i){if(!["ArrowRight","ArrowLeft","Home","End"].includes(i.key))return;const o=Array.from(n.querySelectorAll(".tab-buttons [data-tab-id]:not([disabled])")).map(t=>t.getAttribute("data-tab-id")),r=o.indexOf(e);if(0>r||0===o.length)return;i.preventDefault();const s="Home"===i.key?o[0]:"End"===i.key?o[o.length-1]:"ArrowRight"===i.key?o[(r+1)%o.length]:o[(r-1+o.length)%o.length];s!==e&&(Ne(t,s,i),requestAnimationFrame(()=>{n.querySelector(`.tab-buttons [data-tab-id='${s}']`)?.focus()}))}(t,n,o,e);r.addEventListener("click",e),r.addEventListener("keydown",s),i.tabClickHandlers.set(o,e),i.tabKeydownHandlers.set(o,s)}}),ke.set(t,i)}function We(t){return`translateX(${-100*t}%)`}function Re(t){if(!t)return;const n=++_e+"";t.setAttribute("data-snap",n),requestAnimationFrame(()=>requestAnimationFrame(()=>{t.getAttribute("data-snap")===n&&t.removeAttribute("data-snap")}))}function Ye(t,n,e){t.getAttribute(n)!==e&&t.setAttribute(n,e)}function Ue(t,n,e){De(t).forEach(i=>{const o=Ae(i);if(!o)return;const r=n.querySelector(`[data-tab-id='${o}']`),s=o===e;if(r){r.setAttribute("aria-selected",s+""),r.setAttribute("tabindex",s?"0":"-1"),r.setAttribute("data-active",s+"");const n=Le(t,o);n&&Ye(n,"data-active",s+"")}})}function Xe(t,n){!function(t,n){const e=t.shadowRoot;if(!e)return;let i=Ce.get(t);if(!i){i=new CSSStyleSheet,i.replaceSync(":host {} ::slotted(ty-tab) {}");const n=i.cssRules[1].style;n.setProperty("opacity","0","important"),n.setProperty("visibility","hidden","important"),n.setProperty("pointer-events","none","important"),e.adoptedStyleSheets=[...e.adoptedStyleSheets,i],Ce.set(t,i)}const o=i.cssRules[0].style;for(const r of["width","height"]){const n=t.getAttribute(r);n?o.setProperty(r,n,"important"):o.removeProperty(r)}i.cssRules[1].selectorText=n?`::slotted(ty-tab:not(#${CSS.escape(n)}))`:"::slotted(ty-tab)"}(t,n),De(t).forEach(t=>{const e=Ae(t);t.setShown?.(!!e&&e===n),e&&Ye(t,"data-active",(e===n)+"")})}function Ke(t,n,e=!1){const i=t.shadowRoot;if(!i)return;const o=i.querySelector(".marker-wrapper");if(!o)return;const r=function(t,n,e){const i=n.querySelector(`[data-tab-id='${e}']`),o=n.querySelector(".tab-buttons");return i&&o?{left:i.offsetLeft,top:i.offsetTop,width:i.offsetWidth,height:i.offsetHeight}:null}(0,i,n);if(!r)return;const s=e||!o.style.left||0===o.offsetWidth;s&&(o.style.transition="none"),o.style.left=r.left+"px",o.style.top=r.top+"px",o.style.width=r.width+"px",o.style.height=r.height+"px",s&&(o.style.transition="")}function Ze(t,n=!1){const e=t.shadowRoot;if(!e)return;const i=De(t),o=$e.get(t)??null,r=Oe(t,i),s=(r?Ve(i,r):void 0)??0,a=e.querySelector(".tabs-container");if(r===o){const t=e.querySelector(".panels-wrapper");return void(t&&t.style.transform!==We(s)&&(Re(a),t.style.transform=We(s)))}$e.set(t,r);const l=null===o,c=!n&&null!==r&&Te.get(t)===r;Te.delete(t);const d=t.getAttribute("active");l&&d&&d!==r&&Te.set(t,d);const h=!n&&(l||c||Ee.get(t)===Me);if(l?Ee.set(t,Me):c||Ee.delete(t),h&&Re(a),function(t,n){const e=t.shadowRoot?.querySelector(".panels-wrapper");e&&(e.style.transform=We(n))}(t,s),Ue(t,e,r||""),Xe(t,r),!r||l)return;if(Ke(t,r,h),ni(t,r,!h),e.querySelectorAll(".tab-overflow-item").forEach(t=>{t.setAttribute("data-active",(t.dataset.tabId===r)+"")}),i[s]?.resetScroll?.(),c)return;const u=Ve(i,o);!function(t,n,e,i,o){const r=new CustomEvent("ty-tab-change",{detail:{activeId:n,activeIndex:e,previousId:i,previousIndex:o},bubbles:!0,cancelable:!1});t.dispatchEvent(r)}(t,r,s,void 0===u?null:o,u??null),i[s]?.Jn?.(s)}function Je(t,n){const e=Ae(n);if(e&&"slot"===je(t,n)){const n=Le(t,e);return n?.textContent?.trim()||e}return n.getAttribute("label")||"Tab"}function Ge(t){t.querySelector(".tab-overflow-trigger")?.remove()}function Qe(t){const n=t.shadowRoot;if(!n)return;const e=n.querySelector(".tab-buttons"),i=n.querySelector(".tab-strip");if(!e||!i)return;if(qe(t).fixed)return Ge(n),i.classList.add("unclipped"),i.style.removeProperty("--fade-left"),void i.style.removeProperty("--fade-right");const o=i.scrollLeft;if(Ge(n),0>=i.clientWidth)return;const r=i.querySelectorAll(".tab-button"),s=r[r.length-1],a=(s?s.offsetLeft+s.offsetWidth:0)-i.clientWidth;if(i.classList.toggle("unclipped",1>=a),1>=a)return i.scrollLeft=o,void ti(i);!function(t,n,e){const i=Oe(t,e),o=document.createElement("button");o.className="tab-overflow-trigger",o.type="button",o.setAttribute("aria-label",e.length+" tabs"),o.textContent="⋯";const r=document.createElement("ty-popup");r.setAttribute("placement","bottom");const s=document.createElement("div");s.className="tab-overflow-menu",s.setAttribute("role","menu"),e.forEach(n=>{const e=Ae(n);if(!e)return;const o=document.createElement("button");o.type="button",o.className="tab-overflow-item",o.setAttribute("role","menuitem"),o.setAttribute("data-tab-id",e),o.setAttribute("data-active",(e===i)+""),o.textContent=Je(t,n),Fe(n)?o.disabled=!0:o.addEventListener("click",()=>{He(t,e),r.closePopup?.()}),s.appendChild(o)}),r.appendChild(s),o.appendChild(r),n.appendChild(o)}(t,e,De(t)),a>e.clientWidth-i.clientWidth||Ge(n),i.scrollLeft=o,ti(i)}function ti(t){const n=t.scrollWidth-t.clientWidth,e=t=>(t>1?Math.min(28,t):0)+"px";t.style.setProperty("--fade-left",e(t.scrollLeft)),t.style.setProperty("--fade-right",e(n-t.scrollLeft))}function ni(t,n,e){const i=t.shadowRoot;if(!i)return;const o=i.querySelector(".tab-strip"),r=i.querySelector(`[data-tab-id='${n}']`);if(!o||!r||0>=o.clientWidth)return;const s=Math.max(0,Math.min(r.offsetLeft+r.offsetWidth/2-o.clientWidth/2,o.scrollWidth-o.clientWidth));if(Math.round(s)!==Math.round(o.scrollLeft)){const t=window.matchMedia("(prefers-reduced-motion: reduce)").matches;o.scrollTo({left:s,behavior:e&&!t?"smooth":"auto"})}}function ei(t){const n=t.shadowRoot;if(!n)return;const{placement:e,fixed:i}=qe(t),o=De(t),r=Oe(t,o),s=r?Ve(o,r)??0:0;o.forEach(n=>n.setPanelLabel?.(Je(t,n)));const a=n.querySelector(".tabs-container"),l=n.querySelector(".tab-buttons"),c=n.querySelector(".tab-strip"),d=n.querySelector(".panels-viewport");if(b(n,{css:'\n:host {\ndisplay: block;\nwidth: 100%;\nheight: 400px;\nbox-sizing: border-box;\n}\n.tabs-container {\nwidth: 100%;\nheight: 100%;\ndisplay: flex;\nflex-direction: column;\nposition: relative;\nbox-sizing: border-box;\n}\n.tabs-container[data-placement="bottom"] {\nflex-direction: column-reverse;\n}\n.tab-buttons {\ndisplay: flex;\ngap: 0;\nflex-shrink: 0;\nposition: relative;\nbackground: transparent;\n}\n.tab-buttons::after {\ncontent: "";\nposition: absolute;\nleft: 0;\nright: 0;\nbottom: 0;\nheight: 1px;\nbackground: var(--ty-tabs-separator, var(--ty-border));\npointer-events: none;\n}\n.tabs-container[data-placement="bottom"] .tab-buttons::after {\nbottom: auto;\ntop: 0;\n}\n.tab-strip {\ndisplay: flex;\nflex: 1 1 auto;\nmin-width: 0;\nposition: relative;\nz-index: 1;\noverflow-x: auto;\nscrollbar-width: none;\n--fade-left: 0px;\n--fade-right: 0px;\n-webkit-mask-image: linear-gradient(to right,\ntransparent, black var(--fade-left),\nblack calc(100% - var(--fade-right)), transparent);\nmask-image: linear-gradient(to right,\ntransparent, black var(--fade-left),\nblack calc(100% - var(--fade-right)), transparent);\n}\n.tab-strip::-webkit-scrollbar {\ndisplay: none;\n}\n.tab-strip.unclipped {\noverflow: visible;\n-webkit-mask-image: none;\nmask-image: none;\n}\n.marker-wrapper {\nposition: absolute;\nz-index: 0;\npointer-events: none;\ntransition: left var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out),\nwidth var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out),\nheight var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out),\ntop var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out);\n}\n.default-marker {\nposition: absolute;\nbottom: 0;\nleft: 0;\nheight: 3px;\nwidth: 100%;\nbackground: var(--ty-color-primary);\npointer-events: none;\n}\n.tabs-container[data-placement="bottom"] .default-marker {\nbottom: auto;\ntop: 0;\n}\n::slotted([slot="marker"]) {\ndisplay: block;\nwidth: 100%;\nheight: 100%;\nbox-sizing: border-box;\n}\n.tab-button {\nmin-width: var(--ty-tab-min-width, 72px);\nflex-shrink: 0;\npadding: 6px 12px;\nborder: none;\nbackground: transparent;\ncursor: pointer;\nfont: inherit;\ncolor: var(--ty-text-soft);\ntransition: var(--ty-local-transition, color 200ms, background-color 200ms);\nwhite-space: nowrap;\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\ngap: 8px;\nfont-weight: var(--ty-font-bold);\nfont-size: var(--ty-font-sm);\nposition: relative;\nz-index: 10;\n}\n.tabs-container[data-fixed] .tab-button {\nflex: 1 1 0;\nmin-width: 0;\n}\n.tabs-container[data-fixed] .tab-label {\noverflow: hidden;\ntext-overflow: ellipsis;\nwhite-space: nowrap;\n}\n.tab-button[aria-selected=true] {\ncolor: var(--ty-text-strong);\n}\n.tab-button[disabled] {\nopacity: 0.5;\ncursor: not-allowed;\npointer-events: none;\n}\n.tab-button:focus-visible {\noutline: 2px solid var(--ty-color-primary);\noutline-offset: -2px;\n}\n.tab-overflow-trigger {\nflex-shrink: 0;\nalign-self: center;\nmin-width: 36px;\nheight: 24px;\nmargin: 0 8px;\npadding: 0 10px;\nborder: 1px solid var(--ty-border);\nborder-radius: 9999px;\nbackground: transparent;\ncursor: pointer;\ncolor: var(--ty-text-soft);\nfont-size: 16px;\nline-height: 1;\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nposition: relative;\nz-index: 10;\ntransition: color 200ms, border-color 200ms;\n}\n.tab-overflow-trigger:hover {\ncolor: var(--ty-text-strong);\nborder-color: var(--ty-text-soft);\n}\n.tab-overflow-trigger:focus-visible {\noutline: 2px solid var(--ty-color-primary);\noutline-offset: -2px;\n}\n.tab-overflow-menu {\ndisplay: flex;\nflex-direction: column;\nmin-width: 160px;\nmax-height: 300px;\noverflow-y: auto;\npadding: var(--ty-spacing-2, 4px);\nbackground: var(--ty-surface-floating);\nborder-radius: var(--ty-radius-md);\nbox-shadow: var(--ty-shadow-md, 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1));\n}\n.tab-overflow-item {\npadding: var(--ty-spacing-2, 6px) var(--ty-spacing-3, 12px);\nborder: none;\nbackground: transparent;\ntext-align: left;\ncursor: pointer;\nborder-radius: var(--ty-radius-md);\ncolor: var(--ty-text);\nfont: inherit;\nfont-size: var(--ty-font-sm);\nwhite-space: nowrap;\n}\n.tab-overflow-item:hover {\nbackground: var(--ty-bg-neutral-soft);\ncolor: var(--ty-text-strong);\n}\n.tab-overflow-item[data-active="true"] {\ncolor: var(--ty-color-primary);\nfont-weight: var(--ty-font-bold);\n}\n.tab-overflow-item[disabled] {\nopacity: 0.5;\ncursor: not-allowed;\n}\n.panels-viewport {\nposition: relative;\nflex: 1;\noverflow: hidden;\nmin-height: 0;\n}\n.panels-wrapper {\ndisplay: flex;\nheight: 100%;\ntransition: transform var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out);\n}\n@media (prefers-reduced-motion: reduce) {\n.panels-wrapper {\ntransition-duration: 0ms !important;\n}\n.marker-wrapper {\ntransition-duration: 0ms !important;\n}\n}\n::slotted(ty-tab) {\nwidth: 100%;\nheight: 100%;\nflex-shrink: 0;\n}\n.tabs-container[data-snap] .panels-wrapper,\n.tabs-container[data-snap] ::slotted(ty-tab) {\ntransition: none;\n}\n',id:"ty-tabs"}),a&&l&&c&&d){a.setAttribute("data-placement",e),a.toggleAttribute("data-fixed",i);const s=c.scrollLeft;l.querySelector(".tab-overflow-trigger")?.remove(),c.querySelectorAll(".tab-button").forEach(t=>t.remove());const d=function(t,n,e){return n.map(n=>{const i=Ae(n);if(!i)return"";const o=je(t,n),r="text"===o?n.getAttribute("label")||"Tab":"",s=Fe(n),a=i===e;return`<button\nclass="tab-button"\nrole="tab"\ndata-tab-id="${i}"\nid="tab-${i}"\naria-selected="${a}"\ntabindex="${a?"0":"-1"}"\ndata-active="${a}"\n${s?'disabled aria-disabled="true"':""}\n>\n${"slot"===o?`<slot name="label-${i}"></slot>`:`<span class="tab-label">${r}</span>`}\n</button>`}).join("")}(t,o,r),h=document.createElement("div");h.innerHTML=d,Array.from(h.children).forEach(t=>{c.appendChild(t)}),c.scrollLeft=s,Pe(t,n,o),Ue(t,n,r||"");const u=!$e.get(t);requestAnimationFrame(()=>{const n=Ie(t);Qe(t),n&&(Ke(t,n,u),ni(t,n,!u))}),Xe(t,r)}else{n.innerHTML=`\n<div class="tabs-container" data-placement="${e}"${i?" data-fixed":""}>\n${function(t,n,e){const i=n.map(n=>{const i=Ae(n);if(!i)return"";const o=je(t,n),r="text"===o?n.getAttribute("label")||"Tab":"",s=Fe(n),a=i===e;return`<button\nclass="tab-button"\nrole="tab"\ndata-tab-id="${i}"\nid="tab-${i}"\naria-selected="${a}"\ntabindex="${a?"0":"-1"}"\ndata-active="${a}"\n${s?'disabled aria-disabled="true"':""}\n>\n${"slot"===o?`<slot name="label-${i}"></slot>`:`<span class="tab-label">${r}</span>`}\n</button>`}).join("");return`\n<div class="tab-buttons" part="buttons-container">\n<div class="tab-strip" role="tablist" part="strip">\n<div class="marker-wrapper" part="marker-wrapper">\n${o=t,null===o.querySelector(':scope > [slot="marker"]')?'<div class="default-marker"></div>':""}\n<slot name="marker"></slot>\n</div>\n${i}\n</div>\n</div>\n`;var o}(t,o,r)}\n<div class="panels-viewport" part="panels-container">\n<div class="panels-wrapper" style="transform: ${We(s)}">\n<slot></slot>\n</div>\n</div>\n</div>\n`,requestAnimationFrame(()=>{const n=Ie(t);Qe(t),n&&(Ke(t,n),ni(t,n,!1))}),Pe(t,n,o),Ue(t,n,r||"");const a=n.querySelector(".tab-strip");a?.addEventListener("scroll",()=>ti(a),{passive:!0}),Xe(t,r);const l=n.querySelector('slot[name="marker"]');if(l){const t=()=>{const t=n.querySelector(".default-marker");if(t){const n=l.assignedElements().length>0;t.style.display=n?"none":""}};l.addEventListener("slotchange",t),t()}}}class TyTabs extends HTMLElement{constructor(){super(),this.Hn=null,this.Gn=!1,this.Qn=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["width","height","active","placement","fixed"]}get activeTab(){return $e.get(this)??null}connectedCallback(){ei(this),Ze(this),function(t){const n=ze.get(t);n&&n.disconnect();const e=new ResizeObserver(()=>{const n=Ie(t);Qe(t),n&&(Ke(t,n),ni(t,n,!1))});e.observe(t),ze.set(t,e)}(this),this.Hn=new MutationObserver(()=>this.te(!0)),this.Hn.observe(this,{childList:!0})}disconnectedCallback(){this.Hn?.disconnect(),this.Hn=null,Be(this),function(t){const n=ze.get(t);n&&(n.disconnect(),ze.delete(t))}(this)}te(t){this.Qn||(this.Qn=t),this.Gn||(this.Gn=!0,queueMicrotask(()=>{this.Gn=!1,this.isConnected&&(this.Hn?.takeRecords().length&&(this.Qn=!0),this.Qn&&(this.Qn=!1,ei(this)),Ze(this))}))}attributeChangedCallback(t,n,e){this.isConnected&&("active"===t?(n!==e&&Te.delete(this),this.te(!1)):ei(this))}}customElements.get("ty-tabs")||customElements.define("ty-tabs",TyTabs);const ii=`\n:host {\nwidth: 100%;\nheight: 100%;\ndisplay: block;\nbox-sizing: border-box;\nflex-shrink: 0;\ntransition:\nopacity var(--ty-tabs-transition-duration, 400ms) var(--ty-tabs-transition-easing, ease-in-out),\nvisibility var(--ty-tabs-transition-duration, 400ms);\n}\n@media (prefers-reduced-motion: reduce) {\n:host {\ntransition-duration: 0ms !important;\n}\n}\n.tab-wrapper {\nwidth: 100%;\nheight: 100%;\nposition: relative;\noverflow: hidden;\n}\n.tab-panel {\nwidth: 100%;\nheight: 100%;\noverflow: auto;\nbox-sizing: border-box;\n}\n.tab-loading,\n.tab-error {\ndisplay: none;\nbox-sizing: border-box;\nmin-height: 100%;\nflex-direction: column;\nalign-items: center;\njustify-content: center;\ngap: 12px;\npadding: 24px;\ntext-align: center;\n}\n.tab-panel[data-load="loading"] .tab-loading,\n.tab-panel[data-load="failed"] .tab-error {\ndisplay: flex;\n}\n.tab-panel[data-load="loading"] .tab-loading {\nanimation: ty-tab-status-in 200ms ease-out 150ms both;\n}\n@keyframes ty-tab-status-in {\nfrom { opacity: 0; }\n}\n.tab-spinner {\ndisplay: inline-flex;\nwidth: 20px;\nheight: 20px;\ncolor: var(--ty-text-soft);\nanimation: var(--ty-loader-animation, ty-tab-spin 0.7s linear infinite);\n}\n.tab-spinner svg {\nwidth: 100%;\nheight: 100%;\n}\n@keyframes ty-tab-spin {\nto { transform: rotate(360deg); }\n}\n@media (prefers-reduced-motion: reduce) {\n.tab-spinner {\nanimation-duration: 1.6s;\n}\n}\n.tab-error {\ncolor: var(--ty-text-soft);\nfont-size: 14px;\n}\n.tab-retry {\nfont: inherit;\nfont-size: 13px;\npadding: 4px 14px;\nborder: 1px solid var(--ty-border);\nborder-radius: 9999px;\nbackground: transparent;\ncolor: var(--ty-text-strong);\ncursor: pointer;\n}\n.tab-retry:hover {\nborder-color: var(--ty-text-soft);\n}\n.tab-retry:focus-visible {\noutline: 2px solid var(--ty-color-primary);\noutline-offset: 2px;\n}\n.tab-panel.ty-custom-scroll {\nscrollbar-width: none;\n-ms-overflow-style: none;\n}\n.tab-panel.ty-custom-scroll::-webkit-scrollbar {\ndisplay: none;\n}\n.tab-wrapper:hover .ty-scrollbar-track-y.has-overflow {\nopacity: 1;\n}\n${Pt}\n`,oi=new Set(["loading","error"]),ri=new Set(["template","script","style"]);class TyTab extends HTMLElement{constructor(){super(),this.ln=null,this.ne=null,this.ee=!0,this.ie="idle",this.oe=null,this.re=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["id","label","disabled","lazy"]}connectedCallback(){this.se(),this.ln||this.hn(),this.ae()}setPanelLabel(t){this.ne=t,this.le()}setShown(t){this.ee=t,this.le()}disconnectedCallback(){this.dn(),this.re=!!this.oe?.takeRecords().length,this.oe?.disconnect(),this.oe=null}Jn(t){this.oe?.takeRecords().length&&this.ce(!1),"empty"!==this.ie&&"failed"!==this.ie||this.de(t)}loadFailed(){"loading"!==this.ie&&"empty"!==this.ie||this.he("failed")}attributeChangedCallback(t,n,e){if(this.se(),"lazy"===t)return void(this.isConnected&&this.ae());const i=this.parentElement;n!==e&&this.isConnected&&"ty-tabs"===i?.localName&&i.te?.(!0)}se(){const t=this.shadowRoot;t&&(t.querySelector(".tab-wrapper")||(b(t,{css:ii,id:"ty-tab"}),t.innerHTML='\n<div class="tab-wrapper">\n<div class="tab-panel" role="tabpanel" tabindex="0">\n<slot></slot>\n</div>\n</div>\n'),this.le())}ae(){const t=this.hasAttribute("lazy");t&&!this.oe?(this.oe=new MutationObserver(()=>this.ce(!0)),this.oe.observe(this,{childList:!0,characterData:!0,subtree:!0})):!t&&this.oe&&(this.oe.disconnect(),this.oe=null);const n=this.re;this.re=!1,this.ce(n)}ue(){for(const t of Array.from(this.childNodes)){if(t.nodeType===Node.TEXT_NODE&&t.textContent.trim())return!0;if(t.nodeType!==Node.ELEMENT_NODE)continue;const n=t;if(!oi.has(n.getAttribute("slot")??"")&&!ri.has(n.localName))return!0}return!1}ce(t){this.hasAttribute("lazy")&&!this.ue()?"idle"===this.ie&&(this.he("empty"),t&&queueMicrotask(()=>{"empty"===this.ie&&this.ee&&"ty-tabs"===this.parentElement?.localName&&this.de()})):this.he("idle")}de(t){const n=this.parentElement;void 0===t&&(t="ty-tabs"===n?.localName?Array.from(n.querySelectorAll(":scope > ty-tab")).indexOf(this):0),this.he("loading"),this.dispatchEvent(new CustomEvent("ty-tab-load",{detail:{id:this.id,index:t}}))}pe(t){t.querySelector(".tab-loading")||(t.insertAdjacentHTML("beforeend",'\n<div class="tab-loading" part="loading">\n<slot name="loading"><span class="tab-spinner" part="spinner" aria-hidden="true"></span></slot>\n</div>\n<div class="tab-error" part="error" role="alert">\n<slot name="error">Couldn\'t load.</slot>\n<button type="button" class="tab-retry" part="retry">Retry</button>\n</div>\n'),t.querySelector(".tab-retry").addEventListener("click",()=>{t.focus({preventScroll:!0}),this.de()}))}he(t){if(t===this.ie)return;this.ie=t;const n=this.shadowRoot?.querySelector(".tab-panel");n&&("loading"===t||"failed"===t?(this.pe(n),n.dataset.load=t):delete n.dataset.load,"loading"===t?(n.setAttribute("aria-busy","true"),n.querySelector(".tab-spinner").innerHTML=C()):n.removeAttribute("aria-busy"))}le(){const t=this.shadowRoot?.querySelector(".tab-panel");if(!t)return;const n=this.parentElement,e=!this.ne&&this.id&&"ty-tabs"===n?.localName?n.querySelector(`:scope > [slot="label-${CSS.escape(this.id)}"]`):null,i=this.ne||e?.textContent?.trim()||this.getAttribute("label");i?t.setAttribute("aria-label",i):t.removeAttribute("aria-label"),t.parentElement.inert=!this.ee}hn(){const t=this.shadowRoot?.querySelector(".tab-panel"),n=this.shadowRoot?.querySelector(".tab-wrapper");t&&n&&Nt()&&(t.classList.add("ty-custom-scroll"),this.ln=new Bt(t,{vertical:!0}),this.ln.trackY&&n.appendChild(this.ln.trackY))}dn(){this.ln&&(this.ln.trackY?.remove(),this.ln.destroy(),this.ln=null)}resetScroll(){this.ln?.scrollToTop(!1)}}customElements.get("ty-tab")||customElements.define("ty-tab",TyTab);const si=new WeakMap;function ai(t){return Array.from(t.querySelectorAll("ty-step"))}function li(t){return t.getAttribute("id")}function ci(t){const n=t.getAttribute("completed")||"";return n.trim()?new Set(n.split(",").map(t=>t.trim()).filter(Boolean)):new Set}function di(t,n){const e=t.findIndex(t=>li(t)===n);return 0>e?void 0:e}function hi(t,n){const e=t.getAttribute("active");return e&&void 0!==di(n,e)?e:n.length>0?li(n[0]):null}function ui(t){const n=si.get(t);if(!n)return;const e=t.shadowRoot;e&&(n.stepClickHandlers.forEach((t,n)=>{const i=e.querySelector(`[data-step-id='${n}']`);i&&(i.removeEventListener("pointerdown",t),i.removeEventListener("click",t))}),n.stepClickHandlers.clear())}function pi(t,n,e){const i=ai(t),o=ci(t);i.forEach(i=>{const r=li(i);if(!r)return;const s=n.querySelector(`[data-step-id='${r}']`),a=n.querySelector(`[data-step-id='${r}'] .step-circle`),l=r===e;s&&(s.setAttribute("aria-selected",l+""),s.setAttribute("tabindex",l?"0":"-1"),s.setAttribute("data-active",l+""));const c=vi(i,r,e,o);s?.setAttribute("data-state",c),a?.setAttribute("data-state",c);const d=t.querySelector(`[slot='indicator-${r}']`);d&&d.setAttribute("data-active",l+"")})}function bi(t,n){ai(t).forEach(t=>{const e=li(t);e&&t.setAttribute("data-active",(e===n)+"")})}function vi(t,n,e,i){const o=t.getAttribute("status");if(o&&["completed","active","pending","error"].includes(o))return o;const r=n===e,s=i.has(n);return r?"active":s?"completed":"pending"}const mi={completed:"completed",active:"current",pending:"not started",error:"has an error"};function gi(t){const n=t.shadowRoot;if(!n)return;const{width:e,height:i}=function(t){return{width:t.getAttribute("width")||"100%",height:t.getAttribute("height")||"",active:t.getAttribute("active"),completed:t.getAttribute("completed")||"",orientation:t.getAttribute("orientation")||"horizontal"}}(t),o=ai(t),r=hi(t,o),s=ci(t);o.forEach(t=>{const n=li(t);n&&(t.setAttribute("role","tabpanel"),t.setAttribute("aria-labelledby","step-"+n),t.setAttribute("tabindex","0"))}),b(n,{css:'\n:host {\ndisplay: block;\nwidth: var(--ty-wizard-width, 100%); \nbox-sizing: border-box;\n--ty-wizard-active-accent: var(--ty-color-primary);\n--ty-wizard-completed-accent: var(--ty-text-strong, var(--ty-color-neutral-strong));\n--ty-wizard-error-accent: var(--ty-color-danger);\n--ty-wizard-pending-accent: color-mix(in oklab, var(--ty-text, currentColor) 35%, transparent);\n--ty-wizard-bg: var(--ty-surface-elevated);\n--ty-wizard-border: var(--ty-border);\n--ty-wizard-radius: var(--ty-radius-lg, 12px);\n--ty-wizard-shadow: none;\n--ty-wizard-header-bg: transparent;\n--ty-wizard-header-border: var(--ty-wizard-border);\n--ty-wizard-header-padding: 14px 20px;\n--ty-wizard-progress-track: var(--ty-border);\n--ty-wizard-progress-fill: var(--ty-wizard-completed-accent);\n--ty-wizard-progress-height: 1.5px;\n--ty-wizard-transition-duration: var(--ty-transition-duration, 300ms);\n--ty-wizard-transition-easing: var(--ty-transition-easing, ease-in-out);\n--ty-wizard-circle-size: 24px;\n--ty-wizard-circle-border-width: 1.5px;\n--ty-wizard-panels-bg: transparent;\n--ty-wizard-focus-outline: var(--ty-wizard-active-accent);\n}\n.wizard-container {\ndisplay: flex;\nflex-direction: column;\nposition: relative;\nbox-sizing: border-box;\nborder-radius: var(--ty-wizard-radius);\nborder: 1px solid var(--ty-wizard-border);\nbackground: var(--ty-wizard-bg);\nbox-shadow: var(--ty-wizard-shadow);\noverflow: hidden;\n}\n.step-indicators-wrapper {\nflex-shrink: 0;\npadding: var(--ty-wizard-header-padding);\nborder-bottom: 1px solid var(--ty-wizard-header-border);\nbackground: var(--ty-wizard-header-bg);\n}\n.step-indicators {\ndisplay: flex;\nalign-items: center;\ngap: 12px;\n}\n.step-indicator {\ndisplay: flex;\nalign-items: center;\ngap: 8px;\nflex: 1 1 auto;\nmin-width: 0;\ncursor: pointer;\nbackground: transparent;\nborder: none;\npadding: 0;\nfont: inherit;\ncolor: inherit;\ntext-align: left;\noutline: none;\n}\n.step-indicator:last-child {\nflex: 0 0 auto;\n}\n.step-indicator:not(:last-child)::after {\ncontent: "";\nflex: 1 1 auto;\nmin-width: 16px;\nheight: var(--ty-wizard-progress-height);\nborder-radius: 1px;\nmargin-left: 4px;\nbackground: var(--ty-wizard-progress-track);\ntransition: background var(--ty-wizard-transition-duration) var(--ty-wizard-transition-easing);\n}\n.step-indicator[data-done="true"]:not(:last-child)::after {\nbackground: var(--ty-wizard-progress-fill);\n}\n.step-indicator[aria-disabled="true"] {\nopacity: 0.45;\ncursor: not-allowed;\npointer-events: none;\n}\n.step-indicator:focus-visible .step-circle {\noutline: 2px solid var(--ty-wizard-focus-outline);\noutline-offset: 2px;\n}\n.step-circle {\nwidth: var(--ty-wizard-circle-size);\nheight: var(--ty-wizard-circle-size);\nborder-radius: 50%;\nborder: var(--ty-wizard-circle-border-width) solid;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nbox-sizing: border-box;\nflex-shrink: 0;\nfont-size: calc(var(--ty-wizard-circle-size) * 0.46);\nfont-weight: 600;\nfont-variant-numeric: tabular-nums;\nline-height: 1;\ntransition: var(--ty-local-transition, background-color var(--ty-wizard-transition-duration) var(--ty-wizard-transition-easing), border-color var(--ty-wizard-transition-duration) var(--ty-wizard-transition-easing), color var(--ty-wizard-transition-duration) var(--ty-wizard-transition-easing));\n}\n.step-circle svg {\nwidth: 58%;\nheight: 58%;\n}\n.step-circle[data-state="completed"] {\nbackground: var(--ty-wizard-completed-accent);\nborder-color: var(--ty-wizard-completed-accent);\ncolor: oklch(\nfrom var(--ty-wizard-completed-accent)\nclamp(0, (var(--ty-solid-fg-threshold, 0.57) - l) * 1000, 1) 0 0\n);\n}\n.step-circle[data-state="active"] {\nbackground: color-mix(in oklab, var(--ty-wizard-active-accent) 12%, var(--ty-wizard-bg));\nborder-color: var(--ty-wizard-active-accent);\ncolor: color-mix(in oklab, var(--ty-wizard-active-accent) 75%, var(--ty-text-strong, currentColor));\n}\n.step-circle[data-state="pending"] {\nbackground: transparent;\nborder-color: var(--ty-wizard-pending-accent);\ncolor: var(--ty-text-soft, var(--ty-color-neutral));\n}\n.step-circle[data-state="error"] {\nbackground: color-mix(in oklab, var(--ty-wizard-error-accent) 12%, var(--ty-wizard-bg));\nborder-color: var(--ty-wizard-error-accent);\ncolor: color-mix(in oklab, var(--ty-wizard-error-accent) 75%, var(--ty-text-strong, currentColor));\n}\n.step-text {\ndisplay: flex;\nflex-direction: column;\ngap: 0;\nmin-width: 0;\n}\n.step-label {\nfont-size: var(--ty-font-sm, 14px);\nfont-weight: 500;\nline-height: 1.3;\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\ncolor: var(--ty-text-soft, var(--ty-color-neutral));\ntransition: var(--ty-local-transition, color 200ms);\n}\n.step-indicator[data-state="completed"] .step-label,\n.step-indicator[data-state="active"] .step-label {\ncolor: var(--ty-text-strong, var(--ty-color-neutral-strong));\n}\n.step-indicator[aria-selected="true"] .step-label {\nfont-weight: 600;\n}\n.step-indicator[data-state="error"] .step-label {\ncolor: var(--ty-wizard-error-accent);\n}\n.step-description {\nheight: 0;\nvisibility: hidden;\nfont-size: var(--ty-font-xs, 12px);\nline-height: 1.3;\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\ncolor: var(--ty-text-soft, var(--ty-color-neutral));\n}\n.step-indicator[aria-selected="true"] .step-description,\n.step-indicator[data-state="error"] .step-description {\nheight: auto;\nvisibility: inherit;\n}\n.step-indicator:hover:not([aria-selected="true"]) .step-label {\ncolor: var(--ty-text-strong, var(--ty-color-neutral-strong));\n}\n::slotted([slot^="indicator-"]) {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\n}\n.step-compact {\ndisplay: none;\nflex-direction: column;\ngap: 10px;\n}\n.compact-top {\ndisplay: flex;\nalign-items: baseline;\njustify-content: space-between;\ngap: 12px;\nmin-width: 0;\n}\n.compact-where {\ndisplay: flex;\nalign-items: baseline;\ngap: 6px;\nmin-width: 0;\nwhite-space: nowrap;\n}\n.compact-count {\nfont-size: var(--ty-font-xs, 12px);\ncolor: var(--ty-text-soft, var(--ty-color-neutral));\n}\n.compact-count::after {\ncontent: "·";\nmargin-left: 6px;\ncolor: var(--ty-text-faint, var(--ty-color-neutral));\n}\n.compact-label {\nfont-size: var(--ty-font-sm, 14px);\nfont-weight: 600;\ncolor: var(--ty-text-strong, var(--ty-color-neutral-strong));\noverflow: hidden;\ntext-overflow: ellipsis;\n}\n.compact-description {\nfont-size: var(--ty-font-xs, 12px);\ncolor: var(--ty-text-faint, var(--ty-color-neutral));\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\n}\n.compact-segments {\ndisplay: flex;\ngap: 4px;\n}\n.compact-segment {\nflex: 1;\nheight: 3px;\nborder-radius: 2px;\nbackground: var(--ty-wizard-progress-track);\ntransition: background var(--ty-wizard-transition-duration) var(--ty-wizard-transition-easing);\n}\n.compact-segment[data-state="completed"] { background: var(--ty-wizard-progress-fill); }\n.compact-segment[data-state="active"] { background: var(--ty-wizard-active-accent); }\n.compact-segment[data-state="error"] { background: var(--ty-wizard-error-accent); }\n.wizard-container.compact { flex-direction: column; }\n.wizard-container.compact .step-indicators {\nposition: absolute;\nvisibility: hidden;\npointer-events: none;\nwidth: max-content;\n}\n.wizard-container.compact .step-compact { display: flex; }\n.wizard-container.compact .step-indicators-wrapper {\npadding: var(--ty-wizard-header-padding);\nborder-right: none;\nborder-bottom: 1px solid var(--ty-wizard-header-border);\nmin-width: 0;\n}\n:host([orientation="vertical"]) .wizard-container:not(.compact) {\nflex-direction: row;\n}\n:host([orientation="vertical"]) .wizard-container:not(.compact) .step-indicators-wrapper {\nborder-bottom: none;\nborder-right: 1px solid var(--ty-wizard-header-border);\npadding: 20px 18px;\nmin-width: 170px;\nbox-sizing: border-box;\n}\n:host([orientation="vertical"]) .step-indicators {\nflex-direction: column;\nalign-items: stretch;\ngap: 0;\n}\n:host([orientation="vertical"]) .step-indicator {\nflex: 0 0 auto;\nalign-items: flex-start;\ngap: 10px;\nposition: relative;\npadding-bottom: 26px;\n}\n:host([orientation="vertical"]) .step-indicator:last-child {\npadding-bottom: 0;\n}\n:host([orientation="vertical"]) .step-text {\npadding-top: calc((var(--ty-wizard-circle-size) - var(--ty-font-sm, 14px) * 1.3) / 2);\n}\n:host([orientation="vertical"]) .step-indicator:not(:last-child)::after {\nposition: absolute;\nleft: calc(var(--ty-wizard-circle-size) / 2 - var(--ty-wizard-progress-height) / 2);\ntop: calc(var(--ty-wizard-circle-size) + 4px);\nbottom: 4px;\nwidth: var(--ty-wizard-progress-height);\nheight: auto;\nmin-width: 0;\nmargin: 0;\n}\n.panels-viewport {\nposition: relative;\nflex: 1;\nmin-width: 0;\nheight: var(--ty-wizard-panel-height, auto);\noverflow: hidden;\nbackground: var(--ty-wizard-panels-bg);\n}\n.panels-wrapper {\ndisplay: flex;\nheight: 100%;\ntransform: translateX(calc(var(--ty-wizard-active-index, 0) * -100%));\ntransition: transform var(--ty-wizard-transition-duration) var(--ty-wizard-transition-easing);\nwill-change: transform;\n}\n::slotted(ty-step) {\nflex: 0 0 100%;\nmin-width: 0;\ntransition: visibility 0s linear 0s;\n}\n::slotted(ty-step:not([data-active="true"])) {\nvisibility: hidden;\npointer-events: none;\ntransition: visibility 0s linear var(--ty-wizard-transition-duration);\n}\n@media (prefers-reduced-motion: reduce) {\n.panels-wrapper,\n::slotted(ty-step),\n::slotted(ty-step:not([data-active="true"])),\n.step-circle,\n.compact-segment,\n.step-indicator::after {\ntransition-duration: 0ms !important;\ntransition-delay: 0ms !important;\n}\n}\n.sr-only {\nposition: absolute;\nwidth: 1px;\nheight: 1px;\npadding: 0;\nmargin: -1px;\noverflow: hidden;\nclip: rect(0, 0, 0, 0);\nwhite-space: nowrap;\nborder-width: 0;\n}\n',id:"ty-wizard"}),t.style.setProperty("--ty-wizard-width",e),t.style.setProperty("--ty-wizard-active-index",Math.max(0,r?o.findIndex(t=>li(t)===r):0)+""),i?t.style.setProperty("--ty-wizard-panel-height",i):t.style.removeProperty("--ty-wizard-panel-height");let a=n.querySelector(".wizard-container"),l=n.querySelector(".panels-viewport");a&&l||(n.innerHTML='\n<div class="wizard-container">\n<div class="panels-viewport" part="panels-container">\n<div class="panels-wrapper">\n<slot></slot>\n</div>\n</div>\n</div>\n',a=n.querySelector(".wizard-container"),l=n.querySelector(".panels-viewport")),n.querySelector(".step-indicators-wrapper")?.remove();const c=document.createElement("div");if(c.innerHTML=function(t,n,e,i){const o=n.length,r=Math.max(0,e?n.findIndex(t=>li(t)===e):0),s=n.map((n,r)=>{const s=li(n);if(!s)return"";const a=n.getAttribute("label")||"Step "+(r+1),l=n.getAttribute("description")||"",c=function(t){return t.hasAttribute("disabled")}(n),d=s===e,h=vi(n,s,e,i),u=function(t,n){return null!==t.querySelector(`[slot='indicator-${n}']`)}(t,s)?`<slot name="indicator-${s}"></slot>`:"completed"===h?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"></polyline></svg>':"error"===h?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="13"></line><line x1="12" y1="18.5" x2="12" y2="18.6"></line></svg>':`<span aria-hidden="true">${r+1}</span>`;return`<button\nclass="step-indicator"\nrole="tab"\ntype="button"\ndata-step-id="${s}"\nid="step-${s}"\ndata-state="${h}"\ndata-done="${"completed"===h||"active"===h&&i.has(s)}"\naria-selected="${d}"\ntabindex="${d?"0":"-1"}"\ndata-active="${d}"\n${c?'disabled aria-disabled="true"':""}\n>\n<span class="step-circle" data-state="${h}" part="step-circle">${u}</span>\n<span class="step-text">\n<span class="step-label">${a}</span>\n${l?`<span class="step-description">${l}</span>`:""}\n<span class="sr-only">, step ${r+1} of ${o}, ${mi[h]??h}</span>\n</span>\n</button>`}).join(""),a=n[r],l=a?a.getAttribute("label")||"Step "+(r+1):"",c=a?.getAttribute("description")||"",d=n.map(t=>`<span class="compact-segment" data-state="${vi(t,li(t)||"",e,i)}"></span>`).join("");return`\n<div class="step-indicators-wrapper" part="indicators-wrapper">\n<div class="step-indicators" role="tablist" aria-label="Steps">\n${s}\n</div>\n<div class="step-compact">\n<div class="compact-top">\n<span class="compact-where">\n<span class="compact-count">Step ${o?r+1:0} of ${o}</span>\n<span class="compact-label">${l}</span>\n</span>\n${c?`<span class="compact-description">${c}</span>`:""}\n</div>\n<div class="compact-segments" part="progress">${d}</div>\n</div>\n</div>\n`}(t,o,r,s),a.insertBefore(c.firstElementChild,l),function(t,n,e){ui(t);const i={stepClickHandlers:new Map};e.forEach(e=>{const o=li(e);if(!o)return;const r=n.querySelector(`[data-step-id='${o}']`);if(r){const n=n=>{"click"===n.type&&0!==n.detail||function(t,n,e){e.preventDefault(),e.stopPropagation();const i=ai(t),o=i.findIndex(t=>li(t)===n);if(0>o)return;const r=hi(t,i),s=r?di(i,r)??null:null,a=new CustomEvent("ty-wizard-step-change",{detail:{activeId:n,activeIndex:o,previousId:r,previousIndex:s,direction:null===s?"none":o>s?"forward":s>o?"backward":"none"},bubbles:!0,cancelable:!1});t.dispatchEvent(a)}(t,o,n)};r.addEventListener("pointerdown",n),r.addEventListener("click",n),i.stepClickHandlers.set(o,n)}}),si.set(t,i)}(t,n,o),pi(t,n,r||""),r&&bi(t,r),!fi.has(t)){const n=new ResizeObserver(()=>yi(t));n.observe(t),fi.set(t,n),document.fonts?.ready.then(()=>t.isConnected&&yi(t))}yi(t)}function yi(t){const n=t.shadowRoot,e=n?.querySelector(".wizard-container"),i=n?.querySelector(".step-indicators-wrapper"),o=n?.querySelector(".step-indicators");if(!e||!i||!o)return;let r;if("vertical"===t.getAttribute("orientation"))r=360>t.clientWidth;else{const t=Array.from(o.querySelectorAll(".step-indicator")),n=t=>parseFloat(t)||0;let e=n(getComputedStyle(o).columnGap)*Math.max(0,t.length-1);t.forEach((i,o)=>{const r=i.querySelector(".step-circle"),s=Array.from(i.querySelectorAll(".step-label, .step-description"));if(e+=(r?.offsetWidth??0)+n(getComputedStyle(i).columnGap)+Math.max(0,...s.map(t=>t.scrollWidth)),t.length-1>o){const t=getComputedStyle(i,"::after");e+=n(getComputedStyle(i).columnGap)+n(t.minWidth)+n(t.marginLeft)}});const s=getComputedStyle(i);r=e>i.clientWidth-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)+.5}e.classList.toggle("compact",r)}const fi=new WeakMap;class TyWizard extends HTMLElement{constructor(){super(),this.Hn=null,this.be=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["width","height","active","completed","orientation"]}connectedCallback(){gi(this),this.Hn=new MutationObserver(t=>{t.some(t=>"childList"===t.type&&t.target===this||"TY-STEP"===t.target.tagName&&t.target.parentElement===this)&&!this.be&&(this.be=!0,queueMicrotask(()=>{this.be=!1,this.isConnected&&gi(this)}))}),this.Hn.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["status","label","description","disabled"]})}disconnectedCallback(){this.Hn?.disconnect(),this.Hn=null,ui(this),fi.get(this)?.disconnect(),fi.delete(this)}attributeChangedCallback(t,n,e){"active"===t?(e&&function(t,n){const e=ai(t),i=t.shadowRoot;if(!i)return;const o=hi(t,e),r=o?di(e,o):void 0,s=di(e,n);if(o===n||void 0===s)return;t.style.setProperty("--ty-wizard-active-index",s+""),pi(t,i,n),bi(t,n);const a=e[s];a?.resetScroll&&a.resetScroll(),function(t,n,e,i,o){const r=new CustomEvent("ty-wizard-step-change",{detail:{activeId:n,activeIndex:e,previousId:i,previousIndex:o,direction:null===o?"none":e>o?"forward":o>e?"backward":"none"},bubbles:!0,cancelable:!1});t.dispatchEvent(r)}(t,n,s,o,r??null)}(this,e),gi(this)):gi(this)}}customElements.get("ty-wizard")||customElements.define("ty-wizard",TyWizard);const wi=`\n:host {\nheight: var(--ty-wizard-panel-height, auto);\ndisplay: block;\nbox-sizing: border-box;\n}\n.step-wrapper {\nwidth: 100%;\nheight: 100%;\nposition: relative;\noverflow: hidden;\n}\n.step-panel {\nwidth: 100%;\nheight: 100%;\noverflow: auto;\nbox-sizing: border-box;\n}\n.step-panel.ty-custom-scroll {\nscrollbar-width: none;\n-ms-overflow-style: none;\n}\n.step-panel.ty-custom-scroll::-webkit-scrollbar {\ndisplay: none;\n}\n.step-wrapper:hover .ty-scrollbar-track-y.has-overflow {\nopacity: 1;\n}\n${Pt}\n`;class TyStep extends HTMLElement{constructor(){super(),this.ln=null,this.attachShadow({mode:"open"})}static get observedAttributes(){return["id","label","description","disabled","status"]}connectedCallback(){this.se()}disconnectedCallback(){this.dn()}attributeChangedCallback(t,n,e){this.se()}se(){const t=this.shadowRoot;if(!t)return;const n=this.getAttribute("id");t.querySelector(".step-wrapper")||(b(t,{css:wi,id:"ty-step"}),t.innerHTML=`\n<div class="step-wrapper"\nrole="tabpanel"\n${n?`id="panel-${n}"`:""}\n${n?`aria-labelledby="step-${n}"`:""}\n>\n<div class="step-panel">\n<slot></slot>\n</div>\n</div>\n`,this.hn())}hn(){const t=this.shadowRoot?.querySelector(".step-panel"),n=this.shadowRoot?.querySelector(".step-wrapper");t&&n&&Nt()&&(t.classList.add("ty-custom-scroll"),this.ln=new Bt(t,{vertical:!0}),this.ln.trackY&&n.appendChild(this.ln.trackY))}dn(){this.ln&&(this.ln.trackY?.remove(),this.ln.destroy(),this.ln=null)}resetScroll(){this.ln?.scrollToTop(!1)}}customElements.get("ty-step")||customElements.define("ty-step",TyStep);const xi=(t,n)=>{const e=e=>n?`var(--ty-color-${t}${e}, var(--ty-color-${n}${e}))`:`var(--ty-color-${t}${e})`,i=e=>n?`var(--ty-solid-${t}${e}, var(--ty-solid-${n}${e}))`:`var(--ty-solid-${t}${e})`;return`\n:host([flavor="${t}"]) {\n--calendar-month-accent: ${e("")};\n--calendar-month-selected-bg: ${i("")};\n--calendar-month-selected-color: ${i("-fg")};\n--calendar-month-selected-hover-bg: ${i("-hover")};\n}\n:host([flavor="${t}+"]) {\n--calendar-month-accent: ${e("-strong")};\n--calendar-month-selected-bg: ${i("-strong")};\n--calendar-month-selected-color: ${i("-strong-fg")};\n--calendar-month-selected-hover-bg: color-mix(in oklab, ${i("-strong")} 85%, ${i("-strong-fg")});\n}\n:host([flavor="${t}-"]) {\n--calendar-month-accent: ${e("-soft")};\n--calendar-month-selected-bg: ${i("-soft")};\n--calendar-month-selected-color: ${i("-soft-fg")};\n--calendar-month-selected-hover-bg: color-mix(in oklab, ${i("-soft")} 85%, ${i("-soft-fg")});\n}\n`},ki=n.map(t=>xi(t)).join(""),zi=`\n.calendar-flex-container {\ndisplay: flex;\nflex-direction: column;\nbox-sizing: border-box;\ngap: 0;\npadding: 0.75rem;\nborder-radius: var(--ty-radius-md);\nfont-family: inherit;\nuser-select: none;\nwidth: var(--calendar-width, fit-content);\nmin-width: var(--ty-calendar-width, 280px);\nmax-width: var(--calendar-max-width, none);\n}\n.calendar-row {\ndisplay: flex;\nflex: 1;\nmin-height: 0;\n}\n.calendar-header-row {\nflex: 0 0 auto;\ncolor: var(--ty-calendar-header-color, var(--ty-color-neutral-soft));\n}\n.calendar-day-row {\nflex: 1;\nmin-height: 2rem;\nmargin-bottom: 0.125rem;\n}\n.calendar-cell {\nflex: 1;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nmin-width: 0;\nposition: relative;\nbox-sizing: border-box;\n}\n.calendar-header-cell {\ntext-align: center;\nfont-weight: 500;\npadding: 0.25rem;\n}\n.calendar-day-cell {\naspect-ratio: 1;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nflex-direction: column;\nmargin: 0.125rem;\nborder-radius: var(--ty-calendar-day-radius, 0.5rem);\nborder: 1px solid var(--ty-calendar-day-border, transparent);\nbackground-color: var(--ty-calendar-day-bg, transparent);\ncolor: var(--ty-calendar-day-color, var(--ty-calendar-muted, var(--ty-text)));\ncursor: pointer;\ntransition: var(--ty-local-transition, background-color 0.15s ease, color 0.15s ease);\nfont-weight: 400;\nfont-variant-numeric: tabular-nums;\n}\n.calendar-day-cell:hover {\ncolor: var(--ty-calendar-day-hover-color, var(--ty-text-strong));\nbackground-color: var(--ty-calendar-day-hover-bg, var(--ty-bg-neutral));\nborder-color: var(--ty-calendar-day-hover-border, transparent);\nfont-weight: 500;\n}\n.calendar-day-cell:focus-visible {\noutline: none;\nbox-shadow: 0 0 0 2px var(--calendar-month-accent, var(--ty-color-primary));\n}\n.calendar-day-cell.today {\nbackground-color: var(--ty-calendar-today-bg, transparent);\ncolor: var(--ty-calendar-today-color, var(--ty-calendar-today-accent, var(--calendar-month-accent, var(--ty-color-primary))));\nborder-color: var(--ty-calendar-today-border, transparent);\nfont-weight: 600;\n}\n.calendar-day-cell.today:hover {\nbackground-color: var(--ty-calendar-day-hover-bg, var(--ty-bg-neutral));\n}\n.calendar-day-cell.today.default-content::after {\ncontent: "";\nposition: absolute;\ntop: calc(50% + 0.72em);\nleft: 50%;\nwidth: 4px;\nheight: 4px;\nmargin-left: -2px;\nborder-radius: 50%;\nbackground: currentColor;\n}\n.calendar-day-cell.weekend {\ncolor: var(--ty-calendar-weekend-color, var(--ty-calendar-day-color, var(--ty-text)));\n}\n.calendar-day-cell.other-month {\ncolor: var(--ty-calendar-other-month-color, color-mix(in oklab, var(--ty-text-faint) 65%, transparent));\n}\n.calendar-day-cell.other-month:hover {\ncolor: var(--ty-calendar-day-hover-color, var(--ty-text-soft, var(--ty-text-)));\nbackground-color: var(--ty-calendar-day-hover-bg, var(--ty-bg-neutral-soft));\n}\n.calendar-day-cell.disabled {\ncolor: var(--ty-calendar-disabled-color, var(--ty-text-faint));\nopacity: var(--ty-calendar-disabled-opacity, 0.7);\ntext-decoration: line-through;\ntext-decoration-color: color-mix(in oklab, currentColor 60%, transparent);\ncursor: default;\npointer-events: none;\n}\n.calendar-day-cell.selected {\nbackground-color: var(--ty-calendar-selected-bg, var(--ty-calendar-accent, var(--calendar-month-selected-bg, var(--ty-solid-primary, var(--ty-color-primary)))));\ncolor: var(--ty-calendar-selected-color, var(--calendar-month-selected-color, var(--ty-solid-primary-fg, white)));\nborder-color: var(--ty-calendar-selected-border, transparent);\nfont-weight: 600;\n}\n.calendar-day-cell.selected:hover {\nbackground-color: var(--ty-calendar-selected-hover-bg, var(--calendar-month-selected-hover-bg, color-mix(in oklab, var(--ty-calendar-selected-bg, var(--ty-calendar-accent, var(--calendar-month-selected-bg, var(--ty-solid-primary, var(--ty-color-primary))))) 85%, var(--ty-calendar-selected-color, var(--calendar-month-selected-color, var(--ty-solid-primary-fg, white))))));\ncolor: var(--ty-calendar-selected-color, var(--calendar-month-selected-color, var(--ty-solid-primary-fg, white)));\nborder-color: var(--ty-calendar-selected-hover-border, var(--ty-calendar-selected-border, transparent));\n}\n.calendar-day-cell.selected.other-month {\nopacity: 0.7;\n}\n.calendar-size-sm {\npadding: 0.5rem;\nmin-width: var(--ty-calendar-width, 240px);\n}\n.calendar-size-sm .calendar-header-cell {\nfont-size: 0.625rem;\npadding: 0.125rem;\n}\n.calendar-size-sm .calendar-day-cell {\nfont-size: 0.75rem;\nmargin: 0.0625rem;\n}\n.calendar-size-sm .calendar-day-row {\nmin-height: 1.5rem;\n}\n.calendar-size-md {\npadding: 0.75rem;\nmin-width: var(--ty-calendar-width, 280px);\n}\n.calendar-size-md .calendar-header-cell {\nfont-size: 0.6875rem;\npadding: 0.25rem;\n}\n.calendar-size-md .calendar-day-cell {\nfont-size: 0.8125rem;\nmargin: 0.125rem;\n}\n.calendar-size-md .calendar-day-row {\nmin-height: 2rem;\n}\n.calendar-size-lg {\npadding: 1rem;\nmin-width: var(--ty-calendar-width, 360px);\n}\n.calendar-size-lg .calendar-header-cell {\nfont-size: 0.75rem;\npadding: 0.375rem;\n}\n.calendar-size-lg .calendar-day-cell {\nfont-size: 0.875rem;\nmargin: 0.1875rem;\n}\n.calendar-size-lg .calendar-day-row {\nmin-height: 2.5rem;\n}\n.calendar-day {\nwidth: 100%;\nheight: 100%;\ndisplay: flex;\nflex-direction: column;\nalign-items: center;\njustify-content: center;\nbox-sizing: border-box;\n}\n${ki}\n`;function $i(t){if(!Number.isInteger(t)||1>t||t>12)throw new RangeError(`Invalid month: ${t}. Must be an integer between 1 and 12.`)}function Ci(t,n,e,i){const o=t.getFullYear(),r=t.getMonth()+1,s=t.getDate(),a=t.getDay(),l=o!==n||r!==e;let c=!1,d=!1;l&&(n>o||o===n&&e>r?c=!0:d=!0);const h=(p=function(){const t=new Date;return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)}(),(u=t).getFullYear()===p.getFullYear()&&u.getMonth()===p.getMonth()&&u.getDate()===p.getDate());var u,p;const b=i?.year===o&&i?.month===r&&i?.day===s;return{value:Date.UTC(o,r-1,s,0,0,0,0),localValue:t.getTime(),year:o,month:r,dayInMonth:s,weekend:0===a||6===a,otherMonth:l,prevMonth:c,nextMonth:d,today:h,isSelected:b,selectedYear:i?.year,selectedMonth:i?.month,selectedDay:i?.day}}function Ei(t,n){const e=new Date(t);return e.setDate(e.getDate()+n),e}function Mi(t,n="en-US",e="long"){$i(t);const i=new Date(2024,t-1,1);return new Intl.DateTimeFormat(n,{month:e}).format(i)}function Si(t){const n=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!n)return null;const e=parseInt(n[1],10),i=parseInt(n[2],10),o=parseInt(n[3],10);if(1>e||e>9999)return null;if(1>i||i>12)return null;if(1>o||o>31)return null;const r=new Date(e,i-1,o);return r.getFullYear()!==e||r.getMonth()!==i-1||r.getDate()!==o?null:{year:e,month:i,day:o}}function Ti(t){return t instanceof HTMLElement}function _i(t){if(!t)return null;const n=Si(t);return n?Date.UTC(n.year,n.month-1,n.day):null}function qi(t){if(!t||""===t)return null;const n=t+"";return/^\d+(\.\d+)?$/.test(n)?n+"px":n}class TyCalendarMonth extends HTMLElement{constructor(){super(),this.ve="en-US",this.Mn="md",this.j=null,this.me=null,this.ge=[];const t=new Date;this.ye=t.getFullYear(),this.fe=t.getMonth()+1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["display-year","display-month","locale","size","min","max","flavor"]}connectedCallback(){this.fe||(this.fe=(new Date).getMonth()+1),this.ye||(this.ye=(new Date).getFullYear()),this.ve||(this.ve=this.getAttribute("locale")||"en-US");const t=this.getAttribute("size");!t||"sm"!==t&&"md"!==t&&"lg"!==t||(this.Mn=t);const n=this.dayContentFn;n&&!this.we&&(this.we=n,delete this.dayContentFn);const e=this.customCSS;e&&!this.xe&&(this.xe=e,delete this.customCSS),this.rt=at(this,()=>{this.render()}),this.F(),this.render()}disconnectedCallback(){this.rt&&(this.rt(),this.rt=void 0)}attributeChangedCallback(t,n,e){if("display-year"===t||"display-month"===t){const n=+e;Number.isInteger(n)&&("display-year"===t?n>0:n>=1&&12>=n)&&("display-year"===t?this.displayYear=n:this.displayMonth=n)}else"locale"===t?(this.ve=e||"en-US",this.render()):"size"===t?"sm"!==e&&"md"!==e&&"lg"!==e||(this.Mn=e,this.render()):"min"===t||"max"===t?(this["min"===t?"ke":"ze"]=e??void 0,this.render()):"flavor"===t&&this.F()}F(){this.j=k(this.shadowRoot,this.j,this.getAttribute("flavor"),({base:t})=>(t=>xi(t,"neutral"))(t))}get displayYear(){return this.ye}set displayYear(t){this.ye!==t&&(this.ye=t,this.me=null,this.render())}get displayMonth(){return this.fe}set displayMonth(t){this.fe!==t&&(this.fe=t,this.me=null,this.render())}get locale(){return st(this,this.getAttribute("locale"))}set locale(t){this.ve!==t&&(this.ve=t,this.render())}get size(){return this.Mn}set size(t){this.Mn!==t&&(this.Mn=t,this.render())}get flavor(){return this.getAttribute("flavor")||"primary"}set flavor(t){t?this.setAttribute("flavor",t):this.removeAttribute("flavor")}get width(){return this.$e}set width(t){this.$e!==t&&(this.$e=t,this.applyWidthProperties())}get minWidth(){return this.Ce}set minWidth(t){this.Ce!==t&&(this.Ce=t,this.applyWidthProperties())}get maxWidth(){return this.Ee}set maxWidth(t){this.Ee!==t&&(this.Ee=t,this.applyWidthProperties())}get dayContentFn(){return this.we}set dayContentFn(t){this.we!==t&&(this.we=t,this.render())}get customCSS(){return this.xe}set customCSS(t){this.xe!==t&&(this.xe=t,this.applyCustomCSS())}get min(){return this.ke}set min(t){this.ke!==t&&(this.ke=t,this.render())}get max(){return this.ze}set max(t){this.ze!==t&&(this.ze=t,this.render())}get value(){return this.N}set value(t){const n=t??void 0;this.N!==n&&(this.N=n,this.render())}applyWidthProperties(){const t=qi(this.$e),n=qi(this.Ce),e=qi(this.Ee);t?this.style.setProperty("--calendar-width",t):this.style.removeProperty("--calendar-width"),n?this.style.setProperty("--calendar-min-width",n):this.style.removeProperty("--calendar-min-width"),e?this.style.setProperty("--calendar-max-width",e):this.style.removeProperty("--calendar-max-width")}applyCustomCSS(){if(!this.xe||!this.shadowRoot)return;const t=this.shadowRoot.adoptedStyleSheets;t.includes(this.xe)||(this.shadowRoot.adoptedStyleSheets=[...t,this.xe])}refresh(){this.render()}dispatchDayClick(t,n){const e={dayContext:t,value:t.value,year:t.year,month:t.month,day:t.dayInMonth,isHoliday:t.holiday,isToday:t.today,isWeekend:t.weekend,isOtherMonth:t.otherMonth};for(const i of["day-click","day-select"]){const t=new CustomEvent(i,{detail:e,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}renderDayCell(t,n,e){const i=document.createElement("div"),o=this.we?this.we(t):function(t){return""+t.dayInMonth}(t);if(this.we&&o&&!Ti(o)&&"string"!=typeof o)throw Error(`Custom dayContentFn must return a DOM element or string, got: ${typeof o}. Use document.createElement() to create DOM elements.`);const r=function(t){const n=["calendar-day"];return t.today&&n.push("today"),t.weekend&&n.push("weekend"),t.otherMonth&&n.push("other-month"),t.isSelected&&n.push("selected"),n}(t);return n&&r.push("disabled"),this.we||r.push("default-content"),i.className=r.join(" "),"string"==typeof o?i.textContent=o:Ti(o)&&i.appendChild(o),i.setAttribute("role","gridcell"),i.setAttribute("aria-label",new Intl.DateTimeFormat(this.ve,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(new Date(t.localValue))),i.setAttribute("aria-selected",!!t.isSelected+""),t.today&&i.setAttribute("aria-current","date"),n?(i.setAttribute("aria-disabled","true"),i.setAttribute("tabindex","-1")):(i.setAttribute("tabindex",e?"0":"-1"),i.addEventListener("click",n=>{this.dispatchDayClick(t,n)}),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.dispatchDayClick(t,n))})),i}render(){const t=this.shadowRoot;if(!t)return;let n;if(b(t,{css:zi,id:"ty-calendar-month"}),this.applyCustomCSS(),this.applyWidthProperties(),this.N){const t=new Date(this.N);n={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}const e=function(t,n,e){return function(t){if(!Number.isInteger(t)||1>t||t>9999)throw new RangeError(`Invalid year: ${t}. Must be an integer between 1 and 9999.`)}(t),$i(n),function(t,n,e,i,o){const r=[];for(let s=0;42>s;s++){const n=Ei(t,s);r.push(Ci(n,e,i,o))}return r}(function(t,n){const e=function(t,n){return new Date(t,n-1,1,0,0,0,0)}(t,n);return function(t){const n=t.getDay(),e=0===n?6:n-1,i=new Date(t);return i.setDate(t.getDate()-e),i.setHours(0,0,0,0),i}(e)}(t,n),0,t,n,e)}(this.ye,this.fe,n),i=function(t,n="short"){const e=new Intl.DateTimeFormat(t,{weekday:n}),i=new Date(2024,0,7),o=Array.from({length:7},(t,n)=>{const o=Ei(i,n);return e.format(o)}),[r,...s]=o;return[...s,r]}(this.ve,"short");t.innerHTML="";const o=document.createElement("div");o.className="calendar-flex-container calendar-size-"+this.Mn,o.setAttribute("role","grid"),o.setAttribute("aria-label",new Intl.DateTimeFormat(this.ve,{month:"long",year:"numeric"}).format(new Date(this.ye,this.fe-1,1)));const r=document.createElement("div");r.className="calendar-row calendar-header-row",r.setAttribute("role","row"),i.forEach(t=>{const n=document.createElement("div");n.className="calendar-cell calendar-header-cell",n.setAttribute("role","columnheader"),n.textContent=t,r.appendChild(n)}),o.appendChild(r);const s=[];for(let b=0;42>b;b+=7)s.push(e.slice(b,b+7));const a=_i(this.ke),l=_i(this.ze),c=t=>{const n=e[t].value;return null!==a&&a>n||null!==l&&n>l},d=t=>{for(let n=0;42>n;n++)if(t(n)&&!c(n))return n;return-1};let h=d(t=>!!e[t].isSelected),u=!1;-1===h&&(h=d(t=>!!e[t].today)),-1===h&&(h=d(()=>!0),u=!0),-1===h&&(h=0),(null===this.me||0>this.me||this.me>41||c(this.me))&&(this.me=u?null:h);const p=this.me??h;this.ge=[];let v=0;s.forEach(t=>{const n=document.createElement("div");n.className="calendar-row calendar-day-row",n.setAttribute("role","row"),t.forEach(t=>{const e=this.renderDayCell(t,null!==a&&a>t.value||null!==l&&t.value>l,v===p);e.className=e.className+" calendar-cell calendar-day-cell",n.appendChild(e),this.ge[v]=e,v++}),o.appendChild(n)}),o.addEventListener("keydown",t=>{const n=t,e="ArrowLeft"===n.key?-1:"ArrowRight"===n.key?1:"ArrowUp"===n.key?-7:"ArrowDown"===n.key?7:0;if(0===e)return;const i=this.me??h,o=i+e;if(0>o||o>41||c(o))return;n.preventDefault(),this.ge[i]?.setAttribute("tabindex","-1"),this.me=o;const r=this.ge[o];r&&(r.setAttribute("tabindex","0"),r.focus())}),t.appendChild(o)}}customElements.get("ty-calendar-month")||customElements.define("ty-calendar-month",TyCalendarMonth);const Di='\n:host([data-size="md"]) {\n--nav-btn-size: 1.875rem;\n--nav-btn-icon-size: 1.125rem;\n--nav-font-size: 1rem;\n--nav-padding: 0.5rem 0.75rem;\n--nav-default-width: 280px;\n}\n:host([data-size="sm"]) {\n--nav-btn-size: 1.5rem;\n--nav-btn-icon-size: 0.9375rem;\n--nav-font-size: 0.875rem;\n--nav-padding: 0.375rem 0.5rem;\n--nav-default-width: 240px;\n}\n:host([data-size="lg"]) {\n--nav-btn-size: 2.25rem;\n--nav-btn-icon-size: 1.25rem;\n--nav-font-size: 1.125rem;\n--nav-padding: 0.625rem 1rem;\n--nav-default-width: 360px;\n}\n.calendar-navigation-header {\ndisplay: flex;\nalign-items: center;\njustify-content: space-between;\npadding: var(--nav-padding);\nfont-family: inherit;\nuser-select: none;\nwidth: var(--nav-width, var(--ty-calendar-width, var(--nav-default-width)));\nbox-sizing: border-box;\n}\n.nav-group {\ndisplay: flex;\nalign-items: center;\ngap: 0.25rem;\nflex: 0 0 auto;\n}\n.nav-title {\ndisplay: inline-flex;\nalign-items: center;\ngap: 0.375rem;\nmin-width: 0;\nmargin-left: -0.375rem;\npadding: 0.25rem 0.375rem;\nborder: none;\nborder-radius: var(--ty-radius-base);\nbackground: transparent;\nfont-family: inherit;\nfont-size: var(--nav-font-size);\nline-height: 1.2;\nwhite-space: nowrap;\ncursor: pointer;\ntransition: var(--ty-local-transition, background-color 0.15s ease);\noutline: none;\n}\n.nav-title:hover,\n.nav-title[aria-expanded="true"] {\nbackground-color: var(--ty-calendar-nav-hover-bg, var(--ty-bg-neutral-soft));\n}\n.nav-title:focus-visible {\noutline: 2px solid var(--ty-calendar-nav-focus-outline, var(--ty-calendar-accent, var(--ty-color-primary)));\noutline-offset: 2px;\n}\n.nav-title-month {\nfont-weight: 600;\nletter-spacing: -0.01em;\ncolor: var(--ty-calendar-nav-title-color, var(--ty-text-strong, var(--ty-color-neutral-strong)));\n}\n.nav-title-year {\nfont-weight: 400;\ncolor: var(--ty-calendar-nav-year-color, var(--ty-text-soft, var(--ty-color-neutral)));\n}\n.nav-caret {\ndisplay: inline-flex;\ncolor: var(--ty-calendar-nav-color, var(--ty-color-neutral));\ntransition: transform 0.15s ease;\n}\n.nav-caret svg {\nwidth: 1em;\nheight: 1em;\ndisplay: block;\n}\n.nav-title[aria-expanded="true"] .nav-caret {\ntransform: rotate(180deg);\n}\n.nav-btn {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nwidth: var(--nav-btn-size);\nheight: var(--nav-btn-size);\npadding: 0;\nborder: 1px solid var(--ty-calendar-nav-border, var(--ty-border));\nborder-radius: var(--ty-radius-base);\nbackground-color: transparent;\ncolor: var(--ty-calendar-nav-color, var(--ty-color-neutral-strong));\ncursor: pointer;\ntransition: var(--ty-local-transition, all 0.15s ease);\noutline: none;\n}\n.nav-btn:hover {\nbackground-color: var(--ty-calendar-nav-hover-bg, var(--ty-bg-neutral-soft));\ncolor: var(--ty-calendar-nav-hover-color, var(--ty-color-neutral-strong));\n}\n.nav-btn:active {\nbackground-color: var(--ty-calendar-nav-active-bg, var(--ty-bg-neutral));\ntransform: scale(0.95);\n}\n.nav-btn:disabled {\nopacity: 0.35;\ncursor: default;\npointer-events: none;\n}\n.nav-btn:focus-visible {\noutline: 2px solid var(--ty-calendar-nav-focus-outline, var(--ty-calendar-accent, var(--ty-color-primary)));\noutline-offset: 2px;\n}\n.nav-btn svg {\nwidth: var(--nav-btn-icon-size);\nheight: var(--nav-btn-icon-size);\ndisplay: block;\n}\n',Ai=class t extends u{constructor(){super();const t=new Date;this.qn={displayMonth:t.getMonth()+1,displayYear:t.getFullYear()},b(this.shadowRoot,{css:Di,id:"ty-calendar-navigation"})}onConnect(){this.qn.displayMonth=this.displayMonth,this.qn.displayYear=this.displayYear,this.rt=at(this,()=>{this.render()}),this.render()}onDisconnect(){this.rt&&(this.rt(),this.rt=void 0)}onPropertiesChanged(t){for(const{name:n,newValue:e}of t)switch(n){case"display-month":this.qn.displayMonth=e;break;case"display-year":this.qn.displayYear=e}}get displayMonth(){return this.getProperty("display-month")}set displayMonth(t){this.setProperty("display-month",t)}get displayYear(){return this.getProperty("display-year")}set displayYear(t){this.setProperty("display-year",t)}get locale(){return st(this,this.getProperty("locale"))}set locale(t){this.setProperty("locale",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get width(){return this.getProperty("width")}set width(t){this.setProperty("width",t)}get view(){return this.getProperty("view")}set view(t){this.setProperty("view",t)}get min(){return this.getProperty("min")}set min(t){this.setProperty("min",t??"")}get max(){return this.getProperty("max")}set max(t){this.setProperty("max",t??"")}emitChangeEvent(t,n){const e=new CustomEvent("change",{detail:{month:t,year:n},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}static monthIndex(t,n){return 12*t+(n-1)}boundIndices(){const n=Si(this.min),e=Si(this.max);return{minIdx:n?t.monthIndex(n.year,n.month):null,maxIdx:e?t.monthIndex(e.year,e.month):null}}clampIndex(t){const{minIdx:n,maxIdx:e}=this.boundIndices();return null!==n&&n>t?n:null!==e&&t>e?e:t}navigateBy(n){const e=t.monthIndex(this.qn.displayYear,this.qn.displayMonth),i=this.clampIndex(e+n);i!==e&&this.emitChangeEvent(i%12+1,Math.floor(i/12))}isNavDisabled(n){const e=t.monthIndex(this.qn.displayYear,this.qn.displayMonth);return this.clampIndex(e+n)===e}createButton(t,n,e,i,o=!1){const r=document.createElement("button");return r.type="button",r.className=t,r.title=n,r.setAttribute("aria-label",n),r.innerHTML=e,r.disabled=o,r.addEventListener("click",i),r}render(){const t=this.shadowRoot;if(!t)return;b(t,{css:Di,id:"ty-calendar-navigation"}),this.setAttribute("data-size",this.size);const n=this.width;n?this.style.setProperty("--nav-width",n):this.style.removeProperty("--nav-width");const e="months"===this.view,i=Mi(this.qn.displayMonth,this.locale,"long");t.innerHTML="";const o=document.createElement("div");o.className="calendar-navigation-header";const r=document.createElement("button");if(r.type="button",r.className="nav-title",r.setAttribute("aria-expanded",e+""),r.setAttribute("aria-label",e?"Back to days":"Choose month and year"),!e){const t=document.createElement("span");t.className="nav-title-month",t.textContent=i,r.appendChild(t)}const s=document.createElement("span");s.className=e?"nav-title-month":"nav-title-year",s.textContent=this.qn.displayYear+"",r.appendChild(s);const a=document.createElement("span");a.className="nav-caret",a.innerHTML="<svg width='24' viewBox='0 0 24 24' height='24' xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'>\n<path d='m6 9 6 6 6-6'/>\n</svg>",r.appendChild(a),r.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("view-toggle",{detail:{view:e?"days":"months"}}))});const l=e?12:1,c=e?"year":"month",d=document.createElement("div");d.className="nav-group nav-arrows",d.appendChild(this.createButton(`nav-btn nav-${c}-prev`,"Previous "+c,"<?xml version='1.0' encoding='UTF-8'?>\n<svg width='24' viewBox='0 0 24 24' height='24' xmlns='http://www.w3.org/2000/svg' stroke-width='0' stroke='currentColor' fill='currentColor'>\n<path fill='none' d='M0 0h24v24H0V0z'/>\n<path d='M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z'/>\n</svg>",()=>this.navigateBy(-l),this.isNavDisabled(-l))),d.appendChild(this.createButton(`nav-btn nav-${c}-next`,"Next "+c,"<?xml version='1.0' encoding='UTF-8'?>\n<svg width='24' viewBox='0 0 24 24' height='24' xmlns='http://www.w3.org/2000/svg' stroke-width='0' stroke='currentColor' fill='currentColor'>\n<path fill='none' d='M0 0h24v24H0V0z'/>\n<path d='M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z'/>\n</svg>",()=>this.navigateBy(l),this.isNavDisabled(l))),o.appendChild(r),o.appendChild(d),t.appendChild(o)}};Ai.properties={"display-month":{type:"number",visual:!0,default:()=>(new Date).getMonth()+1,validate:t=>{const n=+t;return Number.isInteger(n)&&n>=1&&12>=n},coerce:t=>{const n=+t;return isNaN(n)||1>n||n>12?(new Date).getMonth()+1:n}},"display-year":{type:"number",visual:!0,default:()=>(new Date).getFullYear(),validate:t=>{const n=+t;return Number.isInteger(n)&&n>=1&&9999>=n},coerce:t=>{const n=+t;return isNaN(n)||1>n||n>9999?(new Date).getFullYear():n}},locale:{type:"string",visual:!0,default:"en-US"},size:{type:"string",visual:!0,default:"md",validate:t=>["sm","md","lg"].includes(t),coerce:t=>["sm","md","lg"].includes(t)?t:"md"},width:{type:"string",visual:!0,default:""},view:{type:"string",visual:!0,default:"days",validate:t=>"days"===t||"months"===t,coerce:t=>"months"===t?"months":"days"},min:{type:"string",visual:!0,default:""},max:{type:"string",visual:!0,default:""}};let Li=Ai;customElements.get("ty-calendar-navigation")||customElements.define("ty-calendar-navigation",Li);const ji="var(--ty-calendar-selected-bg, var(--ty-calendar-accent, var(--calendar-month-selected-bg, var(--ty-solid-primary, var(--ty-color-primary)))))",Fi="var(--ty-calendar-selected-color, var(--calendar-month-selected-color, var(--ty-solid-primary-fg, white)))",Vi=`\n.calendar-container {\ndisplay: flex;\nflex-direction: column;\ngap: 0.125rem;\nbox-sizing: border-box;\nfont-family: inherit;\nalign-items: center;\n}\n@media (max-width: 320px) {\n.calendar-container {\ngap: 0.375rem;\n}\n}\n.month-grid {\ndisplay: grid;\ngrid-template-columns: repeat(3, 1fr);\ngrid-auto-rows: 1fr;\ngap: 0.375rem;\nbox-sizing: border-box;\npadding: 0.75rem;\nmin-width: 280px;\nwidth: var(--calendar-width, auto);\n}\n.month-grid.size-sm { padding: 0.5rem; min-width: 240px; gap: 0.25rem; }\n.month-grid.size-lg { padding: 1rem; min-width: 360px; gap: 0.5rem; }\n.month-cell {\nposition: relative;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nmin-height: 2.5rem;\npadding: 0;\nborder: none;\nborder-radius: var(--ty-calendar-day-radius, 0.5rem);\nbackground: transparent;\ncolor: var(--ty-calendar-day-color, var(--ty-text));\nfont-family: inherit;\nfont-size: 0.875rem;\ncursor: pointer;\noutline: none;\ntransition: var(--ty-local-transition, background-color 0.15s ease, color 0.15s ease);\n}\n.month-grid.size-sm .month-cell { font-size: 0.75rem; min-height: 2rem; }\n.month-grid.size-lg .month-cell { font-size: 1rem; min-height: 3rem; }\n.month-cell:hover {\ncolor: var(--ty-calendar-day-hover-color, var(--ty-text-strong));\nbackground-color: var(--ty-calendar-day-hover-bg, var(--ty-bg-neutral));\nfont-weight: 500;\n}\n.month-cell:focus-visible {\nbox-shadow: 0 0 0 2px var(--calendar-month-accent, var(--ty-color-primary));\n}\n.month-cell.current {\ncolor: var(--ty-calendar-today-color, var(--ty-calendar-today-accent, var(--calendar-month-accent, var(--ty-color-primary))));\nfont-weight: 600;\n}\n.month-cell.current::after {\ncontent: "";\nposition: absolute;\ntop: calc(50% + 0.72em);\nleft: 50%;\nwidth: 4px;\nheight: 4px;\nmargin-left: -2px;\nborder-radius: 50%;\nbackground: currentColor;\n}\n.month-cell.selected {\nbackground-color: ${ji};\ncolor: ${Fi};\nfont-weight: 600;\n}\n.month-cell.selected:hover {\nbackground-color: var(--ty-calendar-selected-hover-bg, var(--calendar-month-selected-hover-bg, color-mix(in oklab, ${ji} 85%, ${Fi})));\n}\n.month-cell:disabled {\ncolor: var(--ty-calendar-disabled-color, var(--ty-text-faint));\nopacity: var(--ty-calendar-disabled-opacity, 0.7);\ntext-decoration: line-through;\ntext-decoration-color: color-mix(in oklab, currentColor 60%, transparent);\ncursor: default;\npointer-events: none;\n}\n${ki}\n`;function Ii(){const t=new Date;return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function Oi(t){return t&&/^\d{4}$/.test(t)?parseInt(t,10):null}function Hi(t){if(!t||!/^\d{1,2}$/.test(t))return null;const n=parseInt(t,10);return 1>n||n>12?null:n}function Ni(t,n,e){if(!t||!/^\d{1,2}$/.test(t))return null;const i=parseInt(t,10),o=new Date(n,e,0).getDate();return 1>i||i>o?null:i}function Bi(t,n,e){return`${t}-${(""+n).padStart(2,"0")}-${(""+e).padStart(2,"0")}`}const Pi=class t extends HTMLElement{constructor(){super(),this.Me=!1,this.Se=!1,this.Mn="md",this.Te="primary",this._e="days",this.qe=0,this.De="";const t=Ii();this.qn={displayYear:t.year,displayMonth:t.month},this.attachShadow({mode:"open"}),"attachInternals"in this&&(this.$=this.attachInternals(),this.C=new d(this,this.$))}static get observedAttributes(){return["value","year","month","day","hide-navigation","stateless","locale","name","size","width","min","max","flavor"]}connectedCallback(){this.initializeFromAttributes();const t=this.dayContentFn;t&&!this.we&&(this.we=t,delete this.dayContentFn);const n=this.customCSS;n&&!this.xe&&(this.xe=n,delete this.customCSS);const e=this.value;if(e&&"string"==typeof e&&e!==this.value){const t=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(t){const n=parseInt(t[1],10),e=parseInt(t[2],10),i=parseInt(t[3],10);this.qn.selectedYear=n,this.qn.selectedMonth=e,this.qn.selectedDay=i,this.qn.displayYear=n,this.qn.displayMonth=e,this.Se||(this.setAttribute("year",""+n),this.setAttribute("month",""+e),this.setAttribute("day",""+i))}delete this.value}this.render(),this.updateFormValue(),this.rt=at(this,()=>{this.render()})}disconnectedCallback(){this.rt&&(this.rt(),this.rt=void 0),this.Ae=void 0,this.Le=void 0,this.je=void 0,this.Fe=void 0,this._e="days"}attributeChangedCallback(t,n,e){if(n!==e)switch(t){case"value":this.value=e||"";break;case"year":case"month":case"day":this.syncStateFromAttributes(),this.syncChildComponents(),this.updateFormValue();break;case"hide-navigation":this.Me=null!==e,this.render();break;case"stateless":this.Se=null!==e&&"false"!==e;break;case"locale":this.syncChildComponents();break;case"size":"sm"!==e&&"md"!==e&&"lg"!==e||(this.Mn=e,this.$e=void 0,this.removeAttribute("width"),this.syncChildComponents());break;case"width":this.$e=e||void 0,e&&(this.Mn="md",this.removeAttribute("size")),this.syncChildComponents();break;case"name":this.updateFormValue();break;case"min":case"max":this["min"===t?"ke":"ze"]=e||void 0,this.syncChildComponents(),this.updateValidity();break;case"flavor":this.Te=e||"primary",this.syncChildComponents()}}get min(){return this.ke}set min(t){t?this.setAttribute("min",t):this.removeAttribute("min")}get max(){return this.ze}set max(t){t?this.setAttribute("max",t):this.removeAttribute("max")}get flavor(){return this.Te}set flavor(t){t?this.setAttribute("flavor",t):this.removeAttribute("flavor")}get year(){return this.qn.selectedYear}set year(t){void 0!==t?this.Se?(this.qn.displayYear=t,this.setAttribute("year",""+t)):(this.qn.selectedYear=t,this.qn.displayYear=t,this.setAttribute("year",""+t)):(this.Se||delete this.qn.selectedYear,this.removeAttribute("year")),this.syncChildComponents(),this.Se||this.updateFormValue()}get month(){return this.qn.selectedMonth}set month(t){void 0!==t?this.Se?(this.qn.displayMonth=t,this.setAttribute("month",""+t)):(this.qn.selectedMonth=t,this.qn.displayMonth=t,this.setAttribute("month",""+t)):(this.Se||delete this.qn.selectedMonth,this.removeAttribute("month")),this.syncChildComponents(),this.Se||this.updateFormValue()}get day(){return this.qn.selectedDay}set day(t){void 0!==t?(this.qn.selectedDay=t,this.setAttribute("day",""+t)):(delete this.qn.selectedDay,this.removeAttribute("day")),this.syncChildComponents(),this.updateFormValue()}get locale(){return st(this,this.getAttribute("locale"))}set locale(t){this.setAttribute("locale",t)}get hideNavigation(){return this.Me}set hideNavigation(t){this.Me=t,t?this.setAttribute("hide-navigation",""):this.removeAttribute("hide-navigation")}get stateless(){return this.Se}set stateless(t){this.Se=t,t?this.setAttribute("stateless",""):this.removeAttribute("stateless")}get size(){return this.Mn}set size(t){this.Mn!==t&&(this.Mn=t,this.$e=void 0,this.removeAttribute("width"),this.setAttribute("size",t),this.syncChildComponents())}get width(){return this.$e}set width(t){this.$e!==t&&(this.$e=t,t?(this.Mn="md",this.removeAttribute("size"),this.setAttribute("width",t)):this.removeAttribute("width"),this.syncChildComponents())}get dayContentFn(){return this.we}set dayContentFn(t){this.we=t,this.syncChildComponents()}get customCSS(){return this.xe}set customCSS(t){this.xe=t,this.syncChildComponents()}get value(){const{selectedYear:t,selectedMonth:n,selectedDay:e}=this.qn;return t&&n&&e?Bi(t,n,e):""}set value(t){if(t){const n=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(n){const t=parseInt(n[1],10),e=parseInt(n[2],10),i=parseInt(n[3],10);this.qn.selectedYear=t,this.qn.selectedMonth=e,this.qn.selectedDay=i,this.qn.displayYear=t,this.qn.displayMonth=e,this.Se||(this.setAttribute("year",""+t),this.setAttribute("month",""+e),this.setAttribute("day",""+i))}}else delete this.qn.selectedYear,delete this.qn.selectedMonth,delete this.qn.selectedDay,this.Se||(this.removeAttribute("year"),this.removeAttribute("month"),this.removeAttribute("day"));this.syncChildComponents(),this.Se||this.updateFormValue()}initializeFromAttributes(){const t=this.getAttribute("year"),n=this.getAttribute("month"),e=this.getAttribute("day"),i=this.hasAttribute("hide-navigation"),o=this.getAttribute("stateless"),r=this.getAttribute("size"),s=this.getAttribute("width");this.ke=this.getAttribute("min")||void 0,this.ze=this.getAttribute("max")||void 0;const a=Oi(t);a&&(this.qn.displayYear=a);const l=Hi(n);if(l&&(this.qn.displayMonth=l),a&&l){const t=Ni(e,a,l);t&&(this.qn.selectedYear=a,this.qn.selectedMonth=l,this.qn.selectedDay=t)}this.Me=i,null!==o&&(this.Se="false"!==o),!r||"sm"!==r&&"md"!==r&&"lg"!==r||(this.Mn=r),s&&(this.$e=s),this.De=this.value}formResetCallback(){this.value=this.De}syncStateFromAttributes(){const t=this.getAttribute("year"),n=this.getAttribute("month"),e=this.getAttribute("day"),i=Oi(t),o=Hi(n);if(i&&(this.qn.displayYear=i),o&&(this.qn.displayMonth=o),i&&o){const t=Ni(e,i,o);t?(this.qn.selectedYear=i,this.qn.selectedMonth=o,this.qn.selectedDay=t):(delete this.qn.selectedYear,delete this.qn.selectedMonth,delete this.qn.selectedDay)}else delete this.qn.selectedYear,delete this.qn.selectedMonth,delete this.qn.selectedDay}syncChildComponents(){if(this.Ae&&(this.Ae.displayMonth=this.qn.displayMonth,this.Ae.displayYear=this.qn.displayYear,this.Ae.locale=this.locale,this.Ae.size=this.Mn,this.Ae.min=this.ke??"",this.Ae.max=this.ze??"",this.Ae.width=this.$e,this.Ae.view=this._e),this.je&&this.showBody(),this.Le){this.Le.displayMonth=this.qn.displayMonth,this.Le.displayYear=this.qn.displayYear,this.Le.locale=this.locale,this.Le.size=this.Mn,this.Le.min=this.ke,this.Le.max=this.ze,this.Le.flavor=this.Te,this.Le.width=this.$e,this.we&&(this.Le.dayContentFn=this.we),this.xe&&(this.Le.customCSS=this.xe);const{selectedYear:t,selectedMonth:n,selectedDay:e}=this.qn;this.Le.value=t&&n&&e?new Date(t,n-1,e).getTime():null}}updateFormValue(){if(this.Se)return;if(!this.$)return;const t=this.getAttribute("name"),{selectedYear:n,selectedMonth:e,selectedDay:i}=this.qn;if(t&&n&&e&&i){const t=Bi(n,e,i);this.$.setFormValue(t)}else this.$.setFormValue("");this.updateValidity()}updateValidity(){if(!this.$)return;const{selectedYear:t,selectedMonth:n,selectedDay:e}=this.qn;if(t&&n&&e){const i=Date.UTC(t,n-1,e),o=this.ke?Si(this.ke):null,r=this.ze?Si(this.ze):null;if(o&&i<Date.UTC(o.year,o.month-1,o.day))return void this.C.set({rangeUnderflow:!0},`Date must be ${this.ke} or later`);if(r&&i>Date.UTC(r.year,r.month-1,r.day))return void this.C.set({rangeOverflow:!0},`Date must be ${this.ze} or earlier`)}this.C.set({})}get form(){return this.$?.form??null}get validity(){return this.$?.validity}get validationMessage(){return this.$?.validationMessage??""}get willValidate(){return this.$?.willValidate??!1}checkValidity(){return this.$?.checkValidity()??!0}reportValidity(){return this.C?.report()??!0}setCustomValidity(t){this.C?.setCustom(t)}handleNavigationChange(t){t.preventDefault(),t.stopPropagation();const{month:n,year:e}=t.detail;this.goTo(n,e)}goTo(t,n){this.qn.displayMonth=t,this.qn.displayYear=n,this.syncChildComponents(),this.dispatchEvent(new CustomEvent("navigate",{detail:{month:t,year:n,action:"navigate",source:"navigation"},bubbles:!0,composed:!0,cancelable:!1}))}handleDayClick(t){t.preventDefault(),t.stopPropagation();const{dayContext:n,year:e,month:i,day:o}=t.detail;this.Se?this.dispatchEvent(new CustomEvent("day-click",{detail:t.detail,bubbles:!0,composed:!0,cancelable:!0})):(this.qn.selectedYear=e,this.qn.selectedMonth=i,this.qn.selectedDay=o,this.qn.displayYear=e,this.qn.displayMonth=i,this.setAttribute("year",""+e),this.setAttribute("month",""+i),this.setAttribute("day",""+o),this.updateFormValue(),this.syncChildComponents(),this.dispatchEvent(new CustomEvent("change",{detail:{year:e,month:i,day:o,action:"select",source:"day-click",dayContext:n},bubbles:!0,composed:!0,cancelable:!1})))}refresh(){this.syncChildComponents(),this.Le&&"function"==typeof this.Le.refresh&&this.Le.refresh()}createNavigation(){const t=document.createElement("ty-calendar-navigation");return t.displayMonth=this.qn.displayMonth,t.displayYear=this.qn.displayYear,t.locale=this.locale,t.size=this.Mn,t.min=this.ke??"",t.max=this.ze??"",this.$e&&(t.width=this.$e),t.view=this._e,t.addEventListener("change",t=>this.handleNavigationChange(t)),t.addEventListener("view-toggle",t=>{this.setView(t.detail.view),this.focusNavTitle()}),this.Ae=t,t}createMonthDisplay(){const t=document.createElement("ty-calendar-month");t.displayMonth=this.qn.displayMonth,t.displayYear=this.qn.displayYear,t.locale=this.locale,t.size=this.Mn,t.min=this.ke,t.max=this.ze,t.flavor=this.Te,this.$e&&(t.width=this.$e);const{selectedYear:n,selectedMonth:e,selectedDay:i}=this.qn;return n&&e&&i&&(t.value=new Date(n,e-1,i).getTime()),this.we&&(t.dayContentFn=this.we),this.xe&&(t.customCSS=this.xe),t.addEventListener("day-click",t=>this.handleDayClick(t)),this.Le=t,t}render(){const t=this.shadowRoot;if(!t)return;b(t,{css:Vi,id:"ty-calendar"}),t.innerHTML="",this.je=void 0;const n=document.createElement("div");if(n.className="calendar-container",n.addEventListener("keydown",t=>this.handleKeydown(t)),this.Fe=n,!this.Me){const t=this.createNavigation();n.appendChild(t)}const e=this.createMonthDisplay();n.appendChild(e),t.appendChild(n),"months"===this._e&&this.showBody()}setView(t){t!==this._e&&("months"===t&&this.Le&&(this.qe=this.Le.getBoundingClientRect().height),this._e=t,this.Ae&&(this.Ae.view=t),this.showBody())}showBody(){const t=this.Fe;if(!t||!this.Le)return;if("days"===this._e)return this.je?.remove(),this.je=void 0,void(this.Le.isConnected||t.appendChild(this.Le));const n=this.buildMonthGrid();this.je?this.je.replaceWith(n):(this.Le.remove(),t.appendChild(n)),this.je=n}static monthIndex(t,n){return 12*t+(n-1)}boundIndices(){const n=this.ke?Si(this.ke):null,e=this.ze?Si(this.ze):null;return{minIdx:n?t.monthIndex(n.year,n.month):null,maxIdx:e?t.monthIndex(e.year,e.month):null}}buildMonthGrid(){const{displayYear:n,displayMonth:e,selectedYear:i,selectedMonth:o}=this.qn,r=Ii(),{minIdx:s,maxIdx:a}=this.boundIndices(),l=document.createElement("div");l.className="month-grid size-"+this.Mn,l.setAttribute("role","grid"),l.setAttribute("aria-label",n+""),this.qe&&(l.style.minHeight=this.qe+"px"),this.$e&&l.style.setProperty("--calendar-width",this.$e);for(let c=1;12>=c;c++){const d=t.monthIndex(n,c),h=null!==s&&s>d||null!==a&&d>a,u=i===n&&o===c,p=document.createElement("button");p.type="button",p.className="month-cell",p.setAttribute("role","gridcell"),p.setAttribute("aria-selected",u+""),p.setAttribute("aria-label",`${Mi(c,this.locale,"long")} ${n}`),p.dataset.month=c+"",p.tabIndex=c===e?0:-1,p.disabled=h,u&&p.classList.add("selected"),r.year===n&&r.month===c&&p.classList.add("current"),p.textContent=Mi(c,this.locale,"short"),p.addEventListener("click",()=>this.pickMonth(c)),l.appendChild(p)}return l.addEventListener("keydown",t=>{const n="ArrowLeft"===t.key?-1:"ArrowRight"===t.key?1:"ArrowUp"===t.key?-3:"ArrowDown"===t.key?3:0;if(!n)return;const i=Array.from(l.querySelectorAll(".month-cell")),o=i.findIndex(t=>t===this.shadowRoot.activeElement),r=i[(-1===o?e-1:o)+n];r&&!r.disabled&&(t.preventDefault(),i.forEach(t=>t.tabIndex=-1),r.tabIndex=0,r.focus())}),l}pickMonth(t){this.setView("days"),this.goTo(t,this.qn.displayYear),this.focusDayGrid()}handleKeydown(n){if("Escape"===n.key&&"months"===this._e)return n.preventDefault(),n.stopPropagation(),this.setView("days"),void this.focusNavTitle();if("PageUp"!==n.key&&"PageDown"!==n.key)return;n.preventDefault();const e="PageUp"===n.key?-1:1,i=n.shiftKey||"months"===this._e?12:1,o=t.monthIndex(this.qn.displayYear,this.qn.displayMonth),{minIdx:r,maxIdx:s}=this.boundIndices();let a=o+e*i;if(null!==r&&r>a&&(a=r),null!==s&&a>s&&(a=s),a!==o)if(this.goTo(a%12+1,Math.floor(a/12)),"months"===this._e){const t=this.je?.querySelector('.month-cell[tabindex="0"]');t?.focus()}else this.focusDayGrid()}focusNavTitle(){requestAnimationFrame(()=>{this.Ae?.shadowRoot?.querySelector(".nav-title")?.focus()})}focus(t){const n="months"===this._e?this.je?.querySelector('.month-cell[tabindex="0"]'):this.Le?.shadowRoot?.querySelector('.calendar-day-cell[tabindex="0"]');n?n.focus(t):super.focus(t)}focusDayGrid(){requestAnimationFrame(()=>{const t=this.Le?.shadowRoot?.querySelector('.calendar-day-cell[tabindex="0"]');t?.focus()})}};Pi.formAssociated=!0;let Wi=Pi;customElements.get("ty-calendar")||customElements.define("ty-calendar",Wi);const Ri=(t,n)=>{const e=e=>n?e?`var(--ty-color-${t}${e}, var(--ty-color-${t}, var(--ty-color-${n}${e})))`:`var(--ty-color-${t}, var(--ty-color-${n}))`:e?`var(--ty-color-${t}${e}, var(--ty-color-${t}))`:`var(--ty-color-${t})`;return`\n:host([flavor="${t}"]) {\n--date-picker-accent: var(--ty-input-${t}-border, ${e("-soft")});\n--date-picker-accent-bold: ${e("")};\n--date-picker-ring: color-mix(in oklab, ${e("")} 15%, transparent);\n}\n:host([flavor="${t}+"]) {\n--date-picker-accent: ${e("")};\n--date-picker-accent-bold: ${e("-strong")};\n--date-picker-ring: color-mix(in oklab, ${e("-strong")} 15%, transparent);\n}\n:host([flavor="${t}-"]) {\n--date-picker-accent: ${e("-faint")};\n--date-picker-accent-bold: ${e("-soft")};\n--date-picker-ring: color-mix(in oklab, ${e("-soft")} 15%, transparent);\n}\n`},Yi=`\n${et}\n:host {\ndisplay: block;\nwidth: auto;\nmin-width: 200px;\nfont-family: inherit;\n--ty-date-picker-bg: var(--ty-input-bg);\n--ty-date-picker-color: var(--ty-input-color);\n--ty-date-picker-placeholder: var(--ty-input-placeholder);\n--ty-date-picker-border: var(--ty-input-border);\n--ty-date-picker-border-hover: var(--ty-input-border-hover);\n--ty-date-picker-border-focus: var(--ty-input-border-focus);\n--ty-date-picker-shadow-focus: var(--ty-input-shadow-focus);\n--ty-date-picker-disabled-bg: var(--ty-input-disabled-bg);\n--ty-date-picker-disabled-color: var(--ty-input-disabled-color);\n--ty-date-picker-radius: var(--ty-radius-md);\n--ty-calendar-surface-bg: var(--ty-surface-floating);\n--ty-calendar-surface-border: var(--ty-input-border);\n--ty-calendar-surface-shadow: var(--ty-shadow-lg, 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1));\n--ty-calendar-surface-radius: var(--ty-radius-lg);\n--ty-calendar-time-bg: transparent;\n--ty-calendar-time-border: var(--ty-border-faint);\n--ty-calendar-time-label-color: var(--ty-color-neutral);\n--ty-calendar-time-input-color: var(--ty-input-color);\n--ty-calendar-time-placeholder-color: var(--ty-input-placeholder);\n--ty-calendar-time-icon-color: var(--ty-color-neutral-soft);\n}\n.dropdown-container {\ndisplay: flex;\nflex-direction: column;\nwidth: 100%;\nbox-sizing: border-box;\n}\n.ty-field-label {\nfont-size: var(--ty-field-label-font);\nline-height: var(--ty-field-label-leading);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-medium);\ncolor: var(--ty-label-color);\nmargin-bottom: var(--ty-field-label-gap);\npadding-left: var(--ty-field-outer-pad-x);\ndisplay: flex;\nalign-items: center;\n}\n.required-icon {\ndisplay: inline-flex;\nalign-items: center;\ncolor: #ef4444;\nwidth: 12px;\nheight: 12px;\nvertical-align: middle;\nmargin-left: 4px;\n}\n.dropdown-wrapper {\nposition: relative;\ndisplay: block;\nwidth: 100%;\n}\n.date-picker-stub ::slotted([slot="start"]) {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nflex-shrink: 0;\nmargin-right: 0.5rem;\ncolor: var(--ty-text-soft);\n}\n.date-picker-stub ::slotted(ty-icon[slot="start"]) {\nwidth: 1em;\nheight: 1em;\n}\n.date-picker-stub {\nwidth: 100%;\ncursor: pointer;\nbox-sizing: border-box;\nposition: relative;\ndisplay: flex;\nalign-items: center;\nbackground: var(--ty-date-picker-bg);\ncolor: var(--ty-date-picker-color);\nborder: 1px solid var(--date-picker-accent, var(--ty-date-picker-border));\nborder-radius: var(--ty-date-picker-radius);\nfont-family: inherit;\nfont-size: var(--ty-field-font);\nfont-weight: var(--ty-font-normal);\nline-height: var(--ty-field-leading);\nmin-height: var(--ty-field-height);\npadding: 0 var(--ty-field-pad-x);\npadding-right: calc(var(--ty-field-pad-x) + 1rem + var(--ty-field-pad-x));\ntransition: var(--ty-transition-all), opacity 0.2s ease;\noutline: none;\n}\n.date-picker-stub:hover:not([disabled]):not(.open) {\nborder-color: var(--date-picker-accent-bold, var(--ty-date-picker-border-hover));\n}\n.date-picker-stub[disabled] {\nbackground-color: var(--ty-date-picker-disabled-bg);\ncolor: var(--ty-date-picker-disabled-color);\ncursor: not-allowed;\nopacity: 0.6;\n}\n.date-picker-stub:focus,\n.date-picker-stub.open {\nborder-color: var(--date-picker-accent-bold, var(--ty-date-picker-border-focus));\nbox-shadow: 0 0 0 3px var(--date-picker-ring, var(--ty-date-picker-shadow-focus));\n}\n${n.filter(t=>"neutral"!==t).map(t=>Ri(t)).join("")}\n.stub-text {\nflex: 1;\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\nuser-select: none;\ncolor: inherit;\npointer-events: none;\n}\n.stub-text.placeholder {\ncolor: var(--ty-date-picker-placeholder);\n}\n.stub-icons {\ndisplay: flex;\nalign-items: center;\ngap: var(--ty-spacing-1);\nposition: absolute;\nright: var(--ty-spacing-3);\ntop: 50%;\ntransform: translateY(-50%);\nheight: 1rem;\npointer-events: none;\nz-index: 2;\n}\n.stub-clear {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nwidth: 1rem;\nheight: 1rem;\npadding: 0;\nborder: none;\nbackground: none;\ncolor: var(--ty-color-neutral-soft);\ncursor: pointer;\nborder-radius: var(--ty-radius-sm);\ntransition: var(--ty-local-transition, all 0.15s ease);\npointer-events: auto;\n}\n.stub-clear:hover {\ncolor: var(--ty-color-danger);\nbackground-color: var(--ty-bg-danger-soft);\n}\n.stub-arrow {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nwidth: 1rem;\nheight: 1rem;\ncolor: var(--date-picker-accent, var(--ty-color-neutral-soft));\n}\n.date-picker-stub:hover .stub-arrow {\ncolor: var(--date-picker-accent-bold, var(--ty-color-neutral));\n}\n.date-picker-stub:focus .stub-arrow,\n.date-picker-stub.open .stub-arrow {\ncolor: var(--date-picker-accent-bold, var(--ty-date-picker-border-focus));\n}\n.calendar-dialog {\nposition: fixed;\nflex-direction: column;\nmax-width: 90vw;\nmargin: 0;\npadding: 0;\nborder: none;\nbackground: transparent;\nbox-sizing: border-box;\npadding: var(--calendar-padding, 8px);\nopacity: 0;\nscale: 0.96;\ntranslate: 0 -6px;\ntransform-origin: top center;\ntransition:\nopacity var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\nscale var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\ntranslate var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1));\ntransform: translate(var(--calendar-offset-x, 0px), var(--calendar-offset-y, 0px));\ntop: -1000px;\nleft: -1000px;\n}\n.calendar-dialog.position-below {\nleft: var(--calendar-x);\ntop: var(--calendar-y);\n}\n.calendar-dialog.position-above {\nleft: var(--calendar-x);\nbottom: var(--calendar-y);\ntop: auto;\nflex-direction: column-reverse;\ntranslate: 0 6px;\ntransform-origin: bottom center;\n}\n.calendar-dialog.open {\nopacity: 1;\nscale: 1;\ntranslate: 0 0;\n}\n@starting-style {\n.calendar-dialog.open {\nopacity: 0;\nscale: 0.96;\ntranslate: 0 -6px;\n}\n.calendar-dialog.open.position-above {\ntranslate: 0 6px;\n}\n}\n.calendar-dialog::backdrop {\nbackground: transparent\n}\n.calendar-content {\nbackground-color: var(--ty-calendar-surface-bg);\nborder: 1px solid var(--ty-calendar-surface-border);\nborder-radius: var(--ty-calendar-surface-radius);\nbox-shadow: var(--ty-calendar-surface-shadow);\noverflow: hidden;\ndisplay: flex;\nflex-direction: column;\nalign-items: center;\n}\n.native-date-input {\nposition: absolute;\ninset: 0;\nopacity: 0;\nwidth: 100%;\nheight: 100%;\nmargin: 0;\npadding: 0;\nborder: none;\ncursor: pointer;\nz-index: 1;\n}\n.native-date-input::-webkit-calendar-picker-indicator {\nposition: absolute;\ninset: 0;\nwidth: 100%;\nheight: 100%;\nmargin: 0;\npadding: 0;\ncursor: pointer;\n}\n.time-section {\ndisplay: flex;\nflex-direction: column;\ngap: 0.375rem;\nwidth: 100%;\nbox-sizing: border-box;\npadding: 0.75rem 1rem 0.875rem;\nborder-top: 1px solid var(--ty-calendar-time-border);\nbackground-color: var(--ty-calendar-time-bg);\n}\n.time-row {\ndisplay: flex;\nalign-items: center;\njustify-content: space-between;\ngap: 0.75rem;\n}\n.time-label {\ndisplay: inline-flex;\nalign-items: center;\ngap: 0.5rem;\nfont-size: var(--ty-font-sm);\nfont-weight: 500;\ncolor: var(--ty-calendar-time-label-color);\n}\n.time-icon {\ndisplay: flex;\ncolor: var(--ty-calendar-time-icon-color);\nwidth: 1rem;\nheight: 1rem;\n}\n.time-fields {\ndisplay: inline-flex;\nalign-items: center;\ngap: 0.25rem;\n}\n.time-colon {\nfont-weight: 600;\ncolor: var(--ty-calendar-time-label-color);\n}\n.time-input {\nwidth: 2.75rem;\nheight: 2.125rem;\nbox-sizing: border-box;\nborder: 1px solid var(--ty-input-border);\nborder-radius: var(--ty-radius-md, 0.5rem);\nbackground: var(--ty-input-bg);\ncolor: var(--ty-calendar-time-input-color);\nfont-family: inherit;\nfont-size: var(--ty-font-base, 0.9375rem);\nfont-weight: 500;\nfont-variant-numeric: tabular-nums;\ntext-align: center;\npadding: 0;\noutline: none;\ncaret-color: transparent;\ntransition: var(--ty-transition-all);\n}\n.time-input::selection {\nbackground: var(--ty-bg-primary-soft, var(--ty-bg-primary));\n}\n.time-input:hover {\nborder-color: var(--ty-input-border-hover, var(--ty-input-border));\n}\n.time-input:focus {\nborder-color: var(--ty-input-border-focus);\nbox-shadow: 0 0 0 3px var(--ty-input-shadow-focus);\n}\n.time-summary {\ndisplay: flex;\njustify-content: space-between;\ngap: 0.75rem;\nfont-size: var(--ty-font-xs, 0.75rem);\ncolor: var(--ty-calendar-time-label-color);\n}\n.time-summary-iso {\nfont-family: var(--ty-font-mono, ui-monospace, SFMono-Regular, monospace);\ncolor: var(--ty-calendar-time-placeholder-color);\n}\n`,Ui="<svg stroke='currentColor' fill='none' stroke-width='2' viewBox='0 0 24 24' width='16' height='16' xmlns='http://www.w3.org/2000/svg'><rect x='3' y='4' width='18' height='18' rx='2' ry='2'></rect><line x1='16' y1='2' x2='16' y2='6'></line><line x1='8' y1='2' x2='8' y2='6'></line><line x1='3' y1='10' x2='21' y2='10'></line></svg>",Xi="<svg stroke='currentColor' fill='none' stroke-width='2' viewBox='0 0 24 24' width='14' height='14' xmlns='http://www.w3.org/2000/svg'><line x1='18' y1='6' x2='6' y2='18'></line><line x1='6' y1='6' x2='18' y2='18'></line></svg>",Ki=new WeakMap;let Zi=0;function Ji(t){let n=Ki.get(t);return void 0===n&&(n=++Zi,Ki.set(t,n)),n}function Gi(t,n){if(!t)return null;let e=null;if("string"==typeof t)if(/^\d{4}-\d{2}-\d{2}$/.test(t)){const[n,i,o]=t.split("-");e=new Date(parseInt(n,10),parseInt(i,10)-1,parseInt(o,10),0,0,0,0)}else e=new Date(t);else"number"==typeof t&&(e=new Date(t));return!e||isNaN(e.getTime())?null:{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:n?e.getHours():0,minute:n?e.getMinutes():0}}function Qi(t){const{year:n,month:e,day:i,hour:o,minute:r}=t;return n&&e&&i?new Date(n,e-1,i,o||0,r||0,0,0):null}function to(t){if(!t.year||!t.month||!t.day)return null;const n=Qi(t);return n?n.toISOString():null}function no(t,n){if(!t.year||!t.month||!t.day)return null;const e=(""+t.year).padStart(4,"0"),i=(""+t.month).padStart(2,"0"),o=(""+t.day).padStart(2,"0");return n?`${e}-${i}-${o}T${(""+(t.hour||0)).padStart(2,"0")}:${(""+(t.minute||0)).padStart(2,"0")}`:`${e}-${i}-${o}`}class eo{constructor(t,n,e,i=0,o=0){this.hourEl=t,this.minuteEl=n,this.onChange=e,this.typed="",this.hour=i,this.minute=o,this.paint(),this.wire(t,"hour"),this.wire(n,"minute")}static pad(t){return(""+t).padStart(2,"0")}paint(){this.hourEl.value=eo.pad(this.hour),this.minuteEl.value=eo.pad(this.minute)}wire(t,n){const e="hour"===n?23:59,i="hour"===n?2:5;t.addEventListener("focus",()=>{this.typed="",t.select()}),t.addEventListener("click",()=>t.select()),t.addEventListener("blur",()=>{this.typed=""}),t.addEventListener("input",()=>this.paint()),t.addEventListener("keydown",o=>{const r=t=>{"hour"===n?this.hour=t:this.minute=t,this.paint(),this.onChange(this.hour,this.minute)},s="hour"===n?this.hour:this.minute;if(/^\d$/.test(o.key)){o.preventDefault();const s=this.typed+o.key,a=2===s.length||1===s.length&&+o.key>i;return r(Math.min(+s,e)),void(a?(this.typed="","hour"===n?this.minuteEl.focus():t.select()):this.typed=s)}switch(o.key){case"ArrowUp":case"ArrowDown":{o.preventDefault();const n="ArrowUp"===o.key?1:-1;return this.typed="",r((s+n+e+1)%(e+1)),void t.select()}case"Backspace":case"Delete":return o.preventDefault(),"minute"===n&&""===this.typed&&"Backspace"===o.key&&0===s?void this.hourEl.focus():(this.typed="",r(0),void t.select());case"ArrowLeft":return void("minute"===n&&(o.preventDefault(),this.hourEl.focus()));case"ArrowRight":return void("hour"===n&&(o.preventDefault(),this.minuteEl.focus()));case"Tab":case"Escape":case"Enter":return;default:1!==o.key.length||o.metaKey||o.ctrlKey||o.preventDefault()}})}getTime(){return{hour:this.hour,minute:this.minute}}setTime(t,n){this.hour=t,this.minute=n,this.paint()}}const io=class extends u{constructor(){super(),this.qn={withTime:!1,open:!1},this.Ve=0,this.j=null,b(this.shadowRoot,{css:Yi,id:"ty-date-picker"})}onConnect(){this.initializeState(),this.render(),this.updateFormValue(),this.rt=at(this,()=>{this.render()}),this.F()}F(){this.j=k(this.shadowRoot,this.j,"default"===this.flavor?"neutral":this.flavor,({base:t})=>(t=>Ri(t,"neutral"))(t))}onDisconnect(){this.rt&&(this.rt(),this.rt=void 0),this.cleanup()}onPropertiesChanged(t){for(const{name:n,newValue:e}of t)switch(n){case"flavor":this.F();break;case"size":case"label":case"placeholder":case"required":case"disabled":this.updateValidity();break;case"noClear":case"format":case"locale":break;case"value":{const t=Gi(e,this.qn.withTime);if(null===t){(void 0!==this.qn.year||void 0!==this.qn.month||void 0!==this.qn.day)&&(this.qn={withTime:this.qn.withTime,open:this.qn.open}),this.syncFormValue();break}const n={year:this.qn.year,month:this.qn.month,day:this.qn.day,hour:this.qn.hour,minute:this.qn.minute};(t?.year!==n.year||t?.month!==n.month||t?.day!==n.day||t?.hour!==n.hour||t?.minute!==n.minute)&&(this.qn={...this.qn,...t},this.syncFormValue());break}case"with-time":e!==this.qn.withTime&&(this.qn.withTime=e,void 0!==this.qn.year&&void 0!==this.qn.month&&void 0!==this.qn.day&&this.syncFormValue())}}getFormValue(){return to(this.getComponents())}updateFormValue(){this.$.setFormValue(this.getFormValue()??""),this.updateValidity()}focus(t){const n=this.shadowRoot?.querySelector(".date-picker-stub");n?n.focus(t):super.focus(t)}updateValidity(){if(this.getProperty("disabled")||!this.getProperty("required")||this.getFormValue())return void this.applyValidity({});const t=this.shadowRoot?.querySelector(".date-picker-stub, .native-date-input");this.applyValidity({valueMissing:!0},"Please select a date",t??void 0)}getComponents(){return{year:this.qn.year,month:this.qn.month,day:this.qn.day,hour:this.qn.hour,minute:this.qn.minute}}hasDate(){return!!(this.qn.year&&this.qn.month&&this.qn.day)}getFormattedValue(t){const n=t||this.getComponents();return n.year&&n.month&&n.day?function(t,n,e,i){if(!t.year||!t.month||!t.day)return null;const o=Qi(t);if(!o)return null;const r={dateStyle:n};return i&&(r.timeStyle="short"),new Intl.DateTimeFormat(e,r).format(o)}(n,this.getProperty("format")||"long",st(this,this.getProperty("locale")),this.qn.withTime):null}initializeState(){const t=this.getProperty("value"),n=this.getProperty("with-time"),e=Gi(t,n);this.qn=null===e?{withTime:n,open:!1}:{...e,withTime:n,open:!1},this.syncFormValue()}updateState(t,n=!1){this.qn={...this.qn,...t},(n||!this.qn.open||!this.qn.withTime)&&this.syncFormValue()}syncFormValue(){const t=this.getFormValue();t!==this.getProperty("value")&&this.setProperty("value",t||null)}handleTimeInputChange(t,n){if(!this.hasDate())return;const e={...this.getComponents(),hour:t,minute:n};this.updateState(e,!0),this.emitChangeEvent(e,"time-change"),this.updateTimeSummary()}updateTimeSummary(t=this.shadowRoot?.querySelector(".time-summary")){if(!t)return;const n=this.getComponents(),e=t.querySelector(".time-summary-date"),i=t.querySelector(".time-summary-iso");if(!n.year||!n.month||!n.day)return e.textContent="Pick a day",void(i.textContent="");const o=st(this,this.getProperty("locale"))||void 0,r=new Date(n.year,n.month-1,n.day,n.hour??0,n.minute??0),s=new Intl.DateTimeFormat(o,{weekday:"short",month:"short",day:"numeric"}).format(r),a=new Intl.DateTimeFormat(o,{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(r);e.textContent=`${s} · ${a}`,i.textContent=no(n,!0)??""}emitChangeEvent(t,n){const e=t?to(t):null,i=t?no(t,this.qn.withTime):null,o=t?Qi(t)?.getTime()??null:null,r=t?this.getFormattedValue(t):null,s=new CustomEvent("change",{detail:{value:e,localValue:i,milliseconds:o,formatted:r,source:n},bubbles:!0,cancelable:!0});this.dispatchEvent(s)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get placement(){return this.getProperty("placement")}set placement(t){this.setProperty("placement",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get placeholder(){return this.getProperty("placeholder")}set placeholder(t){this.setProperty("placeholder",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get format(){return this.getProperty("format")}set format(t){this.setProperty("format",t)}get locale(){return this.getProperty("locale")}set locale(t){this.setProperty("locale",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get noClear(){return this.getProperty("noClear")}set noClear(t){this.setProperty("noClear",t)}get min(){return this.getProperty("min")}set min(t){this.setProperty("min",t??"")}get max(){return this.getProperty("max")}set max(t){this.setProperty("max",t??"")}get withTime(){return this.getProperty("with-time")}set withTime(t){this.setProperty("with-time",t)}get value(){return this.getProperty("value")||null}set value(t){if(null==t||""===t)this.setProperty("value",null);else{const n=t instanceof Date?t.toISOString():t;this.setProperty("value",n)}}clear(){this.clearValue()}buildStubClasses(){const t=["date-picker-stub"];return this.getProperty("disabled")&&t.push("disabled"),this.getProperty("required")&&t.push("required"),this.qn.open&&t.push("open"),t.join(" ")}renderStub(){const t=document.createElement("div");t.className=this.buildStubClasses();const n=this.getProperty("disabled");n&&t.setAttribute("disabled","true"),t.setAttribute("role","button"),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded",this.qn.open+""),t.setAttribute("tabindex",n?"-1":"0"),n&&t.setAttribute("aria-disabled","true"),this.getProperty("label")&&t.setAttribute("aria-labelledby","date-picker-label-"+Ji(this)),t.addEventListener("keydown",t=>{this.qn.open||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleStubClick(t))});const e=document.createElement("slot");e.name="start";const i=document.createElement("span");i.className="stub-text";const o=this.getFormattedValue(),r=this.getProperty("placeholder")||"Select date...";i.textContent=o||r,o||i.classList.add("placeholder");const s=document.createElement("div");if(s.className="stub-icons",!this.getProperty("noClear")&&o&&!n){const t=document.createElement("button");t.className="stub-clear",t.type="button",t.innerHTML=Xi,t.addEventListener("click",t=>this.handleClearClick(t)),s.appendChild(t)}const a=document.createElement("span");return a.className="stub-arrow",a.innerHTML=Ui,s.appendChild(a),t.addEventListener("click",t=>this.handleStubClick(t)),t.appendChild(e),t.appendChild(i),t.appendChild(s),t}createTimeField(t){const n=document.createElement("input");return n.type="text",n.className="time-input time-"+t,n.inputMode="numeric",n.autocomplete="off",n.maxLength=2,n.setAttribute("aria-label","hour"===t?"Hours":"Minutes"),n}renderTimeSection(){const t=document.createElement("div");t.className="time-section",t.setAttribute("role","group"),t.setAttribute("aria-label","Time");const n=document.createElement("div");n.className="time-row";const e=document.createElement("span");e.className="time-label";const i=document.createElement("span");i.className="time-icon",i.innerHTML="<svg stroke='currentColor' fill='none' stroke-width='2' viewBox='0 0 24 24' width='16' height='16' xmlns='http://www.w3.org/2000/svg'><circle cx='12' cy='12' r='10'></circle><polyline points='12,6 12,12 16,14'></polyline></svg>",e.appendChild(i),e.appendChild(document.createTextNode("Time"));const o=document.createElement("div");o.className="time-fields";const r=this.createTimeField("hour"),s=this.createTimeField("minute"),a=document.createElement("span");a.className="time-colon",a.textContent=":",o.appendChild(r),o.appendChild(a),o.appendChild(s),this.Ie=new eo(r,s,(t,n)=>this.handleTimeInputChange(t,n),this.qn.hour||0,this.qn.minute||0),n.appendChild(e),n.appendChild(o);const l=document.createElement("div");l.className="time-summary",l.setAttribute("aria-live","polite");const c=document.createElement("span");c.className="time-summary-date";const d=document.createElement("span");return d.className="time-summary-iso",l.appendChild(c),l.appendChild(d),this.updateTimeSummary(l),t.appendChild(n),t.appendChild(l),t}renderCalendarDropdown(){const t=document.createElement("dialog");t.className="calendar-dialog";const n=document.createElement("div");n.className="calendar-content";const e=document.createElement("ty-calendar");this.qn.year&&this.qn.month&&this.qn.day&&(e.setAttribute("year",""+this.qn.year),e.setAttribute("month",""+this.qn.month),e.setAttribute("day",""+this.qn.day));const i=st(this,this.getProperty("locale"));i&&e.setAttribute("locale",i);const o=this.getProperty("min"),r=this.getProperty("max");o&&e.setAttribute("min",o),r&&e.setAttribute("max",r);const s=this.getProperty("flavor");return s&&"default"!==s&&e.setAttribute("flavor",s),e.addEventListener("change",t=>this.handleCalendarChange(t)),n.appendChild(e),this.qn.withTime&&n.appendChild(this.renderTimeSection()),t.appendChild(n),t.addEventListener("close",()=>{this.updateState({open:!1})}),t}renderNativeInput(){const t=document.createElement("div");t.className="dropdown-wrapper";const n=document.createElement("div");n.className=this.buildStubClasses();const e=this.getProperty("disabled");e&&n.setAttribute("disabled","true");const i=document.createElement("input");i.className="native-date-input",i.type=this.qn.withTime?"datetime-local":"date",e&&(i.disabled=!0),this.getProperty("required")&&(i.required=!0);const o=this.getProperty("min"),r=this.getProperty("max");o&&(i.min=this.qn.withTime?o+"T00:00":o),r&&(i.max=this.qn.withTime?r+"T23:59":r);const s=no(this.getComponents(),this.qn.withTime);s&&(i.value=s);const a=this.getProperty("placeholder")||"Select date...",l=this.getFormattedValue(),c=document.createElement("span");c.className="stub-text"+(l?"":" placeholder"),c.textContent=l||a,i.addEventListener("change",()=>{if(!i.value)return void this.clearValue();const t=Gi(i.value,this.qn.withTime);t&&(this.updateState(t,!0),this.emitChangeEvent(t,"selection"))});const d=document.createElement("slot");d.name="start",n.appendChild(d),n.appendChild(i),n.appendChild(c);const h=document.createElement("div");if(h.className="stub-icons",!this.getProperty("noClear")&&s&&!e){const t=document.createElement("button");t.className="stub-clear",t.type="button",t.innerHTML=Xi,t.addEventListener("click",t=>this.handleClearClick(t)),h.appendChild(t)}const u=document.createElement("span");return u.className="stub-arrow",u.innerHTML=Ui,h.appendChild(u),n.appendChild(h),t.appendChild(n),t}calculateCalendarPosition(){if(!this.shadowRoot)return;if(ue())return;const t=this.shadowRoot.querySelector(".date-picker-stub"),n=this.shadowRoot.querySelector(".calendar-dialog");if(!t||!n)return;const e=t.getBoundingClientRect(),i=n.getBoundingClientRect(),o=i.height||400,r=i.width||320,s=Gt(this.getProperty("placement")),a=nn({anchorRect:e,popupWidth:r,popupHeight:o,gap:0,align:s.align,side:s.side}),l=a.below,c=l?a.topY:a.bottomY;this.style.setProperty("--calendar-x",a.x-8+"px"),this.style.setProperty("--calendar-y",c+"px"),this.style.setProperty("--calendar-offset-x","0px"),this.style.setProperty("--calendar-offset-y","0px"),l?(n.classList.add("position-below"),n.classList.remove("position-above")):(n.classList.add("position-above"),n.classList.remove("position-below"))}renderContainer(){const t=document.createElement("div");t.className="dropdown-container";const n=this.getProperty("label");if(n){const e=document.createElement("label");e.className="ty-field-label",e.id="date-picker-label-"+Ji(this),e.innerHTML=n+(this.getProperty("required")?'<span class="required-icon">*</span>':""),t.appendChild(e)}return t}render(){if(!this.shadowRoot)return;if(b(this.shadowRoot,{css:Yi,id:"ty-date-picker"}),ue()){if(this.shadowRoot.querySelector(".native-date-input"))return void this.updateDisplay();this.shadowRoot.innerHTML="";const t=this.renderContainer();return t.appendChild(this.renderNativeInput()),void this.shadowRoot.appendChild(t)}const t=this.shadowRoot.querySelector(".calendar-dialog");if(t&&t.open&&this.qn.open)return this.updateDisplay(),void this.calculateCalendarPosition();this.shadowRoot.innerHTML="";const n=this.renderContainer(),e=document.createElement("div");e.className="dropdown-wrapper",e.appendChild(this.renderStub()),e.appendChild(this.renderCalendarDropdown()),n.appendChild(e),this.shadowRoot.appendChild(n),this.setupEventListeners()}updateDisplay(){if(!this.shadowRoot)return;const t=this.getFormattedValue(),n=this.getProperty("placeholder")||"Select date...",e=this.hasDate(),i=!this.getProperty("noClear"),o=this.getProperty("disabled"),r=this.shadowRoot.querySelector(".stub-text");r&&(r.textContent=t||n,r.classList.toggle("placeholder",!t));const s=this.shadowRoot.querySelector(".stub-clear");if(s&&(s.style.display=i&&e&&!o?"":"none"),ue()){const t=this.shadowRoot.querySelector(".native-date-input");if(t){const n=no(this.getComponents(),this.qn.withTime);t.value=n||""}return}const a=this.shadowRoot.querySelector("ty-calendar");if(a&&e&&(a.setAttribute("year",""+this.qn.year),a.setAttribute("month",""+this.qn.month),a.setAttribute("day",""+this.qn.day)),a){const t=this.getProperty("flavor");t&&"default"!==t?a.setAttribute("flavor",t):a.removeAttribute("flavor");const n=this.getProperty("min"),e=this.getProperty("max");n?a.setAttribute("min",n):a.removeAttribute("min"),e?a.setAttribute("max",e):a.removeAttribute("max")}this.Ie&&void 0!==this.qn.hour&&void 0!==this.qn.minute&&this.Ie.setTime(this.qn.hour,this.qn.minute),this.updateTimeSummary()}setupEventListeners(){this.Oe&&document.removeEventListener("click",this.Oe),this.He&&document.removeEventListener("keydown",this.He),this.Oe=t=>this.handleOutsideClick(t),this.He=t=>this.handleEscapeKey(t),document.addEventListener("click",this.Oe),document.addEventListener("keydown",this.He);const t=this.shadowRoot?.querySelector(".calendar-dialog");t&&(this.Ne=t=>this.handleDialogClick(t),t.addEventListener("click",this.Ne))}handleStubClick(t){t.preventDefault();const n=this.shadowRoot?.querySelector(".calendar-dialog");!this.qn.open||n&&n.open||(this.updateState({open:!1},!0),Tn("date-picker-"+(this.id||""+this))),!this.getProperty("disabled")&&Date.now()-this.Ve>300&&this.openDropdown()}clearValue(){this.updateState({year:void 0,month:void 0,day:void 0,hour:void 0,minute:void 0},!0),this.value=null,this.emitChangeEvent(null,"clear"),this.render()}handleClearClick(t){t.preventDefault(),t.stopPropagation(),this.clearValue()}handleCalendarChange(t){t.preventDefault(),t.stopPropagation();const n=t.detail.dayContext;if(!n)return;const e={year:n.year,month:n.month,day:n.dayInMonth,hour:this.qn.hour,minute:this.qn.minute};this.updateState(e,!0),this.emitChangeEvent(e,"selection"),this.qn.withTime?requestAnimationFrame(()=>{if(!this.shadowRoot)return;this.updateTimeSummary();const t=this.shadowRoot.querySelector(".time-hour");t&&t.focus()}):this.closeDropdown()}handleDialogClick(t){if(!this.shadowRoot)return;const n=this.shadowRoot.querySelector(".calendar-dialog"),e=this.shadowRoot.querySelector(".calendar-content");t.target===n&&this.qn.open&&e&&!e.contains(t.target)&&(t.preventDefault(),t.stopPropagation(),this.closeDropdown())}handleOutsideClick(t){if(!this.shadowRoot)return;const n=t.target,e=this.shadowRoot.querySelector(".calendar-dialog");this.qn.open&&e&&!this.contains(n)&&!e.contains(n)&&this.closeDropdown()}handleEscapeKey(t){"Escape"===t.key&&this.qn.open&&(t.preventDefault(),this.closeDropdown())}openDropdown(){this.qn.open||ue()||(this.updateState({open:!0}),this.dispatchEvent(new CustomEvent("open")),this.render(),requestAnimationFrame(()=>{if(!this.shadowRoot)return;const t=this.shadowRoot.querySelector(".calendar-dialog");if(t){Sn("date-picker-"+(this.id||""+this)),t.showModal(),this.calculateCalendarPosition(),t.classList.add("open");const n=this.shadowRoot.querySelector(".date-picker-stub");n&&n.setAttribute("aria-expanded","true");const e=this.shadowRoot.activeElement;e&&e.blur()}}))}closeDropdown(){if(!this.qn.open)return;this.Ve=Date.now();const t="date-picker-"+(this.id||""+this);if(this.updateState({open:!1},!0),Tn(t),this.shadowRoot){const t=this.shadowRoot.querySelector(".calendar-dialog");t&&(t.classList.remove("position-above","position-below","open"),t.close());const n=this.shadowRoot.querySelector(".date-picker-stub");n&&n.setAttribute("aria-expanded","false")}this.dispatchEvent(new CustomEvent("close")),this.render()}cleanup(){if(this.Oe&&document.removeEventListener("click",this.Oe),this.He&&document.removeEventListener("keydown",this.He),this.Ne&&this.shadowRoot){const t=this.shadowRoot.querySelector(".calendar-dialog");t&&t.removeEventListener("click",this.Ne)}this.qn.open&&Tn("date-picker-"+(this.id||""+this)),this.Oe=void 0,this.He=void 0,this.Ne=void 0,this.Ie=void 0}};io.properties={placement:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},flavor:{type:"string",visual:!0,default:"default"},label:{type:"string",visual:!0,default:""},placeholder:{type:"string",visual:!0,default:"Select date..."},name:{type:"string",visual:!1,default:""},min:{type:"string",visual:!0,default:""},max:{type:"string",visual:!0,default:""},required:{type:"boolean",visual:!0,default:!1},disabled:{type:"boolean",visual:!0,default:!1},noClear:{type:"boolean",visual:!0,default:!1},format:{type:"string",visual:!0,default:"long",validate:t=>["short","medium","long","full"].includes(t),coerce:t=>["short","medium","long","full"].includes(t)?t:"long"},locale:{type:"string",visual:!0,default:""},value:{type:"string",visual:!0,formValue:!0,emitChange:!1,default:null},"with-time":{type:"boolean",visual:!0,default:!1}},io.formAssociated=!0;let oo=io;customElements.get("ty-date-picker")||customElements.define("ty-date-picker",oo);const ro=new Map,so=new Map;function ao(t){return ro.get(t)}function lo(t,n){so.has(t)||so.set(t,new Set),so.get(t).add(n);const e=ro.get(t);return e&&n(e),()=>{so.get(t)?.delete(n),0===so.get(t)?.size&&so.delete(t)}}function co(){return Object.fromEntries(ro)}function ho(t,n,e){ro.set(t,{width:n,height:e});const i=so.get(t);if(i){const t={width:n,height:e};i.forEach(n=>n(t))}}function uo(t){ro.delete(t),so.delete(t)}class TyResizeObserver extends HTMLElement{constructor(){super(),this.qt=null,this.Be=null;const t=this.attachShadow({mode:"open"});b(t,{css:"\n:host {\ndisplay: block;\nposition: relative;\n}\n::slotted(*) {\n}\n",id:"ty-resize-observer"}),t.innerHTML="<slot></slot>"}static get observedAttributes(){return["id","debounce"]}get debounce(){return parseInt(this.getAttribute("debounce")||"0")}set debounce(t){this.setAttribute("debounce",t+"")}connectedCallback(){this.setupObserver()}attributeChangedCallback(t,n,e){if("id"===t&&n&&n!==e&&(uo(n),e&&this.isConnected)){const{width:t,height:n}=this.getBoundingClientRect();ho(e,t,n)}}disconnectedCallback(){this.cleanup()}setupObserver(){this.qt=new ResizeObserver(t=>{this.debounce>0?(this.Be&&clearTimeout(this.Be),this.Be=window.setTimeout(()=>{this.handleResize(t)},this.debounce)):this.handleResize(t)}),this.qt.observe(this)}handleResize(t){const{width:n,height:e}=t[0].contentRect;this.id&&ho(this.id,n,e)}cleanup(){this.qt&&(this.qt.disconnect(),this.qt=null),this.Be&&(clearTimeout(this.Be),this.Be=null),this.id&&uo(this.id)}}customElements.get("ty-resize-observer")||customElements.define("ty-resize-observer",TyResizeObserver);const po=`\n:host {\ndisplay: block;\nposition: relative;\noverflow: hidden;\n}\n.scroll-wrapper {\nwidth: 100%;\nheight: 100%;\noverflow-y: auto;\noverflow-x: hidden;\n}\n:host([overflow-x]) .scroll-wrapper {\noverflow-x: auto;\n}\n:host([max-height]) .scroll-wrapper {\nmax-height: var(--scroll-max-height);\n}\n:host([hide-scrollbar]) .scroll-wrapper {\nscrollbar-width: none;\n-ms-overflow-style: none;\n}\n:host([hide-scrollbar]) .scroll-wrapper::-webkit-scrollbar {\ndisplay: none;\n}\n:host([scroll-anchoring]) .scroll-wrapper {\noverflow-anchor: none;\n}\n:host([custom-scrollbar]) .scroll-wrapper {\nscrollbar-width: none;\n-ms-overflow-style: none;\n}\n:host([custom-scrollbar]) .scroll-wrapper::-webkit-scrollbar {\ndisplay: none;\n}\n:host([custom-scrollbar]:hover) .ty-scrollbar-track-y.has-overflow,\n:host([custom-scrollbar]:hover) .ty-scrollbar-track-x.has-overflow {\nopacity: 1;\n}\n:host([custom-scrollbar][overflow-x]) .ty-scrollbar-track-y {\nbottom: var(--ty-scrollbar-width, 8px);\n}\n:host([custom-scrollbar]) .ty-scrollbar-track-x {\nright: var(--ty-scrollbar-width, 8px);\n}\n.shadow-overlay {\nposition: absolute;\ninset: 0;\npointer-events: none;\nz-index: 2;\n}\n.shadow-top,\n.shadow-bottom,\n.shadow-left,\n.shadow-right {\nposition: absolute;\nopacity: 0;\ntransition: var(--ty-scroll-shadow-transition, opacity 0.2s ease-out);\npointer-events: none;\n}\n.shadow-top {\ntop: -40px;\nleft: 0;\nright: 0;\nheight: 80px;\nbackground: var(--ty-scroll-shadow-top, radial-gradient(\nellipse 100% 30% at center,\ncolor-mix(in oklab, var(--ty-color-neutral-bold) 12%, transparent),\ntransparent,\ntransparent\n));\nclip-path: inset(50% 0 0 0);\n}\n.shadow-bottom {\nbottom: -30px;\nleft: 0;\nright: 0;\nheight: 60px;\nbackground: var(--ty-scroll-shadow-bottom, radial-gradient(\nellipse 100% 20% at center,\ncolor-mix(in oklab, var(--ty-color-neutral-bold) 18%, transparent),\ntransparent,\ntransparent\n));\nclip-path: inset(0 0 50% 0);\n}\n.shadow-left {\nleft: -30px;\ntop: 0;\nbottom: 0;\nwidth: 60px;\nbackground: var(--ty-scroll-shadow-left, radial-gradient(\nellipse 30% 100% at center,\ncolor-mix(in oklab, var(--ty-color-neutral-bold) 12%, transparent),\ntransparent,\ntransparent\n));\nclip-path: inset(0 0 0 50%);\n}\n.shadow-right {\nright: -30px;\ntop: 0;\nbottom: 0;\nwidth: 60px;\nbackground: var(--ty-scroll-shadow-right, radial-gradient(\nellipse 30% 100% at center,\ncolor-mix(in oklab, var(--ty-color-neutral-bold) 12%, transparent),\ntransparent,\ntransparent\n));\nclip-path: inset(0 50% 0 0);\n}\n.shadow-left,\n.shadow-right {\ndisplay: none;\n}\n:host([overflow-x]) .shadow-left,\n:host([overflow-x]) .shadow-right {\ndisplay: block;\n}\n.shadow-top.visible,\n.shadow-bottom.visible,\n.shadow-left.visible,\n.shadow-right.visible {\nopacity: 1;\n}\n:host([no-shadow]) .shadow-overlay {\ndisplay: none;\n}\n@media (pointer: coarse) and (hover: none) {\n:host([custom-scrollbar]) .scroll-wrapper {\nscrollbar-width: thin;\nscrollbar-color: var(--ty-border, color-mix(in oklab, var(--ty-color-neutral-bold) 25%, transparent)) transparent;\n}\n:host([custom-scrollbar]) .scroll-wrapper::-webkit-scrollbar {\ndisplay: block;\nwidth: 4px;\nheight: 4px;\n}\n:host([custom-scrollbar]) .scroll-wrapper::-webkit-scrollbar-thumb {\nbackground: var(--ty-border, color-mix(in oklab, var(--ty-color-neutral-bold) 25%, transparent));\nborder-radius: 2px;\n}\n}\n@media (prefers-reduced-motion: reduce) {\n.shadow-top,\n.shadow-bottom,\n.shadow-left,\n.shadow-right {\ntransition-duration: 0ms !important;\n}\n}\n${Pt}\n`;class TyScrollContainer extends HTMLElement{constructor(){super(),this.Pe=null,this.We=null,this.Re=null,this.Ye=null,this.Ue=null,this.ln=null,this.qt=null,this.oe=null,this.Tt=null,this.Xe=!1,this.Ke=!1,this.Ft=()=>{null===this.Tt&&(this.Tt=requestAnimationFrame(()=>{this.Tt=null,this.Ze()}))},this.Je=()=>{this.ln?.update(),this.Ze()};const t=this.attachShadow({mode:"open"});b(t,{css:po,id:"ty-scroll-container"}),t.innerHTML='\n<div class="scroll-wrapper">\n<slot></slot>\n</div>\n<div class="shadow-overlay">\n<div class="shadow-top"></div>\n<div class="shadow-bottom"></div>\n<div class="shadow-left"></div>\n<div class="shadow-right"></div>\n</div>\n',this.Pe=t.querySelector(".scroll-wrapper"),this.We=t.querySelector(".shadow-top"),this.Re=t.querySelector(".shadow-bottom"),this.Ye=t.querySelector(".shadow-left"),this.Ue=t.querySelector(".shadow-right")}static get observedAttributes(){return["no-shadow","max-height","hide-scrollbar","custom-scrollbar","overflow-x","scroll-anchoring"]}get noShadow(){return this.hasAttribute("no-shadow")}set noShadow(t){t?this.setAttribute("no-shadow",""):this.removeAttribute("no-shadow")}get maxHeight(){return this.getAttribute("max-height")}set maxHeight(t){t?this.setAttribute("max-height",t):this.removeAttribute("max-height"),this.Ge()}get hideScrollbar(){return this.hasAttribute("hide-scrollbar")}set hideScrollbar(t){t?this.setAttribute("hide-scrollbar",""):this.removeAttribute("hide-scrollbar")}get customScrollbar(){return this.hasAttribute("custom-scrollbar")}set customScrollbar(t){t?this.setAttribute("custom-scrollbar",""):this.removeAttribute("custom-scrollbar")}get overflowX(){return this.hasAttribute("overflow-x")}set overflowX(t){t?this.setAttribute("overflow-x",""):this.removeAttribute("overflow-x")}get nearEdgeThreshold(){const t=parseInt(this.getAttribute("near-edge-threshold")||"",10);return Number.isFinite(t)?t:100}set nearEdgeThreshold(t){null==t?this.removeAttribute("near-edge-threshold"):this.setAttribute("near-edge-threshold",t+"")}get scrollAnchoring(){return this.hasAttribute("scroll-anchoring")}set scrollAnchoring(t){t?this.setAttribute("scroll-anchoring",""):this.removeAttribute("scroll-anchoring")}connectedCallback(){if(this.Pe?.addEventListener("scroll",this.Ft,{passive:!0}),this.qt=new ResizeObserver(()=>{this.ln?.update(),this.Ze()}),this.Pe){this.qt.observe(this.Pe);const t=this.Pe.querySelector("slot");t&&t.addEventListener("slotchange",this.Je)}this.Ge(),this.Ze(),this.hn(),this.Qe()}disconnectedCallback(){this.Pe?.removeEventListener("scroll",this.Ft),this.dn(),this.ti(),this.qt&&(this.qt.disconnect(),this.qt=null),null!==this.Tt&&(cancelAnimationFrame(this.Tt),this.Tt=null)}attributeChangedCallback(t,n,e){n!==e&&("max-height"===t&&(this.Ge(),this.Ze(),this.ln?.update()),"custom-scrollbar"!==t&&"overflow-x"!==t||(this.dn(),this.hn(),this.Ze()),"scroll-anchoring"===t&&(this.ti(),this.Qe()))}Qe(){!this.oe&&this.scrollAnchoring&&(this.oe=new MutationObserver(t=>{const n=this.Pe;if(!n)return;const e=new Set;for(const o of t)o.addedNodes.forEach(t=>e.add(t));if(0===e.size)return;let i=0;for(const o of Array.from(this.children)){if(!e.has(o))break;i+=o.offsetHeight}i>0&&(n.scrollTop+=i,this.ln?.update())}),this.oe.observe(this,{childList:!0}))}ti(){this.oe?.disconnect(),this.oe=null}hn(){if(this.ln)return;if(!this.Pe||!this.customScrollbar)return;this.ln=new Bt(this.Pe,{vertical:!0,horizontal:this.overflowX});const t=this.shadowRoot;this.ln.trackY&&t.appendChild(this.ln.trackY),this.ln.trackX&&t.appendChild(this.ln.trackX)}dn(){this.ln&&(this.ln.trackY?.remove(),this.ln.trackX?.remove(),this.ln.destroy(),this.ln=null)}Ge(){if(this.Pe){const t=this.maxHeight;t?(this.Pe.style.setProperty("--scroll-max-height",t),this.Pe.style.maxHeight=t):(this.Pe.style.removeProperty("--scroll-max-height"),this.Pe.style.maxHeight="")}}Ze(){if(!this.Pe)return;const{scrollTop:t,scrollLeft:n,scrollHeight:e,scrollWidth:i,clientHeight:o,clientWidth:r}=this.Pe;this.We&&this.We.classList.toggle("visible",t>2),this.Re&&this.Re.classList.toggle("visible",e-2>t+o),this.overflowX&&(this.Ye&&this.Ye.classList.toggle("visible",n>2),this.Ue&&this.Ue.classList.toggle("visible",i-2>n+r));const s=e-o;if(s>0){const n=this.nearEdgeThreshold,i=s-t;this.Ke=this.ni("nearend",i,n,this.Ke,{distance:i,scrollTop:t,scrollHeight:e,clientHeight:o}),this.Xe=this.ni("nearstart",t,n,this.Xe,{distance:t,scrollTop:t,scrollHeight:e,clientHeight:o})}else this.Xe=!1,this.Ke=!1}ni(t,n,e,i,o){return e>=n&&(i||this.dispatchEvent(new CustomEvent(t,{detail:o,bubbles:!0,composed:!0})),!0)}updateShadows(){this.Ze(),this.ln?.update()}scrollToTop(t=!0){this.Pe?.scrollTo({top:0,behavior:t?"smooth":"auto"})}scrollToBottom(t=!0){this.Pe&&this.Pe.scrollTo({top:this.Pe.scrollHeight,behavior:t?"smooth":"auto"})}scrollToLeft(t=!0){this.Pe?.scrollTo({left:0,behavior:t?"smooth":"auto"})}scrollToRight(t=!0){this.Pe&&this.Pe.scrollTo({left:this.Pe.scrollWidth,behavior:t?"smooth":"auto"})}scrollToElement(t,n=!0){const e="string"==typeof t?this.querySelector(t):t;e?.scrollIntoView({behavior:n?"smooth":"auto",block:"nearest"})}get scrollElement(){return this.Pe}}customElements.define("ty-scroll-container",TyScrollContainer),"undefined"!=typeof window&&(window.tyVersion=T,window.tyIcons={register:t=>{O(t)},get:t=>H(t),has:t=>N(t),list:()=>Y(),cacheInfo:()=>U(),clearCache:()=>B()},window.tyResizeObserver={getSize:t=>ao(t),onResize:(t,n)=>lo(t,n),get sizes(){return co()}},window.tyLoader={set:t=>$(t),get:()=>C(),reset:()=>E()}),t.IconRegistry=X,t.TyButton=S,t.TyCalendar=Wi,t.TyCalendarMonth=TyCalendarMonth,t.TyCalendarNavigation=Li,t.TyCheckbox=wt,t.TyCopy=Ft,t.TyDatePicker=oo,t.TyFileUpload=Ot,t.TyIcon=G,t.TyInput=ht,t.TyModal=TyModal,t.TyOption=TyOption,t.TyPopup=TyPopup,t.TyRadio=St,t.TyRadioGroup=_t,t.TyResizeObserver=TyResizeObserver,t.TyScrollContainer=TyScrollContainer,t.TySelect=we,t.TySelectedOptions=TySelectedOptions,t.TySelectedTags=TySelectedOptions,t.TyStep=TyStep,t.TySwitch=$t,t.TyTab=TyTab,t.TyTabs=TyTabs,t.TyTag=nt,t.TyTextarea=Yt,t.TyTooltip=TyTooltip,t.TyWizard=TyWizard,t.disableScrollLockDebug=function(){window.tyScrollDebug=!1},t.enableScrollLockDebug=function(){window.tyScrollDebug=!0},t.forceUnlockAll=function(){Cn.activeLocks.clear(),Mn()},t.getActiveLocks=function(){return new Set(Cn.activeLocks)},t.getAllSizes=co,t.getLoaderSvg=C,t.getLockState=function(){return{locked:Cn.locked,scrollY:Cn.scrollY,activeLocks:Array.from(Cn.activeLocks)}},t.getSize=ao,t.isLocked=function(){return Cn.locked},t.isLockedBy=function(t){return Cn.activeLocks.has(t)},t.lockScroll=Sn,t.onResize=lo,t.resetLoaderSvg=E,t.setLoaderSvg=$,t.unlockScroll=Tn,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).Tyrell={})}(this,function(t){"use strict";const n=["primary","success","danger","warning","neutral"],e="sm";function i(t){if("string"==typeof t){const n=t.toLowerCase().trim();return"false"!==n&&"0"!==n}return!!t}function o(t){return"function"==typeof t.default?t.default():t.default}class r{constructor(t){this.t=new Map,this.i=t,this.o()}o(){for(const[t,n]of Object.entries(this.i))void 0!==n.default&&this.t.set(t,o(n))}hasConfig(t){return t in this.i}updateProperty(t,n,e="property"){const i=this.i[t];if(!i)return null;const o=this.t.get(t),r=this.l(t,n,i);return this.h(t,r,i)?this.u(o,r)?null:(this.t.set(t,r),{name:t,oldValue:o,newValue:r,source:e}):null}l(t,n,e){if(e.coerce)return e.coerce(n);if(null==n)return o(e)??null;switch(e.type){case"boolean":if("string"==typeof n){if(""===n)return!0;const t=n.toLowerCase().trim();return"false"!==t&&"0"!==t}return!!n;case"number":const t=+n;return isNaN(t)?o(e)??0:t;case"string":return n+"";case"object":case"array":if("string"==typeof n)try{return JSON.parse(n)}catch{return o(e)??("array"===e.type?[]:{})}return n;default:return n}}h(t,n,e){return!e.validate||e.validate(n)}u(t,n){if("object"!=typeof t||"object"!=typeof n)return t===n;if(null===t||null===n)return t===n;try{return JSON.stringify(t)===JSON.stringify(n)}catch{return!1}}get(t){return this.t.get(t)}getAll(){return Object.fromEntries(this.t)}getConfig(t){return this.i[t]}isVisual(t){return this.i[t]?.visual??!1}isFormValue(t){return this.i[t]?.formValue??!1}shouldEmitChange(t){return this.i[t]?.emitChange??!1}handleAlias(t,n){for(const[e,i]of Object.entries(this.i))if(i.aliases&&t in i.aliases)return this.updateProperty(e,null===n?o(i):i.aliases[t],"attribute");return null}}let s,a=!1,l=!1;const c=new Set;let d=!1;function h(){clearTimeout(s),l=!1,0!==c.size&&setTimeout(()=>{const t=[...c];c.clear(),t.forEach(t=>t.reveal())})}const u=new WeakSet;function p(t){u.has(t)||(u.add(t),t.addEventListener("invalid",t=>{if(!a)return;const n=t.target,e=n.form?b(n.form):void 0;e&&e!==n&&v(e)&&t.preventDefault()},!0))}function b(t){return Array.from(t.elements).find(t=>{const n=t;return n.willValidate&&n.validity&&!n.validity.valid&&!1!==n.checkVisibility?.({visibilityProperty:!0,checkVisibilityCSS:!0})})}const g=new WeakSet;function v(t){return g.has(t)&&"error"in t}class m{constructor(t,n){this.host=t,this.internals=n,this.own={flags:{}},this.custom="",this.written=null,function(){if(d)return;d=!0;const t=()=>{a=!0,setTimeout(()=>{a=!1})};document.addEventListener("click",n=>{const e=n.composedPath().find(t=>t instanceof HTMLButtonElement||t instanceof HTMLInputElement);!e?.form||"submit"!==e.type&&"image"!==e.type||t(),l&&h()},!0),document.addEventListener("keydown",n=>{const e=n.composedPath()[0];"Enter"===n.key&&!n.isComposing&&e instanceof HTMLInputElement&&e.form&&t()},!0);const n=HTMLFormElement.prototype;for(const e of["requestSubmit","reportValidity"]){const t=n[e];"function"==typeof t&&(n[e]=function(...n){const e=a;a=!0;try{return t.apply(this,n)}finally{a=e}})}document.addEventListener("pointerdown",()=>{clearTimeout(s),l=!0},!0),document.addEventListener("pointerup",t=>{"mouse"===t.pointerType?h():s=setTimeout(h,1e3)},!0),document.addEventListener("pointercancel",h,!0),p(document)}(),g.add(t),t.addEventListener("invalid",n=>{if(!v(t))return;if(p(t.getRootNode()),n.preventDefault(),this.showError(),!a)return;const e=this.internals.form;e&&b(e)!==t||t.focus()})}reveal(){l?c.add(this):"error"in this.host&&!this.internals.validity.valid&&this.showError()}get errorFromReport(){return null!==this.written&&this.host.getAttribute("error")===this.written}writeError(t){this.written=t,null===t?this.host.removeAttribute("error"):this.host.setAttribute("error",t)}showError(){this.host.getAttribute("error")&&!this.errorFromReport||this.writeError(this.internals.validationMessage)}reset(){c.delete(this),this.errorFromReport&&this.writeError(null),this.written=null}set(t,n,e){this.own={flags:t,message:n,anchor:e},this.sync()}setCustom(t){this.custom=t||"",this.sync()}report(){return!!this.internals.checkValidity()||("error"in this.host?(this.showError(),this.host.focus()):this.internals.reportValidity(),!1)}sync(){const{flags:t,message:n}=this.own,e=this.own.anchor&&function(t,n){for(let e=n;e;e=e.getRootNode().host)if(t.contains(e))return!0;return!1}(this.host,this.own.anchor)?this.own.anchor:void 0,i=Object.values(t).some(Boolean);this.custom?this.internals.setValidity({...t,customError:!0},this.custom,e):i?this.internals.setValidity(t,n||"Invalid value",e):this.internals.setValidity({}),this.errorFromReport?this.internals.validity.valid?this.writeError(null):this.host.getAttribute("error")!==this.internals.validationMessage&&this.showError():this.written=null}}const y={};function f(t,n,e=""){const i=y[t]??(y[t]=document.createElement(t));for(const o of i.getAttributeNames())i.removeAttribute(o);for(const[o,r]of Object.entries(n))!0===r?i.setAttribute(o,""):r&&i.setAttribute(o,r);return i.value=e,i.validationMessage}function w(t){if(null==t||""===(t+"").trim())return null;const n=+t;return Number.isInteger(n)&&n>=0?n:null}function x(t,n){return t.replace(/\{(\w+)\}/g,(t,e)=>null!=n[e]?n[e]+"":t)}function k(t,n,e){const i=t.length,o=w(n.minlength),r=w(n.maxlength),s={minlength:o,maxlength:r,length:i},a={};return null!==o&&o>i&&(a.tooShort=!n.tooShortMessage&&e?.validity.tooShort?e.validationMessage:x(n.tooShortMessage||"Use at least {minlength} characters (now {length})",s)),null!==r&&i>r&&(a.tooLong=x(n.tooLongMessage||"Use at most {maxlength} characters (now {length})",s)),a}const z=new WeakMap,$=new WeakMap;function C(t){const n=[];for(const e of function(t){let n=z.get(t);if(!n){const e=new Set;for(let n=t.prototype;n&&n!==HTMLElement.prototype;n=Object.getPrototypeOf(n))for(const[t,i]of Object.entries(Object.getOwnPropertyDescriptors(n)))i.set&&e.add(t);n=[...e],z.set(t,n)}return n}(t.constructor))({}).hasOwnProperty.call(t,e)&&(n.push([e,t[e]]),delete t[e]);return n}function M(t){const n=C(t);n.length&&$.set(t,n)}function E(t){const n=[...$.get(t)??[],...C(t)];$.delete(t);for(const[i,o]of n)if(void 0!==o)try{t[i]=o}catch(e){reportError(e)}}const S=class extends HTMLElement{constructor(){super(),this.p=!1,this.v=!1,this.m=!1,this.k=!1,this.$=null,this.props=new r(this.constructor.properties),this.C=this.attachInternals(),this.M=new m(this,this.C),this.shadowRoot||this.attachShadow({mode:"open"})}static get observedAttributes(){const t=[];for(const[n,e]of Object.entries(this.properties))if(t.push(n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()),e.aliases)for(const i of Object.keys(e.aliases))t.push(i);return t}setProperty(t,n){const e=this.props.updateProperty(t,n,"property");e&&(this.S(e),this.T([e]))}getProperty(t){return this.props.get(t)}S(t){const{name:n,newValue:e}=t,i=this.props.getConfig(n);if(!i)return;const o=this._(n);"boolean"===i.type?e?this.setAttribute(o,""):this.removeAttribute(o):null==e?this.removeAttribute(o):this.setAttribute(o,"object"==typeof e?JSON.stringify(e):e+"")}_(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}q(t){return t.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}attributeChangedCallback(t,n,e){if(n===e)return;let i=this.props.handleAlias(t,e);if(!i){const n=this.q(t),o=this.props.hasConfig(t)?t:n;i=this.props.updateProperty(o,e,"attribute")}i&&this.T([i])}connectedCallback(){if(!this.$){this.$=new Map;const t=this.constructor;for(const[n,e]of Object.entries(t.properties)){if(!e.formValue)continue;const t=this.getAttribute(this._(n));this.$.set(n,t??("function"==typeof e.default?e.default():e.default)??null)}}this.L(),this.p=!0,this.onConnect(),this.v||(this.render(),this.v=!0)}disconnectedCallback(){this.p=!1,this.onDisconnect()}L(){for(const t of Object.keys(this.constructor.properties)){if(!{}.hasOwnProperty.call(this,t))continue;const n=this[t];delete this[t],void 0!==n&&(t in this?this[t]=n:this.setProperty(t,n))}E(this)}T(t){0!==t.length&&(this.onPropertiesChanged(t),t.some(t=>this.props.isFormValue(t.name))&&this.updateFormValue(),t.some(t=>this.props.isVisual(t.name))&&this.p&&this.render(),this.D(t))}D(t){for(const n of t)this.props.shouldEmitChange(n.name)&&this.dispatchEvent(new CustomEvent("prop:change",{detail:{property:n.name,oldValue:n.oldValue,newValue:n.newValue},bubbles:!0,composed:!0}))}updateFormValue(){const t=this.getFormValue();this.C.setFormValue(t)}getFormValue(){return this.props.get("value")??null}onPropertiesChanged(t){}onConnect(){}onDisconnect(){}get form(){return this.C.form}get A(){return!0===this.constructor.formAssociated}applyValidity(t,n,e){this.M.set(t,n,e)}revealValidity(){this.A&&this.M.reveal()}get validity(){return this.A?this.C.validity:void 0}get validationMessage(){return this.A?this.C.validationMessage:""}get willValidate(){return!!this.A&&this.C.willValidate}checkValidity(){return!this.A||this.C.checkValidity()}reportValidity(){return!this.A||this.M.report()}setCustomValidity(t){this.A&&this.M.setCustom(t)}applyLabelName(t){let n=Array.from(this.C.labels??[]).map(t=>t.textContent?.trim()).filter(Boolean).join(" ");if(!n){const t=this.closest("label");if(t){const e=t.cloneNode(!0);e.querySelectorAll(this.tagName.toLowerCase()).forEach(t=>t.remove()),n=e.textContent?.trim()??""}}n?t.setAttribute("aria-label",n):t.removeAttribute("aria-label")}isDuplicateActivationClick(){return!!this.k||(this.k=!0,queueMicrotask(()=>{this.k=!1}),!1)}formResetCallback(){this.m=!1,this.A&&this.M.reset();for(const[t,n]of this.$??[])this.setProperty(t,n);this.onFormReset()}onFormReset(){}};S.formAssociated=!0,S.properties={};let T=S;const _=new Map;function q(t,n){const{css:e,id:i}=n;let o;i&&_.has(i)?o=_.get(i):(o=new CSSStyleSheet,o.replaceSync(e),i&&_.set(i,o));const r=t.adoptedStyleSheets||[];r.includes(o)||(t.adoptedStyleSheets=[...r,o])}const L=(t,n,e,i)=>i?`var(${t}-${n}${e}, var(${t}-${i}${e}))`:`var(${t}-${n}${e})`,D=(t,n)=>`oklch(from ${t} calc(l + var(--ty-${n})) c h)`,A=(t,n)=>`oklch(from ${t} calc(l + sign(0.5 - l) * abs(var(--ty-${n}))) c h)`,F=(t,n)=>{const e=e=>L("--ty-solid",t,e,n),i="neutral"===t?" --_border-l: var(--ty-button-border-l-neutral, var(--ty-button-border-l, -0.15));":" --_border-l: var(--_muted-border-l, var(--ty-button-border-l, -0.15));",o="neutral"===t?A:D;return`\nbutton.solid.${t} { --_ring: ${L("--ty-color",t,"",n)}; --_solid-bg: var(--ty-button-bg, var(--_muted-solid-bg, ${e("")})); --_solid-rest: var(--ty-button-bg, var(--_muted-solid-bg, ${e("")}));${i} color: var(--ty-button-color, var(--_muted-solid-fg, ${e("-fg")})); }\nbutton.solid.${t}.tone-plus { --_solid-bg: var(--ty-button-bg, var(--_muted-solid-bg, ${e("-strong")})); --_solid-rest: var(--ty-button-bg, var(--_muted-solid-bg, ${e("-strong")})); color: var(--ty-button-color, var(--_muted-solid-fg, ${e("-strong-fg")})); }\nbutton.solid.${t}.tone-minus { --_solid-bg: var(--ty-button-bg, var(--_muted-solid-bg, ${e("-soft")})); --_solid-rest: var(--ty-button-bg, var(--_muted-solid-bg, ${e("-soft")})); color: var(--ty-button-color, var(--_muted-solid-fg, ${e("-soft-fg")})); }\nbutton.solid.${t}:hover:not(:disabled) { --_solid-bg: var(--ty-button-bg-hover, ${e("-hover")}); }\nbutton.solid.${t}:active:not(:disabled) { --_solid-bg: ${e("-active")}; }\nbutton.solid.${t}.tone-plus:hover:not(:disabled) { --_solid-bg: var(--ty-button-bg-hover, ${o(e("-strong"),"solid-hover-l")}); }\nbutton.solid.${t}.tone-plus:active:not(:disabled) { --_solid-bg: ${o(e("-strong"),"solid-active-l")}; }\nbutton.solid.${t}.tone-minus:hover:not(:disabled) { --_solid-bg: var(--ty-button-bg-hover, ${D(e("-soft"),"solid-hover-l")}); }\nbutton.solid.${t}.tone-minus:active:not(:disabled) { --_solid-bg: ${D(e("-soft"),"solid-active-l")}; }\n`},V=(t,n)=>{const e=e=>"neutral"===t&&"-strong"===e?`var(--ty-solid-neutral${e})`:(e=>L("--ty-color",t,e,n))(e);return`\nbutton.outlined.${t} {\ncolor: var(--ty-button-color, var(--_muted-outlined-line, ${e("")}));\nborder-color: var(--ty-button-border, var(--_muted-outlined-line, ${e("")}));\n}\nbutton.outlined.${t}.tone-plus {\ncolor: var(--ty-button-color, var(--_muted-outlined-line, ${e("-strong")}));\nborder-color: var(--ty-button-border, var(--_muted-outlined-line, ${e("-strong")}));\n}\nbutton.outlined.${t}.tone-minus {\ncolor: var(--ty-button-color, var(--_muted-outlined-line, ${e("-soft")}));\nborder-color: var(--ty-button-border, var(--_muted-outlined-line, ${e("-soft")}));\n}\nbutton.outlined.${t}:hover:not(:disabled) {\nbackground: var(--ty-button-bg-hover, ${L("--ty-bg",t,"-soft",n)});\n}\nbutton.outlined.${t}:not(.muted):hover:not(:disabled),\nbutton.outlined.${t}:active:not(:disabled),\nbutton.outlined.${t}:focus-visible {\ncolor: var(--ty-button-color, ${e("-strong")});\nborder-color: var(--ty-button-border, ${e("-strong")});\n}\n`},j=(t,n)=>{const e=e=>"neutral"===t&&"-strong"===e?`var(--ty-solid-neutral${e})`:(e=>L("--ty-color",t,e,n))(e);return`\nbutton.ghost.${t} { color: var(--ty-button-color, var(--_muted-ghost-fg, ${e("")})); }\nbutton.ghost.${t}.tone-plus { color: var(--ty-button-color, var(--_muted-ghost-fg, ${e("-strong")})); }\nbutton.ghost.${t}.tone-minus { color: var(--ty-button-color, var(--_muted-ghost-fg, ${e("-soft")})); }\nbutton.ghost.${t}:hover:not(:disabled) {\nbackground: var(--ty-button-bg-hover, ${L("--ty-bg",t,"-soft",n)});\n}\nbutton.ghost.${t}:not(.muted):hover:not(:disabled),\nbutton.ghost.${t}:active:not(:disabled),\nbutton.ghost.${t}:focus-visible {\ncolor: var(--ty-button-color, ${e("-strong")});\n}\n`},I=`\n:host {\n--_rung: var(--ty-button-height);\ndisplay: inline-grid;\ngrid-template: minmax(var(--_rung), 1fr) / minmax(min-content, 1fr);\nheight: fit-content;\nfont-family: inherit;\n}\n:host([action]) {\n--_rung: var(--ty-button-action-size);\n}\n:host([action]:not([wide])) {\nwidth: fit-content;\naspect-ratio: 1;\n}\n:host([wide]) {\ndisplay: grid;\nflex-grow: 1;\ngrid-template-rows: minmax(var(--_rung), max-content);\n}\n:host([wide]) button {\nflex-grow: 1;\n}\n:host {\n--ty-button-height: 1.75rem; \n--ty-button-min-width: 4rem;\n--ty-button-pad-x: var(--ty-spacing-2);\n--ty-button-pad-y: 0px;\n--ty-button-font: var(--ty-font-xs);\n--ty-button-leading: var(--ty-leading-xs);\n--ty-button-tracking: var(--ty-tracking-xs);\n--ty-button-gap: var(--ty-spacing-1);\n--ty-button-action-size: 1.5rem;\n--ty-button-action-icon: 0.875rem;\n}\n:host([size="xs"]) {\n--ty-button-height: 1.5rem; \n--ty-button-pad-x: var(--ty-spacing-2);\n--ty-button-pad-y: 0px;\n--ty-button-font: var(--ty-font-xs);\n--ty-button-leading: var(--ty-leading-xs);\n--ty-button-tracking: var(--ty-tracking-xs);\n--ty-button-gap: var(--ty-spacing-1);\n--ty-button-action-size: 1.375rem;\n--ty-button-action-icon: 0.75rem;\n}\n:host([size="md"]) {\n--ty-button-height: 2rem; \n--ty-button-pad-x: var(--ty-spacing-3);\n--ty-button-pad-y: 0.375rem;\n--ty-button-font: var(--ty-font-sm);\n--ty-button-leading: var(--ty-leading-sm);\n--ty-button-tracking: var(--ty-tracking-sm);\n--ty-button-gap: var(--ty-spacing-2);\n--ty-button-action-size: 2rem;\n--ty-button-action-icon: 1rem;\n}\n:host([size="lg"]) {\n--ty-button-height: 2.25rem; \n--ty-button-pad-x: var(--ty-spacing-4);\n--ty-button-pad-y: 0.375rem;\n--ty-button-font: var(--ty-font-sm);\n--ty-button-leading: var(--ty-leading-sm);\n--ty-button-tracking: var(--ty-tracking-sm);\n--ty-button-gap: var(--ty-spacing-2);\n--ty-button-action-size: 2.25rem;\n--ty-button-action-icon: 1.125rem;\n}\n:host([size="xl"]) {\n--ty-button-height: 2.5rem; \n--ty-button-pad-x: var(--ty-spacing-6);\n--ty-button-pad-y: var(--ty-spacing-2);\n--ty-button-font: var(--ty-font-base);\n--ty-button-leading: var(--ty-leading-base);\n--ty-button-tracking: var(--ty-tracking-base);\n--ty-button-gap: var(--ty-spacing-2);\n--ty-button-action-size: 2.5rem;\n--ty-button-action-icon: 1.25rem;\n}\nbutton {\nfont-family: inherit;\nposition: relative;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\ngap: var(--ty-button-gap);\nheight: var(--ty-button-height);\nmin-height: 100%;\npadding: var(--ty-button-pad-y) var(--ty-button-pad-x);\nfont-size: var(--ty-button-font);\nline-height: var(--ty-button-leading);\nletter-spacing: var(--ty-button-tracking);\nfont-weight: var(--ty-weight-action, var(--ty-font-medium));\nwhite-space: nowrap;\ncursor: pointer;\nuser-select: none;\ntransition: var(--ty-local-transition, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease);\nbackground: transparent;\ncolor: var(--ty-color-neutral);\nborder: 1px solid transparent;\n}\nbutton:not(.action) {\nmin-width: var(--ty-button-min-width);\n}\nbutton:not(.pill) {\nborder-radius: var(--ty-radius-md);\n}\nbutton.xs:not(.pill) { border-radius: var(--ty-button-radius-xs, var(--ty-radius-md)); }\nbutton.sm:not(.pill) { border-radius: var(--ty-button-radius-sm, var(--ty-radius-md)); }\nbutton.md:not(.pill) { border-radius: var(--ty-button-radius-md, var(--ty-radius-md)); }\nbutton.lg:not(.pill) { border-radius: var(--ty-button-radius-lg, var(--ty-radius-md)); }\nbutton.xl:not(.pill) { border-radius: var(--ty-button-radius-xl, var(--ty-radius-md)); }\nbutton:focus-visible {\noutline: none;\n}\nbutton:disabled {\ncursor: not-allowed;\nopacity: 0.6;\n}\n.loader-icon {\ndisplay: none;\nalign-items: center;\njustify-content: center;\nflex-shrink: 0;\nwidth: 1em;\nheight: 1em;\ncolor: currentColor;\n}\n.loader-icon svg {\nwidth: 100%;\nheight: 100%;\n}\nbutton.loading {\ncursor: wait;\n}\nbutton.loading > *:not(.loader-icon) {\nvisibility: hidden;\n}\nbutton.loading > .loader-icon {\ndisplay: inline-flex;\nposition: absolute;\ntop: 50%;\nleft: 50%;\ntransform: translate(-50%, -50%);\nanimation: ty-button-spin 0.7s linear infinite;\n}\n@keyframes ty-button-spin {\nto { transform: translate(-50%, -50%) rotate(360deg); }\n}\n@media (prefers-reduced-motion: reduce) {\nbutton.loading > .loader-icon {\nanimation-duration: 1.6s;\n}\n}\n::slotted(*) {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\n}\n::slotted(ty-icon) {\nflex-shrink: 0;\n}\nbutton.action {\ngap: 0px !important;\nheight: auto;\nmin-width: var(--ty-button-action-size);\nmin-height: var(--ty-button-action-size);\npadding: 0px !important;\n}\nbutton.action ::slotted(ty-icon) {\nheight: var(--ty-button-action-icon);\nwidth: var(--ty-button-action-icon);\n}\nbutton.muted {\n--_muted-solid-bg: var(--ty-solid-neutral);\n--_muted-solid-fg: var(--ty-solid-neutral-fg);\n--_muted-outlined-line: var(--ty-color-neutral);\n--_muted-ghost-fg: var(--ty-color-neutral);\n--_muted-border-l: var(--ty-button-border-l-neutral, var(--ty-button-border-l, -0.15));\n}\nbutton.muted.tone-plus {\n--_muted-solid-bg: var(--ty-solid-neutral-strong);\n--_muted-solid-fg: var(--ty-solid-neutral-strong-fg);\n--_muted-outlined-line: var(--ty-solid-neutral-strong);\n--_muted-ghost-fg: var(--ty-solid-neutral-strong);\n}\nbutton.muted.tone-minus {\n--_muted-solid-bg: var(--ty-solid-neutral-soft);\n--_muted-solid-fg: var(--ty-solid-neutral-soft-fg);\n--_muted-outlined-line: var(--ty-color-neutral-soft);\n--_muted-ghost-fg: var(--ty-color-neutral-soft);\n}\n@media (hover: hover) and (pointer: fine) {\nbutton.muted:hover:not(:disabled) {\n--_muted-solid-bg: unset;\n--_muted-solid-fg: unset;\n--_muted-outlined-line: unset;\n--_muted-ghost-fg: unset;\n--_muted-border-l: unset;\n}\n}\nbutton.muted:active:not(:disabled),\nbutton.muted:focus-visible:not(:disabled) {\n--_muted-solid-bg: unset;\n--_muted-solid-fg: unset;\n--_muted-outlined-line: unset;\n--_muted-ghost-fg: unset;\n--_muted-border-l: unset;\n}\nbutton.pill {\nborder-radius: 9999px;\npadding-left: 1.25em;\npadding-right: 1.25em;\n}\nbutton.pill.xs { padding-left: 1em; padding-right: 1em; }\nbutton.pill.sm { padding-left: 1.125em; padding-right: 1.125em; }\nbutton.pill.lg { padding-left: 1.5em; padding-right: 1.5em; }\nbutton.pill.xl { padding-left: 1.75em; padding-right: 1.75em; }\nbutton.solid {\n--_ring: var(--ty-color-neutral);\n--_solid-bg: var(--ty-button-bg, var(--ty-solid-neutral));\n--_solid-rest: var(--ty-button-bg, var(--ty-solid-neutral));\n--_border-l: var(--ty-button-border-l-neutral, var(--ty-button-border-l, -0.15));\nbackground: var(--_solid-bg);\ncolor: var(--ty-button-color, var(--ty-solid-neutral-fg));\nborder: var(--ty-solid-border-width, 1px) solid\nvar(--ty-solid-border-color,\noklch(from var(--_solid-rest, var(--_solid-bg)) calc(l + var(--_border-l, -0.15) * var(--ty-button-depth, 0.35)) c h));\nbox-shadow: 0 1px 2px oklch(0 0 0 / calc(0.4 * var(--ty-button-depth, 0.35)));\n}\nbutton.solid.tone-plus { --_solid-bg: var(--ty-button-bg, var(--ty-solid-neutral-strong)); --_solid-rest: var(--ty-button-bg, var(--ty-solid-neutral-strong)); color: var(--ty-button-color, var(--ty-solid-neutral-strong-fg)); }\nbutton.solid.tone-minus { --_solid-bg: var(--ty-button-bg, var(--ty-solid-neutral-soft)); --_solid-rest: var(--ty-button-bg, var(--ty-solid-neutral-soft)); color: var(--ty-button-color, var(--ty-solid-neutral-soft-fg)); }\nbutton.solid:hover:not(:disabled) { --_solid-bg: var(--ty-button-bg-hover, var(--ty-solid-neutral-hover)); }\nbutton.solid:active:not(:disabled) { --_solid-bg: var(--ty-solid-neutral-active); }\nbutton.solid.tone-plus:hover:not(:disabled) {\n--_solid-bg: var(--ty-button-bg-hover, oklch(from var(--ty-solid-neutral-strong) calc(l + sign(0.5 - l) * abs(var(--ty-solid-hover-l))) c h));\n}\nbutton.solid.tone-plus:active:not(:disabled) {\n--_solid-bg: oklch(from var(--ty-solid-neutral-strong) calc(l + sign(0.5 - l) * abs(var(--ty-solid-active-l))) c h);\n}\nbutton.solid.tone-minus:hover:not(:disabled) {\n--_solid-bg: var(--ty-button-bg-hover, oklch(from var(--ty-solid-neutral-soft) calc(l + var(--ty-solid-hover-l)) c h));\n}\nbutton.solid.tone-minus:active:not(:disabled) {\n--_solid-bg: oklch(from var(--ty-solid-neutral-soft) calc(l + var(--ty-solid-active-l)) c h);\n}\n${n.map(t=>F(t)).join("")}\nbutton.solid:focus-visible {\nbox-shadow: 0 0 0 2px var(--ty-focus-ring-gap), 0 0 0 4px var(--_ring);\n}\nbutton.outlined {\nbackground: transparent;\ncolor: var(--ty-button-border, var(--ty-button-color, var(--ty-color-neutral)));\nborder-color: var(--ty-button-border, var(--ty-button-color, var(--ty-color-neutral)));\n}\nbutton.outlined:hover:not(:disabled) {\nbackground: var(--ty-button-bg-hover, var(--ty-bg-neutral-soft));\n}\n${n.map(t=>V(t)).join("")}\nbutton.ghost {\nbackground: transparent;\nborder: none;\ncolor: var(--ty-button-color, var(--ty-color-neutral));\n}\nbutton.ghost:hover:not(:disabled) {\nbackground: var(--ty-button-bg-hover, var(--ty-bg-neutral-soft));\n}\n${n.map(t=>j(t)).join("")}`;function O(t,e,i,o){const r=(i||"")+"",s=r.replace(/[+-]$/,"");return n.includes(s)||!/^[A-Za-z][A-Za-z0-9_-]*$/.test(s)?(e&&(t.adoptedStyleSheets=t.adoptedStyleSheets.filter(t=>t!==e)),null):(e||(e=new CSSStyleSheet,t.adoptedStyleSheets=[...t.adoptedStyleSheets,e]),e.replaceSync(o({flavor:r,base:s,shade:r.slice(s.length)})),e)}let H=null;function N(t){H=t&&t.trim()?t:null}function W(){return H??'<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="3" stroke-opacity="0.25"/><path d="M22 12a10 10 0 0 1-10 10" stroke="currentColor" stroke-width="3" stroke-linecap="round"/></svg>'}function B(){H=null}const P=class extends T{constructor(){super(),this.F=!1,this.V=!1,this.j=null,this.I=null,q(this.shadowRoot,{css:I,id:"ty-button"}),this.addEventListener("click",t=>{const n=this.shadowRoot.querySelector("button");n&&t!==this.I&&(t.composedPath().includes(n)||(t.stopImmediatePropagation(),n.click()))},!0)}onConnect(){this.O()}onDisconnect(){}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.O()}formDisabledCallback(t){this.V=t,this.F&&this.render()}get H(){return this.disabled||this.V}O(){const{base:t}=this.parseFlavor();this.j=O(this.shadowRoot,this.j,t,()=>(t=>F(t,"neutral")+V(t,"neutral")+j(t,"neutral"))(t))}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get appearance(){return this.getProperty("appearance")}set appearance(t){this.setProperty("appearance",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get loading(){return this.getProperty("loading")}set loading(t){this.setProperty("loading",t)}get type(){return this.getProperty("type")}set type(t){this.setProperty("type",t)}get pill(){return this.getProperty("pill")}set pill(t){this.setProperty("pill",t)}get action(){return this.getProperty("action")}set action(t){this.setProperty("action",t)}get muted(){return this.getProperty("muted")}set muted(t){this.setProperty("muted",t)}get wide(){return this.getProperty("wide")}set wide(t){this.setProperty("wide",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}parseFlavor(){const t=this.flavor||"";return t.length>1&&t.endsWith("+")?{base:t.slice(0,-1),tone:"+"}:t.length>1&&t.endsWith("-")?{base:t.slice(0,-1),tone:"-"}:{base:t,tone:""}}buildClasses(){const{base:t,tone:n}=this.parseFlavor();return function(...t){return t.filter(Boolean).join(" ")}(t,this.size,this.appearance,this.pill&&"pill",this.action&&"action",this.muted&&"muted","+"===n&&"tone-plus","-"===n&&"tone-minus")}handleFormAction(){const t=this.C.form;if(t)switch(this.type){case"submit":this.name&&this.value&&this.C.setFormValue(this.value);try{t.requestSubmit()}finally{this.name&&this.value&&this.C.setFormValue(null)}break;case"reset":t.reset()}}initializeButtonStructure(){const t=this.shadowRoot,n=this.buildClasses(),e=document.createElement("button");e.disabled=this.H,e.className=n,e.setAttribute("part","button");const i=document.createElement("span");i.className="loader-icon",i.setAttribute("aria-hidden","true"),i.innerHTML=W();const o=document.createElement("slot");o.name="start",o.className="start";const r=document.createElement("slot"),s=document.createElement("slot");s.name="end",s.className="end",e.appendChild(i),e.appendChild(o),e.appendChild(r),e.appendChild(s),e.addEventListener("click",t=>{const n=t.composedPath();if(n.slice(0,n.indexOf(e)).some(t=>t instanceof Element&&"ty-popup"===t.localName))return;if(t.stopPropagation(),this.H||this.loading)return;const i=new CustomEvent("click",{bubbles:!0,composed:!0,cancelable:!0,detail:{originalEvent:t}});this.I=i,this.dispatchEvent(i)&&this.handleFormAction()}),this.applyLoadingState(e),t.appendChild(e),this.F=!0}applyLoadingState(t){const n=this.loading;if(t.classList.toggle("loading",n),n){t.setAttribute("aria-busy","true"),t.setAttribute("aria-disabled","true");const n=t.querySelector(".loader-icon");n&&(n.innerHTML=W())}else t.removeAttribute("aria-busy"),t.removeAttribute("aria-disabled")}render(){const t=this.shadowRoot;if(!this.F)return void this.initializeButtonStructure();const n=this.buildClasses(),e=t.querySelector("button");e&&(e.disabled=this.H,e.className=n,this.applyLoadingState(e))}};P.formAssociated=!0,P.properties={flavor:{type:"string",visual:!0,default:"neutral"},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},appearance:{type:"string",visual:!0,default:"solid",validate:t=>["solid","outlined","ghost"].includes(t),coerce:t=>["solid","outlined","ghost"].includes(t)?t:"solid"},disabled:{type:"boolean",visual:!0,default:!1},loading:{type:"boolean",visual:!0,default:!1},type:{type:"string",visual:!1,default:"submit"},pill:{type:"boolean",visual:!0,default:!1},action:{type:"boolean",visual:!0,default:!1},muted:{type:"boolean",visual:!0,default:!1},wide:{type:"boolean",visual:!1,default:!1},name:{type:"string",default:""},value:{type:"string",default:""}};let R=P;customElements.get("ty-button")||customElements.define("ty-button",R);const Y="1.0.0-TC58",U=new Map,Z=new Map,X=new Map;let K=null,J=null;const G="ty-icons-v"+Y,Q="https://ty-icons.local/",tt=new Map;let nt=!1;function et(t){const n=new Set;Object.entries(t).forEach(([t,e])=>{U.set(t,e),n.add(t)}),n.size>0&<(n)}function it(t){return U.get(t)}function ot(t){return U.has(t)}async function rt(){const t=new Set(U.keys());if(U.clear(),"caches"in window)try{await caches.delete(G),nt=!1}catch(n){}lt(t)}function st(t,n,e){Z.set(t,e),n&&X.set(t,n)}function at(t){Z.delete(t),X.delete(t)}function lt(t){K||(K=new Set),t.forEach(t=>K.add(t)),null!==J&&clearTimeout(J);const n="undefined"!=typeof requestIdleCallback?requestIdleCallback:t=>setTimeout(t,0);J=n(()=>{const t=K;K=null,J=null,t&&t.size>0&&function(t){Z.forEach((n,e)=>{const i=X.get(e);i?t.has(i)&&n(new Set([i])):n(t)})}(t)})}function ct(){return Array.from(U.keys())}async function dt(){const t={version:Y,cacheName:G,available:"caches"in window};if(!t.available)return t;try{const n=await caches.open(G),e=(await n.keys()).filter(t=>t.url.startsWith(Q));return{...t,iconCount:e.length}}catch(n){return t}}const ht=Object.freeze(Object.defineProperty({__proto__:null,addWatcher:st,clearIcons:rt,getCacheInfo:dt,getCachedIcon:async function(t){const n=tt.get(t);if(n)return n;const e=(async()=>{try{await async function(){if(!nt&&"caches"in window){nt=!0;try{const t=(await caches.keys()).filter(t=>t.startsWith("ty-icons-v")&&t!==G);await Promise.all(t.map(t=>caches.delete(t)))}catch(t){}}}();const n=await caches.open(G),e=await n.match(`${Q}${t}`);if(e)return await e.text()}catch(n){}return null})();return tt.set(t,e),e.finally(()=>{tt.delete(t)}),e},getIcon:it,getIconNames:ct,hasIcon:ot,registerIcons:et,removeWatcher:at},Symbol.toStringTag,{value:"Module"}));let ut=0;const pt='<svg xmlns="http://www.w3.org/2000/svg"\nviewBox="0 0 512 512"\nfill="currentColor"\nopacity="0.2">\n<path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512z"/>\n</svg>',bt=class extends T{constructor(){super(),this.N=null,this.W="",this.B=null,q(this.shadowRoot,{css:"\n:host {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nline-height: 0;\nwidth: var(--ty-icon-size, 1em);\nheight: var(--ty-icon-size, 1em);\naspect-ratio: 1 / 1;\ncolor: inherit;\ntransition: color 150ms cubic-bezier(0.4, 0, 0.2, 1);\nflex-shrink: 0;\nvisibility: visible !important;\nopacity: 1;\nwill-change: contents;\ntransform: translateZ(0);\n-webkit-font-smoothing: antialiased;\n}\n:host svg {\nwidth: 100%;\nheight: 100%;\ndisplay: block;\nwill-change: auto;\ntransform: translateZ(0);\n}\n::slotted(svg),\n::slotted(img) {\nwidth: 100%;\nheight: 100%;\ndisplay: block;\n}\n:host([slot]) {\ndisplay: inline-flex;\n}\n:host(.icon-xs) {\nwidth: 0.75em;\nheight: 0.75em;\n}\n:host(.icon-sm) {\nwidth: 0.875em;\nheight: 0.875em;\n}\n:host(.icon-md) {\nwidth: 1em;\nheight: 1em;\n}\n:host(.icon-lg) {\nwidth: 1.25em;\nheight: 1.25em;\n}\n:host(.icon-xl) {\nwidth: 1.5em;\nheight: 1.5em;\n}\n:host(.icon-2xl) {\nwidth: 2em;\nheight: 2em;\n}\n:host(.icon-12) {\nwidth: 12px;\nheight: 12px;\n}\n:host(.icon-14) {\nwidth: 14px;\nheight: 14px;\n}\n:host(.icon-16) {\nwidth: 16px;\nheight: 16px;\n}\n:host(.icon-18) {\nwidth: 18px;\nheight: 18px;\n}\n:host(.icon-20) {\nwidth: 20px;\nheight: 20px;\n}\n:host(.icon-24) {\nwidth: 24px;\nheight: 24px;\n}\n:host(.icon-32) {\nwidth: 32px;\nheight: 32px;\n}\n:host(.icon-48) {\nwidth: 48px;\nheight: 48px;\n}\n:host(.icon-64) {\nwidth: 64px;\nheight: 64px;\n}\n:host(.icon-80) {\nwidth: 80px;\nheight: 80px;\n}\n:host(.icon-96) {\nwidth: 96px;\nheight: 96px;\n}\n:host(.icon-spin) {\nanimation: icon-spin 1s linear infinite;\n}\n:host(.icon-spin.icon-tempo-slow) {\nanimation: icon-spin 2s linear infinite;\n}\n:host(.icon-spin.icon-tempo-fast) {\nanimation: icon-spin 0.5s linear infinite;\n}\n@keyframes icon-spin {\nfrom {\ntransform: rotate(0deg);\n}\nto {\ntransform: rotate(360deg);\n}\n}\n:host(.icon-pulse) {\nanimation: icon-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n:host(.icon-pulse.icon-tempo-slow) {\nanimation: icon-pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n:host(.icon-pulse.icon-tempo-fast) {\nanimation: icon-pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n@keyframes icon-pulse {\n0%,\n100% {\nopacity: 1;\n}\n50% {\nopacity: 0.5;\n}\n}\n:host {\n-webkit-user-select: none;\nuser-select: none;\n}\n:host(:not(.icon-clickable)) {\npointer-events: none;\n}\n:host(.icon-clickable) {\ncursor: pointer;\npointer-events: auto;\ntransition: color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n:host(.icon-clickable:hover) {\ntransform: scale(1.1);\n}\n:host(.icon-clickable:active) {\ntransform: scale(0.95);\n}\n:host(.icon-disabled) {\nopacity: 0.5;\ncursor: not-allowed;\n}\n:host(.icon-block) {\ndisplay: block;\n}\n",id:"ty-icon"}),this.B=document.createElement("slot"),this.B.innerHTML=pt,this.W=pt,this.shadowRoot.appendChild(this.B)}onConnect(){this.N="ty-icon-"+ ++ut,this.name&&st(this.N,this.name,t=>{this.name&&t.has(this.name)&&this.render()}),this.updateClasses()}onDisconnect(){this.N&&(at(this.N),this.N=null)}onPropertiesChanged(t){for(const n of t)if("name"===n.name){this.N&&at(this.N);const t=n.newValue||"";t&&this.isConnected&&(this.N="ty-icon-"+ ++ut,st(this.N,t,t=>{this.name&&t.has(this.name)&&this.render()}))}this.updateClasses()}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get size(){return this.getProperty("size")||void 0}set size(t){this.setProperty("size",t||"")}get spin(){return this.getProperty("spin")}set spin(t){this.setProperty("spin",t)}get pulse(){return this.getProperty("pulse")}set pulse(t){this.setProperty("pulse",t)}get tempo(){return this.getProperty("tempo")||void 0}set tempo(t){this.setProperty("tempo",t||"")}buildClasses(){const t=[],n=this.getProperty("size");n&&t.push("icon-"+n),this.getProperty("spin")&&t.push("icon-spin"),this.getProperty("pulse")&&t.push("icon-pulse");const e=this.getProperty("tempo");e&&(this.getProperty("spin")||this.getProperty("pulse"))&&t.push("icon-tempo-"+e);const i=this.className.split(/\s+/).filter(t=>t&&!t.startsWith("icon-")&&"icon-spin"!==t&&"icon-pulse"!==t);return[...t,...i]}updateClasses(){const t=this.buildClasses().join(" ");this.className!==t&&(this.className=t)}render(){const t=this.getProperty("name");if(!t)return void this.renderSvg(pt);const n=it(t);this.renderSvg(n||pt)}renderSvg(t){this.W!==t&&this.B&&(this.B.innerHTML=t,this.W=t)}};bt.formAssociated=!1,bt.properties={name:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:""},spin:{type:"boolean",visual:!0,default:!1},pulse:{type:"boolean",visual:!0,default:!1},tempo:{type:"string",visual:!0,default:""}};let gt=bt;customElements.get("ty-icon")||customElements.define("ty-icon",gt);const vt=`\n:host([hidden]) {\ndisplay: none !important;\n}\n.tag-container {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\ngap: var(--ty-spacing-1);\nborder-radius: var(--ty-radius-full);\nfont-weight: var(--ty-weight-label, 440);\ntext-align: center;\nwhite-space: nowrap;\nuser-select: none;\nbox-sizing: border-box;\npadding: 0 0.625rem; \nfont-size: var(--ty-font-xs); \nline-height: var(--ty-leading-xs); \nletter-spacing: var(--ty-tracking-xs); \nmin-height: 28px;\ntransition: var(--ty-transition-all);\nbackground: var(--tag-bg, transparent);\ncolor: var(--tag-color, var(--ty-text));\nborder: 1px solid;\nborder-color: var(--tag-border-color, var(--ty-border));\n}\n:host([no-pill]) .tag-container {\nborder-radius: var(--ty-radius-md);\n}\n:host([value]:not([selected])) .tag-container:not([aria-disabled="true"]) {\ncursor: pointer;\n}\n:host([selected]) .tag-container:not([aria-disabled="true"]) {\ncursor: initial;\n}\n.tag-container[tabindex]:not([aria-disabled="true"]):hover {\nbackground: var(--ty-bg-neutral-soft);\ntransform: translateY(-1px);\nbox-shadow: var(--ty-shadow-sm);\n}\n.tag-container[tabindex]:not([aria-disabled="true"]):active {\ntransform: translateY(0);\nbox-shadow: var(--ty-shadow-sm);\n}\n.tag-container[tabindex]:focus {\noutline: none;\n}\n.tag-container[aria-disabled="true"] {\nopacity: 0.6;\ncursor: not-allowed;\npointer-events: none;\n}\n.tag-start,\n.tag-content,\n.tag-end {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nflex-shrink: 0;\n}\n.tag-content {\nflex: 1;\nmin-width: 0;\n}\n.tag-dismiss {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\npadding: 0;\nbackground: none;\nborder: none;\ncolor: currentColor;\ncursor: pointer;\nborder-radius: var(--ty-radius-full);\ntransition: var(--ty-transition-all);\nopacity: 0.7;\nflex-shrink: 0;\nwidth: var(--ty-spacing-4);\nheight: var(--ty-spacing-4);\n}\n.tag-dismiss:hover {\nopacity: 1;\nbackground: rgba(0, 0, 0, 0.1);\n}\n.tag-dismiss svg {\nwidth: 100%;\nheight: 100%;\n}\n:host([size="xs"]) .tag-container {\npadding: 0 0.375rem; \nfont-size: var(--ty-font-xs); \nline-height: var(--ty-leading-xs);\nletter-spacing: var(--ty-tracking-xs);\nmin-height: 20px;\n}\n:host([size="xs"]) .tag-dismiss {\nwidth: var(--ty-spacing-3);\nheight: var(--ty-spacing-3);\nmargin-left: var(--ty-spacing-2);\n}\n:host([size="sm"]) .tag-container {\npadding: 0 var(--ty-spacing-2); \nfont-size: var(--ty-font-xs); \nline-height: var(--ty-leading-xs);\nletter-spacing: var(--ty-tracking-xs);\nmin-height: 24px;\n}\n:host([size="sm"]) .tag-dismiss {\nwidth: var(--ty-spacing-3);\nheight: var(--ty-spacing-3);\nmargin-left: var(--ty-spacing-2);\n}\n:host([size="lg"]) .tag-container {\npadding: 0 var(--ty-spacing-3); \nfont-size: var(--ty-font-sm); \nline-height: var(--ty-leading-sm); \nletter-spacing: var(--ty-tracking-sm); \nmin-height: 32px;\n}\n:host([size="lg"]) .tag-dismiss {\nwidth: var(--ty-spacing-5);\nheight: var(--ty-spacing-5);\nmargin-left: var(--ty-spacing-4);\n}\n:host([size="xl"]) .tag-container {\npadding: 0 0.875rem; \nfont-size: var(--ty-font-sm); \nline-height: var(--ty-leading-sm); \nletter-spacing: var(--ty-tracking-sm); \nmin-height: 36px;\n}\n:host([size="xl"]) .tag-dismiss {\nwidth: var(--ty-spacing-5);\nheight: var(--ty-spacing-5);\nmargin-left: var(--ty-spacing-4);\n}\n${n.filter(t=>"neutral"!==t).map(t=>`\n:host([flavor="${t}"]) {\n--tag-bg: var(--ty-bg-${t});\n--tag-color: var(--ty-color-${t});\n--tag-border-color: var(--ty-border-${t});\n}\n:host([flavor="${t}+"]) {\n--tag-bg: var(--ty-bg-${t}-bold);\n--tag-color: var(--ty-color-${t}-strong);\n--tag-border-color: var(--ty-color-${t});\n}\n:host([flavor="${t}-"]) {\n--tag-bg: var(--ty-bg-${t}-soft);\n--tag-color: var(--ty-color-${t});\n--tag-border-color: var(--ty-border-${t});\n}\n:host([flavor="${t}"]) .tag-container[tabindex]:hover,\n:host([flavor="${t}+"]) .tag-container[tabindex]:hover,\n:host([flavor="${t}-"]) .tag-container[tabindex]:hover {\nbackground: var(--ty-bg-${t}-bold);\n}\n:host([flavor="${t}"]) .tag-container[tabindex]:focus,\n:host([flavor="${t}+"]) .tag-container[tabindex]:focus,\n:host([flavor="${t}-"]) .tag-container[tabindex]:focus {\nbox-shadow: 0 0 0 3px var(--ty-color-${t}-faint);\n}\n`).join("")}\n:host([flavor="neutral"]) {\n--tag-color: var(--ty-text-bold);\n--tag-bg: var(--ty-bg-neutral-soft);\n--tag-border-color: var(--ty-border-bold);\n}\n:host([flavor="neutral+"]) {\n--tag-bg: var(--ty-bg-neutral-bold);\n--tag-color: var(--ty-text-bold);\n--tag-border-color: var(--ty-border-strong);\n}\n:host([flavor="neutral-"]) {\n--tag-bg: var(--ty-bg-neutral-soft);\n--tag-color: var(--ty-text-soft);\n--tag-border-color: var(--ty-border);\n}\n:host([flavor="neutral"]) .tag-container[tabindex]:hover,\n:host([flavor="neutral+"]) .tag-container[tabindex]:hover,\n:host([flavor="neutral-"]) .tag-container[tabindex]:hover {\nbackground: var(--ty-bg-neutral-soft);\n}\n:host([flavor="neutral"]) .tag-container[tabindex]:focus,\n:host([flavor="neutral+"]) .tag-container[tabindex]:focus,\n:host([flavor="neutral-"]) .tag-container[tabindex]:focus {\nbox-shadow: 0 0 0 3px var(--ty-border-soft);\n}\n.tag-start ::slotted(*),\n.tag-content ::slotted(*),\n.tag-end ::slotted(*) {\ndisplay: flex;\nalign-items: center;\n}\n.tag-start ::slotted(ty-icon),\n.tag-end ::slotted(ty-icon) {\nwidth: 1em;\nheight: 1em;\nflex-shrink: 0;\n}\n.tag-end ::slotted(.count) {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nmin-width: var(--ty-spacing-6);\nheight: var(--ty-spacing-5);\npadding: 0 var(--ty-spacing-2);\nbackground: rgba(0, 0, 0, 0.1);\nborder-radius: var(--ty-radius-full);\nfont-size: var(--ty-font-xs);\nfont-weight: var(--ty-font-semibold);\nline-height: var(--ty-line-height-none);\nflex-shrink: 0;\n}\n.tag-content {\noverflow: hidden;\ntext-overflow: ellipsis;\n}\n:host([data-type="user"]) .tag-container {\nmin-width: var(--ty-spacing-20);\n}\n`,mt=class extends T{constructor(){super(),this.P=null,this.j=null,this.handleClick=t=>{this.clickable&&!this.disabled&&(t.preventDefault(),t.stopPropagation(),this.dispatchTagEvent("click",{target:this}),this.dispatchTagEvent("pointerdown",{target:this}))},this.handleDismiss=t=>{this.dismissible&&!this.disabled&&(t.preventDefault(),t.stopPropagation(),this.dispatchTagEvent("dismiss",{target:this}))},this.handleKeydown=t=>{const n=t;if(!this.disabled)switch(n.keyCode){case 13:case 32:this.clickable&&(n.preventDefault(),this.dispatchTagEvent("click",{target:this}));break;case 8:case 46:this.dismissible&&(n.preventDefault(),this.dispatchTagEvent("dismiss",{target:this}))}},q(this.shadowRoot,{css:vt,id:"ty-tag"})}onConnect(){this.O(),queueMicrotask(()=>{this.setupEventListeners()})}O(){this.j=O(this.shadowRoot,this.j,this.flavor,({flavor:t,base:n,shade:e})=>`\n:host([flavor="${t}"]) {\n--tag-bg: var(${"+"===e?`--ty-bg-${n}-bold`:"-"===e?`--ty-bg-${n}-soft`:"--ty-bg-"+n});\n--tag-color: var(${"+"===e?`--ty-color-${n}-strong`:"--ty-color-"+n});\n--tag-border-color: var(--ty-border-${n}, var(--ty-color-${n}));\n}\n:host([flavor="${t}"]) .tag-container[tabindex]:hover {\nbackground: var(--ty-bg-${n}-bold, var(--tag-bg));\n}\n:host([flavor="${t}"]) .tag-container[tabindex]:focus {\nbox-shadow: 0 0 0 3px var(--ty-color-${n}-faint, var(--tag-color));\n}`)}onDisconnect(){this.cleanupEventListeners()}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.O()}dispatchTagEvent(t,n){this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}cleanupEventListeners(){this.P&&(this.P(),this.P=null)}setupEventListeners(){this.cleanupEventListeners();const t=this.shadowRoot,n=t.querySelector(".tag-container"),e=t.querySelector(".tag-dismiss");n&&(n.addEventListener("click",this.handleClick),n.addEventListener("keydown",this.handleKeydown),e&&e.addEventListener("click",this.handleDismiss),this.P=()=>{n.removeEventListener("click",this.handleClick),n.removeEventListener("keydown",this.handleKeydown),e&&e.removeEventListener("click",this.handleDismiss)})}render(){this.shadowRoot.innerHTML=`\n<div class="tag-container" part="container"${this.clickable?' tabindex="0"':""}${this.disabled?' aria-disabled="true"':""}${this.value?` data-value="${this.value}"`:""}>\n<div class="tag-start">\n<slot name="start" class="tag-start"></slot>\n</div>\n<div class="tag-content">\n<slot></slot>\n</div>\n<div class="tag-end">\n<slot name="end"></slot>\n${this.dismissible?'\n<button class="tag-dismiss" type="button" aria-label="Remove tag">\n<svg viewBox="0 0 20 20" fill="currentColor">\n<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" />\n</svg>\n</button>\n':""}\n</div>\n</div>\n`,this.p&&this.setupEventListeners()}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get selected(){return this.getProperty("selected")}set selected(t){this.setProperty("selected",t)}get noPill(){return this.getProperty("noPill")}set noPill(t){this.setProperty("noPill",t)}get clickable(){return this.getProperty("clickable")}set clickable(t){this.setProperty("clickable",t)}get dismissible(){return this.getProperty("dismissible")}set dismissible(t){this.setProperty("dismissible",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}};mt.formAssociated=!0,mt.properties={flavor:{type:"string",visual:!0,default:"neutral"},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},value:{type:"string",visual:!0,default:""},selected:{type:"boolean",visual:!0,default:!1},noPill:{type:"boolean",visual:!0,default:!1},clickable:{type:"boolean",visual:!0,default:!1},dismissible:{type:"boolean",visual:!0,default:!1},disabled:{type:"boolean",visual:!0,default:!1}};let yt=mt;customElements.get("ty-tag")||customElements.define("ty-tag",yt);class TyOption extends HTMLElement{constructor(){super(),this.R=void 0,this.Y=!1,this.U=!1,this.Z=!1,this.X=!1,q(this.attachShadow({mode:"open"}),{css:"\n.option-content {\ndisplay: flex;\nalign-items: center;\njustify-content: space-between;\ngap: var(--ty-spacing-2);\nbox-sizing: border-box;\nwidth: 100%;\ncursor: pointer;\nuser-select: none;\ntransition: var(--ty-transition-all);\ncolor: var(--ty-text);\nfont-family: inherit;\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\npadding: var(--ty-spacing-2) var(--ty-spacing-3);\nborder-radius: var(--ty-radius-md);\n}\n:host([cloned]) {\ndisplay: block;\nmin-width: 0;\noverflow: hidden;\n}\n:host([cloned]) .option-content {\ndisplay: block;\npadding: 0px;\nbackground: transparent;\nmin-width: 0;\noverflow: hidden;\nwhite-space: nowrap;\ntext-overflow: ellipsis;\nfont-size: var(--ty-field-font, var(--ty-font-sm));\nline-height: var(--ty-field-leading, var(--ty-leading-sm));\nletter-spacing: var(--ty-field-tracking, var(--ty-tracking-sm));\n}\n.option-content:hover {\nbackground: var(--ty-bg-neutral-soft);\n}\n.option-content[highlighted] {\nbackground: var(--ty-bg-neutral-soft);\ncolor: var(--ty-text-strong);\n}\n.option-content[selected] {\nbackground: transparent;\ncolor: var(--ty-text-bold);\n}\n.option-check {\ndisplay: block;\nvisibility: hidden;\nflex-shrink: 0;\nwidth: 14px;\nheight: 14px;\nmargin-left: auto;\ncolor: var(--ty-color-primary);\n}\n.option-content[selected] .option-check {\nvisibility: visible;\n}\n:host([cloned]) .option-check {\ndisplay: none;\n}\n.option-content[selected]:hover {\nbackground: var(--ty-bg-neutral-soft);\n}\n.option-content[disabled] {\nopacity: 0.5;\ncursor: not-allowed;\n}\n.option-content[hidden] {}\n.option-content * {\npointer-events: none;\n}\n",id:"ty-option"}),this.render()}static get observedAttributes(){return["value","disabled","selected","highlighted","hidden"]}connectedCallback(){E(this),this.render()}attributeChangedCallback(t,n,e){if(n!==e){switch(t){case"value":this.R=e||void 0;break;case"selected":this.Y=null!==e;break;case"disabled":this.U=null!==e;break;case"highlighted":this.Z=null!==e;break;case"hidden":this.X=null!==e}this.render()}}getOptionValue(){if(void 0!==this.R)return this.R;const t=this.getAttribute("value");return null!==t?t:this.textContent?.trim()||""}get value(){return this.getOptionValue()}set value(t){this.R!==t&&(this.R=t,void 0!==t?this.setAttribute("value",t):this.removeAttribute("value"),this.render())}get selected(){return this.Y}set selected(t){t=i(t),this.Y!==t&&(this.Y=t,t?this.setAttribute("selected",""):this.removeAttribute("selected"),this.render())}get disabled(){return this.U}set disabled(t){t=i(t),this.U!==t&&(this.U=t,t?this.setAttribute("disabled",""):this.removeAttribute("disabled"),this.render())}get highlighted(){return this.Z}set highlighted(t){t=i(t),this.Z!==t&&(this.Z=t,t?this.setAttribute("highlighted",""):this.removeAttribute("highlighted"),this.render())}get hidden(){return this.X}set hidden(t){t=i(t),this.X!==t&&(this.X=t,t?this.setAttribute("hidden",""):this.removeAttribute("hidden"),this.render())}render(){const t=this.shadowRoot;t.querySelector(".option-content")||(t.innerHTML='<div class="option-content"><slot></slot>\n<svg class="option-check" viewBox="0 0 24 24" fill="none" stroke="currentColor"\nstroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">\n<path d="M20 6 9 17l-5-5" />\n</svg>\n</div>');const n=t.querySelector(".option-content");n&&(this.U?n.setAttribute("disabled",""):n.removeAttribute("disabled"),this.Y?n.setAttribute("selected",""):n.removeAttribute("selected"),this.Z?n.setAttribute("highlighted",""):n.removeAttribute("highlighted"),this.X?n.setAttribute("hidden",""):n.removeAttribute("hidden"))}}customElements.get("ty-option")||customElements.define("ty-option",TyOption);const ft="data-error-flavor",wt='\n:host {\n--ty-field-height: var(--ty-size-sm, 2rem);\n--ty-field-pad-x: 10px;\n--ty-field-font: var(--ty-font-sm);\n--ty-field-leading: 20px;\n--ty-field-tracking: var(--ty-tracking-sm);\n--ty-field-label-font: var(--ty-font-xs);\n--ty-field-label-leading: var(--ty-leading-xs);\n--ty-field-label-gap: 5px;\n--ty-field-outer-pad-x: calc(var(--ty-field-pad-x) + 1px);\n--ty-field-control: 24px;\n--ty-field-icon: 16px;\n}\n:host([size="xs"]) {\n--ty-field-height: var(--ty-size-xs, 1.75rem);\n--ty-field-pad-x: 8px;\n--ty-field-font: var(--ty-font-xs);\n--ty-field-leading: 16px;\n--ty-field-tracking: var(--ty-tracking-xs);\n--ty-field-label-font: var(--ty-font-xs);\n--ty-field-label-leading: var(--ty-leading-xs);\n--ty-field-label-gap: 4px;\n--ty-field-control: 20px;\n--ty-field-icon: 14px;\n}\n:host([size="md"]) {\n--ty-field-height: var(--ty-size-md, 2.25rem);\n--ty-field-pad-x: 12px;\n--ty-field-font: var(--ty-font-sm);\n--ty-field-leading: 20px;\n--ty-field-tracking: var(--ty-tracking-sm);\n--ty-field-label-font: var(--ty-font-sm);\n--ty-field-label-leading: var(--ty-leading-sm);\n--ty-field-label-gap: 6px;\n--ty-field-control: 28px;\n--ty-field-icon: 18px;\n}\n:host([size="lg"]) {\n--ty-field-height: var(--ty-size-lg, 2.5rem);\n--ty-field-pad-x: 14px;\n--ty-field-font: var(--ty-font-base);\n--ty-field-leading: 24px;\n--ty-field-tracking: var(--ty-tracking-base);\n--ty-field-label-font: var(--ty-font-sm);\n--ty-field-label-leading: var(--ty-leading-sm);\n--ty-field-label-gap: 6px;\n--ty-field-control: 32px;\n--ty-field-icon: 20px;\n}\n:host([size="xl"]) {\n--ty-field-height: var(--ty-size-xl, 2.75rem);\n--ty-field-pad-x: 16px;\n--ty-field-font: var(--ty-font-lg);\n--ty-field-leading: 28px;\n--ty-field-tracking: var(--ty-tracking-base);\n--ty-field-label-font: var(--ty-font-base);\n--ty-field-label-leading: var(--ty-leading-base);\n--ty-field-label-gap: 8px;\n--ty-field-control: 36px;\n--ty-field-icon: 22px;\n}\n@media (max-width: 640px) {\n:host([size="lg"]) {\n--ty-field-height: var(--ty-size-md, 2.25rem);\n--ty-field-pad-x: 12px;\n--ty-field-font: var(--ty-font-sm);\n--ty-field-leading: 20px;\n--ty-field-control: 28px;\n--ty-field-icon: 18px;\n}\n:host([size="xl"]) {\n--ty-field-height: var(--ty-size-lg, 2.5rem);\n--ty-field-pad-x: 14px;\n--ty-field-font: var(--ty-font-base);\n--ty-field-leading: 24px;\n--ty-field-control: 32px;\n--ty-field-icon: 20px;\n}\n}\n@media (max-width: 480px) {\n:host([size="xl"]) {\n--ty-field-height: var(--ty-size-md, 2.25rem);\n--ty-field-pad-x: 12px;\n--ty-field-font: var(--ty-font-sm);\n--ty-field-leading: 20px;\n--ty-field-control: 28px;\n--ty-field-icon: 18px;\n}\n}\n',xt=(t,n)=>{const e=e=>n?e?`var(--ty-color-${t}${e}, var(--ty-color-${t}, var(--ty-color-${n}${e})))`:`var(--ty-color-${t}, var(--ty-color-${n}))`:e?`var(--ty-color-${t}${e}, var(--ty-color-${t}))`:`var(--ty-color-${t})`;return`\n:host([flavor="${t}"]) {\n--input-accent: var(--ty-input-${t}-border, ${e("-soft")});\n--input-accent-bold: ${e("")};\n--input-ring: color-mix(in oklab, ${e("")} 15%, transparent);\n}\n:host([flavor="${t}+"]) {\n--input-accent: ${e("")};\n--input-accent-bold: ${e("-strong")};\n--input-ring: color-mix(in oklab, ${e("-strong")} 15%, transparent);\n}\n:host([flavor="${t}-"]) {\n--input-accent: ${e("-faint")};\n--input-accent-bold: ${e("-soft")};\n--input-ring: color-mix(in oklab, ${e("-soft")} 15%, transparent);\n}\n`},kt=`\n${wt}\n:host {\ndisplay: block;\nfont-family: inherit;\nwidth: 100%;\n}\n.input-container {\ndisplay: flex;\nflex-direction: column;\nwidth: 100%;\nbox-sizing: border-box;\n}\n.ty-field-label {\nfont-size: var(--ty-field-label-font);\nline-height: var(--ty-field-label-leading);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-medium);\ncolor: var(--ty-label-color);\nmargin-bottom: var(--ty-field-label-gap);\npadding-left: var(--ty-field-outer-pad-x);\ndisplay: flex;\nalign-items: center;\n}\n.required-icon {\ndisplay: inline-flex;\nalign-items: center;\ncolor: var(--ty-color-danger);\nwidth: 12px;\nheight: 12px;\nmargin-left: 4px;\nvertical-align: middle;\n}\n.required-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n.input-wrapper {\ndisplay: flex;\nalign-items: center;\ngap: 0.5rem;\nwidth: 100%;\nbox-sizing: border-box;\nborder: 1px solid var(--input-accent, var(--input-border, var(--ty-input-border)));\nborder-radius: var(--ty-radius-base);\nbackground: var(--input-bg, var(--input-bg, var(--ty-input-bg)));\ntransition: var(--ty-local-transition, all 0.15s ease-in-out);\nmin-height: var(--ty-field-height);\npadding: 0 var(--ty-field-pad-x);\n}\n.input-wrapper:hover:not(.disabled):not(.focused) {\nborder-color: var(--input-accent-bold, var(--input-border-hover, var(--ty-input-border-hover)));\n}\n.input-wrapper.focused {\nborder-color: var(--input-accent-bold, var(--input-border-focus, var(--ty-input-border-focus)));\nbox-shadow: 0 0 0 3px var(--input-ring, var(--input-shadow-focus, var(--ty-input-shadow-focus)));\n}\n.input-wrapper.disabled {\ncursor: not-allowed;\nopacity: 0.5;\nbackground: var(--input-disabled-bg, var(--ty-input-disabled-bg));\nborder-color: var(--input-disabled-border, var(--ty-input-disabled-border));\n}\n::slotted([slot="start"]),\n::slotted([slot="end"]) {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nflex-shrink: 0;\ncolor: var(--ty-text-soft);\n}\n.password-toggle {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nflex-shrink: 0;\nwidth: 1.25rem;\nheight: 1.25rem;\npadding: 0;\nborder: none;\nbackground: none;\ncursor: pointer;\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\ntransition: var(--ty-local-transition, color 0.15s ease-in-out);\n}\n.password-toggle:hover {\ncolor: var(--input-color, var(--ty-input-color));\n}\n.password-toggle:focus-visible {\noutline: 2px solid var(--input-accent, var(--ty-color-primary));\noutline-offset: 2px;\nborder-radius: 2px;\n}\n.password-toggle svg {\nwidth: 1rem;\nheight: 1rem;\n}\n::slotted(ty-icon) {\nwidth: 1em;\nheight: 1em;\nflex-shrink: 0;\n}\n.error-message {\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\nletter-spacing: var(--ty-tracking-xs);\ncolor: var(--ty-color-danger);\nmargin-top: 4px;\npadding-left: var(--ty-field-outer-pad-x);\n}\n.input-wrapper.error {\nborder-color: var(--ty-color-danger);\nbackground: var(--ty-bg-danger-soft);\n}\n.input-wrapper.error.focused {\nborder-color: var(--ty-color-danger-bold);\nbox-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\ninput {\nflex: 1;\nmin-width: 0;\nbox-sizing: border-box;\nborder: none;\noutline: none;\nbackground: transparent;\ncolor: var(--input-color, var(--ty-input-color));\nfont-family: inherit;\nfont-size: var(--ty-field-font);\nline-height: var(--ty-field-leading);\nletter-spacing: var(--ty-field-tracking);\nfont-weight: var(--ty-font-normal);\npadding: 0;\nmargin: 0;\n}\ninput[type="number"]::-webkit-outer-spin-button,\ninput[type="number"]::-webkit-inner-spin-button {\n-webkit-appearance: none;\nmargin: 0;\n}\ninput[type="number"] {\n-moz-appearance: textfield;\n}\ninput:disabled {\ncursor: not-allowed;\ncolor: var(--input-disabled-color, var(--ty-input-disabled-color));\n}\ninput::placeholder {\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\nfont-weight: 400;\n}\n${n.filter(t=>"neutral"!==t).map(t=>xt(t)).join("")}\ninput:focus-visible {\noutline: none;\n}\n@media (prefers-contrast: high) {\n.input-wrapper {\nborder-width: 2px;\n}\n}\n@media (prefers-reduced-motion: reduce) {\n.input-wrapper {\ntransition: none;\n}\n}\n`;function zt(t){return["number","currency","percent","compact"].includes(t)}function $t(t,n){if(n)return n;const e=t.closest("[lang]");if(e){const t=e.getAttribute("lang");if(t)return t}return document.documentElement.lang?document.documentElement.lang:navigator.language?navigator.language:"en-US"}function Ct(t,n){let e=$t(t);const i=new MutationObserver(i=>{for(const o of i)if("attributes"===o.type&&"lang"===o.attributeName){const i=$t(t);i!==e&&(e=i,n(i))}});return i.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}),()=>i.disconnect()}const Mt='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/></svg>',Et='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/></svg>',St=class extends T{constructor(){super(),this.K=null,this.J=!1,this.G=!1,this.j=null,this.tt=null,this.nt=null,this.et=null,this.it=null,this.ot=null,this.rt=null,this.st=t=>{if("Enter"!==t.key||t.isComposing||t.defaultPrevented)return;const n=this.C.form;if(!n)return;const e=Array.from(n.elements),i=e.find(t=>t instanceof HTMLButtonElement&&"submit"===t.type||t instanceof HTMLInputElement&&("submit"===t.type||"image"===t.type)||"TY-BUTTON"===t.tagName&&!["button","reset"].includes(t.getAttribute("type")??""));if(i){if(i.disabled||i.hasAttribute("disabled"))return;return t.preventDefault(),void("TY-BUTTON"===i.tagName?i.shadowRoot?.querySelector("button")??i:i).click()}1===e.filter(t=>"TY-INPUT"===t.tagName||t instanceof HTMLInputElement&&!["button","checkbox","radio","file","hidden","image","reset","submit","range","color"].includes(t.type)).length&&(t.preventDefault(),n.requestSubmit())},q(this.shadowRoot,{css:kt,id:"ty-input"})}onConnect(){this.initializeShadowValue(),this.lt=Ct(this,()=>{this.render()}),this.O(),this.syncErrorFlavor()}O(){this.j=O(this.shadowRoot,this.j,this.flavor,({base:t})=>(t=>xt(t,"neutral"))(t))}syncErrorFlavor(){if(!this.p)return;const t=this.getProperty("flavor"),n=this.getAttribute(ft);if(this.getProperty("error"))null===n&&"neutral"===t&&(this.setAttribute(ft,this.getAttribute("flavor")??""),this.setProperty("flavor","danger"));else if(null!==n){if(this.removeAttribute(ft),"danger"!==t)return;n?this.setProperty("flavor",n):this.removeAttribute("flavor")}}onDisconnect(){this.removeEventListeners(),this.lt&&(this.lt(),this.lt=void 0),null!==this.ot&&(clearTimeout(this.ot),this.ot=null),null!==this.rt&&(clearTimeout(this.rt),this.rt=null)}onPropertiesChanged(t){for(const{name:n,newValue:e}of t)switch(n){case"flavor":"danger"!==e&&(this.removeAttribute(ft),this.syncErrorFlavor()),this.O();break;case"value":this.K=this.parseShadowValue(e||"");break;case"type":const t=this.getProperty("value")||"";this.K=this.parseShadowValue(t);break;case"error":this.syncErrorFlavor()}}onFormReset(){this.K=null,this.initializeShadowValue(),this.J=!1,null!==this.ot&&(clearTimeout(this.ot),this.ot=null),null!==this.rt&&(clearTimeout(this.rt),this.rt=null),this.render()}getFormValue(){return null!==this.K?this.K+"":""}initializeShadowValue(){const t=this.getProperty("value");t?(this.K=this.parseShadowValue(t),this.C.setFormValue(null!==this.K?this.K+"":"")):this.C.setFormValue("")}parseShadowValue(t){if(!t||"string"!=typeof t||""===t.trim())return null;if(zt(this.type)){const n=function(t){if(!t||""===t.trim())return null;let n=t.replace(/[^\d.,-]/g,"").trim();if(""===n||"-"===n)return null;const e=n.lastIndexOf(","),i=n.lastIndexOf("."),o=Math.max(e,i);if(-1===o){const t=parseFloat(n);return isNaN(t)?null:t}const r=n[o],s=n.slice(0,o),a=n.slice(o+1);if(s.includes(r)){const t=parseFloat(n.replace(/[.,]/g,""));return isNaN(t)?null:t}const l=s.replace(/[.,]/g,""),c=parseFloat(l+"."+a);return isNaN(c)?null:c}(t);return null!==n&&0===this.precision?Math.round(n):n}return t}shouldFormat(){return zt(this.type)&&!this.J&&null!==this.K&&"number"==typeof this.K}getFormatConfig(){return{type:this.type,locale:this.locale,currency:this.currency,precision:this.precision}}getDisplayValue(){if(this.shouldFormat()){let t=this.K;return"percent"===this.type&&(t/=100),function(t,n){const{type:e,locale:i="en-US",currency:o="USD",precision:r}=n,s={};switch(void 0!==r&&(s.minimumFractionDigits=r,s.maximumFractionDigits=r),e){case"currency":s.style="currency",s.currency=o;break;case"percent":s.style="percent";break;case"compact":s.notation="compact",s.compactDisplay="short";break;default:s.style="decimal"}return new Intl.NumberFormat(i,s).format(t).replace(/\u202F/g," ").replace(/\u2009/g," ")}(t,this.getFormatConfig())}return null!==this.K?this.K+"":""}get type(){return this.getProperty("type")}set type(t){this.setProperty("type",t)}get value(){return null!==this.K?this.K+"":""}set value(t){this.setProperty("value",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get placeholder(){return this.getProperty("placeholder")}set placeholder(t){this.setProperty("placeholder",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}focus(t){this.shadowRoot?.querySelector("input")?.focus(t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get pattern(){return this.getProperty("pattern")}set pattern(t){this.setProperty("pattern",t??"")}get minLength(){return w(this.getProperty("minlength"))??-1}set minLength(t){this.setProperty("minlength",null==t||0>t?"":t+"")}get maxLength(){return w(this.getProperty("maxlength"))??-1}set maxLength(t){this.setProperty("maxlength",null==t||0>t?"":t+"")}get min(){return this.getProperty("min")}set min(t){this.setProperty("min",null==t?"":t+"")}get max(){return this.getProperty("max")}set max(t){this.setProperty("max",null==t?"":t+"")}get tooShortMessage(){return this.getProperty("tooShortMessage")}set tooShortMessage(t){this.setProperty("tooShortMessage",t??"")}get tooLongMessage(){return this.getProperty("tooLongMessage")}set tooLongMessage(t){this.setProperty("tooLongMessage",t??"")}get error(){return this.getProperty("error")}set error(t){this.setProperty("error",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.removeAttribute(ft),this.setProperty("flavor",t)}attributeChangedCallback(t,n,e){"flavor"===t&&"danger"===e&&n===e&&this.removeAttribute(ft),super.attributeChangedCallback(t,n,e)}get currency(){return this.getProperty("currency")}set currency(t){this.setProperty("currency",t)}get locale(){return $t(this,this.getProperty("locale"))}set locale(t){this.setProperty("locale",t)}get precision(){return this.getProperty("precision")}set precision(t){this.setProperty("precision",t)}get debounce(){return this.getProperty("debounce")}set debounce(t){this.setProperty("debounce",t)}get form(){return this.C.form}buildClassList(){const t=[];return this.disabled&&t.push("disabled"),this.required&&t.push("required"),this.error&&t.push("error"),t.join(" ")}dispatchInputEvent(t,n){this.dispatchEvent(new CustomEvent("input",{detail:{value:this.K,formattedValue:this.shouldFormat()?this.getDisplayValue():null,rawValue:t,originalEvent:n},bubbles:!0,composed:!0}))}dispatchChangeEvent(t,n){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.K,formattedValue:this.shouldFormat()?this.getDisplayValue():null,rawValue:t,originalEvent:n},bubbles:!0,composed:!0}))}removeEventListeners(){if(!this.G)return;const t=this.shadowRoot;if(!t)return;const n=t.querySelector("input");n&&(this.tt&&(n.removeEventListener("input",this.tt),this.tt=null),this.nt&&(n.removeEventListener("change",this.nt),this.nt=null),this.et&&(n.removeEventListener("focus",this.et),this.et=null),this.it&&(n.removeEventListener("blur",this.it),this.it=null),n.removeEventListener("keydown",this.st),this.G=!1)}setupEventListeners(){if(this.G)return;const t=this.shadowRoot,n=t.querySelector("input"),e=t.querySelector(".input-wrapper");n&&e&&(this.tt=t=>{this.m=!0,t.stopPropagation(),t.stopImmediatePropagation();const e=t.target.value;this.K=this.parseShadowValue(e),this.C.setFormValue(null!==this.K?this.K+"":""),this.updateValidity(),null!==this.ot&&clearTimeout(this.ot),this.debounce>0?this.ot=window.setTimeout(()=>{this.dispatchInputEvent(n.value,t),this.ot=null},this.debounce):this.dispatchInputEvent(e,t)},this.nt=t=>{t.stopPropagation(),t.stopImmediatePropagation();const e=t.target.value;this.K=this.parseShadowValue(e),this.C.setFormValue(null!==this.K?this.K+"":""),this.updateValidity(),null!==this.rt&&clearTimeout(this.rt),this.debounce>0?this.rt=window.setTimeout(()=>{this.dispatchChangeEvent(n.value,t),this.rt=null},this.debounce):this.dispatchChangeEvent(e,t)},this.et=t=>{this.J=!0,e.classList.add("focused"),zt(this.type)&&null!==this.K&&(n.value=this.K+""),this.dispatchEvent(new CustomEvent("focus",{detail:{originalEvent:t},bubbles:!0,composed:!0}))},this.it=t=>{const i=t.target.value;null!==this.ot&&(clearTimeout(this.ot),this.ot=null,this.dispatchInputEvent(i,t)),null!==this.rt&&(clearTimeout(this.rt),this.rt=null,this.dispatchChangeEvent(i,t)),this.J=!1,e.classList.remove("focused"),this.m&&this.revealValidity(),this.shouldFormat()&&(n.value=this.getDisplayValue()),this.dispatchEvent(new CustomEvent("blur",{detail:{originalEvent:t},bubbles:!0,composed:!0}))},n.addEventListener("input",this.tt),n.addEventListener("change",this.nt),n.addEventListener("focus",this.et),n.addEventListener("blur",this.it),n.addEventListener("keydown",this.st),this.G=!0)}render(){const t=this.shadowRoot,n=t.querySelector("input"),e=t.querySelector(".input-wrapper"),i=t.querySelector(".ty-field-label"),o=t.querySelector(".error-message"),r=this.buildClassList(),s=["password","email","tel","url"].includes(this.type)?this.type:"text",a=zt(this.type)?"decimal":"email"===this.type?"email":"tel"===this.type?"tel":"url"===this.type?"url":void 0,l=this.getDisplayValue();if(n&&e){if(n.type=s,n.value!==l&&(n.value=l),n.placeholder=this.placeholder,n.name=this.name,a?n.inputMode=a:n.removeAttribute("inputmode"),e.className="input-wrapper "+r,n.disabled=this.disabled,this.disabled?n.setAttribute("disabled",""):n.removeAttribute("disabled"),n.required=this.required,this.required?n.setAttribute("required",""):n.removeAttribute("required"),this.syncConstraintAttributes(n),this.label?n.setAttribute("aria-label",this.label):n.removeAttribute("aria-label"),this.label)if(i)i.innerHTML=`${this.label}${this.required?`<span class="required-icon">${Mt}</span>`:""}`,i.style.display="flex";else{const n=document.createElement("label");n.className="ty-field-label",n.innerHTML=`${this.label}${this.required?`<span class="required-icon">${Mt}</span>`:""}`;const i=t.querySelector(".input-container");i&&i.insertBefore(n,e)}else i&&(i.style.display="none");if(this.error)if(o)o.textContent=this.error;else{const n=document.createElement("div");n.className="error-message",n.textContent=this.error,t.querySelector(".input-container")?.appendChild(n)}else o&&o.remove()}else{t.innerHTML=`\n<div class="input-container">\n${this.label?`\n<label class="ty-field-label">\n${this.label}\n${this.required?`<span class="required-icon">${Mt}</span>`:""}\n</label>\n`:""}\n<div class="input-wrapper ${r}">\n<slot name="start"></slot>\n<input\ntype="${s}"\nvalue="${l}"\nplaceholder="${this.placeholder}"\nname="${this.name}"\n${a?`inputmode="${a}"`:""}\n/>\n<slot name="end"></slot>\n${"password"===s?`\n<button class="password-toggle" type="button"\naria-label="Show password" aria-pressed="false">\n${Et}\n</button>`:""}\n</div>\n${this.error?`\n<div class="error-message">${this.error}</div>\n`:""}\n</div>\n`;const n=t.querySelector("input");n.disabled=this.disabled,n.required=this.required,this.syncConstraintAttributes(n),this.label&&n.setAttribute("aria-label",this.label),this.setupPasswordToggle(),this.setupEventListeners()}this.updateValidity()}setupPasswordToggle(){const t=this.shadowRoot,n=t.querySelector(".password-toggle"),e=t.querySelector("input");n&&e&&(n.addEventListener("mousedown",t=>t.preventDefault()),n.addEventListener("click",()=>{const t="password"===e.type;e.type=t?"text":"password",n.innerHTML=t?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"/><path d="m2 2 20 20"/></svg>':Et,n.setAttribute("aria-label",t?"Hide password":"Show password"),n.setAttribute("aria-pressed",t+"")}))}syncConstraintAttributes(t){const n=!zt(this.type),e=(e,i)=>n&&""!==i?t.setAttribute(e,i):t.removeAttribute(e);e("pattern",this.pattern),e("minlength",null!=w(this.getProperty("minlength"))?this.minLength+"":""),e("maxlength",null!=w(this.getProperty("maxlength"))?this.maxLength+"":"")}updateValidity(){const t=this.shadowRoot?.querySelector("input");if(this.disabled)return void this.applyValidity({});const n=t?t.value:(this.getProperty("value")??"")+"";if(""===n.trim())return void(this.required?this.applyValidity({valueMissing:!0},f("input",{type:"text",required:!0}),t??void 0):this.applyValidity({}));const e={},i=[],o=(t,n)=>{e[t]=!0,i.push(n)};if(zt(this.type)){const t="number"==typeof this.K?this.K:null;if(null!==t&&(this.min||this.max)){const{validity:n,message:e}=function(t,n,e=""){const i=f(t,n,e);return{validity:y[t].validity,message:i}}("input",{type:"number",step:"any",min:this.min,max:this.max},t+"");n.rangeUnderflow&&o("rangeUnderflow",e),n.rangeOverflow&&o("rangeOverflow",e)}}else{t?.validity.typeMismatch&&o("typeMismatch",t.validationMessage),t?.validity.patternMismatch&&o("patternMismatch",t.validationMessage);const{tooShort:e,tooLong:i}=k(n,{minlength:this.getProperty("minlength"),maxlength:this.getProperty("maxlength"),tooShortMessage:this.tooShortMessage,tooLongMessage:this.tooLongMessage},t);e&&o("tooShort",e),i&&o("tooLong",i)}this.applyValidity(e,i[0],t??void 0)}};St.formAssociated=!0,St.properties={type:{type:"string",visual:!0,default:"text",validate:t=>["text","email","password","number","tel","url","currency","percent","compact"].includes(t),coerce:t=>["text","email","password","number","tel","url","currency","percent","compact"].includes(t)?t:"text"},value:{type:"string",visual:!0,formValue:!0,emitChange:!0,default:""},name:{type:"string",default:""},placeholder:{type:"string",visual:!0,default:""},label:{type:"string",visual:!0,default:""},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},pattern:{type:"string",visual:!0,default:""},minlength:{type:"string",visual:!0,default:""},maxlength:{type:"string",visual:!0,default:""},min:{type:"string",visual:!0,default:""},max:{type:"string",visual:!0,default:""},tooShortMessage:{type:"string",visual:!0,default:""},tooLongMessage:{type:"string",visual:!0,default:""},error:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},flavor:{type:"string",visual:!0,default:"neutral"},currency:{type:"string",visual:!0,default:"USD"},locale:{type:"string",visual:!0,default:"en-US"},precision:{type:"number",visual:!0,default:void 0,validate:t=>null==t||"number"==typeof t&&t>=0&&10>=t,coerce:t=>{if(null==t)return;const n=+t;return isNaN(n)?void 0:Math.max(0,Math.min(10,Math.floor(n)))}},debounce:{type:"number",default:0,validate:t=>{const n=+t;return!isNaN(n)&&n>=0&&5e3>=n},coerce:t=>{const n=+t;return isNaN(n)?0:Math.max(0,Math.min(5e3,Math.floor(n)))}}};let Tt=St;customElements.get("ty-input")||customElements.define("ty-input",Tt);const _t=(t,n)=>{const e=e=>n?`var(--ty-color-${t}${e}, var(--ty-color-${n}${e}))`:`var(--ty-color-${t}${e})`;return`\n:host([flavor="${t}"]) { --checkbox-color: ${e("-strong")}; --checkbox-ring: color-mix(in oklab, ${e("")} 25%, transparent); }\n:host([flavor="${t}+"]) { --checkbox-color: ${e("-strong")}; --checkbox-ring: color-mix(in oklab, ${e("-strong")} 25%, transparent); }\n:host([flavor="${t}-"]) { --checkbox-color: ${e("")}; --checkbox-ring: color-mix(in oklab, ${e("")} 25%, transparent); }\n`},qt=`\n:host {\ndisplay: inline-flex;\nwidth: auto;\nvertical-align: middle;\n}\n.checkbox-container {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nmin-height: 1.25em;\nmin-height: 1lh;\noutline: none;\ntransition: var(--ty-local-transition, all 0.15s ease-in-out);\nuser-select: none;\ncursor: pointer;\nborder-radius: 6px;\ngap: var(--ty-spacing-1);\ncolor: var(--checkbox-color-off, color-mix(in oklab, var(--ty-text) 30%, transparent));\nbox-sizing: border-box;\npadding: 2px;\nborder-radius: 5px;\n}\n.checkbox-container:hover {\nbackground: var(--checkbox-hover-bg, color-mix(in oklab, var(--ty-text) 8%, transparent));\n}\n.checkbox-container:not([aria-checked="true"]):not([aria-checked="mixed"]):hover {\ncolor: var(--checkbox-color-off-hover, color-mix(in oklab, var(--ty-text) 50%, transparent));\n}\n.checkbox-container[aria-checked="true"] {\ncolor: var(--checkbox-color, var(--ty-text));\n}\n.checkbox-container.focused,\n.checkbox-container:focus-visible {\nbox-shadow: 0 0 0 3px var(--checkbox-ring, color-mix(in oklab, var(--ty-color-primary) 25%, transparent));\n}\n.checkbox-icon {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\ncolor: inherit;\ntransition: var(--ty-local-transition, color 0.15s ease-in-out);\npointer-events: none;\n}\n.checkbox-container svg {\nwidth: 16px;\nheight: 16px;\n}\n.checkbox-container.xs svg {\nwidth: 12px;\nheight: 12px;\n}\n.checkbox-container.sm svg {\nwidth: 14px;\nheight: 14px;\n}\n.checkbox-container.lg svg {\nwidth: 20px;\nheight: 20px;\n}\n.checkbox-container.xl svg {\nwidth: 24px;\nheight: 24px;\n}\n${n.map(t=>_t(t)).join("")}\n.checkbox-container[aria-checked="mixed"] {\ncolor: var(--checkbox-color, var(--ty-text));\n}\n.checkbox-container.disabled {\npointer-events: none;\ncursor: not-allowed;\nopacity: 0.5;\nfilter: grayscale(1);\n}\n.checkbox-container.disabled:not([aria-checked="true"]) {\nopacity: 0.45;\n}\n.checkbox-container.disabled:hover {\nbackground: none;\n}\n.checkbox-container.error .checkbox-icon {\ncolor: var(--ty-color-danger);\n}\n.checkbox-container.error:focus {\nbox-shadow: 0 0 0 3px color-mix(in oklab, var(--ty-color-danger) 15%, transparent);\n}\n`,Lt=class extends T{constructor(){super(),this.j=null,this.G=!1,this.ct=null,this.dt=null,this.et=null,this.it=null,q(this.shadowRoot,{css:qt,id:"ty-checkbox"})}onConnect(){this.setupEventListeners(),this.O()}O(){this.j=O(this.shadowRoot,this.j,this.flavor,({base:t})=>(t=>_t(t,"neutral"))(t))}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.O()}getFormValue(){return this.checked?this.value:null}buildClassList(){const t=[this.size];return this.disabled&&t.push("disabled"),this.required&&t.push("required"),t.join(" ")}handleCheckboxClick(t){if(this.disabled)return;if(this.isDuplicateActivationClick())return;const n=!!this.indeterminate||!this.checked;this.indeterminate&&(this.indeterminate=!1),this.checked=n,setTimeout(()=>{const e={value:n,checked:n,formValue:n?this.value:null,originalEvent:t};this.dispatchEvent(new CustomEvent("input",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0,composed:!0}))},0)}handleCheckboxKeydown(t){this.disabled||["Space"," ","Enter"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this.handleCheckboxClick(t))}removeEventListeners(){if(!this.G)return;this.ct&&(this.removeEventListener("click",this.ct),this.ct=null);const t=this.shadowRoot;if(!t)return;const n=t.querySelector(".checkbox-container");n?(this.dt&&(n.removeEventListener("keydown",this.dt),this.dt=null),this.et&&(n.removeEventListener("focus",this.et),this.et=null),this.it&&(n.removeEventListener("blur",this.it),this.it=null),this.G=!1):this.G=!1}setupEventListeners(){if(this.G)return;const t=this.shadowRoot.querySelector(".checkbox-container");t&&(this.ct=t=>{this.handleCheckboxClick(t)},this.dt=t=>{this.handleCheckboxKeydown(t)},this.et=()=>{t.classList.add("focused")},this.it=()=>{t.classList.remove("focused")},this.addEventListener("click",this.ct),t.addEventListener("keydown",this.dt),t.addEventListener("focus",this.et),t.addEventListener("blur",this.it),this.G=!0)}render(){const t=this.shadowRoot;let n=t.querySelector(".checkbox-container");const e=this.buildClassList(),i=this.indeterminate?"mixed":this.checked+"";if(n)n.className="checkbox-container "+e,n.tabIndex=this.disabled?-1:0,n.setAttribute("aria-checked",i),n.setAttribute("aria-disabled",this.disabled+""),n.setAttribute("aria-required",this.required+"");else{n=document.createElement("div"),n.className="checkbox-container "+e,n.tabIndex=this.disabled?-1:0,n.setAttribute("role","checkbox"),n.setAttribute("aria-checked",i),n.setAttribute("aria-disabled",this.disabled+""),n.setAttribute("aria-required",this.required+"");const o=document.createElement("div");o.className="checkbox-icon",n.appendChild(o),t.appendChild(n)}n.querySelector(".checkbox-icon").innerHTML=this.indeterminate?'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/></svg>':'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>',this.setupEventListeners(),this.applyLabelName(n),this.updateValidity()}focus(t){const n=this.shadowRoot?.querySelector(".checkbox-container");n?n.focus(t):super.focus(t)}updateValidity(){const t=this.shadowRoot?.querySelector(".checkbox-container");this.disabled?this.applyValidity({}):this.required&&!this.checked?this.applyValidity({valueMissing:!0},f("input",{type:"checkbox",required:!0}),t??void 0):this.applyValidity({})}get checked(){return this.getProperty("checked")}set checked(t){this.setProperty("checked",t)}get indeterminate(){return this.getProperty("indeterminate")}set indeterminate(t){this.setProperty("indeterminate",t)}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get form(){return this.C.form}};Lt.formAssociated=!0,Lt.properties={checked:{type:"boolean",visual:!0,formValue:!0,emitChange:!0,default:!1},indeterminate:{type:"boolean",visual:!0,default:!1},value:{type:"string",default:"on"},name:{type:"string",default:""},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},flavor:{type:"string",visual:!0,default:"neutral"}};let Dt=Lt;customElements.get("ty-checkbox")||customElements.define("ty-checkbox",Dt);const At=(t,n)=>{const e=e=>n?`var(--ty-color-${t}${e}, var(--ty-color-${n}${e}))`:`var(--ty-color-${t}${e})`;return`\n:host([flavor="${t}"]) { --switch-track: ${e("")}; }\n:host([flavor="${t}+"]) { --switch-track: ${e("-strong")}; }\n:host([flavor="${t}-"]) { --switch-track: ${e("-soft")}; }\n`},Ft=`\n${kt}\n:host {\ndisplay: inline-flex;\nwidth: auto;\nvertical-align: middle;\n}\n.switch-container {\ndisplay: inline-flex;\nalign-items: center;\nmin-height: 1.25em;\nmin-height: 1lh;\ncursor: pointer;\nuser-select: none;\noutline: none;\nvertical-align: middle;\n}\n.switch-container.disabled {\ncursor: not-allowed;\nopacity: 0.55;\n}\n.switch-container:focus-visible .switch-track,\n.switch-container.focused .switch-track {\nbox-shadow: 0 0 0 3px var(--ty-input-shadow-focus);\n}\n.switch-track {\nposition: relative;\nflex-shrink: 0;\nwidth: 36px;\nheight: 20px;\nborder-radius: var(--ty-radius-full, 999px);\nbackground: var(--ty-color-neutral-soft, var(--ty-input-border));\ntransition: var(--ty-local-transition, background-color 0.18s ease-in-out);\nbox-sizing: border-box;\n}\n.switch-thumb {\nposition: absolute;\ntop: 2px;\nleft: 2px;\nwidth: 16px;\nheight: 16px;\nborder-radius: min(50%, var(--ty-radius-full, 50%));\nbackground: white;\nbox-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);\ntransition: var(--ty-local-transition, transform 0.18s ease-in-out, background-color 0.18s ease-in-out);\n}\n.switch-container[aria-checked="true"] .switch-track {\nbackground: var(--switch-track, var(--ty-color-primary));\n}\n.switch-container[aria-checked="true"] .switch-thumb {\ntransform: translateX(16px);\n}\n.switch-container.xs .switch-track { width: 26px; height: 14px; }\n.switch-container.xs .switch-thumb { width: 10px; height: 10px; }\n.switch-container.xs[aria-checked="true"] .switch-thumb { transform: translateX(12px); }\n.switch-container.sm .switch-track { width: 30px; height: 16px; }\n.switch-container.sm .switch-thumb { width: 12px; height: 12px; }\n.switch-container.sm[aria-checked="true"] .switch-thumb { transform: translateX(14px); }\n.switch-container.lg .switch-track { width: 44px; height: 24px; }\n.switch-container.lg .switch-thumb { width: 20px; height: 20px; }\n.switch-container.lg[aria-checked="true"] .switch-thumb { transform: translateX(20px); }\n.switch-container.xl .switch-track { width: 52px; height: 28px; }\n.switch-container.xl .switch-thumb { width: 24px; height: 24px; }\n.switch-container.xl[aria-checked="true"] .switch-thumb { transform: translateX(24px); }\n${n.map(t=>At(t)).join("")}\n`,Vt=class extends T{constructor(){super(),this.j=null,this.G=!1,this.ct=null,this.dt=null,this.et=null,this.it=null,q(this.shadowRoot,{css:Ft,id:"ty-switch"})}onConnect(){this.setupEventListeners(),this.O()}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.O()}O(){this.j=O(this.shadowRoot,this.j,this.flavor,({base:t})=>(t=>At(t,"neutral"))(t))}getFormValue(){return this.checked?this.value:null}buildClassList(){const t=[this.size];return this.disabled&&t.push("disabled"),this.required&&t.push("required"),t.join(" ")}handleSwitchClick(t){if(this.disabled)return;if(this.isDuplicateActivationClick())return;const n=!this.checked;this.checked=n,setTimeout(()=>{const e={value:n,checked:n,formValue:n?this.value:null,originalEvent:t};this.dispatchEvent(new CustomEvent("input",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0,composed:!0}))},0)}handleSwitchKeydown(t){this.disabled||["Space"," ","Enter"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this.handleSwitchClick(t))}removeEventListeners(){if(!this.G)return;this.ct&&(this.removeEventListener("click",this.ct),this.ct=null);const t=this.shadowRoot;if(!t)return;const n=t.querySelector(".switch-container");n?(this.dt&&(n.removeEventListener("keydown",this.dt),this.dt=null),this.et&&(n.removeEventListener("focus",this.et),this.et=null),this.it&&(n.removeEventListener("blur",this.it),this.it=null),this.G=!1):this.G=!1}setupEventListeners(){if(this.G)return;const t=this.shadowRoot.querySelector(".switch-container");t&&(this.ct=t=>this.handleSwitchClick(t),this.dt=t=>this.handleSwitchKeydown(t),this.et=()=>t.classList.add("focused"),this.it=()=>t.classList.remove("focused"),this.addEventListener("click",this.ct),t.addEventListener("keydown",this.dt),t.addEventListener("focus",this.et),t.addEventListener("blur",this.it),this.G=!0)}render(){const t=this.shadowRoot;let n=t.querySelector(".switch-container");const e=this.buildClassList();if(n)n.className="switch-container "+e,n.tabIndex=this.disabled?-1:0,n.setAttribute("aria-checked",this.checked?"true":"false"),n.setAttribute("aria-disabled",this.disabled?"true":"false"),n.setAttribute("aria-required",this.required?"true":"false");else{n=document.createElement("div"),n.className="switch-container "+e,n.tabIndex=this.disabled?-1:0,n.setAttribute("role","switch"),n.setAttribute("aria-checked",this.checked?"true":"false"),n.setAttribute("aria-disabled",this.disabled?"true":"false"),n.setAttribute("aria-required",this.required?"true":"false");const i=document.createElement("div");i.className="switch-track";const o=document.createElement("div");o.className="switch-thumb",i.appendChild(o),n.appendChild(i),t.appendChild(n)}this.setupEventListeners(),this.applyLabelName(n),this.updateValidity()}focus(t){const n=this.shadowRoot?.querySelector(".switch-container");n?n.focus(t):super.focus(t)}updateValidity(){const t=this.shadowRoot?.querySelector(".switch-container");this.disabled?this.applyValidity({}):this.required&&!this.checked?this.applyValidity({valueMissing:!0},f("input",{type:"checkbox",switch:!0,required:!0}),t??void 0):this.applyValidity({})}get checked(){return this.getProperty("checked")}set checked(t){this.setProperty("checked",t)}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get form(){return this.C.form}};Vt.formAssociated=!0,Vt.properties={checked:{type:"boolean",visual:!0,formValue:!0,emitChange:!0,default:!1},value:{type:"string",default:"on"},name:{type:"string",default:""},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},flavor:{type:"string",visual:!0,default:"primary"}};let jt=Vt;customElements.get("ty-switch")||customElements.define("ty-switch",jt);const It=(t,n)=>{const e=e=>n?`var(--ty-color-${t}${e}, var(--ty-color-${n}${e}))`:`var(--ty-color-${t}${e})`;return`\n:host([flavor="${t}"]) { --radio-color: ${e("")}; }\n:host([flavor="${t}+"]) { --radio-color: ${e("-strong")}; }\n:host([flavor="${t}-"]) { --radio-color: ${e("-soft")}; }\n`},Ot=`\n${kt}\n:host(ty-radio) {\ndisplay: inline-flex;\nwidth: auto;\nvertical-align: middle;\n}\n:host(ty-radio-group) {\ndisplay: block;\nwidth: 100%;\n}\n.radio-group-container {\ndisplay: flex;\nflex-direction: column;\ngap: 0.4rem;\nfont-family: inherit;\ncolor: var(--ty-text);\n}\n.radio-group-label {\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nfont-weight: var(--ty-font-medium);\ncolor: var(--ty-text);\ndisplay: flex;\nalign-items: center;\ngap: 0.25rem;\n}\n.radio-group-list {\ndisplay: flex;\ngap: 0.6rem;\nalign-items: flex-start;\n}\n.radio-group-list.vertical {\nflex-direction: column;\nalign-items: flex-start;\n}\n.radio-group-list.horizontal {\nflex-direction: row;\nflex-wrap: wrap;\nalign-items: center;\n}\n.radio-group-error {\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\ncolor: var(--ty-color-danger);\n}\n.radio-group-container .required-icon {\nwidth: 0.65em;\nheight: 0.65em;\ncolor: var(--ty-color-danger);\n}\n.radio-group-container .required-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n.radio-container {\ndisplay: inline-flex;\nalign-items: center;\nmin-height: 1.25em;\nmin-height: 1lh;\ncursor: pointer;\nuser-select: none;\noutline: none;\nvertical-align: middle;\n}\n.radio-container:not(.disabled):not([aria-checked="true"]):hover .radio-circle {\nborder-color: var(--radio-ring-off-hover, color-mix(in oklab, var(--ty-text) 80%, transparent));\n}\n.radio-container.disabled {\ncursor: not-allowed;\nopacity: 0.55;\n}\n.radio-container:focus-visible .radio-circle,\n.radio-container.focused .radio-circle {\nbox-shadow: 0 0 0 3px var(--ty-input-shadow-focus);\n}\n.radio-circle {\nposition: relative;\nflex-shrink: 0;\nwidth: 18px;\nheight: 18px;\nborder-radius: 50%;\nborder: 2px solid var(--radio-ring-off, color-mix(in oklab, var(--ty-text) 45%, transparent));\nbackground: var(--ty-input-bg);\nbox-sizing: border-box;\ntransition: var(--ty-local-transition, border-color 0.15s ease-in-out);\n}\n.radio-circle::after {\ncontent: "";\nposition: absolute;\ntop: 50%;\nleft: 50%;\nwidth: 8px;\nheight: 8px;\nborder-radius: 50%;\nbackground: var(--radio-color, var(--ty-color-primary));\ntransform: translate(-50%, -50%) scale(0);\ntransition: transform 0.15s ease-in-out;\n}\n.radio-container[aria-checked="true"] .radio-circle {\nborder-color: var(--radio-color, var(--ty-color-primary));\n}\n.radio-container[aria-checked="true"] .radio-circle::after {\ntransform: translate(-50%, -50%) scale(1);\n}\n.radio-container.xs .radio-circle { width: 14px; height: 14px; }\n.radio-container.xs .radio-circle::after { width: 6px; height: 6px; }\n.radio-container.sm .radio-circle { width: 16px; height: 16px; }\n.radio-container.sm .radio-circle::after { width: 7px; height: 7px; }\n.radio-container.lg .radio-circle { width: 22px; height: 22px; }\n.radio-container.lg .radio-circle::after { width: 10px; height: 10px; }\n.radio-container.xl .radio-circle { width: 26px; height: 26px; }\n.radio-container.xl .radio-circle::after { width: 12px; height: 12px; }\n${n.map(t=>It(t)).join("")}\n`,Ht=class extends T{constructor(){super(),this.j=null,this.G=!1,this.ct=null,this.et=null,this.it=null,this.ht=!0,q(this.shadowRoot,{css:Ot,id:"ty-radio"})}setTabStop(t){this.ht=t;const n=this.shadowRoot?.querySelector(".radio-container");n&&(n.tabIndex=this.disabled||!t?-1:0)}focus(t){const n=this.shadowRoot?.querySelector(".radio-container");n?n.focus(t):super.focus(t)}onConnect(){this.setupEventListeners(),this.dispatchEvent(new CustomEvent("ty-radio-connected",{bubbles:!0})),this.O()}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.O()}O(){this.j=O(this.shadowRoot,this.j,this.flavor,({base:t})=>(t=>It(t,"neutral"))(t))}buildClassList(){const t=[this.size];return this.disabled&&t.push("disabled"),t.join(" ")}handleClick(t){this.disabled||(t.stopPropagation(),this.dispatchEvent(new CustomEvent("ty-radio-select",{detail:{value:this.value},bubbles:!0,composed:!0})))}removeEventListeners(){if(!this.G)return;this.ct&&(this.removeEventListener("click",this.ct),this.ct=null);const t=this.shadowRoot?.querySelector(".radio-container");t?(this.et&&(t.removeEventListener("focus",this.et),this.et=null),this.it&&(t.removeEventListener("blur",this.it),this.it=null),this.G=!1):this.G=!1}setupEventListeners(){if(this.G)return;const t=this.shadowRoot.querySelector(".radio-container");t&&(this.ct=t=>this.handleClick(t),this.et=()=>t.classList.add("focused"),this.it=()=>t.classList.remove("focused"),this.addEventListener("click",this.ct),t.addEventListener("focus",this.et),t.addEventListener("blur",this.it),this.G=!0)}render(){const t=this.shadowRoot;let n=t.querySelector(".radio-container");const e=this.buildClassList();if(n)n.className="radio-container "+e,n.tabIndex=this.disabled||!this.ht?-1:0,n.setAttribute("aria-checked",this.checked+""),n.setAttribute("aria-disabled",this.disabled+"");else{n=document.createElement("div"),n.className="radio-container "+e,n.tabIndex=this.disabled||!this.ht?-1:0,n.setAttribute("role","radio"),n.setAttribute("aria-checked",this.checked+""),n.setAttribute("aria-disabled",this.disabled+"");const i=document.createElement("div");i.className="radio-circle",n.appendChild(i),t.appendChild(n)}this.setupEventListeners(),this.applyLabelName(n)}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get checked(){return this.getProperty("checked")}set checked(t){this.setProperty("checked",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}};Ht.properties={value:{type:"string",default:""},checked:{type:"boolean",visual:!0,default:!1},disabled:{type:"boolean",visual:!0,default:!1},size:{type:"string",visual:!0,default:e},flavor:{type:"string",visual:!0,default:"primary"}};let Nt=Ht;customElements.get("ty-radio")||customElements.define("ty-radio",Nt);const Wt=class extends T{constructor(){super(),this.G=!1,this.ut=null,this.dt=null,this.bt=null,q(this.shadowRoot,{css:Ot,id:"ty-radio-group"})}onConnect(){this.setupEventListeners(),queueMicrotask(()=>this.syncChildren())}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){t.some(t=>"value"===t.name||"size"===t.name||"flavor"===t.name||"disabled"===t.name||"required"===t.name)&&this.syncChildren()}getFormValue(){return this.value||null}focus(t){const n=this.getRadios().filter(t=>!t.disabled),e=n.find(t=>t.checked)??n[0];e?e.focus(t):super.focus(t)}getRadios(){return Array.from(this.querySelectorAll("ty-radio")).filter(t=>"function"==typeof t.setTabStop)}syncChildren(){const t=this.getRadios();for(const i of t)i.checked=i.value===this.value,this.disabled?i.disabled||(i.disabled=!0,i.dataset.tyGroupDisabled=""):"tyGroupDisabled"in i.dataset&&(i.disabled=!1,delete i.dataset.tyGroupDisabled),i.size=this.size,i.flavor=this.flavor;const n=t.filter(t=>!t.disabled),e=n.find(t=>t.checked)??n[0];for(const i of t)i.setTabStop(i===e);this.updateValidity()}updateValidity(){if(!this.required||this.disabled||this.value)this.applyValidity({});else{const t=this.getRadios().find(t=>!t.disabled),n=t?.shadowRoot?.querySelector(".radio-container");this.applyValidity({valueMissing:!0},f("input",{type:"radio",name:"ty",required:!0}),n??void 0)}}handleRadioSelect(t){if(this.disabled)return;const n=t.detail,e=n?.value;"string"==typeof e&&e!==this.value&&(this.value=e,this.syncChildren(),setTimeout(()=>{const n={value:e,formValue:e,originalEvent:t};this.dispatchEvent(new CustomEvent("input",{detail:n,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},0))}handleKeydown(t){if(this.disabled)return;const n=this.getRadios().filter(t=>!t.disabled);if(0===n.length)return;const e=document.activeElement,i=n.find(t=>t===e||t.contains(e));let o=-1;if(["ArrowDown","ArrowRight"].includes(t.key))t.preventDefault(),o=i?(n.indexOf(i)+1)%n.length:0;else{if(!["ArrowUp","ArrowLeft"].includes(t.key)){if(["Space"," ","Enter"].includes(t.key)){if(i){t.preventDefault(),this.value=i.value,this.syncChildren();const n={value:i.value,formValue:i.value,originalEvent:t};setTimeout(()=>{this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},0)}return}return}t.preventDefault(),o=i?(n.indexOf(i)-1+n.length)%n.length:n.length-1}const r=n[o];if(r){r.focus(),this.value=r.value,this.syncChildren();const n={value:r.value,formValue:r.value,originalEvent:t};setTimeout(()=>{this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},0)}}removeEventListeners(){this.G&&(this.ut&&(this.removeEventListener("ty-radio-select",this.ut),this.ut=null),this.dt&&(this.removeEventListener("keydown",this.dt),this.dt=null),this.bt&&(this.removeEventListener("ty-radio-connected",this.bt),this.bt=null),this.G=!1)}setupEventListeners(){this.G||(this.ut=t=>this.handleRadioSelect(t),this.dt=t=>this.handleKeydown(t),this.bt=()=>this.syncChildren(),this.addEventListener("ty-radio-select",this.ut),this.addEventListener("keydown",this.dt),this.addEventListener("ty-radio-connected",this.bt),this.G=!0)}render(){const t=this.shadowRoot;let n=t.querySelector(".radio-group-container");if(n){let t=n.querySelector(".radio-group-label");if(this.label)if(t||(t=document.createElement("div"),t.className="radio-group-label",n.insertBefore(t,n.firstChild)),t.textContent=this.label,this.required&&!t.querySelector(".required-icon")){const n=document.createElement("span");n.className="required-icon",n.innerHTML=Mt,t.appendChild(n)}else this.required||t.querySelector(".required-icon")?.remove();else t&&t.remove();const e=n.querySelector(".radio-group-list");e&&(e.className="radio-group-list "+this.orientation);let i=n.querySelector(".radio-group-error");this.error?(i||(i=document.createElement("div"),i.className="radio-group-error",n.appendChild(i)),i.textContent=this.error):i&&i.remove(),n.setAttribute("aria-disabled",this.disabled+"")}else{if(n=document.createElement("div"),n.className="radio-group-container",n.setAttribute("role","radiogroup"),n.setAttribute("aria-disabled",this.disabled+""),this.label){const t=document.createElement("div");if(t.className="radio-group-label",t.textContent=this.label,this.required){const n=document.createElement("span");n.className="required-icon",n.innerHTML=Mt,t.appendChild(n)}n.appendChild(t)}const e=document.createElement("div");e.className="radio-group-list "+this.orientation;const i=document.createElement("slot");if(e.appendChild(i),n.appendChild(e),this.error){const t=document.createElement("div");t.className="radio-group-error",t.textContent=this.error,n.appendChild(t)}t.appendChild(n),this.setupEventListeners()}this.syncChildren()}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get error(){return this.getProperty("error")}set error(t){this.setProperty("error",t)}get orientation(){return this.getProperty("orientation")}set orientation(t){this.setProperty("orientation",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get form(){return this.C.form}};Wt.formAssociated=!0,Wt.properties={value:{type:"string",visual:!0,formValue:!0,emitChange:!0,default:""},name:{type:"string",default:""},label:{type:"string",visual:!0,default:""},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},error:{type:"string",visual:!0,default:""},orientation:{type:"string",visual:!0,default:"vertical"},size:{type:"string",visual:!0,default:e},flavor:{type:"string",visual:!0,default:"primary"}};let Bt=Wt;customElements.get("ty-radio-group")||customElements.define("ty-radio-group",Bt);const Pt=(t,n)=>{const e=e=>n?`var(--ty-color-${t}${e}, var(--ty-color-${n}${e}))`:`var(--ty-color-${t}${e})`,i=e=>n?`var(--ty-bg-${t}${e}, var(--ty-bg-${n}${e}))`:`var(--ty-bg-${t}${e})`;return`\n:host([flavor="${t}"]) { --copy-color: ${e("")}; --copy-color-hover: ${e("-strong")}; --copy-bg-hover: ${i("-soft")}; }\n:host([flavor="${t}+"]) { --copy-color: ${e("-strong")}; --copy-color-hover: ${e("-strong")}; --copy-bg-hover: ${i("-soft")}; }\n:host([flavor="${t}-"]) { --copy-color: ${e("-soft")}; --copy-color-hover: ${e("")}; --copy-bg-hover: ${i("-soft")}; }\n`},Rt=`\n.copy-field-value {\nflex: 1;\nfont-size: var(--ty-field-font);\nline-height: var(--ty-field-leading);\nletter-spacing: var(--ty-field-tracking);\noverflow: hidden;\ntext-overflow: ellipsis;\nwhite-space: nowrap;\nuser-select: none;\npadding: 0;\nmargin: 0;\nbackground: transparent;\nborder: none;\ncolor: var(--input-color, var(--ty-input-color));\nfont-family: inherit;\n}\ncode.copy-field-value {\nfont-family: var(--ty-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);\nfont-size: calc(var(--ty-field-font) * 0.93);\n}\n.copy-field-value.multiline {\nwhite-space: pre-wrap;\nword-break: break-word;\nmax-height: 200px;\noverflow-y: auto;\n}\n.input-wrapper:has(.copy-field-value.multiline) {\nalign-items: flex-start;\npadding-top: 8px;\npadding-bottom: 8px;\n}\n.copy-field-value.horizontal-scroll {\noverflow-x: auto;\noverflow-y: hidden;\ntext-overflow: clip;\nwhite-space: nowrap;\n}\n.copy-field-value.multiline.horizontal-scroll {\nwhite-space: pre;\nword-break: normal;\noverflow-y: auto;\n}\n.copy-field-value.multiline,\n.copy-field-value.horizontal-scroll {\nscrollbar-width: none; \n}\n.copy-field-value.multiline::-webkit-scrollbar,\n.copy-field-value.horizontal-scroll::-webkit-scrollbar {\ndisplay: none; \n}\n.input-wrapper:not(.disabled):hover {\nbackground: var(--copy-bg-hover, var(--ty-bg-primary-soft));\ntransition: var(--ty-local-transition, background 0.2s ease);\n}\n.copy-button {\nflex-shrink: 0;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nwidth: var(--ty-field-control);\nheight: var(--ty-field-control);\ncursor: pointer;\nborder: none;\nbackground: transparent;\ncolor: var(--copy-color, var(--ty-text-soft));\ntransition: var(--ty-local-transition, color 0.2s ease, transform 0.2s ease);\npadding: 0;\nmargin: 0;\n}\n.copy-button:hover:not(.disabled) {\ncolor: var(--copy-color-hover, var(--ty-text));\ntransform: scale(1.1);\n}\n.copy-button.success {\ncolor: var(--ty-color-success);\nanimation: copy-feedback 0.3s ease;\n}\n.copy-button.error {\ncolor: var(--ty-color-danger);\nanimation: copy-feedback 0.3s ease;\n}\n@keyframes copy-feedback {\n0%, 100% { transform: scale(1); }\n50% { transform: scale(1.2); }\n}\n.copy-button svg {\nwidth: var(--ty-field-icon);\nheight: var(--ty-field-icon);\n}\n.input-wrapper.disabled .copy-button {\ncursor: not-allowed;\nopacity: 0.5;\n}\n.input-wrapper.disabled {\ncursor: not-allowed;\n}\n${n.map(t=>Pt(t)).join("")}\n`,Yt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>',Ut='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>',Zt=class extends T{constructor(){super(),this.gt=null,this.vt=!1,this.j=null,q(this.shadowRoot,{css:kt,id:"ty-input"}),q(this.shadowRoot,{css:Rt,id:"ty-copy"})}onConnect(){this.O()}O(){this.j=O(this.shadowRoot,this.j,this.flavor,({base:t})=>(t=>Pt(t,"neutral"))(t))}onDisconnect(){null!==this.gt&&(clearTimeout(this.gt),this.gt=null)}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.O()}buildClassList(){const t=[];return this.disabled&&t.push("disabled"),this.required&&t.push("required"),t.join(" ")}async copyToClipboard(){if(this.disabled||!this.value)return;const t=this.value;try{await navigator.clipboard.writeText(t),this.dispatchEvent(new CustomEvent("copy-success",{detail:{value:t},bubbles:!0,composed:!0}))}catch(n){try{const n=document.createElement("textarea");n.value=t,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),this.dispatchEvent(new CustomEvent("copy-success",{detail:{value:t},bubbles:!0,composed:!0}))}catch(e){return this.dispatchEvent(new CustomEvent("copy-error",{detail:{error:e},bubbles:!0,composed:!0})),void this.showCopyError()}}this.showCopySuccess()}showCopySuccess(){null!==this.gt&&clearTimeout(this.gt),this.vt=!0;const t=this.shadowRoot.querySelector(".copy-button");t&&(t.classList.add("success"),t.innerHTML=Ut,t.setAttribute("aria-label","Copied!")),this.gt=window.setTimeout(()=>{this.vt=!1;const t=this.shadowRoot.querySelector(".copy-button");t&&(t.classList.remove("success"),t.innerHTML=Yt,t.setAttribute("aria-label","Copy to clipboard")),this.gt=null},2e3)}showCopyError(){null!==this.gt&&clearTimeout(this.gt),this.vt=!1;const t=this.shadowRoot.querySelector(".copy-button");t&&(t.classList.add("error"),t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',t.setAttribute("aria-label","Copy failed")),this.gt=window.setTimeout(()=>{const t=this.shadowRoot.querySelector(".copy-button");t&&(t.classList.remove("error"),t.innerHTML=Yt,t.setAttribute("aria-label","Copy to clipboard")),this.gt=null},2e3)}setupEventListeners(){const t=this.shadowRoot,n=t.querySelector(".input-wrapper"),e=t.querySelector(".copy-button");if(n&&!this.disabled){const t=n;t.addEventListener("click",t=>{t.target===e||t.target.closest(".copy-button")||this.copyToClipboard()}),t.style.cursor="pointer"}e&&e.addEventListener("click",()=>{this.copyToClipboard()})}render(){const t=this.shadowRoot,n=this.buildClassList(),e=["copy-field-value",this.multiline?"multiline":"",this.horizontalScroll?"horizontal-scroll":""].filter(Boolean).join(" "),i=(this.value||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");t.innerHTML=`\n<div class="input-container">\n${this.label?`\n<label class="ty-field-label">\n${this.label}\n${this.required?`<span class="required-icon">${Mt}</span>`:""}\n</label>\n`:""}\n<div class="input-wrapper ${n}">\n${"code"===this.format?`<code class="${e}">${i}</code>`:`<div class="${e}">${i}</div>`}\n<button class="copy-button${this.vt?" success":""}" type="button" aria-label="${this.vt?"Copied!":"Copy to clipboard"}" ${this.disabled?"disabled":""}>\n${this.vt?Ut:Yt}\n</button>\n</div>\n</div>\n`,this.setupEventListeners()}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.setProperty("flavor",t)}get format(){return this.getProperty("format")}set format(t){this.setProperty("format",t)}get multiline(){return this.getProperty("multiline")}set multiline(t){this.setProperty("multiline",t)}get horizontalScroll(){return this.getProperty("horizontalScroll")}set horizontalScroll(t){this.setProperty("horizontalScroll",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}};Zt.formAssociated=!0,Zt.properties={value:{type:"string",visual:!0,formValue:!0,default:""},label:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},flavor:{type:"string",visual:!0,default:"neutral"},format:{type:"string",visual:!0,default:"text",coerce:t=>"code"===t?"code":"text"},multiline:{type:"boolean",visual:!0,default:!1},horizontalScroll:{type:"boolean",visual:!0,default:!1},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1}};let Xt=Zt;function Kt(t){return 1024>t?t+" B":1048576>t?(t/1024).toFixed(1)+" KB":1073741824>t?(t/1024/1024).toFixed(1)+" MB":(t/1024/1024/1024).toFixed(1)+" GB"}customElements.get("ty-copy")||customElements.define("ty-copy",Xt),customElements.get("ty-copy-field")||customElements.define("ty-copy-field",class extends Xt{});const Jt=class extends T{constructor(){super(),this.yt=[],this.ft=!1,this.G=!1,this.wt=null,this.xt=null,this.kt=null,this.zt=null,this.$t=null,this.Ct=null,this.Mt=null,this.Et=null,q(this.shadowRoot,{css:"\n:host {\ndisplay: block;\nfont-family: inherit;\nwidth: 100%;\n}\n.file-upload-container {\ndisplay: flex;\nflex-direction: column;\nwidth: 100%;\nbox-sizing: border-box;\n}\n.upload-label {\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-medium);\ncolor: var(--ty-label-color);\nmargin-bottom: 6px;\npadding-left: 4px;\ndisplay: flex;\nalign-items: center;\n}\n.required-icon {\ncolor: var(--ty-color-danger);\nmargin-left: 4px;\nfont-size: 0.75rem;\nline-height: 1;\n}\n.drop-zone {\nborder: 2px dashed var(--ty-border);\nborder-radius: var(--ty-radius-base);\npadding: 2rem 1.5rem;\ntext-align: center;\ncursor: pointer;\ntransition: var(--ty-local-transition, border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease);\noutline: none;\ndisplay: flex;\nflex-direction: column;\nalign-items: center;\njustify-content: center;\ngap: 0.5rem;\nmin-height: 140px;\nuser-select: none;\n}\n.drop-zone:hover:not(.disabled) {\nborder-color: var(--ty-input-border-hover);\nbackground: var(--ty-surface-content);\n}\n.drop-zone.focused {\nborder-color: var(--ty-input-border-focus);\nbox-shadow: 0 0 0 3px var(--ty-input-shadow-focus);\n}\n.drop-zone.drag-active {\nborder-color: var(--ty-color-primary);\nborder-style: solid;\nbackground: var(--ty-bg-primary-soft);\n}\n.drop-zone.drag-active .upload-icon {\ncolor: var(--ty-color-primary);\ntransform: translateY(-2px);\n}\n.drop-zone.has-files {\nmin-height: 80px;\npadding: 1.25rem 1.5rem;\n}\n.drop-zone.disabled {\nopacity: 0.5;\ncursor: not-allowed;\npointer-events: none;\n}\n.drop-zone.error {\nborder-color: var(--ty-color-danger);\n}\n.drop-zone.error:not(.disabled) {\nbackground: var(--ty-bg-danger-soft);\n}\n.upload-icon {\ncolor: var(--ty-text-faint);\nwidth: 2.5rem;\nheight: 2.5rem;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\ntransition: var(--ty-local-transition, color 0.15s ease, transform 0.15s ease);\npointer-events: none;\n}\n.upload-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n.upload-hint {\ncolor: var(--ty-text-soft);\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\npointer-events: none;\n}\n.browse-link {\ncolor: var(--ty-color-primary);\nfont-weight: var(--ty-font-medium);\n}\n.upload-sub-hint {\ncolor: var(--ty-text-faint);\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\npointer-events: none;\n}\n.file-list {\ndisplay: flex;\nflex-direction: column;\ngap: 0.375rem;\nmargin-top: 0.5rem;\n}\n.file-item {\ndisplay: flex;\nalign-items: center;\ngap: 0.5rem;\npadding: 0.5rem 0.75rem;\nborder-radius: var(--ty-radius-base);\nbackground: var(--ty-surface-content);\nborder: 1px solid var(--ty-border-soft);\n}\n.file-icon {\ncolor: var(--ty-text-faint);\nflex-shrink: 0;\nwidth: 1rem;\nheight: 1rem;\ndisplay: flex;\nalign-items: center;\n}\n.file-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n.file-name {\nflex: 1;\nfont-size: var(--ty-font-sm);\ncolor: var(--ty-text);\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\nmin-width: 0;\n}\n.file-size {\nfont-size: var(--ty-font-xs);\ncolor: var(--ty-text-faint);\nflex-shrink: 0;\nfont-variant-numeric: tabular-nums;\n}\n.file-remove {\nflex-shrink: 0;\ncursor: pointer;\ncolor: var(--ty-text-faint);\nwidth: 1.25rem;\nheight: 1.25rem;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nborder-radius: 50%;\ntransition: var(--ty-local-transition, color 0.15s ease, background-color 0.15s ease);\nborder: none;\nbackground: none;\npadding: 0;\noutline: none;\n}\n.file-remove:hover {\ncolor: var(--ty-color-danger);\nbackground: var(--ty-bg-danger-soft);\n}\n.file-remove:focus-visible {\nbox-shadow: 0 0 0 2px var(--ty-color-danger);\n}\n.file-remove svg {\nwidth: 12px;\nheight: 12px;\n}\n.error-message {\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\ncolor: var(--ty-color-danger);\nmargin-top: 4px;\npadding-left: 4px;\n}\n@media (prefers-reduced-motion: reduce) {\n.drop-zone,\n.upload-icon,\n.file-remove {\ntransition: none;\n}\n}\n@media (prefers-contrast: high) {\n.drop-zone {\nborder-width: 3px;\n}\n}\n",id:"ty-file-upload"})}onConnect(){this.updateFormValue()}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){}onFormReset(){this.yt=[],this.updateFormValue(),this.p&&this.render();const t=this.shadowRoot?.querySelector(".file-input");t&&(t.value="")}updateFormValue(){super.updateFormValue(),this.updateValidity()}updateValidity(){if(this.required&&!this.disabled&&0===this.yt.length){const t=this.shadowRoot?.querySelector(".drop-zone");this.applyValidity({valueMissing:!0},f("input",{type:"file",required:!0,multiple:this.multiple}),t??void 0)}else this.applyValidity({})}getFormValue(){if(!this.name)return null;const t=new FormData;0===this.yt.length&&t.append(this.name,new File([],"",{type:"application/octet-stream"}));for(const n of this.yt)t.append(this.name,n);return t}focus(t){const n=this.shadowRoot?.querySelector(".drop-zone");n?n.focus(t):super.focus(t)}matchesAccept(t){const n=this.accept?.trim();return!n||n.split(",").some(n=>{const e=n.trim().toLowerCase();if(!e)return!1;if(e.startsWith("."))return t.name.toLowerCase().endsWith(e);const i=t.type.toLowerCase();return e.endsWith("/*")?i.startsWith(e.slice(0,-1)):i===e})}get files(){return[...this.yt]}get multiple(){return this.getProperty("multiple")}set multiple(t){this.setProperty("multiple",t)}get accept(){return this.getProperty("accept")}set accept(t){this.setProperty("accept",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get placeholder(){return this.getProperty("placeholder")}set placeholder(t){this.setProperty("placeholder",t)}get error(){return this.getProperty("error")}set error(t){this.setProperty("error",t)}get form(){return this.C.form}setFiles(t){this.yt=this.multiple?t:t.slice(0,1),this.updateFormValue(),this.render();const n={value:this.yt,files:this.yt,names:this.yt.map(t=>t.name)};setTimeout(()=>{this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0})),this.revealValidity()},0)}removeFile(t){const n=[...this.yt];n.splice(t,1),this.setFiles(n);const e=this.shadowRoot?.querySelector(".file-input");e&&(e.value="")}setupEventListeners(){if(this.G)return;const t=this.shadowRoot,n=t.querySelector(".drop-zone"),e=t.querySelector(".file-input");this.wt=t=>{this.disabled||t.target.closest(".file-remove")||e.click()},this.xt=t=>{this.disabled||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())},this.kt=()=>{n.classList.add("focused")},this.zt=()=>{n.classList.remove("focused")},this.$t=t=>{this.disabled||(t.preventDefault(),t.stopPropagation(),this.ft||(this.ft=!0,n.classList.add("drag-active")))},this.Ct=t=>{n.contains(t.relatedTarget)||(this.ft=!1,n.classList.remove("drag-active"))},this.Mt=t=>{if(this.disabled)return;t.preventDefault(),t.stopPropagation(),this.ft=!1,n.classList.remove("drag-active");const e=Array.from(t.dataTransfer?.files??[]).filter(t=>this.matchesAccept(t));e.length>0&&this.setFiles(e)},this.Et=t=>{const n=t.target;n.files&&n.files.length>0&&this.setFiles(Array.from(n.files))},n.addEventListener("click",this.wt),n.addEventListener("keydown",this.xt),n.addEventListener("focus",this.kt),n.addEventListener("blur",this.zt),n.addEventListener("dragover",this.$t),n.addEventListener("dragleave",this.Ct),n.addEventListener("drop",this.Mt),e.addEventListener("change",this.Et),this.G=!0}removeEventListeners(){if(!this.G)return;const t=this.shadowRoot;if(!t)return;const n=t.querySelector(".drop-zone"),e=t.querySelector(".file-input");n&&e&&(this.wt&&n.removeEventListener("click",this.wt),this.xt&&n.removeEventListener("keydown",this.xt),this.kt&&n.removeEventListener("focus",this.kt),this.zt&&n.removeEventListener("blur",this.zt),this.$t&&n.removeEventListener("dragover",this.$t),this.Ct&&n.removeEventListener("dragleave",this.Ct),this.Mt&&n.removeEventListener("drop",this.Mt),this.Et&&e.removeEventListener("change",this.Et),this.G=!1)}buildDropZoneClasses(){const t=["drop-zone"];return this.ft&&t.push("drag-active"),this.yt.length>0&&t.push("has-files"),this.disabled&&t.push("disabled"),this.error&&t.push("error"),t.join(" ")}renderFileList(t){t.innerHTML="";for(let n=0;this.yt.length>n;n++){const e=this.yt[n],i=document.createElement("div");i.className="file-item";const o=document.createElement("span");o.className="file-icon",o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>';const r=document.createElement("span");r.className="file-name",r.textContent=e.name,r.title=e.name;const s=document.createElement("span");s.className="file-size",s.textContent=Kt(e.size);const a=document.createElement("button");a.className="file-remove",a.type="button",a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',a.setAttribute("aria-label","Remove "+e.name);const l=n;a.addEventListener("click",t=>{t.stopPropagation(),this.removeFile(l)}),i.appendChild(o),i.appendChild(r),i.appendChild(s),i.appendChild(a),t.appendChild(i)}}render(){const t=this.shadowRoot;let n=t.querySelector(".file-upload-container");if(!n){n=document.createElement("div"),n.className="file-upload-container";const e=document.createElement("div");e.className="upload-label",n.appendChild(e);const i=document.createElement("div");i.className="drop-zone",i.setAttribute("role","button");const o=document.createElement("input");o.type="file",o.className="file-input",o.style.display="none",i.appendChild(o);const r=document.createElement("div");r.className="upload-icon",r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" y1="3" x2="12" y2="15"/></svg>',i.appendChild(r);const s=document.createElement("div");s.className="upload-hint",i.appendChild(s);const a=document.createElement("div");a.className="upload-sub-hint",i.appendChild(a),n.appendChild(i);const l=document.createElement("div");l.className="file-list",n.appendChild(l);const c=document.createElement("div");c.className="error-message",n.appendChild(c),t.appendChild(n),this.setupEventListeners()}const e=n.querySelector(".upload-label");if(this.label){if(e.style.display="",e.innerHTML="",e.appendChild(document.createTextNode(this.label)),this.required){const t=document.createElement("span");t.className="required-icon",t.textContent="*",t.setAttribute("aria-hidden","true"),e.appendChild(t)}}else e.style.display="none";const i=n.querySelector(".drop-zone");i.className=this.buildDropZoneClasses(),i.tabIndex=this.disabled?-1:0,i.setAttribute("aria-disabled",this.disabled+""),i.setAttribute("aria-label",this.placeholder||"Upload files");const o=n.querySelector(".file-input");o.multiple=this.multiple,o.accept=this.accept,o.disabled=this.disabled,n.querySelector(".upload-icon").style.display=this.yt.length>0?"none":"",n.querySelector(".upload-hint").innerHTML=this.yt.length>0?`<strong>${this.yt.length} file${1!==this.yt.length?"s":""} selected</strong>`:'Drop files here or <span class="browse-link">click to browse</span>';const r=n.querySelector(".upload-sub-hint");this.accept&&0===this.yt.length?(r.textContent="Accepted: "+this.accept,r.style.display=""):r.style.display="none";const s=n.querySelector(".file-list");this.renderFileList(s);const a=n.querySelector(".error-message");a.textContent=this.error,a.style.display=this.error?"":"none",this.updateValidity()}};Jt.formAssociated=!0,Jt.properties={multiple:{type:"boolean",visual:!0,default:!1},accept:{type:"string",visual:!0,default:""},name:{type:"string",default:""},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},label:{type:"string",visual:!0,default:""},placeholder:{type:"string",visual:!0,default:"Drop files here or click to browse"},error:{type:"string",visual:!0,default:""}};let Gt=Jt;customElements.get("ty-file-upload")||customElements.define("ty-file-upload",Gt);const Qt=`\n${wt}\n:host {\ndisplay: block;\nfont-family: inherit;\nwidth: 100%;\n}\n.textarea-container {\ndisplay: flex;\nflex-direction: column;\nwidth: 100%;\nbox-sizing: border-box;\nposition: relative;\n}\n.textarea-wrapper {\nposition: relative;\nwidth: 100%;\ndisplay: flex;\nflex-direction: column;\nbox-sizing: border-box;\nborder: 1px solid var(--input-border, var(--ty-input-border));\nborder-radius: var(--ty-radius-base);\nbackground: var(--input-bg, var(--ty-input-bg));\ntransition: var(--ty-local-transition, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out);\n}\n.textarea-wrapper:has(textarea:focus) {\nborder-color: var(--input-border-focus, var(--ty-input-border-focus));\nbox-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\n.textarea-wrapper:has(textarea.error) {\nborder-color: var(--ty-color-danger);\nbackground: var(--ty-bg-danger-soft);\n}\n.textarea-wrapper:has(textarea.error):has(textarea:focus) {\nborder-color: var(--ty-color-danger-bold);\n}\n.textarea-wrapper:has(textarea:disabled) {\nopacity: 0.5;\nbackground: var(--input-disabled-bg, var(--ty-input-disabled-bg));\nborder-color: var(--input-disabled-border, var(--ty-input-disabled-border));\n}\n.textarea-scroll {\nposition: relative;\nflex: 1 1 auto;\nmin-height: 0;\ndisplay: flex;\n}\n.textarea-scroll .ty-scrollbar-track-y {\ntop: 2px;\nright: 2px;\nbottom: 2px;\nborder-radius: 0 4px 4px 0;\n}\n.textarea-header,\n.textarea-footer {\ndisplay: flex;\nalign-items: center;\ngap: 0.5rem;\n}\n.textarea-footer { justify-content: space-between; }\n.textarea-header.has-content {\npadding: 6px 10px;\nborder-bottom: 1px solid var(--ty-textarea-divider, var(--input-border, var(--ty-input-border)));\n}\n.textarea-footer.has-content {\npadding: 6px 10px;\nborder-top: 1px solid var(--ty-textarea-divider, var(--input-border, var(--ty-input-border)));\n}\n.ty-field-label {\nfont-size: var(--ty-field-label-font);\nline-height: var(--ty-field-label-leading);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-medium);\ncolor: var(--ty-label-color);\nmargin-bottom: var(--ty-field-label-gap);\npadding-left: var(--ty-field-outer-pad-x);\ndisplay: flex;\nalign-items: center;\n}\n.required-icon {\ndisplay: inline-flex;\nalign-items: center;\ncolor: var(--ty-color-danger);\nwidth: 12px;\nheight: 12px;\nmargin-left: 4px;\nvertical-align: middle;\n}\n.required-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n.error-message {\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\nletter-spacing: var(--ty-tracking-xs);\ncolor: var(--ty-color-danger);\nmargin-top: 4px;\npadding-left: var(--ty-field-outer-pad-x);\n}\ntextarea {\nfont-family: inherit;\nbox-sizing: border-box;\nwidth: 100%;\nflex: 1 1 auto;\nborder: none;\nbackground: transparent;\ncolor: var(--input-color, var(--ty-input-color));\nfont-family: inherit;\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-normal);\noutline: none;\nmin-height: 80px;\npadding: 12px 12px;\noverflow: hidden;\nresize: none;\nwhite-space: pre-wrap;\nword-wrap: break-word;\n}\n:host([data-custom-scroll]) textarea::-webkit-scrollbar {\ndisplay: none;\n}\ntextarea:disabled {\ncursor: not-allowed;\ncolor: var(--input-disabled-color, var(--ty-input-disabled-color));\n}\ntextarea::placeholder {\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\nfont-weight: 400;\n}\ntextarea.resize-both {\nresize: both;\n}\ntextarea.resize-horizontal {\nresize: horizontal;\n}\ntextarea.resize-vertical {\nresize: vertical;\n}\ntextarea.resize-none {\nresize: none;\n}\ntextarea:not(.resize-both):not(.resize-horizontal):not(.resize-vertical) {\nresize: none;\n}\n.textarea-dummy {\nposition: absolute !important;\ntop: 0 !important;\nleft: 0 !important;\nvisibility: hidden !important;\nwhite-space: pre-wrap !important;\nword-break: break-word !important;\nbox-sizing: border-box !important;\noverflow: hidden !important;\npointer-events: none !important;\nz-index: -1 !important;\nword-wrap: break-word !important;\noverflow-wrap: break-word !important;\n}\ntextarea.xs {\nmin-height: 64px;\npadding: 8px var(--ty-field-pad-x);\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\nletter-spacing: var(--ty-tracking-xs);\n}\ntextarea.sm {\nmin-height: 72px;\npadding: 10px var(--ty-field-pad-x);\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\n}\ntextarea.md {\nmin-height: 80px;\npadding: 12px var(--ty-field-pad-x);\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\n}\ntextarea.lg {\nmin-height: 96px;\npadding: 14px var(--ty-field-pad-x);\nfont-size: var(--ty-font-base);\nline-height: var(--ty-leading-base);\nletter-spacing: var(--ty-tracking-base);\n}\ntextarea.xl {\nmin-height: 112px;\npadding: 16px var(--ty-field-pad-x);\nfont-size: var(--ty-font-lg);\nline-height: var(--ty-leading-lg);\nletter-spacing: var(--ty-tracking-lg);\n}\ntextarea:focus-visible {\noutline: none;\n}\n@media (prefers-contrast: high) {\ntextarea {\nborder-width: 2px;\n}\n}\n@media (prefers-reduced-motion: reduce) {\ntextarea {\ntransition: none;\n}\n.textarea-dummy {\ntransition: none;\n}\n}\n@container (max-width: 480px) {\ntextarea.lg {\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\npadding: 12px var(--ty-field-pad-x);\nmin-height: 80px;\n}\ntextarea.xl {\nfont-size: var(--ty-font-base);\nline-height: var(--ty-leading-base);\nletter-spacing: var(--ty-tracking-base);\npadding: 14px var(--ty-field-pad-x);\nmin-height: 96px;\n}\n}\n@container (max-width: 320px) {\ntextarea.xl {\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\npadding: 12px var(--ty-field-pad-x);\nmin-height: 80px;\n}\n}\n@media (max-width: 640px) {\ntextarea.lg {\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\npadding: 12px var(--ty-field-pad-x);\nmin-height: 80px;\n}\ntextarea.xl {\nfont-size: var(--ty-font-base);\nline-height: var(--ty-leading-base);\nletter-spacing: var(--ty-tracking-base);\npadding: 14px var(--ty-field-pad-x);\nmin-height: 96px;\n}\n}\n@media (max-width: 480px) {\ntextarea.xl {\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\npadding: 12px var(--ty-field-pad-x);\nmin-height: 80px;\n}\n}\ntextarea {\ntransition: var(--ty-local-transition,\nborder-color 0.15s ease-in-out,\nbox-shadow 0.15s ease-in-out,\nbackground-color 0.15s ease-in-out,\nheight 0.1s ease-out);\n}\ntextarea:focus {\ntransition: var(--ty-local-transition,\nborder-color 0.15s ease-in-out,\nbox-shadow 0.15s ease-in-out,\nbackground-color 0.15s ease-in-out);\n}\n@media (prefers-reduced-motion: reduce) {\ntextarea {\ntransition: none;\n}\n}\n`;function tn(){return"native"!==document.documentElement.getAttribute("data-ty-scrollbar")}class nn{constructor(t,n={}){this.trackY=null,this.thumbY=null,this.trackX=null,this.thumbX=null,this.ft=!1,this.St="y",this.Tt=0,this._t=0,this.qt=null,this.Lt=null,this.Dt=null,this.At=t,this.Ft=!1!==n.vertical,this.Vt=n.horizontal??!1,this.jt=n.autoHideDelay??1e3,this.It=this.Ot.bind(this),this.Ht=this.Nt.bind(this),this.Wt=this.Bt.bind(this),this.Pt=this.Rt.bind(this),this.Yt=this.Ut.bind(this),this.Zt=this.Xt.bind(this),this.Kt=this.Jt.bind(this),this.Ft&&(this.trackY=this.Gt("y"),this.thumbY=this.Qt("y"),this.trackY.appendChild(this.thumbY)),this.Vt&&(this.trackX=this.Gt("x"),this.thumbX=this.Qt("x"),this.trackX.appendChild(this.thumbX)),this.At.addEventListener("scroll",this.It,{passive:!0}),this.thumbY&&this.thumbY.addEventListener("pointerdown",this.Ht),this.trackY&&this.trackY.addEventListener("pointerdown",this.Pt),this.thumbX&&this.thumbX.addEventListener("pointerdown",this.Wt),this.trackX&&this.trackX.addEventListener("pointerdown",this.Yt),this.Dt=new ResizeObserver(()=>this.update()),this.Dt.observe(this.At),this.update()}Gt(t){const n=document.createElement("div");return n.className="ty-scrollbar-track-"+t,n}Qt(t){const n=document.createElement("div");return n.className="ty-scrollbar-thumb-"+t,n}update(){this.tn(),this.nn()}scrollToTop(t=!1){this.At.scrollTo({top:0,behavior:t?"smooth":"auto"})}scrollToBottom(t=!1){this.At.scrollTo({top:this.At.scrollHeight,behavior:t?"smooth":"auto"})}scrollToLeft(t=!1){this.At.scrollTo({left:0,behavior:t?"smooth":"auto"})}scrollToRight(t=!1){this.At.scrollTo({left:this.At.scrollWidth,behavior:t?"smooth":"auto"})}destroy(){this.At.removeEventListener("scroll",this.It),this.thumbY&&this.thumbY.removeEventListener("pointerdown",this.Ht),this.trackY&&this.trackY.removeEventListener("pointerdown",this.Pt),this.thumbX&&this.thumbX.removeEventListener("pointerdown",this.Wt),this.trackX&&this.trackX.removeEventListener("pointerdown",this.Yt),this.Dt&&(this.Dt.disconnect(),this.Dt=null),null!==this.qt&&(cancelAnimationFrame(this.qt),this.qt=null),null!==this.Lt&&(clearTimeout(this.Lt),this.Lt=null)}Ot(){null===this.qt&&(this.qt=requestAnimationFrame(()=>{this.qt=null,this.en(),this.rn()}))}tn(){if(!this.trackY||!this.thumbY)return;const{scrollHeight:t,clientHeight:n}=this.At,e=t>n+2;this.trackY.classList.toggle("has-overflow",e),e&&(this.thumbY.style.height=Math.max(n/t*100,0)+"%"),this.sn()}nn(){if(!this.trackX||!this.thumbX)return;const{scrollWidth:t,clientWidth:n}=this.At,e=t>n+2;this.trackX.classList.toggle("has-overflow",e),e&&(this.thumbX.style.width=Math.max(n/t*100,0)+"%"),this.an()}en(){this.sn(),this.an()}sn(){if(!this.trackY||!this.thumbY)return;const{scrollTop:t,scrollHeight:n,clientHeight:e}=this.At,i=n-e;i>0&&(this.thumbY.style.top=t/i*(this.trackY.clientHeight-this.thumbY.offsetHeight)+"px")}an(){if(!this.trackX||!this.thumbX)return;const{scrollLeft:t,scrollWidth:n,clientWidth:e}=this.At,i=n-e;i>0&&(this.thumbX.style.left=t/i*(this.trackX.clientWidth-this.thumbX.offsetWidth)+"px")}rn(){this.ft||(this.trackY?.classList.add("scrolling"),this.trackX?.classList.add("scrolling"),null!==this.Lt&&clearTimeout(this.Lt),this.Lt=setTimeout(()=>{this.trackY?.classList.remove("scrolling"),this.trackX?.classList.remove("scrolling"),this.Lt=null},this.jt))}Nt(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this.ft=!0,this.St="y",this.Tt=t.clientY,this._t=this.At.scrollTop,this.thumbY.setPointerCapture(t.pointerId),this.trackY?.classList.add("dragging"),this.thumbY.addEventListener("pointermove",this.Zt),this.thumbY.addEventListener("pointerup",this.Kt),this.thumbY.addEventListener("pointercancel",this.Kt))}Bt(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this.ft=!0,this.St="x",this.Tt=t.clientX,this._t=this.At.scrollLeft,this.thumbX.setPointerCapture(t.pointerId),this.trackX?.classList.add("dragging"),this.thumbX.addEventListener("pointermove",this.Zt),this.thumbX.addEventListener("pointerup",this.Kt),this.thumbX.addEventListener("pointercancel",this.Kt))}Xt(t){if(this.ft)if("y"===this.St){const n=t.clientY-this.Tt,{scrollHeight:e,clientHeight:i}=this.At,o=this.trackY.clientHeight-this.thumbY.offsetHeight;if(0>=o)return;this.At.scrollTop=this._t+n*((e-i)/o)}else{const n=t.clientX-this.Tt,{scrollWidth:e,clientWidth:i}=this.At,o=this.trackX.clientWidth-this.thumbX.offsetWidth;if(0>=o)return;this.At.scrollLeft=this._t+n*((e-i)/o)}}Jt(t){const n="y"===this.St?this.thumbY:this.thumbX,e="y"===this.St?this.trackY:this.trackX;this.ft=!1,n.releasePointerCapture(t.pointerId),e?.classList.remove("dragging"),n.removeEventListener("pointermove",this.Zt),n.removeEventListener("pointerup",this.Kt),n.removeEventListener("pointercancel",this.Kt),this.rn()}Rt(t){if(t.target===this.thumbY||0!==t.button)return;t.preventDefault();const n=this.trackY.getBoundingClientRect(),e=(t.clientY-n.top)/n.height,{scrollHeight:i,clientHeight:o}=this.At;this.At.scrollTo({top:e*(i-o),behavior:"smooth"})}Ut(t){if(t.target===this.thumbX||0!==t.button)return;t.preventDefault();const n=this.trackX.getBoundingClientRect(),e=(t.clientX-n.left)/n.width,{scrollWidth:i,clientWidth:o}=this.At;this.At.scrollTo({left:e*(i-o),behavior:"smooth"})}}const en="\n.ty-scrollbar-track-y {\nposition: absolute;\ntop: 0;\nright: 0;\nbottom: 0;\nwidth: var(--ty-scrollbar-width, 8px);\nz-index: 3;\nopacity: 0;\npointer-events: none;\ntransition: opacity 0.25s ease-out;\ncursor: pointer;\n}\n.ty-scrollbar-track-y.has-overflow {\npointer-events: auto;\n}\n.ty-scrollbar-track-y.has-overflow:hover,\n.ty-scrollbar-track-y.has-overflow.scrolling,\n.ty-scrollbar-track-y.dragging {\nopacity: 1;\n}\n.ty-scrollbar-track-y::before {\ncontent: '';\nposition: absolute;\ninset: 0;\nbackground: var(--ty-scrollbar-track, transparent);\nborder-radius: var(--ty-scrollbar-radius, 4px);\nopacity: 0;\ntransition: opacity 0.15s ease-out;\n}\n.ty-scrollbar-track-y:hover::before,\n.ty-scrollbar-track-y.dragging::before {\nopacity: 1;\nbackground: var(--ty-scrollbar-track-hover, color-mix(in oklab, var(--ty-color-neutral-bold) 8%, transparent));\n}\n.ty-scrollbar-thumb-y {\nposition: absolute;\nright: 0;\nwidth: 100%;\nmin-height: var(--ty-scrollbar-thumb-min-height, 30px);\nbackground: var(--ty-scrollbar-thumb, color-mix(in oklab, var(--ty-color-neutral-bold) 40%, transparent));\nborder-radius: var(--ty-scrollbar-radius, 4px);\ntransition: var(--ty-local-transition, background 0.15s ease-out);\nbox-sizing: border-box;\nborder: 1px solid transparent;\n}\n.ty-scrollbar-thumb-y:hover,\n.ty-scrollbar-track-y.dragging .ty-scrollbar-thumb-y {\nbackground: var(--ty-scrollbar-thumb-hover, color-mix(in oklab, var(--ty-color-neutral-bold) 55%, transparent));\n}\n.ty-scrollbar-thumb-y:active,\n.ty-scrollbar-track-y.dragging .ty-scrollbar-thumb-y {\nbackground: var(--ty-scrollbar-thumb-active, color-mix(in oklab, var(--ty-color-neutral-bold) 70%, transparent));\n}\n.ty-scrollbar-track-x {\nposition: absolute;\nbottom: 0;\nleft: 0;\nright: 0;\nheight: var(--ty-scrollbar-width, 8px);\nz-index: 3;\nopacity: 0;\npointer-events: none;\ntransition: opacity 0.25s ease-out;\ncursor: pointer;\n}\n.ty-scrollbar-track-x.has-overflow {\npointer-events: auto;\n}\n.ty-scrollbar-track-x.has-overflow:hover,\n.ty-scrollbar-track-x.has-overflow.scrolling,\n.ty-scrollbar-track-x.dragging {\nopacity: 1;\n}\n.ty-scrollbar-track-x::before {\ncontent: '';\nposition: absolute;\ninset: 0;\nbackground: var(--ty-scrollbar-track, transparent);\nborder-radius: var(--ty-scrollbar-radius, 4px);\nopacity: 0;\ntransition: opacity 0.15s ease-out;\n}\n.ty-scrollbar-track-x:hover::before,\n.ty-scrollbar-track-x.dragging::before {\nopacity: 1;\nbackground: var(--ty-scrollbar-track-hover, color-mix(in oklab, var(--ty-color-neutral-bold) 8%, transparent));\n}\n.ty-scrollbar-thumb-x {\nposition: absolute;\nbottom: 0;\nheight: 100%;\nmin-width: var(--ty-scrollbar-thumb-min-height, 30px);\nbackground: var(--ty-scrollbar-thumb, color-mix(in oklab, var(--ty-color-neutral-bold) 40%, transparent));\nborder-radius: var(--ty-scrollbar-radius, 4px);\ntransition: var(--ty-local-transition, background 0.15s ease-out);\nbox-sizing: border-box;\nborder: 1px solid transparent;\n}\n.ty-scrollbar-thumb-x:hover,\n.ty-scrollbar-track-x.dragging .ty-scrollbar-thumb-x {\nbackground: var(--ty-scrollbar-thumb-hover, color-mix(in oklab, var(--ty-color-neutral-bold) 55%, transparent));\n}\n.ty-scrollbar-thumb-x:active,\n.ty-scrollbar-track-x.dragging .ty-scrollbar-thumb-x {\nbackground: var(--ty-scrollbar-thumb-active, color-mix(in oklab, var(--ty-color-neutral-bold) 70%, transparent));\n}\n@media (pointer: coarse) and (hover: none) {\n.ty-scrollbar-track-y,\n.ty-scrollbar-track-x {\ndisplay: none !important;\n}\n}\n@media (prefers-reduced-motion: reduce) {\n.ty-scrollbar-track-y,\n.ty-scrollbar-track-x,\n.ty-scrollbar-thumb-y,\n.ty-scrollbar-thumb-x {\ntransition-duration: 0ms !important;\n}\n}\n",on=class extends T{constructor(){super(),this.ln=null,this.cn=null,this.dn=null,this.J=!1,this.handleInputEvent=t=>{this.m=!0,this.value=t.target.value,this.ln&&this.cn&&this.resizeTextarea(this.ln,this.cn),this.C.setFormValue(this.value||""),this.updateValidity(),this.emitValueEvent("input",t)},this.hn=null,this.handleFocusEvent=()=>{this.J=!0,this.hn=this.value},this.handleBlurEvent=t=>{this.J=!1,this.m&&this.revealValidity(),null!==this.hn&&this.value!==this.hn&&this.emitValueEvent("change",t),this.hn=null};const t=this.shadowRoot;q(t,{css:Qt,id:"ty-textarea"}),tn()&&q(t,{css:en,id:"ty-custom-scrollbar"})}onConnect(){}onDisconnect(){if(this.un(),this.ln){const t=this.ln.cloneNode(!0);this.ln.parentNode?.replaceChild(t,this.ln),this.ln=null}this.cn=null}onPropertiesChanged(t){}getFormValue(){return this.getProperty("value")||null}get value(){return this.getProperty("value")}set value(t){this.setProperty("value",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get placeholder(){return this.getProperty("placeholder")}set placeholder(t){this.setProperty("placeholder",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}focus(t){this.shadowRoot?.querySelector("textarea")?.focus(t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get minLength(){return w(this.getProperty("minlength"))??-1}set minLength(t){this.setProperty("minlength",null==t||0>t?"":t+"")}get maxLength(){return w(this.getProperty("maxlength"))??-1}set maxLength(t){this.setProperty("maxlength",null==t||0>t?"":t+"")}get tooShortMessage(){return this.getProperty("tooShortMessage")}set tooShortMessage(t){this.setProperty("tooShortMessage",t??"")}get tooLongMessage(){return this.getProperty("tooLongMessage")}set tooLongMessage(t){this.setProperty("tooLongMessage",t??"")}get error(){return this.getProperty("error")}set error(t){this.setProperty("error",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get rows(){return this.getProperty("rows")}set rows(t){this.setProperty("rows",t)}get cols(){return this.getProperty("cols")}set cols(t){this.setProperty("cols",t)}get resize(){return this.getProperty("resize")}set resize(t){this.setProperty("resize",t)}get minHeight(){return this.getProperty("minHeight")}set minHeight(t){this.setProperty("minHeight",t)}get maxHeight(){return this.getProperty("maxHeight")}set maxHeight(t){this.setProperty("maxHeight",t)}getFontStyle(t){const n=window.getComputedStyle(t);return{fontFamily:n.fontFamily,fontSize:n.fontSize,fontWeight:n.fontWeight,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,fontStyle:n.fontStyle}}getSpacingStyle(t){const n=window.getComputedStyle(t);return{padding:n.padding,paddingTop:n.paddingTop,paddingRight:n.paddingRight,paddingBottom:n.paddingBottom,paddingLeft:n.paddingLeft,margin:n.margin,borderWidth:n.borderWidth}}setupDummyElement(t){const n=this.shadowRoot,e=n.querySelector(".textarea-dummy");e&&e.remove();const i=document.createElement("pre"),o=this.getFontStyle(t),r=this.getSpacingStyle(t);i.className="textarea-dummy";const s=i.style;return s.position="absolute",s.top="0",s.left="0",s.visibility="hidden",s.whiteSpace="pre-wrap",s.wordBreak="break-word",s.boxSizing="border-box",s.overflow="hidden",s.pointerEvents="none",Object.entries(o).forEach(([t,n])=>{s[t]=n}),Object.entries(r).forEach(([t,n])=>{s[t]=n}),n.appendChild(i),this.cn=i,i}resizeTextarea(t,n){if(!t||!n)return;const e=this.value,i=this.placeholder,o=t.clientHeight;n.textContent=""===e&&i?i:e+" ",n.style.width=t.clientWidth+"px";const r=n.scrollHeight,s=this.minHeight?parseInt(this.minHeight.replace("px",""),10):null,a=this.maxHeight?parseInt(this.maxHeight.replace("px",""),10):null;let l=r;null!==s&&(l=Math.max(l,s)),null!==a&&(l=Math.min(l,a)),Math.abs(l-o)>2&&(t.style.height=l+"px",null===a||a>r?(t.style.overflowY="hidden",this.un()):(t.style.overflowY="auto",this.pn(t))),this.dn?.update()}pn(t){if(this.dn||!tn())return;t.style.scrollbarWidth="none",this.setAttribute("data-custom-scroll",""),this.dn=new nn(t,{vertical:!0,horizontal:!1});const n=this.shadowRoot.querySelector(".textarea-scroll");n&&this.dn.trackY&&n.appendChild(this.dn.trackY)}un(){this.dn&&(this.dn.trackY?.remove(),this.dn.destroy(),this.dn=null,this.removeAttribute("data-custom-scroll"),this.ln&&(this.ln.style.scrollbarWidth=""))}emitValueEvent(t,n){const e={bubbles:!0,composed:!0,detail:{value:this.value,originalEvent:n}};setTimeout(()=>this.dispatchEvent(new CustomEvent(t,e)),0)}buildClassList(){const t=[this.size];this.disabled&&t.push("disabled"),this.required&&t.push("required"),this.error&&t.push("error"),"none"!==this.resize&&t.push("resize-"+this.resize);const n=this.getAttribute("class");return n&&t.push(n),t.join(" ")}applyHeightConstraints(t){this.minHeight&&(t.style.minHeight=this.minHeight),this.maxHeight&&(t.style.maxHeight=this.maxHeight)}setupTextareaEvents(t){t.addEventListener("input",this.handleInputEvent),t.addEventListener("focus",this.handleFocusEvent),t.addEventListener("blur",this.handleBlurEvent)}render(){const t=this.shadowRoot,n=t.querySelector(".textarea-container"),e=t.querySelector("label"),i=t.querySelector("textarea"),o=t.querySelector(".error-message");if(n&&i){if(this.label?e&&(e.innerHTML=`${this.label}${this.required?`<span class="required-icon">${Mt}</span>`:""}`,e.style.display="flex"):e&&(e.style.display="none"),i.value!==(this.value||"")&&(i.value=this.value||""),i.placeholder=this.placeholder||"",i.disabled=this.disabled,i.required=this.required,this.syncConstraintAttributes(i),i.className=this.buildClassList(),this.label?i.setAttribute("aria-label",this.label):i.removeAttribute("aria-label"),this.name?i.setAttribute("name",this.name):i.removeAttribute("name"),this.rows&&i.setAttribute("rows",this.rows),this.cols&&i.setAttribute("cols",this.cols),this.applyHeightConstraints(i),this.error){if(!o){const t=document.createElement("div");t.className="error-message",n.appendChild(t)}const e=t.querySelector(".error-message");e&&(e.textContent=this.error)}else o&&o.remove();const r=this.setupDummyElement(i);setTimeout(()=>this.resizeTextarea(i,r),0),this.ln=i}else{const n=document.createElement("div");n.className="textarea-container";const e=document.createElement("label");e.className="ty-field-label",this.label?(e.innerHTML=`${this.label}${this.required?`<span class="required-icon">${Mt}</span>`:""}`,e.style.display="flex"):e.style.display="none";const i=document.createElement("textarea");i.value=this.value||"",i.placeholder=this.placeholder||"",i.disabled=this.disabled,i.required=this.required,this.syncConstraintAttributes(i),i.className=this.buildClassList(),this.label&&i.setAttribute("aria-label",this.label),this.name&&i.setAttribute("name",this.name),i.setAttribute("rows",this.rows||"3"),this.cols&&i.setAttribute("cols",this.cols),this.applyHeightConstraints(i),this.setupTextareaEvents(i);const o=document.createElement("div");o.className="textarea-wrapper";const r=document.createElement("div");r.className="textarea-header";const s=document.createElement("slot");s.setAttribute("name","header"),r.appendChild(s);const a=document.createElement("div");a.className="textarea-scroll",a.appendChild(i);const l=document.createElement("div");l.className="textarea-footer";const c=document.createElement("slot");c.setAttribute("name","footer"),l.appendChild(c),o.appendChild(r),o.appendChild(a),o.appendChild(l);const d=(t,n)=>{const e=()=>n.classList.toggle("has-content",t.assignedNodes({flatten:!0}).length>0);t.addEventListener("slotchange",e),e()};if(d(s,r),d(c,l),n.appendChild(e),n.appendChild(o),this.error){const t=document.createElement("div");t.className="error-message",t.textContent=this.error,n.appendChild(t)}t.appendChild(n);const h=this.setupDummyElement(i);setTimeout(()=>this.resizeTextarea(i,h),0),this.ln=i}this.updateValidity()}syncConstraintAttributes(t){const n=(n,e)=>null!==e?t.setAttribute(n,e+""):t.removeAttribute(n);n("minlength",w(this.getProperty("minlength"))),n("maxlength",w(this.getProperty("maxlength")))}updateValidity(){const t=this.shadowRoot?.querySelector("textarea");if(this.disabled)return void this.applyValidity({});const n=t?t.value:(this.value??"")+"";if(""===n.trim())return void(this.required?this.applyValidity({valueMissing:!0},f("textarea",{required:!0}),t??void 0):this.applyValidity({}));const{tooShort:e,tooLong:i}=k(n,{minlength:this.getProperty("minlength"),maxlength:this.getProperty("maxlength"),tooShortMessage:this.tooShortMessage,tooLongMessage:this.tooLongMessage},t);this.applyValidity({tooShort:!!e,tooLong:!!i},e??i,t??void 0)}};on.formAssociated=!0,on.properties={value:{type:"string",visual:!0,formValue:!0,emitChange:!0,default:""},name:{type:"string",default:""},placeholder:{type:"string",visual:!0,default:""},label:{type:"string",visual:!0,default:""},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},minlength:{type:"string",visual:!0,default:""},maxlength:{type:"string",visual:!0,default:""},tooShortMessage:{type:"string",visual:!0,default:""},tooLongMessage:{type:"string",visual:!0,default:""},error:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},rows:{type:"string",visual:!0,default:"3",coerce:t=>t+""},cols:{type:"string",visual:!0,default:"",coerce:t=>t?t+"":""},resize:{type:"string",visual:!0,default:"none",validate:t=>["none","both","horizontal","vertical"].includes(t),coerce:t=>["none","both","horizontal","vertical"].includes(t)?t:"none"},minHeight:{type:"string",visual:!0,default:""},maxHeight:{type:"string",visual:!0,default:""}};let rn=on;customElements.get("ty-textarea")||customElements.define("ty-textarea",rn);const sn={"top-start":{vertical:"top",horizontal:"start"},top:{vertical:"top",horizontal:"center"},"top-end":{vertical:"top",horizontal:"end"},"right-start":{vertical:"start",horizontal:"end",orientation:"vertical"},right:{vertical:"center",horizontal:"end",orientation:"vertical"},"right-end":{vertical:"end",horizontal:"end",orientation:"vertical"},"bottom-start":{vertical:"bottom",horizontal:"start"},bottom:{vertical:"bottom",horizontal:"center"},"bottom-end":{vertical:"bottom",horizontal:"end"},"left-start":{vertical:"start",horizontal:"start",orientation:"vertical"},left:{vertical:"center",horizontal:"start",orientation:"vertical"},"left-end":{vertical:"end",horizontal:"start",orientation:"vertical"}},an={default:["bottom-start","bottom-end","top-start","top-end","bottom","top","left","right"]},ln={top:"bottom",bottom:"top",left:"right",right:"left"};function cn(t){const[n,e]=t.split("-");return{side:n,align:e}}function dn(t){const{side:n,align:e}=cn(t),i=ln[n],o="top"===n||"bottom"===n?["right","left"]:["bottom","top"],r=t=>e?`${t}-${e}`:t,s=t=>e?[t,`${t}-${"start"===e?"end":"start"}`]:[t+"-start",t+"-end"];return[r(n),r(i),...s(n),...s(i),...o.flatMap(t=>[r(t),...s(t)])]}function hn(t){if(!t)return{side:"auto",align:"start"};const{side:n,align:e}=cn(t);return{side:"top"===n||"bottom"===n?n:"auto",align:e??"start"}}function un(t){const n=t.getBoundingClientRect();return{top:n.top,left:n.left,right:n.right,bottom:n.bottom,width:n.width,height:n.height,centerX:n.left+n.width/2,centerY:n.top+n.height/2}}function pn(t){const{targetEl:n,floatingEl:e,preferences:i=an.default,offset:o=8,padding:r=8,containerPadding:s=0}=t,a=un(n),l=un(e),c=i.map(t=>function(t){const{targetRect:n,floatingRect:e,placement:i,offset:o,padding:r,scrollbarWidth:s,containerPadding:a}=t,l=sn[i],{vertical:c,horizontal:d,orientation:h}=l,u=window.innerWidth,p=window.innerHeight;let b,g;window,window,b="vertical"===h?"start"===d?n.left-e.width-o+a:n.right+o-a:"start"===d?n.left-a:"center"===d?n.centerX-e.width/2:n.right-e.width+a,g="vertical"===h?"center"===c?n.centerY-e.height/2:"end"===c?n.bottom-e.height+a:n.top-a:"top"===c?n.top-e.height-o+a:n.bottom+o-a;const v={top:Math.min(0,g-r),left:Math.min(0,b-r),bottom:Math.min(0,p-(g+e.height+r)),right:Math.min(0,u-(b+e.width+r+s))},m=Object.values(v).reduce((t,n)=>t+Math.abs(n),0);return{x:Math.round(b),y:Math.round(g),placement:i,overflow:v,overflowAmount:m,fits:0===m}}({targetRect:a,floatingRect:l,placement:t,offset:o,padding:r,containerPadding:s,scrollbarWidth:15})),d=c.find(t=>t.fits)||c.reduce((t,n)=>t.overflowAmount>n.overflowAmount?n:t);return 0>d.overflow.right&&(d.x+=d.overflow.right),d}function bn(t){const n=t.gap??4,e=t.padding??8,i=window.innerWidth,o=window.innerHeight,r=o-t.anchorRect.bottom,s=t.anchorRect.top,a=t.popupHeight+n+e,l=r>=a,c=s>=a,d=t.side??"auto",h="bottom"===d?!(!l&&c):"top"===d?!(c||!l):l||r>=s;return{x:Math.max(e,Math.min("end"===t.align?t.anchorRect.right-t.popupWidth:"center"===t.align?t.anchorRect.left+(t.anchorRect.width-t.popupWidth)/2:t.anchorRect.left,i-t.popupWidth-e)),topY:t.anchorRect.bottom+n,bottomY:o-t.anchorRect.top+n,below:h}}const gn={id:"ty-tooltip",css:"\n:host {\ndisplay: contents;\n}\n"},vn=new WeakMap,mn=new WeakMap,yn=new WeakMap,fn=new WeakMap,wn=new WeakMap;function xn(t){const n=t||"neutral",e=n.replace(/[+-]$/,"");return/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?n:"neutral"}function kn(t){let n=yn.get(t);return n||(n={showTimeout:null,hideTimeout:null},yn.set(t,n)),n}function zn(t,n){return t.hasAttribute(n)}function $n(t,n,e){const i=t.getAttribute(n);if(null===i)return e;const o=parseInt(i,10);return isNaN(o)?e:o}function Cn(t){return{placement:t.getAttribute("placement")||"top",offset:$n(t,"offset",8),delay:$n(t,"delay",600),disabled:zn(t,"disabled"),flavor:xn(t.getAttribute("flavor"))}}function Mn(t){return t.parentElement}function En(t){!function(){if(document.getElementById("ty-tooltip-motion"))return;const t=document.createElement("style");t.id="ty-tooltip-motion",t.textContent='\n.ty-tooltip-popover:popover-open {\ntransition:\nopacity var(--ty-tooltip-duration, 120ms) ease-out,\ntranslate var(--ty-tooltip-duration, 120ms) ease-out;\n}\n@starting-style {\n.ty-tooltip-popover:popover-open { opacity: 0; translate: 0 4px; }\n.ty-tooltip-popover:popover-open[data-side="bottom"] { translate: 0 -4px; }\n.ty-tooltip-popover:popover-open[data-side="left"] { translate: 4px 0; }\n.ty-tooltip-popover:popover-open[data-side="right"] { translate: -4px 0; }\n}\n',document.head.appendChild(t)}();let n=fn.get(t);if(!n){n=document.createElement("div"),n.id="ty-tooltip-"+Math.random().toString(36).slice(2,11),n.setAttribute("popover","manual"),n.setAttribute("role","tooltip"),n.className="ty-tooltip-popover",n.style.cssText="\nposition: fixed;\nmargin: 0;\npadding: 8px 12px;\nbackground: var(--ty-tooltip-bg, #262626);\ncolor: var(--ty-tooltip-color, #f5f5f5);\nborder: none;\nborder-radius: 6px;\nfont-size: var(--ty-font-xs, 12px);\nfont-weight: var(--ty-font-semibold, 600);\nline-height: 1.5;\nmax-width: 250px;\ntext-align: center;\nbox-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\nuser-select: none;\npointer-events: none;\n",document.body.appendChild(n),fn.set(t,n);const e=wn.get(t);e&&function(t,n){const e=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);e.includes(n)||(e.push(n),t.setAttribute("aria-describedby",e.join(" ")))}(e,n.id)}const{flavor:e}=Cn(t);return n.setAttribute("data-flavor",e),n.innerHTML=t.innerHTML,Sn(n,e),n}function Sn(t,n){t.style.removeProperty("background"),t.style.removeProperty("color"),t.style.removeProperty("border-color");const e=n.replace(/[+-]$/,""),i=n.slice(e.length);if(("neutral"===e||"dark"===e)&&""===i)return t.style.background="var(--ty-tooltip-bg, #262626)",t.style.color="var(--ty-tooltip-color, #f5f5f5)",void(t.style.borderColor="var(--ty-tooltip-border, #404040)");const o="dark"===e?"neutral":e,r="+"===i?"-strong":"-"===i?"-soft":"";t.style.background=`var(--ty-solid-${o}${r}, var(--ty-tooltip-bg, #262626))`,t.style.color=`var(--ty-solid-${o}${r}-fg, var(--ty-solid-${o}-fg, var(--ty-tooltip-color, #f5f5f5)))`,t.style.borderColor="transparent"}function Tn(t){const{placement:n,offset:e}=Cn(t),i=Mn(t),o=fn.get(t);if(!i||!o)return;const r=pn({targetEl:i,floatingEl:o,preferences:dn(n),offset:e});o.style.left=r.x+"px",o.style.top=r.y+"px",o.dataset.side=r.placement.split("-")[0]}function _n(t){const n=vn.get(t);n&&(n(),vn.delete(t))}function qn(t){const n=kn(t);null!==n.showTimeout&&(clearTimeout(n.showTimeout),n.showTimeout=null),null!==n.hideTimeout&&(clearTimeout(n.hideTimeout),n.hideTimeout=null)}const Ln=new WeakMap;function Dn(t){const n=Ln.get(t);n&&(document.removeEventListener("keydown",n,!0),Ln.delete(t))}function An(t){Dn(t);const n=fn.get(t);if(n)try{n.hidePopover(),t.bn=!1,_n(t)}catch(e){}}function Fn(t){const n=kn(t),{delay:e}=Cn(t);qn(t),n.showTimeout=window.setTimeout(()=>function(t){const{disabled:n}=Cn(t);if(n)return;const e=En(t);try{e.showPopover(),t.bn=!0,Tn(t),function(t){const n=Mn(t),e=fn.get(t);if(!n||!e)return;let i=null;const o=()=>{null!==i&&clearTimeout(i),i=window.setTimeout(()=>{i=null,Tn(t)},10)},r=new ResizeObserver(o);r.observe(n),r.observe(e);let s=null;const a=()=>{null===s&&(s=requestAnimationFrame(()=>{s=null,Tn(t)}))};window.addEventListener("scroll",a,!0),window.addEventListener("resize",o),vn.set(t,()=>{r.disconnect(),window.removeEventListener("scroll",a,!0),window.removeEventListener("resize",o),null!==i&&clearTimeout(i),null!==s&&cancelAnimationFrame(s)})}(t),function(t){if(Ln.has(t))return;const n=n=>{"Escape"===n.key&&(qn(t),An(t))};Ln.set(t,n),document.addEventListener("keydown",n,!0)}(t)}catch(i){}}(t),e)}function Vn(t){const n=kn(t);qn(t),n.hideTimeout=window.setTimeout(()=>An(t),200)}class TyTooltip extends HTMLElement{constructor(){super(),this.bn=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["placement","offset","delay","disabled","flavor"]}connectedCallback(){this.bn=!1,q(this.shadowRoot,gn),function(t){const n=Mn(t);if(!n)return;wn.set(t,n);const e=()=>Fn(t),i=()=>Vn(t),o=()=>Fn(t),r=()=>Vn(t);n.addEventListener("mouseenter",e),n.addEventListener("mouseleave",i),n.addEventListener("focusin",o),n.addEventListener("focusout",r),mn.set(t,()=>{n.removeEventListener("mouseenter",e),n.removeEventListener("mouseleave",i),n.removeEventListener("focusin",o),n.removeEventListener("focusout",r)})}(this),En(this)}disconnectedCallback(){!function(t){qn(t),_n(t),Dn(t);const n=mn.get(t);n&&(n(),mn.delete(t));const e=fn.get(t),i=wn.get(t);e&&i&&function(t,n){const e=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(t=>t&&t!==n);e.length>0?t.setAttribute("aria-describedby",e.join(" ")):t.removeAttribute("aria-describedby")}(i,e.id),e&&(e.remove(),fn.delete(t)),wn.delete(t),yn.delete(t)}(this)}attributeChangedCallback(t,n,e){if("flavor"===t){const t=fn.get(this);t&&Sn(t,xn(e))}"disabled"===t&&null!==e&&An(this)}}customElements.get("ty-tooltip")||customElements.define("ty-tooltip",TyTooltip);const jn={locked:!1,scrollY:0,activeLocks:new Set};function In(){return document.documentElement}function On(){if(!jn.locked)return;const t=In();window,t.classList.remove("ty-scroll-locked"),t.style.overflow="",t.style.paddingRight="",jn.locked=!1}function Hn(t){jn.activeLocks.has(t)||(jn.activeLocks.add(t),1===jn.activeLocks.size&&function(){if(jn.locked)return;const t=window.innerWidth-In().clientWidth,n=In();window,jn.scrollY=window.scrollY||In().scrollTop||0,jn.locked=!0,n.style.overflow="hidden",t>0&&(n.style.paddingRight=t+"px"),n.classList.add("ty-scroll-locked")}())}function Nn(t){jn.activeLocks.has(t)&&(jn.activeLocks.delete(t),0===jn.activeLocks.size&&On())}const Wn=new WeakMap,Bn=new WeakMap,Pn=new WeakMap,Rn=new WeakMap,Yn=new WeakMap,Un=new WeakMap,Zn=new WeakMap,Xn=new WeakSet;function Kn(t,n){return t.hasAttribute(n)}function Jn(t,n,e){const i=t.getAttribute(n);if(null===i)return e;const o=parseInt(i,10);return isNaN(o)?e:o}function Gn(t){return{manual:Kn(t,"manual"),disableClose:Kn(t,"disable-close"),placement:t.getAttribute("placement")||"bottom",offset:Jn(t,"offset",8)}}function Qn(t){return t.parentElement}function te(t){return t.querySelector(".popup-dialog")}function ne(t){let n=Zn.get(t);return n||(n="popup-"+(t.id||Math.random().toString(36).substr(2,9)),Zn.set(t,n)),n}function ee(t,n=!1){const{disableClose:e}=Gn(t);if(!n&&e)return;const i=t.shadowRoot,o=i?te(i):null;if(!o)return;o.classList.remove("open"),o.classList.remove("preparing-animation");const r=Qn(t);r?.hasAttribute("aria-haspopup")&&r.setAttribute("aria-expanded","false");const s=Math.max(0,...getComputedStyle(o).transitionDuration.split(",").map(t=>parseFloat(t)*(t.trim().endsWith("ms")?1:1e3)));clearTimeout(Rn.get(t)),Rn.set(t,setTimeout(()=>{Rn.delete(t),o.classList.remove("position-calculated"),o.close()},s+20))}function ie(t){const n=t.shadowRoot,e=n?te(n):null;if(!e)return;const i=Qn(t);if(e.open){const n=Rn.get(t);return void(void 0!==n&&(clearTimeout(n),Rn.delete(t),e.classList.add("open"),i?.hasAttribute("aria-haspopup")&&i.setAttribute("aria-expanded","true")))}Hn(ne(t)),e.showModal(),i?.hasAttribute("aria-haspopup")&&i.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>{!function(t){const{placement:n,offset:e}=Gn(t),i=t.shadowRoot,o=Qn(t),r=i?te(i):null;if(!o||!r)return;const s=pn({targetEl:o,floatingEl:r,preferences:dn(n),offset:e,padding:8,containerPadding:16});t.style.setProperty("--popup-x",s.x+"px"),t.style.setProperty("--popup-y",s.y+"px"),r.dataset.side=s.placement.split("-")[0],r.classList.add("position-calculated")}(t),e.classList.add("preparing-animation"),requestAnimationFrame(()=>{e.classList.add("open"),t.dispatchEvent(new CustomEvent("open"))})})}function oe(t){const n=t.shadowRoot,e=n?te(n):null;e&&(e.classList.contains("open")?ee(t):ie(t))}function re(t,n){n.preventDefault(),n.stopPropagation(),oe(t)}function se(t){const{manual:n}=Gn(t),e=Qn(t);if(!e||n)return;e.setAttribute("aria-haspopup","dialog"),e.hasAttribute("aria-expanded")||e.setAttribute("aria-expanded","false");const i=Wn.get(t);i&&e.removeEventListener("pointerdown",i);const o=Bn.get(t);o&&e.removeEventListener("click",o);const r=n=>{Xn.add(t),re(t,n)};Wn.set(t,r),e.addEventListener("pointerdown",r);const s=n=>{if(Xn.delete(t))return;const e=n.detail,i="number"==typeof e?n:e?.originalEvent??n;0===i.detail&&(i.composedPath().includes(t)||re(t,n))};Bn.set(t,s),e.addEventListener("click",s)}function ae(t){const n=Qn(t),e=Wn.get(t);n&&e&&(n.removeEventListener("pointerdown",e),Wn.delete(t));const i=Bn.get(t);n&&i&&(n.removeEventListener("click",i),Bn.delete(t)),n?.removeAttribute("aria-haspopup"),n?.removeAttribute("aria-expanded")}function le(t){const n=t.shadowRoot;if(!n)return;const e=te(n);if(q(n,{css:'\n.popup-dialog {\nposition: fixed;\ntop: 0;\nleft: 0;\nmargin: 0;\nborder: none;\nbackground: transparent;\nmax-width: none;\nmax-height: none;\npadding: var(--popup-padding, 16px);\nvisibility: hidden;\nopacity: 0;\ntransition:\nopacity var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\nvisibility var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\ntransform var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1));\npointer-events: none;\n}\n.popup-dialog.position-calculated {\ntop: var(--popup-y, 0px);\nleft: var(--popup-x, 0px);\n}\n.popup-dialog.preparing-animation {\ntransform: scale(var(--ty-popup-scale, 0.96));\n}\n.popup-dialog.preparing-animation:not(.open) {\ntransition: none;\n}\n.popup-dialog[data-side="bottom"].preparing-animation:not(.open) {\ntransform: translateY(-6px) scale(var(--ty-popup-scale, 0.96));\n}\n.popup-dialog[data-side="top"].preparing-animation:not(.open) {\ntransform: translateY(6px) scale(var(--ty-popup-scale, 0.96));\n}\n.popup-dialog[data-side="left"].preparing-animation:not(.open) {\ntransform: translateX(6px) scale(var(--ty-popup-scale, 0.96));\n}\n.popup-dialog[data-side="right"].preparing-animation:not(.open) {\ntransform: translateX(-6px) scale(var(--ty-popup-scale, 0.96));\n}\n.popup-dialog.open {\nvisibility: visible;\nopacity: 1;\ntransform: scale(1);\npointer-events: auto;\n}\n.popup-dialog::backdrop {\nbackground: transparent;\n}\n.popup-container {\ndisplay: contents;\n}\n#popup-content {\ndisplay: contents;\n}\n#popup-content ::slotted(*) {\nposition: relative;\nmax-width: min(400px, 90vw);\nmax-height: min(500px, 80vh);\noverflow: auto;\n}\n',id:"ty-popup"}),!e){const e=document.createElement("dialog"),i=document.createElement("div"),o=document.createElement("slot");e.className="popup-dialog",i.className="popup-container",o.id="popup-content",n.appendChild(e),e.appendChild(i),i.appendChild(o),t.style.setProperty("--popup-x","0px"),t.style.setProperty("--popup-y","0px");const r=n=>function(t,n){n.stopPropagation();const e=t.shadowRoot,i=e?te(e):null;i&&n.target===i&&(n.preventDefault(),ee(t))}(t,n);Pn.set(t,r),e.addEventListener("pointerdown",r);const s=n=>function(t,n){if(!function(t,n){const e=t.shadowRoot?te(t.shadowRoot):null;for(const i of n.composedPath()){if(i===e)return!1;if(i instanceof HTMLDialogElement&&i.matches(":modal"))return!0}return!1}(t,n)&&(n.stopPropagation(),"Escape"===n.key)){const{disableClose:e}=Gn(t);e?n.preventDefault():ee(t)}}(t,n);Yn.set(t,s),t.addEventListener("keydown",s),new MutationObserver(()=>{if(e.open)return;clearTimeout(Rn.get(t)),Rn.delete(t),Xn.delete(t),Nn(ne(t)),e.classList.remove("open"),e.classList.remove("preparing-animation");const n=Qn(t);n?.hasAttribute("aria-haspopup")&&n.setAttribute("aria-expanded","false")}).observe(e,{attributes:!0,attributeFilter:["open"]}),e.addEventListener("close",()=>{t.dispatchEvent(new CustomEvent("close"))})}t.closePopup=()=>ee(t,!0),t.openPopup=()=>ie(t),t.togglePopup=()=>oe(t);const i=Un.get(t);i&&t.removeEventListener("ty:close-popup",i);const o=n=>function(t,n){n.stopPropagation(),ee(t,!0)}(t,n);Un.set(t,o),t.addEventListener("ty:close-popup",o),se(t)}class TyPopup extends HTMLElement{static get observedAttributes(){return["manual","disable-close","placement","offset"]}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){le(this)}disconnectedCallback(){!function(t){const n=Zn.get(t);n&&(Nn(n),Zn.delete(t)),ae(t);const e=t.shadowRoot,i=e?te(e):null;if(i){const n=Pn.get(t);n&&(i.removeEventListener("pointerdown",n),Pn.delete(t))}const o=Yn.get(t);o&&(t.removeEventListener("keydown",o),Yn.delete(t));const r=Un.get(t);r&&(t.removeEventListener("ty:close-popup",r),Un.delete(t))}(this)}attributeChangedCallback(t,n,e){switch(le(this),t){case"placement":case"offset":le(this);break;case"manual":case"disable-close":ae(this),se(this)}}}customElements.get("ty-popup")||customElements.define("ty-popup",TyPopup);const ce=new WeakMap,de=new WeakMap,he=new WeakMap,ue=new WeakMap,pe=new WeakMap,be=new WeakMap,ge=new WeakMap;function ve(t,n){if(!t.hasAttribute(n))return!1;const e=t.getAttribute(n);return null===e||"false"!==e.toLowerCase()}function me(t){return{open:ve(t,"open"),backdrop:!ve(t,"no-backdrop"),closeOnOutsideClick:!ve(t,"prevent-outside-click"),closeOnEscape:!ve(t,"prevent-escape")}}function ye(t){return t.querySelector(".ty-modal-dialog")}function fe(t,n,e){const i=new CustomEvent(n,{detail:e,cancelable:!0});t.dispatchEvent(i)}function we(t,n="programmatic",e){const i=t.shadowRoot,o=i?ye(i):null;if(o&&o.open){if(!e?.force){const e=new CustomEvent("beforeclose",{detail:{reason:n},cancelable:!0});if(t.dispatchEvent(e),e.defaultPrevented)return}ge.set(t,n),t.removeAttribute("open")}}function xe(t,n){for(const e of n.composedPath()){if(e===t)return!1;if(e instanceof HTMLDialogElement&&e.matches(":modal"))return!0}return!1}function ke(t,n=new WeakSet){const e=t=>{if(!n.has(t)&&(n.add(t),t instanceof TyModal&&t.open&&t.removeAttribute("open"),t instanceof HTMLDialogElement&&t.matches(":modal")&&t.close(),t.shadowRoot&&ke(t.shadowRoot,n),t instanceof HTMLSlotElement))for(const i of t.assignedElements({flatten:!0}))e(i),ke(i,n)};t.querySelectorAll("*").forEach(e)}function ze(t){const n=t.shadowRoot;if(!n)return;const e=me(t),i=function(t){let n=ye(t);if(!n){n=document.createElement("dialog");const e=document.createElement("button"),i=document.createElement("div"),o=document.createElement("slot");n.className="ty-modal-dialog",e.className="close-button",e.type="button",e.setAttribute("aria-label","Close modal"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x-icon lucide-x"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',i.className="modal-content",i.appendChild(o),n.appendChild(e),n.appendChild(i),t.appendChild(n)}return n}(n),o=function(t){let n=be.get(t);return n||(n="modal-"+(t.id||Math.random().toString(36).slice(2,11)),be.set(t,n)),n}(t);q(n,{css:"\n:host {\ndisplay: contents;\n}\n.close-button {\nposition: absolute;\ntop: -8px;\nright: -8px;\nbackground: transparent;\nborder: none;\ncursor: pointer;\npadding: 4px;\nborder-radius: 4px;\ntransition: var(--ty-transition-colors);\nz-index: 1;\ncolor: #d8d8d8;\noutline: none;\nbox-shadow: none;\n-webkit-appearance: none;\n-moz-appearance: none;\nappearance: none;\n-webkit-tap-highlight-color: transparent;\n-webkit-touch-callout: none;\n-webkit-user-select: none;\n-moz-user-select: none;\n-ms-user-select: none;\nuser-select: none;\n}\n.close-button:hover {\ncolor: white;\n}\n.close-button:focus,\n.close-button:focus-visible,\n.close-button:focus-within,\n.close-button:active {\noutline: none !important;\nbox-shadow: none !important;\nborder: none !important;\nbackground: transparent !important;\n}\n.close-button:hover,\n.close-button:focus:hover,\n.close-button:active:hover {\ncolor: white;\n}\n.close-button.hide {\nvisibility: hidden;\n}\n.ty-modal-dialog {\npadding: 18px;\nborder: none;\nmargin: 0;\nbackground: transparent;\nposition: fixed;\ntop: 50%;\nleft: 50%;\ntransform: translate(-50%, -50%);\nz-index: 1000;\noverflow: hidden;\nmax-width: 85vw;\nmax-height: 90vh;\noutline: none;\n}\n.ty-modal-dialog[open] {\nanimation: ty-modal-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n@keyframes ty-modal-enter {\nfrom {\nopacity: 0;\ntransform: translate(-50%, -50%) scale(0.93);\n}\nto {\nopacity: 1;\ntransform: translate(-50%, -50%) scale(1);\n}\n}\n.ty-modal-dialog::backdrop {\nbackground: var(--ty-modal-backdrop, rgba(0, 0, 0, 0.5));\nbackdrop-filter: var(--ty-modal-backdrop-blur, blur(2px));\nanimation: ty-modal-backdrop-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n.ty-modal-dialog:not([data-backdrop])::backdrop {\nbackground: transparent;\nbackdrop-filter: none;\n}\n.modal-content {\ncolor: var(--ty-text);\n}\n@keyframes ty-modal-backdrop-enter {\nfrom {\nopacity: 0;\n}\nto {\nopacity: 1;\n}\n}\n",id:"ty-modal"}),i.className="ty-modal-dialog",e.backdrop?i.setAttribute("data-backdrop","true"):i.removeAttribute("data-backdrop");const r=t.getAttribute("label");if(r?i.setAttribute("aria-label",r):i.removeAttribute("aria-label"),function(t,n,e){const i=ce.get(t);if(i&&(n.removeEventListener("click",i),ce.delete(t)),e){const e=n=>function(t,n){n.stopPropagation();const e=t.shadowRoot,i=e?ye(e):null;i&&n.target===i&&(n.preventDefault(),we(t,"backdrop"))}(t,n);ce.set(t,e),n.addEventListener("click",e)}}(t,i,e.closeOnOutsideClick),function(t,n,e){const i=de.get(t);if(i&&(n.removeEventListener("keydown",i),de.delete(t)),e){const e=n=>function(t,n){xe(n.currentTarget,n)||(n.stopPropagation(),"Escape"===n.key&&(n.preventDefault(),we(t,"escape")))}(t,n);de.set(t,e),n.addEventListener("keydown",e)}else{const e=t=>{"Escape"!==t.key||xe(n,t)||t.preventDefault()};de.set(t,e),n.addEventListener("keydown",e)}}(t,i,e.closeOnEscape),i.oncancel=n=>{n.preventDefault(),me(t).closeOnEscape&&we(t,"escape")},function(t,n,e){const i=n.querySelector(".close-button");if(!i)return;i.style.display=e?"":"none";const o=he.get(t);if(o&&(i.removeEventListener("click",o),he.delete(t)),e){const n=n=>function(t,n){n.preventDefault(),n.stopPropagation(),we(t,"close-button")}(t,n);he.set(t,n),i.addEventListener("click",n)}}(t,i,e.closeOnOutsideClick),function(t,n){const e=n.querySelector(".modal-content");if(!e)return;const i=ue.get(t),o=pe.get(t);if(i&&(e.removeEventListener("mouseenter",i),ue.delete(t)),o&&(e.removeEventListener("mouseleave",o),pe.delete(t)),window.innerWidth>=768&&0>=navigator.maxTouchPoints){const n=t=>function(t,n){const e=n.currentTarget.closest(".ty-modal-dialog");if(e){const t=e.querySelector(".close-button");t&&t.classList.add("hide")}}(0,t),i=t=>function(t,n){const e=n.currentTarget.closest(".ty-modal-dialog");if(e){const t=e.querySelector(".close-button");t&&t.classList.remove("hide")}}(0,t);ue.set(t,n),pe.set(t,i),e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",i)}}(t,i),e.open)i.open||(Hn(o),e.backdrop?i.showModal():i.show(),$e(),fe(t,"open",{}));else if(i.open){Nn(o),ke(t),i.close(),$e();const n=ge.get(t)??"programmatic";ge.delete(t),fe(t,"close",{reason:n})}$e(),i.onclose=n=>{n.target===i&&(Nn(o),ke(t),t.hasAttribute("open")&&(t.removeAttribute("open"),fe(t,"close",{reason:"native",returnValue:i.returnValue||void 0})),$e())}}function $e(){const t=Array.from(document.querySelectorAll("ty-modal[open], ty-dialog[open]")).some(t=>ve(t,"open")&&!ve(t,"no-zoom"));document.documentElement.classList.toggle("ty-modal-zoom",t)}class TyModal extends HTMLElement{static get observedAttributes(){return["open","no-backdrop","no-zoom","prevent-outside-click","prevent-escape","label"]}get open(){return ve(this,"open")}set open(t){i(t)?this.setAttribute("open","true"):this.removeAttribute("open")}get noBackdrop(){return ve(this,"no-backdrop")}set noBackdrop(t){i(t)?this.setAttribute("no-backdrop",""):this.removeAttribute("no-backdrop")}get noZoom(){return ve(this,"no-zoom")}set noZoom(t){i(t)?this.setAttribute("no-zoom",""):this.removeAttribute("no-zoom")}get preventOutsideClick(){return ve(this,"prevent-outside-click")}set preventOutsideClick(t){i(t)?this.setAttribute("prevent-outside-click",""):this.removeAttribute("prevent-outside-click")}get preventEscape(){return ve(this,"prevent-escape")}set preventEscape(t){i(t)?this.setAttribute("prevent-escape",""):this.removeAttribute("prevent-escape")}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){E(this),ze(this),this.show=()=>{this.setAttribute("open","true")},this.hide=t=>we(this,"programmatic",t)}disconnectedCallback(){!function(t){const n=be.get(t),e=t.shadowRoot,i=e?ye(e):null;if(n&&(Nn(n),be.delete(t)),$e(),!i)return;const o=ce.get(t);o&&(i.removeEventListener("click",o),ce.delete(t));const r=de.get(t);r&&(i.removeEventListener("keydown",r),de.delete(t));const s=i.querySelector(".close-button");if(s){const n=he.get(t);n&&(s.removeEventListener("click",n),he.delete(t))}const a=i.querySelector(".modal-content");if(a){const n=ue.get(t),e=pe.get(t);n&&(a.removeEventListener("mouseenter",n),ue.delete(t)),e&&(a.removeEventListener("mouseleave",e),pe.delete(t))}}(this)}attributeChangedCallback(t,n,e){this.isConnected&&ze(this)}}customElements.get("ty-modal")||customElements.define("ty-modal",TyModal),customElements.get("ty-dialog")||customElements.define("ty-dialog",class extends TyModal{});const Ce=(t,n)=>{const e=e=>n?e?`var(--ty-color-${t}${e}, var(--ty-color-${t}, var(--ty-color-${n}${e})))`:`var(--ty-color-${t}, var(--ty-color-${n}))`:e?`var(--ty-color-${t}${e}, var(--ty-color-${t}))`:`var(--ty-color-${t})`;return`\n:host([flavor="${t}"]) {\n--select-accent: var(--ty-input-${t}-border, ${e("-soft")});\n--select-accent-bold: ${e("")};\n--select-ring: color-mix(in oklab, ${e("")} 15%, transparent);\n}\n:host([flavor="${t}+"]) {\n--select-accent: ${e("")};\n--select-accent-bold: ${e("-strong")};\n--select-ring: color-mix(in oklab, ${e("-strong")} 15%, transparent);\n}\n:host([flavor="${t}-"]) {\n--select-accent: ${e("-faint")};\n--select-accent-bold: ${e("-soft")};\n--select-ring: color-mix(in oklab, ${e("-soft")} 15%, transparent);\n}\n`},Me=`\n${wt}\n:host {\ndisplay: block;\nwidth: 100%;\nfont-family: inherit;\n--mobile-border-color: var(--ty-border, #5858587d);\n}\n:host([compact]) {\ndisplay: inline-block;\nwidth: auto;\n}\n:host([has-trigger]) {\ndisplay: inline-block;\nwidth: auto;\n}\n.dropdown-dialog {\nposition: fixed;\nwidth: var(--dropdown-width, 200px);\nmax-width: 100vw;\nmargin: 0;\npadding: 0;\nborder: none;\nbackground: transparent;\nbox-sizing: border-box;\npadding: var(--dropdown-padding, 20px);\nopacity: 0;\nscale: 0.96;\ntranslate: 0 -6px;\ntransform-origin: top center;\ntransition:\nopacity var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\nscale var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\ntranslate var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1));\ntransform: translate(var(--dropdown-offset-x, 0px), var(--dropdown-offset-y, 0px));\ntop: -1000px;\nleft: -1000px;\n}\n.dropdown-dialog[open] {\ndisplay: flex;\nflex-direction: column;\n}\n.dropdown-dialog.position-below {\nleft: var(--dropdown-x);\ntop: var(--dropdown-y);\n}\n.dropdown-dialog.position-above {\nleft: var(--dropdown-x);\nbottom: var(--dropdown-y);\ntop: auto;\nflex-direction: column-reverse;\ntranslate: 0 6px;\ntransform-origin: bottom center;\n}\n.dropdown-dialog.position-above .dropdown-header {\nmargin-top: 4px;\n}\n.dropdown-dialog.position-below .dropdown-header {\nmargin-bottom: 4px;\n}\n.dropdown-dialog.position-below .dropdown-options {\nbox-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1), var(--ty-shadow-md);\n}\n.dropdown-dialog.position-above .dropdown-options {\ntransform: translateY(6px) scale(0.96);\ntransform-origin: bottom center;\n}\n.dropdown-dialog.open {\nopacity: 1;\nscale: 1;\ntranslate: 0 0;\n}\n.dropdown-dialog.open .dropdown-options {\nopacity: 1;\ntransform: translateY(0) scale(1);\n}\n@starting-style {\n.dropdown-dialog.open {\nopacity: 0;\nscale: 0.96;\ntranslate: 0 -6px;\n}\n.dropdown-dialog.open.position-above {\ntranslate: 0 6px;\n}\n.dropdown-dialog.open .dropdown-options {\nopacity: 0;\ntransform: translateY(-6px) scale(0.96);\n}\n.dropdown-dialog.open.position-above .dropdown-options {\ntransform: translateY(6px) scale(0.96);\n}\n}\n.dropdown-dialog::backdrop {\nbackground: transparent;\n}\n.dropdown-header {\ndisplay: flex;\nalign-items: center;\ngap: var(--ty-spacing-2);\nposition: relative;\n}\n.dropdown-search-input {\nfont-family: inherit;\nwidth: 100%;\nmin-width: 0;\nbox-sizing: border-box;\nbackground: var(--input-bg, var(--ty-input-bg));\ncolor: var(--input-color, var(--ty-input-color));\nborder: 1px solid var(--input-border, var(--ty-input-border));\nborder-radius: var(--ty-radius-md);\nfont-family: inherit;\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-normal);\nmin-height: var(--ty-size-md);\npadding: var(--ty-spacing-2) var(--ty-spacing-3);\npadding-right: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\ntransition: var(--ty-transition-all);\noutline: none;\n}\n.dropdown-search-input:focus {\nborder-color: var(--input-border-focus, var(--ty-input-border-focus));\nbox-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\n.dropdown-search-input:disabled {\nbackground-color: var(--input-disabled-bg, var(--ty-input-disabled-bg));\ncolor: var(--input-disabled-color, var(--ty-input-disabled-color));\ncursor: not-allowed;\nopacity: 0.6;\n}\n.dropdown-search-input::placeholder {\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\n}\n.dropdown-search-chevron {\nposition: absolute;\ntop: 50%;\nright: var(--ty-spacing-3);\ntransform: translateY(-50%);\nwidth: 1rem;\nheight: 1rem;\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\ntransition: var(--ty-transition-transform);\npointer-events: none;\n}\n.dropdown-search-chevron.open {\ntransform: translateY(-50%) rotate(180deg);\n}\n.dropdown-search-chevron svg {\nwidth: 100%;\nheight: 100%;\n}\n.select-stub {\nmin-height: var(--ty-size-md);\ndisplay: flex;\nflex-wrap: wrap;\ngap: 0.25rem;\nalign-items: center;\npadding: 0 2.5rem 0 0.75rem;\ntransition: var(--ty-transition-all), opacity 0.2s ease;\noutline: none;\nbackground: var(--input-bg, var(--ty-input-bg));\ncolor: var(--input-color, var(--ty-input-color));\nborder: 1px solid var(--select-accent, var(--input-border, var(--ty-input-border)));\nborder-radius: var(--ty-radius-md);\nfont-family: inherit;\nfont-size: var(--ty-field-font);\nline-height: var(--ty-field-leading);\nletter-spacing: var(--ty-field-tracking);\ncursor: pointer;\nposition: relative;\nwidth: 100%;\nbox-sizing: border-box;\n}\n.select-stub {\nmin-height: var(--ty-field-height);\npadding: 0 2.5rem 0 var(--ty-field-pad-x);\n}\n.select-stub:hover {\nborder-color: var(--select-accent-bold, var(--input-border-hover, var(--ty-input-border-hover)));\n}\n.select-stub[disabled] {\nbackground-color: var(--input-disabled-bg, var(--ty-input-disabled-bg));\ncolor: var(--input-disabled-color, var(--ty-input-disabled-color));\ncursor: not-allowed;\nopacity: 0.6;\n}\n.dropdown-wrapper:has(.dropdown-chevron.open) .select-stub {\nopacity: 0;\npointer-events: none;\n}\n.dropdown-wrapper:has(.dropdown-chevron.open):not(:has(.dropdown-search-input:focus)) .select-stub:not(.custom-trigger),\n.select-stub:focus,\n.select-stub:focus-visible {\nborder-color: var(--select-accent-bold, var(--input-border-focus, var(--ty-input-border-focus)));\nbox-shadow: 0 0 0 3px var(--select-ring, var(--input-shadow-focus, var(--ty-input-shadow-focus)));\n}\n.select-stub.custom-trigger {\nmin-height: 0;\npadding: 0;\nborder: none;\nbackground: transparent;\n}\n.select-stub.custom-trigger:hover,\n.dropdown-wrapper:has(.dropdown-chevron.open) .select-stub.custom-trigger,\n.select-stub.custom-trigger:focus,\n.select-stub.custom-trigger:focus-visible {\nborder-color: transparent;\nbox-shadow: none;\n}\n.error-message {\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\nletter-spacing: var(--ty-tracking-xs);\ncolor: var(--ty-color-danger);\nmargin-top: 4px;\npadding-left: var(--ty-field-outer-pad-x);\ncontain: inline-size;\n}\n:host([compact]) .error-message,\n:host([has-trigger]) .error-message {\nbox-sizing: border-box;\nwidth: max(100%, 20em);\n}\n:host([has-trigger]) .error-message {\npadding-left: 0;\n}\n.select-stub.error:not(.custom-trigger) {\nborder-color: var(--ty-color-danger);\nbackground: var(--ty-bg-danger-soft);\n}\n.select-stub.error:not(.custom-trigger):focus,\n.select-stub.error:not(.custom-trigger):focus-visible {\nborder-color: var(--ty-color-danger-bold);\nbox-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\n.dropdown-mode-mobile .dropdown-wrapper:has(.mobile-dialog[open]) .select-chips {\ndisplay: none;\n}\n.select-stub.has-tags {\npadding: 0.25rem 2.5rem 0.25rem 0.5rem;\nwidth: 100%;\n}\n.select-stub.has-tags slot[name="selected"] {\ndisplay: flex;\nflex-wrap: wrap;\ngap: 0.25rem;\n}\n.dropdown-chevron {\nposition: absolute;\ntop: 50%;\nright: var(--ty-spacing-3);\ntransform: translateY(-50%);\nwidth: 1rem;\nheight: 1rem;\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\ntransition: var(--ty-transition-transform);\npointer-events: none;\n}\n.dropdown-chevron.open {\ntransform: translateY(-50%) rotate(180deg);\n}\n.dropdown-chevron svg {\nwidth: 100%;\nheight: 100%;\n}\n.select-chips {\ndisplay: flex;\nflex-wrap: wrap;\ngap: 0.5rem;\nalign-items: center;\nmin-width: 0;\n}\n.dropdown-placeholder {\ncolor: var(--input-placeholder, var(--ty-input-placeholder, #9ca3af));\nfont-size: var(--ty-field-font);\nline-height: var(--ty-field-leading);\nletter-spacing: var(--ty-field-tracking);\nfont-weight: var(--ty-font-light);\nfont-style: italic;\n}\n.dropdown-placeholder.hidden {\ndisplay: none;\n}\n.dropdown-options {\nopacity: 0;\nbackground: var(--ty-surface-floating);\nborder: 1px solid var(--ty-floating-border);\nborder-radius: var(--ty-radius-lg);\nmax-height: 16rem;\nwidth: 100%;\nmax-width: 100%;\noverflow-x: hidden;\noverflow-y: auto;\nscroll-behavior: smooth;\nbox-sizing: border-box;\nposition: relative;\nbox-shadow:\n0 20px 25px -5px rgba(0, 0, 0, 0.1),\n0 10px 10px -5px rgba(0, 0, 0, 0.04);\ntransform: translateY(-6px) scale(0.96);\ntransform-origin: top center;\ntransition:\nopacity var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\ntransform var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1));\ndisplay: flex;\nflex-wrap: wrap;\npadding: 0.5rem;\ngap: 0.5rem;\n}\n.dropdown-options.ty-custom-scroll {\nscrollbar-width: none;\n-ms-overflow-style: none;\n}\n.dropdown-options.ty-custom-scroll::-webkit-scrollbar {\ndisplay: none;\n}\n.dropdown-options-wrapper {\nposition: relative;\n}\n.dropdown-options-wrapper:hover .ty-scrollbar-track-y.has-overflow {\nopacity: 1;\n}\n.dropdown-options ty-tag {\nuser-select: none;\ntransition: transform 0.1s ease;\n}\n.dropdown-options ty-tag:hover {\ntransform: scale(1.02);\n}\n.dropdown-options ty-tag:active {\ntransform: scale(0.98);\n}\n.dropdown-options ty-tag[selected] {\nopacity: 0.5;\n}\n.select-chips ty-tag {\nmax-width: 150px;\n}\n@media (max-width: 640px) {\n.select-chips ty-tag {\nmax-width: 100px;\n}\n}\n.select-container {\ndisplay: flex;\nflex-direction: column;\n}\n.dropdown-wrapper {\nposition: relative;\ndisplay: block;\nwidth: 100%;\n}\n.ty-field-label {\nfont-size: var(--ty-field-label-font);\nline-height: var(--ty-field-label-leading);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-medium);\ncolor: var(--ty-label-color);\nmargin-bottom: var(--ty-field-label-gap);\npadding-left: var(--ty-field-outer-pad-x);\ndisplay: flex;\nalign-items: center;\n}\n.required-icon {\ndisplay: inline-flex;\nalign-items: center;\ncolor: #ef4444;\nwidth: 12px;\nheight: 12px;\nvertical-align: middle;\nmargin-left: 4px;\n}\n.required-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n:host([disabled]) .select-container {\npointer-events: none;\n}\n.dropdown-mode-mobile .mobile-dialog {\nposition: fixed;\ntop: 0;\nleft: 0;\nright: 0;\nbottom: 0;\nwidth: 100vw;\nheight: 100dvh; \nmax-width: 100vw;\nmax-height: 100dvh;\nmargin: 0;\npadding: 0;\npadding-top: 6dvh; \nborder: none;\nbackground: transparent; \nalign-items: flex-start;\njustify-content: center;\nopacity: 0;\ntransition: opacity 300ms ease;\n}\n.dropdown-mode-mobile .mobile-dialog[open] {\ndisplay: flex;\n}\n.dropdown-mode-mobile .mobile-dialog.open {\nopacity: 1;\n}\n.dropdown-mode-mobile .mobile-dialog::backdrop {\nbackground: rgba(0, 0, 0, 0.65); \nbackdrop-filter: blur(8px);\n-webkit-backdrop-filter: blur(8px);\n}\n.dropdown-mode-mobile .mobile-dialog-content {\nposition: relative;\ndisplay: flex;\nflex-direction: column;\nwidth: calc(100% - 32px); \nmax-width: 400px;\nmin-height: 200px;\nmax-height: 90dvh; \nopacity: 0;\ntransform: scale(0.95);\ntransition: \nopacity 300ms cubic-bezier(0.16, 1, 0.3, 1),\ntransform 300ms cubic-bezier(0.16, 1, 0.3, 1);\n}\n.dropdown-mode-mobile .mobile-dialog.open .mobile-dialog-content {\nopacity: 1;\ntransform: scale(1);\n}\n.dropdown-mode-mobile .mobile-search-input:focus {\nborder-color: var(--ty-border);\n}\n.dropdown-mode-mobile .mobile-search-header {\nflex-shrink: 0;\ndisplay: flex;\nflex-direction: column;\nmargin-bottom: 16px;\npadding: 0;\nbackground: transparent;\nposition: relative;\n}\n.dropdown-mode-mobile .mobile-header-content {\ndisplay: flex;\nalign-items: center;\ngap: 12px;\nwidth: 100%;\njustify-content: flex-end;\n}\n.dropdown-mode-mobile .mobile-header-label {\nposition: absolute;\nbottom: 100%;\nleft: 2px;\nmargin-bottom: 8px; \nfont-size: var(--ty-font-base); \nline-height: var(--ty-leading-base);\nletter-spacing: var(--ty-tracking-base);\nfont-weight: 600; \ncolor: #ffffff;\npointer-events: none;\n}\n.dropdown-mode-mobile .mobile-close-button {\nflex-shrink: 0;\nwidth: 32px;\nheight: 32px;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nbackground: transparent;\nborder: none;\nborder-radius: 50%;\ncolor: #ffffff;\ncursor: pointer;\ntransition: var(--ty-transition-all);\npadding: 0;\n}\n.dropdown-mode-mobile .mobile-close-button:hover {\nbackground: rgba(255, 255, 255, 0.15);\ncolor: #ffffff;\n}\n.dropdown-mode-mobile .mobile-close-button:active {\ntransform: scale(0.9);\nbackground: rgba(255, 255, 255, 0.25);\n}\n.dropdown-mode-mobile .mobile-close-button svg {\nwidth: 18px;\nheight: 18px;\n}\n.dropdown-mode-mobile .mobile-search-input {\nfont-family: inherit;\nflex: 1;\nmin-width: 0;\nbox-sizing: border-box;\nbackground: var(--ty-surface-floating);\ncolor: var(--ty-text);\nborder: 2px solid;\nborder-color: var(--mobile-border-color);\nborder-radius: var(--ty-radius-md);\nfont-family: inherit;\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-normal);\npadding: var(--ty-spacing-2) var(--ty-spacing-3);\nheight: 40px;\ntransition: var(--ty-transition-all);\noutline: none;\n}\n.dropdown-mode-mobile .mobile-search-input::placeholder {\ncolor: var(--ty-text-faint);\n}\n.dropdown-mode-mobile .mobile-search-input:focus {\nborder-color: var(--ty-border);\n}\n.dropdown-mode-mobile .mobile-body {\nposition: relative;\ndisplay: flex;\nflex-direction: column;\nheight: var(--body-height, 350px);\nmax-height: 350px;\noverflow: hidden;\nbackground: var(--ty-surface-floating);\nborder-radius: var(--ty-radius-lg);\nbox-shadow: \n0 20px 25px -5px rgba(0, 0, 0, 0.1),\n0 10px 10px -5px rgba(0, 0, 0, 0.04);\nborder: 2px solid;\nborder-color: var(--mobile-border-color);\n}\n.dropdown-mode-mobile .section-header {\ndisplay: flex;\nalign-items: center;\njustify-content: space-between;\nheight: 36px;\nflex-shrink: 0;\npadding: 0 16px;\nfont-size: 11px;\nfont-weight: 600;\ntext-transform: uppercase;\nletter-spacing: 0.06em;\ncolor: var(--ty-text-bold);\nbackground: transparent;\ncursor: default;\nuser-select: none;\n}\n.dropdown-mode-mobile .section-header .section-title {\nflex: 1;\n}\n.dropdown-mode-mobile .section-header .section-count {\nfont-weight: 500;\ncolor: var(--ty-text-faint);\nmargin-left: 0.25rem;\n}\n.dropdown-mode-mobile .mobile-body .section-header {\nheight: 36px;\nflex: 0 0 36px;\n}\n.dropdown-mode-mobile .mobile-selected-section,\n.dropdown-mode-mobile .mobile-available-section {\ndisplay: flex;\nflex-direction: column;\nbackground: var(--ty-input-bg);\noverflow: hidden;\nmin-height: 36px;\nflex: 0 1 36px;\ntransition: flex-grow 220ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n.dropdown-mode-mobile .mobile-body[data-expanded="selected"] .mobile-selected-section,\n.dropdown-mode-mobile .mobile-body[data-expanded="available"] .mobile-available-section {\nflex-grow: 1;\n}\n.dropdown-mode-mobile .mobile-selected-section[data-empty="true"] {\nflex-grow: 0;\n}\n.dropdown-mode-mobile .mobile-selected-section .section-content {\nflex: 1;\nmin-height: 0;\noverflow-y: auto;\noverscroll-behavior: contain;\npadding: 0.75rem 1rem;\ndisplay: flex;\nflex-wrap: wrap;\ngap: 0.5rem;\nalign-content: flex-start;\n-webkit-mask-image: linear-gradient(to bottom, black calc(100% - 12px), transparent);\nmask-image: linear-gradient(to bottom, black calc(100% - 12px), transparent);\n}\n.dropdown-mode-mobile .mobile-available-section .section-content {\nflex: 1;\nmin-height: 0;\noverflow-y: auto;\noverscroll-behavior: contain;\npadding: 0.75rem 1rem;\ndisplay: flex;\nflex-wrap: wrap;\ngap: 0.5rem;\nalign-content: flex-start;\n}\n@media (prefers-reduced-motion: reduce) {\n.dropdown-mode-mobile .mobile-selected-section,\n.dropdown-mode-mobile .mobile-available-section {\ntransition: none;\n}\n}\n.dropdown-mode-mobile .mobile-body .section-header {\ndisplay: flex;\nalign-items: center;\njustify-content: space-between;\nwidth: 100%;\nborder: none;\nbackground: transparent;\nfont: inherit;\ntext-align: left;\ncursor: pointer;\n-webkit-tap-highlight-color: transparent;\n}\n.dropdown-mode-mobile .mobile-body .section-header svg {\nwidth: 1rem;\nheight: 1rem;\nflex-shrink: 0;\nopacity: 0.5;\ntransition: transform 180ms ease;\n}\n.dropdown-mode-mobile .mobile-body .section-header[aria-expanded="true"] svg {\ntransform: rotate(180deg);\n}\n.dropdown-mode-mobile .mobile-selected-section[data-empty="true"] .section-header {\ncursor: default;\n}\n.dropdown-mode-mobile .mobile-selected-section[data-empty="true"] .section-header svg {\ndisplay: none;\n}\n.dropdown-mode-mobile .mobile-selected-chip {\ndisplay: inline-flex;\nalign-items: center;\ngap: 0.375rem;\npadding: 0.25rem 0.5rem 0.25rem 0.625rem;\nborder: 1px solid var(--ty-border);\nborder-radius: 9999px;\nbackground: var(--ty-surface-content);\ncolor: var(--ty-text);\nfont: inherit;\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\ncursor: pointer;\ntransition: transform 0.1s ease, border-color 0.15s ease;\nanimation: ty-select-tag-enter 180ms cubic-bezier(0.16, 1, 0.3, 1);\n}\n.dropdown-mode-mobile .mobile-selected-chip svg {\nwidth: 0.875rem;\nheight: 0.875rem;\nflex-shrink: 0;\nopacity: 0.6;\n}\n@media (hover: hover) {\n.dropdown-mode-mobile .mobile-selected-chip:hover {\nborder-color: var(--ty-text-soft);\n}\n.dropdown-mode-mobile .mobile-selected-chip:hover svg {\nopacity: 1;\n}\n}\n.dropdown-mode-mobile .mobile-selected-chip:active {\ntransform: scale(0.96);\n}\n.dropdown-mode-mobile .empty-state {\ndisplay: none;\nwidth: 100%;\npadding: 2rem 1rem;\ntext-align: center;\ncolor: var(--ty-text-faint);\nfont-size: var(--ty-font-sm);\nline-height: var(--ty-leading-sm);\nletter-spacing: var(--ty-tracking-sm);\nfont-style: italic;\n}\n.dropdown-mode-mobile .mobile-available-section[data-empty="true"] .empty-state {\ndisplay: block;\n}\n.dropdown-mode-mobile .mobile-selected-section[data-empty="true"] .section-content,\n.dropdown-mode-mobile .mobile-available-section[data-empty="true"] slot {\ndisplay: none;\n}\n.dropdown-mode-mobile .section-content ::slotted(ty-tag) {\ncursor: pointer;\nuser-select: none;\ntransition: transform 0.1s ease;\nmargin: 2px 0;\nanimation: ty-select-tag-enter 180ms cubic-bezier(0.16, 1, 0.3, 1);\n}\n@media (hover: hover) {\n.dropdown-mode-mobile .section-content ::slotted(ty-tag:hover) {\ntransform: scale(1.02);\n}\n}\n.dropdown-mode-mobile .section-content ::slotted(ty-tag:active) {\ntransform: scale(0.96);\n}\n.dropdown-mode-mobile .section-content ::slotted(ty-tag[hidden]) {\ndisplay: none !important;\n}\n@keyframes ty-select-tag-enter {\nfrom { opacity: 0; transform: scale(0.85); }\nto { opacity: 1; transform: scale(1); }\n}\n@media (prefers-reduced-motion: reduce) {\n.dropdown-mode-mobile .section-content ::slotted(ty-tag) {\nanimation: none;\n}\n}\n.dropdown-loading {\ndisplay: none;\nalign-items: center;\njustify-content: center;\ngap: var(--ty-spacing-2);\npadding: var(--ty-spacing-4) var(--ty-spacing-3);\ncolor: var(--ty-text-soft);\nfont-size: var(--ty-font-sm);\nmin-height: 4rem;\nbackground: var(--ty-loader-bg, var(--ty-surface-floating));\nborder: 1px solid var(--ty-loader-border, var(--ty-floating-border));\nborder-radius: var(--ty-loader-radius, var(--ty-radius-lg));\nbox-shadow: var(--ty-loader-shadow, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04));\nbox-sizing: border-box;\n}\n.dropdown-options-wrapper.loading .dropdown-loading {\ndisplay: flex;\n}\n.dropdown-loading > slot[name="loading"] {\ndisplay: contents;\n}\n.dropdown-mode-mobile .dropdown-loading {\nbackground: transparent;\nborder: none;\nbox-shadow: none;\nflex: 1;\nflex-direction: column;\ngap: var(--ty-spacing-3);\npadding: var(--ty-spacing-8) var(--ty-spacing-4);\nmin-height: 12rem;\n}\n.dropdown-mode-mobile .dropdown-loading-spinner {\nwidth: 2rem;\nheight: 2rem;\n}\n.dropdown-mode-mobile .dropdown-loading-text {\nfont-size: var(--ty-font-base);\n}\n.dropdown-options-wrapper.loading .dropdown-options,\n.dropdown-options-wrapper.loading > slot#options-slot,\n.dropdown-options-wrapper.loading .empty-state {\ndisplay: none;\n}\n.dropdown-loading-spinner {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nwidth: 1.125rem;\nheight: 1.125rem;\nflex-shrink: 0;\nanimation: ty-select-spin 0.7s linear infinite;\ncolor: var(--select-accent-bold, var(--ty-color-primary));\n}\n.dropdown-loading-spinner svg {\nwidth: 100%;\nheight: 100%;\n}\n.dropdown-loading-text {\ncolor: var(--ty-text-soft);\n}\n@keyframes ty-select-spin {\nto { transform: rotate(360deg); }\n}\n@media (prefers-reduced-motion: reduce) {\n.dropdown-loading-spinner {\nanimation-duration: 1.6s;\n}\n}\n${en}\n${n.filter(t=>"neutral"!==t).map(t=>Ce(t)).join("")}\n`;function Ee(t=768){return window.matchMedia(`(pointer: coarse) and (max-width: ${t}px)`).matches}let Se=0;const Te=new WeakMap;function _e(t){let n=Te.get(t);return void 0===n&&(n=++Se,Te.set(t,n)),n}const qe='<svg viewBox="0 0 20 20" fill="currentColor">\n<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />\n</svg>',Le='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>\n</svg>',De='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n<line x1="18" y1="6" x2="6" y2="18"></line>\n<line x1="6" y1="6" x2="18" y2="18"></line>\n</svg>',Ae=class extends T{constructor(){super(),this.gn="",this.vn=!1,this.mn=!1,this.yn="Select...",this.fn="",this.U=!1,this.wn=!1,this.xn=!1,this.kn=!0,this.zn=!1,this.$n=!1,this.Cn="none",this.Mn=!1,this.En=!1,this.Sn=null,this.Tn=e,this._n="Available",this.qn="Selected",this.Ln="No options available",this.Dn={open:!1,search:"",highlightedIndex:-1,filteredTags:[],selectedValues:[],mode:"desktop"},this.An=null,this.Fn=null,this.Vn=null,this.jn=null,this.In=null,this.On=0,this.Hn=null,this.Nn=null,this.Wn=null,this.Bn=null,this.j=null,this.Pn=null;const t=this.shadowRoot;q(t,{css:Me,id:"ty-select-base"}),q(t,{css:'\n.select-stub.compact {\ndisplay: inline-flex;\nflex-wrap: nowrap;\nwidth: auto;\ngap: 0.5rem;\npadding: 0.5rem 2.25rem 0.5rem 0.875rem;\n}\n.select-stub.custom-trigger {\ndisplay: inline-block;\nwidth: auto;\nborder: none;\nbackground: none;\npadding: 0;\nmin-height: 0;\nborder-radius: 0;\n}\n.select-stub.custom-trigger:hover {\nborder: none;\n}\n.select-count {\nflex-shrink: 0;\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nmin-width: 1.25rem;\nheight: 1.25rem;\npadding: 0 0.375rem;\nborder-radius: 9999px;\nbackground: color-mix(in oklab, var(--select-accent, var(--ty-color-primary)) 15%, transparent);\ncolor: var(--select-accent-bold, var(--ty-color-primary-strong));\nfont-size: var(--ty-font-xs);\nfont-weight: var(--ty-font-semibold);\nfont-style: normal;\n}\n.select-count[hidden] {\ndisplay: none;\n}\n.select-clear {\nflex-shrink: 0;\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nwidth: 1rem;\nheight: 1rem;\npadding: 0;\nborder: none;\nbackground: none;\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\ncursor: pointer;\nborder-radius: var(--ty-radius-sm);\ntransition: var(--ty-local-transition, all 0.15s ease);\n}\n.select-stub .select-clear {\nmargin-right: -0.375rem;\n}\n.select-stub.compact .select-clear {\nmargin-right: -0.125rem;\n}\n.select-clear[hidden] {\ndisplay: none;\n}\n.select-clear:hover {\ncolor: var(--ty-color-danger);\nbackground-color: var(--ty-bg-danger-soft);\n}\n.select-clear svg {\nwidth: 100%;\nheight: 100%;\n}\n.select-stub .dropdown-placeholder {\nfont-style: normal;\nflex: 1 1 0%;\nmin-width: 0;\noverflow: hidden;\ntext-overflow: ellipsis;\nwhite-space: nowrap;\ncolor: var(--input-color, var(--ty-input-color));\n}\n.select-stub .dropdown-placeholder.placeholder-shown {\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\n}\n.select-stub .dropdown-placeholder[hidden] {\ndisplay: none;\n}\n.select-stub slot[name="selected"] {\ndisplay: none;\n}\n.select-stub.has-clone slot[name="selected"] {\ndisplay: block;\nflex: 1 1 0%;\nmin-width: 0;\noverflow: hidden;\n}\n.select-stub.compact.has-clone slot[name="selected"] {\nflex: 0 1 auto;\n}\n.select-stub ::slotted([slot="start"]),\n.select-stub ::slotted([slot="end"]) {\nflex-shrink: 0;\ncolor: var(--ty-text-soft);\n}\n.select-stub.compact .dropdown-placeholder {\nflex: 0 1 auto;\ncolor: var(--ty-text);\n}\n.dropdown-wrapper:has(.dropdown-chevron.open) .select-stub {\nopacity: 1;\npointer-events: auto;\n}\n.dropdown-dialog.open {\nfilter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.14)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.08));\n}\n.dropdown-header {\nbackground: var(--ty-surface-floating);\nborder: 1px solid var(--ty-floating-border);\nborder-bottom: none;\nborder-radius: var(--ty-radius-lg) var(--ty-radius-lg) 0 0;\npadding: var(--ty-spacing-2) var(--ty-spacing-2) var(--ty-spacing-1);\n}\n.dropdown-dialog.position-below .dropdown-header {\nmargin-bottom: 0;\n}\n.dropdown-dialog.position-above .dropdown-header {\nmargin-top: 0;\nborder-top: none;\nborder-bottom: 1px solid var(--ty-floating-border);\nborder-radius: 0 0 var(--ty-radius-lg) var(--ty-radius-lg);\npadding: var(--ty-spacing-1) var(--ty-spacing-2) var(--ty-spacing-2);\n}\n.dropdown-search-icon {\nposition: absolute;\ntop: 50%;\nleft: calc(var(--ty-spacing-2) + var(--ty-spacing-3));\ntransform: translateY(-50%);\nwidth: 1rem;\nheight: 1rem;\ncolor: var(--input-placeholder, var(--ty-input-placeholder));\npointer-events: none;\n}\n.dropdown-search-icon svg {\nwidth: 100%;\nheight: 100%;\n}\n.dropdown-mode-mobile .mobile-header-content .dropdown-search-icon {\nposition: static;\ntransform: none;\nflex-shrink: 0;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nwidth: 32px;\nheight: 32px;\ncolor: #ffffff;\n}\n.dropdown-mode-mobile .mobile-header-content .dropdown-search-icon svg {\nwidth: 18px;\nheight: 18px;\n}\n.dropdown-search-input {\nmin-height: 2.25rem;\npadding-right: var(--ty-spacing-2);\npadding-left: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n}\n.dropdown-search-chevron {\ndisplay: none;\n}\n.dropdown-dialog:focus,\n.dropdown-dialog:focus-visible {\noutline: none;\n}\n.dropdown-header[hidden] {\ndisplay: none;\n}\n.dropdown-header[hidden] ~ .dropdown-options-wrapper .dropdown-options {\nborder-top: 1px solid var(--ty-floating-border);\nborder-radius: var(--ty-radius-lg);\n}\n.mobile-search-input[hidden],\n.mobile-header-content .dropdown-search-icon[hidden] {\ndisplay: none;\n}\n.dropdown-options {\nflex-direction: column;\nflex-wrap: nowrap;\nalign-items: stretch;\ngap: 0;\npadding: var(--ty-spacing-1);\nborder-top: none;\nborder-radius: 0 0 var(--ty-radius-lg) var(--ty-radius-lg);\nbox-shadow: none;\ntransform: none;\ntransition: none;\nmax-height: 24rem;\n}\n.dropdown-dialog.position-below .dropdown-options {\nbox-shadow: none;\n}\n.dropdown-dialog.position-above .dropdown-options {\nborder-top: 1px solid var(--ty-floating-border);\nborder-bottom: none;\nborder-radius: var(--ty-radius-lg) var(--ty-radius-lg) 0 0;\n}\n.dropdown-loading {\nborder-top: none;\nborder-radius: 0 0 var(--ty-radius-lg) var(--ty-radius-lg);\nbox-shadow: none;\n}\n.dropdown-dialog.position-above .dropdown-loading {\nborder-top: 1px solid var(--ty-floating-border);\nborder-bottom: none;\nborder-radius: var(--ty-radius-lg) var(--ty-radius-lg) 0 0;\n}\n.dropdown-mode-mobile .section-content ::slotted(ty-option) {\ndisplay: block;\nwidth: 100%;\n}\n',id:"ty-select"})}onConnect(){this.shadowRoot.querySelectorAll("dialog").forEach(t=>{t.open&&t.close()}),this.render(),this.initializeState(),this.updateFormValue(),this.Wn=new MutationObserver(()=>{this.ensureOptionRoles(),this.Dn.selectedValues.length>0&&this.syncSelectedTags(this.Dn.selectedValues),this.updateSearchVisibility(),this.updateSelectionDisplay(),this.updateMobileSelectedState()}),this.Wn.observe(this,{childList:!0}),this.ensureOptionRoles(),this.O(),this.syncErrorFlavor(),this.In||(this.In=this.handleKeyboard.bind(this),document.addEventListener("keydown",this.In,!0))}O(){this.j=O(this.shadowRoot,this.j,this.getProperty("flavor"),({base:t})=>(t=>Ce(t,"neutral"))(t))}syncErrorFlavor(){if(!this.p)return;const t=this.getProperty("flavor"),n=this.getAttribute(ft);if(this.getProperty("error"))null===n&&"neutral"===t&&(this.setAttribute(ft,this.getAttribute("flavor")??""),this.setProperty("flavor","danger"));else if(null!==n){if(this.removeAttribute(ft),"danger"!==t)return;n?this.setProperty("flavor",n):this.removeAttribute("flavor")}}onDisconnect(){this.Dn.open&&("mobile"===this.Dn.mode?this.closeMobileModal():this.closeDropdown()),this.shadowRoot.querySelectorAll("dialog").forEach(t=>{t.open&&t.close()}),this.In&&(document.removeEventListener("keydown",this.In,!0),this.In=null),null!==this.Hn&&(clearTimeout(this.Hn),this.Hn=null),this.Rn(),this.Wn&&(this.Wn.disconnect(),this.Wn=null)}onPropertiesChanged(t){for(const{name:n,newValue:e}of t)switch(n){case"value":const t=this.parseValue(e);this.Dn.selectedValues=t,this.isConnected&&this.shadowRoot&&(this.syncSelectedTags(t),this.updateSelectionDisplay(),this.updateMobileSelectedState());break;case"name":this.gn=e||"";break;case"flavor":"danger"!==e&&(this.removeAttribute(ft),this.syncErrorFlavor()),this.O();break;case"error":this.syncErrorFlavor();break;case"multiple":this.vn=e,!e&&this.Dn.selectedValues.length>1&&this.updateComponentValue([this.Dn.selectedValues[0]],!1,"set",null);break;case"compact":this.mn=e;break;case"placeholder":this.yn=e||"Select...",this.isConnected&&this.shadowRoot&&this.updateSelectionDisplay();break;case"label":this.fn=e||"";break;case"disabled":this.U=e;break;case"readonly":this.wn=e;break;case"required":this.xn=e;break;case"noClear":this.kn=!e,this.isConnected&&this.shadowRoot&&this.updateSelectionDisplay();break;case"externalSearch":this.zn=e;break;case"notSearchable":this.Mn=e,this.isConnected&&this.shadowRoot&&this.updateSearchVisibility();break;case"allowCreate":this.$n=e,this.isConnected&&this.shadowRoot&&this.updateSearchVisibility();break;case"createTransform":this.Cn=e;break;case"size":this.Tn=e;break;case"debounce":this.On=e;break;case"available-label":this._n=e||"Available";break;case"selected-label":this.qn=e||"Selected";break;case"no-options-message":this.Ln=e||"No options available";break;case"loading":this.En=e,this.applyLoadingState()}}applyLoadingState(){const t=this.shadowRoot;if(!t)return;const n=this.En?W():null;t.querySelectorAll(".dropdown-options-wrapper").forEach(t=>{if(t.classList.toggle("loading",this.En),this.En){t.setAttribute("aria-busy","true");const e=t.querySelector(".dropdown-loading-spinner");e&&n&&(e.innerHTML=n)}else t.removeAttribute("aria-busy")})}getFormValue(){const t=this.Dn.selectedValues;if(this.gn&&t.length>0){if(!this.vn)return t[0];const n=new FormData;return t.forEach(t=>{n.append(this.gn,t)}),n}return this.gn&&!this.vn?"":null}focus(t){if(this.U)return;const n=this.querySelector(':scope > [slot="trigger"]'),e=this.shadowRoot?.querySelector(".select-stub"),i=n??e;i?i.focus(t):super.focus(t)}parseValue(t){return t&&"string"==typeof t&&""!==t.trim()?t.split(",").map(t=>t.trim()).filter(t=>""!==t):[]}initializeState(){const t=this.getProperty("value")||"";if(t){const n=this.parseValue(t);this.Dn.selectedValues=n,this.syncSelectedTags(n),this.updateSelectionDisplay(),this.updateMobileSelectedState()}else this.resolveDeclarativeSelection()}resolveDeclarativeSelection(){if(this.getAttribute("value")||this.Dn.selectedValues.length>0)return;const t=this.getTagElements().filter(t=>t.hasAttribute("selected")).map(t=>this.getTagData(t).value);t.length>0?this.updateComponentValue(t,!1):"loading"===document.readyState&&document.addEventListener("DOMContentLoaded",()=>{this.isConnected&&this.resolveDeclarativeSelection()},{once:!0})}getTagElements(){return Array.from(this.querySelectorAll("ty-option:not([cloned]), ty-tag:not([cloned])"))}getTagData(t){return{value:t.value||t.getAttribute("value")||t.textContent||"",text:t.getAttribute("label")||t.textContent||"",element:t}}selectTag(t){t.setAttribute("selected","")}deselectTag(t){t.removeAttribute("selected")}getSelectedValues(){return[...this.Dn.selectedValues]}syncSelectedTags(t){const n=new Set(t);this.getTagElements().forEach(t=>{const e=this.getTagData(t).value,i=n.has(e),o=t.hasAttribute("selected");i&&!o?this.selectTag(t):!i&&o&&this.deselectTag(t),t.setAttribute("aria-selected",i+"")})}ensureOptionRoles(){this.getTagElements().forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","option"),t.hasAttribute("aria-selected")||t.setAttribute("aria-selected","false")})}updateComponentValue(t,n=!1,e="set",i=null,o=n){const r=this.getSelectedValues(),s=t.join(",");JSON.stringify(t.sort())!==JSON.stringify(r.sort())&&(this.setProperty("value",s),this.updateValidity(),n&&(this.dispatchChangeEvent({value:this.vn?[...t]:t[0]??null,values:t,items:this.getSelectedItems(t),action:e,item:i}),o&&this.revealValidity()))}getSelectedItems(t){const n=new Map(this.getTagElements().map(t=>[this.getTagData(t).value,t]));return t.map(t=>{const e=n.get(t);return{value:t,label:e?.getAttribute("label")||e?.textContent?.trim()||t,flavor:e?.getAttribute("flavor")??null}})}calculatePosition(){const t=this.shadowRoot,n=t.querySelector(".select-stub"),e=t.querySelector(".dropdown-dialog");if(!n||!e)return;const i=n.getBoundingClientRect(),o=e.getBoundingClientRect(),r=Math.min(o.height||200,440),s=parseFloat(getComputedStyle(this).getPropertyValue("--ty-select-popup-width")),a=isNaN(s)?Math.max(i.width,320):s,l=this.getProperty("placement"),c=l?hn(l):{side:"auto",align:this.getProperty("align")},d=bn({anchorRect:i,popupWidth:a,popupHeight:r,align:c.align,side:c.side,gap:8}),h=d.below,u=(h?d.topY:d.bottomY)-20,p=a+20+20;this.style.setProperty("--dropdown-x",d.x-20+"px"),this.style.setProperty("--dropdown-y",u+"px"),this.style.setProperty("--dropdown-width",p+"px"),this.style.setProperty("--dropdown-offset-x","0px"),this.style.setProperty("--dropdown-offset-y","0px"),this.style.setProperty("--dropdown-padding","20px"),h?(e.classList.add("position-below"),e.classList.remove("position-above")):(e.classList.add("position-above"),e.classList.remove("position-below")),this.style.setProperty("--dropdown-direction",h?"below":"above")}Yn(){if(!tn())return;const t=this.shadowRoot,n=t.querySelector(".dropdown-options"),e=t.querySelector(".dropdown-options-wrapper");n&&e&&(this.Rn(),n.classList.add("ty-custom-scroll"),this.Nn=new nn(n,{vertical:!0}),this.Nn.trackY&&e.appendChild(this.Nn.trackY))}Rn(){this.Nn&&(this.Nn.trackY?.remove(),this.Nn.destroy(),this.Nn=null)}openDropdown(){const t=this.shadowRoot,n=t.querySelector(".dropdown-dialog");if(!n)return;const e=t.querySelector(".select-stub");e&&e.setAttribute("aria-expanded","true");const i=`select-${this.id||"anon"}-${_e(this)}`;this.Sn=i,Hn(i),n.showModal(),this.calculatePosition(),n.classList.add("open"),this.Dn.open=!0;const o=t.querySelector(".dropdown-chevron");o&&o.classList.add("open");const r=t.querySelector(".dropdown-search-chevron");r&&r.classList.add("open");const s=this.getTagElements().map(t=>this.getTagData(t));this.Dn.filteredTags=s,this.Dn.highlightedIndex=-1,this.updateOptionsVisibility(!0),this.Yn();const a=t.querySelector(".dropdown-search-input");a&&this.shouldShowSearch()&&setTimeout(()=>a.focus(),100),this.fireOpenEvent()}closeDropdown(){const t=this.shadowRoot,n=t.querySelector(".dropdown-dialog");if(!n)return;const e=t.querySelector(".select-stub");e&&e.setAttribute("aria-expanded","false"),this.Rn(),n.classList.remove("open"),n.classList.remove("position-above"),n.classList.remove("position-below"),n.close(),this.Sn&&(Nn(this.Sn),this.Sn=null),this.Dn.open=!1,this.Dn.highlightedIndex=-1;const i=t.querySelector(".dropdown-chevron");i&&i.classList.remove("open");const o=t.querySelector(".dropdown-search-chevron");o&&o.classList.remove("open");const r=""!==this.Dn.search;this.Dn.search="";const s=t.querySelector(".dropdown-search-input");if(s&&(s.value=""),this.zn)r&&(null!==this.Hn&&(clearTimeout(this.Hn),this.Hn=null),this.fireSearchEvent(""));else{const t=this.getTagElements().map(t=>this.getTagData(t));this.Dn.filteredTags=t,this.updateTagVisibility(t,t),this.clearHighlights(t)}this.fireCloseEvent()}openMobileModal(){const t=this.shadowRoot,n=t.querySelector(".mobile-dialog");if(!n)return;const e=t.querySelector(".select-stub");e&&e.setAttribute("aria-expanded","true");const i=`select-${this.id||"anon"}-${_e(this)}`;this.Sn=i,Hn(i),n.showModal(),n.getBoundingClientRect(),n.classList.add("open"),this.Dn.open=!0;const o=this.getTagElements().map(t=>this.getTagData(t));this.Dn.filteredTags=o,this.updateTagVisibility(o,o),requestAnimationFrame(()=>{this.updateMobileSelectedState()}),this.fireOpenEvent()}closeMobileModal(){const t=this.shadowRoot,n=t.querySelector(".mobile-dialog");if(!n)return;const e=t.querySelector(".select-stub");e&&e.setAttribute("aria-expanded","false"),n.classList.remove("open"),n.close(),this.Sn&&(Nn(this.Sn),this.Sn=null),this.Dn.open=!1,this.Dn.highlightedIndex=-1;const i=""!==this.Dn.search;this.Dn.search="";const o=t.querySelector(".mobile-search-input");o&&(o.value=""),this.zn?i&&(null!==this.Hn&&(clearTimeout(this.Hn),this.Hn=null),this.fireSearchEvent("")):this.getTagElements().forEach(t=>t.removeAttribute("hidden")),this.fireCloseEvent()}handleStubClick(t){t.preventDefault(),t.stopPropagation(),this.U||this.wn||this.openDropdown()}handleClearClick(t){t.preventDefault(),t.stopPropagation(),this.U||this.wn||(this.clear(),this.revealValidity())}handleStubKeydown(t){this.U||this.wn||this.Dn.open||"Enter"!==t.key&&" "!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.openDropdown())}handleTagClick(t){const n=t.target.closest("ty-option, ty-tag");n&&!n.hasAttribute("disabled")&&(t.preventDefault(),t.stopPropagation(),this.selectByTag(n))}selectByTag(t){const n=this.getTagData(t).value,e=this.getSelectedValues();if(!this.vn)return this.updateComponentValue([n],!0,"set",n),void("mobile"===this.Dn.mode?this.closeMobileModal():this.closeDropdown());if(e.includes(n)){const t=e.filter(t=>t!==n);this.updateComponentValue(t,!0,"remove",n)}else this.updateComponentValue([...e,n],!0,"add",n)}tryCreateFromSearch(){if(!this.$n)return!1;const t=(this.Dn.search||"").trim();if(!t)return!1;const n=t.toLowerCase(),e=this.getTagElements().map(t=>this.getTagData(t)).find(t=>t.value.toLowerCase()===n||t.text.toLowerCase()===n);if(e)return this.selectByTag(e.element),!0;const i=t,o="slug"===this.Cn?i.trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"").replace(/_+/g,"_").replace(/^_|_$/g,""):i;if(!o)return!0;const r={value:o,label:i},s=new CustomEvent("create",{detail:r,bubbles:!0,composed:!0,cancelable:!0});if(this.dispatchEvent(s),s.defaultPrevented)return!0;const a=r.value,l=document.createElement("ty-option");if(l.setAttribute("value",a),l.textContent=i,this.appendChild(l),!this.vn)return this.updateComponentValue([a],!0,"create",a),"mobile"===this.Dn.mode?this.closeMobileModal():this.closeDropdown(),!0;const c=this.getSelectedValues();return this.updateComponentValue([...c,a],!0,"create",a),this.clearSearchAfterCreate(),!0}clearSearchAfterCreate(){this.Dn.search="",this.Dn.highlightedIndex=-1;const t=this.shadowRoot;if(!t)return;const n=t.querySelector(".dropdown-search-input"),e=t.querySelector(".mobile-search-input");n&&(n.value=""),e&&(e.value="");const i=this.getTagElements().map(t=>this.getTagData(t));this.Dn.filteredTags=i,this.updateTagVisibility(i,i),this.updateOptionsVisibility(!0),this.clearHighlights(i),this.updateMobileSelectedState(),(n??e)?.focus()}blockSearchClick(t){t.stopPropagation(),t.preventDefault()}handleSearchInput(t){"mobile"===this.Dn.mode&&this.expandMobileSection("available");const n=t.target.value;if(this.Dn.search=n,this.zn)return void this.dispatchSearchEvent(n);const e=this.getTagElements().map(t=>this.getTagData(t)),i=this.filterTags(e,n);this.Dn.filteredTags=i,this.Dn.highlightedIndex=-1,this.updateTagVisibility(i,e),this.updateOptionsVisibility(i.length>0),this.updateMobileSelectedState(),this.clearHighlights(e)}handleKeyboard(t){if(!this.Dn.open)return;const n=this.shadowRoot.querySelector(".dropdown-search-input");if(t.target!==n&&document.activeElement===n)return;const e=this.Dn.filteredTags,i=e.length,o=this.Dn.highlightedIndex;switch(t.key){case"Escape":t.preventDefault(),t.stopPropagation(),"mobile"===this.Dn.mode?this.closeMobileModal():this.closeDropdown(),this.focus();break;case"Enter":t.preventDefault(),t.stopPropagation(),o>=0&&i>o?this.selectByTag(e[o].element):this.tryCreateFromSearch();break;case"ArrowUp":t.preventDefault(),t.stopPropagation();const n=this.nextEnabledTagIndex(e,o,-1);this.Dn.highlightedIndex=n,this.highlightTag(e,n);break;case"ArrowDown":t.preventDefault(),t.stopPropagation();const r=this.nextEnabledTagIndex(e,o,1);this.Dn.highlightedIndex=r,this.highlightTag(e,r)}}nextEnabledTagIndex(t,n,e){const i=t.length;if(0===i)return-1;let o=-1===n?1===e?0:i-1:(n+e+i)%i;for(let r=0;i>r;r++){if(!t[o].element.hasAttribute("disabled"))return o;o=(o+e+i)%i}return-1}filterTags(t,n){if(!n||""===n.trim())return t;const e=n.toLowerCase();return t.filter(({text:t})=>t.toLowerCase().includes(e))}updateTagVisibility(t,n){const e=new Set(t.map(t=>t.value));n.forEach(({value:t,element:n})=>{e.has(t)?n.removeAttribute("hidden"):n.setAttribute("hidden","")})}updateOptionsVisibility(t){const n=this.shadowRoot.querySelector(".dropdown-options");n&&(n.style.display=t?"":"none")}clearHighlights(t){t.forEach(({element:t})=>{t.removeAttribute("highlighted")})}highlightTag(t,n){if(this.clearHighlights(t),n>=0&&t.length>n){const{element:e}=t[n];e.setAttribute("highlighted",""),e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}dispatchSearchEvent(t){null!==this.Hn&&(clearTimeout(this.Hn),this.Hn=null),this.On>0?this.Hn=window.setTimeout(()=>{this.fireSearchEvent(t),this.Hn=null},this.On):this.fireSearchEvent(t)}fireSearchEvent(t){this.dispatchEvent(new CustomEvent("search",{detail:{query:t,element:this},bubbles:!0,composed:!0}))}fireOpenEvent(){this.dispatchEvent(new CustomEvent("open",{detail:{mode:this.Dn.mode,element:this}})),this.zn&&this.fireSearchEvent("")}fireCloseEvent(){this.dispatchEvent(new CustomEvent("close",{detail:{mode:this.Dn.mode,element:this}}))}dispatchChangeEvent(t){this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,cancelable:!0}))}render(){this.Dn.mode=Ee()?"mobile":"desktop","mobile"===this.Dn.mode?this.renderMobile():this.renderDesktop(),this.updateSearchVisibility(),this.applyLoadingState(),this.syncFieldChrome(),this.updateValidity()}syncFieldChrome(){const t=this.shadowRoot,n=t?.querySelector(".select-container");if(!t||!n)return;const e="select-label-"+_e(this);let i=n.querySelector(":scope > .ty-field-label");this.fn?(i||(i=document.createElement("label"),i.className="ty-field-label",i.id=e,n.prepend(i)),i.innerHTML=`${this.fn}${this.xn?`<span class="required-icon">${Mt}</span>`:""}`):i?.remove();const o=this.getProperty("error")||"",r="select-error-"+_e(this);let s=n.querySelector(":scope > .error-message");o?(s||(s=document.createElement("div"),s.className="error-message",s.id=r,n.append(s)),s.textContent=o):s?.remove();const a=t.querySelector(".select-stub");a&&(a.classList.toggle("disabled",this.U),a.classList.toggle("compact",this.mn),a.classList.toggle("error",!!o),a.tabIndex=this.U?-1:0,a.toggleAttribute("disabled",this.U),this.U?a.setAttribute("aria-disabled","true"):a.removeAttribute("aria-disabled"),this.fn?a.setAttribute("aria-labelledby",e):a.removeAttribute("aria-labelledby"),o?(a.setAttribute("aria-invalid","true"),a.setAttribute("aria-describedby",r)):(a.removeAttribute("aria-invalid"),a.removeAttribute("aria-describedby")));const l=o?this.querySelector(':scope > [slot="trigger"]'):null;this.Pn&&this.Pn!==l&&(this.Pn.removeAttribute("aria-invalid"),this.Pn.removeAttribute("aria-description")),l&&(l.setAttribute("aria-invalid","true"),l.setAttribute("aria-description",o)),this.Pn=l,t.querySelectorAll(".dropdown-search-input, .mobile-search-input").forEach(t=>t.disabled=this.U)}updateValidity(){if(this.disabled)this.applyValidity({});else if(this.required&&0===this.getSelectedValues().length){const t=this.shadowRoot?.querySelector(".select-stub");this.applyValidity({valueMissing:!0},f("select",{required:!0,multiple:this.vn}),t??void 0)}else this.applyValidity({})}setupTriggerSlot(){const t=this.shadowRoot,n=t.querySelector(".select-stub"),e=t.querySelector('slot[name="trigger"]');if(!n||!e)return;const i=()=>{const t=e.assignedElements().length>0;n.classList.toggle("custom-trigger",t),this.toggleAttribute("has-trigger",t)};e.addEventListener("slotchange",()=>{i(),this.syncFieldChrome()}),i()}setupEventListeners(){const t=this.shadowRoot,n=t.querySelector(".select-stub"),e=t.querySelector("#options-slot"),i=t.querySelector(".dropdown-search-input");n&&(this.An=this.handleStubClick.bind(this),n.addEventListener("click",this.An),n.addEventListener("keydown",this.handleStubKeydown.bind(this)));const o=t.querySelector(".select-clear");o?.addEventListener("click",this.handleClearClick.bind(this)),this.setupTriggerSlot(),e&&(this.Fn=this.handleTagClick.bind(this),e.addEventListener("click",this.Fn)),i&&(this.Vn=this.handleSearchInput.bind(this),this.jn=this.blockSearchClick.bind(this),i.addEventListener("input",this.Vn),i.addEventListener("click",this.jn));const r=t.querySelector(".dropdown-dialog");r&&(r.addEventListener("click",t=>{t.target===r&&this.closeDropdown()}),r.addEventListener("cancel",t=>{t.preventDefault(),this.closeDropdown(),this.focus()}),this.syncOnOutsideClose(r,()=>this.closeDropdown()))}buildStubClasses(){const t=[];return this.U&&t.push("disabled"),this.mn&&t.push("compact"),t.join(" ")}renderDesktop(){const t=this.shadowRoot;if(!t.querySelector(".select-container")){const n=this.buildStubClasses(),e="select-listbox-"+_e(this),i="select-label-"+_e(this);t.innerHTML=`\n<div class="select-container dropdown-mode-desktop">\n${this.fn?`\n<label class="ty-field-label" id="${i}">\n${this.fn}\n${this.xn?`<span class="required-icon">${Mt}</span>`:""}\n</label>\n`:""}\n<div class="dropdown-wrapper">\n<div class="dropdown-stub select-stub ${n}"\nrole="combobox"\naria-haspopup="listbox"\naria-expanded="false"\naria-controls="${e}"\n${this.fn?`aria-labelledby="${i}"`:""}\ntabindex="${this.U?"-1":"0"}"\n${this.U?'disabled aria-disabled="true"':""}>\n<slot name="trigger">\n<slot name="start"></slot>\n<slot name="selected"></slot>\n<span class="dropdown-placeholder">${this.yn}</span>\n<span class="select-count" hidden></span>\n<slot name="end"></slot>\n<button class="select-clear" type="button" aria-label="Clear selection" hidden>\n${De}\n</button>\n<div class="dropdown-chevron">\n${qe}\n</div>\n</slot>\n</div>\n<dialog class="dropdown-dialog">\n<div class="dropdown-header">\n<div class="dropdown-search-icon" aria-hidden="true">\n${Le}\n</div>\n<input\nclass="dropdown-search-input"\ntype="text"\nplaceholder="Search..."\n${this.U?"disabled":""}\n/>\n<div class="dropdown-search-chevron">\n${qe}\n</div>\n</div>\n<div class="dropdown-options-wrapper">\n<div class="dropdown-options" id="${e}" role="listbox" ${this.vn?'aria-multiselectable="true"':""}>\n<slot id="options-slot"></slot>\n</div>\n<div class="dropdown-loading" aria-hidden="true">\n<slot name="loading">\n<span class="dropdown-loading-spinner"></span>\n<span class="dropdown-loading-text">Searching…</span>\n</slot>\n</div>\n</div>\n</dialog>\n</div>\n</div>\n`,this.setupEventListeners()}this.updateSelectionDisplay()}renderMobile(){const t=this.shadowRoot;if(!t.querySelector(".select-container")){const n=this.buildStubClasses(),e="select-listbox-"+_e(this),i="select-label-"+_e(this);t.innerHTML=`\n<div class="select-container dropdown-mode-mobile">\n${this.fn?`\n<label class="ty-field-label" id="${i}">\n${this.fn}\n${this.xn?`<span class="required-icon">${Mt}</span>`:""}\n</label>\n`:""}\n<div class="dropdown-wrapper">\n<div class="dropdown-stub select-stub ${n}"\nrole="combobox"\naria-haspopup="listbox"\naria-expanded="false"\naria-controls="${e}"\n${this.fn?`aria-labelledby="${i}"`:""}\ntabindex="${this.U?"-1":"0"}"\n${this.U?'disabled aria-disabled="true"':""}>\n<slot name="trigger">\n<slot name="start"></slot>\n<slot name="selected"></slot>\n<span class="dropdown-placeholder">${this.yn}</span>\n<span class="select-count" hidden></span>\n<slot name="end"></slot>\n<button class="select-clear" type="button" aria-label="Clear selection" hidden>\n${De}\n</button>\n<div class="dropdown-chevron">\n${qe}\n</div>\n</slot>\n</div>\n<dialog class="mobile-dialog">\n<div class="mobile-dialog-content">\n\x3c!-- HEADER (matches dropdown.ts) --\x3e\n\n<div class="mobile-search-header">\n${this.fn?`<span class="mobile-header-label">${this.fn}</span>`:""}\n<div class="mobile-header-content">\n<div class="dropdown-search-icon" aria-hidden="true">\n${Le}\n</div>\n<input\nclass="mobile-search-input"\ntype="text"\nplaceholder="${this.fn?`Search ${this.fn}...`:"Search..."}"\nautofocus\n${this.U?"disabled":""}\n/>\n<button class="mobile-close-button" type="button" aria-label="Close">\n<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n<line x1="18" y1="6" x2="6" y2="18"></line>\n<line x1="6" y1="6" x2="18" y2="18"></line>\n</svg>\n</button>\n</div>\n</div>\n\n\x3c!-- BODY: options list with toggleable selected state --\x3e\n<div class="mobile-body" data-expanded="available">\n\x3c!-- SELECTED STRIP (pinned above the list, collapses when empty) --\x3e\n<div class="mobile-selected-section" data-empty="true">\n<button class="section-header" type="button" data-section="selected" aria-expanded="false">\n<span class="section-title">${this.qn} <span class="section-count">(0)</span></span>\n${qe}\n</button>\n<div class="section-content mobile-selected-chips"></div>\n</div>\n\x3c!-- AVAILABLE LIST (always visible, takes remaining space) --\x3e\n<div class="mobile-available-section" data-empty="false">\n<button class="section-header" type="button" data-section="available" aria-expanded="true">\n<span class="section-title">${this._n} <span class="section-count"></span></span>\n${qe}\n</button>\n<div class="section-content dropdown-options-wrapper" id="${e}" role="listbox" ${this.vn?'aria-multiselectable="true"':""}>\n<slot id="options-slot"></slot>\n<div class="empty-state">${this.Ln}</div>\n<div class="dropdown-loading" aria-hidden="true">\n<slot name="loading">\n<span class="dropdown-loading-spinner"></span>\n<span class="dropdown-loading-text">Searching…</span>\n</slot>\n</div>\n</div>\n</div>\n</div>\n</div>\n</dialog>\n</div>\n</div>\n`,this.setupMobileEventListeners()}this.updateSelectionDisplay()}setupMobileEventListeners(){const t=this.shadowRoot,n=t.querySelector(".select-stub"),e=t.querySelector("#options-slot"),i=t.querySelector(".mobile-search-input"),o=t.querySelector(".mobile-close-button"),r=t.querySelector(".mobile-dialog");n&&(n.addEventListener("click",t=>this.handleMobileStubClick(t)),n.addEventListener("keydown",t=>this.handleMobileStubKeydown(t)));const s=t.querySelector(".select-clear");s?.addEventListener("click",this.handleClearClick.bind(this)),this.setupTriggerSlot(),e&&e.addEventListener("click",t=>this.handleMobileTagClick(t)),i&&i.addEventListener("input",t=>this.handleSearchInput(t)),t.querySelectorAll(".mobile-body .section-header").forEach(t=>{t.addEventListener("click",()=>this.expandMobileSection("selected"===t.dataset.section?"selected":"available"))}),o&&o.addEventListener("click",()=>this.closeMobileModal()),r&&(r.addEventListener("click",t=>{t.target===r&&this.closeMobileModal()}),r.addEventListener("cancel",t=>{t.preventDefault(),this.closeMobileModal(),this.focus()}),this.syncOnOutsideClose(r,()=>this.closeMobileModal()))}syncOnOutsideClose(t,n){new MutationObserver(()=>{this.Dn.open&&!t.open&&n()}).observe(t,{attributes:!0,attributeFilter:["open"]})}handleMobileStubClick(t){t.preventDefault(),t.stopPropagation(),this.U||this.wn||this.openMobileModal()}handleMobileStubKeydown(t){this.U||this.wn||this.Dn.open||"Enter"!==t.key&&" "!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.openMobileModal())}handleMobileTagClick(t){this.handleTagClick(t)}updateMobileSelectedState(){if("mobile"!==this.Dn.mode)return;const t=this.shadowRoot;this.renderMobileSelectedChips();const n=t.querySelector(".mobile-available-section");if(n){const t=this.getTagElements().filter(t=>!t.hasAttribute("hidden")&&!t.hasAttribute("selected")).length;n.setAttribute("data-empty",(0===t)+""),this.setMobileSectionTitle(n,this._n,t)}}setMobileSectionTitle(t,n,e){const i=t.querySelector(".section-title");if(!i)return;const o=document.createElement("span");o.className="section-count",o.textContent=`(${e})`,i.replaceChildren(n+" ",o)}expandMobileSection(t){const n=this.shadowRoot,e=n?.querySelector(".mobile-body");e&&("selected"===t&&0===this.Dn.selectedValues.length||(e.dataset.expanded=t,n.querySelectorAll(".mobile-body .section-header").forEach(n=>{n.setAttribute("aria-expanded",(n.dataset.section===t)+"")})))}renderMobileSelectedChips(){const t=this.shadowRoot,n=t.querySelector(".mobile-selected-section"),e=t.querySelector(".mobile-selected-chips");if(!n||!e)return;const i=this.Dn.selectedValues;n.setAttribute("data-empty",(0===i.length)+""),this.setMobileSectionTitle(n,this.qn,i.length),0===i.length&&this.expandMobileSection("available");const o=t=>{const n=this.getTagElements().find(n=>this.getTagData(n).value===t);return n?this.getTagData(n).text:t};e.textContent="";for(const r of i){const t=document.createElement("button");t.type="button",t.className="mobile-selected-chip",t.dataset.value=r,t.setAttribute("aria-label","Remove "+o(r)),t.innerHTML='<span class="chip-label"></span>'+De,t.querySelector(".chip-label").textContent=o(r),t.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.deselectValue(r)}),e.appendChild(t)}}shouldShowSearch(){return!!this.zn||!!this.$n||!this.Mn&&this.getTagElements().length>7}updateSearchVisibility(){const t=this.shadowRoot;if(!t)return;const n=this.shouldShowSearch(),e=t.querySelector(".dropdown-header");e&&(e.hidden=!n);const i=t.querySelector(".mobile-search-input");i&&(i.hidden=!n);const o=t.querySelector(".mobile-header-content .dropdown-search-icon");o&&(o.hidden=!n)}updateSelectionDisplay(){const t=this.shadowRoot.querySelector(".select-stub");if(!t)return;const n=this.Dn.selectedValues,e=n.length;t.classList.toggle("has-selection",e>0),t.classList.toggle("compact",this.mn);const i=t.querySelector(".select-count");i&&(i.textContent=e+"",i.hidden=0===e||!this.vn||!this.mn);const o=t.querySelector(".select-clear");o&&(o.hidden=!(e>0&&this.kn&&!this.U&&!this.wn));const r=!this.vn&&e>0?n[0]:null;this.syncSelectedClone(r);const s=null!==this.Bn;t.classList.toggle("has-clone",s);const a=t.querySelector(".dropdown-placeholder");a&&(a.hidden=s,e>0&&this.vn&&!this.mn?(a.textContent=this.getSelectedItems(n).map(t=>t.label).join(", "),a.classList.remove("placeholder-shown")):null!==r?(a.textContent=n.join(", "),a.classList.remove("placeholder-shown")):(a.textContent=this.yn,a.classList.add("placeholder-shown")))}syncSelectedClone(t){const n=this.querySelector(':scope > [cloned][slot="selected"]');if(n?.getAttribute("value")===t&&(null===t||0!==n.childNodes.length||0>=(this.getTagElements().find(n=>this.getTagData(n).value===t)?.childNodes.length??0)))return void(this.Bn=n);if(n?.remove(),null===t)return void(this.Bn=null);const e=this.getTagElements().find(n=>this.getTagData(n).value===t);if(e){const t=e.cloneNode(!0);t.removeAttribute("selected"),t.setAttribute("slot","selected"),t.setAttribute("cloned","true"),this.appendChild(t),this.Bn=t,0===e.childNodes.length&&"loading"===document.readyState&&document.addEventListener("DOMContentLoaded",()=>{this.isConnected&&this.updateSelectionDisplay()},{once:!0})}else if(this.Bn?.getAttribute("value")===t){const t=this.Bn.cloneNode(!0);this.appendChild(t),this.Bn=t}}deselectValue(t){const n=this.getSelectedValues();n.includes(t)&&this.updateComponentValue(n.filter(n=>n!==t),!0,"remove",t)}clear(){this.updateComponentValue([],!0,"clear",null,!1)}get value(){return this.getSelectedValues().join(",")}set value(t){this.setProperty("value",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get multiple(){return this.getProperty("multiple")}set multiple(t){this.setProperty("multiple",t)}get compact(){return this.getProperty("compact")}set compact(t){this.setProperty("compact",t)}get placeholder(){return this.getProperty("placeholder")}set placeholder(t){this.setProperty("placeholder",t)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get loading(){return this.getProperty("loading")}set loading(t){this.setProperty("loading",t)}get readonly(){return this.getProperty("readonly")}set readonly(t){this.setProperty("readonly",t)}get noClear(){return this.getProperty("noClear")}set noClear(t){this.setProperty("noClear",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get error(){return this.getProperty("error")}set error(t){this.setProperty("error",t)}get notSearchable(){return this.getProperty("notSearchable")}set notSearchable(t){this.setProperty("notSearchable",t)}get externalSearch(){return this.getProperty("externalSearch")}set externalSearch(t){this.setProperty("externalSearch",t)}get debounce(){return this.getProperty("debounce")}set debounce(t){this.setProperty("debounce","string"==typeof t?parseInt(t,10):t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get align(){return this.getProperty("align")}set align(t){this.setProperty("align",t)}get placement(){return this.getProperty("placement")}set placement(t){this.setProperty("placement",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.removeAttribute(ft),this.setProperty("flavor",t)}attributeChangedCallback(t,n,e){"flavor"===t&&"danger"===e&&n===e&&this.removeAttribute(ft),super.attributeChangedCallback(t,n,e)}get form(){return this.C.form}};Ae.properties={value:{type:"string",visual:!0,formValue:!0,emitChange:!1,default:"",coerce:t=>Array.isArray(t)?t.join(","):null==t?"":t+""},name:{type:"string",default:""},multiple:{type:"boolean",visual:!0,default:!1},compact:{type:"boolean",visual:!0,default:!1},placeholder:{type:"string",visual:!0,default:"Select..."},label:{type:"string",visual:!0,default:""},disabled:{type:"boolean",visual:!0,default:!1},readonly:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1},error:{type:"string",visual:!0,default:""},noClear:{type:"boolean",visual:!0,default:!1},externalSearch:{type:"boolean",visual:!0,default:!1,aliases:{"external-search":!0}},allowCreate:{type:"boolean",visual:!0,default:!1,aliases:{"allow-create":!0}},createTransform:{type:"string",visual:!1,default:"none",aliases:{"create-transform":!0},coerce:t=>"slug"===t?"slug":"none"},notSearchable:{type:"boolean",visual:!0,default:!1},align:{type:"string",visual:!0,default:"start",validate:t=>["start","center","end"].includes(t),coerce:t=>"end"===t?"end":"center"===t?"center":"start"},placement:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},debounce:{type:"number",default:0,validate:t=>t>=0&&5e3>=t,coerce:t=>{const n=+t;return isNaN(n)?0:Math.max(0,Math.min(5e3,n))}},"available-label":{type:"string",visual:!0,default:"Available"},"selected-label":{type:"string",visual:!0,default:"Selected"},"no-options-message":{type:"string",visual:!0,default:"No options available"},loading:{type:"boolean",visual:!0,default:!1},flavor:{type:"string",visual:!0,default:"neutral"}};let Fe=Ae;function Ve(t,n){return t.replace(/\{([\w-]+)\}/g,(t,e)=>n[e]??t)}customElements.get("ty-select")||customElements.define("ty-select",Fe);class TySelectedOptions extends HTMLElement{constructor(){super(...arguments),this.Un=null,this.Zn=()=>this.renderChips(),this.Wn=null,this.Xn=null,this.Kn=null,this.Jn=!1,this.Gn=()=>{this.Jn=!0},this.Qn=()=>{this.Jn=!1,this.renderChips()}}static get observedAttributes(){return["for"]}connectedCallback(){this.style.display||(this.style.display="contents"),this.bind(),this.renderChips(),"loading"===document.readyState&&document.addEventListener("DOMContentLoaded",()=>{this.isConnected&&this.renderChips()},{once:!0}),this.Wn=new MutationObserver(()=>{this.template()!==this.Kn&&this.renderChips()}),this.Wn.observe(this,{childList:!0})}disconnectedCallback(){this.unbind(),this.Wn?.disconnect(),this.Wn=null}attributeChangedCallback(){this.isConnected&&(this.bind(),this.renderChips())}resolvePicker(){const t=this.getAttribute("for");return(t?document.getElementById(t):this.previousElementSibling)??null}bind(){const t=this.resolvePicker();t!==this.Un&&(this.unbind(),this.Un=t,this.Un?.addEventListener("change",this.Zn),this.Un?.addEventListener("open",this.Gn),this.Un?.addEventListener("close",this.Qn),this.Un&&(this.Xn=new MutationObserver(()=>this.renderChips()),this.Xn.observe(this.Un,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["selected"]})))}unbind(){this.Un?.removeEventListener("change",this.Zn),this.Un?.removeEventListener("open",this.Gn),this.Un?.removeEventListener("close",this.Qn),this.Xn?.disconnect(),this.Xn=null,this.Un=null,this.Jn=!1}values(){return(this.Un?.value??"").split(",").map(t=>t.trim()).filter(Boolean)}template(){return this.querySelector(":scope > template")}option(t){return this.Un?.querySelector(`[value="${CSS.escape(t)}"]:not([cloned])`)}context(t){const n=this.option(t),e={value:t,label:n?.getAttribute("label")||n?.textContent?.trim()||t,flavor:n?.getAttribute("flavor")??""};if(n)for(const i of Array.from(n.attributes))i.name.startsWith("data-")&&(e[i.name]=i.value);return e}templateSource(t){if(t.content.hasChildNodes())return t.content;const n=document.createDocumentFragment();return t.childNodes.forEach(t=>n.appendChild(t.cloneNode(!0))),n}stampTemplate(t,n){const e=this.context(n),i=this.templateSource(t).cloneNode(!0),o=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);for(let r=o.nextNode();r;r=o.nextNode())if(r.nodeType===Node.TEXT_NODE)r.textContent?.includes("{")&&(r.textContent=Ve(r.textContent,e));else{const t=r;for(const n of Array.from(t.attributes)){if(!n.value.includes("{"))continue;const i=Ve(n.value,e);!/^\{[\w-]+\}$/.test(n.value)||""!==i&&i!==n.value?t.setAttribute(n.name,i):t.removeAttribute(n.name)}}for(const r of Array.from(i.children))r.addEventListener("dismiss",t=>{t.stopPropagation(),this.deselect(n)});return i}defaultChip(t){const n=this.context(t),e=this.option(t),i=document.createElement("ty-tag");return i.setAttribute("value",t),i.setAttribute("dismissible","true"),n.flavor&&i.setAttribute("flavor",n.flavor),e&&!e.hasAttribute("label")&&e.hasChildNodes()?e.childNodes.forEach(t=>i.appendChild(t.cloneNode(!0))):i.textContent=n.label,i.addEventListener("dismiss",()=>this.deselect(t)),i}renderChips(){if(this.Jn)return;const t=this.template();if(this.Kn=t,!this.Un)return void this.replaceChildren(...t?[t]:[]);const n=document.createDocumentFragment();t&&n.appendChild(t);for(const e of this.values())n.appendChild(t?this.stampTemplate(t,e):this.defaultChip(e));this.replaceChildren(n)}deselect(t){if(!this.Un)return;const n=this.Un;"function"==typeof n.deselectValue?n.deselectValue(t):(n.value=this.values().filter(n=>n!==t).join(","),this.renderChips())}}customElements.get("ty-selected-options")||customElements.define("ty-selected-options",TySelectedOptions),customElements.get("ty-selected-tags")||customElements.define("ty-selected-tags",class extends TySelectedOptions{});const je=new WeakMap,Ie=new WeakMap,Oe=new WeakMap,He=new WeakMap,Ne=new WeakMap;let We=0;const Be=()=>{We++};addEventListener("pointerdown",Be,{capture:!0,passive:!0}),addEventListener("keydown",Be,{capture:!0,passive:!0});const Pe=new WeakMap;let Re=0;function Ye(t){return{placement:t.getAttribute("placement")||"top",fixed:t.hasAttribute("fixed")}}function Ue(t){return Array.from(t.querySelectorAll(":scope > ty-tab"))}function Ze(t){return t.getAttribute("id")}function Xe(t,n){return t.querySelector(`:scope > [slot='label-${n}']`)}function Ke(t,n){const e=Ze(n);return e&&function(t,n){return null!==Xe(t,n)}(t,e)?"slot":"text"}function Je(t){return t.hasAttribute("disabled")}function Ge(t,n){const e=t.findIndex(t=>Ze(t)===n);return 0>e?void 0:e}function Qe(t){return Oe.get(t)??null}function ti(t,n){const e=n.map(Ze).filter(t=>!!t),i=t.getAttribute("active");if(i&&e.includes(i))return i;const o=Oe.get(t);return o&&e.includes(o)?o:e[0]??null}function ni(t,n){t.setAttribute("active",n),hi(t,!0)}function ei(t,n,e){e.preventDefault(),e.stopPropagation(),ni(t,n)}function ii(t){const n=je.get(t);if(!n)return;const e=t.shadowRoot;e&&(n.tabClickHandlers.forEach((t,n)=>{const i=e.querySelector(`[data-tab-id='${n}']`);i&&i.removeEventListener("click",t)}),n.tabKeydownHandlers.forEach((t,n)=>{const i=e.querySelector(`[data-tab-id='${n}']`);i&&i.removeEventListener("keydown",t)}),n.tabClickHandlers.clear(),n.tabKeydownHandlers.clear())}function oi(t,n,e){ii(t);const i={tabClickHandlers:new Map,tabKeydownHandlers:new Map};e.forEach(e=>{const o=Ze(e);if(!o)return;const r=n.querySelector(`[data-tab-id='${o}']`);if(r){const e=n=>ei(t,o,n),s=e=>function(t,n,e,i){if(!["ArrowRight","ArrowLeft","Home","End"].includes(i.key))return;const o=Array.from(n.querySelectorAll(".tab-buttons [data-tab-id]:not([disabled])")).map(t=>t.getAttribute("data-tab-id")),r=o.indexOf(e);if(0>r||0===o.length)return;i.preventDefault();const s="Home"===i.key?o[0]:"End"===i.key?o[o.length-1]:"ArrowRight"===i.key?o[(r+1)%o.length]:o[(r-1+o.length)%o.length];s!==e&&(ei(t,s,i),requestAnimationFrame(()=>{n.querySelector(`.tab-buttons [data-tab-id='${s}']`)?.focus()}))}(t,n,o,e);r.addEventListener("click",e),r.addEventListener("keydown",s),i.tabClickHandlers.set(o,e),i.tabKeydownHandlers.set(o,s)}}),je.set(t,i)}function ri(t){return`translateX(${-100*t}%)`}function si(t){if(!t)return;const n=++Re+"";t.setAttribute("data-snap",n),requestAnimationFrame(()=>requestAnimationFrame(()=>{t.getAttribute("data-snap")===n&&t.removeAttribute("data-snap")}))}function ai(t,n,e){t.getAttribute(n)!==e&&t.setAttribute(n,e)}function li(t,n,e){Ue(t).forEach(i=>{const o=Ze(i);if(!o)return;const r=n.querySelector(`[data-tab-id='${o}']`),s=o===e;if(r){r.setAttribute("aria-selected",s+""),r.setAttribute("tabindex",s?"0":"-1"),r.setAttribute("data-active",s+"");const n=Xe(t,o);n&&ai(n,"data-active",s+"")}})}function ci(t,n){!function(t,n){const e=t.shadowRoot;if(!e)return;let i=He.get(t);if(!i){i=new CSSStyleSheet,i.replaceSync(":host {} ::slotted(ty-tab) {}");const n=i.cssRules[1].style;n.setProperty("opacity","0","important"),n.setProperty("visibility","hidden","important"),n.setProperty("pointer-events","none","important"),e.adoptedStyleSheets=[...e.adoptedStyleSheets,i],He.set(t,i)}const o=i.cssRules[0].style;for(const r of["width","height"]){const n=t.getAttribute(r);n?o.setProperty(r,n,"important"):o.removeProperty(r)}i.cssRules[1].selectorText=n?`::slotted(ty-tab:not(#${CSS.escape(n)}))`:"::slotted(ty-tab)"}(t,n),Ue(t).forEach(t=>{const e=Ze(t);t.setShown?.(!!e&&e===n),e&&ai(t,"data-active",(e===n)+"")})}function di(t,n,e=!1){const i=t.shadowRoot;if(!i)return;const o=i.querySelector(".marker-wrapper");if(!o)return;const r=function(t,n,e){const i=n.querySelector(`[data-tab-id='${e}']`),o=n.querySelector(".tab-buttons");return i&&o?{left:i.offsetLeft,top:i.offsetTop,width:i.offsetWidth,height:i.offsetHeight}:null}(0,i,n);if(!r)return;const s=e||!o.style.left||0===o.offsetWidth;s&&(o.style.transition="none"),o.style.left=r.left+"px",o.style.top=r.top+"px",o.style.width=r.width+"px",o.style.height=r.height+"px",s&&(o.style.transition="")}function hi(t,n=!1){const e=t.shadowRoot;if(!e)return;const i=Ue(t),o=Oe.get(t)??null,r=ti(t,i),s=(r?Ge(i,r):void 0)??0,a=e.querySelector(".tabs-container");if(r===o){const t=e.querySelector(".panels-wrapper");return void(t&&t.style.transform!==ri(s)&&(si(a),t.style.transform=ri(s)))}Oe.set(t,r);const l=null===o,c=!n&&null!==r&&Pe.get(t)===r;Pe.delete(t);const d=t.getAttribute("active");l&&d&&d!==r&&Pe.set(t,d);const h=!n&&(l||c||Ne.get(t)===We);if(l?Ne.set(t,We):c||Ne.delete(t),h&&si(a),function(t,n){const e=t.shadowRoot?.querySelector(".panels-wrapper");e&&(e.style.transform=ri(n))}(t,s),li(t,e,r||""),ci(t,r),!r||l)return;if(di(t,r,h),vi(t,r,!h),e.querySelectorAll(".tab-overflow-item").forEach(t=>{t.setAttribute("data-active",(t.dataset.tabId===r)+"")}),i[s]?.resetScroll?.(),c)return;const u=Ge(i,o);!function(t,n,e,i,o){const r=new CustomEvent("ty-tab-change",{detail:{activeId:n,activeIndex:e,previousId:i,previousIndex:o},bubbles:!0,cancelable:!1});t.dispatchEvent(r)}(t,r,s,void 0===u?null:o,u??null),i[s]?.te?.(s)}function ui(t,n){const e=Ze(n);if(e&&"slot"===Ke(t,n)){const n=Xe(t,e);return n?.textContent?.trim()||e}return n.getAttribute("label")||"Tab"}function pi(t){t.querySelector(".tab-overflow-trigger")?.remove()}function bi(t){const n=t.shadowRoot;if(!n)return;const e=n.querySelector(".tab-buttons"),i=n.querySelector(".tab-strip");if(!e||!i)return;if(Ye(t).fixed)return pi(n),i.classList.add("unclipped"),i.style.removeProperty("--fade-left"),void i.style.removeProperty("--fade-right");const o=i.scrollLeft;if(pi(n),0>=i.clientWidth)return;const r=i.querySelectorAll(".tab-button"),s=r[r.length-1],a=(s?s.offsetLeft+s.offsetWidth:0)-i.clientWidth;if(i.classList.toggle("unclipped",1>=a),1>=a)return i.scrollLeft=o,void gi(i);!function(t,n,e){const i=ti(t,e),o=document.createElement("button");o.className="tab-overflow-trigger",o.type="button",o.setAttribute("aria-label",e.length+" tabs"),o.textContent="⋯";const r=document.createElement("ty-popup");r.setAttribute("placement","bottom");const s=document.createElement("div");s.className="tab-overflow-menu",s.setAttribute("role","menu"),e.forEach(n=>{const e=Ze(n);if(!e)return;const o=document.createElement("button");o.type="button",o.className="tab-overflow-item",o.setAttribute("role","menuitem"),o.setAttribute("data-tab-id",e),o.setAttribute("data-active",(e===i)+""),o.textContent=ui(t,n),Je(n)?o.disabled=!0:o.addEventListener("click",()=>{ni(t,e),r.closePopup?.()}),s.appendChild(o)}),r.appendChild(s),o.appendChild(r),n.appendChild(o)}(t,e,Ue(t)),a>e.clientWidth-i.clientWidth||pi(n),i.scrollLeft=o,gi(i)}function gi(t){const n=t.scrollWidth-t.clientWidth,e=t=>(t>1?Math.min(28,t):0)+"px";t.style.setProperty("--fade-left",e(t.scrollLeft)),t.style.setProperty("--fade-right",e(n-t.scrollLeft))}function vi(t,n,e){const i=t.shadowRoot;if(!i)return;const o=i.querySelector(".tab-strip"),r=i.querySelector(`[data-tab-id='${n}']`);if(!o||!r||0>=o.clientWidth)return;const s=Math.max(0,Math.min(r.offsetLeft+r.offsetWidth/2-o.clientWidth/2,o.scrollWidth-o.clientWidth));if(Math.round(s)!==Math.round(o.scrollLeft)){const t=window.matchMedia("(prefers-reduced-motion: reduce)").matches;o.scrollTo({left:s,behavior:e&&!t?"smooth":"auto"})}}function mi(t){const n=t.shadowRoot;if(!n)return;const{placement:e,fixed:i}=Ye(t),o=Ue(t),r=ti(t,o),s=r?Ge(o,r)??0:0;o.forEach(n=>n.setPanelLabel?.(ui(t,n)));const a=n.querySelector(".tabs-container"),l=n.querySelector(".tab-buttons"),c=n.querySelector(".tab-strip"),d=n.querySelector(".panels-viewport");if(q(n,{css:'\n:host {\ndisplay: block;\nwidth: 100%;\nheight: 400px;\nbox-sizing: border-box;\n}\n.tabs-container {\nwidth: 100%;\nheight: 100%;\ndisplay: flex;\nflex-direction: column;\nposition: relative;\nbox-sizing: border-box;\n}\n.tabs-container[data-placement="bottom"] {\nflex-direction: column-reverse;\n}\n.tab-buttons {\ndisplay: flex;\ngap: 0;\nflex-shrink: 0;\nposition: relative;\nbackground: transparent;\n}\n.tab-buttons::after {\ncontent: "";\nposition: absolute;\nleft: 0;\nright: 0;\nbottom: 0;\nheight: 1px;\nbackground: var(--ty-tabs-separator, var(--ty-border));\npointer-events: none;\n}\n.tabs-container[data-placement="bottom"] .tab-buttons::after {\nbottom: auto;\ntop: 0;\n}\n.tab-strip {\ndisplay: flex;\nflex: 1 1 auto;\nmin-width: 0;\nposition: relative;\nz-index: 1;\noverflow-x: auto;\nscrollbar-width: none;\n--fade-left: 0px;\n--fade-right: 0px;\n-webkit-mask-image: linear-gradient(to right,\ntransparent, black var(--fade-left),\nblack calc(100% - var(--fade-right)), transparent);\nmask-image: linear-gradient(to right,\ntransparent, black var(--fade-left),\nblack calc(100% - var(--fade-right)), transparent);\n}\n.tab-strip::-webkit-scrollbar {\ndisplay: none;\n}\n.tab-strip.unclipped {\noverflow: visible;\n-webkit-mask-image: none;\nmask-image: none;\n}\n.marker-wrapper {\nposition: absolute;\nz-index: 0;\npointer-events: none;\ntransition: left var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out),\nwidth var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out),\nheight var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out),\ntop var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out);\n}\n.default-marker {\nposition: absolute;\nbottom: 0;\nleft: 0;\nheight: 3px;\nwidth: 100%;\nbackground: var(--ty-color-primary);\npointer-events: none;\n}\n.tabs-container[data-placement="bottom"] .default-marker {\nbottom: auto;\ntop: 0;\n}\n::slotted([slot="marker"]) {\ndisplay: block;\nwidth: 100%;\nheight: 100%;\nbox-sizing: border-box;\n}\n.tab-button {\nmin-width: var(--ty-tab-min-width, 72px);\nflex-shrink: 0;\npadding: 6px 12px;\nborder: none;\nbackground: transparent;\ncursor: pointer;\nfont: inherit;\ncolor: var(--ty-text-soft);\ntransition: var(--ty-local-transition, color 200ms, background-color 200ms);\nwhite-space: nowrap;\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\ngap: 8px;\nfont-weight: var(--ty-font-bold);\nfont-size: var(--ty-font-sm);\nposition: relative;\nz-index: 10;\n}\n.tabs-container[data-fixed] .tab-button {\nflex: 1 1 0;\nmin-width: 0;\n}\n.tabs-container[data-fixed] .tab-label {\noverflow: hidden;\ntext-overflow: ellipsis;\nwhite-space: nowrap;\n}\n.tab-button[aria-selected=true] {\ncolor: var(--ty-text-strong);\n}\n.tab-button[disabled] {\nopacity: 0.5;\ncursor: not-allowed;\npointer-events: none;\n}\n.tab-button:focus-visible {\noutline: 2px solid var(--ty-color-primary);\noutline-offset: -2px;\n}\n.tab-overflow-trigger {\nflex-shrink: 0;\nalign-self: center;\nmin-width: 36px;\nheight: 24px;\nmargin: 0 8px;\npadding: 0 10px;\nborder: 1px solid var(--ty-border);\nborder-radius: 9999px;\nbackground: transparent;\ncursor: pointer;\ncolor: var(--ty-text-soft);\nfont-size: 16px;\nline-height: 1;\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nposition: relative;\nz-index: 10;\ntransition: color 200ms, border-color 200ms;\n}\n.tab-overflow-trigger:hover {\ncolor: var(--ty-text-strong);\nborder-color: var(--ty-text-soft);\n}\n.tab-overflow-trigger:focus-visible {\noutline: 2px solid var(--ty-color-primary);\noutline-offset: -2px;\n}\n.tab-overflow-menu {\ndisplay: flex;\nflex-direction: column;\nmin-width: 160px;\nmax-height: 300px;\noverflow-y: auto;\npadding: var(--ty-spacing-2, 4px);\nbackground: var(--ty-surface-floating);\nborder-radius: var(--ty-radius-md);\nbox-shadow: var(--ty-shadow-md, 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1));\n}\n.tab-overflow-item {\npadding: var(--ty-spacing-2, 6px) var(--ty-spacing-3, 12px);\nborder: none;\nbackground: transparent;\ntext-align: left;\ncursor: pointer;\nborder-radius: var(--ty-radius-md);\ncolor: var(--ty-text);\nfont: inherit;\nfont-size: var(--ty-font-sm);\nwhite-space: nowrap;\n}\n.tab-overflow-item:hover {\nbackground: var(--ty-bg-neutral-soft);\ncolor: var(--ty-text-strong);\n}\n.tab-overflow-item[data-active="true"] {\ncolor: var(--ty-color-primary);\nfont-weight: var(--ty-font-bold);\n}\n.tab-overflow-item[disabled] {\nopacity: 0.5;\ncursor: not-allowed;\n}\n.panels-viewport {\nposition: relative;\nflex: 1;\noverflow: hidden;\nmin-height: 0;\n}\n.panels-wrapper {\ndisplay: flex;\nheight: 100%;\ntransition: transform var(--ty-tabs-transition-duration, 300ms) var(--ty-tabs-transition-easing, ease-in-out);\n}\n@media (prefers-reduced-motion: reduce) {\n.panels-wrapper {\ntransition-duration: 0ms !important;\n}\n.marker-wrapper {\ntransition-duration: 0ms !important;\n}\n}\n::slotted(ty-tab) {\nwidth: 100%;\nheight: 100%;\nflex-shrink: 0;\n}\n.tabs-container[data-snap] .panels-wrapper,\n.tabs-container[data-snap] ::slotted(ty-tab) {\ntransition: none;\n}\n',id:"ty-tabs"}),a&&l&&c&&d){a.setAttribute("data-placement",e),a.toggleAttribute("data-fixed",i);const s=c.scrollLeft;l.querySelector(".tab-overflow-trigger")?.remove(),c.querySelectorAll(".tab-button").forEach(t=>t.remove());const d=function(t,n,e){return n.map(n=>{const i=Ze(n);if(!i)return"";const o=Ke(t,n),r="text"===o?n.getAttribute("label")||"Tab":"",s=Je(n),a=i===e;return`<button\nclass="tab-button"\nrole="tab"\ndata-tab-id="${i}"\nid="tab-${i}"\naria-selected="${a}"\ntabindex="${a?"0":"-1"}"\ndata-active="${a}"\n${s?'disabled aria-disabled="true"':""}\n>\n${"slot"===o?`<slot name="label-${i}"></slot>`:`<span class="tab-label">${r}</span>`}\n</button>`}).join("")}(t,o,r),h=document.createElement("div");h.innerHTML=d,Array.from(h.children).forEach(t=>{c.appendChild(t)}),c.scrollLeft=s,oi(t,n,o),li(t,n,r||"");const u=!Oe.get(t);requestAnimationFrame(()=>{const n=Qe(t);bi(t),n&&(di(t,n,u),vi(t,n,!u))}),ci(t,r)}else{n.innerHTML=`\n<div class="tabs-container" data-placement="${e}"${i?" data-fixed":""}>\n${function(t,n,e){const i=n.map(n=>{const i=Ze(n);if(!i)return"";const o=Ke(t,n),r="text"===o?n.getAttribute("label")||"Tab":"",s=Je(n),a=i===e;return`<button\nclass="tab-button"\nrole="tab"\ndata-tab-id="${i}"\nid="tab-${i}"\naria-selected="${a}"\ntabindex="${a?"0":"-1"}"\ndata-active="${a}"\n${s?'disabled aria-disabled="true"':""}\n>\n${"slot"===o?`<slot name="label-${i}"></slot>`:`<span class="tab-label">${r}</span>`}\n</button>`}).join("");return`\n<div class="tab-buttons" part="buttons-container">\n<div class="tab-strip" role="tablist" part="strip">\n<div class="marker-wrapper" part="marker-wrapper">\n${o=t,null===o.querySelector(':scope > [slot="marker"]')?'<div class="default-marker"></div>':""}\n<slot name="marker"></slot>\n</div>\n${i}\n</div>\n</div>\n`;var o}(t,o,r)}\n<div class="panels-viewport" part="panels-container">\n<div class="panels-wrapper" style="transform: ${ri(s)}">\n<slot></slot>\n</div>\n</div>\n</div>\n`,requestAnimationFrame(()=>{const n=Qe(t);bi(t),n&&(di(t,n),vi(t,n,!1))}),oi(t,n,o),li(t,n,r||"");const a=n.querySelector(".tab-strip");a?.addEventListener("scroll",()=>gi(a),{passive:!0}),ci(t,r);const l=n.querySelector('slot[name="marker"]');if(l){const t=()=>{const t=n.querySelector(".default-marker");if(t){const n=l.assignedElements().length>0;t.style.display=n?"none":""}};l.addEventListener("slotchange",t),t()}}}class TyTabs extends HTMLElement{constructor(){super(),this.Wn=null,this.ne=!1,this.ee=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["width","height","active","placement","fixed"]}get activeTab(){return Oe.get(this)??null}connectedCallback(){mi(this),hi(this),function(t){const n=Ie.get(t);n&&n.disconnect();const e=new ResizeObserver(()=>{const n=Qe(t);bi(t),n&&(di(t,n),vi(t,n,!1))});e.observe(t),Ie.set(t,e)}(this),this.Wn=new MutationObserver(()=>this.ie(!0)),this.Wn.observe(this,{childList:!0})}disconnectedCallback(){this.Wn?.disconnect(),this.Wn=null,ii(this),function(t){const n=Ie.get(t);n&&(n.disconnect(),Ie.delete(t))}(this)}ie(t){this.ee||(this.ee=t),this.ne||(this.ne=!0,queueMicrotask(()=>{this.ne=!1,this.isConnected&&(this.Wn?.takeRecords().length&&(this.ee=!0),this.ee&&(this.ee=!1,mi(this)),hi(this))}))}attributeChangedCallback(t,n,e){this.isConnected&&("active"===t?(n!==e&&Pe.delete(this),this.ie(!1)):mi(this))}}customElements.get("ty-tabs")||customElements.define("ty-tabs",TyTabs);const yi=`\n:host {\nwidth: 100%;\nheight: 100%;\ndisplay: block;\nbox-sizing: border-box;\nflex-shrink: 0;\ntransition:\nopacity var(--ty-tabs-transition-duration, 400ms) var(--ty-tabs-transition-easing, ease-in-out),\nvisibility var(--ty-tabs-transition-duration, 400ms);\n}\n@media (prefers-reduced-motion: reduce) {\n:host {\ntransition-duration: 0ms !important;\n}\n}\n.tab-wrapper {\nwidth: 100%;\nheight: 100%;\nposition: relative;\noverflow: hidden;\n}\n.tab-panel {\nwidth: 100%;\nheight: 100%;\noverflow: auto;\nbox-sizing: border-box;\n}\n.tab-loading,\n.tab-error {\ndisplay: none;\nbox-sizing: border-box;\nmin-height: 100%;\nflex-direction: column;\nalign-items: center;\njustify-content: center;\ngap: 12px;\npadding: 24px;\ntext-align: center;\n}\n.tab-panel[data-load="loading"] .tab-loading,\n.tab-panel[data-load="failed"] .tab-error {\ndisplay: flex;\n}\n.tab-panel[data-load="loading"] .tab-loading {\nanimation: ty-tab-status-in 200ms ease-out 150ms both;\n}\n@keyframes ty-tab-status-in {\nfrom { opacity: 0; }\n}\n.tab-spinner {\ndisplay: inline-flex;\nwidth: 20px;\nheight: 20px;\ncolor: var(--ty-text-soft);\nanimation: var(--ty-loader-animation, ty-tab-spin 0.7s linear infinite);\n}\n.tab-spinner svg {\nwidth: 100%;\nheight: 100%;\n}\n@keyframes ty-tab-spin {\nto { transform: rotate(360deg); }\n}\n@media (prefers-reduced-motion: reduce) {\n.tab-spinner {\nanimation-duration: 1.6s;\n}\n}\n.tab-error {\ncolor: var(--ty-text-soft);\nfont-size: 14px;\n}\n.tab-retry {\nfont: inherit;\nfont-size: 13px;\npadding: 4px 14px;\nborder: 1px solid var(--ty-border);\nborder-radius: 9999px;\nbackground: transparent;\ncolor: var(--ty-text-strong);\ncursor: pointer;\n}\n.tab-retry:hover {\nborder-color: var(--ty-text-soft);\n}\n.tab-retry:focus-visible {\noutline: 2px solid var(--ty-color-primary);\noutline-offset: 2px;\n}\n.tab-panel.ty-custom-scroll {\nscrollbar-width: none;\n-ms-overflow-style: none;\n}\n.tab-panel.ty-custom-scroll::-webkit-scrollbar {\ndisplay: none;\n}\n.tab-wrapper:hover .ty-scrollbar-track-y.has-overflow {\nopacity: 1;\n}\n${en}\n`,fi=new Set(["loading","error"]),wi=new Set(["template","script","style"]);class TyTab extends HTMLElement{constructor(){super(),this.dn=null,this.oe=null,this.re=!0,this.se="idle",this.ae=null,this.le=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["id","label","disabled","lazy"]}connectedCallback(){this.ce(),this.dn||this.pn(),this.de()}setPanelLabel(t){this.oe=t,this.he()}setShown(t){this.re=t,this.he()}disconnectedCallback(){this.un(),this.le=!!this.ae?.takeRecords().length,this.ae?.disconnect(),this.ae=null}te(t){this.ae?.takeRecords().length&&this.ue(!1),"empty"!==this.se&&"failed"!==this.se||this.pe(t)}loadFailed(){"loading"!==this.se&&"empty"!==this.se||this.be("failed")}attributeChangedCallback(t,n,e){if(this.ce(),"lazy"===t)return void(this.isConnected&&this.de());const i=this.parentElement;n!==e&&this.isConnected&&"ty-tabs"===i?.localName&&i.ie?.(!0)}ce(){const t=this.shadowRoot;t&&(t.querySelector(".tab-wrapper")||(q(t,{css:yi,id:"ty-tab"}),t.innerHTML='\n<div class="tab-wrapper">\n<div class="tab-panel" role="tabpanel" tabindex="0">\n<slot></slot>\n</div>\n</div>\n'),this.he())}de(){const t=this.hasAttribute("lazy");t&&!this.ae?(this.ae=new MutationObserver(()=>this.ue(!0)),this.ae.observe(this,{childList:!0,characterData:!0,subtree:!0})):!t&&this.ae&&(this.ae.disconnect(),this.ae=null);const n=this.le;this.le=!1,this.ue(n)}ge(){for(const t of Array.from(this.childNodes)){if(t.nodeType===Node.TEXT_NODE&&t.textContent.trim())return!0;if(t.nodeType!==Node.ELEMENT_NODE)continue;const n=t;if(!fi.has(n.getAttribute("slot")??"")&&!wi.has(n.localName))return!0}return!1}ue(t){this.hasAttribute("lazy")&&!this.ge()?"idle"===this.se&&(this.be("empty"),t&&queueMicrotask(()=>{"empty"===this.se&&this.re&&"ty-tabs"===this.parentElement?.localName&&this.pe()})):this.be("idle")}pe(t){const n=this.parentElement;void 0===t&&(t="ty-tabs"===n?.localName?Array.from(n.querySelectorAll(":scope > ty-tab")).indexOf(this):0),this.be("loading"),this.dispatchEvent(new CustomEvent("ty-tab-load",{detail:{id:this.id,index:t}}))}ve(t){t.querySelector(".tab-loading")||(t.insertAdjacentHTML("beforeend",'\n<div class="tab-loading" part="loading">\n<slot name="loading"><span class="tab-spinner" part="spinner" aria-hidden="true"></span></slot>\n</div>\n<div class="tab-error" part="error" role="alert">\n<slot name="error">Couldn\'t load.</slot>\n<button type="button" class="tab-retry" part="retry">Retry</button>\n</div>\n'),t.querySelector(".tab-retry").addEventListener("click",()=>{t.focus({preventScroll:!0}),this.pe()}))}be(t){if(t===this.se)return;this.se=t;const n=this.shadowRoot?.querySelector(".tab-panel");n&&("loading"===t||"failed"===t?(this.ve(n),n.dataset.load=t):delete n.dataset.load,"loading"===t?(n.setAttribute("aria-busy","true"),n.querySelector(".tab-spinner").innerHTML=W()):n.removeAttribute("aria-busy"))}he(){const t=this.shadowRoot?.querySelector(".tab-panel");if(!t)return;const n=this.parentElement,e=!this.oe&&this.id&&"ty-tabs"===n?.localName?n.querySelector(`:scope > [slot="label-${CSS.escape(this.id)}"]`):null,i=this.oe||e?.textContent?.trim()||this.getAttribute("label");i?t.setAttribute("aria-label",i):t.removeAttribute("aria-label"),t.parentElement.inert=!this.re}pn(){const t=this.shadowRoot?.querySelector(".tab-panel"),n=this.shadowRoot?.querySelector(".tab-wrapper");t&&n&&tn()&&(t.classList.add("ty-custom-scroll"),this.dn=new nn(t,{vertical:!0}),this.dn.trackY&&n.appendChild(this.dn.trackY))}un(){this.dn&&(this.dn.trackY?.remove(),this.dn.destroy(),this.dn=null)}resetScroll(){this.dn?.scrollToTop(!1)}}customElements.get("ty-tab")||customElements.define("ty-tab",TyTab);const xi=new WeakMap;function ki(t){return Array.from(t.querySelectorAll("ty-step"))}function zi(t){return t.getAttribute("id")}function $i(t){const n=t.getAttribute("completed")||"";return n.trim()?new Set(n.split(",").map(t=>t.trim()).filter(Boolean)):new Set}function Ci(t,n){const e=t.findIndex(t=>zi(t)===n);return 0>e?void 0:e}function Mi(t,n){const e=t.getAttribute("active");return e&&void 0!==Ci(n,e)?e:n.length>0?zi(n[0]):null}function Ei(t){const n=xi.get(t);if(!n)return;const e=t.shadowRoot;e&&(n.stepClickHandlers.forEach((t,n)=>{const i=e.querySelector(`[data-step-id='${n}']`);i&&(i.removeEventListener("pointerdown",t),i.removeEventListener("click",t))}),n.stepClickHandlers.clear())}function Si(t,n,e){const i=ki(t),o=$i(t);i.forEach(i=>{const r=zi(i);if(!r)return;const s=n.querySelector(`[data-step-id='${r}']`),a=n.querySelector(`[data-step-id='${r}'] .step-circle`),l=r===e;s&&(s.setAttribute("aria-selected",l+""),s.setAttribute("tabindex",l?"0":"-1"),s.setAttribute("data-active",l+""));const c=_i(i,r,e,o);s?.setAttribute("data-state",c),a?.setAttribute("data-state",c);const d=t.querySelector(`[slot='indicator-${r}']`);d&&d.setAttribute("data-active",l+"")})}function Ti(t,n){ki(t).forEach(t=>{const e=zi(t);e&&t.setAttribute("data-active",(e===n)+"")})}function _i(t,n,e,i){const o=t.getAttribute("status");if(o&&["completed","active","pending","error"].includes(o))return o;const r=n===e,s=i.has(n);return r?"active":s?"completed":"pending"}const qi={completed:"completed",active:"current",pending:"not started",error:"has an error"};function Li(t){const n=t.shadowRoot;if(!n)return;const{width:e,height:i}=function(t){return{width:t.getAttribute("width")||"100%",height:t.getAttribute("height")||"",active:t.getAttribute("active"),completed:t.getAttribute("completed")||"",orientation:t.getAttribute("orientation")||"horizontal"}}(t),o=ki(t),r=Mi(t,o),s=$i(t);o.forEach(t=>{const n=zi(t);n&&(t.setAttribute("role","tabpanel"),t.setAttribute("aria-labelledby","step-"+n),t.setAttribute("tabindex","0"))}),q(n,{css:'\n:host {\ndisplay: block;\nwidth: var(--ty-wizard-width, 100%); \nbox-sizing: border-box;\n--ty-wizard-active-accent: var(--ty-color-primary);\n--ty-wizard-completed-accent: var(--ty-text-strong, var(--ty-color-neutral-strong));\n--ty-wizard-error-accent: var(--ty-color-danger);\n--ty-wizard-pending-accent: color-mix(in oklab, var(--ty-text, currentColor) 35%, transparent);\n--ty-wizard-bg: var(--ty-surface-elevated);\n--ty-wizard-border: var(--ty-border);\n--ty-wizard-radius: var(--ty-radius-lg, 12px);\n--ty-wizard-shadow: none;\n--ty-wizard-header-bg: transparent;\n--ty-wizard-header-border: var(--ty-wizard-border);\n--ty-wizard-header-padding: 14px 20px;\n--ty-wizard-progress-track: var(--ty-border);\n--ty-wizard-progress-fill: var(--ty-wizard-completed-accent);\n--ty-wizard-progress-height: 1.5px;\n--ty-wizard-transition-duration: var(--ty-transition-duration, 300ms);\n--ty-wizard-transition-easing: var(--ty-transition-easing, ease-in-out);\n--ty-wizard-circle-size: 24px;\n--ty-wizard-circle-border-width: 1.5px;\n--ty-wizard-panels-bg: transparent;\n--ty-wizard-focus-outline: var(--ty-wizard-active-accent);\n}\n.wizard-container {\ndisplay: flex;\nflex-direction: column;\nposition: relative;\nbox-sizing: border-box;\nborder-radius: var(--ty-wizard-radius);\nborder: 1px solid var(--ty-wizard-border);\nbackground: var(--ty-wizard-bg);\nbox-shadow: var(--ty-wizard-shadow);\noverflow: hidden;\n}\n.step-indicators-wrapper {\nflex-shrink: 0;\npadding: var(--ty-wizard-header-padding);\nborder-bottom: 1px solid var(--ty-wizard-header-border);\nbackground: var(--ty-wizard-header-bg);\n}\n.step-indicators {\ndisplay: flex;\nalign-items: center;\ngap: 12px;\n}\n.step-indicator {\ndisplay: flex;\nalign-items: center;\ngap: 8px;\nflex: 1 1 auto;\nmin-width: 0;\ncursor: pointer;\nbackground: transparent;\nborder: none;\npadding: 0;\nfont: inherit;\ncolor: inherit;\ntext-align: left;\noutline: none;\n}\n.step-indicator:last-child {\nflex: 0 0 auto;\n}\n.step-indicator:not(:last-child)::after {\ncontent: "";\nflex: 1 1 auto;\nmin-width: 16px;\nheight: var(--ty-wizard-progress-height);\nborder-radius: 1px;\nmargin-left: 4px;\nbackground: var(--ty-wizard-progress-track);\ntransition: background var(--ty-wizard-transition-duration) var(--ty-wizard-transition-easing);\n}\n.step-indicator[data-done="true"]:not(:last-child)::after {\nbackground: var(--ty-wizard-progress-fill);\n}\n.step-indicator[aria-disabled="true"] {\nopacity: 0.45;\ncursor: not-allowed;\npointer-events: none;\n}\n.step-indicator:focus-visible .step-circle {\noutline: 2px solid var(--ty-wizard-focus-outline);\noutline-offset: 2px;\n}\n.step-circle {\nwidth: var(--ty-wizard-circle-size);\nheight: var(--ty-wizard-circle-size);\nborder-radius: 50%;\nborder: var(--ty-wizard-circle-border-width) solid;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nbox-sizing: border-box;\nflex-shrink: 0;\nfont-size: calc(var(--ty-wizard-circle-size) * 0.46);\nfont-weight: 600;\nfont-variant-numeric: tabular-nums;\nline-height: 1;\ntransition: var(--ty-local-transition, background-color var(--ty-wizard-transition-duration) var(--ty-wizard-transition-easing), border-color var(--ty-wizard-transition-duration) var(--ty-wizard-transition-easing), color var(--ty-wizard-transition-duration) var(--ty-wizard-transition-easing));\n}\n.step-circle svg {\nwidth: 58%;\nheight: 58%;\n}\n.step-circle[data-state="completed"] {\nbackground: var(--ty-wizard-completed-accent);\nborder-color: var(--ty-wizard-completed-accent);\ncolor: oklch(\nfrom var(--ty-wizard-completed-accent)\nclamp(0, (var(--ty-solid-fg-threshold, 0.57) - l) * 1000, 1) 0 0\n);\n}\n.step-circle[data-state="active"] {\nbackground: color-mix(in oklab, var(--ty-wizard-active-accent) 12%, var(--ty-wizard-bg));\nborder-color: var(--ty-wizard-active-accent);\ncolor: color-mix(in oklab, var(--ty-wizard-active-accent) 75%, var(--ty-text-strong, currentColor));\n}\n.step-circle[data-state="pending"] {\nbackground: transparent;\nborder-color: var(--ty-wizard-pending-accent);\ncolor: var(--ty-text-soft, var(--ty-color-neutral));\n}\n.step-circle[data-state="error"] {\nbackground: color-mix(in oklab, var(--ty-wizard-error-accent) 12%, var(--ty-wizard-bg));\nborder-color: var(--ty-wizard-error-accent);\ncolor: color-mix(in oklab, var(--ty-wizard-error-accent) 75%, var(--ty-text-strong, currentColor));\n}\n.step-text {\ndisplay: flex;\nflex-direction: column;\ngap: 0;\nmin-width: 0;\n}\n.step-label {\nfont-size: var(--ty-font-sm, 14px);\nfont-weight: 500;\nline-height: 1.3;\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\ncolor: var(--ty-text-soft, var(--ty-color-neutral));\ntransition: var(--ty-local-transition, color 200ms);\n}\n.step-indicator[data-state="completed"] .step-label,\n.step-indicator[data-state="active"] .step-label {\ncolor: var(--ty-text-strong, var(--ty-color-neutral-strong));\n}\n.step-indicator[aria-selected="true"] .step-label {\nfont-weight: 600;\n}\n.step-indicator[data-state="error"] .step-label {\ncolor: var(--ty-wizard-error-accent);\n}\n.step-description {\nheight: 0;\nvisibility: hidden;\nfont-size: var(--ty-font-xs, 12px);\nline-height: 1.3;\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\ncolor: var(--ty-text-soft, var(--ty-color-neutral));\n}\n.step-indicator[aria-selected="true"] .step-description,\n.step-indicator[data-state="error"] .step-description {\nheight: auto;\nvisibility: inherit;\n}\n.step-indicator:hover:not([aria-selected="true"]) .step-label {\ncolor: var(--ty-text-strong, var(--ty-color-neutral-strong));\n}\n::slotted([slot^="indicator-"]) {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\n}\n.step-compact {\ndisplay: none;\nflex-direction: column;\ngap: 10px;\n}\n.compact-top {\ndisplay: flex;\nalign-items: baseline;\njustify-content: space-between;\ngap: 12px;\nmin-width: 0;\n}\n.compact-where {\ndisplay: flex;\nalign-items: baseline;\ngap: 6px;\nmin-width: 0;\nwhite-space: nowrap;\n}\n.compact-count {\nfont-size: var(--ty-font-xs, 12px);\ncolor: var(--ty-text-soft, var(--ty-color-neutral));\n}\n.compact-count::after {\ncontent: "·";\nmargin-left: 6px;\ncolor: var(--ty-text-faint, var(--ty-color-neutral));\n}\n.compact-label {\nfont-size: var(--ty-font-sm, 14px);\nfont-weight: 600;\ncolor: var(--ty-text-strong, var(--ty-color-neutral-strong));\noverflow: hidden;\ntext-overflow: ellipsis;\n}\n.compact-description {\nfont-size: var(--ty-font-xs, 12px);\ncolor: var(--ty-text-faint, var(--ty-color-neutral));\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\n}\n.compact-segments {\ndisplay: flex;\ngap: 4px;\n}\n.compact-segment {\nflex: 1;\nheight: 3px;\nborder-radius: 2px;\nbackground: var(--ty-wizard-progress-track);\ntransition: background var(--ty-wizard-transition-duration) var(--ty-wizard-transition-easing);\n}\n.compact-segment[data-state="completed"] { background: var(--ty-wizard-progress-fill); }\n.compact-segment[data-state="active"] { background: var(--ty-wizard-active-accent); }\n.compact-segment[data-state="error"] { background: var(--ty-wizard-error-accent); }\n.wizard-container.compact { flex-direction: column; }\n.wizard-container.compact .step-indicators {\nposition: absolute;\nvisibility: hidden;\npointer-events: none;\nwidth: max-content;\n}\n.wizard-container.compact .step-compact { display: flex; }\n.wizard-container.compact .step-indicators-wrapper {\npadding: var(--ty-wizard-header-padding);\nborder-right: none;\nborder-bottom: 1px solid var(--ty-wizard-header-border);\nmin-width: 0;\n}\n:host([orientation="vertical"]) .wizard-container:not(.compact) {\nflex-direction: row;\n}\n:host([orientation="vertical"]) .wizard-container:not(.compact) .step-indicators-wrapper {\nborder-bottom: none;\nborder-right: 1px solid var(--ty-wizard-header-border);\npadding: 20px 18px;\nmin-width: 170px;\nbox-sizing: border-box;\n}\n:host([orientation="vertical"]) .step-indicators {\nflex-direction: column;\nalign-items: stretch;\ngap: 0;\n}\n:host([orientation="vertical"]) .step-indicator {\nflex: 0 0 auto;\nalign-items: flex-start;\ngap: 10px;\nposition: relative;\npadding-bottom: 26px;\n}\n:host([orientation="vertical"]) .step-indicator:last-child {\npadding-bottom: 0;\n}\n:host([orientation="vertical"]) .step-text {\npadding-top: calc((var(--ty-wizard-circle-size) - var(--ty-font-sm, 14px) * 1.3) / 2);\n}\n:host([orientation="vertical"]) .step-indicator:not(:last-child)::after {\nposition: absolute;\nleft: calc(var(--ty-wizard-circle-size) / 2 - var(--ty-wizard-progress-height) / 2);\ntop: calc(var(--ty-wizard-circle-size) + 4px);\nbottom: 4px;\nwidth: var(--ty-wizard-progress-height);\nheight: auto;\nmin-width: 0;\nmargin: 0;\n}\n.panels-viewport {\nposition: relative;\nflex: 1;\nmin-width: 0;\nheight: var(--ty-wizard-panel-height, auto);\noverflow: hidden;\nbackground: var(--ty-wizard-panels-bg);\n}\n.panels-wrapper {\ndisplay: flex;\nheight: 100%;\ntransform: translateX(calc(var(--ty-wizard-active-index, 0) * -100%));\ntransition: transform var(--ty-wizard-transition-duration) var(--ty-wizard-transition-easing);\nwill-change: transform;\n}\n::slotted(ty-step) {\nflex: 0 0 100%;\nmin-width: 0;\ntransition: visibility 0s linear 0s;\n}\n::slotted(ty-step:not([data-active="true"])) {\nvisibility: hidden;\npointer-events: none;\ntransition: visibility 0s linear var(--ty-wizard-transition-duration);\n}\n@media (prefers-reduced-motion: reduce) {\n.panels-wrapper,\n::slotted(ty-step),\n::slotted(ty-step:not([data-active="true"])),\n.step-circle,\n.compact-segment,\n.step-indicator::after {\ntransition-duration: 0ms !important;\ntransition-delay: 0ms !important;\n}\n}\n.sr-only {\nposition: absolute;\nwidth: 1px;\nheight: 1px;\npadding: 0;\nmargin: -1px;\noverflow: hidden;\nclip: rect(0, 0, 0, 0);\nwhite-space: nowrap;\nborder-width: 0;\n}\n',id:"ty-wizard"}),t.style.setProperty("--ty-wizard-width",e),t.style.setProperty("--ty-wizard-active-index",Math.max(0,r?o.findIndex(t=>zi(t)===r):0)+""),i?t.style.setProperty("--ty-wizard-panel-height",i):t.style.removeProperty("--ty-wizard-panel-height");let a=n.querySelector(".wizard-container"),l=n.querySelector(".panels-viewport");a&&l||(n.innerHTML='\n<div class="wizard-container">\n<div class="panels-viewport" part="panels-container">\n<div class="panels-wrapper">\n<slot></slot>\n</div>\n</div>\n</div>\n',a=n.querySelector(".wizard-container"),l=n.querySelector(".panels-viewport")),n.querySelector(".step-indicators-wrapper")?.remove();const c=document.createElement("div");if(c.innerHTML=function(t,n,e,i){const o=n.length,r=Math.max(0,e?n.findIndex(t=>zi(t)===e):0),s=n.map((n,r)=>{const s=zi(n);if(!s)return"";const a=n.getAttribute("label")||"Step "+(r+1),l=n.getAttribute("description")||"",c=function(t){return t.hasAttribute("disabled")}(n),d=s===e,h=_i(n,s,e,i),u=function(t,n){return null!==t.querySelector(`[slot='indicator-${n}']`)}(t,s)?`<slot name="indicator-${s}"></slot>`:"completed"===h?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"></polyline></svg>':"error"===h?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" aria-hidden="true"><line x1="12" y1="5" x2="12" y2="13"></line><line x1="12" y1="18.5" x2="12" y2="18.6"></line></svg>':`<span aria-hidden="true">${r+1}</span>`;return`<button\nclass="step-indicator"\nrole="tab"\ntype="button"\ndata-step-id="${s}"\nid="step-${s}"\ndata-state="${h}"\ndata-done="${"completed"===h||"active"===h&&i.has(s)}"\naria-selected="${d}"\ntabindex="${d?"0":"-1"}"\ndata-active="${d}"\n${c?'disabled aria-disabled="true"':""}\n>\n<span class="step-circle" data-state="${h}" part="step-circle">${u}</span>\n<span class="step-text">\n<span class="step-label">${a}</span>\n${l?`<span class="step-description">${l}</span>`:""}\n<span class="sr-only">, step ${r+1} of ${o}, ${qi[h]??h}</span>\n</span>\n</button>`}).join(""),a=n[r],l=a?a.getAttribute("label")||"Step "+(r+1):"",c=a?.getAttribute("description")||"",d=n.map(t=>`<span class="compact-segment" data-state="${_i(t,zi(t)||"",e,i)}"></span>`).join("");return`\n<div class="step-indicators-wrapper" part="indicators-wrapper">\n<div class="step-indicators" role="tablist" aria-label="Steps">\n${s}\n</div>\n<div class="step-compact">\n<div class="compact-top">\n<span class="compact-where">\n<span class="compact-count">Step ${o?r+1:0} of ${o}</span>\n<span class="compact-label">${l}</span>\n</span>\n${c?`<span class="compact-description">${c}</span>`:""}\n</div>\n<div class="compact-segments" part="progress">${d}</div>\n</div>\n</div>\n`}(t,o,r,s),a.insertBefore(c.firstElementChild,l),function(t,n,e){Ei(t);const i={stepClickHandlers:new Map};e.forEach(e=>{const o=zi(e);if(!o)return;const r=n.querySelector(`[data-step-id='${o}']`);if(r){const n=n=>{"click"===n.type&&0!==n.detail||function(t,n,e){e.preventDefault(),e.stopPropagation();const i=ki(t),o=i.findIndex(t=>zi(t)===n);if(0>o)return;const r=Mi(t,i),s=r?Ci(i,r)??null:null,a=new CustomEvent("ty-wizard-step-change",{detail:{activeId:n,activeIndex:o,previousId:r,previousIndex:s,direction:null===s?"none":o>s?"forward":s>o?"backward":"none"},bubbles:!0,cancelable:!1});t.dispatchEvent(a)}(t,o,n)};r.addEventListener("pointerdown",n),r.addEventListener("click",n),i.stepClickHandlers.set(o,n)}}),xi.set(t,i)}(t,n,o),Si(t,n,r||""),r&&Ti(t,r),!Ai.has(t)){const n=new ResizeObserver(()=>Di(t));n.observe(t),Ai.set(t,n),document.fonts?.ready.then(()=>t.isConnected&&Di(t))}Di(t)}function Di(t){const n=t.shadowRoot,e=n?.querySelector(".wizard-container"),i=n?.querySelector(".step-indicators-wrapper"),o=n?.querySelector(".step-indicators");if(!e||!i||!o)return;let r;if("vertical"===t.getAttribute("orientation"))r=360>t.clientWidth;else{const t=Array.from(o.querySelectorAll(".step-indicator")),n=t=>parseFloat(t)||0;let e=n(getComputedStyle(o).columnGap)*Math.max(0,t.length-1);t.forEach((i,o)=>{const r=i.querySelector(".step-circle"),s=Array.from(i.querySelectorAll(".step-label, .step-description"));if(e+=(r?.offsetWidth??0)+n(getComputedStyle(i).columnGap)+Math.max(0,...s.map(t=>t.scrollWidth)),t.length-1>o){const t=getComputedStyle(i,"::after");e+=n(getComputedStyle(i).columnGap)+n(t.minWidth)+n(t.marginLeft)}});const s=getComputedStyle(i);r=e>i.clientWidth-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)+.5}e.classList.toggle("compact",r)}const Ai=new WeakMap;class TyWizard extends HTMLElement{constructor(){super(),this.Wn=null,this.me=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["width","height","active","completed","orientation"]}connectedCallback(){Li(this),this.Wn=new MutationObserver(t=>{t.some(t=>"childList"===t.type&&t.target===this||"TY-STEP"===t.target.tagName&&t.target.parentElement===this)&&!this.me&&(this.me=!0,queueMicrotask(()=>{this.me=!1,this.isConnected&&Li(this)}))}),this.Wn.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["status","label","description","disabled"]})}disconnectedCallback(){this.Wn?.disconnect(),this.Wn=null,Ei(this),Ai.get(this)?.disconnect(),Ai.delete(this)}attributeChangedCallback(t,n,e){"active"===t?(e&&function(t,n){const e=ki(t),i=t.shadowRoot;if(!i)return;const o=Mi(t,e),r=o?Ci(e,o):void 0,s=Ci(e,n);if(o===n||void 0===s)return;t.style.setProperty("--ty-wizard-active-index",s+""),Si(t,i,n),Ti(t,n);const a=e[s];a?.resetScroll&&a.resetScroll(),function(t,n,e,i,o){const r=new CustomEvent("ty-wizard-step-change",{detail:{activeId:n,activeIndex:e,previousId:i,previousIndex:o,direction:null===o?"none":e>o?"forward":o>e?"backward":"none"},bubbles:!0,cancelable:!1});t.dispatchEvent(r)}(t,n,s,o,r??null)}(this,e),Li(this)):Li(this)}}customElements.get("ty-wizard")||customElements.define("ty-wizard",TyWizard);const Fi=`\n:host {\nheight: var(--ty-wizard-panel-height, auto);\ndisplay: block;\nbox-sizing: border-box;\n}\n.step-wrapper {\nwidth: 100%;\nheight: 100%;\nposition: relative;\noverflow: hidden;\n}\n.step-panel {\nwidth: 100%;\nheight: 100%;\noverflow: auto;\nbox-sizing: border-box;\n}\n.step-panel.ty-custom-scroll {\nscrollbar-width: none;\n-ms-overflow-style: none;\n}\n.step-panel.ty-custom-scroll::-webkit-scrollbar {\ndisplay: none;\n}\n.step-wrapper:hover .ty-scrollbar-track-y.has-overflow {\nopacity: 1;\n}\n${en}\n`;class TyStep extends HTMLElement{constructor(){super(),this.dn=null,this.attachShadow({mode:"open"})}static get observedAttributes(){return["id","label","description","disabled","status"]}connectedCallback(){this.ce()}disconnectedCallback(){this.un()}attributeChangedCallback(t,n,e){this.ce()}ce(){const t=this.shadowRoot;if(!t)return;const n=this.getAttribute("id");t.querySelector(".step-wrapper")||(q(t,{css:Fi,id:"ty-step"}),t.innerHTML=`\n<div class="step-wrapper"\nrole="tabpanel"\n${n?`id="panel-${n}"`:""}\n${n?`aria-labelledby="step-${n}"`:""}\n>\n<div class="step-panel">\n<slot></slot>\n</div>\n</div>\n`,this.pn())}pn(){const t=this.shadowRoot?.querySelector(".step-panel"),n=this.shadowRoot?.querySelector(".step-wrapper");t&&n&&tn()&&(t.classList.add("ty-custom-scroll"),this.dn=new nn(t,{vertical:!0}),this.dn.trackY&&n.appendChild(this.dn.trackY))}un(){this.dn&&(this.dn.trackY?.remove(),this.dn.destroy(),this.dn=null)}resetScroll(){this.dn?.scrollToTop(!1)}}customElements.get("ty-step")||customElements.define("ty-step",TyStep);const Vi=(t,n)=>{const e=e=>n?`var(--ty-color-${t}${e}, var(--ty-color-${n}${e}))`:`var(--ty-color-${t}${e})`,i=e=>n?`var(--ty-solid-${t}${e}, var(--ty-solid-${n}${e}))`:`var(--ty-solid-${t}${e})`;return`\n:host([flavor="${t}"]) {\n--calendar-month-accent: ${e("")};\n--calendar-month-selected-bg: ${i("")};\n--calendar-month-selected-color: ${i("-fg")};\n--calendar-month-selected-hover-bg: ${i("-hover")};\n}\n:host([flavor="${t}+"]) {\n--calendar-month-accent: ${e("-strong")};\n--calendar-month-selected-bg: ${i("-strong")};\n--calendar-month-selected-color: ${i("-strong-fg")};\n--calendar-month-selected-hover-bg: color-mix(in oklab, ${i("-strong")} 85%, ${i("-strong-fg")});\n}\n:host([flavor="${t}-"]) {\n--calendar-month-accent: ${e("-soft")};\n--calendar-month-selected-bg: ${i("-soft")};\n--calendar-month-selected-color: ${i("-soft-fg")};\n--calendar-month-selected-hover-bg: color-mix(in oklab, ${i("-soft")} 85%, ${i("-soft-fg")});\n}\n`},ji=n.map(t=>Vi(t)).join(""),Ii=`\n.calendar-flex-container {\ndisplay: flex;\nflex-direction: column;\nbox-sizing: border-box;\ngap: 0;\npadding: 0.75rem;\nborder-radius: var(--ty-radius-md);\nfont-family: inherit;\nuser-select: none;\nwidth: var(--calendar-width, fit-content);\nmin-width: var(--ty-calendar-width, 280px);\nmax-width: var(--calendar-max-width, none);\n}\n.calendar-row {\ndisplay: flex;\nflex: 1;\nmin-height: 0;\n}\n.calendar-header-row {\nflex: 0 0 auto;\ncolor: var(--ty-calendar-header-color, var(--ty-color-neutral-soft));\n}\n.calendar-day-row {\nflex: 1;\nmin-height: 2rem;\nmargin-bottom: 0.125rem;\n}\n.calendar-cell {\nflex: 1;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nmin-width: 0;\nposition: relative;\nbox-sizing: border-box;\n}\n.calendar-header-cell {\ntext-align: center;\nfont-weight: 500;\npadding: 0.25rem;\n}\n.calendar-day-cell {\naspect-ratio: 1;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nflex-direction: column;\nmargin: 0.125rem;\nborder-radius: var(--ty-calendar-day-radius, 0.5rem);\nborder: 1px solid var(--ty-calendar-day-border, transparent);\nbackground-color: var(--ty-calendar-day-bg, transparent);\ncolor: var(--ty-calendar-day-color, var(--ty-calendar-muted, var(--ty-text)));\ncursor: pointer;\ntransition: var(--ty-local-transition, background-color 0.15s ease, color 0.15s ease);\nfont-weight: 400;\nfont-variant-numeric: tabular-nums;\n}\n.calendar-day-cell:hover {\ncolor: var(--ty-calendar-day-hover-color, var(--ty-text-strong));\nbackground-color: var(--ty-calendar-day-hover-bg, var(--ty-bg-neutral));\nborder-color: var(--ty-calendar-day-hover-border, transparent);\nfont-weight: 500;\n}\n.calendar-day-cell:focus-visible {\noutline: none;\nbox-shadow: 0 0 0 2px var(--calendar-month-accent, var(--ty-color-primary));\n}\n.calendar-day-cell.today {\nbackground-color: var(--ty-calendar-today-bg, transparent);\ncolor: var(--ty-calendar-today-color, var(--ty-calendar-today-accent, var(--calendar-month-accent, var(--ty-color-primary))));\nborder-color: var(--ty-calendar-today-border, transparent);\nfont-weight: 600;\n}\n.calendar-day-cell.today:hover {\nbackground-color: var(--ty-calendar-day-hover-bg, var(--ty-bg-neutral));\n}\n.calendar-day-cell.today.default-content::after {\ncontent: "";\nposition: absolute;\ntop: calc(50% + 0.72em);\nleft: 50%;\nwidth: 4px;\nheight: 4px;\nmargin-left: -2px;\nborder-radius: 50%;\nbackground: currentColor;\n}\n.calendar-day-cell.weekend {\ncolor: var(--ty-calendar-weekend-color, var(--ty-calendar-day-color, var(--ty-text)));\n}\n.calendar-day-cell.other-month {\ncolor: var(--ty-calendar-other-month-color, color-mix(in oklab, var(--ty-text-faint) 65%, transparent));\n}\n.calendar-day-cell.other-month:hover {\ncolor: var(--ty-calendar-day-hover-color, var(--ty-text-soft, var(--ty-text-)));\nbackground-color: var(--ty-calendar-day-hover-bg, var(--ty-bg-neutral-soft));\n}\n.calendar-day-cell.disabled {\ncolor: var(--ty-calendar-disabled-color, var(--ty-text-faint));\nopacity: var(--ty-calendar-disabled-opacity, 0.7);\ntext-decoration: line-through;\ntext-decoration-color: color-mix(in oklab, currentColor 60%, transparent);\ncursor: default;\npointer-events: none;\n}\n.calendar-day-cell.selected {\nbackground-color: var(--ty-calendar-selected-bg, var(--ty-calendar-accent, var(--calendar-month-selected-bg, var(--ty-solid-primary, var(--ty-color-primary)))));\ncolor: var(--ty-calendar-selected-color, var(--calendar-month-selected-color, var(--ty-solid-primary-fg, white)));\nborder-color: var(--ty-calendar-selected-border, transparent);\nfont-weight: 600;\n}\n.calendar-day-cell.selected:hover {\nbackground-color: var(--ty-calendar-selected-hover-bg, var(--calendar-month-selected-hover-bg, color-mix(in oklab, var(--ty-calendar-selected-bg, var(--ty-calendar-accent, var(--calendar-month-selected-bg, var(--ty-solid-primary, var(--ty-color-primary))))) 85%, var(--ty-calendar-selected-color, var(--calendar-month-selected-color, var(--ty-solid-primary-fg, white))))));\ncolor: var(--ty-calendar-selected-color, var(--calendar-month-selected-color, var(--ty-solid-primary-fg, white)));\nborder-color: var(--ty-calendar-selected-hover-border, var(--ty-calendar-selected-border, transparent));\n}\n.calendar-day-cell.selected.other-month {\nopacity: 0.7;\n}\n.calendar-size-sm {\npadding: 0.5rem;\nmin-width: var(--ty-calendar-width, 240px);\n}\n.calendar-size-sm .calendar-header-cell {\nfont-size: 0.625rem;\npadding: 0.125rem;\n}\n.calendar-size-sm .calendar-day-cell {\nfont-size: 0.75rem;\nmargin: 0.0625rem;\n}\n.calendar-size-sm .calendar-day-row {\nmin-height: 1.5rem;\n}\n.calendar-size-md {\npadding: 0.75rem;\nmin-width: var(--ty-calendar-width, 280px);\n}\n.calendar-size-md .calendar-header-cell {\nfont-size: 0.6875rem;\npadding: 0.25rem;\n}\n.calendar-size-md .calendar-day-cell {\nfont-size: 0.8125rem;\nmargin: 0.125rem;\n}\n.calendar-size-md .calendar-day-row {\nmin-height: 2rem;\n}\n.calendar-size-lg {\npadding: 1rem;\nmin-width: var(--ty-calendar-width, 360px);\n}\n.calendar-size-lg .calendar-header-cell {\nfont-size: 0.75rem;\npadding: 0.375rem;\n}\n.calendar-size-lg .calendar-day-cell {\nfont-size: 0.875rem;\nmargin: 0.1875rem;\n}\n.calendar-size-lg .calendar-day-row {\nmin-height: 2.5rem;\n}\n.calendar-day {\nwidth: 100%;\nheight: 100%;\ndisplay: flex;\nflex-direction: column;\nalign-items: center;\njustify-content: center;\nbox-sizing: border-box;\n}\n${ji}\n`;function Oi(t){if(!Number.isInteger(t)||1>t||t>12)throw new RangeError(`Invalid month: ${t}. Must be an integer between 1 and 12.`)}function Hi(t,n,e,i){const o=t.getFullYear(),r=t.getMonth()+1,s=t.getDate(),a=t.getDay(),l=o!==n||r!==e;let c=!1,d=!1;l&&(n>o||o===n&&e>r?c=!0:d=!0);const h=(p=function(){const t=new Date;return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)}(),(u=t).getFullYear()===p.getFullYear()&&u.getMonth()===p.getMonth()&&u.getDate()===p.getDate());var u,p;const b=i?.year===o&&i?.month===r&&i?.day===s;return{value:Date.UTC(o,r-1,s,0,0,0,0),localValue:t.getTime(),year:o,month:r,dayInMonth:s,weekend:0===a||6===a,otherMonth:l,prevMonth:c,nextMonth:d,today:h,isSelected:b,selectedYear:i?.year,selectedMonth:i?.month,selectedDay:i?.day}}function Ni(t,n){const e=new Date(t);return e.setDate(e.getDate()+n),e}function Wi(t,n="en-US",e="long"){Oi(t);const i=new Date(2024,t-1,1);return new Intl.DateTimeFormat(n,{month:e}).format(i)}function Bi(t){const n=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!n)return null;const e=parseInt(n[1],10),i=parseInt(n[2],10),o=parseInt(n[3],10);if(1>e||e>9999)return null;if(1>i||i>12)return null;if(1>o||o>31)return null;const r=new Date(e,i-1,o);return r.getFullYear()!==e||r.getMonth()!==i-1||r.getDate()!==o?null:{year:e,month:i,day:o}}function Pi(t){return t instanceof HTMLElement}function Ri(t){if(!t)return null;const n=Bi(t);return n?Date.UTC(n.year,n.month-1,n.day):null}function Yi(t){if(!t||""===t)return null;const n=t+"";return/^\d+(\.\d+)?$/.test(n)?n+"px":n}class TyCalendarMonth extends HTMLElement{constructor(){super(),this.ye="en-US",this.Tn="md",this.j=null,this.fe=null,this.we=[];const t=new Date;this.xe=t.getFullYear(),this.ke=t.getMonth()+1,this.attachShadow({mode:"open"}),M(this)}static get observedAttributes(){return["display-year","display-month","locale","size","min","max","flavor"]}connectedCallback(){this.ke||(this.ke=(new Date).getMonth()+1),this.xe||(this.xe=(new Date).getFullYear()),this.ye||(this.ye=this.getAttribute("locale")||"en-US");const t=this.getAttribute("size");!t||"sm"!==t&&"md"!==t&&"lg"!==t||(this.Tn=t),E(this),this.lt=Ct(this,()=>{this.render()}),this.O(),this.render()}disconnectedCallback(){this.lt&&(this.lt(),this.lt=void 0)}attributeChangedCallback(t,n,e){if("display-year"===t||"display-month"===t){const n=+e;Number.isInteger(n)&&("display-year"===t?n>0:n>=1&&12>=n)&&("display-year"===t?this.displayYear=n:this.displayMonth=n)}else"locale"===t?(this.ye=e||"en-US",this.render()):"size"===t?"sm"!==e&&"md"!==e&&"lg"!==e||(this.Tn=e,this.render()):"min"===t||"max"===t?(this["min"===t?"ze":"$e"]=e??void 0,this.render()):"flavor"===t&&this.O()}O(){this.j=O(this.shadowRoot,this.j,this.getAttribute("flavor"),({base:t})=>(t=>Vi(t,"neutral"))(t))}get displayYear(){return this.xe}set displayYear(t){this.xe!==t&&(this.xe=t,this.fe=null,this.render())}get displayMonth(){return this.ke}set displayMonth(t){this.ke!==t&&(this.ke=t,this.fe=null,this.render())}get locale(){return $t(this,this.getAttribute("locale"))}set locale(t){this.ye!==t&&(this.ye=t,this.render())}get size(){return this.Tn}set size(t){this.Tn!==t&&(this.Tn=t,this.render())}get flavor(){return this.getAttribute("flavor")||"primary"}set flavor(t){t?this.setAttribute("flavor",t):this.removeAttribute("flavor")}get width(){return this.Ce}set width(t){this.Ce!==t&&(this.Ce=t,this.applyWidthProperties())}get minWidth(){return this.Me}set minWidth(t){this.Me!==t&&(this.Me=t,this.applyWidthProperties())}get maxWidth(){return this.Ee}set maxWidth(t){this.Ee!==t&&(this.Ee=t,this.applyWidthProperties())}get dayContentFn(){return this.Se}set dayContentFn(t){this.Se!==t&&(this.Se=t,this.render())}get customCSS(){return this.Te}set customCSS(t){this.Te!==t&&(this.Te=t,this.applyCustomCSS())}get min(){return this.ze}set min(t){this.ze!==t&&(this.ze=t,this.render())}get max(){return this.$e}set max(t){this.$e!==t&&(this.$e=t,this.render())}get value(){return this.R}set value(t){const n=t??void 0;this.R!==n&&(this.R=n,this.render())}applyWidthProperties(){const t=Yi(this.Ce),n=Yi(this.Me),e=Yi(this.Ee);t?this.style.setProperty("--calendar-width",t):this.style.removeProperty("--calendar-width"),n?this.style.setProperty("--calendar-min-width",n):this.style.removeProperty("--calendar-min-width"),e?this.style.setProperty("--calendar-max-width",e):this.style.removeProperty("--calendar-max-width")}applyCustomCSS(){if(!this.Te||!this.shadowRoot)return;const t=this.shadowRoot.adoptedStyleSheets;t.includes(this.Te)||(this.shadowRoot.adoptedStyleSheets=[...t,this.Te])}refresh(){this.render()}dispatchDayClick(t,n){const e={dayContext:t,value:t.value,year:t.year,month:t.month,day:t.dayInMonth,isHoliday:t.holiday,isToday:t.today,isWeekend:t.weekend,isOtherMonth:t.otherMonth};for(const i of["day-click","day-select"]){const t=new CustomEvent(i,{detail:e,bubbles:!0,cancelable:!0});this.dispatchEvent(t)}}renderDayCell(t,n,e){const i=document.createElement("div"),o=this.Se?this.Se(t):function(t){return""+t.dayInMonth}(t);if(this.Se&&o&&!Pi(o)&&"string"!=typeof o)throw Error(`Custom dayContentFn must return a DOM element or string, got: ${typeof o}. Use document.createElement() to create DOM elements.`);const r=function(t){const n=["calendar-day"];return t.today&&n.push("today"),t.weekend&&n.push("weekend"),t.otherMonth&&n.push("other-month"),t.isSelected&&n.push("selected"),n}(t);return n&&r.push("disabled"),this.Se||r.push("default-content"),i.className=r.join(" "),"string"==typeof o?i.textContent=o:Pi(o)&&i.appendChild(o),i.setAttribute("role","gridcell"),i.setAttribute("aria-label",new Intl.DateTimeFormat(this.ye,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(new Date(t.localValue))),i.setAttribute("aria-selected",!!t.isSelected+""),t.today&&i.setAttribute("aria-current","date"),n?(i.setAttribute("aria-disabled","true"),i.setAttribute("tabindex","-1")):(i.setAttribute("tabindex",e?"0":"-1"),i.addEventListener("click",n=>{this.dispatchDayClick(t,n)}),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.dispatchDayClick(t,n))})),i}render(){const t=this.shadowRoot;if(!t)return;let n;if(q(t,{css:Ii,id:"ty-calendar-month"}),this.applyCustomCSS(),this.applyWidthProperties(),this.R){const t=new Date(this.R);n={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}const e=function(t,n,e){return function(t){if(!Number.isInteger(t)||1>t||t>9999)throw new RangeError(`Invalid year: ${t}. Must be an integer between 1 and 9999.`)}(t),Oi(n),function(t,n,e,i,o){const r=[];for(let s=0;42>s;s++){const n=Ni(t,s);r.push(Hi(n,e,i,o))}return r}(function(t,n){const e=function(t,n){return new Date(t,n-1,1,0,0,0,0)}(t,n);return function(t){const n=t.getDay(),e=0===n?6:n-1,i=new Date(t);return i.setDate(t.getDate()-e),i.setHours(0,0,0,0),i}(e)}(t,n),0,t,n,e)}(this.xe,this.ke,n),i=function(t,n="short"){const e=new Intl.DateTimeFormat(t,{weekday:n}),i=new Date(2024,0,7),o=Array.from({length:7},(t,n)=>{const o=Ni(i,n);return e.format(o)}),[r,...s]=o;return[...s,r]}(this.ye,"short");t.innerHTML="";const o=document.createElement("div");o.className="calendar-flex-container calendar-size-"+this.Tn,o.setAttribute("role","grid"),o.setAttribute("aria-label",new Intl.DateTimeFormat(this.ye,{month:"long",year:"numeric"}).format(new Date(this.xe,this.ke-1,1)));const r=document.createElement("div");r.className="calendar-row calendar-header-row",r.setAttribute("role","row"),i.forEach(t=>{const n=document.createElement("div");n.className="calendar-cell calendar-header-cell",n.setAttribute("role","columnheader"),n.textContent=t,r.appendChild(n)}),o.appendChild(r);const s=[];for(let g=0;42>g;g+=7)s.push(e.slice(g,g+7));const a=Ri(this.ze),l=Ri(this.$e),c=t=>{const n=e[t].value;return null!==a&&a>n||null!==l&&n>l},d=t=>{for(let n=0;42>n;n++)if(t(n)&&!c(n))return n;return-1};let h=d(t=>!!e[t].isSelected),u=!1;-1===h&&(h=d(t=>!!e[t].today)),-1===h&&(h=d(()=>!0),u=!0),-1===h&&(h=0),(null===this.fe||0>this.fe||this.fe>41||c(this.fe))&&(this.fe=u?null:h);const p=this.fe??h;this.we=[];let b=0;s.forEach(t=>{const n=document.createElement("div");n.className="calendar-row calendar-day-row",n.setAttribute("role","row"),t.forEach(t=>{const e=this.renderDayCell(t,null!==a&&a>t.value||null!==l&&t.value>l,b===p);e.className=e.className+" calendar-cell calendar-day-cell",n.appendChild(e),this.we[b]=e,b++}),o.appendChild(n)}),o.addEventListener("keydown",t=>{const n=t,e="ArrowLeft"===n.key?-1:"ArrowRight"===n.key?1:"ArrowUp"===n.key?-7:"ArrowDown"===n.key?7:0;if(0===e)return;const i=this.fe??h,o=i+e;if(0>o||o>41||c(o))return;n.preventDefault(),this.we[i]?.setAttribute("tabindex","-1"),this.fe=o;const r=this.we[o];r&&(r.setAttribute("tabindex","0"),r.focus())}),t.appendChild(o)}}customElements.get("ty-calendar-month")||customElements.define("ty-calendar-month",TyCalendarMonth);const Ui='\n:host([data-size="md"]) {\n--nav-btn-size: 1.875rem;\n--nav-btn-icon-size: 1.125rem;\n--nav-font-size: 1rem;\n--nav-padding: 0.5rem 0.75rem;\n--nav-default-width: 280px;\n}\n:host([data-size="sm"]) {\n--nav-btn-size: 1.5rem;\n--nav-btn-icon-size: 0.9375rem;\n--nav-font-size: 0.875rem;\n--nav-padding: 0.375rem 0.5rem;\n--nav-default-width: 240px;\n}\n:host([data-size="lg"]) {\n--nav-btn-size: 2.25rem;\n--nav-btn-icon-size: 1.25rem;\n--nav-font-size: 1.125rem;\n--nav-padding: 0.625rem 1rem;\n--nav-default-width: 360px;\n}\n.calendar-navigation-header {\ndisplay: flex;\nalign-items: center;\njustify-content: space-between;\npadding: var(--nav-padding);\nfont-family: inherit;\nuser-select: none;\nwidth: var(--nav-width, var(--ty-calendar-width, var(--nav-default-width)));\nbox-sizing: border-box;\n}\n.nav-group {\ndisplay: flex;\nalign-items: center;\ngap: 0.25rem;\nflex: 0 0 auto;\n}\n.nav-title {\ndisplay: inline-flex;\nalign-items: center;\ngap: 0.375rem;\nmin-width: 0;\nmargin-left: -0.375rem;\npadding: 0.25rem 0.375rem;\nborder: none;\nborder-radius: var(--ty-radius-base);\nbackground: transparent;\nfont-family: inherit;\nfont-size: var(--nav-font-size);\nline-height: 1.2;\nwhite-space: nowrap;\ncursor: pointer;\ntransition: var(--ty-local-transition, background-color 0.15s ease);\noutline: none;\n}\n.nav-title:hover,\n.nav-title[aria-expanded="true"] {\nbackground-color: var(--ty-calendar-nav-hover-bg, var(--ty-bg-neutral-soft));\n}\n.nav-title:focus-visible {\noutline: 2px solid var(--ty-calendar-nav-focus-outline, var(--ty-calendar-accent, var(--ty-color-primary)));\noutline-offset: 2px;\n}\n.nav-title-month {\nfont-weight: 600;\nletter-spacing: -0.01em;\ncolor: var(--ty-calendar-nav-title-color, var(--ty-text-strong, var(--ty-color-neutral-strong)));\n}\n.nav-title-year {\nfont-weight: 400;\ncolor: var(--ty-calendar-nav-year-color, var(--ty-text-soft, var(--ty-color-neutral)));\n}\n.nav-caret {\ndisplay: inline-flex;\ncolor: var(--ty-calendar-nav-color, var(--ty-color-neutral));\ntransition: transform 0.15s ease;\n}\n.nav-caret svg {\nwidth: 1em;\nheight: 1em;\ndisplay: block;\n}\n.nav-title[aria-expanded="true"] .nav-caret {\ntransform: rotate(180deg);\n}\n.nav-btn {\ndisplay: inline-flex;\nalign-items: center;\njustify-content: center;\nwidth: var(--nav-btn-size);\nheight: var(--nav-btn-size);\npadding: 0;\nborder: 1px solid var(--ty-calendar-nav-border, var(--ty-border));\nborder-radius: var(--ty-radius-base);\nbackground-color: transparent;\ncolor: var(--ty-calendar-nav-color, var(--ty-color-neutral-strong));\ncursor: pointer;\ntransition: var(--ty-local-transition, all 0.15s ease);\noutline: none;\n}\n.nav-btn:hover {\nbackground-color: var(--ty-calendar-nav-hover-bg, var(--ty-bg-neutral-soft));\ncolor: var(--ty-calendar-nav-hover-color, var(--ty-color-neutral-strong));\n}\n.nav-btn:active {\nbackground-color: var(--ty-calendar-nav-active-bg, var(--ty-bg-neutral));\ntransform: scale(0.95);\n}\n.nav-btn:disabled {\nopacity: 0.35;\ncursor: default;\npointer-events: none;\n}\n.nav-btn:focus-visible {\noutline: 2px solid var(--ty-calendar-nav-focus-outline, var(--ty-calendar-accent, var(--ty-color-primary)));\noutline-offset: 2px;\n}\n.nav-btn svg {\nwidth: var(--nav-btn-icon-size);\nheight: var(--nav-btn-icon-size);\ndisplay: block;\n}\n',Zi=class t extends T{constructor(){super();const t=new Date;this.Dn={displayMonth:t.getMonth()+1,displayYear:t.getFullYear()},q(this.shadowRoot,{css:Ui,id:"ty-calendar-navigation"})}onConnect(){this.Dn.displayMonth=this.displayMonth,this.Dn.displayYear=this.displayYear,this.lt=Ct(this,()=>{this.render()}),this.render()}onDisconnect(){this.lt&&(this.lt(),this.lt=void 0)}onPropertiesChanged(t){for(const{name:n,newValue:e}of t)switch(n){case"display-month":this.Dn.displayMonth=e;break;case"display-year":this.Dn.displayYear=e}}get displayMonth(){return this.getProperty("display-month")}set displayMonth(t){this.setProperty("display-month",t)}get displayYear(){return this.getProperty("display-year")}set displayYear(t){this.setProperty("display-year",t)}get locale(){return $t(this,this.getProperty("locale"))}set locale(t){this.setProperty("locale",t)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get width(){return this.getProperty("width")}set width(t){this.setProperty("width",t)}get view(){return this.getProperty("view")}set view(t){this.setProperty("view",t)}get min(){return this.getProperty("min")}set min(t){this.setProperty("min",t??"")}get max(){return this.getProperty("max")}set max(t){this.setProperty("max",t??"")}emitChangeEvent(t,n){const e=new CustomEvent("change",{detail:{month:t,year:n},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}static monthIndex(t,n){return 12*t+(n-1)}boundIndices(){const n=Bi(this.min),e=Bi(this.max);return{minIdx:n?t.monthIndex(n.year,n.month):null,maxIdx:e?t.monthIndex(e.year,e.month):null}}clampIndex(t){const{minIdx:n,maxIdx:e}=this.boundIndices();return null!==n&&n>t?n:null!==e&&t>e?e:t}navigateBy(n){const e=t.monthIndex(this.Dn.displayYear,this.Dn.displayMonth),i=this.clampIndex(e+n);i!==e&&this.emitChangeEvent(i%12+1,Math.floor(i/12))}isNavDisabled(n){const e=t.monthIndex(this.Dn.displayYear,this.Dn.displayMonth);return this.clampIndex(e+n)===e}createButton(t,n,e,i,o=!1){const r=document.createElement("button");return r.type="button",r.className=t,r.title=n,r.setAttribute("aria-label",n),r.innerHTML=e,r.disabled=o,r.addEventListener("click",i),r}render(){const t=this.shadowRoot;if(!t)return;q(t,{css:Ui,id:"ty-calendar-navigation"}),this.setAttribute("data-size",this.size);const n=this.width;n?this.style.setProperty("--nav-width",n):this.style.removeProperty("--nav-width");const e="months"===this.view,i=Wi(this.Dn.displayMonth,this.locale,"long");t.innerHTML="";const o=document.createElement("div");o.className="calendar-navigation-header";const r=document.createElement("button");if(r.type="button",r.className="nav-title",r.setAttribute("aria-expanded",e+""),r.setAttribute("aria-label",e?"Back to days":"Choose month and year"),!e){const t=document.createElement("span");t.className="nav-title-month",t.textContent=i,r.appendChild(t)}const s=document.createElement("span");s.className=e?"nav-title-month":"nav-title-year",s.textContent=this.Dn.displayYear+"",r.appendChild(s);const a=document.createElement("span");a.className="nav-caret",a.innerHTML="<svg width='24' viewBox='0 0 24 24' height='24' xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'>\n<path d='m6 9 6 6 6-6'/>\n</svg>",r.appendChild(a),r.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("view-toggle",{detail:{view:e?"days":"months"}}))});const l=e?12:1,c=e?"year":"month",d=document.createElement("div");d.className="nav-group nav-arrows",d.appendChild(this.createButton(`nav-btn nav-${c}-prev`,"Previous "+c,"<?xml version='1.0' encoding='UTF-8'?>\n<svg width='24' viewBox='0 0 24 24' height='24' xmlns='http://www.w3.org/2000/svg' stroke-width='0' stroke='currentColor' fill='currentColor'>\n<path fill='none' d='M0 0h24v24H0V0z'/>\n<path d='M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z'/>\n</svg>",()=>this.navigateBy(-l),this.isNavDisabled(-l))),d.appendChild(this.createButton(`nav-btn nav-${c}-next`,"Next "+c,"<?xml version='1.0' encoding='UTF-8'?>\n<svg width='24' viewBox='0 0 24 24' height='24' xmlns='http://www.w3.org/2000/svg' stroke-width='0' stroke='currentColor' fill='currentColor'>\n<path fill='none' d='M0 0h24v24H0V0z'/>\n<path d='M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z'/>\n</svg>",()=>this.navigateBy(l),this.isNavDisabled(l))),o.appendChild(r),o.appendChild(d),t.appendChild(o)}};Zi.properties={"display-month":{type:"number",visual:!0,default:()=>(new Date).getMonth()+1,validate:t=>{const n=+t;return Number.isInteger(n)&&n>=1&&12>=n},coerce:t=>{const n=+t;return isNaN(n)||1>n||n>12?(new Date).getMonth()+1:n}},"display-year":{type:"number",visual:!0,default:()=>(new Date).getFullYear(),validate:t=>{const n=+t;return Number.isInteger(n)&&n>=1&&9999>=n},coerce:t=>{const n=+t;return isNaN(n)||1>n||n>9999?(new Date).getFullYear():n}},locale:{type:"string",visual:!0,default:"en-US"},size:{type:"string",visual:!0,default:"md",validate:t=>["sm","md","lg"].includes(t),coerce:t=>["sm","md","lg"].includes(t)?t:"md"},width:{type:"string",visual:!0,default:""},view:{type:"string",visual:!0,default:"days",validate:t=>"days"===t||"months"===t,coerce:t=>"months"===t?"months":"days"},min:{type:"string",visual:!0,default:""},max:{type:"string",visual:!0,default:""}};let Xi=Zi;customElements.get("ty-calendar-navigation")||customElements.define("ty-calendar-navigation",Xi);const Ki="var(--ty-calendar-selected-bg, var(--ty-calendar-accent, var(--calendar-month-selected-bg, var(--ty-solid-primary, var(--ty-color-primary)))))",Ji="var(--ty-calendar-selected-color, var(--calendar-month-selected-color, var(--ty-solid-primary-fg, white)))",Gi=`\n.calendar-container {\ndisplay: flex;\nflex-direction: column;\ngap: 0.125rem;\nbox-sizing: border-box;\nfont-family: inherit;\nalign-items: center;\n}\n@media (max-width: 320px) {\n.calendar-container {\ngap: 0.375rem;\n}\n}\n.month-grid {\ndisplay: grid;\ngrid-template-columns: repeat(3, 1fr);\ngrid-auto-rows: 1fr;\ngap: 0.375rem;\nbox-sizing: border-box;\npadding: 0.75rem;\nmin-width: 280px;\nwidth: var(--calendar-width, auto);\n}\n.month-grid.size-sm { padding: 0.5rem; min-width: 240px; gap: 0.25rem; }\n.month-grid.size-lg { padding: 1rem; min-width: 360px; gap: 0.5rem; }\n.month-cell {\nposition: relative;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nmin-height: 2.5rem;\npadding: 0;\nborder: none;\nborder-radius: var(--ty-calendar-day-radius, 0.5rem);\nbackground: transparent;\ncolor: var(--ty-calendar-day-color, var(--ty-text));\nfont-family: inherit;\nfont-size: 0.875rem;\ncursor: pointer;\noutline: none;\ntransition: var(--ty-local-transition, background-color 0.15s ease, color 0.15s ease);\n}\n.month-grid.size-sm .month-cell { font-size: 0.75rem; min-height: 2rem; }\n.month-grid.size-lg .month-cell { font-size: 1rem; min-height: 3rem; }\n.month-cell:hover {\ncolor: var(--ty-calendar-day-hover-color, var(--ty-text-strong));\nbackground-color: var(--ty-calendar-day-hover-bg, var(--ty-bg-neutral));\nfont-weight: 500;\n}\n.month-cell:focus-visible {\nbox-shadow: 0 0 0 2px var(--calendar-month-accent, var(--ty-color-primary));\n}\n.month-cell.current {\ncolor: var(--ty-calendar-today-color, var(--ty-calendar-today-accent, var(--calendar-month-accent, var(--ty-color-primary))));\nfont-weight: 600;\n}\n.month-cell.current::after {\ncontent: "";\nposition: absolute;\ntop: calc(50% + 0.72em);\nleft: 50%;\nwidth: 4px;\nheight: 4px;\nmargin-left: -2px;\nborder-radius: 50%;\nbackground: currentColor;\n}\n.month-cell.selected {\nbackground-color: ${Ki};\ncolor: ${Ji};\nfont-weight: 600;\n}\n.month-cell.selected:hover {\nbackground-color: var(--ty-calendar-selected-hover-bg, var(--calendar-month-selected-hover-bg, color-mix(in oklab, ${Ki} 85%, ${Ji})));\n}\n.month-cell:disabled {\ncolor: var(--ty-calendar-disabled-color, var(--ty-text-faint));\nopacity: var(--ty-calendar-disabled-opacity, 0.7);\ntext-decoration: line-through;\ntext-decoration-color: color-mix(in oklab, currentColor 60%, transparent);\ncursor: default;\npointer-events: none;\n}\n${ji}\n`;function Qi(){const t=new Date;return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function to(t){return t&&/^\d{4}$/.test(t)?parseInt(t,10):null}function no(t){if(!t||!/^\d{1,2}$/.test(t))return null;const n=parseInt(t,10);return 1>n||n>12?null:n}function eo(t,n,e){if(!t||!/^\d{1,2}$/.test(t))return null;const i=parseInt(t,10),o=new Date(n,e,0).getDate();return 1>i||i>o?null:i}function io(t,n,e){return`${t}-${(""+n).padStart(2,"0")}-${(""+e).padStart(2,"0")}`}const oo=class t extends HTMLElement{constructor(){super(),this._e=!1,this.qe=!1,this.Tn="md",this.Le="primary",this.De="days",this.Ae=0,this.Fe="",this.Ve=0;const t=Qi();this.Dn={displayYear:t.year,displayMonth:t.month},this.attachShadow({mode:"open"}),M(this),"attachInternals"in this&&(this.C=this.attachInternals(),this.M=new m(this,this.C))}static get observedAttributes(){return["value","year","month","day","hide-navigation","stateless","locale","name","size","width","min","max","flavor"]}connectedCallback(){this.initializeFromAttributes(),E(this),this.render(),this.updateFormValue(),this.lt=Ct(this,()=>{this.render()})}disconnectedCallback(){this.lt&&(this.lt(),this.lt=void 0),this.je=void 0,this.Ie=void 0,this.Oe=void 0,this.He=void 0,this.De="days"}attributeChangedCallback(t,n,e){if(n!==e)switch(t){case"value":this.value=e||"";break;case"year":case"month":case"day":this.syncStateFromAttributes(),this.syncChildComponents(),this.updateFormValue();break;case"hide-navigation":this._e=null!==e,this.render();break;case"stateless":this.qe=null!==e&&"false"!==e;break;case"locale":this.syncChildComponents();break;case"size":"sm"!==e&&"md"!==e&&"lg"!==e||(this.Tn=e,this.Ce=void 0,this.removeAttribute("width"),this.syncChildComponents());break;case"width":this.Ce=e||void 0,e&&(this.Tn="md",this.removeAttribute("size")),this.syncChildComponents();break;case"name":this.updateFormValue();break;case"min":case"max":this["min"===t?"ze":"$e"]=e||void 0,this.syncChildComponents(),this.updateValidity();break;case"flavor":this.Le=e||"primary",this.syncChildComponents()}}get min(){return this.ze}set min(t){t?this.setAttribute("min",t):this.removeAttribute("min")}get max(){return this.$e}set max(t){t?this.setAttribute("max",t):this.removeAttribute("max")}get flavor(){return this.Le}set flavor(t){t?this.setAttribute("flavor",t):this.removeAttribute("flavor")}get year(){return this.Dn.selectedYear}set year(t){void 0!==t?this.qe?(this.Dn.displayYear=t,this.setAttribute("year",""+t)):(this.Dn.selectedYear=t,this.Dn.displayYear=t,this.setAttribute("year",""+t)):(this.qe||delete this.Dn.selectedYear,this.removeAttribute("year")),this.syncChildComponents(),this.qe||this.updateFormValue()}get month(){return this.Dn.selectedMonth}set month(t){void 0!==t?this.qe?(this.Dn.displayMonth=t,this.setAttribute("month",""+t)):(this.Dn.selectedMonth=t,this.Dn.displayMonth=t,this.setAttribute("month",""+t)):(this.qe||delete this.Dn.selectedMonth,this.removeAttribute("month")),this.syncChildComponents(),this.qe||this.updateFormValue()}get day(){return this.Dn.selectedDay}set day(t){void 0!==t?(this.Dn.selectedDay=t,this.setAttribute("day",""+t)):(delete this.Dn.selectedDay,this.removeAttribute("day")),this.syncChildComponents(),this.updateFormValue()}get locale(){return $t(this,this.getAttribute("locale"))}set locale(t){this.setAttribute("locale",t)}get hideNavigation(){return this._e}set hideNavigation(t){this._e=t,t?this.setAttribute("hide-navigation",""):this.removeAttribute("hide-navigation")}get stateless(){return this.qe}set stateless(t){this.qe=t,t?this.setAttribute("stateless",""):this.removeAttribute("stateless")}get size(){return this.Tn}set size(t){this.Tn!==t&&(this.Tn=t,this.Ce=void 0,this.removeAttribute("width"),this.setAttribute("size",t),this.syncChildComponents())}get width(){return this.Ce}set width(t){this.Ce!==t&&(this.Ce=t,t?(this.Tn="md",this.removeAttribute("size"),this.setAttribute("width",t)):this.removeAttribute("width"),this.syncChildComponents())}get dayContentFn(){return this.Se}set dayContentFn(t){this.Se=t,this.syncChildComponents()}get customCSS(){return this.Te}set customCSS(t){this.Te=t,this.syncChildComponents()}get value(){const{selectedYear:t,selectedMonth:n,selectedDay:e}=this.Dn;return t&&n&&e?io(t,n,e):""}set value(t){const n=++this.Ve,e=()=>n!==this.Ve;if(t){const n="string"==typeof t&&t.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(n){const t=parseInt(n[1],10),i=parseInt(n[2],10),o=parseInt(n[3],10);if(this.Dn.selectedYear=t,this.Dn.selectedMonth=i,this.Dn.selectedDay=o,this.Dn.displayYear=t,this.Dn.displayMonth=i,!this.qe){if(this.setAttribute("year",""+t),e())return;if(this.setAttribute("month",""+i),e())return;this.setAttribute("day",""+o)}}}else if(delete this.Dn.selectedYear,delete this.Dn.selectedMonth,delete this.Dn.selectedDay,!this.qe){if(this.removeAttribute("year"),e())return;if(this.removeAttribute("month"),e())return;this.removeAttribute("day")}this.syncChildComponents(),this.qe||this.updateFormValue()}initializeFromAttributes(){const t=this.getAttribute("year"),n=this.getAttribute("month"),e=this.getAttribute("day"),i=this.hasAttribute("hide-navigation"),o=this.getAttribute("stateless"),r=this.getAttribute("size"),s=this.getAttribute("width");this.ze=this.getAttribute("min")||void 0,this.$e=this.getAttribute("max")||void 0;const a=to(t);a&&(this.Dn.displayYear=a);const l=no(n);if(l&&(this.Dn.displayMonth=l),a&&l){const t=eo(e,a,l);t&&(this.Dn.selectedYear=a,this.Dn.selectedMonth=l,this.Dn.selectedDay=t)}this._e=i,null!==o&&(this.qe="false"!==o),!r||"sm"!==r&&"md"!==r&&"lg"!==r||(this.Tn=r),s&&(this.Ce=s),this.Fe=this.value}formResetCallback(){this.value=this.Fe}syncStateFromAttributes(){const t=this.getAttribute("year"),n=this.getAttribute("month"),e=this.getAttribute("day"),i=to(t),o=no(n);if(i&&(this.Dn.displayYear=i),o&&(this.Dn.displayMonth=o),i&&o){const t=eo(e,i,o);t?(this.Dn.selectedYear=i,this.Dn.selectedMonth=o,this.Dn.selectedDay=t):(delete this.Dn.selectedYear,delete this.Dn.selectedMonth,delete this.Dn.selectedDay)}else delete this.Dn.selectedYear,delete this.Dn.selectedMonth,delete this.Dn.selectedDay}syncChildComponents(){if(this.je&&(this.je.displayMonth=this.Dn.displayMonth,this.je.displayYear=this.Dn.displayYear,this.je.locale=this.locale,this.je.size=this.Tn,this.je.min=this.ze??"",this.je.max=this.$e??"",this.je.width=this.Ce,this.je.view=this.De),this.Oe&&this.showBody(),this.Ie){this.Ie.displayMonth=this.Dn.displayMonth,this.Ie.displayYear=this.Dn.displayYear,this.Ie.locale=this.locale,this.Ie.size=this.Tn,this.Ie.min=this.ze,this.Ie.max=this.$e,this.Ie.flavor=this.Le,this.Ie.width=this.Ce,this.Se&&(this.Ie.dayContentFn=this.Se),this.Te&&(this.Ie.customCSS=this.Te);const{selectedYear:t,selectedMonth:n,selectedDay:e}=this.Dn;this.Ie.value=t&&n&&e?new Date(t,n-1,e).getTime():null}}updateFormValue(){if(this.qe)return;if(!this.C)return;const t=this.getAttribute("name"),{selectedYear:n,selectedMonth:e,selectedDay:i}=this.Dn;if(t&&n&&e&&i){const t=io(n,e,i);this.C.setFormValue(t)}else this.C.setFormValue("");this.updateValidity()}updateValidity(){if(!this.C)return;const{selectedYear:t,selectedMonth:n,selectedDay:e}=this.Dn;if(t&&n&&e){const i=Date.UTC(t,n-1,e),o=this.ze?Bi(this.ze):null,r=this.$e?Bi(this.$e):null,s=()=>f("input",{type:"date",min:this.ze,max:this.$e},io(t,n,e));if(o&&i<Date.UTC(o.year,o.month-1,o.day))return void this.M.set({rangeUnderflow:!0},s());if(r&&i>Date.UTC(r.year,r.month-1,r.day))return void this.M.set({rangeOverflow:!0},s())}this.M.set({})}get form(){return this.C?.form??null}get validity(){return this.C?.validity}get validationMessage(){return this.C?.validationMessage??""}get willValidate(){return this.C?.willValidate??!1}checkValidity(){return this.C?.checkValidity()??!0}reportValidity(){return this.M?.report()??!0}setCustomValidity(t){this.M?.setCustom(t)}handleNavigationChange(t){t.preventDefault(),t.stopPropagation();const{month:n,year:e}=t.detail;this.goTo(n,e)}goTo(t,n){this.Dn.displayMonth=t,this.Dn.displayYear=n,this.syncChildComponents(),this.dispatchEvent(new CustomEvent("navigate",{detail:{month:t,year:n,action:"navigate",source:"navigation"},bubbles:!0,composed:!0,cancelable:!1}))}handleDayClick(t){t.preventDefault(),t.stopPropagation();const{dayContext:n,year:e,month:i,day:o}=t.detail;this.qe?this.dispatchEvent(new CustomEvent("day-click",{detail:t.detail,bubbles:!0,composed:!0,cancelable:!0})):(this.Dn.selectedYear=e,this.Dn.selectedMonth=i,this.Dn.selectedDay=o,this.Dn.displayYear=e,this.Dn.displayMonth=i,this.setAttribute("year",""+e),this.setAttribute("month",""+i),this.setAttribute("day",""+o),this.updateFormValue(),this.syncChildComponents(),this.dispatchEvent(new CustomEvent("change",{detail:{year:e,month:i,day:o,action:"select",source:"day-click",dayContext:n},bubbles:!0,composed:!0,cancelable:!1})))}refresh(){this.syncChildComponents(),this.Ie&&"function"==typeof this.Ie.refresh&&this.Ie.refresh()}createNavigation(){const t=document.createElement("ty-calendar-navigation");return t.displayMonth=this.Dn.displayMonth,t.displayYear=this.Dn.displayYear,t.locale=this.locale,t.size=this.Tn,t.min=this.ze??"",t.max=this.$e??"",this.Ce&&(t.width=this.Ce),t.view=this.De,t.addEventListener("change",t=>this.handleNavigationChange(t)),t.addEventListener("view-toggle",t=>{this.setView(t.detail.view),this.focusNavTitle()}),this.je=t,t}createMonthDisplay(){const t=document.createElement("ty-calendar-month");t.displayMonth=this.Dn.displayMonth,t.displayYear=this.Dn.displayYear,t.locale=this.locale,t.size=this.Tn,t.min=this.ze,t.max=this.$e,t.flavor=this.Le,this.Ce&&(t.width=this.Ce);const{selectedYear:n,selectedMonth:e,selectedDay:i}=this.Dn;return n&&e&&i&&(t.value=new Date(n,e-1,i).getTime()),this.Se&&(t.dayContentFn=this.Se),this.Te&&(t.customCSS=this.Te),t.addEventListener("day-click",t=>this.handleDayClick(t)),this.Ie=t,t}render(){const t=this.shadowRoot;if(!t)return;q(t,{css:Gi,id:"ty-calendar"}),t.innerHTML="",this.Oe=void 0;const n=document.createElement("div");if(n.className="calendar-container",n.addEventListener("keydown",t=>this.handleKeydown(t)),this.He=n,!this._e){const t=this.createNavigation();n.appendChild(t)}const e=this.createMonthDisplay();n.appendChild(e),t.appendChild(n),"months"===this.De&&this.showBody()}setView(t){t!==this.De&&("months"===t&&this.Ie&&(this.Ae=this.Ie.getBoundingClientRect().height),this.De=t,this.je&&(this.je.view=t),this.showBody())}showBody(){const t=this.He;if(!t||!this.Ie)return;if("days"===this.De)return this.Oe?.remove(),this.Oe=void 0,void(this.Ie.isConnected||t.appendChild(this.Ie));const n=this.buildMonthGrid();this.Oe?this.Oe.replaceWith(n):(this.Ie.remove(),t.appendChild(n)),this.Oe=n}static monthIndex(t,n){return 12*t+(n-1)}boundIndices(){const n=this.ze?Bi(this.ze):null,e=this.$e?Bi(this.$e):null;return{minIdx:n?t.monthIndex(n.year,n.month):null,maxIdx:e?t.monthIndex(e.year,e.month):null}}buildMonthGrid(){const{displayYear:n,displayMonth:e,selectedYear:i,selectedMonth:o}=this.Dn,r=Qi(),{minIdx:s,maxIdx:a}=this.boundIndices(),l=document.createElement("div");l.className="month-grid size-"+this.Tn,l.setAttribute("role","grid"),l.setAttribute("aria-label",n+""),this.Ae&&(l.style.minHeight=this.Ae+"px"),this.Ce&&l.style.setProperty("--calendar-width",this.Ce);for(let c=1;12>=c;c++){const d=t.monthIndex(n,c),h=null!==s&&s>d||null!==a&&d>a,u=i===n&&o===c,p=document.createElement("button");p.type="button",p.className="month-cell",p.setAttribute("role","gridcell"),p.setAttribute("aria-selected",u+""),p.setAttribute("aria-label",`${Wi(c,this.locale,"long")} ${n}`),p.dataset.month=c+"",p.tabIndex=c===e?0:-1,p.disabled=h,u&&p.classList.add("selected"),r.year===n&&r.month===c&&p.classList.add("current"),p.textContent=Wi(c,this.locale,"short"),p.addEventListener("click",()=>this.pickMonth(c)),l.appendChild(p)}return l.addEventListener("keydown",t=>{const n="ArrowLeft"===t.key?-1:"ArrowRight"===t.key?1:"ArrowUp"===t.key?-3:"ArrowDown"===t.key?3:0;if(!n)return;const i=Array.from(l.querySelectorAll(".month-cell")),o=i.findIndex(t=>t===this.shadowRoot.activeElement),r=i[(-1===o?e-1:o)+n];r&&!r.disabled&&(t.preventDefault(),i.forEach(t=>t.tabIndex=-1),r.tabIndex=0,r.focus())}),l}pickMonth(t){this.setView("days"),this.goTo(t,this.Dn.displayYear),this.focusDayGrid()}handleKeydown(n){if("Escape"===n.key&&"months"===this.De)return n.preventDefault(),n.stopPropagation(),this.setView("days"),void this.focusNavTitle();if("PageUp"!==n.key&&"PageDown"!==n.key)return;n.preventDefault();const e="PageUp"===n.key?-1:1,i=n.shiftKey||"months"===this.De?12:1,o=t.monthIndex(this.Dn.displayYear,this.Dn.displayMonth),{minIdx:r,maxIdx:s}=this.boundIndices();let a=o+e*i;if(null!==r&&r>a&&(a=r),null!==s&&a>s&&(a=s),a!==o)if(this.goTo(a%12+1,Math.floor(a/12)),"months"===this.De){const t=this.Oe?.querySelector('.month-cell[tabindex="0"]');t?.focus()}else this.focusDayGrid()}focusNavTitle(){requestAnimationFrame(()=>{this.je?.shadowRoot?.querySelector(".nav-title")?.focus()})}focus(t){const n="months"===this.De?this.Oe?.querySelector('.month-cell[tabindex="0"]'):this.Ie?.shadowRoot?.querySelector('.calendar-day-cell[tabindex="0"]');n?n.focus(t):super.focus(t)}focusDayGrid(){requestAnimationFrame(()=>{const t=this.Ie?.shadowRoot?.querySelector('.calendar-day-cell[tabindex="0"]');t?.focus()})}};oo.formAssociated=!0;let ro=oo;customElements.get("ty-calendar")||customElements.define("ty-calendar",ro);const so=(t,n)=>{const e=e=>n?e?`var(--ty-color-${t}${e}, var(--ty-color-${t}, var(--ty-color-${n}${e})))`:`var(--ty-color-${t}, var(--ty-color-${n}))`:e?`var(--ty-color-${t}${e}, var(--ty-color-${t}))`:`var(--ty-color-${t})`;return`\n:host([flavor="${t}"]) {\n--date-picker-accent: var(--ty-input-${t}-border, ${e("-soft")});\n--date-picker-accent-bold: ${e("")};\n--date-picker-ring: color-mix(in oklab, ${e("")} 15%, transparent);\n}\n:host([flavor="${t}+"]) {\n--date-picker-accent: ${e("")};\n--date-picker-accent-bold: ${e("-strong")};\n--date-picker-ring: color-mix(in oklab, ${e("-strong")} 15%, transparent);\n}\n:host([flavor="${t}-"]) {\n--date-picker-accent: ${e("-faint")};\n--date-picker-accent-bold: ${e("-soft")};\n--date-picker-ring: color-mix(in oklab, ${e("-soft")} 15%, transparent);\n}\n`},ao=`\n${wt}\n:host {\ndisplay: block;\nwidth: auto;\nmin-width: 200px;\nfont-family: inherit;\n--ty-date-picker-bg: var(--ty-input-bg);\n--ty-date-picker-color: var(--ty-input-color);\n--ty-date-picker-placeholder: var(--ty-input-placeholder);\n--ty-date-picker-border: var(--ty-input-border);\n--ty-date-picker-border-hover: var(--ty-input-border-hover);\n--ty-date-picker-border-focus: var(--ty-input-border-focus);\n--ty-date-picker-shadow-focus: var(--ty-input-shadow-focus);\n--ty-date-picker-disabled-bg: var(--ty-input-disabled-bg);\n--ty-date-picker-disabled-color: var(--ty-input-disabled-color);\n--ty-date-picker-radius: var(--ty-radius-md);\n--ty-calendar-surface-bg: var(--ty-surface-floating);\n--ty-calendar-surface-border: var(--ty-input-border);\n--ty-calendar-surface-shadow: var(--ty-shadow-lg, 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1));\n--ty-calendar-surface-radius: var(--ty-radius-lg);\n--ty-calendar-time-bg: transparent;\n--ty-calendar-time-border: var(--ty-border-faint);\n--ty-calendar-time-label-color: var(--ty-color-neutral);\n--ty-calendar-time-input-color: var(--ty-input-color);\n--ty-calendar-time-placeholder-color: var(--ty-input-placeholder);\n--ty-calendar-time-icon-color: var(--ty-color-neutral-soft);\n}\n.dropdown-container {\ndisplay: flex;\nflex-direction: column;\nwidth: 100%;\nbox-sizing: border-box;\n}\n.ty-field-label {\nfont-size: var(--ty-field-label-font);\nline-height: var(--ty-field-label-leading);\nletter-spacing: var(--ty-tracking-sm);\nfont-weight: var(--ty-font-medium);\ncolor: var(--ty-label-color);\nmargin-bottom: var(--ty-field-label-gap);\npadding-left: var(--ty-field-outer-pad-x);\ndisplay: flex;\nalign-items: center;\n}\n.required-icon {\ndisplay: inline-flex;\nalign-items: center;\ncolor: #ef4444;\nwidth: 12px;\nheight: 12px;\nvertical-align: middle;\nmargin-left: 4px;\n}\n.dropdown-wrapper {\nposition: relative;\ndisplay: block;\nwidth: 100%;\n}\n.date-picker-stub ::slotted([slot="start"]) {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nflex-shrink: 0;\nmargin-right: 0.5rem;\ncolor: var(--ty-text-soft);\n}\n.date-picker-stub ::slotted(ty-icon[slot="start"]) {\nwidth: 1em;\nheight: 1em;\n}\n.date-picker-stub {\nwidth: 100%;\ncursor: pointer;\nbox-sizing: border-box;\nposition: relative;\ndisplay: flex;\nalign-items: center;\nbackground: var(--ty-date-picker-bg);\ncolor: var(--ty-date-picker-color);\nborder: 1px solid var(--date-picker-accent, var(--ty-date-picker-border));\nborder-radius: var(--ty-date-picker-radius);\nfont-family: inherit;\nfont-size: var(--ty-field-font);\nfont-weight: var(--ty-font-normal);\nline-height: var(--ty-field-leading);\nmin-height: var(--ty-field-height);\npadding: 0 var(--ty-field-pad-x);\npadding-right: calc(var(--ty-field-pad-x) + 1rem + var(--ty-field-pad-x));\ntransition: var(--ty-transition-all), opacity 0.2s ease;\noutline: none;\n}\n.date-picker-stub:hover:not([disabled]):not(.open) {\nborder-color: var(--date-picker-accent-bold, var(--ty-date-picker-border-hover));\n}\n.date-picker-stub[disabled] {\nbackground-color: var(--ty-date-picker-disabled-bg);\ncolor: var(--ty-date-picker-disabled-color);\ncursor: not-allowed;\nopacity: 0.6;\n}\n.date-picker-stub:focus,\n.date-picker-stub.open {\nborder-color: var(--date-picker-accent-bold, var(--ty-date-picker-border-focus));\nbox-shadow: 0 0 0 3px var(--date-picker-ring, var(--ty-date-picker-shadow-focus));\n}\n${n.filter(t=>"neutral"!==t).map(t=>so(t)).join("")}\n.error-message {\nfont-size: var(--ty-font-xs);\nline-height: var(--ty-leading-xs);\nletter-spacing: var(--ty-tracking-xs);\ncolor: var(--ty-color-danger);\nmargin-top: 4px;\npadding-left: var(--ty-field-outer-pad-x);\n}\n.date-picker-stub.error {\nborder-color: var(--ty-color-danger);\nbackground: var(--ty-bg-danger-soft);\n}\n.date-picker-stub.error:focus,\n.date-picker-stub.error.open {\nborder-color: var(--ty-color-danger-bold);\nbox-shadow: 0 0 0 3px var(--ty-date-picker-shadow-focus);\n}\n.stub-text {\nflex: 1;\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\nuser-select: none;\ncolor: inherit;\npointer-events: none;\n}\n.stub-text.placeholder {\ncolor: var(--ty-date-picker-placeholder);\n}\n.stub-icons {\ndisplay: flex;\nalign-items: center;\ngap: var(--ty-spacing-1);\nposition: absolute;\nright: var(--ty-spacing-3);\ntop: 50%;\ntransform: translateY(-50%);\nheight: 1rem;\npointer-events: none;\nz-index: 2;\n}\n.stub-clear {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nwidth: 1rem;\nheight: 1rem;\npadding: 0;\nborder: none;\nbackground: none;\ncolor: var(--ty-color-neutral-soft);\ncursor: pointer;\nborder-radius: var(--ty-radius-sm);\ntransition: var(--ty-local-transition, all 0.15s ease);\npointer-events: auto;\n}\n.stub-clear:hover {\ncolor: var(--ty-color-danger);\nbackground-color: var(--ty-bg-danger-soft);\n}\n.stub-arrow {\ndisplay: flex;\nalign-items: center;\njustify-content: center;\nwidth: 1rem;\nheight: 1rem;\ncolor: var(--date-picker-accent, var(--ty-color-neutral-soft));\n}\n.date-picker-stub:hover .stub-arrow {\ncolor: var(--date-picker-accent-bold, var(--ty-color-neutral));\n}\n.date-picker-stub:focus .stub-arrow,\n.date-picker-stub.open .stub-arrow {\ncolor: var(--date-picker-accent-bold, var(--ty-date-picker-border-focus));\n}\n.calendar-dialog {\nposition: fixed;\nflex-direction: column;\nmax-width: 90vw;\nmargin: 0;\npadding: 0;\nborder: none;\nbackground: transparent;\nbox-sizing: border-box;\npadding: var(--calendar-padding, 8px);\nopacity: 0;\nscale: 0.96;\ntranslate: 0 -6px;\ntransform-origin: top center;\ntransition:\nopacity var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\nscale var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1)),\ntranslate var(--ty-popup-duration, 180ms) var(--ty-popup-ease, cubic-bezier(0.34, 1.56, 0.64, 1));\ntransform: translate(var(--calendar-offset-x, 0px), var(--calendar-offset-y, 0px));\ntop: -1000px;\nleft: -1000px;\n}\n.calendar-dialog.position-below {\nleft: var(--calendar-x);\ntop: var(--calendar-y);\n}\n.calendar-dialog.position-above {\nleft: var(--calendar-x);\nbottom: var(--calendar-y);\ntop: auto;\nflex-direction: column-reverse;\ntranslate: 0 6px;\ntransform-origin: bottom center;\n}\n.calendar-dialog.open {\nopacity: 1;\nscale: 1;\ntranslate: 0 0;\n}\n@starting-style {\n.calendar-dialog.open {\nopacity: 0;\nscale: 0.96;\ntranslate: 0 -6px;\n}\n.calendar-dialog.open.position-above {\ntranslate: 0 6px;\n}\n}\n.calendar-dialog::backdrop {\nbackground: transparent\n}\n.calendar-content {\nbackground-color: var(--ty-calendar-surface-bg);\nborder: 1px solid var(--ty-calendar-surface-border);\nborder-radius: var(--ty-calendar-surface-radius);\nbox-shadow: var(--ty-calendar-surface-shadow);\noverflow: hidden;\ndisplay: flex;\nflex-direction: column;\nalign-items: center;\n}\n.native-date-input {\nposition: absolute;\ninset: 0;\nopacity: 0;\nwidth: 100%;\nheight: 100%;\nmargin: 0;\npadding: 0;\nborder: none;\ncursor: pointer;\nz-index: 1;\n}\n.native-date-input::-webkit-calendar-picker-indicator {\nposition: absolute;\ninset: 0;\nwidth: 100%;\nheight: 100%;\nmargin: 0;\npadding: 0;\ncursor: pointer;\n}\n.time-section {\ndisplay: flex;\nflex-direction: column;\ngap: 0.375rem;\nwidth: 100%;\nbox-sizing: border-box;\npadding: 0.75rem 1rem 0.875rem;\nborder-top: 1px solid var(--ty-calendar-time-border);\nbackground-color: var(--ty-calendar-time-bg);\n}\n.time-row {\ndisplay: flex;\nalign-items: center;\njustify-content: space-between;\ngap: 0.75rem;\n}\n.time-label {\ndisplay: inline-flex;\nalign-items: center;\ngap: 0.5rem;\nfont-size: var(--ty-font-sm);\nfont-weight: 500;\ncolor: var(--ty-calendar-time-label-color);\n}\n.time-icon {\ndisplay: flex;\ncolor: var(--ty-calendar-time-icon-color);\nwidth: 1rem;\nheight: 1rem;\n}\n.time-fields {\ndisplay: inline-flex;\nalign-items: center;\ngap: 0.25rem;\n}\n.time-colon {\nfont-weight: 600;\ncolor: var(--ty-calendar-time-label-color);\n}\n.time-input {\nwidth: 2.75rem;\nheight: 2.125rem;\nbox-sizing: border-box;\nborder: 1px solid var(--ty-input-border);\nborder-radius: var(--ty-radius-md, 0.5rem);\nbackground: var(--ty-input-bg);\ncolor: var(--ty-calendar-time-input-color);\nfont-family: inherit;\nfont-size: var(--ty-font-base, 0.9375rem);\nfont-weight: 500;\nfont-variant-numeric: tabular-nums;\ntext-align: center;\npadding: 0;\noutline: none;\ncaret-color: transparent;\ntransition: var(--ty-transition-all);\n}\n.time-input::selection {\nbackground: var(--ty-bg-primary-soft, var(--ty-bg-primary));\n}\n.time-input:hover {\nborder-color: var(--ty-input-border-hover, var(--ty-input-border));\n}\n.time-input:focus {\nborder-color: var(--ty-input-border-focus);\nbox-shadow: 0 0 0 3px var(--ty-input-shadow-focus);\n}\n.time-summary {\ndisplay: flex;\njustify-content: space-between;\ngap: 0.75rem;\nfont-size: var(--ty-font-xs, 0.75rem);\ncolor: var(--ty-calendar-time-label-color);\n}\n.time-summary-iso {\nfont-family: var(--ty-font-mono, ui-monospace, SFMono-Regular, monospace);\ncolor: var(--ty-calendar-time-placeholder-color);\n}\n`,lo="<svg stroke='currentColor' fill='none' stroke-width='2' viewBox='0 0 24 24' width='16' height='16' xmlns='http://www.w3.org/2000/svg'><rect x='3' y='4' width='18' height='18' rx='2' ry='2'></rect><line x1='16' y1='2' x2='16' y2='6'></line><line x1='8' y1='2' x2='8' y2='6'></line><line x1='3' y1='10' x2='21' y2='10'></line></svg>",co="<svg stroke='currentColor' fill='none' stroke-width='2' viewBox='0 0 24 24' width='14' height='14' xmlns='http://www.w3.org/2000/svg'><line x1='18' y1='6' x2='6' y2='18'></line><line x1='6' y1='6' x2='18' y2='18'></line></svg>",ho=new WeakMap;let uo=0;function po(t){let n=ho.get(t);return void 0===n&&(n=++uo,ho.set(t,n)),n}const bo=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?)?$/;function go(t){const n=new Date(0);return n.setUTCFullYear(t.year,t.month-1,t.day),n.setUTCHours(t.hour||0,t.minute||0,t.second||0),n}function vo(t){if(null==t||""===t)return null;if("string"==typeof t){const n=bo.exec(t);if(n){const[t,e,i,o,r,s]=n.slice(1,7).map(t=>+(t??0)),a={year:t,month:e,day:i,hour:o,minute:r,second:s},l=go(a);return l.getUTCMonth()===e-1&&l.getUTCDate()===i&&24>o&&60>r&&60>s?a:null}}const n="number"==typeof t||"string"==typeof t?new Date(t):null;return!n||isNaN(n.getTime())?null:{year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate(),hour:n.getHours(),minute:n.getMinutes(),second:n.getSeconds(),epoch:n.getTime()}}function mo(t){const{year:n,month:e,day:i,hour:o,minute:r,second:s}=t;if(!n||!e||!i)return null;const a=new Date(2e3,0,1,12);return a.setFullYear(n,e-1,i),a.setHours(o||0,r||0,s||0,0),a}function yo(t,n){return n?t:{...t,hour:0,minute:0,second:0,epoch:void 0}}function fo(t,n,e){if(!t.year||!t.month||!t.day)return null;const i=yo(t,n);if(e)return wo(i,n);if(void 0!==i.epoch)return new Date(i.epoch).toISOString();const o=mo(i);return o?o.toISOString():null}function wo(t,n){if(!t.year||!t.month||!t.day)return null;const e=(""+t.year).padStart(4,"0"),i=(""+t.month).padStart(2,"0"),o=(""+t.day).padStart(2,"0");return n?`${e}-${i}-${o}T${(""+(t.hour||0)).padStart(2,"0")}:${(""+(t.minute||0)).padStart(2,"0")}${t.second?":"+(""+t.second).padStart(2,"0"):""}`:`${e}-${i}-${o}`}function xo(t,n){return n?{date:go(t),timeZone:"UTC"}:{date:mo(t)}}class ko{constructor(t,n,e,i=0,o=0){this.hourEl=t,this.minuteEl=n,this.onChange=e,this.typed="",this.hour=i,this.minute=o,this.paint(),this.wire(t,"hour"),this.wire(n,"minute")}static pad(t){return(""+t).padStart(2,"0")}paint(){this.hourEl.value=ko.pad(this.hour),this.minuteEl.value=ko.pad(this.minute)}wire(t,n){const e="hour"===n?23:59,i="hour"===n?2:5;t.addEventListener("focus",()=>{this.typed="",t.select()}),t.addEventListener("click",()=>t.select()),t.addEventListener("blur",()=>{this.typed=""}),t.addEventListener("input",()=>this.paint()),t.addEventListener("keydown",o=>{const r=t=>{"hour"===n?this.hour=t:this.minute=t,this.paint(),this.onChange(this.hour,this.minute)},s="hour"===n?this.hour:this.minute;if(/^\d$/.test(o.key)){o.preventDefault();const s=this.typed+o.key,a=2===s.length||1===s.length&&+o.key>i;return r(Math.min(+s,e)),void(a?(this.typed="","hour"===n?this.minuteEl.focus():t.select()):this.typed=s)}switch(o.key){case"ArrowUp":case"ArrowDown":{o.preventDefault();const n="ArrowUp"===o.key?1:-1;return this.typed="",r((s+n+e+1)%(e+1)),void t.select()}case"Backspace":case"Delete":return o.preventDefault(),"minute"===n&&""===this.typed&&"Backspace"===o.key&&0===s?void this.hourEl.focus():(this.typed="",r(0),void t.select());case"ArrowLeft":return void("minute"===n&&(o.preventDefault(),this.hourEl.focus()));case"ArrowRight":return void("hour"===n&&(o.preventDefault(),this.minuteEl.focus()));case"Tab":case"Escape":case"Enter":return;default:1!==o.key.length||o.metaKey||o.ctrlKey||o.preventDefault()}})}getTime(){return{hour:this.hour,minute:this.minute}}setTime(t,n){this.hour=t,this.minute=n,this.paint()}}const zo=class extends T{constructor(){super(),this.Dn={withTime:!1,open:!1},this.Ne=0,this.We=!1,this.Be=!1,this.j=null,q(this.shadowRoot,{css:ao,id:"ty-date-picker"})}onConnect(){this.We?this.Dn.open=!1:this.initializeState(),this.syncErrorFlavor(),this.render(),this.updateFormValue(),this.lt=Ct(this,()=>{this.render()}),this.O()}O(){this.j=O(this.shadowRoot,this.j,"default"===this.flavor?"neutral":this.flavor,({base:t})=>(t=>so(t,"neutral"))(t))}onDisconnect(){this.lt&&(this.lt(),this.lt=void 0),this.cleanup()}onPropertiesChanged(t){for(const{name:n,newValue:e}of t)switch(n){case"flavor":"danger"!==e&&(this.removeAttribute(ft),this.syncErrorFlavor()),this.O();break;case"size":case"label":case"placeholder":case"required":case"disabled":this.updateValidity();break;case"noClear":case"format":case"locale":break;case"error":this.syncErrorFlavor();break;case"value":if(!this.We||this.Be)break;this.Dn={withTime:this.Dn.withTime,open:this.Dn.open,...vo(e)},this.syncFormValue();break;case"with-time":if(!this.We)break;e!==this.Dn.withTime&&(this.Dn.withTime=e,this.syncFormValue(),this.updateValidity());break;case"native":this.We&&this.syncFormValue()}}getFormValue(){return this.outputValue(this.getComponents())}outputValue(t){return fo(t,this.Dn.withTime,!!this.getProperty("native"))}updateFormValue(){this.C.setFormValue(this.getFormValue()??""),this.updateValidity()}focusTarget(){return this.shadowRoot?.querySelector(".native-date-input")??this.shadowRoot?.querySelector(".date-picker-stub")??null}focus(t){if(this.getProperty("disabled"))return;const n=this.focusTarget();n?n.focus(t):super.focus(t)}updateValidity(){this.getProperty("disabled")||!this.getProperty("required")||this.getFormValue()?this.applyValidity({}):this.applyValidity({valueMissing:!0},f("input",{type:this.Dn.withTime?"datetime-local":"date",required:!0}),this.focusTarget()??void 0)}getComponents(){return{year:this.Dn.year,month:this.Dn.month,day:this.Dn.day,hour:this.Dn.hour,minute:this.Dn.minute,second:this.Dn.second,epoch:this.Dn.epoch}}hasDate(){return!!(this.Dn.year&&this.Dn.month&&this.Dn.day)}getFormattedValue(t){const n=t||this.getComponents();return n.year&&n.month&&n.day?function(t,n,e,i,o){if(!t.year||!t.month||!t.day)return null;const{date:r,timeZone:s}=xo(t,o);if(!r)return null;const a={dateStyle:n,timeZone:s};return i&&(a.timeStyle="short"),new Intl.DateTimeFormat(e,a).format(r)}(n,this.getProperty("format")||"long",$t(this,this.getProperty("locale")),this.Dn.withTime,!!this.getProperty("native")):null}initializeState(){this.Dn={...vo(this.getProperty("value")),withTime:this.getProperty("with-time"),open:!1},this.We=!0,this.syncFormValue()}updateState(t,n=!1){this.Dn={...this.Dn,...t},(n||!this.Dn.open||!this.Dn.withTime)&&this.syncFormValue()}syncFormValue(){const t=this.getFormValue();if(t!==this.getProperty("value")){this.Be=!0;try{this.setProperty("value",t||null)}finally{this.Be=!1}}}syncErrorFlavor(){if(!this.p)return;const t=this.getProperty("flavor"),n=this.getAttribute(ft);if(this.getProperty("error"))null!==n||"default"!==t&&"neutral"!==t||(this.setAttribute(ft,this.getAttribute("flavor")??""),this.setProperty("flavor","danger"));else if(null!==n){if(this.removeAttribute(ft),"danger"!==t)return;n?this.setProperty("flavor",n):this.removeAttribute("flavor")}}handleTimeInputChange(t,n){if(!this.hasDate())return;const e={...this.getComponents(),hour:t,minute:n,second:0,epoch:void 0};this.updateState(e,!0),this.emitChangeEvent(e,"time-change"),this.updateTimeSummary(),this.revealValidity()}updateTimeSummary(t=this.shadowRoot?.querySelector(".time-summary")){if(!t)return;const n=this.getComponents(),e=t.querySelector(".time-summary-date"),i=t.querySelector(".time-summary-iso");if(!n.year||!n.month||!n.day)return e.textContent="Pick a day",void(i.textContent="");const o=$t(this,this.getProperty("locale"))||void 0,{date:r,timeZone:s}=xo(n,!!this.getProperty("native")),a=new Intl.DateTimeFormat(o,{weekday:"short",month:"short",day:"numeric",timeZone:s}).format(r),l=new Intl.DateTimeFormat(o,{hour:"2-digit",minute:"2-digit",hourCycle:"h23",timeZone:s}).format(r);e.textContent=`${a} · ${l}`,i.textContent=wo(n,!0)??""}emitChangeEvent(t,n){const e=t?this.outputValue(t):null,i=t?wo(t,this.Dn.withTime):null,o=t&&yo(t,this.Dn.withTime),r=o?o.epoch??mo(o)?.getTime()??null:null,s=t?this.getFormattedValue(t):null,a=new CustomEvent("change",{detail:{value:e,localValue:i,milliseconds:r,formatted:s,source:n},bubbles:!0,cancelable:!0});this.dispatchEvent(a)}get size(){return this.getProperty("size")}set size(t){this.setProperty("size",t)}get placement(){return this.getProperty("placement")}set placement(t){this.setProperty("placement",t)}get flavor(){return this.getProperty("flavor")}set flavor(t){this.removeAttribute(ft),this.setProperty("flavor",t)}attributeChangedCallback(t,n,e){"flavor"===t&&"danger"===e&&n===e&&this.removeAttribute(ft),super.attributeChangedCallback(t,n,e)}get label(){return this.getProperty("label")}set label(t){this.setProperty("label",t)}get placeholder(){return this.getProperty("placeholder")}set placeholder(t){this.setProperty("placeholder",t)}get name(){return this.getProperty("name")}set name(t){this.setProperty("name",t)}get format(){return this.getProperty("format")}set format(t){this.setProperty("format",t)}get locale(){return this.getProperty("locale")}set locale(t){this.setProperty("locale",t)}get required(){return this.getProperty("required")}set required(t){this.setProperty("required",t)}get disabled(){return this.getProperty("disabled")}set disabled(t){this.setProperty("disabled",t)}get noClear(){return this.getProperty("noClear")}set noClear(t){this.setProperty("noClear",t)}get min(){return this.getProperty("min")}set min(t){this.setProperty("min",t??"")}get max(){return this.getProperty("max")}set max(t){this.setProperty("max",t??"")}get withTime(){return this.getProperty("with-time")}set withTime(t){this.setProperty("with-time",t)}get native(){return this.getProperty("native")}set native(t){this.setProperty("native",t)}get error(){return this.getProperty("error")}set error(t){this.setProperty("error",t)}get value(){if(this.We)return this.getProperty("value")||null;const t=vo(this.getProperty("value"));return t&&fo(t,!!this.getProperty("with-time"),!!this.getProperty("native"))}set value(t){if(null==t||""===t)this.setProperty("value",null);else if("string"==typeof t)this.setProperty("value",t);else{const n=new Date(t);this.setProperty("value",isNaN(n.getTime())?null:n.toISOString())}}clear(){this.clearValue()}buildStubClasses(){const t=["date-picker-stub"];return this.getProperty("disabled")&&t.push("disabled"),this.getProperty("required")&&t.push("required"),this.getProperty("error")&&t.push("error"),this.Dn.open&&t.push("open"),t.join(" ")}renderStub(){const t=document.createElement("div");t.className=this.buildStubClasses();const n=this.getProperty("disabled");n&&t.setAttribute("disabled","true"),t.setAttribute("role","button"),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded",this.Dn.open+""),t.setAttribute("tabindex",n?"-1":"0"),n&&t.setAttribute("aria-disabled","true"),this.getProperty("label")&&t.setAttribute("aria-labelledby","date-picker-label-"+po(this)),t.addEventListener("keydown",n=>{this.Dn.open||n.target!==t||"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleStubClick(n))});const e=document.createElement("slot");e.name="start";const i=document.createElement("span");i.className="stub-text";const o=this.getFormattedValue(),r=this.getProperty("placeholder")||"Select date...";i.textContent=o||r,o||i.classList.add("placeholder");const s=document.createElement("div");if(s.className="stub-icons",!this.getProperty("noClear")&&o&&!n){const t=document.createElement("button");t.className="stub-clear",t.type="button",t.innerHTML=co,t.addEventListener("click",t=>this.handleClearClick(t)),s.appendChild(t)}const a=document.createElement("span");return a.className="stub-arrow",a.innerHTML=lo,s.appendChild(a),t.addEventListener("click",t=>this.handleStubClick(t)),t.appendChild(e),t.appendChild(i),t.appendChild(s),t}createTimeField(t){const n=document.createElement("input");return n.type="text",n.className="time-input time-"+t,n.inputMode="numeric",n.autocomplete="off",n.maxLength=2,n.setAttribute("aria-label","hour"===t?"Hours":"Minutes"),n}renderTimeSection(){const t=document.createElement("div");t.className="time-section",t.setAttribute("role","group"),t.setAttribute("aria-label","Time");const n=document.createElement("div");n.className="time-row";const e=document.createElement("span");e.className="time-label";const i=document.createElement("span");i.className="time-icon",i.innerHTML="<svg stroke='currentColor' fill='none' stroke-width='2' viewBox='0 0 24 24' width='16' height='16' xmlns='http://www.w3.org/2000/svg'><circle cx='12' cy='12' r='10'></circle><polyline points='12,6 12,12 16,14'></polyline></svg>",e.appendChild(i),e.appendChild(document.createTextNode("Time"));const o=document.createElement("div");o.className="time-fields";const r=this.createTimeField("hour"),s=this.createTimeField("minute"),a=document.createElement("span");a.className="time-colon",a.textContent=":",o.appendChild(r),o.appendChild(a),o.appendChild(s),this.Pe=new ko(r,s,(t,n)=>this.handleTimeInputChange(t,n),this.Dn.hour||0,this.Dn.minute||0),n.appendChild(e),n.appendChild(o);const l=document.createElement("div");l.className="time-summary",l.setAttribute("aria-live","polite");const c=document.createElement("span");c.className="time-summary-date";const d=document.createElement("span");return d.className="time-summary-iso",l.appendChild(c),l.appendChild(d),this.updateTimeSummary(l),t.appendChild(n),t.appendChild(l),t}renderCalendarDropdown(){const t=document.createElement("dialog");t.className="calendar-dialog";const n=document.createElement("div");n.className="calendar-content";const e=document.createElement("ty-calendar");this.Dn.year&&this.Dn.month&&this.Dn.day&&(e.setAttribute("year",""+this.Dn.year),e.setAttribute("month",""+this.Dn.month),e.setAttribute("day",""+this.Dn.day));const i=$t(this,this.getProperty("locale"));i&&e.setAttribute("locale",i);const o=this.getProperty("min"),r=this.getProperty("max");o&&e.setAttribute("min",o),r&&e.setAttribute("max",r);const s=this.calendarFlavor();return s&&e.setAttribute("flavor",s),e.addEventListener("change",t=>this.handleCalendarChange(t)),n.appendChild(e),this.Dn.withTime&&n.appendChild(this.renderTimeSection()),t.appendChild(n),new MutationObserver(()=>{this.Dn.open&&!t.open&&this.isConnected&&this.closeDropdown()}).observe(t,{attributes:!0,attributeFilter:["open"]}),t}calendarFlavor(){const t=this.getAttribute(ft)??this.getProperty("flavor");return t&&"default"!==t?t:null}renderNativeInput(){const t=document.createElement("div");t.className="dropdown-wrapper";const n=document.createElement("div");n.className=this.buildStubClasses();const e=this.getProperty("disabled");e&&n.setAttribute("disabled","true");const i=document.createElement("input");i.className="native-date-input",this.syncNativeInput(i);const o=i.value,r=this.getProperty("placeholder")||"Select date...",s=this.getFormattedValue(),a=document.createElement("span");a.className="stub-text"+(s?"":" placeholder"),a.textContent=s||r,i.addEventListener("change",()=>{if(i.value){const t=vo(i.value);if(t){const{hour:n,minute:e,second:i}=this.Dn.withTime?t:this.Dn,o={...t,hour:n,minute:e,second:i,epoch:void 0};this.updateState(o,!0),this.emitChangeEvent(o,"selection")}}else this.clearValue();this.revealValidity()});const l=document.createElement("slot");l.name="start",n.appendChild(l),n.appendChild(i),n.appendChild(a);const c=document.createElement("div");if(c.className="stub-icons",!this.getProperty("noClear")&&o&&!e){const t=document.createElement("button");t.className="stub-clear",t.type="button",t.innerHTML=co,t.addEventListener("click",t=>this.handleClearClick(t)),c.appendChild(t)}const d=document.createElement("span");return d.className="stub-arrow",d.innerHTML=lo,c.appendChild(d),n.appendChild(c),t.appendChild(n),t}syncNativeInput(t){const n=this.Dn.withTime;t.type=n?"datetime-local":"date",t.disabled=!!this.getProperty("disabled"),t.required=!!this.getProperty("required");const e=this.getProperty("min"),i=this.getProperty("max");e?t.min=n?e+"T00:00":e:t.removeAttribute("min"),i?t.max=n?i+"T23:59":i:t.removeAttribute("max"),t.value=wo(this.getComponents(),n)??""}calculateCalendarPosition(){if(!this.shadowRoot)return;if(Ee())return;const t=this.shadowRoot.querySelector(".date-picker-stub"),n=this.shadowRoot.querySelector(".calendar-dialog");if(!t||!n)return;const e=t.getBoundingClientRect(),i=n.getBoundingClientRect(),o=i.height||400,r=i.width||320,s=hn(this.getProperty("placement")),a=bn({anchorRect:e,popupWidth:r,popupHeight:o,gap:0,align:s.align,side:s.side}),l=a.below,c=l?a.topY:a.bottomY;this.style.setProperty("--calendar-x",a.x-8+"px"),this.style.setProperty("--calendar-y",c+"px"),this.style.setProperty("--calendar-offset-x","0px"),this.style.setProperty("--calendar-offset-y","0px"),l?(n.classList.add("position-below"),n.classList.remove("position-above")):(n.classList.add("position-above"),n.classList.remove("position-below"))}renderContainer(){const t=document.createElement("div");t.className="dropdown-container";const n=this.getProperty("label");if(n){const e=document.createElement("label");e.className="ty-field-label",e.id="date-picker-label-"+po(this),e.innerHTML=n+(this.getProperty("required")?'<span class="required-icon">*</span>':""),t.appendChild(e)}return t}render(){if(!this.shadowRoot)return;if(q(this.shadowRoot,{css:ao,id:"ty-date-picker"}),Ee()){if(this.shadowRoot.querySelector(".native-date-input"))return void this.updateDisplay();this.shadowRoot.innerHTML="";const t=this.renderContainer();return t.appendChild(this.renderNativeInput()),this.shadowRoot.appendChild(t),this.syncErrorLine(),void this.updateValidity()}const t=this.shadowRoot.querySelector(".calendar-dialog");if(t&&t.open&&this.Dn.open)return this.updateDisplay(),void this.calculateCalendarPosition();const n=!!this.shadowRoot.activeElement;this.shadowRoot.innerHTML="";const e=this.renderContainer(),i=document.createElement("div");i.className="dropdown-wrapper",i.appendChild(this.renderStub()),i.appendChild(this.renderCalendarDropdown()),e.appendChild(i),this.shadowRoot.appendChild(e),this.syncErrorLine(),this.setupEventListeners(),this.updateValidity(),n&&this.focus({preventScroll:!0})}syncErrorLine(){const t=this.shadowRoot?.querySelector(".dropdown-container");if(!t)return;const n=this.getProperty("error"),e="date-picker-error-"+po(this);let i=t.querySelector(":scope > .error-message");n?(i||(i=document.createElement("div"),i.className="error-message",i.id=e,t.appendChild(i)),i.textContent=n,this.focusTarget()?.setAttribute("aria-describedby",e)):(i?.remove(),this.focusTarget()?.removeAttribute("aria-describedby"))}updateDisplay(){if(!this.shadowRoot)return;const t=this.getFormattedValue(),n=this.getProperty("placeholder")||"Select date...",e=this.hasDate(),i=!this.getProperty("noClear"),o=this.getProperty("disabled"),r=this.shadowRoot.querySelector(".stub-text");r&&(r.textContent=t||n,r.classList.toggle("placeholder",!t));const s=this.shadowRoot.querySelector(".stub-clear");s&&(s.style.display=i&&e&&!o?"":"none");const a=this.shadowRoot.querySelector(".date-picker-stub");if(a&&(a.className=this.buildStubClasses()),this.syncErrorLine(),Ee()){const t=this.shadowRoot.querySelector(".native-date-input");return t&&this.syncNativeInput(t),void a?.toggleAttribute("disabled",!!o)}const l=this.shadowRoot.querySelector("ty-calendar");if(l&&e&&(l.setAttribute("year",""+this.Dn.year),l.setAttribute("month",""+this.Dn.month),l.setAttribute("day",""+this.Dn.day)),l){const t=this.calendarFlavor();t?l.setAttribute("flavor",t):l.removeAttribute("flavor");const n=this.getProperty("min"),e=this.getProperty("max");n?l.setAttribute("min",n):l.removeAttribute("min"),e?l.setAttribute("max",e):l.removeAttribute("max")}this.Pe&&void 0!==this.Dn.hour&&void 0!==this.Dn.minute&&this.Pe.setTime(this.Dn.hour,this.Dn.minute),this.updateTimeSummary()}setupEventListeners(){this.Re&&document.removeEventListener("click",this.Re),this.Ye&&document.removeEventListener("keydown",this.Ye),this.Re=t=>this.handleOutsideClick(t),this.Ye=t=>this.handleEscapeKey(t),document.addEventListener("click",this.Re),document.addEventListener("keydown",this.Ye);const t=this.shadowRoot?.querySelector(".calendar-dialog");t&&(this.Ue=t=>this.handleDialogClick(t),t.addEventListener("click",this.Ue))}handleStubClick(t){t.preventDefault();const n=this.shadowRoot?.querySelector(".calendar-dialog");!this.Dn.open||n&&n.open||(this.updateState({open:!1},!0),Nn("date-picker-"+po(this))),!this.getProperty("disabled")&&Date.now()-this.Ne>300&&this.openDropdown()}clearValue(){this.updateState({year:void 0,month:void 0,day:void 0,hour:void 0,minute:void 0,second:void 0,epoch:void 0},!0),this.value=null,this.emitChangeEvent(null,"clear"),this.render()}handleClearClick(t){t.preventDefault(),t.stopPropagation(),this.clearValue();const n=document.activeElement;!this.matches(":focus-within")&&n&&n!==document.body||this.shadowRoot?.querySelector(".native-date-input")?.focus({preventScroll:!0}),this.revealValidity()}handleCalendarChange(t){t.preventDefault(),t.stopPropagation();const n=t.detail.dayContext;if(!n)return;const e={year:n.year,month:n.month,day:n.dayInMonth,hour:this.Dn.hour,minute:this.Dn.minute,second:this.Dn.second,epoch:void 0};this.updateState(e,!0),this.emitChangeEvent(e,"selection"),this.revealValidity(),this.Dn.withTime?requestAnimationFrame(()=>{if(!this.shadowRoot)return;this.updateTimeSummary();const t=this.shadowRoot.querySelector(".time-hour");t&&t.focus()}):this.closeDropdown()}handleDialogClick(t){if(!this.shadowRoot)return;const n=this.shadowRoot.querySelector(".calendar-dialog"),e=this.shadowRoot.querySelector(".calendar-content");t.target===n&&this.Dn.open&&e&&!e.contains(t.target)&&(t.preventDefault(),t.stopPropagation(),this.closeDropdown())}handleOutsideClick(t){if(!this.shadowRoot)return;const n=t.target,e=this.shadowRoot.querySelector(".calendar-dialog");this.Dn.open&&e&&!this.contains(n)&&!e.contains(n)&&this.closeDropdown()}handleEscapeKey(t){"Escape"===t.key&&this.Dn.open&&(t.preventDefault(),this.closeDropdown())}openDropdown(){this.Dn.open||Ee()||(this.updateState({open:!0}),this.dispatchEvent(new CustomEvent("open")),this.render(),requestAnimationFrame(()=>{if(!this.shadowRoot)return;if(!this.Dn.open||!this.isConnected)return;if(!1===this.shadowRoot.querySelector(".date-picker-stub")?.checkVisibility())return void this.closeDropdown();const t=this.shadowRoot.querySelector(".calendar-dialog");if(t){Hn("date-picker-"+po(this)),t.showModal(),this.calculateCalendarPosition(),t.classList.add("open");const n=this.shadowRoot.querySelector(".date-picker-stub");n&&n.setAttribute("aria-expanded","true");const e=this.shadowRoot.activeElement;e&&e.blur()}}))}closeDropdown(){if(!this.Dn.open)return;this.Ne=Date.now();const t="date-picker-"+po(this);if(this.updateState({open:!1},!0),Nn(t),this.shadowRoot){const t=this.shadowRoot.querySelector(".calendar-dialog");t&&(t.classList.remove("position-above","position-below","open"),t.close());const n=this.shadowRoot.querySelector(".date-picker-stub");n&&n.setAttribute("aria-expanded","false")}this.dispatchEvent(new CustomEvent("close")),this.render(),this.focus()}cleanup(){if(this.Re&&document.removeEventListener("click",this.Re),this.Ye&&document.removeEventListener("keydown",this.Ye),this.Ue&&this.shadowRoot){const t=this.shadowRoot.querySelector(".calendar-dialog");t&&t.removeEventListener("click",this.Ue)}this.Dn.open&&Nn("date-picker-"+po(this)),this.Re=void 0,this.Ye=void 0,this.Ue=void 0,this.Pe=void 0}};zo.properties={placement:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:e,validate:t=>["xs","sm","md","lg","xl"].includes(t),coerce:t=>["xs","sm","md","lg","xl"].includes(t)?t:e},flavor:{type:"string",visual:!0,default:"default"},label:{type:"string",visual:!0,default:""},placeholder:{type:"string",visual:!0,default:"Select date..."},name:{type:"string",visual:!1,default:""},min:{type:"string",visual:!0,default:""},max:{type:"string",visual:!0,default:""},required:{type:"boolean",visual:!0,default:!1},disabled:{type:"boolean",visual:!0,default:!1},noClear:{type:"boolean",visual:!0,default:!1},error:{type:"string",visual:!0,default:""},format:{type:"string",visual:!0,default:"long",validate:t=>["short","medium","long","full"].includes(t),coerce:t=>["short","medium","long","full"].includes(t)?t:"long"},locale:{type:"string",visual:!0,default:""},value:{type:"string",visual:!0,formValue:!0,emitChange:!1,default:null},"with-time":{type:"boolean",visual:!0,default:!1},native:{type:"boolean",visual:!0,default:!1}},zo.formAssociated=!0;let $o=zo;customElements.get("ty-date-picker")||customElements.define("ty-date-picker",$o);const Co=new Map,Mo=new Map;function Eo(t){return Co.get(t)}function So(t,n){Mo.has(t)||Mo.set(t,new Set),Mo.get(t).add(n);const e=Co.get(t);return e&&n(e),()=>{Mo.get(t)?.delete(n),0===Mo.get(t)?.size&&Mo.delete(t)}}function To(){return Object.fromEntries(Co)}function _o(t,n,e){Co.set(t,{width:n,height:e});const i=Mo.get(t);if(i){const t={width:n,height:e};i.forEach(n=>n(t))}}function qo(t){Co.delete(t),Mo.delete(t)}class TyResizeObserver extends HTMLElement{constructor(){super(),this.Dt=null,this.Ze=null;const t=this.attachShadow({mode:"open"});q(t,{css:"\n:host {\ndisplay: block;\nposition: relative;\n}\n::slotted(*) {\n}\n",id:"ty-resize-observer"}),t.innerHTML="<slot></slot>"}static get observedAttributes(){return["id","debounce"]}get debounce(){return parseInt(this.getAttribute("debounce")||"0")}set debounce(t){this.setAttribute("debounce",t+"")}connectedCallback(){E(this),this.setupObserver()}attributeChangedCallback(t,n,e){if("id"===t&&n&&n!==e&&(qo(n),e&&this.isConnected)){const{width:t,height:n}=this.getBoundingClientRect();_o(e,t,n)}}disconnectedCallback(){this.cleanup()}setupObserver(){this.Dt=new ResizeObserver(t=>{this.debounce>0?(this.Ze&&clearTimeout(this.Ze),this.Ze=window.setTimeout(()=>{this.handleResize(t)},this.debounce)):this.handleResize(t)}),this.Dt.observe(this)}handleResize(t){const{width:n,height:e}=t[0].contentRect;this.id&&_o(this.id,n,e)}cleanup(){this.Dt&&(this.Dt.disconnect(),this.Dt=null),this.Ze&&(clearTimeout(this.Ze),this.Ze=null),this.id&&qo(this.id)}}customElements.get("ty-resize-observer")||customElements.define("ty-resize-observer",TyResizeObserver);const Lo=`\n:host {\ndisplay: block;\nposition: relative;\noverflow: hidden;\n}\n.scroll-wrapper {\nwidth: 100%;\nheight: 100%;\noverflow-y: auto;\noverflow-x: hidden;\n}\n:host([overflow-x]) .scroll-wrapper {\noverflow-x: auto;\n}\n:host([max-height]) .scroll-wrapper {\nmax-height: var(--scroll-max-height);\n}\n:host([hide-scrollbar]) .scroll-wrapper {\nscrollbar-width: none;\n-ms-overflow-style: none;\n}\n:host([hide-scrollbar]) .scroll-wrapper::-webkit-scrollbar {\ndisplay: none;\n}\n:host([scroll-anchoring]) .scroll-wrapper {\noverflow-anchor: none;\n}\n:host([custom-scrollbar]) .scroll-wrapper {\nscrollbar-width: none;\n-ms-overflow-style: none;\n}\n:host([custom-scrollbar]) .scroll-wrapper::-webkit-scrollbar {\ndisplay: none;\n}\n:host([custom-scrollbar]:hover) .ty-scrollbar-track-y.has-overflow,\n:host([custom-scrollbar]:hover) .ty-scrollbar-track-x.has-overflow {\nopacity: 1;\n}\n:host([custom-scrollbar][overflow-x]) .ty-scrollbar-track-y {\nbottom: var(--ty-scrollbar-width, 8px);\n}\n:host([custom-scrollbar]) .ty-scrollbar-track-x {\nright: var(--ty-scrollbar-width, 8px);\n}\n.shadow-overlay {\nposition: absolute;\ninset: 0;\npointer-events: none;\nz-index: 2;\n}\n.shadow-top,\n.shadow-bottom,\n.shadow-left,\n.shadow-right {\nposition: absolute;\nopacity: 0;\ntransition: var(--ty-scroll-shadow-transition, opacity 0.2s ease-out);\npointer-events: none;\n}\n.shadow-top {\ntop: -40px;\nleft: 0;\nright: 0;\nheight: 80px;\nbackground: var(--ty-scroll-shadow-top, radial-gradient(\nellipse 100% 30% at center,\ncolor-mix(in oklab, var(--ty-color-neutral-bold) 12%, transparent),\ntransparent,\ntransparent\n));\nclip-path: inset(50% 0 0 0);\n}\n.shadow-bottom {\nbottom: -30px;\nleft: 0;\nright: 0;\nheight: 60px;\nbackground: var(--ty-scroll-shadow-bottom, radial-gradient(\nellipse 100% 20% at center,\ncolor-mix(in oklab, var(--ty-color-neutral-bold) 18%, transparent),\ntransparent,\ntransparent\n));\nclip-path: inset(0 0 50% 0);\n}\n.shadow-left {\nleft: -30px;\ntop: 0;\nbottom: 0;\nwidth: 60px;\nbackground: var(--ty-scroll-shadow-left, radial-gradient(\nellipse 30% 100% at center,\ncolor-mix(in oklab, var(--ty-color-neutral-bold) 12%, transparent),\ntransparent,\ntransparent\n));\nclip-path: inset(0 0 0 50%);\n}\n.shadow-right {\nright: -30px;\ntop: 0;\nbottom: 0;\nwidth: 60px;\nbackground: var(--ty-scroll-shadow-right, radial-gradient(\nellipse 30% 100% at center,\ncolor-mix(in oklab, var(--ty-color-neutral-bold) 12%, transparent),\ntransparent,\ntransparent\n));\nclip-path: inset(0 50% 0 0);\n}\n.shadow-left,\n.shadow-right {\ndisplay: none;\n}\n:host([overflow-x]) .shadow-left,\n:host([overflow-x]) .shadow-right {\ndisplay: block;\n}\n.shadow-top.visible,\n.shadow-bottom.visible,\n.shadow-left.visible,\n.shadow-right.visible {\nopacity: 1;\n}\n:host([no-shadow]) .shadow-overlay {\ndisplay: none;\n}\n@media (pointer: coarse) and (hover: none) {\n:host([custom-scrollbar]) .scroll-wrapper {\nscrollbar-width: thin;\nscrollbar-color: var(--ty-border, color-mix(in oklab, var(--ty-color-neutral-bold) 25%, transparent)) transparent;\n}\n:host([custom-scrollbar]) .scroll-wrapper::-webkit-scrollbar {\ndisplay: block;\nwidth: 4px;\nheight: 4px;\n}\n:host([custom-scrollbar]) .scroll-wrapper::-webkit-scrollbar-thumb {\nbackground: var(--ty-border, color-mix(in oklab, var(--ty-color-neutral-bold) 25%, transparent));\nborder-radius: 2px;\n}\n}\n@media (prefers-reduced-motion: reduce) {\n.shadow-top,\n.shadow-bottom,\n.shadow-left,\n.shadow-right {\ntransition-duration: 0ms !important;\n}\n}\n${en}\n`;class TyScrollContainer extends HTMLElement{constructor(){super(),this.Xe=null,this.Ke=null,this.Je=null,this.Ge=null,this.Qe=null,this.dn=null,this.Dt=null,this.ae=null,this.qt=null,this.ti=!1,this.ni=!1,this.It=()=>{null===this.qt&&(this.qt=requestAnimationFrame(()=>{this.qt=null,this.ei()}))},this.ii=()=>{this.dn?.update(),this.ei()};const t=this.attachShadow({mode:"open"});q(t,{css:Lo,id:"ty-scroll-container"}),t.innerHTML='\n<div class="scroll-wrapper">\n<slot></slot>\n</div>\n<div class="shadow-overlay">\n<div class="shadow-top"></div>\n<div class="shadow-bottom"></div>\n<div class="shadow-left"></div>\n<div class="shadow-right"></div>\n</div>\n',this.Xe=t.querySelector(".scroll-wrapper"),this.Ke=t.querySelector(".shadow-top"),this.Je=t.querySelector(".shadow-bottom"),this.Ge=t.querySelector(".shadow-left"),this.Qe=t.querySelector(".shadow-right")}static get observedAttributes(){return["no-shadow","max-height","hide-scrollbar","custom-scrollbar","overflow-x","scroll-anchoring"]}get noShadow(){return this.hasAttribute("no-shadow")}set noShadow(t){t?this.setAttribute("no-shadow",""):this.removeAttribute("no-shadow")}get maxHeight(){return this.getAttribute("max-height")}set maxHeight(t){t?this.setAttribute("max-height",t):this.removeAttribute("max-height"),this.oi()}get hideScrollbar(){return this.hasAttribute("hide-scrollbar")}set hideScrollbar(t){t?this.setAttribute("hide-scrollbar",""):this.removeAttribute("hide-scrollbar")}get customScrollbar(){return this.hasAttribute("custom-scrollbar")}set customScrollbar(t){t?this.setAttribute("custom-scrollbar",""):this.removeAttribute("custom-scrollbar")}get overflowX(){return this.hasAttribute("overflow-x")}set overflowX(t){t?this.setAttribute("overflow-x",""):this.removeAttribute("overflow-x")}get nearEdgeThreshold(){const t=parseInt(this.getAttribute("near-edge-threshold")||"",10);return Number.isFinite(t)?t:100}set nearEdgeThreshold(t){null==t?this.removeAttribute("near-edge-threshold"):this.setAttribute("near-edge-threshold",t+"")}get scrollAnchoring(){return this.hasAttribute("scroll-anchoring")}set scrollAnchoring(t){t?this.setAttribute("scroll-anchoring",""):this.removeAttribute("scroll-anchoring")}connectedCallback(){if(E(this),this.Xe?.addEventListener("scroll",this.It,{passive:!0}),this.Dt=new ResizeObserver(()=>{this.dn?.update(),this.ei()}),this.Xe){this.Dt.observe(this.Xe);const t=this.Xe.querySelector("slot");t&&t.addEventListener("slotchange",this.ii)}this.oi(),this.ei(),this.pn(),this.ri()}disconnectedCallback(){this.Xe?.removeEventListener("scroll",this.It),this.un(),this.si(),this.Dt&&(this.Dt.disconnect(),this.Dt=null),null!==this.qt&&(cancelAnimationFrame(this.qt),this.qt=null)}attributeChangedCallback(t,n,e){n!==e&&("max-height"===t&&(this.oi(),this.ei(),this.dn?.update()),"custom-scrollbar"!==t&&"overflow-x"!==t||(this.un(),this.pn(),this.ei()),"scroll-anchoring"===t&&(this.si(),this.ri()))}ri(){!this.ae&&this.scrollAnchoring&&(this.ae=new MutationObserver(t=>{const n=this.Xe;if(!n)return;const e=new Set;for(const o of t)o.addedNodes.forEach(t=>e.add(t));if(0===e.size)return;let i=0;for(const o of Array.from(this.children)){if(!e.has(o))break;i+=o.offsetHeight}i>0&&(n.scrollTop+=i,this.dn?.update())}),this.ae.observe(this,{childList:!0}))}si(){this.ae?.disconnect(),this.ae=null}pn(){if(this.dn)return;if(!this.Xe||!this.customScrollbar)return;this.dn=new nn(this.Xe,{vertical:!0,horizontal:this.overflowX});const t=this.shadowRoot;this.dn.trackY&&t.appendChild(this.dn.trackY),this.dn.trackX&&t.appendChild(this.dn.trackX)}un(){this.dn&&(this.dn.trackY?.remove(),this.dn.trackX?.remove(),this.dn.destroy(),this.dn=null)}oi(){if(this.Xe){const t=this.maxHeight;t?(this.Xe.style.setProperty("--scroll-max-height",t),this.Xe.style.maxHeight=t):(this.Xe.style.removeProperty("--scroll-max-height"),this.Xe.style.maxHeight="")}}ei(){if(!this.Xe)return;const{scrollTop:t,scrollLeft:n,scrollHeight:e,scrollWidth:i,clientHeight:o,clientWidth:r}=this.Xe;this.Ke&&this.Ke.classList.toggle("visible",t>2),this.Je&&this.Je.classList.toggle("visible",e-2>t+o),this.overflowX&&(this.Ge&&this.Ge.classList.toggle("visible",n>2),this.Qe&&this.Qe.classList.toggle("visible",i-2>n+r));const s=e-o;if(s>0){const n=this.nearEdgeThreshold,i=s-t;this.ni=this.ai("nearend",i,n,this.ni,{distance:i,scrollTop:t,scrollHeight:e,clientHeight:o}),this.ti=this.ai("nearstart",t,n,this.ti,{distance:t,scrollTop:t,scrollHeight:e,clientHeight:o})}else this.ti=!1,this.ni=!1}ai(t,n,e,i,o){return e>=n&&(i||this.dispatchEvent(new CustomEvent(t,{detail:o,bubbles:!0,composed:!0})),!0)}updateShadows(){this.ei(),this.dn?.update()}scrollToTop(t=!0){this.Xe?.scrollTo({top:0,behavior:t?"smooth":"auto"})}scrollToBottom(t=!0){this.Xe&&this.Xe.scrollTo({top:this.Xe.scrollHeight,behavior:t?"smooth":"auto"})}scrollToLeft(t=!0){this.Xe?.scrollTo({left:0,behavior:t?"smooth":"auto"})}scrollToRight(t=!0){this.Xe&&this.Xe.scrollTo({left:this.Xe.scrollWidth,behavior:t?"smooth":"auto"})}scrollToElement(t,n=!0){const e="string"==typeof t?this.querySelector(t):t;e?.scrollIntoView({behavior:n?"smooth":"auto",block:"nearest"})}get scrollElement(){return this.Xe}}customElements.define("ty-scroll-container",TyScrollContainer),"undefined"!=typeof window&&(window.tyVersion=Y,window.tyIcons={register:t=>{et(t)},get:t=>it(t),has:t=>ot(t),list:()=>ct(),cacheInfo:()=>dt(),clearCache:()=>rt()},window.tyResizeObserver={getSize:t=>Eo(t),onResize:(t,n)=>So(t,n),get sizes(){return To()}},window.tyLoader={set:t=>N(t),get:()=>W(),reset:()=>B()}),t.IconRegistry=ht,t.TyButton=R,t.TyCalendar=ro,t.TyCalendarMonth=TyCalendarMonth,t.TyCalendarNavigation=Xi,t.TyCheckbox=Dt,t.TyCopy=Xt,t.TyDatePicker=$o,t.TyFileUpload=Gt,t.TyIcon=gt,t.TyInput=Tt,t.TyModal=TyModal,t.TyOption=TyOption,t.TyPopup=TyPopup,t.TyRadio=Nt,t.TyRadioGroup=Bt,t.TyResizeObserver=TyResizeObserver,t.TyScrollContainer=TyScrollContainer,t.TySelect=Fe,t.TySelectedOptions=TySelectedOptions,t.TySelectedTags=TySelectedOptions,t.TyStep=TyStep,t.TySwitch=jt,t.TyTab=TyTab,t.TyTabs=TyTabs,t.TyTag=yt,t.TyTextarea=rn,t.TyTooltip=TyTooltip,t.TyWizard=TyWizard,t.disableScrollLockDebug=function(){window.tyScrollDebug=!1},t.enableScrollLockDebug=function(){window.tyScrollDebug=!0},t.forceUnlockAll=function(){jn.activeLocks.clear(),On()},t.getActiveLocks=function(){return new Set(jn.activeLocks)},t.getAllSizes=To,t.getLoaderSvg=W,t.getLockState=function(){return{locked:jn.locked,scrollY:jn.scrollY,activeLocks:Array.from(jn.activeLocks)}},t.getSize=Eo,t.isLocked=function(){return jn.locked},t.isLockedBy=function(t){return jn.activeLocks.has(t)},t.lockScroll=Hn,t.onResize=So,t.resetLoaderSvg=B,t.setLoaderSvg=N,t.unlockScroll=Nn,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|