tyrell-components 1.0.0-TC9 → 1.0.0-rc.21
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/AGENTS.md +122 -0
- package/CHANGELOG.md +1531 -0
- package/README.md +71 -53
- package/css/tyrell-colors-static.css +1 -0
- package/css/tyrell-theme.css +1 -0
- package/css/tyrell.css +1 -1783
- package/dist/tyrell-colors-static.css +1 -0
- package/dist/tyrell-theme.css +1 -0
- package/dist/tyrell.css +1 -1783
- package/dist/tyrell.js +1 -1
- package/guides/AGENT_INSTRUCTIONS.md +124 -0
- package/guides/AI_GUIDE.md +53 -0
- package/guides/CSS_GUIDE.md +1016 -0
- package/guides/DATASTAR_TY_GUIDE.md +657 -0
- package/guides/ICONS_GUIDE.md +212 -0
- package/guides/TY_GUIDE.md +935 -0
- package/guides/clj/CLOJURESCRIPT_GUIDE.md +300 -0
- package/guides/clj/CODE_SPLITTING.md +279 -0
- package/guides/clj/COMPONENT_GUIDE.md +391 -0
- package/guides/clj/HELIX_TY_GUIDE.md +428 -0
- package/guides/clj/I18N_GUIDE.md +478 -0
- package/guides/clj/LAYOUT_GUIDE.md +273 -0
- package/guides/clj/QUICKSTART.md +266 -0
- package/guides/clj/REAGENT_TY_GUIDE.md +408 -0
- package/guides/clj/REPLICANT_TY_GUIDE.md +623 -0
- package/guides/clj/ROUTING_GUIDE.md +346 -0
- package/guides/clj/UIX_TY_GUIDE.md +319 -0
- package/guides/js/HTMX_TY_GUIDE.md +252 -0
- package/guides/js/JAVASCRIPT_GUIDE.md +388 -0
- package/guides/js/REACT_TY_GUIDE.md +983 -0
- package/guides/js/SVELTE_TY_GUIDE.md +682 -0
- package/guides/js/TYCOMPONENT_GUIDE.md +962 -0
- package/guides/js/VUE_TY_GUIDE.md +738 -0
- package/lib/base/ty-component.d.ts +57 -13
- package/lib/base/ty-component.js +266 -292
- package/lib/components/button.d.ts +33 -18
- package/lib/components/button.js +317 -267
- package/lib/components/calendar-month.d.ts +30 -47
- package/lib/components/calendar-month.js +455 -429
- package/lib/components/calendar-navigation.d.ts +41 -49
- package/lib/components/calendar-navigation.js +287 -346
- package/lib/components/calendar.d.ts +73 -83
- package/lib/components/calendar.js +837 -762
- package/lib/components/checkbox.d.ts +26 -75
- package/lib/components/checkbox.js +298 -391
- package/lib/components/copy.d.ts +20 -60
- package/lib/components/copy.js +276 -380
- package/lib/components/date-picker.d.ts +100 -183
- package/lib/components/date-picker.js +1155 -1570
- package/lib/components/file-upload.d.ts +16 -15
- package/lib/components/file-upload.js +436 -426
- package/lib/components/icon.d.ts +3 -24
- package/lib/components/icon.js +141 -230
- package/lib/components/input.d.ts +93 -108
- package/lib/components/input.js +734 -710
- package/lib/components/modal.d.ts +39 -29
- package/lib/components/modal.js +419 -438
- package/lib/components/option.d.ts +20 -35
- package/lib/components/option.js +184 -309
- package/lib/components/popup.d.ts +2 -17
- package/lib/components/popup.js +353 -347
- package/lib/components/radio.d.ts +33 -25
- package/lib/components/radio.js +433 -422
- package/lib/components/resize-observer.d.ts +3 -30
- package/lib/components/resize-observer.js +71 -103
- package/lib/components/scroll-container.d.ts +21 -14
- package/lib/components/scroll-container.js +292 -234
- package/lib/components/select.d.ts +446 -0
- package/lib/components/select.js +1381 -0
- package/lib/components/selected-tags.d.ts +60 -0
- package/lib/components/selected-tags.js +225 -0
- package/lib/components/sortable.d.ts +175 -0
- package/lib/components/sortable.js +1844 -0
- package/lib/components/step.d.ts +1 -6
- package/lib/components/step.js +62 -68
- package/lib/components/switch.d.ts +15 -15
- package/lib/components/switch.js +237 -231
- package/lib/components/tab.d.ts +50 -7
- package/lib/components/tab.js +203 -69
- package/lib/components/tabs.d.ts +19 -64
- package/lib/components/tabs.js +600 -618
- package/lib/components/tag.d.ts +14 -52
- package/lib/components/tag.js +231 -306
- package/lib/components/textarea.d.ts +58 -89
- package/lib/components/textarea.js +523 -573
- package/lib/components/tooltip.d.ts +8 -13
- package/lib/components/tooltip.js +322 -409
- package/lib/components/wizard.d.ts +7 -54
- package/lib/components/wizard.js +376 -606
- package/lib/icons/fontawesome/brands.d.ts +0 -1
- package/lib/icons/fontawesome/brands.js +0 -8
- package/lib/icons/fontawesome/regular.d.ts +0 -1
- package/lib/icons/fontawesome/regular.js +0 -8
- package/lib/icons/fontawesome/solid.d.ts +0 -1
- package/lib/icons/fontawesome/solid.js +0 -8
- package/lib/icons/heroicons/micro.d.ts +0 -1
- package/lib/icons/heroicons/micro.js +392 -400
- package/lib/icons/heroicons/mini.d.ts +0 -1
- package/lib/icons/heroicons/mini.js +382 -390
- package/lib/icons/heroicons/outline.d.ts +0 -1
- package/lib/icons/heroicons/outline.js +337 -345
- package/lib/icons/heroicons/solid.d.ts +0 -1
- package/lib/icons/heroicons/solid.js +407 -415
- package/lib/icons/lucide.d.ts +0 -1
- package/lib/icons/lucide.js +24479 -26351
- package/lib/icons/material/filled.d.ts +0 -1
- package/lib/icons/material/filled.js +9653 -9663
- package/lib/icons/material/outlined.d.ts +0 -1
- package/lib/icons/material/outlined.js +10271 -10281
- package/lib/icons/material/round.d.ts +0 -1
- package/lib/icons/material/round.js +10495 -10505
- package/lib/icons/material/sharp.d.ts +0 -1
- package/lib/icons/material/sharp.js +9905 -9915
- package/lib/icons/material/two-tone.d.ts +0 -1
- package/lib/icons/material/two-tone.js +12792 -12802
- package/lib/index.d.ts +7 -4
- package/lib/index.js +26 -39
- package/lib/styles/button.d.ts +24 -7
- package/lib/styles/button.js +285 -445
- package/lib/styles/calendar-month.d.ts +7 -6
- package/lib/styles/calendar-month.js +158 -226
- package/lib/styles/calendar-navigation.d.ts +2 -6
- package/lib/styles/calendar-navigation.js +108 -127
- package/lib/styles/calendar.d.ts +3 -3
- package/lib/styles/calendar.js +87 -23
- package/lib/styles/checkbox.d.ts +7 -6
- package/lib/styles/checkbox.js +101 -15
- package/lib/styles/copy.d.ts +3 -2
- package/lib/styles/copy.js +91 -71
- package/lib/styles/custom-scrollbar.d.ts +1 -2
- package/lib/styles/custom-scrollbar.js +80 -115
- package/lib/styles/date-picker.d.ts +4 -6
- package/lib/styles/date-picker.js +321 -388
- package/lib/styles/field-size.d.ts +6 -0
- package/lib/styles/field-size.js +91 -0
- package/lib/styles/file-upload.d.ts +1 -2
- package/lib/styles/file-upload.js +143 -188
- package/lib/styles/icon.d.ts +2 -6
- package/lib/styles/icon.js +92 -170
- package/lib/styles/input.d.ts +4 -7
- package/lib/styles/input.js +148 -643
- package/lib/styles/modal.d.ts +1 -2
- package/lib/styles/modal.js +127 -108
- package/lib/styles/option.d.ts +2 -6
- package/lib/styles/option.js +53 -96
- package/lib/styles/popup.d.ts +1 -2
- package/lib/styles/popup.js +47 -77
- package/lib/styles/radio.d.ts +3 -2
- package/lib/styles/radio.js +90 -116
- package/lib/styles/resize-observer.d.ts +1 -2
- package/lib/styles/resize-observer.js +2 -12
- package/lib/styles/scroll-container.d.ts +1 -2
- package/lib/styles/scroll-container.js +103 -146
- package/lib/styles/select-base.d.ts +8 -0
- package/lib/styles/select-base.js +747 -0
- package/lib/styles/select.d.ts +11 -0
- package/lib/styles/select.js +229 -0
- package/lib/styles/sortable.d.ts +16 -0
- package/lib/styles/sortable.js +85 -0
- package/lib/styles/step.d.ts +1 -2
- package/lib/styles/step.js +15 -34
- package/lib/styles/switch.d.ts +3 -2
- package/lib/styles/switch.js +52 -68
- package/lib/styles/tab.d.ts +1 -2
- package/lib/styles/tab.js +86 -34
- package/lib/styles/tabs.d.ts +3 -11
- package/lib/styles/tabs.js +204 -162
- package/lib/styles/tag.d.ts +2 -6
- package/lib/styles/tag.js +168 -362
- package/lib/styles/textarea.d.ts +1 -2
- package/lib/styles/textarea.js +238 -306
- package/lib/styles/tooltip.d.ts +4 -3
- package/lib/styles/tooltip.js +3 -131
- package/lib/styles/wizard.d.ts +8 -20
- package/lib/styles/wizard.js +306 -295
- package/lib/types/common.d.ts +9 -8
- package/lib/types/common.js +8 -5
- package/lib/utils/calendar-utils.d.ts +49 -65
- package/lib/utils/calendar-utils.js +158 -343
- package/lib/utils/custom-scrollbar.d.ts +6 -20
- package/lib/utils/custom-scrollbar.js +273 -317
- package/lib/utils/flavor-sheet.d.ts +31 -0
- package/lib/utils/flavor-sheet.js +17 -0
- package/lib/utils/icon-registry.d.ts +0 -15
- package/lib/utils/icon-registry.js +138 -279
- package/lib/utils/icons.d.ts +9 -0
- package/lib/utils/icons.js +1 -0
- package/lib/utils/loader-registry.d.ts +2 -3
- package/lib/utils/loader-registry.js +3 -35
- package/lib/utils/locale.d.ts +2 -80
- package/lib/utils/locale.js +30 -205
- package/lib/utils/mobile.d.ts +0 -1
- package/lib/utils/mobile.js +1 -18
- package/lib/utils/number-format.d.ts +6 -24
- package/lib/utils/number-format.js +53 -136
- package/lib/utils/positioning.d.ts +72 -22
- package/lib/utils/positioning.js +224 -298
- package/lib/utils/property-capture.d.ts +5 -27
- package/lib/utils/property-capture.js +36 -144
- package/lib/utils/property-manager.d.ts +6 -6
- package/lib/utils/property-manager.js +127 -196
- package/lib/utils/resize-observer.d.ts +0 -1
- package/lib/utils/resize-observer.js +23 -59
- package/lib/utils/scroll-lock.d.ts +10 -11
- package/lib/utils/scroll-lock.js +165 -173
- package/lib/utils/styles.d.ts +0 -6
- package/lib/utils/styles.js +17 -48
- package/lib/utils/upgrade-properties.d.ts +21 -0
- package/lib/utils/upgrade-properties.js +47 -0
- package/lib/utils/validity.d.ts +122 -0
- package/lib/utils/validity.js +289 -0
- package/lib/version.d.ts +1 -2
- package/lib/version.js +1 -11
- package/package.json +62 -18
- 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 -404
- package/lib/components/dropdown.d.ts.map +0 -1
- package/lib/components/dropdown.js +0 -1563
- package/lib/components/dropdown.js.map +0 -1
- package/lib/components/file-upload.d.ts.map +0 -1
- package/lib/components/file-upload.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 -408
- package/lib/components/multiselect.d.ts.map +0 -1
- package/lib/components/multiselect.js +0 -1611
- 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/radio.d.ts.map +0 -1
- package/lib/components/radio.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/switch.d.ts.map +0 -1
- package/lib/components/switch.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/checkbox.d.ts.map +0 -1
- package/lib/styles/checkbox.js.map +0 -1
- package/lib/styles/copy.d.ts.map +0 -1
- package/lib/styles/copy.js.map +0 -1
- package/lib/styles/custom-scrollbar.d.ts.map +0 -1
- package/lib/styles/custom-scrollbar.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 -1048
- package/lib/styles/dropdown.js.map +0 -1
- package/lib/styles/file-upload.d.ts.map +0 -1
- package/lib/styles/file-upload.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 -837
- 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/radio.d.ts.map +0 -1
- package/lib/styles/radio.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/switch.d.ts.map +0 -1
- package/lib/styles/switch.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/custom-scrollbar.d.ts.map +0 -1
- package/lib/utils/custom-scrollbar.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/loader-registry.d.ts.map +0 -1
- package/lib/utils/loader-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/mobile.d.ts.map +0 -1
- package/lib/utils/mobile.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 -58
- 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(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).Tyrell={})}(this,function(n){"use strict";class t{constructor(n){this.t=new Map,this.o=n,this.i()}i(){for(const[n,t]of Object.entries(this.o))void 0!==t.default&&this.t.set(n,t.default)}hasConfig(n){return n in this.o}updateProperty(n,t,e="property"){const o=this.o[n];if(!o)return null;const i=this.t.get(n),r=this.l(n,t,o);return this.h(n,r,o)?this.p(i,r)?null:(this.t.set(n,r),{name:n,oldValue:i,newValue:r,source:e}):null}l(n,t,e){if(e.coerce)return e.coerce(t);if(null==t)return e.default??null;switch(e.type){case"boolean":if("string"==typeof t){if(""===t)return!0;const n=t.toLowerCase().trim();return"false"!==n&&"0"!==n}return!!t;case"number":const n=+t;return isNaN(n)?e.default??0:n;case"string":return t+"";case"object":case"array":if("string"==typeof t)try{return JSON.parse(t)}catch{return e.default??("array"===e.type?[]:{})}return t;default:return t}}h(n,t,e){return!e.validate||e.validate(t)}p(n,t){if("object"!=typeof n||"object"!=typeof t)return n===t;if(null===n||null===t)return n===t;try{return JSON.stringify(n)===JSON.stringify(t)}catch{return!1}}get(n){return this.t.get(n)}getAll(){return Object.fromEntries(this.t)}getConfig(n){return this.o[n]}isVisual(n){return this.o[n]?.visual??!1}isFormValue(n){return this.o[n]?.formValue??!1}shouldEmitChange(n){return this.o[n]?.emitChange??!1}handleAlias(n,t){for(const[e,o]of Object.entries(this.o))if(o.aliases&&n in o.aliases)return this.updateProperty(e,o.aliases[n],"attribute");return null}}const e=class extends HTMLElement{constructor(){super(),this.u=!1,this.v=!1,this.props=new t(this.constructor.properties),this.m=this.attachInternals(),this.shadowRoot||this.attachShadow({mode:"open"})}static get observedAttributes(){const n=[];for(const[t,e]of Object.entries(this.properties))if(n.push(t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()),e.aliases)for(const o of Object.keys(e.aliases))n.push(o);return n}setProperty(n,t){const e=this.props.updateProperty(n,t,"property");e&&(this.k(e),this.C([e]))}getProperty(n){return this.props.get(n)}k(n){const{name:t,newValue:e}=n,o=this.props.getConfig(t);if(!o)return;const i=this.S(t);"boolean"===o.type?e?this.setAttribute(i,""):this.removeAttribute(i):null==e?this.removeAttribute(i):this.setAttribute(i,"object"==typeof e?JSON.stringify(e):e+"")}S(n){return n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}T(n){return n.replace(/-([a-z])/g,(n,t)=>t.toUpperCase())}attributeChangedCallback(n,t,e){if(t===e)return;let o=this.props.handleAlias(n,e);if(!o){const t=this.T(n),i=this.props.hasConfig(n)?n:t;o=this.props.updateProperty(i,e,"attribute")}o&&this.C([o])}connectedCallback(){this.u=!0;const n=this.M();n.length>0&&this.C(n),this.onConnect(),this.v||(this.render(),this.v=!0)}disconnectedCallback(){this.u=!1,this.onDisconnect()}M(){const n=[],t=this.constructor;for(const e of Object.keys(t.properties)){const t=Object.getOwnPropertyDescriptor(this,e);if(t&&void 0!==t.value){const o=this.props.updateProperty(e,t.value,"property");o&&n.push(o)}}return n}C(n){0!==n.length&&(this.onPropertiesChanged(n),n.some(n=>this.props.isFormValue(n.name))&&this.updateFormValue(),n.some(n=>this.props.isVisual(n.name))&&this.u&&this.render(),this.D(n))}D(n){for(const t of n)this.props.shouldEmitChange(t.name)&&this.dispatchEvent(new CustomEvent("prop:change",{detail:{property:t.name,oldValue:t.oldValue,newValue:t.newValue},bubbles:!0,composed:!0}))}updateFormValue(){const n=this.getFormValue();this.m.setFormValue(n)}getFormValue(){return this.props.get("value")??null}onPropertiesChanged(n){}onConnect(){}onDisconnect(){}get form(){return this.m.form}formResetCallback(){const n=this.constructor.properties.value;n&&this.setProperty("value",n.default??""),this.onFormReset()}onFormReset(){}};e.formAssociated=!0,e.properties={};let o=e;const i=new Map;function r(n,t){const{css:e,id:o}=t;let r;o&&i.has(o)?r=i.get(o):(r=new CSSStyleSheet,r.replaceSync(e),o&&i.set(o,r));const s=n.adoptedStyleSheets||[];s.includes(r)||(n.adoptedStyleSheets=[...s,r])}let s=null;function a(n){s=n&&n.trim()?n:null}function l(){return s??'<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 d(){s=null}const c=class extends o{constructor(){super(),this.$=!1,r(this.shadowRoot,{css:'\n:host {\n display: inline-block;\n font-family: var(--ty-font-sans);\n}\n\n:host([wide]) {\n display: flex;\n flex-grow: 1;\n}\n\nbutton {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--ty-spacing-1);\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n letter-spacing: var(--ty-tracking-xs);\n font-weight: var(--ty-font-medium);\n white-space: nowrap;\n cursor: pointer;\n user-select: none;\n transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;\n background: transparent;\n color: var(--ty-color-neutral);\n border: 1px solid transparent;\n}\n\nbutton:not(.action) {\n min-width: 4rem;\n}\n\nbutton:not(.pill) {\n border-radius: var(--ty-radius-md);\n}\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)); }\n\nbutton:focus-visible {\n outline: none;\n}\n\nbutton:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n/* ===== LOADING STATE =====\n Spinner overlays the button center; original content kept in flow but\n hidden via visibility so width/height are preserved (no layout shift).\n*/\n.loader-icon {\n display: none;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: 1em;\n height: 1em;\n color: currentColor;\n}\n.loader-icon svg {\n width: 100%;\n height: 100%;\n}\nbutton.loading {\n cursor: wait;\n}\nbutton.loading > *:not(.loader-icon) {\n visibility: hidden;\n}\nbutton.loading > .loader-icon {\n display: inline-flex;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n animation: ty-button-spin 0.7s linear infinite;\n}\n@keyframes ty-button-spin {\n to { transform: translate(-50%, -50%) rotate(360deg); }\n}\n@media (prefers-reduced-motion: reduce) {\n button.loading > .loader-icon {\n animation-duration: 1.6s;\n }\n}\n\n::slotted(*) {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n::slotted(ty-icon) {\n flex-shrink: 0;\n}\n\n:host([wide]) button {\n flex-grow: 1;\n}\n\n/* ===== SIZES ===== */\n\nbutton.xs {\n padding: 0 var(--ty-spacing-2);\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n letter-spacing: var(--ty-tracking-xs);\n gap: var(--ty-spacing-1);\n height: 1.375rem;\n}\n\nbutton.sm {\n padding: 0 var(--ty-spacing-2);\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n letter-spacing: var(--ty-tracking-xs);\n gap: var(--ty-spacing-1);\n height: 1.5rem;\n}\n\nbutton.md {\n padding: 0.375rem var(--ty-spacing-3);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n gap: var(--ty-spacing-2);\n height: 1.8rem;\n}\n\nbutton.lg {\n padding: 0.375rem var(--ty-spacing-4);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n gap: var(--ty-spacing-2);\n height: 2.1rem;\n}\n\nbutton.xl {\n padding: var(--ty-spacing-2) var(--ty-spacing-6);\n font-size: var(--ty-font-base);\n line-height: var(--ty-leading-base);\n letter-spacing: var(--ty-tracking-base);\n gap: var(--ty-spacing-2);\n height: 2.3rem;\n}\n\n/* ===== ACTION (icon-only square) ===== */\n\nbutton.action {\n gap: 0px !important;\n height: 2rem;\n width: 2rem;\n padding: 0px !important;\n}\n\nbutton.action ::slotted(ty-icon) {\n height: 1rem;\n width: 1rem;\n}\n\nbutton.action.xs { height: 1.375rem; width: 1.375rem; }\nbutton.action.xs ::slotted(ty-icon) { height: 0.75rem; width: 0.75rem; }\n\nbutton.action.sm { height: 1.5rem; width: 1.5rem; }\nbutton.action.sm ::slotted(ty-icon) { height: 0.875rem; width: 0.875rem; }\n\nbutton.action.lg { height: 2.25rem; width: 2.25rem; }\nbutton.action.lg ::slotted(ty-icon) { height: 1.125rem; width: 1.125rem; }\n\nbutton.action.xl { height: 2.5rem; width: 2.5rem; }\nbutton.action.xl ::slotted(ty-icon) { height: 1.25rem; width: 1.25rem; }\n\n/* ===== PILL ===== */\n\nbutton.pill {\n border-radius: 9999px;\n padding-left: 1.25em;\n padding-right: 1.25em;\n}\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; }\n\nbutton.pill:has(ty-icon:only-child),\nbutton.pill:has(slot[name="start"]:only-child),\nbutton.pill:has(slot[name="end"]:only-child) {\n padding: 0;\n aspect-ratio: 1;\n min-width: var(--ty-size-md);\n}\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; }\n\n/* ============================================================\n SOLID — saturated brand fill (uses --ty-solid-{flavor}-* tokens)\n Bare .solid rule = fallback for custom flavors (theme via --ty-button-*).\n ============================================================ */\n\nbutton.solid {\n border: none;\n background: var(--ty-button-bg, var(--ty-solid-neutral));\n color: var(--ty-button-color, var(--ty-solid-neutral-fg));\n}\nbutton.solid:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-button-bg, var(--ty-solid-neutral-strong)));\n}\n\n/* Primary */\nbutton.solid.primary {\n background: var(--ty-button-bg, var(--ty-solid-primary));\n color: var(--ty-button-color, var(--ty-solid-primary-fg));\n}\nbutton.solid.primary.tone-plus { background: var(--ty-button-bg, var(--ty-solid-primary-strong)); }\nbutton.solid.primary.tone-minus { background: var(--ty-button-bg, var(--ty-solid-primary-soft)); }\nbutton.solid.primary:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-solid-primary-strong));\n}\nbutton.solid.primary:focus-visible {\n box-shadow: 0 0 0 2px var(--ty-focus-ring-gap), 0 0 0 4px var(--ty-color-primary);\n}\n\n/* Secondary */\nbutton.solid.secondary {\n background: var(--ty-button-bg, var(--ty-solid-secondary));\n color: var(--ty-button-color, var(--ty-solid-secondary-fg));\n}\nbutton.solid.secondary.tone-plus { background: var(--ty-button-bg, var(--ty-solid-secondary-strong)); }\nbutton.solid.secondary.tone-minus { background: var(--ty-button-bg, var(--ty-solid-secondary-soft)); }\nbutton.solid.secondary:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-solid-secondary-strong));\n}\nbutton.solid.secondary:focus-visible {\n box-shadow: 0 0 0 2px var(--ty-focus-ring-gap), 0 0 0 4px var(--ty-color-secondary);\n}\n\n/* Success */\nbutton.solid.success {\n background: var(--ty-button-bg, var(--ty-solid-success));\n color: var(--ty-button-color, var(--ty-solid-success-fg));\n}\nbutton.solid.success.tone-plus { background: var(--ty-button-bg, var(--ty-solid-success-strong)); }\nbutton.solid.success.tone-minus { background: var(--ty-button-bg, var(--ty-solid-success-soft)); }\nbutton.solid.success:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-solid-success-strong));\n}\nbutton.solid.success:focus-visible {\n box-shadow: 0 0 0 2px var(--ty-focus-ring-gap), 0 0 0 4px var(--ty-color-success);\n}\n\n/* Danger */\nbutton.solid.danger {\n background: var(--ty-button-bg, var(--ty-solid-danger));\n color: var(--ty-button-color, var(--ty-solid-danger-fg));\n}\nbutton.solid.danger.tone-plus { background: var(--ty-button-bg, var(--ty-solid-danger-strong)); }\nbutton.solid.danger.tone-minus { background: var(--ty-button-bg, var(--ty-solid-danger-soft)); }\nbutton.solid.danger:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-solid-danger-strong));\n}\nbutton.solid.danger:focus-visible {\n box-shadow: 0 0 0 2px var(--ty-focus-ring-gap), 0 0 0 4px var(--ty-color-danger);\n}\n\n/* Warning */\nbutton.solid.warning {\n background: var(--ty-button-bg, var(--ty-solid-warning));\n color: var(--ty-button-color, var(--ty-solid-warning-fg));\n}\nbutton.solid.warning.tone-plus { background: var(--ty-button-bg, var(--ty-solid-warning-strong)); }\nbutton.solid.warning.tone-minus { background: var(--ty-button-bg, var(--ty-solid-warning-soft)); }\nbutton.solid.warning:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-solid-warning-strong));\n}\nbutton.solid.warning:focus-visible {\n box-shadow: 0 0 0 2px var(--ty-focus-ring-gap), 0 0 0 4px var(--ty-color-warning);\n}\n\n/* Neutral */\nbutton.solid.neutral {\n background: var(--ty-button-bg, var(--ty-solid-neutral));\n color: var(--ty-button-color, var(--ty-solid-neutral-fg));\n}\nbutton.solid.neutral.tone-plus { background: var(--ty-button-bg, var(--ty-solid-neutral-strong)); }\nbutton.solid.neutral.tone-minus { background: var(--ty-button-bg, var(--ty-solid-neutral-soft)); }\nbutton.solid.neutral:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-solid-neutral-strong));\n}\nbutton.solid.neutral:focus-visible {\n box-shadow: 0 0 0 2px var(--ty-focus-ring-gap), 0 0 0 4px var(--ty-color-neutral);\n}\n\n/* ============================================================\n OUTLINED — transparent bg, text === border (uses --ty-color-*)\n Bare .outlined rule = fallback for custom flavors. For outlined,\n text is bound to border color (the rule "text === border"), so the\n fallback chain prefers --ty-button-border, then --ty-button-color.\n ============================================================ */\n\nbutton.outlined {\n background: transparent;\n color: var(--ty-button-border, var(--ty-button-color, var(--ty-color-neutral)));\n border-color: var(--ty-button-border, var(--ty-button-color, var(--ty-color-neutral)));\n}\nbutton.outlined:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-neutral-soft));\n}\n\n/* Primary */\nbutton.outlined.primary {\n color: var(--ty-button-color, var(--ty-color-primary));\n border-color: var(--ty-button-border, var(--ty-color-primary));\n}\nbutton.outlined.primary.tone-plus {\n color: var(--ty-button-color, var(--ty-color-primary-strong));\n border-color: var(--ty-button-border, var(--ty-color-primary-strong));\n}\nbutton.outlined.primary.tone-minus {\n color: var(--ty-button-color, var(--ty-color-primary-soft));\n border-color: var(--ty-button-border, var(--ty-color-primary-soft));\n}\nbutton.outlined.primary:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-primary-soft));\n}\n\n/* Secondary */\nbutton.outlined.secondary {\n color: var(--ty-button-color, var(--ty-color-secondary));\n border-color: var(--ty-button-border, var(--ty-color-secondary));\n}\nbutton.outlined.secondary.tone-plus {\n color: var(--ty-button-color, var(--ty-color-secondary-strong));\n border-color: var(--ty-button-border, var(--ty-color-secondary-strong));\n}\nbutton.outlined.secondary.tone-minus {\n color: var(--ty-button-color, var(--ty-color-secondary-soft));\n border-color: var(--ty-button-border, var(--ty-color-secondary-soft));\n}\nbutton.outlined.secondary:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-secondary-soft));\n}\n\n/* Success */\nbutton.outlined.success {\n color: var(--ty-button-color, var(--ty-color-success));\n border-color: var(--ty-button-border, var(--ty-color-success));\n}\nbutton.outlined.success.tone-plus {\n color: var(--ty-button-color, var(--ty-color-success-strong));\n border-color: var(--ty-button-border, var(--ty-color-success-strong));\n}\nbutton.outlined.success.tone-minus {\n color: var(--ty-button-color, var(--ty-color-success-soft));\n border-color: var(--ty-button-border, var(--ty-color-success-soft));\n}\nbutton.outlined.success:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-success-soft));\n}\n\n/* Danger */\nbutton.outlined.danger {\n color: var(--ty-button-color, var(--ty-color-danger));\n border-color: var(--ty-button-border, var(--ty-color-danger));\n}\nbutton.outlined.danger.tone-plus {\n color: var(--ty-button-color, var(--ty-color-danger-strong));\n border-color: var(--ty-button-border, var(--ty-color-danger-strong));\n}\nbutton.outlined.danger.tone-minus {\n color: var(--ty-button-color, var(--ty-color-danger-soft));\n border-color: var(--ty-button-border, var(--ty-color-danger-soft));\n}\nbutton.outlined.danger:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-danger-soft));\n}\n\n/* Warning */\nbutton.outlined.warning {\n color: var(--ty-button-color, var(--ty-color-warning));\n border-color: var(--ty-button-border, var(--ty-color-warning));\n}\nbutton.outlined.warning.tone-plus {\n color: var(--ty-button-color, var(--ty-color-warning-strong));\n border-color: var(--ty-button-border, var(--ty-color-warning-strong));\n}\nbutton.outlined.warning.tone-minus {\n color: var(--ty-button-color, var(--ty-color-warning-soft));\n border-color: var(--ty-button-border, var(--ty-color-warning-soft));\n}\nbutton.outlined.warning:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-warning-soft));\n}\n\n/* Neutral */\nbutton.outlined.neutral {\n color: var(--ty-button-color, var(--ty-color-neutral));\n border-color: var(--ty-button-border, var(--ty-color-neutral));\n}\nbutton.outlined.neutral.tone-plus {\n color: var(--ty-button-color, var(--ty-color-neutral-strong));\n border-color: var(--ty-button-border, var(--ty-color-neutral-strong));\n}\nbutton.outlined.neutral.tone-minus {\n color: var(--ty-button-color, var(--ty-color-neutral-soft));\n border-color: var(--ty-button-border, var(--ty-color-neutral-soft));\n}\nbutton.outlined.neutral:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-neutral-soft));\n}\n\n/* ============================================================\n GHOST — text only, hover bg (uses --ty-color-* + --ty-bg-*-soft)\n Bare .ghost rule = fallback for custom flavors.\n ============================================================ */\n\nbutton.ghost {\n background: transparent;\n border: none;\n color: var(--ty-button-color, var(--ty-color-neutral));\n}\nbutton.ghost:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-neutral-soft));\n}\n\n/* Primary */\nbutton.ghost.primary { color: var(--ty-button-color, var(--ty-color-primary)); }\nbutton.ghost.primary.tone-plus { color: var(--ty-button-color, var(--ty-color-primary-strong)); }\nbutton.ghost.primary.tone-minus { color: var(--ty-button-color, var(--ty-color-primary-soft)); }\nbutton.ghost.primary:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-primary-soft));\n}\n\n/* Secondary */\nbutton.ghost.secondary { color: var(--ty-button-color, var(--ty-color-secondary)); }\nbutton.ghost.secondary.tone-plus { color: var(--ty-button-color, var(--ty-color-secondary-strong)); }\nbutton.ghost.secondary.tone-minus { color: var(--ty-button-color, var(--ty-color-secondary-soft)); }\nbutton.ghost.secondary:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-secondary-soft));\n}\n\n/* Success */\nbutton.ghost.success { color: var(--ty-button-color, var(--ty-color-success)); }\nbutton.ghost.success.tone-plus { color: var(--ty-button-color, var(--ty-color-success-strong)); }\nbutton.ghost.success.tone-minus { color: var(--ty-button-color, var(--ty-color-success-soft)); }\nbutton.ghost.success:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-success-soft));\n}\n\n/* Danger */\nbutton.ghost.danger { color: var(--ty-button-color, var(--ty-color-danger)); }\nbutton.ghost.danger.tone-plus { color: var(--ty-button-color, var(--ty-color-danger-strong)); }\nbutton.ghost.danger.tone-minus { color: var(--ty-button-color, var(--ty-color-danger-soft)); }\nbutton.ghost.danger:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-danger-soft));\n}\n\n/* Warning */\nbutton.ghost.warning { color: var(--ty-button-color, var(--ty-color-warning)); }\nbutton.ghost.warning.tone-plus { color: var(--ty-button-color, var(--ty-color-warning-strong)); }\nbutton.ghost.warning.tone-minus { color: var(--ty-button-color, var(--ty-color-warning-soft)); }\nbutton.ghost.warning:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-warning-soft));\n}\n\n/* Neutral */\nbutton.ghost.neutral { color: var(--ty-button-color, var(--ty-color-neutral)); }\nbutton.ghost.neutral.tone-plus { color: var(--ty-button-color, var(--ty-color-neutral-strong)); }\nbutton.ghost.neutral.tone-minus { color: var(--ty-button-color, var(--ty-color-neutral-soft)); }\nbutton.ghost.neutral:hover:not(:disabled) {\n background: var(--ty-button-bg-hover, var(--ty-bg-neutral-soft));\n}\n',id:"ty-button"})}onConnect(){}onDisconnect(){}onPropertiesChanged(n){}get flavor(){return this.getProperty("flavor")}set flavor(n){this.setProperty("flavor",n)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get appearance(){return this.getProperty("appearance")}set appearance(n){this.setProperty("appearance",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}get loading(){return this.getProperty("loading")}set loading(n){this.setProperty("loading",n)}get type(){return this.getProperty("type")}set type(n){this.setProperty("type",n)}get pill(){return this.getProperty("pill")}set pill(n){this.setProperty("pill",n)}get action(){return this.getProperty("action")}set action(n){this.setProperty("action",n)}get wide(){return this.getProperty("wide")}set wide(n){this.setProperty("wide",n)}get name(){return this.getProperty("name")}set name(n){this.setProperty("name",n)}get value(){return this.getProperty("value")}set value(n){this.setProperty("value",n)}parseFlavor(){const n=this.flavor||"";return n.length>1&&n.endsWith("+")?{base:n.slice(0,-1),tone:"+"}:n.length>1&&n.endsWith("-")?{base:n.slice(0,-1),tone:"-"}:{base:n,tone:""}}buildClasses(){const{base:n,tone:t}=this.parseFlavor();return function(...n){return n.filter(Boolean).join(" ")}(n,this.size,this.appearance,this.pill&&"pill",this.action&&"action","+"===t&&"tone-plus","-"===t&&"tone-minus")}handleFormAction(){const n=this.m.form;if(n)switch(this.type){case"submit":this.name&&this.value&&this.m.setFormValue(this.value),n.requestSubmit();break;case"reset":n.reset()}}initializeButtonStructure(){const n=this.shadowRoot,t=this.buildClasses(),e=document.createElement("button");e.disabled=this.disabled,e.className=t;const o=document.createElement("span");o.className="loader-icon",o.setAttribute("aria-hidden","true"),o.innerHTML=l();const i=document.createElement("slot");i.name="start",i.className="start";const r=document.createElement("slot"),s=document.createElement("slot");s.name="end",s.className="end",e.appendChild(o),e.appendChild(i),e.appendChild(r),e.appendChild(s),e.addEventListener("click",n=>{this.disabled||this.loading||(n.stopPropagation(),this.handleFormAction(),this.dispatchEvent(new CustomEvent("click",{bubbles:!0,composed:!0,detail:{originalEvent:n}})))}),this.applyLoadingState(e),n.appendChild(e),this.$=!0}applyLoadingState(n){const t=this.loading;if(n.classList.toggle("loading",t),t){n.setAttribute("aria-busy","true");const t=n.querySelector(".loader-icon");t&&(t.innerHTML=l())}else n.removeAttribute("aria-busy")}render(){const n=this.shadowRoot;if(!this.$)return void this.initializeButtonStructure();const t=this.buildClasses(),e=n.querySelector("button");e&&(e.disabled=this.disabled,e.className=t,this.applyLoadingState(e))}};c.formAssociated=!0,c.properties={flavor:{type:"string",visual:!0,default:"neutral"},size:{type:"string",visual:!0,default:"md",validate:n=>["xs","sm","md","lg","xl"].includes(n),coerce:n=>["xs","sm","md","lg","xl"].includes(n)?n:"md"},appearance:{type:"string",visual:!0,default:"solid",validate:n=>["solid","outlined","ghost"].includes(n),coerce:n=>["solid","outlined","ghost"].includes(n)?n:"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},wide:{type:"boolean",visual:!1,default:!1},name:{type:"string",default:""},value:{type:"string",default:""}};let h=c;customElements.get("ty-button")||customElements.define("ty-button",h);const p="1.0.0-TC9",u=new Map,g=new Map,b=new Map;let v=null,m=null;const y="ty-icons-v"+p,f="https://ty-icons.local/",w=new Map;let x=!1;async function k(n,t){if("caches"in window)try{const e=await caches.open(y),o=new Response(t,{headers:{"Content-Type":"image/svg+xml"}});await e.put(`${f}${n}`,o)}catch(e){}}async function z(n){const t=w.get(n);if(t)return t;const e=(async()=>{try{await async function(){if(!x&&"caches"in window){x=!0;try{const n=(await caches.keys()).filter(n=>n.startsWith("ty-icons-v")&&n!==y);await Promise.all(n.map(n=>caches.delete(n)))}catch(n){}}}();const t=await caches.open(y),e=await t.match(`${f}${n}`);if(e)return await e.text()}catch(t){}return null})();return w.set(n,e),e.finally(()=>{w.delete(n)}),e}function C(n){const t=new Set;Object.entries(n).forEach(([n,e])=>{u.set(n,e),t.add(n)}),t.size>0&&$(t)}function S(n){return u.get(n)}function E(n){return u.has(n)}async function T(){const n=new Set(u.keys());if(u.clear(),"caches"in window)try{await caches.delete(y),x=!1}catch(t){}$(n)}function M(n,t,e){g.set(n,e),t&&b.set(n,t)}function D(n){g.delete(n),b.delete(n)}function $(n){v||(v=new Set),n.forEach(n=>v.add(n)),null!==m&&clearTimeout(m);const t="undefined"!=typeof requestIdleCallback?requestIdleCallback:n=>setTimeout(n,0);m=t(()=>{const n=v;v=null,m=null,n&&n.size>0&&function(n){g.forEach((t,e)=>{const o=b.get(e);o?n.has(o)&&t(new Set([o])):t(n)})}(n)})}function A(){return Array.from(u.keys())}async function I(){const n={version:p,cacheName:y,available:"caches"in window};if(!n.available)return n;try{const t=await caches.open(y),e=(await t.keys()).filter(n=>n.url.startsWith(f));return{...n,iconCount:e.length}}catch(t){return n}}const O=Object.freeze(Object.defineProperty({__proto__:null,addWatcher:M,clearIcons:T,getCacheInfo:I,getCachedIcon:z,getIcon:S,getIconCount:function(){return u.size},getIconNames:A,hasIcon:E,registerIcon:function(n,t){u.set(n,t),$(new Set([n])),z(n).then(e=>{e!==t&&k(n,t).catch(()=>{})}).catch(()=>{k(n,t).catch(()=>{})})},registerIcons:C,removeWatcher:D},Symbol.toStringTag,{value:"Module"}));let L=0;const N='<svg xmlns="http://www.w3.org/2000/svg"\n viewBox="0 0 512 512"\n fill="currentColor"\n opacity="0.2">\n <path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512z"/>\n</svg>',q=class extends o{constructor(){super(),this.A=null,this.I="",this.O=null,r(this.shadowRoot,{css:"\n:host {\n /* Display & Layout - CRITICAL: No containment to prevent paint deferral */\n display: flex;\n align-items: center;\n justify-content: center;\n line-height: 0;\n \n /* Dimensions with CSS variable support for flexibility */\n width: var(--ty-icon-size, 1em);\n height: var(--ty-icon-size, 1em);\n \n /* Enforce square aspect ratio */\n aspect-ratio: 1 / 1;\n \n \n /* Color & Transitions */\n color: inherit;\n transition: color var(--ty-transition-fast);\n \n /* Flex Behavior */\n flex-shrink: 0;\n \n /* Visibility - Force immediate rendering */\n visibility: visible !important;\n opacity: 1;\n \n /* ANTI-FLICKER: Force browser to paint immediately */\n will-change: contents;\n \n /* Prevent any sub-pixel rendering issues */\n transform: translateZ(0);\n -webkit-font-smoothing: antialiased;\n}\n\n/* The SVG element inside shadow DOM (registry / fallback path) */\n:host svg {\n width: 100%;\n height: 100%;\n display: block;\n\n /* Force immediate SVG rendering */\n will-change: auto;\n transform: translateZ(0);\n}\n\n/* Slotted SVG (server-side path: <ty-icon><svg>...</svg></ty-icon>).\n ::slotted() targets light-DOM children so they fill the host the same way\n shadow-DOM SVG does. Color is inherited from :host via currentColor. */\n::slotted(svg),\n::slotted(img) {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n/* When used in slots, ensure proper display */\n:host([slot]) {\n display: inline-flex;\n}\n\n/* Size variants via CSS classes on the host */\n:host(.icon-xs) {\n width: 0.75em;\n height: 0.75em;\n}\n\n:host(.icon-sm) {\n width: 0.875em;\n height: 0.875em;\n}\n\n:host(.icon-md) {\n width: 1em;\n height: 1em;\n}\n\n:host(.icon-lg) {\n width: 1.25em;\n height: 1.25em;\n}\n\n:host(.icon-xl) {\n width: 1.5em;\n height: 1.5em;\n}\n\n:host(.icon-2xl) {\n width: 2em;\n height: 2em;\n}\n\n/* Fixed pixel sizes */\n:host(.icon-12) {\n width: 12px;\n height: 12px;\n}\n\n:host(.icon-14) {\n width: 14px;\n height: 14px;\n}\n\n:host(.icon-16) {\n width: 16px;\n height: 16px;\n}\n\n:host(.icon-18) {\n width: 18px;\n height: 18px;\n}\n\n:host(.icon-20) {\n width: 20px;\n height: 20px;\n}\n\n:host(.icon-24) {\n width: 24px;\n height: 24px;\n}\n\n:host(.icon-32) {\n width: 32px;\n height: 32px;\n}\n\n:host(.icon-48) {\n width: 48px;\n height: 48px;\n}\n\n:host(.icon-64) {\n width: 64px;\n height: 64px;\n}\n\n:host(.icon-80) {\n width: 80px;\n height: 80px;\n}\n\n:host(.icon-96) {\n width: 96px;\n height: 96px;\n}\n\n/* Spinning animation - default tempo */\n:host(.icon-spin) {\n animation: icon-spin 1s linear infinite;\n}\n\n/* Spinning animation - slow tempo */\n:host(.icon-spin.icon-tempo-slow) {\n animation: icon-spin 2s linear infinite;\n}\n\n/* Spinning animation - fast tempo */\n:host(.icon-spin.icon-tempo-fast) {\n animation: icon-spin 0.5s linear infinite;\n}\n\n@keyframes icon-spin {\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n}\n\n/* Pulse animation - default tempo */\n:host(.icon-pulse) {\n animation: icon-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n\n/* Pulse animation - slow tempo */\n:host(.icon-pulse.icon-tempo-slow) {\n animation: icon-pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n\n/* Pulse animation - fast tempo */\n:host(.icon-pulse.icon-tempo-fast) {\n animation: icon-pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n\n@keyframes icon-pulse {\n 0%,\n 100% {\n opacity: 1;\n }\n\n 50% {\n opacity: 0.5;\n }\n}\n\n/* Accessibility: ensure icons are not announced by screen readers by default */\n:host {\n -webkit-user-select: none;\n user-select: none;\n}\n\n/* Allow pointer events to pass through by default */\n:host(:not(.icon-clickable)) {\n pointer-events: none;\n}\n\n/* Clickable icons */\n:host(.icon-clickable) {\n cursor: pointer;\n pointer-events: auto;\n transition: color var(--ty-transition-fast), transform var(--ty-transition-fast);\n}\n\n:host(.icon-clickable:hover) {\n transform: scale(1.1);\n}\n\n:host(.icon-clickable:active) {\n transform: scale(0.95);\n}\n\n/* Disabled state */\n:host(.icon-disabled) {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n/* Block display variant */\n:host(.icon-block) {\n display: block;\n}\n",id:"ty-icon"}),this.O=document.createElement("slot"),this.O.innerHTML=N,this.I=N,this.shadowRoot.appendChild(this.O)}onConnect(){this.A="ty-icon-"+ ++L,this.name&&M(this.A,this.name,n=>{this.name&&n.has(this.name)&&this.render()}),this.updateClasses()}onDisconnect(){this.A&&(D(this.A),this.A=null)}onPropertiesChanged(n){for(const t of n)if("name"===t.name){this.A&&D(this.A);const n=t.newValue||"";n&&this.isConnected&&(this.A="ty-icon-"+ ++L,M(this.A,n,n=>{this.name&&n.has(this.name)&&this.render()}))}this.updateClasses()}get name(){return this.getProperty("name")}set name(n){this.setProperty("name",n)}get size(){return this.getProperty("size")||void 0}set size(n){this.setProperty("size",n||"")}get spin(){return this.getProperty("spin")}set spin(n){this.setProperty("spin",n)}get pulse(){return this.getProperty("pulse")}set pulse(n){this.setProperty("pulse",n)}get tempo(){return this.getProperty("tempo")||void 0}set tempo(n){this.setProperty("tempo",n||"")}buildClasses(){const n=[],t=this.getProperty("size");t&&n.push("icon-"+t),this.getProperty("spin")&&n.push("icon-spin"),this.getProperty("pulse")&&n.push("icon-pulse");const e=this.getProperty("tempo");e&&(this.getProperty("spin")||this.getProperty("pulse"))&&n.push("icon-tempo-"+e);const o=this.className.split(/\s+/).filter(n=>n&&!n.startsWith("icon-")&&"icon-spin"!==n&&"icon-pulse"!==n);return[...n,...o]}updateClasses(){const n=this.buildClasses().join(" ");this.className!==n&&(this.className=n)}render(){const n=this.getProperty("name");if(!n)return void this.renderSvg(N);const t=S(n);this.renderSvg(t||N)}renderSvg(n){this.I!==n&&this.O&&(this.O.innerHTML=n,this.I=n)}};q.formAssociated=!1,q.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 R=q;customElements.get("ty-icon")||customElements.define("ty-icon",R);const P=class extends o{constructor(){super(),this.L=null,this.handleClick=n=>{this.clickable&&!this.disabled&&(n.preventDefault(),n.stopPropagation(),this.dispatchTagEvent("click",{target:this}),this.dispatchTagEvent("pointerdown",{target:this}))},this.handleDismiss=n=>{this.dismissible&&!this.disabled&&(n.preventDefault(),n.stopPropagation(),this.dispatchTagEvent("dismiss",{target:this}))},this.handleKeydown=n=>{const t=n;if(!this.disabled)switch(t.keyCode){case 13:case 32:this.clickable&&(t.preventDefault(),this.dispatchTagEvent("click",{target:this}));break;case 8:case 46:this.dismissible&&(t.preventDefault(),this.dispatchTagEvent("dismiss",{target:this}))}},r(this.shadowRoot,{css:'\n/* Tag Component Styles using centralized ty.variables.css */\n\n/* Host element */\n\n/* Hidden attribute support */\n:host([hidden]) {\n display: none !important;\n}\n\n/* Main container */\n.tag-container {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--ty-spacing-1);\n /* Default pill shape - can be overridden */\n border-radius: var(--ty-radius-full);\n font-weight: var(--ty-font-medium);\n text-align: center;\n white-space: nowrap;\n user-select: none;\n box-sizing: border-box;\n\n /* Default MD size — anchor at 28px, even +4 steps for other sizes */\n padding: 0 0.625rem; /* 0 10px */\n font-size: var(--ty-font-xs); /* 14px */\n line-height: var(--ty-leading-xs); /* 21px */\n letter-spacing: var(--ty-tracking-xs); /* -0.013em */\n min-height: 28px;\n\n /* Transitions using centralized values */\n transition: var(--ty-transition-all);\n\n /* Colors via custom properties — override on :host for full control */\n background: var(--tag-bg, transparent);\n color: var(--tag-color, var(--ty-text));\n border: 1px solid;jk\n border-color: var(--tag-border-color, var(--ty-border));\n}\n\n/* Non-pill variant - rectangular with rounded corners */\n:host([pill="false"]) .tag-container,\n:host([not-pill]) .tag-container {\n border-radius: var(--ty-radius-md);\n /* 6px instead of full pill */\n}\n\n/* Tags with value attribute but NOT selected should be clickable */\n:host([value]:not([selected])) .tag-container:not([aria-disabled="true"]) {\n cursor: pointer;\n}\n\n:host([selected]) .tag-container:not([aria-disabled="true"]) {\n cursor: initial;\n}\n\n.tag-container[tabindex]:not([aria-disabled="true"]):hover {\n background: var(--ty-bg-neutral-soft);\n transform: translateY(-1px);\n box-shadow: var(--ty-shadow-sm);\n}\n\n.tag-container[tabindex]:not([aria-disabled="true"]):active {\n transform: translateY(0);\n box-shadow: var(--ty-shadow-sm);\n}\n\n.tag-container[tabindex]:focus {\n outline: none;\n}\n\n/* Disabled state */\n.tag-container[aria-disabled="true"] {\n opacity: 0.6;\n cursor: not-allowed;\n pointer-events: none;\n}\n\n/* Slot containers */\n.tag-start,\n.tag-content,\n.tag-end {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n}\n\n.tag-content {\n flex: 1;\n min-width: 0;\n}\n\n/* Dismiss button */\n.tag-dismiss {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n background: none;\n border: none;\n color: currentColor;\n cursor: pointer;\n border-radius: var(--ty-radius-full);\n transition: var(--ty-transition-all);\n opacity: 0.7;\n flex-shrink: 0;\n /* Default MD dismiss button size */\n width: var(--ty-spacing-4);\n /* 16px */\n height: var(--ty-spacing-4);\n}\n\n.tag-dismiss:hover {\n opacity: 1;\n background: rgba(0, 0, 0, 0.1);\n}\n\n.tag-dismiss svg {\n width: 100%;\n height: 100%;\n}\n\n/* Size variants - override defaults */\n:host([size="xs"]) .tag-container {\n padding: 0 0.375rem; /* 0 6px */\n font-size: var(--ty-font-xs); /* 12px */\n line-height: var(--ty-leading-xs);\n letter-spacing: var(--ty-tracking-xs);\n min-height: 20px;\n}\n\n:host([size="xs"]) .tag-dismiss {\n width: var(--ty-spacing-3);\n height: var(--ty-spacing-3);\n margin-left: var(--ty-spacing-2);\n}\n\n:host([size="sm"]) .tag-container {\n padding: 0 var(--ty-spacing-2); /* 0 8px */\n font-size: var(--ty-font-xs); /* 12px */\n line-height: var(--ty-leading-xs);\n letter-spacing: var(--ty-tracking-xs);\n min-height: 24px;\n}\n\n:host([size="sm"]) .tag-dismiss {\n width: var(--ty-spacing-3);\n height: var(--ty-spacing-3);\n margin-left: var(--ty-spacing-2);\n}\n\n/* MD is now the default - no need for explicit [size="md"] selector */\n/* All default styles above apply to MD size (min-height: 24px) */\n\n:host([size="lg"]) .tag-container {\n padding: 0 var(--ty-spacing-3); /* 0 12px */\n font-size: var(--ty-font-sm); /* 14px */\n line-height: var(--ty-leading-sm); /* 21px */\n letter-spacing: var(--ty-tracking-sm); /* -0.013em */\n min-height: 32px;\n}\n\n:host([size="lg"]) .tag-dismiss {\n width: var(--ty-spacing-5);\n height: var(--ty-spacing-5);\n margin-left: var(--ty-spacing-4);\n}\n\n:host([size="xl"]) .tag-container {\n padding: 0 0.875rem; /* 0 14px */\n font-size: var(--ty-font-sm); /* 14px */\n line-height: var(--ty-leading-sm); /* 21px */\n letter-spacing: var(--ty-tracking-sm); /* -0.013em */\n min-height: 36px;\n}\n\n:host([size="xl"]) .tag-dismiss {\n width: var(--ty-spacing-5);\n height: var(--ty-spacing-5);\n margin-left: var(--ty-spacing-4);\n}\n\n/* ===== FLAVOR VARIANTS =====\n Each flavor sets --tag-bg / --tag-color / --tag-border-color on :host.\n Append \'+\' to flavor for a stronger shade (mild background, strong color),\n or \'-\' for a softer shade (soft background, base color). */\n\n/* ----- PRIMARY ----- */\n:host([flavor="primary"]) {\n --tag-bg: var(--ty-bg-primary);\n --tag-color: var(--ty-color-primary-strong);\n --tag-border-color: var(--ty-border-primary);\n}\n:host([flavor="primary+"]) {\n --tag-bg: var(--ty-bg-primary-mild);\n --tag-color: var(--ty-color-primary-strong);\n --tag-border-color: var(--ty-color-primary);\n}\n:host([flavor="primary-"]) {\n --tag-bg: var(--ty-bg-primary-soft);\n --tag-color: var(--ty-color-primary);\n --tag-border-color: var(--ty-border-primary);\n}\n:host([flavor="primary"]) .tag-container[tabindex]:hover,\n:host([flavor="primary+"]) .tag-container[tabindex]:hover,\n:host([flavor="primary-"]) .tag-container[tabindex]:hover {\n background: var(--ty-bg-primary-mild);\n}\n:host([flavor="primary"]) .tag-container[tabindex]:focus,\n:host([flavor="primary+"]) .tag-container[tabindex]:focus,\n:host([flavor="primary-"]) .tag-container[tabindex]:focus {\n box-shadow: 0 0 0 3px var(--ty-color-primary-faint);\n}\n\n/* ----- SECONDARY ----- */\n:host([flavor="secondary"]) {\n --tag-bg: var(--ty-bg-secondary);\n --tag-color: var(--ty-color-secondary-strong);\n --tag-border-color: var(--ty-border-secondary);\n}\n:host([flavor="secondary+"]) {\n --tag-bg: var(--ty-bg-secondary-mild);\n --tag-color: var(--ty-color-secondary-strong);\n --tag-border-color: var(--ty-color-secondary);\n}\n:host([flavor="secondary-"]) {\n --tag-bg: var(--ty-bg-secondary-soft);\n --tag-color: var(--ty-color-secondary);\n --tag-border-color: var(--ty-border-secondary);\n}\n:host([flavor="secondary"]) .tag-container[tabindex]:hover,\n:host([flavor="secondary+"]) .tag-container[tabindex]:hover,\n:host([flavor="secondary-"]) .tag-container[tabindex]:hover {\n background: var(--ty-bg-secondary-mild);\n}\n:host([flavor="secondary"]) .tag-container[tabindex]:focus,\n:host([flavor="secondary+"]) .tag-container[tabindex]:focus,\n:host([flavor="secondary-"]) .tag-container[tabindex]:focus {\n box-shadow: 0 0 0 3px var(--ty-color-secondary-faint);\n}\n\n/* ----- SUCCESS ----- */\n:host([flavor="success"]) {\n --tag-bg: var(--ty-bg-success);\n --tag-color: var(--ty-color-success-strong);\n --tag-border-color: var(--ty-border-success);\n}\n:host([flavor="success+"]) {\n --tag-bg: var(--ty-bg-success-mild);\n --tag-color: var(--ty-color-success-strong);\n --tag-border-color: var(--ty-color-success);\n}\n:host([flavor="success-"]) {\n --tag-bg: var(--ty-bg-success-soft);\n --tag-color: var(--ty-color-success);\n --tag-border-color: var(--ty-border-success);\n}\n:host([flavor="success"]) .tag-container[tabindex]:hover,\n:host([flavor="success+"]) .tag-container[tabindex]:hover,\n:host([flavor="success-"]) .tag-container[tabindex]:hover {\n background: var(--ty-bg-success-mild);\n}\n:host([flavor="success"]) .tag-container[tabindex]:focus,\n:host([flavor="success+"]) .tag-container[tabindex]:focus,\n:host([flavor="success-"]) .tag-container[tabindex]:focus {\n box-shadow: 0 0 0 3px var(--ty-color-success-faint);\n}\n\n/* ----- DANGER ----- */\n:host([flavor="danger"]) {\n --tag-bg: var(--ty-bg-danger);\n --tag-color: var(--ty-color-danger-strong);\n --tag-border-color: var(--ty-border-danger);\n}\n:host([flavor="danger+"]) {\n --tag-bg: var(--ty-bg-danger-mild);\n --tag-color: var(--ty-color-danger-strong);\n --tag-border-color: var(--ty-color-danger);\n}\n:host([flavor="danger-"]) {\n --tag-bg: var(--ty-bg-danger-soft);\n --tag-color: var(--ty-color-danger);\n --tag-border-color: var(--ty-border-danger);\n}\n:host([flavor="danger"]) .tag-container[tabindex]:hover,\n:host([flavor="danger+"]) .tag-container[tabindex]:hover,\n:host([flavor="danger-"]) .tag-container[tabindex]:hover {\n background: var(--ty-bg-danger-mild);\n}\n:host([flavor="danger"]) .tag-container[tabindex]:focus,\n:host([flavor="danger+"]) .tag-container[tabindex]:focus,\n:host([flavor="danger-"]) .tag-container[tabindex]:focus {\n box-shadow: 0 0 0 3px var(--ty-color-danger-faint);\n}\n\n/* ----- WARNING ----- */\n:host([flavor="warning"]) {\n --tag-bg: var(--ty-bg-warning);\n --tag-color: var(--ty-color-warning-strong);\n --tag-border-color: var(--ty-border-warning);\n}\n:host([flavor="warning+"]) {\n --tag-bg: var(--ty-bg-warning-mild);\n --tag-color: var(--ty-color-warning-strong);\n --tag-border-color: var(--ty-color-warning);\n}\n:host([flavor="warning-"]) {\n --tag-bg: var(--ty-bg-warning-soft);\n --tag-color: var(--ty-color-warning);\n --tag-border-color: var(--ty-border-warning);\n}\n:host([flavor="warning"]) .tag-container[tabindex]:hover,\n:host([flavor="warning+"]) .tag-container[tabindex]:hover,\n:host([flavor="warning-"]) .tag-container[tabindex]:hover {\n background: var(--ty-bg-warning-mild);\n}\n:host([flavor="warning"]) .tag-container[tabindex]:focus,\n:host([flavor="warning+"]) .tag-container[tabindex]:focus,\n:host([flavor="warning-"]) .tag-container[tabindex]:focus {\n box-shadow: 0 0 0 3px var(--ty-color-warning-faint);\n}\n\n/* ----- INFO (kept for back-compat — not in built-in Flavor union) ----- */\n:host([flavor="info"]) {\n --tag-bg: var(--ty-bg-info);\n --tag-color: var(--ty-color-info-strong);\n --tag-border-color: var(--ty-border-info);\n}\n\n:host([flavor="info"]) .tag-container[tabindex]:hover {\n background: var(--ty-bg-info-mild);\n}\n\n:host([flavor="info"]) .tag-container[tabindex]:focus {\n box-shadow: 0 0 0 3px var(--ty-color-info-faint);\n}\n\n/* ----- NEUTRAL ----- */\n:host([flavor="neutral"]) {\n --tag-color: var(--ty-text-mild);\n --tag-bg: var(--ty-bg-neutral-soft);\n --tag-border-color: var(--ty-border-mild);\n}\n\n:host([flavor="neutral+"]) {\n --tag-bg: var(--ty-bg-neutral-mild);\n --tag-color: var(--ty-text-mild);\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-mildstrong);\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 {\n background: 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 {\n box-shadow: 0 0 0 3px var(--ty-border-soft);\n}\n\n/* Slotted content styling */\n.tag-start ::slotted(*),\n.tag-content ::slotted(*),\n.tag-end ::slotted(*) {\n display: flex;\n align-items: center;\n}\n\n/* Icon sizing for slotted icons */\n.tag-start ::slotted(ty-icon),\n.tag-end ::slotted(ty-icon) {\n width: 1em;\n height: 1em;\n flex-shrink: 0;\n}\n\n/* Count/badge styling using centralized spacing */\n.tag-end ::slotted(.count) {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: var(--ty-spacing-6);\n /* 24px */\n height: var(--ty-spacing-5);\n /* 20px */\n padding: 0 var(--ty-spacing-2);\n /* 0 8px */\n background: rgba(0, 0, 0, 0.1);\n border-radius: var(--ty-radius-full);\n font-size: var(--ty-font-xs);\n font-weight: var(--ty-font-semibold);\n line-height: var(--ty-line-height-none);\n flex-shrink: 0;\n}\n\n/* Special handling for long text content */\n.tag-content {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n:host([data-type="user"]) .tag-container {\n min-width: var(--ty-spacing-20);\n /* 80px for user tags */\n}\n\n/* Dark mode is handled automatically by the centralized variables */\n',id:"ty-tag"})}onConnect(){queueMicrotask(()=>{this.setupEventListeners()})}onDisconnect(){this.cleanupEventListeners()}onPropertiesChanged(n){}dispatchTagEvent(n,t){this.dispatchEvent(new CustomEvent(n,{detail:t,bubbles:!0,composed:!0,cancelable:!0}))}cleanupEventListeners(){this.L&&(this.L(),this.L=null)}setupEventListeners(){this.cleanupEventListeners();const n=this.shadowRoot,t=n.querySelector(".tag-container"),e=n.querySelector(".tag-dismiss");t&&(t.addEventListener("click",this.handleClick),t.addEventListener("keydown",this.handleKeydown),e&&e.addEventListener("click",this.handleDismiss),this.L=()=>{t.removeEventListener("click",this.handleClick),t.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.u&&this.setupEventListeners()}get flavor(){return this.getProperty("flavor")}set flavor(n){this.setProperty("flavor",n)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get value(){return this.getProperty("value")}set value(n){this.setProperty("value",n)}get selected(){return this.getProperty("selected")}set selected(n){this.setProperty("selected",n)}get pill(){return this.getProperty("pill")}set pill(n){this.setProperty("pill",n)}get clickable(){return this.getProperty("clickable")}set clickable(n){this.setProperty("clickable",n)}get dismissible(){return this.getProperty("dismissible")}set dismissible(n){this.setProperty("dismissible",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}};P.formAssociated=!0,P.properties={flavor:{type:"string",visual:!0,default:"neutral"},size:{type:"string",visual:!0,default:"md",validate:n=>["xs","sm","md","lg","xl"].includes(n),coerce:n=>["xs","sm","md","lg","xl"].includes(n)?n:"md"},value:{type:"string",visual:!0,default:""},selected:{type:"boolean",visual:!0,default:!1},pill:{type:"boolean",visual:!0,default:!0,aliases:{"not-pill":!1}},clickable:{type:"boolean",visual:!0,default:!1},dismissible:{type:"boolean",visual:!0,default:!1},disabled:{type:"boolean",visual:!0,default:!1}};let V=P;function B(n=768){return window.matchMedia(`(pointer: coarse) and (max-width: ${n}px)`).matches}customElements.get("ty-tag")||customElements.define("ty-tag",V);class TyOption extends HTMLElement{constructor(){super(),this.N=void 0,this.q=!1,this.R=!1,this.P=!1,this.V=!1,this.B=null,this.F=B(),r(this.attachShadow({mode:"open"}),{css:"\n/* Ty Option Component Styles */\n\n.option-content {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--ty-spacing-2);\n box-sizing: border-box;\n width: 100%;\n\n /* Ensure content is clickable */\n cursor: pointer;\n user-select: none;\n\n /* Smooth transitions */\n transition: var(--ty-transition-all);\n\n /* Text styling — Linear-paired typography */\n color: var(--ty-text);\n font-family: var(--ty-font-sans);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n}\n\n:host([cloned]) .option-content {\n padding: 0px;\n background: transparent;\n}\n\n.option-content:hover {\n background: var(--ty-bg-primary-soft);\n}\n\n.option-content[highlighted] {\n background: var(--ty-bg-primary-soft);\n color: var(--ty-text-strong);\n font-weight: var(--ty-font-semibold);\n}\n\n.option-content[selected] {\n background: var(--ty-bg-primary-mild);\n color: var(--ty-text-strong);\n font-weight: var(--ty-font-medium);\n}\n\n.option-text {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.option-clear-btn {\n flex-shrink: 0;\n width: 28px;\n height: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.5);\n border: none;\n border-radius: 50%;\n cursor: pointer;\n padding: 0;\n transition: all 150ms ease;\n opacity: 0.9;\n}\n\n.option-clear-btn:hover {\n background: rgba(0, 0, 0, 0.7);\n opacity: 1;\n transform: scale(1.05);\n}\n\n.option-clear-btn:active {\n background: rgba(0, 0, 0, 0.85);\n transform: scale(0.95);\n}\n\n.option-clear-btn svg {\n width: 16px;\n height: 16px;\n color: #ffffff;\n stroke-width: 2.5;\n}\n\n.option-content[disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.option-content[hidden] {}\n\n/* Ensure nested elements inherit proper styling */\n.option-content * {\n pointer-events: none;\n}\n\n/* CRITICAL: Re-enable pointer events on clear button */\n.option-clear-btn {\n pointer-events: auto !important;\n}\n\n.option-clear-btn * {\n pointer-events: none;\n}\n",id:"ty-option"}),this.render()}static get observedAttributes(){return["value","disabled","selected","highlighted","hidden"]}connectedCallback(){const n=Object.getOwnPropertyDescriptor(this,"value");n&&void 0!==n.value&&(this.N=n.value,delete this.value),this.render()}disconnectedCallback(){this.removeClearButtonListener()}attributeChangedCallback(n,t,e){if(t!==e){switch(n){case"value":this.N=e||void 0;break;case"selected":this.q=null!==e;break;case"disabled":this.R=null!==e;break;case"highlighted":this.P=null!==e;break;case"hidden":this.V=null!==e}this.render()}}getOptionValue(){if(void 0!==this.N)return this.N;const n=this.getAttribute("value");return null!==n?n:this.textContent?.trim()||""}get value(){return this.getOptionValue()}set value(n){this.N!==n&&(this.N=n,void 0!==n?this.setAttribute("value",n):this.removeAttribute("value"),this.render())}get selected(){return this.q}set selected(n){this.q!==n&&(this.q=n,n?this.setAttribute("selected",""):this.removeAttribute("selected"),this.render())}get disabled(){return this.R}set disabled(n){this.R!==n&&(this.R=n,n?this.setAttribute("disabled",""):this.removeAttribute("disabled"),this.render())}get highlighted(){return this.P}set highlighted(n){this.P!==n&&(this.P=n,n?this.setAttribute("highlighted",""):this.removeAttribute("highlighted"),this.render())}get hidden(){return this.V}set hidden(n){this.V!==n&&(this.V=n,n?this.setAttribute("hidden",""):this.removeAttribute("hidden"),this.render())}removeClearButtonListener(){if(this.B){const n=this.shadowRoot?.querySelector(".option-clear-btn");n&&n.removeEventListener("click",this.B),this.B=null}}addClearButtonListener(n){this.removeClearButtonListener(),this.B=n=>{n.preventDefault(),n.stopPropagation(),this.dispatchEvent(new CustomEvent("clear-selection",{bubbles:!0,composed:!0,detail:{value:this.N}}))},n.addEventListener("click",this.B)}render(){const n=this.shadowRoot;if(this.getOptionValue(),n.querySelector(".option-content")){const t=this.q&&this.F,e=n.querySelector(".option-clear-btn");if(t&&!e){const t=n.querySelector(".option-content");if(t){const n=t.querySelector("slot");if(n&&!n.parentElement?.classList.contains("option-text")){const t=document.createElement("span");t.className="option-text",n.parentNode?.insertBefore(t,n),t.appendChild(n)}const e=document.createElement("button");e.className="option-clear-btn",e.type="button",e.setAttribute("aria-label","Clear selection"),e.innerHTML='\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\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 ',this.addClearButtonListener(e),t.appendChild(e)}}else!t&&e&&(e.remove(),this.removeClearButtonListener())}else if(this.q&&this.F){n.innerHTML='\n <div class="option-content">\n <span class="option-text"><slot></slot></span>\n <button class="option-clear-btn" type="button" aria-label="Clear selection">\n <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\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 ';const t=n.querySelector(".option-clear-btn");t&&this.addClearButtonListener(t)}else n.innerHTML='<div class="option-content"><slot></slot></div>';const t=n.querySelector(".option-content");t&&(this.R?t.setAttribute("disabled",""):t.removeAttribute("disabled"),this.q?t.setAttribute("selected",""):t.removeAttribute("selected"),this.P?t.setAttribute("highlighted",""):t.removeAttribute("highlighted"),this.V?t.setAttribute("hidden",""):t.removeAttribute("hidden"))}}customElements.get("ty-option")||customElements.define("ty-option",TyOption);const F='\n:host {\n display: block;\n font-family: var(--ty-font-sans);\n width: 100%;\n}\n\n:host([size="xl"]) {\n font-size: 20px;\n}\n\n\n:host([size="xs"]) {\n font-size: 12px;\n}\n\n\n:host([size="sm"]) {\n font-size: 14px;\n}\n\n:host([size="lg"]) {\n font-size: 18px;\n}\n\n.input-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n box-sizing: border-box;\n}\n\n/* ===== LABEL STYLING ===== */\n\n.input-label {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-medium);\n color: var(--ty-label-color);\n margin-bottom: 6px;\n padding-left: 12px;\n display: flex;\n align-items: center;\n}\n\n/* Required indicator - using SVG icon */\n.required-icon {\n display: inline-flex;\n align-items: center;\n color: var(--ty-color-danger);\n width: 12px;\n height: 12px;\n margin-left: 4px;\n vertical-align: middle;\n}\n\n.required-icon svg {\n width: 100%;\n height: 100%;\n}\n\n/* ===== INPUT WRAPPER WITH SLOTS ===== */\n\n.input-wrapper {\n display: flex;\n align-items: center;\n gap: 0.5rem; /* No gap by default */\n width: 100%;\n box-sizing: border-box;\n border: 1px solid var(--input-border, var(--ty-input-border));\n border-radius: var(--ty-radius-base);\n background: var(--input-bg, var(--input-bg, var(--ty-input-bg)));\n transition: all 0.15s ease-in-out;\n \n /* Default size (md) */\n min-height: 40px;\n padding: 0 12px;\n}\n\n/* Wrapper states */\n.input-wrapper:hover:not(.disabled) {\n border-color: var(--input-border-hover, var(--ty-input-border-hover));\n}\n\n.input-wrapper.focused {\n border-color: var(--input-border-focus, var(--ty-input-border-focus));\n box-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\n\n.input-wrapper.disabled {\n cursor: not-allowed;\n opacity: 0.5;\n background: var(--input-disabled-bg, var(--ty-input-disabled-bg));\n border-color: var(--input-disabled-border, var(--ty-input-disabled-border));\n}\n\n/* ===== SLOT STYLING ===== */\n\n/* Style slotted content directly (no wrappers needed) */\n::slotted([slot="start"]),\n::slotted([slot="end"]) {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n color: var(--ty-color-text-soft);\n}\n\n/* Icon sizing for slotted icons */\n::slotted(ty-icon) {\n width: 1em;\n height: 1em;\n flex-shrink: 0;\n}\n\n/* ===== ERROR MESSAGE STYLING ===== */\n\n.error-message {\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n letter-spacing: var(--ty-tracking-xs);\n color: var(--ty-color-danger);\n margin-top: 4px;\n padding-left: 12px;\n}\n\n/* Error state for wrapper */\n.input-wrapper.error {\n border-color: var(--ty-color-danger);\n background: var(--ty-bg-danger-soft);\n}\n\n.input-wrapper.error.focused {\n border-color: var(--ty-color-danger-mild);\n box-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\n\n/* ===== INPUT BASE STYLING ===== */\n\ninput {\n /* Reset and base styles — Linear-paired typography */\n flex: 1;\n min-width: 0;\n box-sizing: border-box;\n border: none;\n outline: none;\n background: transparent;\n color: var(--input-color, var(--ty-input-color));\n font-family: inherit;\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-normal);\n padding: 0;\n margin: 0;\n}\n\n/* Remove number input spinner arrows */\ninput[type="number"]::-webkit-outer-spin-button,\ninput[type="number"]::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\ninput[type="number"] {\n -moz-appearance: textfield;\n}\n\n/* Disabled state */\ninput:disabled {\n cursor: not-allowed;\n color: var(--input-disabled-color, var(--ty-input-disabled-color));\n}\n\n/* Placeholder styling */\ninput::placeholder {\n color: var(--input-placeholder, var(--ty-input-placeholder));\n font-weight: 400;\n}\n\n/* ===== SIZE MODIFIERS ===== */\n\n/* Extra Small */\n.input-wrapper.xs {\n min-height: 32px;\n padding: 0 8px;\n border-radius: var(--ty-input-radius-xs, var(--ty-radius-base));\n}\n\n.input-wrapper.xs input {\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n letter-spacing: var(--ty-tracking-xs);\n}\n\n/* Small */\n.input-wrapper.sm {\n min-height: 36px;\n padding: 0 10px;\n border-radius: var(--ty-input-radius-sm, var(--ty-radius-base));\n}\n\n.input-wrapper.sm input {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n}\n\n/* Medium (default) */\n.input-wrapper.md {\n min-height: 40px;\n padding: 0 12px;\n border-radius: var(--ty-input-radius-md, var(--ty-radius-base));\n}\n\n.input-wrapper.md input {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n}\n\n/* Large */\n.input-wrapper.lg {\n min-height: 44px;\n padding: 0 14px;\n border-radius: var(--ty-input-radius-lg, var(--ty-radius-base));\n}\n\n.input-wrapper.lg input {\n font-size: var(--ty-font-base);\n line-height: var(--ty-leading-base);\n letter-spacing: var(--ty-tracking-base);\n}\n\n/* Extra Large */\n.input-wrapper.xl {\n min-height: 48px;\n padding: 0 16px;\n border-radius: var(--ty-input-radius-xl, var(--ty-radius-base));\n}\n\n.input-wrapper.xl input {\n font-size: var(--ty-font-lg);\n line-height: var(--ty-leading-lg);\n letter-spacing: var(--ty-tracking-lg);\n}\n\n/* ===== SEMANTIC FLAVOR MODIFIERS ===== */\n\n/* Primary */\n.input-wrapper.primary {\n border-color: var(--ty-input-primary-border, var(--ty-color-primary));\n}\n\n.input-wrapper.primary:hover:not(.disabled) {\n border-color: var(--ty-color-primary-mild);\n}\n\n.input-wrapper.primary.focused {\n border-color: var(--ty-color-primary-mild);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n}\n\n/* Secondary */\n.input-wrapper.secondary {\n border-color: var(--ty-input-secondary-border, var(--ty-color-secondary));\n}\n\n.input-wrapper.secondary.focused {\n border-color: var(--ty-color-secondary-mild);\n box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);\n}\n\n/* Success */\n.input-wrapper.success {\n border-color: var(--ty-input-success-border);\n}\n\n.input-wrapper.success:hover:not(.disabled) {\n border-color: var(--ty-color-success-mild);\n}\n\n.input-wrapper.success.focused {\n border-color: var(--ty-color-success-mild);\n box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);\n}\n\n/* Danger */\n.input-wrapper.danger {\n border-color: var(--ty-input-danger-border);\n}\n\n.input-wrapper.danger:hover:not(.disabled) {\n border-color: var(--ty-color-danger-mild);\n}\n\n.input-wrapper.danger.focused {\n border-color: var(--ty-color-danger-mild);\n box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);\n}\n\n/* Warning */\n.input-wrapper.warning {\n border-color: var(--ty-input-warning-border);\n}\n\n.input-wrapper.warning:hover:not(.disabled) {\n border-color: var(--ty-color-warning-mild);\n}\n\n.input-wrapper.warning.focused {\n border-color: var(--ty-color-warning-mild);\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);\n}\n\n/* Neutral (default) */\n.input-wrapper.neutral.focused {\n border-color: var(--input-border-focus, var(--ty-input-border-focus));\n box-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\n\n/* ===== ACCESSIBILITY ENHANCEMENTS ===== */\n\ninput:focus-visible {\n outline: none;\n}\n\n/* High contrast mode support */\n@media (prefers-contrast: high) {\n .input-wrapper {\n border-width: 2px;\n }\n}\n\n/* Reduced motion support */\n@media (prefers-reduced-motion: reduce) {\n .input-wrapper {\n transition: none;\n }\n}\n\n/* ===== RESPONSIVE BEHAVIOR ===== */\n\n@media (max-width: 640px) {\n .input-wrapper.lg {\n min-height: 40px;\n padding: 0 12px;\n }\n\n .input-wrapper.lg input {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n }\n\n .input-wrapper.xl {\n min-height: 44px;\n padding: 0 14px;\n }\n\n .input-wrapper.xl input {\n font-size: var(--ty-font-base);\n line-height: var(--ty-leading-base);\n letter-spacing: var(--ty-tracking-base);\n }\n}\n\n@media (max-width: 480px) {\n .input-wrapper.xl {\n min-height: 40px;\n padding: 0 12px;\n }\n\n .input-wrapper.xl input {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n }\n}\n\n/* ===== CHECKBOX STYLING ===== */\n\n.checkbox-container {\n display: inline-flex;\n align-items: center;\n outline: none;\n transition: all 0.15s ease-in-out;\n user-select: none;\n cursor: pointer;\n\n /* Default size (md) - matching input sizes */\n border-radius: 6px;\n gap: var(--ty-spacing-1);\n color: var(--ty-text-faint);\n}\n\n.checkbox-container[aria-checked="true"] {\n color: var(--ty-text);\n}\n\n/* Ensure slotted label content inherits the color from container */\n.checkbox-container ::slotted(*) {\n color: inherit;\n transition: color 0.15s ease-in-out;\n}\n\n.checkbox-container label {\n cursor: pointer;\n}\n\n.checkbox-container label {\n font-size: var(--ty-font-sm);\n}\n\n.checkbox-container.sm label {\n font-size: var(--ty-font-xs);\n}\n\n.checkbox-container.lg label {\n font-size: var(--ty-font-base);\n}\n\n.checkbox-container.xl label {\n font-size: var(--ty-font-lg);\n}\n\n/* Checkbox input container - different layout for checkboxes */\n.input-container.checkbox-layout {\n flex-direction: row;\n align-items: center;\n gap: 12px;\n width: auto;\n /* Don\'t force full width for checkboxes */\n}\n\n.input-container.checkbox-layout .input-label {\n margin-bottom: 0;\n padding-left: 0;\n order: 2;\n cursor: pointer;\n flex: 1;\n}\n\n.input-container.checkbox-layout .checkbox-container {\n order: 1;\n flex-shrink: 0;\n}\n\n/* Error message positioning for checkboxes */\n.input-container.checkbox-layout .error-message {\n padding-left: 0;\n margin-left: 52px;\n /* Align with label text */\n}\n\n.checkbox-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n color: inherit;\n transition: color 0.15s ease-in-out;\n pointer-events: none;\n /* Let the container handle the click */\n}\n\n.checkbox-container svg {\n width: 24px;\n height: 24px;\n}\n\n/* ===== CHECKBOX SIZE MODIFIERS ===== */\n\n.checkbox-container.xs svg {\n width: 16px;\n height: 16px;\n}\n\n/* Adjust error message margin for XS */\n.input-container.checkbox-layout .checkbox-container.xs~.error-message {\n margin-left: 44px;\n}\n\n\n.checkbox-container.sm svg {\n width: 20px;\n height: 20px;\n}\n\n/* Adjust error message margin for SM */\n.input-container.checkbox-layout .checkbox-container.sm~.error-message {\n margin-left: 48px;\n}\n\n\n.checkbox-container.md svg {\n width: 24px;\n height: 24px;\n}\n\n\n.checkbox-container.lg svg {\n width: 28px;\n height: 28px;\n}\n\n.checkbox-container.xl svg {\n width: 32px;\n height: 32px;\n}\n\n\n.checkbox-container.xl svg {\n font-size: 20px;\n}\n\n/* Adjust error message margin for LG */\n.input-container.checkbox-layout .checkbox-container.lg~.error-message {\n margin-left: 56px;\n}\n\n\n/* Adjust error message margin for XL */\n.input-container.checkbox-layout .checkbox-container.xl~.error-message {\n margin-left: 60px;\n /* 48px + 12px gap */\n}\n\n/* ===== CHECKBOX SEMANTIC FLAVORS ===== */\n\n.checkbox-container.primary {\n color: var(--ty-color-primary-soft);\n}\n\n\n.checkbox-container.primary[aria-checked="true"] {\n color: var(--ty-color-primary);\n}\n\n.checkbox-container.secondary {\n color: var(--ty-color-secondary-soft);\n}\n\n\n.checkbox-container.secondary[aria-checked="true"] {\n color: var(--ty-color-secondary);\n}\n\n.checkbox-container.success {\n color: var(--ty-color-success-soft);\n}\n\n\n.checkbox-container.success[aria-checked="true"] {\n color: var(--ty-color-success);\n}\n\n.checkbox-container.danger {\n color: var(--ty-color-danger-soft);\n}\n\n.checkbox-container.danger[aria-checked="true"] {\n color: var(--ty-color-danger);\n}\n\n.checkbox-container.warning {\n color: var(--ty-color-warning-soft);\n}\n\n.checkbox-container.warning[aria-checked="true"] {\n color: var(--ty-color-warning);\n}\n\n\n/* Neutral */\n.checkbox-container.neutral {\n color: var(--ty-color-neutral-soft);\n}\n\n.checkbox-container.neutral[aria-checked="true"] {\n color: var(--ty-color-neutral);\n}\n\n/* Disabled state */\n.checkbox-container.disabled {\n pointer-events: none;\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n.checkbox-container.disabled .checkbox-icon {\n color: var(--ty-color-neutral-faint);\n}\n\n/* Error state */\n.checkbox-container.error .checkbox-icon {\n color: var(--ty-color-danger);\n}\n\n.checkbox-container.error:focus {\n box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);\n}\n\n/* Required state */\n.checkbox-container.required .checkbox-icon {\n /* Could add specific styling for required checkboxes */\n}\n\n/* ===== RESPONSIVE CHECKBOX BEHAVIOR ===== */\n\n@container (max-width: 480px) {\n .checkbox-container.lg {\n width: 40px;\n height: 40px;\n }\n\n .checkbox-container.lg svg {\n width: 20px;\n height: 20px;\n }\n\n .checkbox-container.xl {\n width: 44px;\n height: 44px;\n }\n\n .checkbox-container.xl svg {\n width: 22px;\n height: 22px;\n }\n}\n\n@container (max-width: 320px) {\n .checkbox-container.xl {\n width: 40px;\n height: 40px;\n }\n\n .checkbox-container.xl svg {\n width: 20px;\n height: 20px;\n }\n}\n\n/* Fallback for browsers without container query support */\n@media (max-width: 640px) {\n .checkbox-container.lg {\n width: 40px;\n height: 40px;\n }\n\n .checkbox-container.lg svg {\n width: 20px;\n height: 20px;\n }\n\n .checkbox-container.xl {\n width: 44px;\n height: 44px;\n }\n\n .checkbox-container.xl svg {\n width: 22px;\n height: 22px;\n }\n}\n\n@media (max-width: 480px) {\n .checkbox-container.xl {\n width: 40px;\n height: 40px;\n }\n\n .checkbox-container.xl svg {\n width: 20px;\n height: 20px;\n }\n}\n';function H(n){return["number","currency","percent","compact"].includes(n)}function j(n,t){if(t)return t;const e=n.closest("[lang]");if(e){const n=e.getAttribute("lang");if(n)return n}return document.documentElement.lang?document.documentElement.lang:navigator.language?navigator.language:"en-US"}function W(n,t){let e=j(n);const o=new MutationObserver(o=>{for(const i of o)if("attributes"===i.type&&"lang"===i.attributeName){const o=j(n);o!==e&&(e=o,t(o))}});return o.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}),()=>o.disconnect()}const Y='<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-asterisk-icon lucide-asterisk"><path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/></svg>',_=class extends o{constructor(){super(),this.H=null,this.j=!1,this.W=!1,this.Y=null,this._=null,this.U=null,this.G=null,this.X=null,this.K=null,r(this.shadowRoot,{css:F,id:"ty-input"})}onConnect(){this.initializeShadowValue(),this.Z=W(this,()=>{this.render()})}onDisconnect(){this.removeEventListeners(),this.Z&&(this.Z(),this.Z=void 0),null!==this.X&&(clearTimeout(this.X),this.X=null),null!==this.K&&(clearTimeout(this.K),this.K=null)}onPropertiesChanged(n){for(const{name:t,newValue:e}of n)switch(t){case"value":this.H=this.parseShadowValue(e||"");break;case"type":const n=this.getProperty("value")||"";this.H=this.parseShadowValue(n);break;case"error":e&&"neutral"===this.getProperty("flavor")&&this.setProperty("flavor","danger")}}onFormReset(){this.H=null,this.j=!1,null!==this.X&&(clearTimeout(this.X),this.X=null),null!==this.K&&(clearTimeout(this.K),this.K=null),this.render()}getFormValue(){return null!==this.H?this.H+"":null}initializeShadowValue(){const n=this.getProperty("value");n&&(this.H=this.parseShadowValue(n),this.m.setFormValue(null!==this.H?this.H+"":null))}parseShadowValue(n){if(!n||"string"!=typeof n||""===n.trim())return null;if(H(this.type)){const t=function(n){if(!n||""===n.trim())return null;let t=n.replace(/[^\d.,-]/g,"").trim();if(""===t||"-"===t)return null;const e=t.lastIndexOf(","),o=t.lastIndexOf("."),i=Math.max(e,o);if(-1===i){const n=parseFloat(t);return isNaN(n)?null:n}const r=t.slice(0,i).replace(/[.,]/g,""),s=t.slice(i+1),a=parseFloat(r+"."+s);return isNaN(a)?null:a}(n);return null!==t&&0===this.precision?Math.round(t):t}return n}shouldFormat(){return H(this.type)&&!this.j&&null!==this.H&&"number"==typeof this.H}getFormatConfig(){return{type:this.type,locale:this.locale,currency:this.currency,precision:this.precision}}getDisplayValue(){if(this.shouldFormat()){let n=this.H;return"percent"===this.type&&(n/=100),function(n,t){const{type:e,locale:o="en-US",currency:i="USD",precision:r}=t,s={};switch(void 0!==r&&(s.minimumFractionDigits=r,s.maximumFractionDigits=r),e){case"currency":s.style="currency",s.currency=i;break;case"percent":s.style="percent";break;case"compact":s.notation="compact",s.compactDisplay="short";break;default:s.style="decimal"}return new Intl.NumberFormat(o,s).format(n).replace(/\u202F/g," ").replace(/\u2009/g," ")}(n,this.getFormatConfig())}return null!==this.H?this.H+"":""}get type(){return this.getProperty("type")}set type(n){this.setProperty("type",n)}get value(){return null!==this.H?this.H+"":""}set value(n){this.setProperty("value",n)}get name(){return this.getProperty("name")}set name(n){this.setProperty("name",n)}get placeholder(){return this.getProperty("placeholder")}set placeholder(n){this.setProperty("placeholder",n)}get label(){return this.getProperty("label")}set label(n){this.setProperty("label",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}get required(){return this.getProperty("required")}set required(n){this.setProperty("required",n)}get error(){return this.getProperty("error")}set error(n){this.setProperty("error",n)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get flavor(){return this.getProperty("flavor")}set flavor(n){this.setProperty("flavor",n)}get currency(){return this.getProperty("currency")}set currency(n){this.setProperty("currency",n)}get locale(){return j(this,this.getProperty("locale"))}set locale(n){this.setProperty("locale",n)}get precision(){return this.getProperty("precision")}set precision(n){this.setProperty("precision",n)}get debounce(){return this.getProperty("debounce")}set debounce(n){this.setProperty("debounce",n)}get form(){return this.m.form}buildClassList(){const n=[this.size,this.flavor];return this.disabled&&n.push("disabled"),this.required&&n.push("required"),this.error&&n.push("error"),n.join(" ")}dispatchInputEvent(n,t){this.dispatchEvent(new CustomEvent("input",{detail:{value:this.H,formattedValue:this.shouldFormat()?this.getDisplayValue():null,rawValue:n,originalEvent:t},bubbles:!0,composed:!0}))}dispatchChangeEvent(n,t){this.dispatchEvent(new CustomEvent("change",{detail:{value:this.H,formattedValue:this.shouldFormat()?this.getDisplayValue():null,rawValue:n,originalEvent:t},bubbles:!0,composed:!0}))}removeEventListeners(){if(!this.W)return;const n=this.shadowRoot;if(!n)return;const t=n.querySelector("input");t&&(this.Y&&(t.removeEventListener("input",this.Y),this.Y=null),this._&&(t.removeEventListener("change",this._),this._=null),this.U&&(t.removeEventListener("focus",this.U),this.U=null),this.G&&(t.removeEventListener("blur",this.G),this.G=null),this.W=!1)}setupEventListeners(){if(this.W)return;const n=this.shadowRoot,t=n.querySelector("input"),e=n.querySelector(".input-wrapper");t&&e&&(this.Y=n=>{n.stopPropagation(),n.stopImmediatePropagation();const e=n.target.value;this.H=this.parseShadowValue(e),this.m.setFormValue(null!==this.H?this.H+"":null),null!==this.X&&clearTimeout(this.X),this.debounce>0?this.X=window.setTimeout(()=>{this.dispatchInputEvent(t.value,n),this.X=null},this.debounce):this.dispatchInputEvent(e,n)},this._=n=>{n.stopPropagation(),n.stopImmediatePropagation();const e=n.target.value;this.H=this.parseShadowValue(e),this.m.setFormValue(null!==this.H?this.H+"":null),null!==this.K&&clearTimeout(this.K),this.debounce>0?this.K=window.setTimeout(()=>{this.dispatchChangeEvent(t.value,n),this.K=null},this.debounce):this.dispatchChangeEvent(e,n)},this.U=n=>{this.j=!0,e.classList.add("focused"),H(this.type)&&null!==this.H&&(t.value=this.H+""),this.dispatchEvent(new CustomEvent("focus",{detail:{originalEvent:n},bubbles:!0,composed:!0}))},this.G=n=>{const o=n.target.value;null!==this.X&&(clearTimeout(this.X),this.X=null,this.dispatchInputEvent(o,n)),null!==this.K&&(clearTimeout(this.K),this.K=null,this.dispatchChangeEvent(o,n)),this.j=!1,e.classList.remove("focused"),this.shouldFormat()&&(t.value=this.getDisplayValue()),this.dispatchEvent(new CustomEvent("blur",{detail:{originalEvent:n},bubbles:!0,composed:!0}))},t.addEventListener("input",this.Y),t.addEventListener("change",this._),t.addEventListener("focus",this.U),t.addEventListener("blur",this.G),this.W=!0)}render(){const n=this.shadowRoot,t=n.querySelector("input"),e=n.querySelector(".input-wrapper"),o=n.querySelector(".input-label"),i=n.querySelector(".error-message"),r=this.buildClassList(),s=["password","email","tel","url"].includes(this.type)?this.type:"text",a=H(this.type)?"decimal":"email"===this.type?"email":"tel"===this.type?"tel":"url"===this.type?"url":void 0,l=this.getDisplayValue();if(t&&e){if(t.type=s,t.value=l,t.placeholder=this.placeholder,t.name=this.name,a?t.inputMode=a:t.removeAttribute("inputmode"),e.className="input-wrapper "+r,t.disabled=this.disabled,this.disabled?t.setAttribute("disabled",""):t.removeAttribute("disabled"),t.required=this.required,this.required?t.setAttribute("required",""):t.removeAttribute("required"),this.label)if(o)o.innerHTML=`${this.label}${this.required?`<span class="required-icon">${Y}</span>`:""}`,o.style.display="flex";else{const t=document.createElement("label");t.className="input-label",t.innerHTML=`${this.label}${this.required?`<span class="required-icon">${Y}</span>`:""}`;const o=n.querySelector(".input-container");o&&o.insertBefore(t,e)}else o&&(o.style.display="none");if(this.error)if(i)i.textContent=this.error;else{const t=document.createElement("div");t.className="error-message",t.textContent=this.error,n.querySelector(".input-container")?.appendChild(t)}else i&&i.remove()}else{n.innerHTML=`\n <div class="input-container">\n ${this.label?`\n <label class="input-label">\n ${this.label}\n ${this.required?`<span class="required-icon">${Y}</span>`:""}\n </label>\n `:""}\n <div class="input-wrapper ${r}">\n <slot name="start"></slot>\n <input\n type="${s}"\n value="${l}"\n placeholder="${this.placeholder}"\n name="${this.name}"\n ${a?`inputmode="${a}"`:""}\n />\n <slot name="end"></slot>\n </div>\n ${this.error?`\n <div class="error-message">${this.error}</div>\n `:""}\n </div>\n `;const t=n.querySelector("input");t.disabled=this.disabled,t.required=this.required,this.setupEventListeners()}}};_.formAssociated=!0,_.properties={type:{type:"string",visual:!0,default:"text",validate:n=>["text","email","password","number","tel","url","currency","percent","compact"].includes(n),coerce:n=>["text","email","password","number","tel","url","currency","percent","compact"].includes(n)?n:"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},error:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:"md",validate:n=>["xs","sm","md","lg","xl"].includes(n),coerce:n=>["xs","sm","md","lg","xl"].includes(n)?n:"md"},flavor:{type:"string",visual:!0,default:"neutral",validate:n=>["primary","secondary","success","danger","warning","neutral"].includes(n),coerce:n=>["primary","secondary","success","danger","warning","neutral"].includes(n)?n:"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:n=>null==n||"number"==typeof n&&n>=0&&10>=n,coerce:n=>{if(null==n)return;const t=+n;return isNaN(t)?void 0:Math.max(0,Math.min(10,Math.floor(t)))}},debounce:{type:"number",default:0,validate:n=>{const t=+n;return!isNaN(t)&&t>=0&&5e3>=t},coerce:n=>{const t=+n;return isNaN(t)?0:Math.max(0,Math.min(5e3,Math.floor(t)))}}};let U=_;customElements.get("ty-input")||customElements.define("ty-input",U);const G=`\n${F}\n\n/* Override input's :host to be inline (sized to its visual) */\n:host {\n display: inline-flex;\n width: auto;\n vertical-align: middle;\n}\n`,X='<svg fill=\'currentColor\' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640">\x3c!--!Font Awesome Free v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--\x3e<path d="M160 96L480 96C515.3 96 544 124.7 544 160L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 160C96 124.7 124.7 96 160 96z"/></svg>',K='<svg fill=\'currentColor\' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640">\x3c!--!Font Awesome Free v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--\x3e<path d="M480 96C515.3 96 544 124.7 544 160L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 160C96 124.7 124.7 96 160 96L480 96zM438 209.7C427.3 201.9 412.3 204.3 404.5 215L285.1 379.2L233 327.1C223.6 317.7 208.4 317.7 199.1 327.1C189.8 336.5 189.7 351.7 199.1 361L271.1 433C276.1 438 283 440.5 289.9 440C296.8 439.5 303.3 435.9 307.4 430.2L443.3 243.2C451.1 232.5 448.7 217.5 438 209.7z"/></svg>',Z=class extends o{constructor(){super(),this.W=!1,this.J=null,this.nn=null,this.U=null,this.G=null,r(this.shadowRoot,{css:G,id:"ty-checkbox"})}onConnect(){}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(n){}getFormValue(){return this.checked?this.value:null}buildClassList(){const n=[this.size,this.flavor];return this.disabled&&n.push("disabled"),this.required&&n.push("required"),n.join(" ")}handleCheckboxClick(n){if(this.disabled)return;const t=!this.checked;this.checked=t,setTimeout(()=>{const e={value:t,checked:t,formValue:t?this.value:null,originalEvent:n};this.dispatchEvent(new CustomEvent("input",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0,composed:!0}))},0)}handleCheckboxKeydown(n){this.disabled||["Space"," ","Enter"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),this.handleCheckboxClick(n))}removeEventListeners(){if(!this.W)return;const n=this.shadowRoot;if(!n)return;const t=n.querySelector(".checkbox-container");t&&(this.J&&(t.removeEventListener("click",this.J),this.J=null),this.nn&&(t.removeEventListener("keydown",this.nn),this.nn=null),this.U&&(t.removeEventListener("focus",this.U),this.U=null),this.G&&(t.removeEventListener("blur",this.G),this.G=null),this.W=!1)}setupEventListeners(){if(this.W)return;const n=this.shadowRoot.querySelector(".checkbox-container");n&&(this.J=n=>{this.handleCheckboxClick(n)},this.nn=n=>{this.handleCheckboxKeydown(n)},this.U=()=>{n.classList.add("focused")},this.G=()=>{n.classList.remove("focused")},n.addEventListener("click",this.J),n.addEventListener("keydown",this.nn),n.addEventListener("focus",this.U),n.addEventListener("blur",this.G),this.W=!0)}render(){const n=this.shadowRoot;let t=n.querySelector(".checkbox-container");const e=this.buildClassList();if(t){t.className="checkbox-container "+e,t.tabIndex=this.disabled?-1:0,t.setAttribute("aria-checked",this.checked+""),t.setAttribute("aria-disabled",this.disabled+""),t.setAttribute("aria-required",this.required+"");const n=t.querySelector(".checkbox-icon");n&&(n.innerHTML=this.checked?K:X)}else{t=document.createElement("div"),t.className="checkbox-container "+e,t.tabIndex=this.disabled?-1:0,t.setAttribute("role","checkbox"),t.setAttribute("aria-checked",this.checked+""),t.setAttribute("aria-disabled",this.disabled+""),t.setAttribute("aria-required",this.required+"");const o=document.createElement("div");o.className="checkbox-icon",o.innerHTML=this.checked?K:X,t.appendChild(o),n.appendChild(t),this.setupEventListeners()}}get checked(){return this.getProperty("checked")}set checked(n){this.setProperty("checked",n)}get value(){return this.getProperty("value")}set value(n){this.setProperty("value",n)}get name(){return this.getProperty("name")}set name(n){this.setProperty("name",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}get required(){return this.getProperty("required")}set required(n){this.setProperty("required",n)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get flavor(){return this.getProperty("flavor")}set flavor(n){this.setProperty("flavor",n)}get form(){return this.m.form}};Z.formAssociated=!0,Z.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:"md",validate:n=>["xs","sm","md","lg","xl"].includes(n),coerce:n=>["xs","sm","md","lg","xl"].includes(n)?n:"md"},flavor:{type:"string",visual:!0,default:"neutral",validate:n=>["primary","secondary","success","danger","warning","neutral"].includes(n),coerce:n=>["primary","secondary","success","danger","warning","neutral"].includes(n)?n:"neutral"}};let J=Z;customElements.get("ty-checkbox")||customElements.define("ty-checkbox",J);const Q=`\n${F}\n\n/* Override input's :host so the switch sizes to its visual */\n:host {\n display: inline-flex;\n width: auto;\n vertical-align: middle;\n}\n\n/* ===== SWITCH CONTAINER (just the visual) ===== */\n.switch-container {\n display: inline-block;\n cursor: pointer;\n user-select: none;\n outline: none;\n vertical-align: middle;\n}\n\n.switch-container.disabled {\n cursor: not-allowed;\n opacity: 0.55;\n}\n\n.switch-container:focus-visible .switch-track,\n.switch-container.focused .switch-track {\n box-shadow: 0 0 0 3px var(--ty-input-shadow-focus);\n}\n\n/* ===== TRACK ===== */\n.switch-track {\n position: relative;\n flex-shrink: 0;\n width: 36px;\n height: 20px;\n border-radius: 999px;\n background: var(--ty-color-neutral-soft, var(--ty-input-border));\n transition: background-color 0.18s ease-in-out;\n box-sizing: border-box;\n}\n\n/* ===== THUMB ===== */\n.switch-thumb {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: white;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);\n transition: transform 0.18s ease-in-out, background-color 0.18s ease-in-out;\n}\n\n/* ===== CHECKED STATE ===== */\n.switch-container[aria-checked="true"] .switch-track {\n background: var(--ty-color-primary);\n}\n\n.switch-container[aria-checked="true"] .switch-thumb {\n transform: translateX(16px);\n}\n\n/* ===== SIZE VARIANTS ===== */\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\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\n/* md is default — already set above */\n\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\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/* ===== FLAVOR VARIANTS (checked-state colors) ===== */\n.switch-container.primary[aria-checked="true"] .switch-track { background: var(--ty-color-primary); }\n.switch-container.secondary[aria-checked="true"] .switch-track { background: var(--ty-color-secondary); }\n.switch-container.success[aria-checked="true"] .switch-track { background: var(--ty-color-success); }\n.switch-container.danger[aria-checked="true"] .switch-track { background: var(--ty-color-danger); }\n.switch-container.warning[aria-checked="true"] .switch-track { background: var(--ty-color-warning); }\n.switch-container.neutral[aria-checked="true"] .switch-track { background: var(--ty-color-neutral); }\n\n`,nn=class extends o{constructor(){super(),this.W=!1,this.J=null,this.nn=null,this.U=null,this.G=null,r(this.shadowRoot,{css:Q,id:"ty-switch"})}onConnect(){}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(n){}getFormValue(){return this.checked?this.value:null}buildClassList(){const n=[this.size,this.flavor];return this.disabled&&n.push("disabled"),this.required&&n.push("required"),n.join(" ")}handleSwitchClick(n){if(this.disabled)return;const t=!this.checked;this.checked=t,setTimeout(()=>{const e={value:t,checked:t,formValue:t?this.value:null,originalEvent:n};this.dispatchEvent(new CustomEvent("input",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0,composed:!0}))},0)}handleSwitchKeydown(n){this.disabled||["Space"," ","Enter"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),this.handleSwitchClick(n))}removeEventListeners(){if(!this.W)return;const n=this.shadowRoot;if(!n)return;const t=n.querySelector(".switch-container");t&&(this.J&&(t.removeEventListener("click",this.J),this.J=null),this.nn&&(t.removeEventListener("keydown",this.nn),this.nn=null),this.U&&(t.removeEventListener("focus",this.U),this.U=null),this.G&&(t.removeEventListener("blur",this.G),this.G=null),this.W=!1)}setupEventListeners(){if(this.W)return;const n=this.shadowRoot.querySelector(".switch-container");n&&(this.J=n=>this.handleSwitchClick(n),this.nn=n=>this.handleSwitchKeydown(n),this.U=()=>n.classList.add("focused"),this.G=()=>n.classList.remove("focused"),n.addEventListener("click",this.J),n.addEventListener("keydown",this.nn),n.addEventListener("focus",this.U),n.addEventListener("blur",this.G),this.W=!0)}render(){const n=this.shadowRoot;let t=n.querySelector(".switch-container");const e=this.buildClassList();if(t)t.className="switch-container "+e,t.tabIndex=this.disabled?-1:0,t.setAttribute("aria-checked",this.checked?"true":"false"),t.setAttribute("aria-disabled",this.disabled?"true":"false"),t.setAttribute("aria-required",this.required?"true":"false");else{t=document.createElement("div"),t.className="switch-container "+e,t.tabIndex=this.disabled?-1:0,t.setAttribute("role","switch"),t.setAttribute("aria-checked",this.checked?"true":"false"),t.setAttribute("aria-disabled",this.disabled?"true":"false"),t.setAttribute("aria-required",this.required?"true":"false");const o=document.createElement("div");o.className="switch-track";const i=document.createElement("div");i.className="switch-thumb",o.appendChild(i),t.appendChild(o),n.appendChild(t),this.setupEventListeners()}}get checked(){return this.getProperty("checked")}set checked(n){this.setProperty("checked",n)}get value(){return this.getProperty("value")}set value(n){this.setProperty("value",n)}get name(){return this.getProperty("name")}set name(n){this.setProperty("name",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}get required(){return this.getProperty("required")}set required(n){this.setProperty("required",n)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get flavor(){return this.getProperty("flavor")}set flavor(n){this.setProperty("flavor",n)}get form(){return this.m.form}};nn.formAssociated=!0,nn.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:"md",validate:n=>["xs","sm","md","lg","xl"].includes(n),coerce:n=>["xs","sm","md","lg","xl"].includes(n)?n:"md"},flavor:{type:"string",visual:!0,default:"primary",validate:n=>["primary","secondary","success","danger","warning","neutral"].includes(n),coerce:n=>["primary","secondary","success","danger","warning","neutral"].includes(n)?n:"primary"}};let tn=nn;customElements.get("ty-switch")||customElements.define("ty-switch",tn);const en=`\n${F}\n\n/* Override input's :host. ty-radio is just the circle (inline);\n ty-radio-group is a form-field block. */\n:host(ty-radio) {\n display: inline-flex;\n width: auto;\n vertical-align: middle;\n}\n\n:host(ty-radio-group) {\n display: block;\n width: 100%;\n}\n\n/* ===== RADIO GROUP ===== */\n.radio-group-container {\n display: flex;\n flex-direction: column;\n gap: 0.4rem;\n font-family: var(--ty-font-sans);\n color: var(--ty-color-text);\n}\n\n.radio-group-label {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n font-weight: var(--ty-font-medium);\n color: var(--ty-color-text);\n display: flex;\n align-items: center;\n gap: 0.25rem;\n}\n\n.radio-group-list {\n display: flex;\n gap: 0.6rem;\n align-items: flex-start;\n}\n\n.radio-group-list.vertical {\n flex-direction: column;\n align-items: flex-start;\n}\n\n.radio-group-list.horizontal {\n flex-direction: row;\n flex-wrap: wrap;\n align-items: center;\n}\n\n.radio-group-error {\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n color: var(--ty-color-danger);\n}\n\n.radio-group-container .required-icon {\n width: 0.65em;\n height: 0.65em;\n color: var(--ty-color-danger);\n}\n.radio-group-container .required-icon svg {\n width: 100%;\n height: 100%;\n}\n\n/* ===== RADIO ITEM (just the circle) ===== */\n.radio-container {\n display: inline-block;\n cursor: pointer;\n user-select: none;\n outline: none;\n vertical-align: middle;\n}\n\n.radio-container.disabled {\n cursor: not-allowed;\n opacity: 0.55;\n}\n\n.radio-container:focus-visible .radio-circle,\n.radio-container.focused .radio-circle {\n box-shadow: 0 0 0 3px var(--ty-input-shadow-focus);\n}\n\n.radio-circle {\n position: relative;\n flex-shrink: 0;\n width: 18px;\n height: 18px;\n border-radius: 50%;\n border: 2px solid var(--ty-input-border);\n background: var(--ty-input-bg);\n box-sizing: border-box;\n transition: border-color 0.15s ease-in-out;\n}\n\n.radio-circle::after {\n content: "";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: var(--ty-color-primary);\n transform: translate(-50%, -50%) scale(0);\n transition: transform 0.15s ease-in-out;\n}\n\n.radio-container[aria-checked="true"] .radio-circle {\n border-color: var(--ty-color-primary);\n}\n\n.radio-container[aria-checked="true"] .radio-circle::after {\n transform: translate(-50%, -50%) scale(1);\n}\n\n/* Size variants */\n.radio-container.xs .radio-circle { width: 14px; height: 14px; }\n.radio-container.xs .radio-circle::after { width: 6px; height: 6px; }\n\n.radio-container.sm .radio-circle { width: 16px; height: 16px; }\n.radio-container.sm .radio-circle::after { width: 7px; height: 7px; }\n\n.radio-container.lg .radio-circle { width: 22px; height: 22px; }\n.radio-container.lg .radio-circle::after { width: 10px; height: 10px; }\n\n.radio-container.xl .radio-circle { width: 26px; height: 26px; }\n.radio-container.xl .radio-circle::after { width: 12px; height: 12px; }\n\n/* Flavor variants — color of inner dot + checked border */\n.radio-container.primary[aria-checked="true"] .radio-circle { border-color: var(--ty-color-primary); }\n.radio-container.primary .radio-circle::after { background: var(--ty-color-primary); }\n\n.radio-container.secondary[aria-checked="true"] .radio-circle { border-color: var(--ty-color-secondary); }\n.radio-container.secondary .radio-circle::after { background: var(--ty-color-secondary); }\n\n.radio-container.success[aria-checked="true"] .radio-circle { border-color: var(--ty-color-success); }\n.radio-container.success .radio-circle::after { background: var(--ty-color-success); }\n\n.radio-container.danger[aria-checked="true"] .radio-circle { border-color: var(--ty-color-danger); }\n.radio-container.danger .radio-circle::after { background: var(--ty-color-danger); }\n\n.radio-container.warning[aria-checked="true"] .radio-circle { border-color: var(--ty-color-warning); }\n.radio-container.warning .radio-circle::after { background: var(--ty-color-warning); }\n\n.radio-container.neutral[aria-checked="true"] .radio-circle { border-color: var(--ty-color-neutral); }\n.radio-container.neutral .radio-circle::after { background: var(--ty-color-neutral); }\n`,on='<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>',rn=class extends o{constructor(){super(),this.W=!1,this.J=null,this.U=null,this.G=null,r(this.shadowRoot,{css:en,id:"ty-radio"})}onConnect(){}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(n){}buildClassList(){const n=[this.size,this.flavor];return this.disabled&&n.push("disabled"),n.join(" ")}handleClick(n){this.disabled||(n.stopPropagation(),this.dispatchEvent(new CustomEvent("ty-radio-select",{detail:{value:this.value},bubbles:!0,composed:!0})))}removeEventListeners(){if(!this.W)return;const n=this.shadowRoot?.querySelector(".radio-container");n&&(this.J&&(n.removeEventListener("click",this.J),this.J=null),this.U&&(n.removeEventListener("focus",this.U),this.U=null),this.G&&(n.removeEventListener("blur",this.G),this.G=null),this.W=!1)}setupEventListeners(){if(this.W)return;const n=this.shadowRoot.querySelector(".radio-container");n&&(this.J=n=>this.handleClick(n),this.U=()=>n.classList.add("focused"),this.G=()=>n.classList.remove("focused"),n.addEventListener("click",this.J),n.addEventListener("focus",this.U),n.addEventListener("blur",this.G),this.W=!0)}render(){const n=this.shadowRoot;let t=n.querySelector(".radio-container");const e=this.buildClassList();if(t)t.className="radio-container "+e,t.tabIndex=this.disabled?-1:0,t.setAttribute("aria-checked",this.checked+""),t.setAttribute("aria-disabled",this.disabled+"");else{t=document.createElement("div"),t.className="radio-container "+e,t.tabIndex=this.disabled?-1:0,t.setAttribute("role","radio"),t.setAttribute("aria-checked",this.checked+""),t.setAttribute("aria-disabled",this.disabled+"");const o=document.createElement("div");o.className="radio-circle",t.appendChild(o),n.appendChild(t),this.setupEventListeners()}}get value(){return this.getProperty("value")}set value(n){this.setProperty("value",n)}get checked(){return this.getProperty("checked")}set checked(n){this.setProperty("checked",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get flavor(){return this.getProperty("flavor")}set flavor(n){this.setProperty("flavor",n)}};rn.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:"md"},flavor:{type:"string",visual:!0,default:"primary"}};let sn=rn;customElements.get("ty-radio")||customElements.define("ty-radio",sn);const an=class extends o{constructor(){super(),this.W=!1,this.tn=null,this.nn=null,r(this.shadowRoot,{css:en,id:"ty-radio-group"})}onConnect(){queueMicrotask(()=>this.syncChildren())}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(n){n.some(n=>"value"===n.name||"size"===n.name||"flavor"===n.name||"disabled"===n.name)&&this.syncChildren()}getFormValue(){return this.value||null}getRadios(){return Array.from(this.querySelectorAll("ty-radio"))}syncChildren(){const n=this.getRadios();for(const t of n)t.checked=t.value===this.value,this.disabled&&(t.disabled=!0),t.size=this.size,t.flavor=this.flavor}handleRadioSelect(n){if(this.disabled)return;const t=n.detail,e=t?.value;"string"==typeof e&&e!==this.value&&(this.value=e,this.syncChildren(),setTimeout(()=>{const t={value:e,formValue:e,originalEvent:n};this.dispatchEvent(new CustomEvent("input",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))},0))}handleKeydown(n){if(this.disabled)return;const t=this.getRadios().filter(n=>!n.disabled);if(0===t.length)return;const e=document.activeElement,o=t.find(n=>n===e||n.contains(e));let i=-1;if(["ArrowDown","ArrowRight"].includes(n.key))n.preventDefault(),i=o?(t.indexOf(o)+1)%t.length:0;else{if(!["ArrowUp","ArrowLeft"].includes(n.key)){if(["Space"," ","Enter"].includes(n.key)){if(o){n.preventDefault(),this.value=o.value,this.syncChildren();const t={value:o.value,formValue:o.value,originalEvent:n};setTimeout(()=>{this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))},0)}return}return}n.preventDefault(),i=o?(t.indexOf(o)-1+t.length)%t.length:t.length-1}const r=t[i];if(r){r.focus(),this.value=r.value,this.syncChildren();const t={value:r.value,formValue:r.value,originalEvent:n};setTimeout(()=>{this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))},0)}}removeEventListeners(){this.W&&(this.tn&&(this.removeEventListener("ty-radio-select",this.tn),this.tn=null),this.nn&&(this.removeEventListener("keydown",this.nn),this.nn=null),this.W=!1)}setupEventListeners(){this.W||(this.tn=n=>this.handleRadioSelect(n),this.nn=n=>this.handleKeydown(n),this.addEventListener("ty-radio-select",this.tn),this.addEventListener("keydown",this.nn),this.W=!0)}render(){const n=this.shadowRoot;let t=n.querySelector(".radio-group-container");if(t){let n=t.querySelector(".radio-group-label");if(this.label)if(n||(n=document.createElement("div"),n.className="radio-group-label",t.insertBefore(n,t.firstChild)),n.textContent=this.label,this.required&&!n.querySelector(".required-icon")){const t=document.createElement("span");t.className="required-icon",t.innerHTML=on,n.appendChild(t)}else this.required||n.querySelector(".required-icon")?.remove();else n&&n.remove();const e=t.querySelector(".radio-group-list");e&&(e.className="radio-group-list "+this.orientation);let o=t.querySelector(".radio-group-error");this.error?(o||(o=document.createElement("div"),o.className="radio-group-error",t.appendChild(o)),o.textContent=this.error):o&&o.remove(),t.setAttribute("aria-disabled",this.disabled+"")}else{if(t=document.createElement("div"),t.className="radio-group-container",t.setAttribute("role","radiogroup"),t.setAttribute("aria-disabled",this.disabled+""),this.label){const n=document.createElement("div");if(n.className="radio-group-label",n.textContent=this.label,this.required){const t=document.createElement("span");t.className="required-icon",t.innerHTML=on,n.appendChild(t)}t.appendChild(n)}const e=document.createElement("div");e.className="radio-group-list "+this.orientation;const o=document.createElement("slot");if(e.appendChild(o),t.appendChild(e),this.error){const n=document.createElement("div");n.className="radio-group-error",n.textContent=this.error,t.appendChild(n)}n.appendChild(t),this.setupEventListeners()}this.syncChildren()}get value(){return this.getProperty("value")}set value(n){this.setProperty("value",n)}get name(){return this.getProperty("name")}set name(n){this.setProperty("name",n)}get label(){return this.getProperty("label")}set label(n){this.setProperty("label",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}get required(){return this.getProperty("required")}set required(n){this.setProperty("required",n)}get error(){return this.getProperty("error")}set error(n){this.setProperty("error",n)}get orientation(){return this.getProperty("orientation")}set orientation(n){this.setProperty("orientation",n)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get flavor(){return this.getProperty("flavor")}set flavor(n){this.setProperty("flavor",n)}get form(){return this.m.form}};an.formAssociated=!0,an.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:"md"},flavor:{type:"string",visual:!0,default:"primary"}};let ln=an;customElements.get("ty-radio-group")||customElements.define("ty-radio-group",ln);const dn='<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>',cn='<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>',hn=class extends o{constructor(){super(),this.en=null,this.rn=!1,r(this.shadowRoot,{css:F,id:"ty-input"}),r(this.shadowRoot,{css:"\n/* Copy field value display */\n.copy-field-value {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: none;\n padding: 0;\n margin: 0;\n background: transparent;\n border: none;\n color: inherit;\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n}\n\n/* Multiline variant */\n.copy-field-value.multiline {\n white-space: pre-wrap;\n word-break: break-word;\n max-height: 200px;\n overflow-y: auto;\n}\n\n/* Code format */\n.copy-field-value {\n font-size: 0.8em;\n}\n\n/* Hover state - primary soft background */\n.input-wrapper:not(.disabled):hover {\n background: var(--ty-bg-primary-soft);\n transition: background 0.2s ease;\n}\n\n/* Copy button */\n.copy-button {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n cursor: pointer;\n border: none;\n background: transparent;\n color: var(--ty-text-soft);\n transition: color 0.2s ease, transform 0.2s ease;\n padding: 0;\n margin: 0;\n}\n\n.copy-button:hover:not(.disabled) {\n color: var(--ty-text);\n transform: scale(1.1);\n}\n\n.copy-button.success {\n color: var(--ty-color-success);\n animation: copy-feedback 0.3s ease;\n}\n\n.copy-button.error {\n color: var(--ty-color-danger);\n animation: copy-feedback 0.3s ease;\n}\n\n@keyframes copy-feedback {\n 0%, 100% { transform: scale(1); }\n 50% { transform: scale(1.2); }\n}\n\n.copy-button svg {\n width: 18px;\n height: 18px;\n}\n\n.input-wrapper.disabled .copy-button {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n.input-wrapper.disabled {\n cursor: not-allowed;\n}\n",id:"ty-copy"})}onConnect(){}onDisconnect(){null!==this.en&&(clearTimeout(this.en),this.en=null)}onPropertiesChanged(n){}buildClassList(){const n=[this.size,this.flavor];return this.disabled&&n.push("disabled"),this.required&&n.push("required"),n.join(" ")}async copyToClipboard(){if(!this.disabled&&this.value){try{await navigator.clipboard.writeText(this.value),this.dispatchEvent(new CustomEvent("copy-success",{detail:{value:this.value},bubbles:!0,composed:!0}))}catch(n){try{const n=document.createElement("textarea");n.value=this.value,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:this.value},bubbles:!0,composed:!0}))}catch(t){return this.dispatchEvent(new CustomEvent("copy-error",{detail:{error:t},bubbles:!0,composed:!0})),void this.showCopyError()}}this.showCopySuccess()}}showCopySuccess(){null!==this.en&&clearTimeout(this.en),this.rn=!0;const n=this.shadowRoot.querySelector(".copy-button");n&&(n.classList.add("success"),n.innerHTML=cn),this.en=window.setTimeout(()=>{this.rn=!1;const n=this.shadowRoot.querySelector(".copy-button");n&&(n.classList.remove("success"),n.innerHTML=dn),this.en=null},2e3)}showCopyError(){null!==this.en&&clearTimeout(this.en),this.rn=!1;const n=this.shadowRoot.querySelector(".copy-button");n&&(n.classList.add("error"),n.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>'),this.en=window.setTimeout(()=>{const n=this.shadowRoot.querySelector(".copy-button");n&&(n.classList.remove("error"),n.innerHTML=dn),this.en=null},2e3)}setupEventListeners(){const n=this.shadowRoot,t=n.querySelector(".input-wrapper"),e=n.querySelector(".copy-button");if(t&&!this.disabled){const n=t;n.addEventListener("click",n=>{n.target===e||n.target.closest(".copy-button")||this.copyToClipboard()}),n.style.cursor="pointer"}e&&e.addEventListener("click",()=>{this.copyToClipboard()})}render(){const n=this.shadowRoot,t=this.buildClassList(),e=this.multiline?" multiline":"";n.innerHTML=`\n <div class="input-container">\n ${this.label?`\n <label class="input-label">\n ${this.label}\n ${this.required?'<span class="required-icon"><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-asterisk-icon lucide-asterisk"><path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/></svg></span>':""}\n </label>\n `:""}\n <div class="input-wrapper ${t}">\n ${"code"===this.format?`<code class="copy-field-value${e}">${this.value||""}</code>`:`<div class="copy-field-value${e}">${this.value||""}</div>`}\n <button class="copy-button${this.rn?" success":""}" type="button" ${this.disabled?"disabled":""}>\n ${this.rn?cn:dn}\n </button>\n </div>\n </div>\n `,this.setupEventListeners()}get value(){return this.getProperty("value")}set value(n){this.setProperty("value",n)}get label(){return this.getProperty("label")}set label(n){this.setProperty("label",n)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get flavor(){return this.getProperty("flavor")}set flavor(n){this.setProperty("flavor",n)}get format(){return this.getProperty("format")}set format(n){this.setProperty("format",n)}get multiline(){return this.getProperty("multiline")}set multiline(n){this.setProperty("multiline",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}get required(){return this.getProperty("required")}set required(n){this.setProperty("required",n)}};hn.formAssociated=!0,hn.properties={value:{type:"string",visual:!0,formValue:!0,default:""},label:{type:"string",visual:!0,default:""},size:{type:"string",visual:!0,default:"md",validate:n=>["xs","sm","md","lg","xl"].includes(n),coerce:n=>["xs","sm","md","lg","xl"].includes(n)?n:"md"},flavor:{type:"string",visual:!0,default:"neutral",validate:n=>["primary","secondary","success","danger","warning","neutral"].includes(n),coerce:n=>["primary","secondary","success","danger","warning","neutral"].includes(n)?n:"neutral"},format:{type:"string",visual:!0,default:"text",coerce:n=>"code"===n?"code":"text"},multiline:{type:"boolean",visual:!0,default:!1},disabled:{type:"boolean",visual:!0,default:!1},required:{type:"boolean",visual:!0,default:!1}};let pn=hn;function un(n){return 1024>n?n+" B":1048576>n?(n/1024).toFixed(1)+" KB":1073741824>n?(n/1024/1024).toFixed(1)+" MB":(n/1024/1024/1024).toFixed(1)+" GB"}customElements.get("ty-copy")||customElements.define("ty-copy",pn);const gn=class extends o{constructor(){super(),this.sn=[],this.an=!1,this.W=!1,this.ln=null,this.dn=null,this.cn=null,this.hn=null,this.pn=null,this.un=null,this.gn=null,this.bn=null,r(this.shadowRoot,{css:"\n:host {\n display: block;\n font-family: var(--ty-font-sans);\n width: 100%;\n}\n\n.file-upload-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n box-sizing: border-box;\n}\n\n/* ===== LABEL ===== */\n\n.upload-label {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-medium);\n color: var(--ty-label-color);\n margin-bottom: 6px;\n padding-left: 4px;\n display: flex;\n align-items: center;\n}\n\n.required-icon {\n color: var(--ty-color-danger);\n margin-left: 4px;\n font-size: 0.75rem;\n line-height: 1;\n}\n\n/* ===== DROP ZONE ===== */\n\n.drop-zone {\n border: 2px dashed var(--ty-border);\n border-radius: var(--ty-radius-base);\n padding: 2rem 1.5rem;\n text-align: center;\n cursor: pointer;\n transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;\n outline: none;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n min-height: 140px;\n user-select: none;\n}\n\n.drop-zone:hover:not(.disabled) {\n border-color: var(--ty-input-border-hover);\n background: var(--ty-surface-content);\n}\n\n.drop-zone.focused {\n border-color: var(--ty-input-border-focus);\n box-shadow: 0 0 0 3px var(--ty-input-shadow-focus);\n}\n\n.drop-zone.drag-active {\n border-color: var(--ty-color-primary);\n border-style: solid;\n background: var(--ty-bg-primary-);\n}\n\n.drop-zone.drag-active .upload-icon {\n color: var(--ty-color-primary);\n transform: translateY(-2px);\n}\n\n.drop-zone.has-files {\n min-height: 80px;\n padding: 1.25rem 1.5rem;\n}\n\n.drop-zone.disabled {\n opacity: 0.5;\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.drop-zone.error {\n border-color: var(--ty-color-danger);\n}\n\n.drop-zone.error:not(.disabled) {\n background: var(--ty-bg-danger-);\n}\n\n/* ===== UPLOAD ICON ===== */\n\n.upload-icon {\n color: var(--ty-text--);\n width: 2.5rem;\n height: 2.5rem;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: color 0.15s ease, transform 0.15s ease;\n pointer-events: none;\n}\n\n.upload-icon svg {\n width: 100%;\n height: 100%;\n}\n\n/* ===== HINT TEXT ===== */\n\n.upload-hint {\n color: var(--ty-text-);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n pointer-events: none;\n}\n\n.browse-link {\n color: var(--ty-color-primary);\n font-weight: var(--ty-font-medium);\n}\n\n.upload-sub-hint {\n color: var(--ty-text--);\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n pointer-events: none;\n}\n\n/* ===== FILE LIST ===== */\n\n.file-list {\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n margin-top: 0.5rem;\n}\n\n.file-item {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n border-radius: var(--ty-radius-base);\n background: var(--ty-surface-content);\n border: 1px solid var(--ty-border-soft);\n}\n\n.file-icon {\n color: var(--ty-text--);\n flex-shrink: 0;\n width: 1rem;\n height: 1rem;\n display: flex;\n align-items: center;\n}\n\n.file-icon svg {\n width: 100%;\n height: 100%;\n}\n\n.file-name {\n flex: 1;\n font-size: var(--ty-font-sm);\n color: var(--ty-text);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n min-width: 0;\n}\n\n.file-size {\n font-size: var(--ty-font-xs);\n color: var(--ty-text--);\n flex-shrink: 0;\n font-variant-numeric: tabular-nums;\n}\n\n.file-remove {\n flex-shrink: 0;\n cursor: pointer;\n color: var(--ty-text--);\n width: 1.25rem;\n height: 1.25rem;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n transition: color 0.15s ease, background-color 0.15s ease;\n border: none;\n background: none;\n padding: 0;\n outline: none;\n}\n\n.file-remove:hover {\n color: var(--ty-color-danger);\n background: var(--ty-bg-danger-);\n}\n\n.file-remove:focus-visible {\n box-shadow: 0 0 0 2px var(--ty-color-danger);\n}\n\n.file-remove svg {\n width: 12px;\n height: 12px;\n}\n\n/* ===== ERROR MESSAGE ===== */\n\n.error-message {\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n color: var(--ty-color-danger);\n margin-top: 4px;\n padding-left: 4px;\n}\n\n/* ===== ACCESSIBILITY ===== */\n\n@media (prefers-reduced-motion: reduce) {\n .drop-zone,\n .upload-icon,\n .file-remove {\n transition: none;\n }\n}\n\n@media (prefers-contrast: high) {\n .drop-zone {\n border-width: 3px;\n }\n}\n",id:"ty-file-upload"})}onConnect(){}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(n){}onFormReset(){this.sn=[],this.updateFormValue(),this.u&&this.render();const n=this.shadowRoot?.querySelector(".file-input");n&&(n.value="")}getFormValue(){if(0===this.sn.length)return null;const n=new FormData,t=this.name||"files";for(const e of this.sn)n.append(t,e);return n}get files(){return[...this.sn]}get multiple(){return this.getProperty("multiple")}set multiple(n){this.setProperty("multiple",n)}get accept(){return this.getProperty("accept")}set accept(n){this.setProperty("accept",n)}get name(){return this.getProperty("name")}set name(n){this.setProperty("name",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}get required(){return this.getProperty("required")}set required(n){this.setProperty("required",n)}get label(){return this.getProperty("label")}set label(n){this.setProperty("label",n)}get placeholder(){return this.getProperty("placeholder")}set placeholder(n){this.setProperty("placeholder",n)}get error(){return this.getProperty("error")}set error(n){this.setProperty("error",n)}get form(){return this.m.form}setFiles(n){this.sn=this.multiple?n:n.slice(0,1),this.updateFormValue(),this.render();const t={value:this.sn,files:this.sn,names:this.sn.map(n=>n.name)};setTimeout(()=>{this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))},0)}removeFile(n){const t=[...this.sn];t.splice(n,1),this.setFiles(t);const e=this.shadowRoot?.querySelector(".file-input");e&&(e.value="")}setupEventListeners(){if(this.W)return;const n=this.shadowRoot,t=n.querySelector(".drop-zone"),e=n.querySelector(".file-input");this.ln=n=>{this.disabled||n.target.closest(".file-remove")||e.click()},this.dn=n=>{this.disabled||"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.click())},this.cn=()=>{t.classList.add("focused")},this.hn=()=>{t.classList.remove("focused")},this.pn=n=>{this.disabled||(n.preventDefault(),n.stopPropagation(),this.an||(this.an=!0,t.classList.add("drag-active")))},this.un=n=>{t.contains(n.relatedTarget)||(this.an=!1,t.classList.remove("drag-active"))},this.gn=n=>{if(this.disabled)return;n.preventDefault(),n.stopPropagation(),this.an=!1,t.classList.remove("drag-active");const e=Array.from(n.dataTransfer?.files??[]);e.length>0&&this.setFiles(e)},this.bn=n=>{const t=n.target;t.files&&t.files.length>0&&this.setFiles(Array.from(t.files))},t.addEventListener("click",this.ln),t.addEventListener("keydown",this.dn),t.addEventListener("focus",this.cn),t.addEventListener("blur",this.hn),t.addEventListener("dragover",this.pn),t.addEventListener("dragleave",this.un),t.addEventListener("drop",this.gn),e.addEventListener("change",this.bn),this.W=!0}removeEventListeners(){if(!this.W)return;const n=this.shadowRoot;if(!n)return;const t=n.querySelector(".drop-zone"),e=n.querySelector(".file-input");t&&e&&(this.ln&&t.removeEventListener("click",this.ln),this.dn&&t.removeEventListener("keydown",this.dn),this.cn&&t.removeEventListener("focus",this.cn),this.hn&&t.removeEventListener("blur",this.hn),this.pn&&t.removeEventListener("dragover",this.pn),this.un&&t.removeEventListener("dragleave",this.un),this.gn&&t.removeEventListener("drop",this.gn),this.bn&&e.removeEventListener("change",this.bn),this.W=!1)}buildDropZoneClasses(){const n=["drop-zone"];return this.an&&n.push("drag-active"),this.sn.length>0&&n.push("has-files"),this.disabled&&n.push("disabled"),this.error&&n.push("error"),n.join(" ")}renderFileList(n){n.innerHTML="";for(let t=0;this.sn.length>t;t++){const e=this.sn[t],o=document.createElement("div");o.className="file-item";const i=document.createElement("span");i.className="file-icon",i.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=un(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=t;a.addEventListener("click",n=>{n.stopPropagation(),this.removeFile(l)}),o.appendChild(i),o.appendChild(r),o.appendChild(s),o.appendChild(a),n.appendChild(o)}}render(){const n=this.shadowRoot;let t=n.querySelector(".file-upload-container");if(!t){t=document.createElement("div"),t.className="file-upload-container";const e=document.createElement("div");e.className="upload-label",t.appendChild(e);const o=document.createElement("div");o.className="drop-zone",o.setAttribute("role","button");const i=document.createElement("input");i.type="file",i.className="file-input",i.style.display="none",o.appendChild(i);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>',o.appendChild(r);const s=document.createElement("div");s.className="upload-hint",o.appendChild(s);const a=document.createElement("div");a.className="upload-sub-hint",o.appendChild(a),t.appendChild(o);const l=document.createElement("div");l.className="file-list",t.appendChild(l);const d=document.createElement("div");d.className="error-message",t.appendChild(d),n.appendChild(t),this.setupEventListeners()}const e=t.querySelector(".upload-label");if(this.label){if(e.style.display="",e.innerHTML="",e.appendChild(document.createTextNode(this.label)),this.required){const n=document.createElement("span");n.className="required-icon",n.textContent="*",n.setAttribute("aria-hidden","true"),e.appendChild(n)}}else e.style.display="none";const o=t.querySelector(".drop-zone");o.className=this.buildDropZoneClasses(),o.tabIndex=this.disabled?-1:0,o.setAttribute("aria-disabled",this.disabled+""),o.setAttribute("aria-label",this.placeholder||"Upload files");const i=t.querySelector(".file-input");i.multiple=this.multiple,i.accept=this.accept,i.disabled=this.disabled,t.querySelector(".upload-icon").style.display=this.sn.length>0?"none":"",t.querySelector(".upload-hint").innerHTML=this.sn.length>0?`<strong>${this.sn.length} file${1!==this.sn.length?"s":""} selected</strong>`:'Drop files here or <span class="browse-link">click to browse</span>';const r=t.querySelector(".upload-sub-hint");this.accept&&0===this.sn.length?(r.textContent="Accepted: "+this.accept,r.style.display=""):r.style.display="none";const s=t.querySelector(".file-list");this.renderFileList(s);const a=t.querySelector(".error-message");a.textContent=this.error,a.style.display=this.error?"":"none"}};gn.formAssociated=!0,gn.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 bn=gn;function vn(){return"native"!==document.documentElement.getAttribute("data-ty-scrollbar")}customElements.get("ty-file-upload")||customElements.define("ty-file-upload",bn);class mn{constructor(n,t={}){this.trackY=null,this.thumbY=null,this.trackX=null,this.thumbX=null,this.an=!1,this.vn="y",this.mn=0,this.yn=0,this.fn=null,this.wn=null,this.xn=null,this.kn=n,this.zn=!1!==t.vertical,this.Cn=t.horizontal??!1,this.Sn=t.autoHideDelay??1e3,this.En=this.Tn.bind(this),this.Mn=this.Dn.bind(this),this.$n=this.An.bind(this),this.In=this.On.bind(this),this.Ln=this.Nn.bind(this),this.qn=this.Rn.bind(this),this.Pn=this.Vn.bind(this),this.zn&&(this.trackY=this.Bn("y"),this.thumbY=this.Fn("y"),this.trackY.appendChild(this.thumbY)),this.Cn&&(this.trackX=this.Bn("x"),this.thumbX=this.Fn("x"),this.trackX.appendChild(this.thumbX)),this.kn.addEventListener("scroll",this.En,{passive:!0}),this.thumbY&&this.thumbY.addEventListener("pointerdown",this.Mn),this.trackY&&this.trackY.addEventListener("pointerdown",this.In),this.thumbX&&this.thumbX.addEventListener("pointerdown",this.$n),this.trackX&&this.trackX.addEventListener("pointerdown",this.Ln),this.xn=new ResizeObserver(()=>this.update()),this.xn.observe(this.kn),this.update()}Bn(n){const t=document.createElement("div");return t.className="ty-scrollbar-track-"+n,t}Fn(n){const t=document.createElement("div");return t.className="ty-scrollbar-thumb-"+n,t}update(){this.Hn(),this.jn()}scrollToTop(n=!1){this.kn.scrollTo({top:0,behavior:n?"smooth":"auto"})}scrollToBottom(n=!1){this.kn.scrollTo({top:this.kn.scrollHeight,behavior:n?"smooth":"auto"})}scrollToLeft(n=!1){this.kn.scrollTo({left:0,behavior:n?"smooth":"auto"})}scrollToRight(n=!1){this.kn.scrollTo({left:this.kn.scrollWidth,behavior:n?"smooth":"auto"})}destroy(){this.kn.removeEventListener("scroll",this.En),this.thumbY&&this.thumbY.removeEventListener("pointerdown",this.Mn),this.trackY&&this.trackY.removeEventListener("pointerdown",this.In),this.thumbX&&this.thumbX.removeEventListener("pointerdown",this.$n),this.trackX&&this.trackX.removeEventListener("pointerdown",this.Ln),this.xn&&(this.xn.disconnect(),this.xn=null),null!==this.fn&&(cancelAnimationFrame(this.fn),this.fn=null),null!==this.wn&&(clearTimeout(this.wn),this.wn=null)}Tn(){null===this.fn&&(this.fn=requestAnimationFrame(()=>{this.fn=null,this.Wn(),this.Yn()}))}Hn(){if(!this.trackY||!this.thumbY)return;const{scrollHeight:n,clientHeight:t}=this.kn,e=n>t+2;this.trackY.classList.toggle("has-overflow",e),e&&(this.thumbY.style.height=Math.max(t/n*100,0)+"%"),this._n()}jn(){if(!this.trackX||!this.thumbX)return;const{scrollWidth:n,clientWidth:t}=this.kn,e=n>t+2;this.trackX.classList.toggle("has-overflow",e),e&&(this.thumbX.style.width=Math.max(t/n*100,0)+"%"),this.Un()}Wn(){this._n(),this.Un()}_n(){if(!this.trackY||!this.thumbY)return;const{scrollTop:n,scrollHeight:t,clientHeight:e}=this.kn,o=t-e;o>0&&(this.thumbY.style.top=n/o*(this.trackY.clientHeight-this.thumbY.offsetHeight)+"px")}Un(){if(!this.trackX||!this.thumbX)return;const{scrollLeft:n,scrollWidth:t,clientWidth:e}=this.kn,o=t-e;o>0&&(this.thumbX.style.left=n/o*(this.trackX.clientWidth-this.thumbX.offsetWidth)+"px")}Yn(){this.an||(this.trackY?.classList.add("scrolling"),this.trackX?.classList.add("scrolling"),null!==this.wn&&clearTimeout(this.wn),this.wn=setTimeout(()=>{this.trackY?.classList.remove("scrolling"),this.trackX?.classList.remove("scrolling"),this.wn=null},this.Sn))}Dn(n){0===n.button&&(n.preventDefault(),n.stopPropagation(),this.an=!0,this.vn="y",this.mn=n.clientY,this.yn=this.kn.scrollTop,this.thumbY.setPointerCapture(n.pointerId),this.trackY?.classList.add("dragging"),this.thumbY.addEventListener("pointermove",this.qn),this.thumbY.addEventListener("pointerup",this.Pn),this.thumbY.addEventListener("pointercancel",this.Pn))}An(n){0===n.button&&(n.preventDefault(),n.stopPropagation(),this.an=!0,this.vn="x",this.mn=n.clientX,this.yn=this.kn.scrollLeft,this.thumbX.setPointerCapture(n.pointerId),this.trackX?.classList.add("dragging"),this.thumbX.addEventListener("pointermove",this.qn),this.thumbX.addEventListener("pointerup",this.Pn),this.thumbX.addEventListener("pointercancel",this.Pn))}Rn(n){if(this.an)if("y"===this.vn){const t=n.clientY-this.mn,{scrollHeight:e,clientHeight:o}=this.kn,i=this.trackY.clientHeight-this.thumbY.offsetHeight;if(0>=i)return;this.kn.scrollTop=this.yn+t*((e-o)/i)}else{const t=n.clientX-this.mn,{scrollWidth:e,clientWidth:o}=this.kn,i=this.trackX.clientWidth-this.thumbX.offsetWidth;if(0>=i)return;this.kn.scrollLeft=this.yn+t*((e-o)/i)}}Vn(n){const t="y"===this.vn?this.thumbY:this.thumbX,e="y"===this.vn?this.trackY:this.trackX;this.an=!1,t.releasePointerCapture(n.pointerId),e?.classList.remove("dragging"),t.removeEventListener("pointermove",this.qn),t.removeEventListener("pointerup",this.Pn),t.removeEventListener("pointercancel",this.Pn),this.Yn()}On(n){if(n.target===this.thumbY||0!==n.button)return;n.preventDefault();const t=this.trackY.getBoundingClientRect(),e=(n.clientY-t.top)/t.height,{scrollHeight:o,clientHeight:i}=this.kn;this.kn.scrollTo({top:e*(o-i),behavior:"smooth"})}Nn(n){if(n.target===this.thumbX||0!==n.button)return;n.preventDefault();const t=this.trackX.getBoundingClientRect(),e=(n.clientX-t.left)/t.width,{scrollWidth:o,clientWidth:i}=this.kn;this.kn.scrollTo({left:e*(o-i),behavior:"smooth"})}}const yn="\n/* ===================================== */\n/* Custom Scrollbar - Vertical Track */\n/* ===================================== */\n\n.ty-scrollbar-track-y {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: var(--ty-scrollbar-width, 8px);\n z-index: 3;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.25s ease-out;\n cursor: pointer;\n}\n\n.ty-scrollbar-track-y.has-overflow {\n pointer-events: auto;\n}\n\n.ty-scrollbar-track-y.has-overflow:hover,\n.ty-scrollbar-track-y.has-overflow.scrolling,\n.ty-scrollbar-track-y.dragging {\n opacity: 1;\n}\n\n.ty-scrollbar-track-y::before {\n content: '';\n position: absolute;\n inset: 0;\n background: var(--ty-scrollbar-track, transparent);\n border-radius: var(--ty-scrollbar-radius, 4px);\n opacity: 0;\n transition: opacity 0.15s ease-out;\n}\n\n.ty-scrollbar-track-y:hover::before,\n.ty-scrollbar-track-y.dragging::before {\n opacity: 1;\n background: var(--ty-scrollbar-track-hover, rgba(0, 0, 0, 0.06));\n}\n\n.ty-scrollbar-thumb-y {\n position: absolute;\n right: 0;\n width: 100%;\n min-height: var(--ty-scrollbar-thumb-min-height, 30px);\n background: var(--ty-scrollbar-thumb, rgba(0, 0, 0, 0.35));\n border-radius: var(--ty-scrollbar-radius, 4px);\n transition: background 0.15s ease-out;\n box-sizing: border-box;\n border: 1px solid transparent;\n}\n\n.ty-scrollbar-thumb-y:hover,\n.ty-scrollbar-track-y.dragging .ty-scrollbar-thumb-y {\n background: var(--ty-scrollbar-thumb-hover, rgba(0, 0, 0, 0.50));\n}\n\n.ty-scrollbar-thumb-y:active,\n.ty-scrollbar-track-y.dragging .ty-scrollbar-thumb-y {\n background: var(--ty-scrollbar-thumb-active, rgba(0, 0, 0, 0.60));\n}\n\n/* ===================================== */\n/* Custom Scrollbar - Horizontal Track */\n/* ===================================== */\n\n.ty-scrollbar-track-x {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: var(--ty-scrollbar-width, 8px);\n z-index: 3;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.25s ease-out;\n cursor: pointer;\n}\n\n.ty-scrollbar-track-x.has-overflow {\n pointer-events: auto;\n}\n\n.ty-scrollbar-track-x.has-overflow:hover,\n.ty-scrollbar-track-x.has-overflow.scrolling,\n.ty-scrollbar-track-x.dragging {\n opacity: 1;\n}\n\n.ty-scrollbar-track-x::before {\n content: '';\n position: absolute;\n inset: 0;\n background: var(--ty-scrollbar-track, transparent);\n border-radius: var(--ty-scrollbar-radius, 4px);\n opacity: 0;\n transition: opacity 0.15s ease-out;\n}\n\n.ty-scrollbar-track-x:hover::before,\n.ty-scrollbar-track-x.dragging::before {\n opacity: 1;\n background: var(--ty-scrollbar-track-hover, rgba(0, 0, 0, 0.06));\n}\n\n.ty-scrollbar-thumb-x {\n position: absolute;\n bottom: 0;\n height: 100%;\n min-width: var(--ty-scrollbar-thumb-min-height, 30px);\n background: var(--ty-scrollbar-thumb, rgba(0, 0, 0, 0.35));\n border-radius: var(--ty-scrollbar-radius, 4px);\n transition: background 0.15s ease-out;\n box-sizing: border-box;\n border: 1px solid transparent;\n}\n\n.ty-scrollbar-thumb-x:hover,\n.ty-scrollbar-track-x.dragging .ty-scrollbar-thumb-x {\n background: var(--ty-scrollbar-thumb-hover, rgba(0, 0, 0, 0.50));\n}\n\n.ty-scrollbar-thumb-x:active,\n.ty-scrollbar-track-x.dragging .ty-scrollbar-thumb-x {\n background: var(--ty-scrollbar-thumb-active, rgba(0, 0, 0, 0.60));\n}\n\n/* ===================================== */\n/* Touch devices - hide custom scrollbar */\n/* ===================================== */\n\n@media (pointer: coarse) and (hover: none) {\n .ty-scrollbar-track-y,\n .ty-scrollbar-track-x {\n display: none !important;\n }\n}\n\n/* Respect reduced motion */\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 {\n transition-duration: 0ms !important;\n }\n}\n",fn='<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>',wn=class extends o{constructor(){super(),this.Gn=null,this.Xn=null,this.Kn=null,this.j=!1,this.handleInputEvent=n=>{this.value=n.target.value,this.Gn&&this.Xn&&this.resizeTextarea(this.Gn,this.Xn),this.emitValueEvents(n)},this.handleFocusEvent=()=>{this.j=!0},this.handleBlurEvent=()=>{this.j=!1};const n=this.shadowRoot;r(n,{css:"\n:host {\n display: block;\n font-family: var(--ty-font-sans);\n width: 100%;\n}\n\n.textarea-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n box-sizing: border-box;\n position: relative;\n /* For absolute positioned dummy element */\n}\n\n.textarea-wrapper {\n position: relative;\n width: 100%;\n}\n\n/* Custom scrollbar track positioning within textarea border */\n.textarea-wrapper .ty-scrollbar-track-y {\n top: 2px;\n right: 2px;\n bottom: 2px;\n border-radius: 0 4px 4px 0;\n}\n\n/* ===== LABEL STYLING ===== */\n\n.textarea-label {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-medium);\n color: var(--ty-label-color);\n margin-bottom: 6px;\n padding-left: 12px;\n}\n\n/* Required indicator - using SVG icon instead of CSS */\n.required-icon {\n display: inline-flex;\n align-items: center;\n color: var(--ty-color-danger);\n width: 12px;\n height: 12px;\n vertical-align: middle;\n}\n\n/* ===== ERROR MESSAGE STYLING ===== */\n\n.error-message {\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n letter-spacing: var(--ty-tracking-xs);\n color: var(--ty-color-danger);\n margin-top: 4px;\n padding-left: 12px;\n}\n\n/* Error state for textareas */\ntextarea.error {\n border-color: var(--ty-color-danger);\n background: var(--ty-bg-danger-soft);\n}\n\ntextarea.error:focus {\n border-color: var(--ty-color-danger-mild);\n box-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\n\n/* ===== TEXTAREA BASE STYLING ===== */\n\ntextarea {\n /* Base appearance — elegant and minimal like input */\n box-sizing: border-box;\n width: 100%;\n border: 1px solid var(--input-border, var(--ty-input-border));\n border-radius: 6px;\n background: var(--input-bg, var(--ty-input-bg));\n color: var(--input-color, var(--ty-input-color));\n font-family: inherit;\n /* Linear-paired typography */\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-normal);\n transition: all 0.15s ease-in-out;\n outline: none;\n\n /* Default size (md) - refined spacing */\n min-height: 80px;\n /* Larger than input for multiline */\n padding: 12px 12px;\n /* Slightly larger padding for text areas */\n\n /* Auto-resize specific styles */\n overflow: hidden;\n /* Hide scrollbars since we're auto-resizing */\n resize: none;\n /* Disable manual resize by default */\n\n /* Ensure consistent text wrapping */\n white-space: pre-wrap;\n word-wrap: break-word;\n}\n\n/* Hide native scrollbar for webkit when custom scrollbar is active\n (scrollbar-width: none handles Firefox; this handles Chrome/Safari) */\n:host([data-custom-scroll]) textarea::-webkit-scrollbar {\n display: none;\n}\n\n/* Focus state - elegant blue glow like input */\ntextarea:focus {\n border-color: var(--input-border-focus, var(--ty-input-border-focus));\n box-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n background: var(--input-bg, var(--ty-input-bg));\n}\n\n/* Hover state - subtle feedback */\ntextarea:hover:not(:disabled) {\n border-color: var(--input-border-hover, var(--ty-input-border-hover));\n}\n\n/* Disabled state - refined opacity */\ntextarea:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n background: var(--input-disabled-bg, var(--ty-input-disabled-bg));\n border-color: var(--input-disabled-border, var(--ty-input-disabled-border));\n color: var(--input-disabled-color, var(--ty-input-disabled-color));\n}\n\n/* Placeholder styling - subtle and elegant */\ntextarea::placeholder {\n color: var(--input-placeholder, var(--ty-input-placeholder));\n font-weight: 400;\n}\n\n/* ===== RESIZE CONTROL OPTIONS ===== */\n\n/* Allow manual resizing */\ntextarea.resize-both {\n resize: both;\n}\n\ntextarea.resize-horizontal {\n resize: horizontal;\n}\n\ntextarea.resize-vertical {\n resize: vertical;\n}\n\ntextarea.resize-none {\n resize: none;\n}\n\n/* Auto-resize mode (default) disables manual resize */\ntextarea:not(.resize-both):not(.resize-horizontal):not(.resize-vertical) {\n resize: none;\n}\n\n/* ===== DUMMY ELEMENT FOR AUTO-RESIZE ===== */\n\n.textarea-dummy {\n /* Hidden element that measures text height */\n position: absolute !important;\n top: 0 !important;\n left: 0 !important;\n visibility: hidden !important;\n white-space: pre-wrap !important;\n word-break: break-word !important;\n box-sizing: border-box !important;\n overflow: hidden !important;\n pointer-events: none !important;\n z-index: -1 !important;\n\n /* Ensure it has the same text behavior as textarea */\n word-wrap: break-word !important;\n overflow-wrap: break-word !important;\n}\n\n/* ===== SIZE MODIFIERS ===== */\n\n/* Extra Small */\ntextarea.xs {\n min-height: 64px;\n padding: 8px 10px;\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n letter-spacing: var(--ty-tracking-xs);\n}\n\n/* Small */\ntextarea.sm {\n min-height: 72px;\n padding: 10px 10px;\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n}\n\n/* Medium (default) */\ntextarea.md {\n min-height: 80px;\n padding: 12px 12px;\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n}\n\n/* Large */\ntextarea.lg {\n min-height: 96px;\n padding: 14px 14px;\n font-size: var(--ty-font-base);\n line-height: var(--ty-leading-base);\n letter-spacing: var(--ty-tracking-base);\n}\n\n/* Extra Large */\ntextarea.xl {\n min-height: 112px;\n padding: 16px 16px;\n font-size: var(--ty-font-lg);\n line-height: var(--ty-leading-lg);\n letter-spacing: var(--ty-tracking-lg);\n}\n\n/* ===== ACCESSIBILITY ENHANCEMENTS ===== */\n\ntextarea:focus-visible {\n outline: none;\n /* We use box-shadow instead */\n}\n\n/* High contrast mode support */\n@media (prefers-contrast: high) {\n textarea {\n border-width: 2px;\n }\n}\n\n/* Reduced motion support */\n@media (prefers-reduced-motion: reduce) {\n textarea {\n transition: none;\n }\n\n .textarea-dummy {\n transition: none;\n }\n}\n\n/* ===== CONTAINER-AWARE RESPONSIVE BEHAVIOR ===== */\n\n/* Scale down on smaller containers using container queries */\n@container (max-width: 480px) {\n textarea.lg {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: 12px 12px;\n min-height: 80px;\n }\n\n textarea.xl {\n font-size: var(--ty-font-base);\n line-height: var(--ty-leading-base);\n letter-spacing: var(--ty-tracking-base);\n padding: 14px 14px;\n min-height: 96px;\n }\n}\n\n@container (max-width: 320px) {\n textarea.xl {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: 12px 12px;\n min-height: 80px;\n }\n}\n\n/* Fallback for browsers without container query support */\n@media (max-width: 640px) {\n textarea.lg {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: 12px 12px;\n min-height: 80px;\n }\n\n textarea.xl {\n font-size: var(--ty-font-base);\n line-height: var(--ty-leading-base);\n letter-spacing: var(--ty-tracking-base);\n padding: 14px 14px;\n min-height: 96px;\n }\n}\n\n@media (max-width: 480px) {\n textarea.xl {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: 12px 12px;\n min-height: 80px;\n }\n}\n\n/* ===== ANIMATION AND TRANSITIONS ===== */\n\n/* Smooth height transitions for auto-resize */\ntextarea {\n transition:\n border-color 0.15s ease-in-out,\n box-shadow 0.15s ease-in-out,\n background-color 0.15s ease-in-out,\n height 0.1s ease-out;\n /* Smooth height changes */\n}\n\n/* Disable height transition on focus to avoid jarring effect */\ntextarea:focus {\n transition:\n border-color 0.15s ease-in-out,\n box-shadow 0.15s ease-in-out,\n background-color 0.15s ease-in-out;\n}\n\n/* For users who prefer reduced motion, disable height transitions */\n@media (prefers-reduced-motion: reduce) {\n textarea {\n transition: none;\n }\n}\n",id:"ty-textarea"}),vn()&&r(n,{css:yn,id:"ty-custom-scrollbar"})}onConnect(){}onDisconnect(){if(this.Zn(),this.Gn){const n=this.Gn.cloneNode(!0);this.Gn.parentNode?.replaceChild(n,this.Gn),this.Gn=null}this.Xn=null}onPropertiesChanged(n){}getFormValue(){return this.getProperty("value")||null}get value(){return this.getProperty("value")}set value(n){this.setProperty("value",n)}get name(){return this.getProperty("name")}set name(n){this.setProperty("name",n)}get placeholder(){return this.getProperty("placeholder")}set placeholder(n){this.setProperty("placeholder",n)}get label(){return this.getProperty("label")}set label(n){this.setProperty("label",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}get required(){return this.getProperty("required")}set required(n){this.setProperty("required",n)}get error(){return this.getProperty("error")}set error(n){this.setProperty("error",n)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get rows(){return this.getProperty("rows")}set rows(n){this.setProperty("rows",n)}get cols(){return this.getProperty("cols")}set cols(n){this.setProperty("cols",n)}get resize(){return this.getProperty("resize")}set resize(n){this.setProperty("resize",n)}get minHeight(){return this.getProperty("minHeight")}set minHeight(n){this.setProperty("minHeight",n)}get maxHeight(){return this.getProperty("maxHeight")}set maxHeight(n){this.setProperty("maxHeight",n)}getFontStyle(n){const t=window.getComputedStyle(n);return{fontFamily:t.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,fontStyle:t.fontStyle}}getSpacingStyle(n){const t=window.getComputedStyle(n);return{padding:t.padding,paddingTop:t.paddingTop,paddingRight:t.paddingRight,paddingBottom:t.paddingBottom,paddingLeft:t.paddingLeft,margin:t.margin,borderWidth:t.borderWidth}}setupDummyElement(n){const t=this.shadowRoot,e=t.querySelector(".textarea-dummy");e&&e.remove();const o=document.createElement("pre"),i=this.getFontStyle(n),r=this.getSpacingStyle(n);o.className="textarea-dummy";const s=o.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(i).forEach(([n,t])=>{s[n]=t}),Object.entries(r).forEach(([n,t])=>{s[n]=t}),t.appendChild(o),this.Xn=o,o}resizeTextarea(n,t){if(!n||!t)return;const e=this.value,o=this.placeholder,i=n.clientHeight;t.textContent=""===e&&o?o:e+" ",t.style.width=n.clientWidth+"px";const r=t.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-i)>2&&(n.style.height=l+"px",null===a||a>r?(n.style.overflowY="hidden",this.Zn()):(n.style.overflowY="auto",this.Jn(n))),this.Kn?.update()}Jn(n){if(this.Kn||!vn())return;n.style.scrollbarWidth="none",this.setAttribute("data-custom-scroll",""),this.Kn=new mn(n,{vertical:!0,horizontal:!1});const t=this.shadowRoot.querySelector(".textarea-wrapper");t&&this.Kn.trackY&&t.appendChild(this.Kn.trackY)}Zn(){this.Kn&&(this.Kn.trackY?.remove(),this.Kn.destroy(),this.Kn=null,this.removeAttribute("data-custom-scroll"),this.Gn&&(this.Gn.style.scrollbarWidth=""))}emitValueEvents(n){const t=this.value;this.m.setFormValue(t||"");const e={bubbles:!0,composed:!0,detail:{value:t,originalEvent:n}};setTimeout(()=>{this.dispatchEvent(new CustomEvent("input",e)),this.dispatchEvent(new CustomEvent("change",e))},0)}buildClassList(){const n=[this.size];this.disabled&&n.push("disabled"),this.required&&n.push("required"),this.error&&n.push("error"),"none"!==this.resize&&n.push("resize-"+this.resize);const t=this.getAttribute("class");return t&&n.push(t),n.join(" ")}applyHeightConstraints(n){this.minHeight&&(n.style.minHeight=this.minHeight),this.maxHeight&&(n.style.maxHeight=this.maxHeight)}setupTextareaEvents(n){n.addEventListener("input",this.handleInputEvent),n.addEventListener("change",this.handleInputEvent),n.addEventListener("focus",this.handleFocusEvent),n.addEventListener("blur",this.handleBlurEvent)}render(){const n=this.shadowRoot,t=n.querySelector(".textarea-container"),e=n.querySelector("label"),o=n.querySelector("textarea"),i=n.querySelector(".error-message");if(t&&o){if(this.label?e&&(e.innerHTML=this.label+(this.required?` <span class="required-icon">${fn}</span>`:""),e.style.display="block"):e&&(e.style.display="none"),o.value=this.value||"",o.placeholder=this.placeholder||"",o.disabled=this.disabled,o.required=this.required,o.className=this.buildClassList(),this.name?o.setAttribute("name",this.name):o.removeAttribute("name"),this.rows&&o.setAttribute("rows",this.rows),this.cols&&o.setAttribute("cols",this.cols),this.applyHeightConstraints(o),this.error){if(!i){const n=document.createElement("div");n.className="error-message",t.appendChild(n)}const e=n.querySelector(".error-message");e&&(e.textContent=this.error)}else i&&i.remove();const r=this.setupDummyElement(o);setTimeout(()=>this.resizeTextarea(o,r),0),this.Gn=o}else{const t=document.createElement("div");t.className="textarea-container";const e=document.createElement("label");e.className="textarea-label",this.label?(e.innerHTML=this.label+(this.required?` <span class="required-icon">${fn}</span>`:""),e.style.display="block"):e.style.display="none";const o=document.createElement("textarea");o.value=this.value||"",o.placeholder=this.placeholder||"",o.disabled=this.disabled,o.required=this.required,o.className=this.buildClassList(),this.name&&o.setAttribute("name",this.name),o.setAttribute("rows",this.rows||"3"),this.cols&&o.setAttribute("cols",this.cols),this.applyHeightConstraints(o),this.setupTextareaEvents(o);const i=document.createElement("div");if(i.className="textarea-wrapper",i.appendChild(o),t.appendChild(e),t.appendChild(i),this.error){const n=document.createElement("div");n.className="error-message",n.textContent=this.error,t.appendChild(n)}n.appendChild(t);const r=this.setupDummyElement(o);setTimeout(()=>this.resizeTextarea(o,r),0),this.Gn=o}}};wn.formAssociated=!0,wn.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:"md",validate:n=>["xs","sm","md","lg","xl"].includes(n),coerce:n=>["xs","sm","md","lg","xl"].includes(n)?n:"md"},rows:{type:"string",visual:!0,default:"3",coerce:n=>n+""},cols:{type:"string",visual:!0,default:"",coerce:n=>n?n+"":""},resize:{type:"string",visual:!0,default:"none",validate:n=>["none","both","horizontal","vertical"].includes(n),coerce:n=>["none","both","horizontal","vertical"].includes(n)?n:"none"},minHeight:{type:"string",visual:!0,default:""},maxHeight:{type:"string",visual:!0,default:""}};let xn=wn;customElements.get("ty-textarea")||customElements.define("ty-textarea",xn);const kn={"top-start":{vertical:"top",horizontal:"start"},top:{vertical:"top",horizontal:"center"},"top-end":{vertical:"top",horizontal:"end"},"right-start":{vertical:"center",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:"center",horizontal:"start",orientation:"vertical"},left:{vertical:"center",horizontal:"start",orientation:"vertical"},"left-end":{vertical:"end",horizontal:"start",orientation:"vertical"}},zn={default:["bottom-start","bottom-end","top-start","top-end","bottom","top","left","right"],tooltip:["top","bottom","left","right","top-start","top-end","bottom-start","bottom-end"]};function Cn(n){const t=n.getBoundingClientRect();return{top:t.top,left:t.left,right:t.right,bottom:t.bottom,width:t.width,height:t.height,centerX:t.left+t.width/2,centerY:t.top+t.height/2}}function Sn(n){const{targetEl:t,floatingEl:e,preferences:o=zn.default,offset:i=8,padding:r=8,containerPadding:s=0}=n,a=Cn(t),l=Cn(e),d=o.map(n=>function(n){const{targetRect:t,floatingRect:e,placement:o,offset:i,padding:r,scrollbarWidth:s,containerPadding:a}=n,l=kn[o],{vertical:d,horizontal:c,orientation:h}=l,p=window.innerWidth,u=window.innerHeight;let g,b;window,window,g="vertical"===h?"start"===c?t.left-e.width-i+a:t.right+i-a:"start"===c?t.left:"center"===c?t.centerX-e.width/2:t.right-e.width,b="vertical"===h?"center"===d?t.centerY-e.height/2:"end"===d?t.bottom-e.height-a:t.top:"top"===d?t.top-e.height-i+a:t.bottom+i-a;const v={top:Math.min(0,b-r),left:Math.min(0,g-r),bottom:Math.min(0,u-(b+e.height+r)),right:Math.min(0,p-(g+e.width+r+s))},m=Object.values(v).reduce((n,t)=>n+Math.abs(t),0);return{x:Math.round(g),y:Math.round(b),placement:o,overflow:v,overflowAmount:m,fits:0===m}}({targetRect:a,floatingRect:l,placement:n,offset:i,padding:r,containerPadding:s,scrollbarWidth:15})),c=d.find(n=>n.fits)||d.reduce((n,t)=>n.overflowAmount>t.overflowAmount?t:n);return 0>c.overflow.right&&(c.x+=c.overflow.right),c}const En={id:"ty-tooltip",css:'\n/* Tooltip host element - display contents to not affect layout */\n:host {\n display: contents;\n}\n\n/* Tooltip container - positioned element */\n#tooltip-container {\n position: fixed;\n top: var(--y, 0px);\n left: var(--x, 0px);\n z-index: var(--ty-z-tooltip, 9999);\n\n /* Hidden by default */\n visibility: hidden;\n opacity: 0;\n transition: opacity 200ms, visibility 200ms;\n\n /* Prevent interaction */\n pointer-events: none;\n user-select: none;\n -webkit-user-select: none;\n \n /* Bold shadow for depth */\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), \n 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n}\n\n/* When open */\n#tooltip-container.open {\n visibility: visible;\n opacity: 1;\n}\n\n/* Base tooltip styling - Dark inverted style (like buttons) */\n#tooltip-container {\n /* Bold, high-contrast styling */\n background: var(--ty-tooltip-bg, #1f2937);\n color: var(--ty-tooltip-color, #ffffff);\n \n /* Comfortable padding */\n padding: var(--ty-tooltip-padding, 8px 12px);\n border-radius: var(--ty-tooltip-radius, 6px);\n \n /* No border - solid color provides contrast */\n border: none;\n \n /* Sizing */\n max-width: var(--ty-tooltip-max-width, 250px);\n \n /* Typography - clear and readable */\n font-size: var(--ty-font-sm, 14px);\n font-weight: var(--ty-font-semibold, 600);\n line-height: 1.5;\n text-align: center;\n}\n\n/* Content slot */\n#tooltip-container ::slotted(*) {\n /* Ensure slotted content inherits styles */\n color: inherit;\n font-size: inherit;\n line-height: inherit;\n}\n\n/* ============================================ */\n/* Flavor Variants - Bold, Button-like Colors */\n/* ============================================ */\n\n/* Primary - Bold blue (like primary button) */\n#tooltip-container[data-flavor="primary"] {\n background: var(--ty-color-primary, #3b82f6);\n color: #ffffff;\n}\n\n/* Success - Bold green */\n#tooltip-container[data-flavor="success"] {\n background: var(--ty-color-success, #10b981);\n color: #ffffff;\n}\n\n/* Danger - Bold red */\n#tooltip-container[data-flavor="danger"] {\n background: var(--ty-color-danger, #ef4444);\n color: #ffffff;\n}\n\n/* Warning - Bold orange/amber */\n#tooltip-container[data-flavor="warning"] {\n background: var(--ty-color-warning, #f59e0b);\n color: #ffffff;\n}\n\n/* Info - Bold cyan/blue */\n#tooltip-container[data-flavor="info"] {\n background: var(--ty-color-info, #06b6d4);\n color: #ffffff;\n}\n\n/* Neutral - Medium gray (default alternative) */\n#tooltip-container[data-flavor="neutral"] {\n background: var(--ty-color-neutral, #6b7280);\n color: #ffffff;\n}\n\n/* Light - For dark backgrounds */\n#tooltip-container[data-flavor="light"] {\n background: var(--ty-surface-elevated, #ffffff);\n color: var(--ty-text-strong, #111827);\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15), \n 0 4px 6px -4px rgba(0, 0, 0, 0.1),\n 0 0 0 1px rgba(0, 0, 0, 0.05);\n}\n\n/* Dark - Inverted style (default) */\n#tooltip-container[data-flavor="dark"] {\n background: var(--ty-tooltip-bg, #1f2937);\n color: #ffffff;\n}\n\n/* Secondary - Purple/indigo */\n#tooltip-container[data-flavor="secondary"] {\n background: var(--ty-color-secondary, #8b5cf6);\n color: #ffffff;\n}\n'},Tn=new WeakMap,Mn=new WeakMap,Dn=new WeakMap,$n=new WeakMap;function An(n){const t=n||"dark";return["dark","light","primary","secondary","success","danger","warning","info","neutral"].includes(t)?t:"dark"}function In(n){let t=Dn.get(n);return t||(t={showTimeout:null,hideTimeout:null},Dn.set(n,t)),t}function On(n,t){return n.hasAttribute(t)}function Ln(n,t,e){const o=n.getAttribute(t);if(null===o)return e;const i=parseInt(o,10);return isNaN(i)?e:i}function Nn(n){return{placement:n.getAttribute("placement")||"top",offset:Ln(n,"offset",8),delay:Ln(n,"delay",600),disabled:On(n,"disabled"),flavor:An(n.getAttribute("flavor"))}}function qn(n){return n.parentElement}function Rn(n,t){switch(n.style.removeProperty("background"),n.style.removeProperty("color"),n.style.removeProperty("border-color"),t){case"primary":n.style.background="var(--ty-bg-primary, #3b82f6)",n.style.color="var(--ty-color-primary-strong, #eff6ff)",n.style.borderColor="var(--ty-border-primary, #60a5fa)";break;case"secondary":n.style.background="var(--ty-bg-secondary, #8b5cf6)",n.style.color="var(--ty-color-secondary-strong, #f5f3ff)",n.style.borderColor="var(--ty-border-secondary, #a78bfa)";break;case"success":n.style.background="var(--ty-bg-success-mild, #10b981)",n.style.color="var(--ty-color-success-strong, #ecfdf5)",n.style.borderColor="var(--ty-border-success, #34d399)";break;case"danger":n.style.background="var(--ty-bg-danger, #ef4444)",n.style.color="var(--ty-color-danger-strong, #fef2f2)",n.style.borderColor="var(--ty-border-danger, #f87171)";break;case"warning":n.style.background="var(--ty-bg-warning, #f59e0b)",n.style.color="var(--ty-color-warning-strong, #fffbeb)",n.style.borderColor="var(--ty-border-warning, #fbbf24)";break;case"info":n.style.background="var(--ty-bg-info, #06b6d4)",n.style.color="var(--ty-text-strong, #f0f9ff)",n.style.borderColor="var(--ty-border-info, #22d3ee)";break;case"light":n.style.background="var(--ty-surface-elevated, #ffffff)",n.style.color="var(--ty-text-strong, #111827)",n.style.borderColor="var(--ty-border, #e5e7eb)";break;case"neutral":n.style.background="var(--ty-bg-neutral, #6b7280)",n.style.color="var(--ty-color-neutral-strong, #f9fafb)",n.style.borderColor="var(--ty-border-neutral, #9ca3af)";break;default:n.style.background="var(--ty-bg-neutral-soft, #4b5563)",n.style.color="var(--ty-color-neutral-strong, #f3f4f6)",n.style.borderColor="var(--ty-border-strong, #6b7280)"}}function Pn(n){const{placement:t,offset:e}=Nn(n),o=qn(n),i=$n.get(n);if(!o||!i)return;const r=Sn({targetEl:o,floatingEl:i,preferences:"top"===t?zn.tooltip:"bottom"===t?["bottom","top","left","right"]:"left"===t?["left","right","top","bottom"]:"right"===t?["right","left","top","bottom"]:zn.tooltip,offset:e});i.style.left=r.x+"px",i.style.top=r.y+"px"}function Vn(n){const t=Tn.get(n);t&&(t(),Tn.delete(n))}function Bn(n){const t=In(n);null!==t.showTimeout&&(clearTimeout(t.showTimeout),t.showTimeout=null),null!==t.hideTimeout&&(clearTimeout(t.hideTimeout),t.hideTimeout=null)}function Fn(n){const t=$n.get(n);if(t)try{t.hidePopover(),n.Qn=!1,Vn(n)}catch(e){}}function Hn(n){const t=In(n),{delay:e}=Nn(n);Bn(n),t.showTimeout=window.setTimeout(()=>function(n){const{disabled:t}=Nn(n);if(t)return;const e=function(n){let t=$n.get(n);if(!t){t=document.createElement("div"),t.id="ty-tooltip-"+Math.random().toString(36).substr(2,9),t.setAttribute("popover","manual"),t.className="ty-tooltip-popover";const{flavor:e}=Nn(n);t.setAttribute("data-flavor",e),t.textContent=n.textContent||"",t.style.cssText="\n position: fixed;\n margin: 0;\n padding: 8px 12px;\n background: var(--ty-tooltip-bg, #1f2937);\n color: #ffffff;\n border: none;\n border-radius: 6px;\n font-size: var(--ty-font-sm, 14px);\n font-weight: var(--ty-font-semibold, 600);\n line-height: 1.5;\n max-width: 250px;\n text-align: center;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n user-select: none;\n pointer-events: none;\n ",Rn(t,e),document.body.appendChild(t),$n.set(n,t)}return t}(n);try{e.showPopover(),n.Qn=!0,Pn(n),function(n){const t=qn(n),e=$n.get(n);if(!t||!e)return;let o=null;const i=()=>{null!==o&&clearTimeout(o),o=window.setTimeout(()=>{o=null,Pn(n)},10)},r=new ResizeObserver(i);r.observe(t),r.observe(e);let s=null;const a=()=>{null===s&&(s=requestAnimationFrame(()=>{s=null,Pn(n)}))};window.addEventListener("scroll",a,!0),window.addEventListener("resize",i),Tn.set(n,()=>{r.disconnect(),window.removeEventListener("scroll",a,!0),window.removeEventListener("resize",i),null!==o&&clearTimeout(o),null!==s&&cancelAnimationFrame(s)})}(n)}catch(o){}}(n),e)}function jn(n){const t=In(n);Bn(n),t.hideTimeout=window.setTimeout(()=>Fn(n),200)}class TyTooltip extends HTMLElement{constructor(){super(),this.Qn=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["placement","offset","delay","disabled","flavor"]}connectedCallback(){this.Qn=!1,r(this.shadowRoot,En),function(n){const t=qn(n);if(!t)return;const e=()=>Hn(n),o=()=>jn(n),i=()=>Hn(n),r=()=>jn(n);t.addEventListener("mouseenter",e),t.addEventListener("mouseleave",o),t.addEventListener("focusin",i),t.addEventListener("focusout",r),Mn.set(n,()=>{t.removeEventListener("mouseenter",e),t.removeEventListener("mouseleave",o),t.removeEventListener("focusin",i),t.removeEventListener("focusout",r)})}(this)}disconnectedCallback(){!function(n){Bn(n),Vn(n);const t=Mn.get(n);t&&(t(),Mn.delete(n));const e=$n.get(n);e&&(e.remove(),$n.delete(n)),Dn.delete(n)}(this)}attributeChangedCallback(n,t,e){if("flavor"===n&&this.Qn){const n=$n.get(this);n&&Rn(n,An(e))}"disabled"===n&&null!==e&&Fn(this)}}customElements.get("ty-tooltip")||customElements.define("ty-tooltip",TyTooltip);const Wn={locked:!1,scrollY:0,activeLocks:new Set};function Yn(){return document.documentElement}function _n(){if(!Wn.locked)return;const n=Yn();window,n.classList.remove("ty-scroll-locked"),n.style.overflow="",n.style.paddingRight="",Wn.locked=!1}function Un(n){Wn.activeLocks.has(n)||(Wn.activeLocks.add(n),1===Wn.activeLocks.size&&function(){if(Wn.locked)return;const n=window.innerWidth-Yn().clientWidth,t=Yn();window,Wn.scrollY=window.scrollY||Yn().scrollTop||0,Wn.locked=!0,t.style.overflow="hidden",n>0&&(t.style.paddingRight=n+"px"),t.classList.add("ty-scroll-locked")}())}function Gn(n){Wn.activeLocks.has(n)&&(Wn.activeLocks.delete(n),0===Wn.activeLocks.size&&_n())}const Xn=new WeakMap,Kn=new WeakMap,Zn=new WeakMap,Jn=new WeakMap,Qn=new WeakMap;function nt(n,t){return n.hasAttribute(t)}function tt(n,t,e){const o=n.getAttribute(t);if(null===o)return e;const i=parseInt(o,10);return isNaN(i)?e:i}function et(n){return{manual:nt(n,"manual"),disableClose:nt(n,"disable-close"),placement:n.getAttribute("placement")||"bottom",offset:tt(n,"offset",8)}}function ot(n){return n.parentElement}function it(n){return n.querySelector(".popup-dialog")}function rt(n){let t=Qn.get(n);return t||(t="popup-"+(n.id||Math.random().toString(36).substr(2,9)),Qn.set(n,t)),t}function st(n,t=!1){const{disableClose:e}=et(n);if(!t&&e)return;const o=n.shadowRoot,i=o?it(o):null;i&&(i.classList.remove("open"),i.classList.remove("preparing-animation"),setTimeout(()=>{i.classList.remove("position-calculated"),i.close()},150),n.dispatchEvent(new CustomEvent("close",{bubbles:!0})))}function at(n){Un(rt(n));const t=n.shadowRoot,e=t?it(t):null;e&&(e.showModal(),requestAnimationFrame(()=>{!function(n){const{placement:t,offset:e}=et(n),o=n.shadowRoot,i=ot(n),r=o?it(o):null;if(!i||!r)return;const s=Sn({targetEl:i,floatingEl:r,preferences:"top"===t?["top","bottom","left","right"]:"bottom"===t?["bottom","top","left","right"]:"left"===t?["left","right","top","bottom"]:"right"===t?["right","left","top","bottom"]:["bottom","top","right","left"],offset:e,padding:8,containerPadding:16});n.style.setProperty("--popup-x",s.x+"px"),n.style.setProperty("--popup-y",s.y+"px"),r.classList.add("position-calculated")}(n),e.classList.add("preparing-animation"),requestAnimationFrame(()=>{e.classList.add("open"),n.dispatchEvent(new CustomEvent("open",{bubbles:!0}))})}))}function lt(n){const t=n.shadowRoot,e=t?it(t):null;e&&(e.classList.contains("open")?st(n):at(n))}function dt(n){const{manual:t}=et(n),e=ot(n);if(!e||t)return;const o=Xn.get(n);o&&e.removeEventListener("pointerdown",o);const i=t=>function(n,t){t.preventDefault(),t.stopPropagation(),lt(n)}(n,t);Xn.set(n,i),e.addEventListener("pointerdown",i)}function ct(n){const t=ot(n),e=Xn.get(n);t&&e&&(t.removeEventListener("pointerdown",e),Xn.delete(n))}function ht(n){const t=n.shadowRoot;if(!t)return;const e=it(t);if(r(t,{css:"\n/* Popup component with dropdown-like behavior and tooltip positioning */\n/* Uses dialog element for top layer rendering like dropdown and date-picker */\n\n.popup-dialog {\n position: fixed;\n top: 0;\n left: 0;\n\n /* Reset dialog defaults */\n margin: 0;\n border: none;\n background: transparent;\n max-width: none;\n max-height: none;\n\n /* Shadow infrastructure - provide space for user shadows */\n padding: var(--popup-padding, 16px);\n\n /* Hidden by default - even when [open] (for positioning phase) */\n visibility: hidden;\n opacity: 0;\n /* NO TRANSFORM here - apply only when animating to avoid measurement errors! */\n\n /* Smooth transitions */\n transition:\n opacity 150ms ease-out,\n visibility 150ms ease-out,\n transform 150ms ease-out;\n\n /* Prevent interactions when hidden */\n pointer-events: none;\n}\n\n/* Apply position variables only when position is calculated (like dropdown) */\n.popup-dialog.position-calculated {\n top: var(--popup-y, 0px);\n left: var(--popup-x, 0px);\n}\n\n/* Apply scale for entrance animation (right before .open) */\n.popup-dialog.preparing-animation {\n transform: scale(0.95);\n}\n\n/* When open - smooth entrance animation */\n.popup-dialog.open {\n visibility: visible;\n opacity: 1;\n transform: scale(1);\n pointer-events: auto;\n}\n\n/* Make dialog backdrop transparent like dropdown/date-picker */\n.popup-dialog::backdrop {\n background: transparent;\n}\n\n/* Inner container - neutral structural container */\n.popup-container {\n /* No default styling - just provides structure */\n /* Users control all visual aspects via slotted content */\n display: contents;\n}\n\n/* Content slot styling */\n#popup-content {\n /* Allow slotted content to define its own styling */\n display: contents;\n}\n\n/* Remove default styling from slotted content - users have full control */\n#popup-content ::slotted(*) {\n /* Remove default styling that conflicts with user styling */\n /* Users now have complete control over popup appearance */\n /* background: unset; */\n /* border: unset; */\n /* box-shadow: unset; */\n\n /* Only maintain essential positioning */\n position: relative;\n\n /* Prevent content from being too wide - still helpful */\n max-width: min(400px, 90vw);\n max-height: min(500px, 80vh);\n overflow: auto;\n}\n",id:"ty-popup"}),!e){const e=document.createElement("dialog"),o=document.createElement("div"),i=document.createElement("slot");e.className="popup-dialog",o.className="popup-container",i.id="popup-content",t.appendChild(e),e.appendChild(o),o.appendChild(i),n.style.setProperty("--popup-x","0px"),n.style.setProperty("--popup-y","0px");const r=t=>function(n,t){t.stopPropagation();const e=n.shadowRoot,o=e?it(e):null;o&&t.target===o&&(t.preventDefault(),st(n))}(n,t);Kn.set(n,r),e.addEventListener("pointerdown",r);const s=t=>function(n,t){if(t.stopPropagation(),"Escape"===t.key){const{disableClose:e}=et(n);e?t.preventDefault():st(n)}}(n,t);Zn.set(n,s),n.addEventListener("keydown",s),e.addEventListener("close",()=>{Gn(rt(n)),e.classList.remove("open"),e.classList.remove("preparing-animation"),n.dispatchEvent(new CustomEvent("close",{bubbles:!0}))})}n.closePopup=()=>st(n,!0),n.openPopup=()=>at(n),n.togglePopup=()=>lt(n);const o=t=>function(n,t){t.stopPropagation(),st(n,!0)}(n,t);Jn.set(n,o),n.addEventListener("ty:close-popup",o),dt(n)}class TyPopup extends HTMLElement{static get observedAttributes(){return["manual","disable-close","placement","offset"]}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){ht(this)}disconnectedCallback(){!function(n){const t=Qn.get(n);t&&(Gn(t),Qn.delete(n)),ct(n);const e=n.shadowRoot,o=e?it(e):null;if(o){const t=Kn.get(n);t&&(o.removeEventListener("pointerdown",t),Kn.delete(n))}const i=Zn.get(n);i&&(n.removeEventListener("keydown",i),Zn.delete(n));const r=Jn.get(n);r&&(n.removeEventListener("ty:close-popup",r),Jn.delete(n))}(this)}attributeChangedCallback(n,t,e){switch(ht(this),n){case"placement":case"offset":ht(this);break;case"manual":case"disable-close":ct(this),dt(this)}}}customElements.get("ty-popup")||customElements.define("ty-popup",TyPopup);const pt=new WeakMap,ut=new WeakMap,gt=new WeakMap,bt=new WeakMap,vt=new WeakMap,mt=new WeakMap;function yt(n,t){if(!n.hasAttribute(t))return!1;const e=n.getAttribute(t);return null===e||"false"!==e.toLowerCase()}function ft(n){return{open:yt(n,"open"),backdrop:!n.hasAttribute("backdrop")||yt(n,"backdrop"),closeOnOutsideClick:!n.hasAttribute("close-on-outside-click")||yt(n,"close-on-outside-click"),closeOnEscape:!n.hasAttribute("close-on-escape")||yt(n,"close-on-escape"),protected:yt(n,"protected")}}function wt(n){return n.querySelector(".ty-modal-dialog")}function xt(n,t,e){const o=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0});n.dispatchEvent(o)}function kt(n){const{protected:t}=ft(n),e=n.shadowRoot,o=e?wt(e):null;if(o&&o.open){if(t&&!confirm("You have unsaved changes. Are you sure you want to close?"))return;n.removeAttribute("open")}}function zt(n){const t=n.shadowRoot;if(!t)return;const e=ft(n),o=function(n){let t=wt(n);if(!t){t=document.createElement("dialog");const e=document.createElement("button"),o=document.createElement("div"),i=document.createElement("slot");t.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>',o.className="modal-content",o.appendChild(i),t.appendChild(e),t.appendChild(o),n.appendChild(t)}return t}(t),i=function(n){let t=mt.get(n);return t||(t="modal-"+(n.id||Math.random().toString(36).substr(2,9)),mt.set(n,t)),t}(n);r(t,{css:"\n/* Modal Host Styling */\n:host {\n display: contents;\n /* Don't interfere with layout */\n /* CSS variables are now auto-generated via the with-vars? option */\n}\n\n/* ===== CLOSE BUTTON STYLING ===== */\n/* This is part of the modal wrapper functionality, not user content styling */\n\n.close-button {\n position: absolute;\n top: -8px;\n right: -8px;\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: var(--ty-transition-colors);\n z-index: 1;\n color: #d8d8d8;\n\n /* Remove all default browser styling that could cause outlines/borders */\n outline: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n\n /* Remove mobile tap highlights and focus rings */\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;\n user-select: none;\n}\n\n.close-button:hover {\n color: white;\n}\n\n/* Explicitly remove focus and active states for all interaction modes */\n.close-button:focus,\n.close-button:focus-visible,\n.close-button:focus-within,\n.close-button:active {\n outline: none !important;\n box-shadow: none !important;\n border: none !important;\n background: transparent !important;\n}\n\n/* Override hover color even in focus/active states */\n.close-button:hover,\n.close-button:focus:hover,\n.close-button:active:hover {\n color: white;\n}\n\n.close-button.hide {\n visibility: hidden;\n}\n\n/* ===== DIALOG ELEMENT - PURE WRAPPER ===== */\n/* Modal dialog - provides only essential modal functionality without styling user content */\n\n.ty-modal-dialog {\n /* Reset default dialog styles */\n padding: 18px;\n border: none;\n margin: 0;\n background: transparent;\n\n /* Modal positioning - centered */\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n\n /* Layer management */\n z-index: 1000;\n overflow: hidden;\n\n /* No sizing - let user content determine size */\n max-width: 85vw;\n max-height: 90vh;\n\n outline: none;\n}\n\n/* ===== BACKDROP STYLING ===== */\n/* Backdrop is part of modal functionality, not user content */\n\n.ty-modal-dialog::backdrop {\n background: var(--ty-modal-backdrop, rgba(0, 0, 0, 0.5));\n backdrop-filter: var(--ty-modal-backdrop-blur, blur(2px));\n animation: ty-modal-backdrop-enter var(--ty-modal-duration, 200ms) ease-out;\n}\n\n/* When backdrop is disabled */\n.ty-modal-dialog:not([data-backdrop])::backdrop {\n background: transparent;\n backdrop-filter: none;\n}\n\n/* ===== MODAL CONTENT CONTAINER ===== */\n/* Minimal container - no styling imposed on user content */\n\n.modal-content {\n color: var(--ty-text);\n}\n\n/* ===== ANIMATION KEYFRAMES ===== */\n\n@keyframes ty-modal-backdrop-enter {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n",id:"ty-modal"}),o.className="ty-modal-dialog",e.backdrop?o.setAttribute("data-backdrop","true"):o.removeAttribute("data-backdrop"),function(n,t,e){const o=pt.get(n);if(o&&(t.removeEventListener("click",o),pt.delete(n)),e){const e=t=>function(n,t){t.stopPropagation();const e=n.shadowRoot,o=e?wt(e):null;o&&t.target===o&&(t.preventDefault(),kt(n))}(n,t);pt.set(n,e),t.addEventListener("click",e)}}(n,o,e.closeOnOutsideClick),function(n,t,e){const o=ut.get(n);if(o&&(t.removeEventListener("keydown",o),ut.delete(n)),e){const e=t=>function(n,t){t.stopPropagation(),"Escape"===t.key&&(t.preventDefault(),kt(n))}(n,t);ut.set(n,e),t.addEventListener("keydown",e)}}(n,o,e.closeOnEscape),function(n,t,e){const o=t.querySelector(".close-button");if(!o)return;o.style.display=e?"":"none";const i=gt.get(n);if(i&&(o.removeEventListener("click",i),gt.delete(n)),e){const t=t=>function(n,t){t.preventDefault(),t.stopPropagation(),kt(n)}(n,t);gt.set(n,t),o.addEventListener("click",t)}}(n,o,e.closeOnOutsideClick),function(n,t){const e=t.querySelector(".modal-content");if(!e)return;const o=bt.get(n),i=vt.get(n);if(o&&(e.removeEventListener("mouseenter",o),bt.delete(n)),i&&(e.removeEventListener("mouseleave",i),vt.delete(n)),window.innerWidth>=768&&0>=navigator.maxTouchPoints){const t=n=>function(n,t){const e=t.currentTarget.closest(".ty-modal-dialog");if(e){const n=e.querySelector(".close-button");n&&n.classList.add("hide")}}(0,n),o=n=>function(n,t){const e=t.currentTarget.closest(".ty-modal-dialog");if(e){const n=e.querySelector(".close-button");n&&n.classList.remove("hide")}}(0,n);bt.set(n,t),vt.set(n,o),e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",o)}}(n,o),e.open?o.open||(Un(i),e.backdrop?o.showModal():o.show(),xt(n,"open",{})):o.open&&(Gn(i),o.close(),xt(n,"close",{reason:"programmatic"})),o.onclose=()=>{Gn(i),n.hasAttribute("open")&&(n.removeAttribute("open"),xt(n,"close",{reason:"native",returnValue:o.returnValue||void 0}))}}class TyModal extends HTMLElement{static get observedAttributes(){return["open","backdrop","close-on-outside-click","close-on-escape","protected"]}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){zt(this),this.show=()=>{this.setAttribute("open","true")},this.hide=()=>kt(this)}disconnectedCallback(){!function(n){const t=mt.get(n),e=n.shadowRoot,o=e?wt(e):null;if(t&&(Gn(t),mt.delete(n)),!o)return;const i=pt.get(n);i&&(o.removeEventListener("click",i),pt.delete(n));const r=ut.get(n);r&&(o.removeEventListener("keydown",r),ut.delete(n));const s=o.querySelector(".close-button");if(s){const t=gt.get(n);t&&(s.removeEventListener("click",t),gt.delete(n))}const a=o.querySelector(".modal-content");if(a){const t=bt.get(n),e=vt.get(n);t&&(a.removeEventListener("mouseenter",t),bt.delete(n)),e&&(a.removeEventListener("mouseleave",e),vt.delete(n))}}(this)}attributeChangedCallback(n,t,e){zt(this)}}customElements.get("ty-modal")||customElements.define("ty-modal",TyModal);const Ct=`\n/* ==================== SHARED STYLES ==================== */\n/* These apply to BOTH desktop and mobile modes */\n\n:host {\n display: block;\n width: auto;\n min-width: 200px;\n}\n\n:host {\n --mobile-border-color: var(--ty-border, #5858587d);\n}\n\n.dropdown-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n box-sizing: border-box;\n}\n\n/* Label styling */\n.dropdown-label {\n font-size: 14px;\n font-weight: 500;\n color: var(--ty-label-color);\n margin-bottom: 6px;\n line-height: 1.25;\n padding-left: 12px;\n}\n\n.required-icon {\n display: inline-flex;\n align-items: center;\n color: #ef4444;\n width: 12px;\n height: 12px;\n vertical-align: middle;\n margin-left: 4px;\n}\n\n.dropdown-wrapper {\n position: relative;\n display: block;\n width: 100%;\n}\n\n/* ==================== DESKTOP MODE STYLES ==================== */\n/* All styles scoped under .dropdown-mode-desktop */\n\n/* Stub (trigger button) */\n.dropdown-mode-desktop .dropdown-stub {\n width: 100%;\n cursor: pointer;\n box-sizing: border-box;\n position: relative;\n display: flex;\n align-items: center;\n background: var(--input-bg, var(--ty-input-bg));\n color: var(--input-color, var(--ty-input-color));\n border: 1px solid var(--input-border, var(--ty-input-border));\n border-radius: var(--ty-radius-md);\n font-family: var(--ty-font-sans);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-normal);\n min-height: var(--ty-size-md);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n padding-right: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n transition: var(--ty-transition-all), opacity 0.2s ease;\n outline: none;\n}\n\n.dropdown-mode-desktop .dropdown-stub:hover {\n border-color: var(--input-border-hover, var(--ty-input-border-hover));\n}\n\n.dropdown-mode-desktop .dropdown-stub[disabled] {\n background-color: var(--input-disabled-bg, var(--ty-input-disabled-bg));\n color: var(--input-disabled-color, var(--ty-input-disabled-color));\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.dropdown-mode-desktop .dropdown-stub:focus {\n border-color: var(--input-border-hover, var(--ty-input-border-hover));\n}\n\n/* Hide stub when dropdown is open */\n.dropdown-mode-desktop .dropdown-wrapper:has(.dropdown-chevron.open) .dropdown-stub {\n opacity: 0;\n pointer-events: none;\n}\n\n/* Size variants */\n.dropdown-mode-desktop .dropdown-stub.xs {\n min-height: var(--ty-size-xs);\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n letter-spacing: var(--ty-tracking-xs);\n padding: var(--ty-spacing-1) var(--ty-spacing-2);\n padding-right: calc(var(--ty-spacing-2) + 1rem + var(--ty-spacing-1));\n}\n\n.dropdown-mode-desktop .dropdown-stub.sm {\n min-height: var(--ty-size-sm);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: var(--ty-spacing-1) var(--ty-spacing-2);\n padding-right: calc(var(--ty-spacing-2) + 1rem + var(--ty-spacing-1));\n}\n\n.dropdown-mode-desktop .dropdown-stub.md {\n min-height: var(--ty-size-md);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n padding-right: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n}\n\n.dropdown-mode-desktop .dropdown-stub.lg {\n min-height: var(--ty-size-lg);\n font-size: var(--ty-font-base);\n line-height: var(--ty-leading-base);\n letter-spacing: var(--ty-tracking-base);\n padding: var(--ty-spacing-3) var(--ty-spacing-4);\n padding-right: calc(var(--ty-spacing-4) + 1rem + var(--ty-spacing-3));\n}\n\n.dropdown-mode-desktop .dropdown-stub.xl {\n min-height: var(--ty-size-xl);\n font-size: var(--ty-font-lg);\n line-height: var(--ty-leading-lg);\n letter-spacing: var(--ty-tracking-lg);\n padding: var(--ty-spacing-4) var(--ty-spacing-5);\n padding-right: calc(var(--ty-spacing-5) + 1rem + var(--ty-spacing-4));\n}\n\n/* Clearable adjustments */\n.dropdown-mode-desktop .dropdown-stub.xs.clearable.has-selection {\n padding-right: calc(var(--ty-spacing-2) + 2rem + var(--ty-spacing-2));\n}\n\n.dropdown-mode-desktop .dropdown-stub.sm.clearable.has-selection {\n padding-right: calc(var(--ty-spacing-2) + 2rem + var(--ty-spacing-2));\n}\n\n.dropdown-mode-desktop .dropdown-stub.md.clearable.has-selection {\n padding-right: calc(var(--ty-spacing-3) + 2rem + var(--ty-spacing-3));\n}\n\n.dropdown-mode-desktop .dropdown-stub.lg.clearable.has-selection {\n padding-right: calc(var(--ty-spacing-4) + 2rem + var(--ty-spacing-4));\n}\n\n.dropdown-mode-desktop .dropdown-stub.xl.clearable.has-selection {\n padding-right: calc(var(--ty-spacing-5) + 2rem + var(--ty-spacing-5));\n}\n\n/* Start-slot icon (leading content inside the stub trigger) */\n.dropdown-mode-desktop .dropdown-stub ::slotted([slot="start"]),\n.dropdown-mode-mobile .dropdown-stub ::slotted([slot="start"]) {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n margin-right: 0.5rem;\n color: var(--ty-color-text-soft);\n}\n\n.dropdown-mode-desktop .dropdown-stub ::slotted(ty-icon[slot="start"]),\n.dropdown-mode-mobile .dropdown-stub ::slotted(ty-icon[slot="start"]) {\n width: 1em;\n height: 1em;\n}\n\n/* Placeholder */\n.dropdown-mode-desktop .dropdown-placeholder {\n color: var(--input-placeholder, var(--ty-input-placeholder));\n font-weight: var(--ty-font-light);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-style: italic;\n pointer-events: none;\n}\n\n.dropdown-mode-desktop .dropdown-stub.has-selection .dropdown-placeholder {\n display: none;\n}\n\n/* Selected content */\n.dropdown-mode-desktop .dropdown-stub slot[name="selected"] {\n display: block;\n}\n\n.dropdown-mode-desktop .dropdown-stub.has-selection slot[name="selected"] {\n width: 100%;\n}\n\n.dropdown-mode-desktop .dropdown-stub slot[name="selected"] * {\n display: block;\n width: 100%;\n padding: 0;\n margin: 0;\n border: none;\n background: none;\n color: inherit;\n font: inherit;\n line-height: inherit;\n outline: none;\n appearance: none;\n}\n\n/* Chevron */\n.dropdown-mode-desktop .dropdown-chevron {\n position: absolute;\n top: 50%;\n right: var(--ty-spacing-3);\n transform: translateY(-50%);\n width: 1rem;\n height: 1rem;\n color: var(--input-placeholder, var(--ty-input-placeholder));\n transition: var(--ty-transition-transform);\n pointer-events: none;\n}\n\n.dropdown-mode-desktop .dropdown-chevron.open {\n transform: translateY(-50%) rotate(180deg);\n}\n\n.dropdown-mode-desktop .dropdown-chevron svg {\n width: 100%;\n height: 100%;\n}\n\n/* Clear button */\n.dropdown-mode-desktop .dropdown-clear-btn {\n position: absolute;\n top: 50%;\n right: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n transform: translateY(-50%);\n width: 1rem;\n height: 1rem;\n padding: 0;\n border: none;\n background: none;\n color: var(--input-placeholder, var(--ty-input-placeholder));\n cursor: pointer;\n transition: var(--ty-transition-colors);\n display: none;\n}\n\n.dropdown-mode-desktop .dropdown-clear-btn:hover {\n color: var(--ty-color-danger);\n}\n\n.dropdown-mode-desktop .dropdown-clear-btn:active {\n transform: translateY(-50%) scale(0.9);\n}\n\n.dropdown-mode-desktop .dropdown-clear-btn svg {\n width: 100%;\n height: 100%;\n display: block;\n}\n\n/* Dialog */\n.dropdown-mode-desktop .dropdown-dialog {\n position: fixed;\n width: var(--dropdown-width, 200px);\n max-width: 100vw;\n margin: 0;\n padding: 0;\n border: none;\n background: transparent;\n box-sizing: border-box;\n padding: var(--dropdown-padding, 20px);\n opacity: 0;\n transition: opacity 400ms ease;\n transform: translate(var(--dropdown-offset-x, 0px), var(--dropdown-offset-y, 0px));\n top: -1000px;\n left: -1000px;\n}\n\n/* When opened via showModal(), apply flex layout and direction */\n.dropdown-mode-desktop .dropdown-dialog[open] {\n display: flex;\n flex-direction: column;\n}\n\n.dropdown-mode-desktop .dropdown-dialog.position-below {\n left: var(--dropdown-x);\n top: var(--dropdown-y);\n}\n\n.dropdown-mode-desktop .dropdown-dialog.position-above {\n left: var(--dropdown-x);\n bottom: var(--dropdown-y);\n top: auto;\n flex-direction: column-reverse;\n}\n\n.dropdown-mode-desktop .dropdown-dialog.position-above .dropdown-header {\n margin-top: 4px;\n}\n\n.dropdown-mode-desktop .dropdown-dialog.position-below .dropdown-header {\n margin-bottom: 4px;\n}\n\n.dropdown-mode-desktop .dropdown-dialog.position-below .dropdown-options {\n box-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\n.dropdown-mode-desktop .dropdown-dialog.open {\n display: flex;\n opacity: 1;\n}\n\n.dropdown-mode-desktop .dropdown-dialog.open .dropdown-options {\n opacity: 1;\n transform: translateY(0) scale(1);\n}\n\n.dropdown-mode-desktop .dropdown-dialog::backdrop {\n background: transparent;\n}\n\n/* Dialog header */\n.dropdown-mode-desktop .dropdown-header {\n display: flex;\n align-items: center;\n gap: var(--ty-spacing-2);\n position: relative;\n}\n\n.dropdown-mode-desktop .dropdown-search-input {\n width: 100%;\n min-width: 0;\n box-sizing: border-box;\n background: var(--input-bg, var(--ty-input-bg));\n color: var(--input-color, var(--ty-input-color));\n border: 1px solid var(--input-border, var(--ty-input-border));\n border-radius: var(--ty-radius-md);\n font-family: var(--ty-font-sans);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-normal);\n min-height: var(--ty-size-md);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n padding-right: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n transition: var(--ty-transition-all);\n outline: none;\n}\n\n.dropdown-mode-desktop .dropdown-search-input:focus {\n border-color: var(--input-border-focus, var(--ty-input-border-focus));\n box-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\n\n.dropdown-mode-desktop .dropdown-search-input:disabled {\n background-color: var(--input-disabled-bg, var(--ty-input-disabled-bg));\n color: var(--input-disabled-color, var(--ty-input-disabled-color));\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.dropdown-mode-desktop .dropdown-search-input::placeholder {\n color: var(--input-placeholder, var(--ty-input-placeholder));\n}\n\n/* Search input sizes */\n.dropdown-mode-desktop .dropdown-search-input.xs {\n min-height: var(--ty-size-xs);\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n letter-spacing: var(--ty-tracking-xs);\n padding: var(--ty-spacing-1) var(--ty-spacing-2);\n padding-right: calc(var(--ty-spacing-2) + 1rem + var(--ty-spacing-1));\n}\n\n.dropdown-mode-desktop .dropdown-search-input.sm {\n min-height: var(--ty-size-sm);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: var(--ty-spacing-1) var(--ty-spacing-2);\n padding-right: calc(var(--ty-spacing-2) + 1rem + var(--ty-spacing-1));\n}\n\n.dropdown-mode-desktop .dropdown-search-input.md {\n min-height: var(--ty-size-md);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n padding-right: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n}\n\n.dropdown-mode-desktop .dropdown-search-input.lg {\n min-height: var(--ty-size-lg);\n font-size: var(--ty-font-base);\n line-height: var(--ty-leading-base);\n letter-spacing: var(--ty-tracking-base);\n padding: var(--ty-spacing-3) var(--ty-spacing-4);\n padding-right: calc(var(--ty-spacing-4) + 1rem + var(--ty-spacing-3));\n}\n\n.dropdown-mode-desktop .dropdown-search-input.xl {\n min-height: var(--ty-size-xl);\n font-size: var(--ty-font-lg);\n line-height: var(--ty-leading-lg);\n letter-spacing: var(--ty-tracking-lg);\n padding: var(--ty-spacing-4) var(--ty-spacing-5);\n padding-right: calc(var(--ty-spacing-5) + 1rem + var(--ty-spacing-4));\n}\n\n.dropdown-mode-desktop .dropdown-search-chevron {\n position: absolute;\n top: 50%;\n right: var(--ty-spacing-3);\n transform: translateY(-50%);\n width: 1rem;\n height: 1rem;\n color: var(--input-placeholder, var(--ty-input-placeholder));\n transition: var(--ty-transition-transform);\n pointer-events: none;\n}\n\n.dropdown-mode-desktop .dropdown-search-chevron.open {\n transform: translateY(-50%) rotate(180deg);\n}\n\n.dropdown-mode-desktop .dropdown-search-chevron svg {\n width: 100%;\n height: 100%;\n}\n\n/* Options container */\n.dropdown-mode-desktop .dropdown-options {\n opacity: 0;\n background: var(--input-bg, var(--ty-input-bg));\n border: 1px solid var(--input-border, var(--ty-input-border));\n border-radius: var(--ty-radius-lg);\n max-height: 16rem;\n width: 100%;\n max-width: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n scroll-behavior: smooth;\n box-sizing: border-box;\n position: relative;\n box-shadow:\n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n transform: translateY(-20px) scale(0.90);\n transition:\n opacity 100ms cubic-bezier(0.16, 1, 0.3, 1),\n transform 200ms cubic-bezier(0.16, 1, 0.3, 1);\n\n}\n\n/* Hide native scrollbar only when custom scrollbar is active */\n.dropdown-mode-desktop .dropdown-options.ty-custom-scroll {\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n.dropdown-mode-desktop .dropdown-options.ty-custom-scroll::-webkit-scrollbar {\n display: none;\n}\n\n/* Options wrapper - positioned container for scrollbar track */\n.dropdown-mode-desktop .dropdown-options-wrapper {\n position: relative;\n}\n\n/* Show custom scrollbar on hover over options */\n.dropdown-mode-desktop .dropdown-options-wrapper:hover .ty-scrollbar-track-y.has-overflow {\n opacity: 1;\n}\n\n/* Option elements */\n.dropdown-mode-desktop .dropdown-options ::slotted(option) {\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n color: var(--input-color, var(--ty-input-color));\n cursor: pointer;\n transition:\n var(--ty-transition-colors),\n transform 150ms cubic-bezier(0.16, 1, 0.3, 1);\n border: none;\n background: none;\n font-size: inherit;\n font-family: inherit;\n width: 100%;\n text-align: left;\n box-sizing: border-box;\n transform: translateX(0);\n}\n\n.dropdown-mode-desktop .dropdown-options ::slotted(option:hover) {\n background-color: var(--ty-bg-neutral-soft);\n}\n\n.dropdown-mode-desktop .dropdown-options ::slotted(option[highlighted]) {\n background-color: var(--ty-bg-primary-soft);\n color: var(--ty-color-primary-mild);\n}\n\n.dropdown-mode-desktop .dropdown-options ::slotted(option[selected]) {\n background-color: var(--ty-color-primary);\n color: #ffffff;\n}\n\n.dropdown-mode-desktop .dropdown-options ::slotted(option[hidden]),\n.dropdown-mode-desktop .dropdown-options ::slotted(ty-option[hidden]),\n.dropdown-mode-desktop .dropdown-options ::slotted(ty-tag[hidden]) {\n display: none;\n}\n\n/* ==================== MOBILE MODE STYLES ==================== */\n/* All styles scoped under .dropdown-mode-mobile */\n/* Floating modal design (centered card with backdrop) */\n\n/* Stub (trigger button) - same as desktop but scoped */\n.dropdown-mode-mobile .dropdown-stub {\n width: 100%;\n cursor: pointer;\n box-sizing: border-box;\n position: relative;\n display: flex;\n align-items: center;\n background: var(--input-bg, var(--ty-input-bg));\n color: var(--input-color, var(--ty-input-color));\n border: 1px solid var(--input-border, var(--ty-input-border));\n border-radius: var(--ty-radius-md);\n font-family: var(--ty-font-sans);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-normal);\n min-height: var(--ty-size-md);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n padding-right: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n transition: var(--ty-transition-all);\n outline: none;\n}\n\n.dropdown-mode-mobile .dropdown-stub:hover {\n border-color: var(--input-border-hover, var(--ty-input-border-hover));\n}\n\n.dropdown-mode-mobile .dropdown-stub[disabled] {\n background-color: var(--input-disabled-bg, var(--ty-input-disabled-bg));\n color: var(--input-disabled-color, var(--ty-input-disabled-color));\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n/* Size variants */\n.dropdown-mode-mobile .dropdown-stub.xs {\n min-height: var(--ty-size-xs);\n font-size: var(--ty-font-xs);\n line-height: var(--ty-leading-xs);\n letter-spacing: var(--ty-tracking-xs);\n padding: var(--ty-spacing-1) var(--ty-spacing-2);\n padding-right: calc(var(--ty-spacing-2) + 1rem + var(--ty-spacing-1));\n}\n\n.dropdown-mode-mobile .dropdown-stub.sm {\n min-height: var(--ty-size-sm);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: var(--ty-spacing-1) var(--ty-spacing-2);\n padding-right: calc(var(--ty-spacing-2) + 1rem + var(--ty-spacing-1));\n}\n\n.dropdown-mode-mobile .dropdown-stub.md {\n min-height: var(--ty-size-md);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n padding-right: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n}\n\n.dropdown-mode-mobile .dropdown-stub.lg {\n min-height: var(--ty-size-lg);\n font-size: var(--ty-font-base);\n line-height: var(--ty-leading-base);\n letter-spacing: var(--ty-tracking-base);\n padding: var(--ty-spacing-3) var(--ty-spacing-4);\n padding-right: calc(var(--ty-spacing-4) + 1rem + var(--ty-spacing-3));\n}\n\n.dropdown-mode-mobile .dropdown-stub.xl {\n min-height: var(--ty-size-xl);\n font-size: var(--ty-font-lg);\n line-height: var(--ty-leading-lg);\n letter-spacing: var(--ty-tracking-lg);\n padding: var(--ty-spacing-4) var(--ty-spacing-5);\n padding-right: calc(var(--ty-spacing-5) + 1rem + var(--ty-spacing-4));\n}\n\n/* Placeholder */\n.dropdown-mode-mobile .dropdown-placeholder {\n color: var(--input-placeholder, var(--ty-input-placeholder));\n font-weight: var(--ty-font-light);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-style: italic;\n pointer-events: none;\n}\n\n.dropdown-mode-mobile .dropdown-stub.has-selection .dropdown-placeholder {\n display: none;\n}\n\n/* Selected content */\n.dropdown-mode-mobile .dropdown-stub slot[name="selected"] {\n display: block;\n}\n\n.dropdown-mode-mobile .dropdown-stub.has-selection slot[name="selected"] {\n width: 100%;\n}\n\n.dropdown-mode-mobile .dropdown-stub slot[name="selected"] * {\n display: block;\n width: 100%;\n padding: 0;\n margin: 0;\n border: none;\n background: none;\n color: inherit;\n font: inherit;\n line-height: inherit;\n outline: none;\n appearance: none;\n}\n\n/* Chevron */\n.dropdown-mode-mobile .dropdown-chevron {\n position: absolute;\n top: 50%;\n right: var(--ty-spacing-3);\n transform: translateY(-50%);\n width: 1rem;\n height: 1rem;\n color: var(--input-placeholder, var(--ty-input-placeholder));\n transition: var(--ty-transition-transform);\n pointer-events: none;\n}\n\n.dropdown-mode-mobile .dropdown-chevron svg {\n width: 100%;\n height: 100%;\n}\n\n/* Mobile dialog - full screen overlay with centered floating card */\n.dropdown-mode-mobile .mobile-dialog {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100vw;\n height: 100vh;\n max-width: 100vw;\n max-height: 100vh;\n margin: 0;\n padding: 0;\n padding-top: 10vh;\n border: none;\n background: transparent;\n align-items: flex-start;\n justify-content: center;\n opacity: 0;\n transition: opacity 300ms ease;\n}\n\n/* When opened via showModal(), add flex layout */\n.dropdown-mode-mobile .mobile-dialog[open] {\n display: flex;\n}\n\n.dropdown-mode-mobile .mobile-dialog.open {\n opacity: 1;\n}\n\n/* Native dialog backdrop with blur */\n.dropdown-mode-mobile .mobile-dialog::backdrop {\n background: rgba(0, 0, 0, 0.5);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n}\n\n/* Mobile content container - floating card */\n.dropdown-mode-mobile .mobile-dialog-content {\n position: relative;\n display: flex;\n flex-direction: column;\n width: calc(100% - 32px);\n max-width: 400px;\n min-height: 200px;\n max-height: calc(90vh - 10vh);\n opacity: 0;\n transform: scale(0.95);\n transition:\n opacity 300ms cubic-bezier(0.16, 1, 0.3, 1),\n transform 300ms cubic-bezier(0.16, 1, 0.3, 1);\n}\n\n.dropdown-mode-mobile .mobile-dialog.open .mobile-dialog-content {\n opacity: 1;\n transform: scale(1);\n}\n\n/* Mobile search header - label floats above, search + close below */\n.dropdown-mode-mobile .mobile-search-header {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n margin-bottom: 16px;\n padding: 0;\n background: transparent;\n position: relative;\n}\n\n.dropdown-mode-mobile .mobile-header-content {\n display: flex;\n align-items: center;\n gap: 12px;\n width: 100%;\n}\n\n/* Header for non-searchable (label + close button) */\n.dropdown-mode-mobile .mobile-header-nosearch {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n margin-bottom: 16px;\n padding: 0;\n background: transparent;\n position: relative;\n min-height: 40px;\n}\n\n.dropdown-mode-mobile .mobile-header-label {\n position: absolute;\n bottom: 100%;\n left: 6px;\n margin-bottom: 4px;\n font-size: var(--ty-font-lg);\n line-height: var(--ty-leading-lg);\n letter-spacing: var(--ty-tracking-lg);\n font-weight: 700;\n color: var(--ty-color-neutral);\n pointer-events: none;\n}\n\n/* Close button - circular with border */\n.dropdown-mode-mobile .mobile-close-button {\n flex-shrink: 0;\n width: 36px;\n height: 36px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--ty-surface-floating);\n border: 2px solid var(--mobile-border-color);\n border-radius: 50%;\n color: var(--ty-text-strong);\n cursor: pointer;\n transition: var(--ty-transition-all);\n padding: 0;\n}\n\n.dropdown-mode-mobile .mobile-close-button:hover {\n background: var(--ty-bg-neutral);\n border-color: var(--ty-border);\n color: var(--ty-text-strong);\n}\n\n.dropdown-mode-mobile .mobile-close-button:active {\n transform: scale(0.9);\n}\n\n.dropdown-mode-mobile .mobile-close-button svg {\n width: 24px;\n height: 24px;\n}\n\n/* Mobile search input */\n.dropdown-mode-mobile .mobile-search-input {\n flex: 1;\n min-width: 0;\n box-sizing: border-box;\n background: var(--ty-surface-floating);\n color: var(--ty-text);\n border: 1px solid var(--ty-border-soft);\n border-radius: var(--ty-radius-md);\n font-family: var(--ty-font-sans);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-normal);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n height: 40px;\n transition: var(--ty-transition-all);\n outline: none;\n border: 2px solid;\n border-color: var(--mobile-border-color);\n}\n\n.dropdown-mode-mobile .mobile-search-input::placeholder {\n color: var(--ty-text-faint);\n}\n\n/* Mobile options container - floating card with elevation */\n.dropdown-mode-mobile .mobile-options-container {\n position: relative;\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n -webkit-overflow-scrolling: touch;\n background: var(--ty-surface-floating); /* Floating card background */\n border-radius: var(--ty-radius-lg);\n border: 1px solid var(--ty-border-soft);\n box-shadow: \n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n border: 2px solid;\n border-color: var(--mobile-border-color);\n}\n\n/* Hide scrollbar but keep functionality */\n.dropdown-mode-mobile .mobile-options-container {\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE/Edge */\n}\n\n.dropdown-mode-mobile .mobile-options-container::-webkit-scrollbar {\n display: none; /* Chrome, Safari, Opera */\n}\n\n/* Mobile option styling - native <option> only */\n.dropdown-mode-mobile .mobile-options-container ::slotted(option) {\n display: block;\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n margin: 2px 8px;\n color: var(--ty-text);\n cursor: pointer;\n transition: var(--ty-transition-all);\n border: none;\n background: transparent;\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-family: inherit;\n width: calc(100% - 16px);\n text-align: left;\n box-sizing: border-box;\n border-radius: var(--ty-radius-sm);\n min-height: 36px;\n}\n\n.dropdown-mode-mobile .mobile-options-container ::slotted(option:active) {\n background-color: var(--ty-bg-neutral-soft);\n}\n\n.dropdown-mode-mobile .mobile-options-container ::slotted(option[highlighted]) {\n background-color: var(--ty-bg-primary-soft);\n color: var(--ty-color-primary-mild);\n}\n\n.dropdown-mode-mobile .mobile-options-container ::slotted(option[selected]) {\n background: var(--ty-bg-primary);\n color: var(--ty-color-primary-strong);\n}\n\n.dropdown-mode-mobile .mobile-options-container ::slotted(option[hidden]),\n.dropdown-mode-mobile .mobile-options-container ::slotted(ty-option[hidden]),\n.dropdown-mode-mobile .mobile-options-container ::slotted(ty-tag[hidden]) {\n display: none;\n}\n\n/* ==================== FLAVOR VARIANTS ==================== */\n/* Apply to both modes */\n\n:host([flavor="primary"]) .dropdown-stub,\n:host([flavor="primary"]) .dropdown-search-input {\n border-color: var(--ty-color-primary);\n}\n\n:host([flavor="primary"]) .dropdown-stub:hover,\n:host([flavor="primary"]) .dropdown-search-input:focus {\n border-color: var(--ty-color-primary-mild);\n box-shadow: 0 0 0 3px var(--ty-color-primary-faint);\n}\n\n:host([flavor="secondary"]) .dropdown-stub,\n:host([flavor="secondary"]) .dropdown-search-input {\n border-color: var(--ty-color-secondary);\n}\n\n:host([flavor="secondary"]) .dropdown-stub:hover,\n:host([flavor="secondary"]) .dropdown-search-input:focus {\n border-color: var(--ty-color-secondary-mild);\n box-shadow: 0 0 0 3px var(--ty-color-secondary-faint);\n}\n\n:host([flavor="success"]) .dropdown-stub,\n:host([flavor="success"]) .dropdown-search-input {\n border-color: var(--ty-color-success);\n}\n\n:host([flavor="success"]) .dropdown-stub:hover,\n:host([flavor="success"]) .dropdown-search-input:focus {\n border-color: var(--ty-color-success-mild);\n box-shadow: 0 0 0 3px var(--ty-color-success-faint);\n}\n\n:host([flavor="danger"]) .dropdown-stub,\n:host([flavor="danger"]) .dropdown-search-input {\n border-color: var(--ty-color-danger);\n}\n\n:host([flavor="danger"]) .dropdown-stub:hover,\n:host([flavor="danger"]) .dropdown-search-input:focus {\n border-color: var(--ty-color-danger-mild);\n box-shadow: 0 0 0 3px var(--ty-color-danger-faint);\n}\n\n:host([flavor="warning"]) .dropdown-stub,\n:host([flavor="warning"]) .dropdown-search-input {\n border-color: var(--ty-color-warning);\n}\n\n:host([flavor="warning"]) .dropdown-stub:hover,\n:host([flavor="warning"]) .dropdown-search-input:focus {\n border-color: var(--ty-color-warning-mild);\n box-shadow: 0 0 0 3px var(--ty-color-warning-faint);\n}\n\n/* ==================== READONLY STATE ==================== */\n\n:host([readonly]) .dropdown-chevron {\n display: none;\n}\n\n:host([readonly]) .dropdown-stub {\n padding-right: var(--ty-spacing-3);\n}\n\n:host([readonly]) .dropdown-stub,\n:host([readonly]) .dropdown-stub slot[name="selected"] {\n cursor: initial;\n}\n\n/* ==================== LOADING STATE ====================\n Spinner overlay shown inside the popup options area while\n the parent (external-search mode) is fetching results.\n Search input stays usable so users can keep refining.\n\n Carries its own surface (background + radius + subtle border)\n so it stays visible even when the host has restyled the popup\n with a transparent or unusual background.\n Override with --ty-loader-bg / --ty-loader-radius / --ty-loader-border\n on the host element.\n*/\n.dropdown-loading {\n display: none;\n align-items: center;\n justify-content: center;\n gap: var(--ty-spacing-2);\n padding: var(--ty-spacing-4) var(--ty-spacing-3);\n color: var(--ty-text-);\n font-size: var(--ty-font-sm);\n min-height: 4rem;\n background: var(--ty-loader-bg, var(--ty-surface-floating));\n border: 1px solid var(--ty-loader-border, var(--ty-border-soft));\n border-radius: var(--ty-loader-radius, var(--ty-radius-base));\n box-sizing: border-box;\n}\n\n.dropdown-options-wrapper.loading .dropdown-loading {\n display: flex;\n}\n\n.dropdown-options-wrapper.loading .dropdown-options,\n.dropdown-options-wrapper.loading > slot#options-slot {\n display: none;\n}\n\n.dropdown-loading-spinner {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 1.125rem;\n height: 1.125rem;\n flex-shrink: 0;\n animation: ty-dropdown-spin 0.7s linear infinite;\n color: var(--ty-color-primary);\n}\n\n.dropdown-loading-spinner svg {\n width: 100%;\n height: 100%;\n}\n\n.dropdown-loading-text {\n color: var(--ty-text-);\n}\n\n@keyframes ty-dropdown-spin {\n to { transform: rotate(360deg); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .dropdown-loading-spinner {\n animation-duration: 1.6s;\n }\n}\n\n/* Custom scrollbar styles */\n${yn}\n`;let St=0;const Et=new WeakMap,Tt='<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-asterisk"><path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/></svg>',Mt='<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>',Dt=class extends o{constructor(){super(),this.N="",this.nt="Select an option...",this.tt="",this.R=!1,this.et=!1,this.ot=!1,this.it=!1,this.rt=!0,this.st=!1,this.lt="md",this.dt={open:!1,search:"",highlightedIndex:-1,filteredOptions:[],currentValue:null,mode:"desktop"},this.ct=null,this.ht=null,this.ut=null,this.gt=null,this.bt=null,this.vt=null,this.yt=null,this.ft=null,this.wt=0,this.xt=null,this.kt=null,r(this.shadowRoot,{css:Ct,id:"ty-dropdown"})}render(){this.dt.mode=B()?"mobile":"desktop","mobile"===this.dt.mode?this.renderMobile():this.renderDesktop(),this.applyLoadingState()}onConnect(){this.initializeState()}onDisconnect(){const n=this.tyOutsideClickHandler;n&&(document.removeEventListener("click",n),this.tyOutsideClickHandler=null),null!==this.xt&&(clearTimeout(this.xt),this.xt=null),this.zt()}onPropertiesChanged(n){for(const{name:t,newValue:e}of n)switch(t){case"value":this.N=e||"",this.dt.currentValue=e||null,this.syncSelectedOption();break;case"placeholder":this.nt=e||"Select an option...",this.updatePlaceholderInDOM();break;case"label":this.tt=e||"";break;case"disabled":this.R=e;break;case"readonly":this.et=e;break;case"required":this.ot=e;break;case"externalSearch":this.it=e;break;case"clearable":this.rt=e,this.updateClearButton();break;case"size":this.lt=e;break;case"debounce":this.wt=e;break;case"loading":this.st=e,this.applyLoadingState()}}applyLoadingState(){const n=this.shadowRoot;if(!n)return;const t=this.st?l():null;n.querySelectorAll(".dropdown-options-wrapper").forEach(n=>{if(n.classList.toggle("loading",this.st),this.st){n.setAttribute("aria-busy","true");const e=n.querySelector(".dropdown-loading-spinner");e&&t&&(e.innerHTML=t)}else n.removeAttribute("aria-busy")})}getFormValue(){return this.dt.currentValue||null}parseValue(n){return n&&"string"==typeof n&&""!==n.trim()?n.trim():null}initializeState(){this.N&&(this.dt.currentValue=this.parseValue(this.N),requestAnimationFrame(()=>{this.syncSelectedOption()})),this.addEventListener("clear-selection",n=>{n.stopPropagation(),this.clearSelection(),this.dt.currentValue=null,this.updateComponentValue(),this.updateSelectionDisplay(),this.dispatchEvent(new CustomEvent("change",{detail:{value:null,text:"",option:null,originalEvent:n},bubbles:!0,composed:!0})),this.dt.open&&"mobile"===this.dt.mode&&this.closeMobileModal()}),this.render()}updatePlaceholderInDOM(){const n=this.shadowRoot,t=n.querySelector(".dropdown-placeholder");t&&(t.textContent=this.nt);const e=n.querySelector(".dropdown-search-input");e&&(e.placeholder=this.nt);const o=n.querySelector(".mobile-search-input");o&&(o.placeholder=this.nt)}getOptions(){const n=this.shadowRoot.querySelector("slot:not([name])");return n?(n.assignedElements?n.assignedElements():[]).filter(n=>{const t=n.tagName;return"OPTION"===t||"TY-OPTION"===t||"TY-TAG"===t}):[]}getOptionData(n){const t=n.tagName;return"OPTION"===t||"TY-OPTION"===t?{value:n.value||n.textContent||"",text:n.textContent||"",element:n}:"TY-TAG"===t?{value:n.getAttribute("value")||n.textContent||"",text:n.textContent||"",element:n}:{value:n.textContent||"",text:n.textContent||"",element:n}}clearSelection(){const n=this.shadowRoot;this.getOptions().forEach(n=>n.removeAttribute("selected"));const t=n.querySelector('slot[name="selected"]');if(t){const n=t.assignedElements?t.assignedElements():[];Array.from(n).filter(n=>n.hasAttribute("cloned")).forEach(n=>n.remove())}}selectOption(n,t){const e=this.getOptionData(n),o=!e.value||""===e.value.trim();if(this.clearSelection(),o)this.dt.currentValue=null;else{const t=n.cloneNode(!0);t.setAttribute("slot","selected"),t.setAttribute("cloned","true"),n.parentNode.appendChild(t),n.setAttribute("selected",""),this.dt.currentValue=e.value}this.updateComponentValue(),this.updateSelectionDisplay(),this.dispatchChangeEvent(n,t)}syncSelectedOption(){const n=this.getOptions(),t=this.dt.currentValue;if(!t)return void this.clearSelection();const e=n.find(n=>this.getOptionData(n).value===t);e&&this.selectOption(e)}updateComponentValue(){const n=this.dt.currentValue;null!==n?this.setAttribute("value",n):this.removeAttribute("value"),this.N=n||""}updateSelectionDisplay(){const n=this.shadowRoot.querySelector(".dropdown-stub");n&&(this.getOptions().some(n=>n.hasAttribute("selected"))?n.classList.add("has-selection"):n.classList.remove("has-selection"),this.updateClearButton())}updateClearButton(){const n=this.shadowRoot.querySelector(".dropdown-clear-btn");n&&(n.style.display=!this.rt||null===this.dt.currentValue||""===this.dt.currentValue||this.R||this.et||this.dt.open||"mobile"===this.dt.mode?"none":"block")}dispatchChangeEvent(n,t){const e=this.getOptionData(n);this.dispatchEvent(new CustomEvent("change",{detail:{value:this.dt.currentValue,text:e.text,option:n,originalEvent:t||null},bubbles:!0,composed:!0}))}filterOptions(n,t){if(!t||""===t.trim())return n;const e=t.toLowerCase();return n.filter(({text:n})=>n.toLowerCase().includes(e))}updateOptionVisibility(n,t){const e=new Set(n.map(n=>n.value));t.forEach(({value:n,element:t})=>{e.has(n)?t.removeAttribute("hidden"):t.setAttribute("hidden","")})}clearHighlights(n){n.forEach(({element:n})=>{n.removeAttribute("highlighted")})}highlightOption(n,t){if(this.clearHighlights(n),t>=0&&n.length>t){const{element:e}=n[t];e.setAttribute("highlighted",""),e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}setupDesktopEventListeners(){const n=this.shadowRoot,t=n.querySelector(".dropdown-stub"),e=n.querySelector("#options-slot"),o=n.querySelector(".dropdown-search-input");t&&(this.ht=this.handleDesktopStubClick.bind(this),t.addEventListener("click",this.ht)),e&&(this.gt=this.handleDesktopOptionClick.bind(this),e.addEventListener("click",this.gt)),o&&(this.bt=this.handleSearchInput.bind(this),this.vt=this.blockSearchClick.bind(this),o.addEventListener("input",this.bt),o.addEventListener("click",this.vt));const i=n.querySelector(".dropdown-clear-btn");i&&(this.ft=this.handleDesktopClearClick.bind(this),i.addEventListener("click",this.ft)),this.ut=this.handleDesktopOutsideClick.bind(this),this.yt=this.handleDesktopKeyboard.bind(this),document.addEventListener("click",this.ut),document.addEventListener("keydown",this.yt)}lockDropdownScroll(){const n=`dropdown-${this.id||"anon"}-${function(n){let t=Et.get(n);return void 0===t&&(t=++St,Et.set(n,t)),t}(this)}`;this.ct=n,Un(n)}unlockDropdownScroll(){this.ct&&(Gn(this.ct),this.ct=null)}initializeOptionsState(n=!1){const t=this.getOptions().map(n=>this.getOptionData(n)),e=this.dt.currentValue;if(this.dt.filteredOptions=t,n&&e){const n=t.findIndex(n=>n.value===e);this.dt.highlightedIndex=n,0>n||this.highlightOption(t,n)}else this.dt.highlightedIndex=-1}handleStubClickBase(n,t){n.preventDefault(),n.stopPropagation(),this.R||this.et||t()}handleOptionClickBase(n,t){n.preventDefault(),n.stopPropagation();const e=n.target.closest("option, ty-option, ty-tag");e&&(this.selectOption(e,n),this.updateSelectionDisplay(),t())}handleClearClickBase(n,t){n.preventDefault(),n.stopPropagation(),this.clearSelection(),this.dt.currentValue=null,this.updateComponentValue(),this.updateSelectionDisplay(),this.dispatchEvent(new CustomEvent("change",{detail:{value:null,text:"",option:null,originalEvent:n},bubbles:!0,composed:!0})),t&&t()}calculateDesktopPosition(){const n=this.shadowRoot,t=n.querySelector(".dropdown-stub"),e=n.querySelector(".dropdown-dialog");if(!t||!e)return;const o=t.getBoundingClientRect(),i=window.innerHeight,r=window.innerWidth,s=e.getBoundingClientRect(),a=i-o.bottom>=(s.height||200)+8,l=a?o.top-20:i-o.bottom-20,d=o.width+20+20;this.style.setProperty("--dropdown-x",(o.width>r-o.left?Math.max(8,r-o.width-8):o.left-20)+"px"),this.style.setProperty("--dropdown-y",l+"px"),this.style.setProperty("--dropdown-width",d+"px"),this.style.setProperty("--dropdown-offset-x","0px"),this.style.setProperty("--dropdown-offset-y","0px"),this.style.setProperty("--dropdown-padding","20px"),a?(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",a?"below":"above")}openDesktopDropdown(){const n=this.shadowRoot,t=n.querySelector(".dropdown-dialog");if(!t)return;this.lockDropdownScroll(),t.showModal(),t.classList.add("open"),this.calculateDesktopPosition(),this.dt.open=!0;const e=n.querySelector(".dropdown-chevron");e&&e.classList.add("open");const o=n.querySelector(".dropdown-search-chevron");o&&o.classList.add("open"),this.initializeOptionsState(!0);const i=n.querySelector(".dropdown-search-input");i&&setTimeout(()=>i.focus(),100),this.Ct(),this.updateClearButton()}closeDesktopDropdown(){const n=this.shadowRoot,t=n.querySelector(".dropdown-dialog");if(!t)return;this.unlockDropdownScroll(),this.zt(),t.classList.remove("open"),t.classList.remove("position-above"),t.classList.remove("position-below"),t.close(),this.dt.open=!1,this.dt.highlightedIndex=-1;const e=n.querySelector(".dropdown-chevron");e&&e.classList.remove("open");const o=n.querySelector(".dropdown-search-chevron");o&&o.classList.remove("open"),this.it&&(this.dt.search=""),this.updateClearButton()}handleDesktopOutsideClick(n){if(!this.dt.open)return;const t=n.target,e=this.shadowRoot.querySelector(".dropdown-wrapper");e&&e.contains(t)||this.closeDesktopDropdown()}handleSearchInput(n){const t=n.target.value;if(this.dt.search=t,this.it)this.dispatchSearchEvent(t,n);else{const n=this.getOptions().map(n=>this.getOptionData(n)),e=this.filterOptions(n,t);this.dt.filteredOptions=e,this.dt.highlightedIndex=-1,this.updateOptionVisibility(e,n),this.clearHighlights(n)}}blockSearchClick(n){n.stopPropagation(),n.preventDefault()}dispatchSearchEvent(n,t){null!==this.xt&&(clearTimeout(this.xt),this.xt=null),this.wt>0?this.xt=window.setTimeout(()=>{this.fireSearchEvent(n,t),this.xt=null},this.wt):this.fireSearchEvent(n,t)}fireSearchEvent(n,t){this.dispatchEvent(new CustomEvent("search",{detail:{query:n,originalEvent:t||null},bubbles:!0,composed:!0}))}handleDesktopKeyboard(n){if(!this.dt.open)return;const t=this.shadowRoot.querySelector(".dropdown-search-input");if(n.target!==t&&document.activeElement===t)return;const e=this.dt.filteredOptions,o=e.length,i=this.dt.highlightedIndex;switch(n.key){case"Escape":n.preventDefault(),n.stopPropagation(),this.closeDesktopDropdown();break;case"Enter":n.preventDefault(),n.stopPropagation(),i>=0&&o>i&&(this.selectOption(e[i].element,n),this.updateSelectionDisplay(),this.closeDesktopDropdown());break;case"ArrowUp":let t;n.preventDefault(),n.stopPropagation(),t=0===o?-1:-1===i||0===i?o-1:i-1,this.dt.highlightedIndex=t,this.highlightOption(e,t);break;case"ArrowDown":let r;n.preventDefault(),n.stopPropagation(),r=0===o?-1:-1===i||i===o-1?0:i+1,this.dt.highlightedIndex=r,this.highlightOption(e,r)}}handleDesktopStubClick(n){this.handleStubClickBase(n,()=>this.openDesktopDropdown())}handleDesktopOptionClick(n){this.handleOptionClickBase(n,()=>this.closeDesktopDropdown())}handleDesktopClearClick(n){this.handleClearClickBase(n)}Ct(){if(!vn())return;const n=this.shadowRoot,t=n.querySelector(".dropdown-options"),e=n.querySelector(".dropdown-options-wrapper");t&&e&&(this.zt(),t.classList.add("ty-custom-scroll"),this.kt=new mn(t,{vertical:!0}),this.kt.trackY&&e.appendChild(this.kt.trackY))}zt(){this.kt&&(this.kt.trackY?.remove(),this.kt.destroy(),this.kt=null)}buildStubClasses(){const n=[this.lt];return this.R&&n.push("disabled"),this.rt&&n.push("clearable"),n.join(" ")}renderDesktop(){const n=this.shadowRoot;if(!n.querySelector(".dropdown-container")){const t=this.buildStubClasses();n.innerHTML=`\n <div class="dropdown-container dropdown-mode-desktop">\n ${this.tt?`\n <label class="dropdown-label">\n ${this.tt}\n ${this.ot?`<span class="required-icon">${Tt}</span>`:""}\n </label>\n `:""}\n <div class="dropdown-wrapper">\n <div class="dropdown-stub ${t}"\n ${this.R?"disabled":""}>\n <slot name="start"></slot>\n <slot name="selected"></slot>\n <span class="dropdown-placeholder">${this.nt}</span>\n <button class="dropdown-clear-btn" type="button" aria-label="Clear selection">\n <svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M6 6L14 14M14 6L6 14" stroke-linecap="round" />\n</svg>\n </button>\n <div class="dropdown-chevron">\n ${Mt}\n </div>\n </div>\n <dialog class="dropdown-dialog">\n <div class="dropdown-header">\n <input \n class="dropdown-search-input ${this.lt}" \n type="text"\n placeholder="${this.nt}"\n ${this.R?"disabled":""}\n />\n <div class="dropdown-search-chevron">\n ${Mt}\n </div>\n </div>\n <div class="dropdown-options-wrapper">\n <div class="dropdown-options">\n <slot id="options-slot"></slot>\n </div>\n <div class="dropdown-loading" aria-hidden="true">\n <span class="dropdown-loading-spinner"></span>\n <span class="dropdown-loading-text">Searching…</span>\n </div>\n </div>\n </dialog>\n </div>\n </div>\n `,this.setupDesktopEventListeners()}const t=n.querySelector(".dropdown-label"),e=n.querySelector(".dropdown-container"),o=n.querySelector(".dropdown-wrapper");if(this.tt){if(t)t.innerHTML=this.tt+(this.ot?'<span class="required-icon">'+Tt+"</span>":""),t.style.display="flex";else if(e&&o){const n=document.createElement("label");n.className="dropdown-label",n.innerHTML=this.tt+(this.ot?'<span class="required-icon">'+Tt+"</span>":""),e.insertBefore(n,o)}}else t&&(t.style.display="none");this.updateSelectionDisplay()}renderMobile(){const n=this.shadowRoot;if(!n.querySelector(".dropdown-container")){const t=this.buildStubClasses();n.innerHTML=`\n <div class="dropdown-container dropdown-mode-mobile">\n ${this.tt?`\n <label class="dropdown-label">\n ${this.tt}\n ${this.ot?`<span class="required-icon">${Tt}</span>`:""}\n </label>\n `:""}\n <div class="dropdown-wrapper">\n <div class="dropdown-stub ${t}"\n ${this.R?"disabled":""}>\n <slot name="start"></slot>\n <slot name="selected"></slot>\n <span class="dropdown-placeholder">${this.nt}</span>\n <div class="dropdown-chevron">\n ${Mt}\n </div>\n </div>\n <dialog class="mobile-dialog">\n <div class="mobile-dialog-content">\n \n <div class="mobile-search-header">\n ${this.tt?`<span class="mobile-header-label">${this.tt}</span>`:""}\n <div class="mobile-header-content">\n <input\n class="mobile-search-input ${this.lt}"\n type="text"\n placeholder="${this.tt?`Search ${this.tt}...`:"Search..."}"\n ${this.R?"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 <div class="mobile-options-container dropdown-options-wrapper">\n <slot id="options-slot"></slot>\n <div class="dropdown-loading" aria-hidden="true">\n <span class="dropdown-loading-spinner"></span>\n <span class="dropdown-loading-text">Searching…</span>\n </div>\n </div>\n </div>\n </dialog>\n </div>\n </div>\n `,this.setupMobileEventListeners()}this.updateSelectionDisplay()}setupMobileEventListeners(){const n=this.shadowRoot,t=n.querySelector(".dropdown-stub"),e=n.querySelector("#options-slot"),o=n.querySelector(".mobile-search-input"),i=n.querySelector(".mobile-close-button"),r=n.querySelector(".mobile-dialog");t&&t.addEventListener("click",n=>this.handleMobileStubClick(n)),e&&e.addEventListener("click",n=>this.handleMobileOptionClick(n)),o&&o.addEventListener("input",n=>this.handleSearchInput(n)),i&&i.addEventListener("click",()=>this.closeMobileModal()),e&&e.addEventListener("clear-selection",n=>{n.preventDefault(),n.stopPropagation(),this.handleMobileClearClick(n)}),r&&(r.addEventListener("click",n=>{n.target===r&&this.closeMobileModal()}),r.addEventListener("cancel",n=>{n.preventDefault(),this.closeMobileModal()}))}handleMobileStubClick(n){this.handleStubClickBase(n,()=>this.openMobileModal())}handleMobileOptionClick(n){this.handleOptionClickBase(n,()=>this.closeMobileModal())}handleMobileClearClick(n){this.handleClearClickBase(n,()=>this.closeMobileModal())}openMobileModal(){const n=this.shadowRoot,t=n.querySelector(".mobile-dialog");if(!t)return;this.lockDropdownScroll(),t.showModal(),requestAnimationFrame(()=>{t.classList.add("open")}),this.dt.open=!0,this.initializeOptionsState(!1);const e=n.querySelector(".mobile-search-input");e&&setTimeout(()=>e.focus(),300),this.updateClearButton()}closeMobileModal(){const n=this.shadowRoot,t=n.querySelector(".mobile-dialog");if(!t)return;this.unlockDropdownScroll(),t.classList.remove("open"),t.close(),this.dt.open=!1,this.dt.highlightedIndex=-1,this.dt.search="",this.dt.filteredOptions=[];const e=n.querySelector(".mobile-search-input");e&&(e.value=""),this.it||this.getOptions().map(n=>this.getOptionData(n)).forEach(({element:n})=>n.removeAttribute("hidden")),this.updateClearButton()}get value(){return this.getProperty("value")}set value(n){this.setProperty("value",n)}get name(){return this.getProperty("name")}set name(n){this.setProperty("name",n)}get placeholder(){return this.getProperty("placeholder")}set placeholder(n){this.setProperty("placeholder",n)}get label(){return this.getProperty("label")}set label(n){this.setProperty("label",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}get readonly(){return this.getProperty("readonly")}set readonly(n){this.setProperty("readonly",n)}get required(){return this.getProperty("required")}set required(n){this.setProperty("required",n)}get externalSearch(){return this.getProperty("externalSearch")}set externalSearch(n){this.setProperty("externalSearch",n)}get clearable(){return this.getProperty("clearable")}set clearable(n){this.setProperty("clearable",n)}get loading(){return this.getProperty("loading")}set loading(n){this.setProperty("loading",n)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get flavor(){return this.getProperty("flavor")}set flavor(n){this.setProperty("flavor",n)}get debounce(){return this.getProperty("debounce")}set debounce(n){this.setProperty("debounce",n)}get form(){return this.m.form}};Dt.properties={value:{type:"string",visual:!0,formValue:!0,emitChange:!0,default:""},name:{type:"string",default:""},placeholder:{type:"string",visual:!0,default:"Select an option..."},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},externalSearch:{type:"boolean",visual:!0,default:!1,aliases:{"external-search":!0}},clearable:{type:"boolean",visual:!0,default:!0,aliases:{"not-clearable":!1}},size:{type:"string",visual:!0,default:"md",validate:n=>["xs","sm","md","lg","xl"].includes(n),coerce:n=>["xs","sm","md","lg","xl"].includes(n)?n:"md"},flavor:{type:"string",visual:!0,default:"neutral",validate:n=>["primary","secondary","success","danger","warning","neutral"].includes(n),coerce:n=>["primary","secondary","success","danger","warning","neutral"].includes(n)?n:"neutral"},debounce:{type:"number",default:0,validate:n=>n>=0&&5e3>=n,coerce:n=>{const t=+n;return isNaN(t)?0:Math.max(0,Math.min(5e3,t))}},loading:{type:"boolean",visual:!0,default:!1}};let $t=Dt;customElements.get("ty-dropdown")||customElements.define("ty-dropdown",$t);const At=`\n/* Multiselect-specific styles extending dropdown base styles */\n\n:host {\n --mobile-border-color: var(--ty-border, #5858587d);\n}\n\n/* ===== DIALOG POSITIONING SUPPORT ===== */\n\n.dropdown-dialog {\n position: fixed;\n width: var(--dropdown-width, 200px);\n max-width: 100vw;\n margin: 0;\n padding: 0;\n border: none;\n background: transparent;\n box-sizing: border-box;\n padding: var(--dropdown-padding, 20px);\n /* Modal handles z-index automatically */\n\n /* Hidden by default */\n opacity: 0;\n transition: opacity 400ms ease;\n\n transform: translate(var(--dropdown-offset-x, 0px), var(--dropdown-offset-y, 0px));\n top: -1000px;\n left: -1000px;\n}\n\n/* When opened via showModal(), apply flex layout and direction */\n.dropdown-dialog[open] {\n display: flex;\n flex-direction: column;\n}\n\n/* Direction-based positioning with CSS classes */\n.dropdown-dialog.position-below {\n left: var(--dropdown-x);\n top: var(--dropdown-y);\n}\n\n.dropdown-dialog.position-above {\n left: var(--dropdown-x);\n bottom: var(--dropdown-y);\n top: auto;\n flex-direction: column-reverse;\n}\n\n.dropdown-dialog.position-above .dropdown-header {\n margin-top: 4px;\n}\n\n.dropdown-dialog.position-below .dropdown-header {\n margin-bottom: 4px;\n}\n\n.dropdown-dialog.position-below .dropdown-options {\n /* Optional: Add upward-pointing shadow for below positioning */\n box-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\n/* Animate when .open class is added */\n.dropdown-dialog.open {\n opacity: 1;\n}\n\n.dropdown-dialog.open .dropdown-options {\n opacity: 1;\n transform: translateY(0) scale(1);\n}\n\n.dropdown-dialog::backdrop {\n background: transparent;\n}\n\n/* ===== DIALOG HEADER ===== */\n\n.dropdown-header {\n display: flex;\n align-items: center;\n gap: var(--ty-spacing-2);\n position: relative;\n}\n\n.dropdown-search-input {\n width: 100%;\n min-width: 0;\n box-sizing: border-box;\n background: var(--input-bg, var(--ty-input-bg));\n color: var(--input-color, var(--ty-input-color));\n border: 1px solid var(--input-border, var(--ty-input-border));\n border-radius: var(--ty-radius-md);\n font-family: var(--ty-font-sans);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-normal);\n min-height: var(--ty-size-md);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n padding-right: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n transition: var(--ty-transition-all);\n outline: none;\n}\n\n.dropdown-search-input:focus {\n border-color: var(--input-border-focus, var(--ty-input-border-focus));\n box-shadow: 0 0 0 3px var(--input-shadow-focus, var(--ty-input-shadow-focus));\n}\n\n.dropdown-search-input:disabled {\n background-color: var(--input-disabled-bg, var(--ty-input-disabled-bg));\n color: var(--input-disabled-color, var(--ty-input-disabled-color));\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.dropdown-search-input::placeholder {\n color: var(--input-placeholder, var(--ty-input-placeholder));\n}\n\n.dropdown-search-chevron {\n position: absolute;\n top: 50%;\n right: var(--ty-spacing-3);\n transform: translateY(-50%);\n width: 1rem;\n height: 1rem;\n color: var(--input-placeholder, var(--ty-input-placeholder));\n transition: var(--ty-transition-transform);\n pointer-events: none;\n}\n\n.dropdown-search-chevron.open {\n transform: translateY(-50%) rotate(180deg);\n}\n\n.dropdown-search-chevron svg {\n width: 100%;\n height: 100%;\n}\n\n/* ===== MULTISELECT-SPECIFIC STYLES ===== */\n\n/* Multiselect stub modifications */\n.multiselect-stub {\n min-height: 2.5rem;\n display: flex;\n flex-wrap: wrap;\n gap: 0.25rem;\n align-items: center;\n padding: 0.5rem 2.5rem 0.5rem 0.75rem;\n /* Transitions - includes opacity for open state */\n transition: var(--ty-transition-all), opacity 0.2s ease;\n outline: none;\n background: var(--input-bg, var(--ty-input-bg));\n color: var(--input-color, var(--ty-input-color));\n border: 1px solid var(--input-border, var(--ty-input-border));\n border-radius: var(--ty-radius-md);\n font-family: var(--ty-font-sans);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n cursor: pointer;\n position: relative;\n width: 100%;\n box-sizing: border-box;\n}\n\n.multiselect-stub:hover {\n border-color: var(--input-border-hover, var(--ty-input-border-hover));\n}\n\n.multiselect-stub[disabled] {\n background-color: var(--input-disabled-bg, var(--ty-input-disabled-bg));\n color: var(--input-disabled-color, var(--ty-input-disabled-color));\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n/* Hide stub when dropdown is open */\n.dropdown-wrapper:has(.dropdown-chevron.open) .multiselect-stub {\n opacity: 0;\n pointer-events: none;\n}\n\n/* Hide stub chips when mobile dialog is open (let modal show them) */\n.dropdown-mode-mobile .dropdown-wrapper:has(.mobile-dialog[open]) .multiselect-chips {\n display: none;\n}\n\n/* When tags are present, reduce padding to make room */\n.multiselect-stub.has-tags {\n padding: 0.25rem 2.5rem 0.25rem 0.5rem;\n width: 100%;\n}\n\n.multiselect-stub.has-tags slot[name="selected"] {\n display: flex;\n flex-wrap: wrap;\n gap: 0.25rem;\n}\n\n/* ===== CHEVRON INDICATOR ===== */\n\n.dropdown-chevron {\n position: absolute;\n top: 50%;\n right: var(--ty-spacing-3);\n transform: translateY(-50%);\n width: 1rem;\n height: 1rem;\n color: var(--input-placeholder, var(--ty-input-placeholder));\n transition: var(--ty-transition-transform);\n pointer-events: none;\n}\n\n.dropdown-chevron.open {\n transform: translateY(-50%) rotate(180deg);\n}\n\n.dropdown-chevron svg {\n width: 100%;\n height: 100%;\n}\n\n\n/* Tags container */\n.multiselect-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n align-items: center;\n min-width: 0;\n}\n\n.dropdown-placeholder {\n flex-grow: 1;\n color: var(--input-placeholder, var(--ty-input-placeholder, #9ca3af));\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-light);\n font-style: italic;\n}\n\n/* Placeholder styling when tags are present */\n.dropdown-placeholder.hidden {\n display: none;\n}\n\n/* Options area styling - Override for multiselect */\n.dropdown-options {\n opacity: 0;\n background: var(--input-bg, var(--ty-input-bg));\n border: 1px solid var(--input-border, var(--ty-input-border));\n border-radius: var(--ty-radius-lg);\n max-height: 16rem;\n width: 100%;\n max-width: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n scroll-behavior: smooth;\n box-sizing: border-box;\n position: relative;\n box-shadow:\n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n\n /* Animation properties */\n transform: translateY(-8px) scale(0.95);\n transition:\n opacity 200ms cubic-bezier(0.16, 1, 0.3, 1),\n transform 200ms cubic-bezier(0.16, 1, 0.3, 1);\n\n /* Multiselect-specific: flex wrap for tags */\n display: flex;\n flex-wrap: wrap;\n padding: 0.5rem;\n gap: 0.5rem;\n\n}\n\n/* Hide native scrollbar only when custom scrollbar is active */\n.dropdown-options.ty-custom-scroll {\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n.dropdown-options.ty-custom-scroll::-webkit-scrollbar {\n display: none;\n}\n\n/* Options wrapper - positioned container for scrollbar track */\n.dropdown-options-wrapper {\n position: relative;\n}\n\n/* Show custom scrollbar on hover */\n.dropdown-options-wrapper:hover .ty-scrollbar-track-y.has-overflow {\n opacity: 1;\n}\n\n/* Make ty-tags in dropdown clickable with pointer cursor */\n.dropdown-options ty-tag {\n user-select: none;\n transition: transform 0.1s ease;\n}\n\n.dropdown-options ty-tag:hover {\n transform: scale(1.02);\n}\n\n.dropdown-options ty-tag:active {\n transform: scale(0.98);\n}\n\n/* Visual feedback for selected tags in options */\n.dropdown-options ty-tag[selected] {\n opacity: 0.5;\n}\n\n/* Ensure ty-tag components in multiselect have proper sizing */\n.multiselect-chips ty-tag {\n max-width: 150px;\n}\n\n/* Responsive adjustments */\n@media (max-width: 640px) {\n .multiselect-chips ty-tag {\n max-width: 100px;\n }\n}\n\n\n/* Ensure proper spacing in container layouts */\n.multiselect-container {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n}\n\n/* ===== DROPDOWN WRAPPER & LABEL ===== */\n\n.dropdown-wrapper {\n position: relative;\n display: block;\n width: 100%;\n}\n\n.dropdown-label {\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-medium);\n color: var(--ty-label-color);\n margin-bottom: 6px;\n padding-left: 12px;\n display: flex;\n align-items: center;\n}\n\n/* Required indicator - using SVG icon */\n.required-icon {\n display: inline-flex;\n align-items: center;\n color: #ef4444;\n width: 12px;\n height: 12px;\n vertical-align: middle;\n margin-left: 4px;\n}\n\n.required-icon svg {\n width: 100%;\n height: 100%;\n}\n\n:host([disabled]) .multiselect-container {\n pointer-events: none;\n}\n\n/* ============================================================================\n MOBILE MODAL STYLES\n ============================================================================ */\n\n.dropdown-mode-mobile .mobile-dialog {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100vw;\n height: 100vh;\n max-width: 100vw;\n max-height: 100vh;\n margin: 0;\n padding: 0;\n padding-top: 10vh; /* Position content from top */\n border: none;\n background: transparent; /* Backdrop handles background */\n /* Note: Don't set display - browser controls <dialog> visibility */\n align-items: flex-start;\n justify-content: center;\n opacity: 0;\n transition: opacity 300ms ease;\n}\n\n/* When opened via showModal(), add flex layout */\n.dropdown-mode-mobile .mobile-dialog[open] {\n display: flex;\n}\n\n.dropdown-mode-mobile .mobile-dialog.open {\n opacity: 1;\n}\n\n/* Native dialog backdrop with blur */\n.dropdown-mode-mobile .mobile-dialog::backdrop {\n background: rgba(0, 0, 0, 0.5);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n}\n\n.dropdown-mode-mobile .mobile-dialog-content {\n position: relative;\n display: flex;\n flex-direction: column;\n width: calc(100% - 32px); /* Side margins */\n max-width: 400px; /* Constrained width like dropdown */\n min-height: 200px;\n max-height: calc(90vh - 10vh);\n opacity: 0;\n transform: scale(0.95);\n transition: \n opacity 300ms cubic-bezier(0.16, 1, 0.3, 1),\n transform 300ms cubic-bezier(0.16, 1, 0.3, 1);\n}\n\n.dropdown-mode-mobile .mobile-dialog.open .mobile-dialog-content {\n opacity: 1;\n transform: scale(1);\n}\n\n.dropdown-mode-mobile .mobile-search-input:focus {\n border-color: var(--ty-border);\n}\n\n/* Mobile search header - label floats above, search + close below */\n.dropdown-mode-mobile .mobile-search-header {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n margin-bottom: 16px;\n padding: 0;\n background: transparent;\n position: relative;\n}\n\n.dropdown-mode-mobile .mobile-header-content {\n display: flex;\n align-items: center;\n gap: 12px;\n width: 100%;\n}\n\n/* Header for non-searchable (label + close button) */\n.dropdown-mode-mobile .mobile-header-nosearch {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n margin-bottom: 16px;\n padding: 0;\n background: transparent;\n position: relative;\n min-height: 40px;\n}\n\n.dropdown-mode-mobile .mobile-header-label {\n position: absolute;\n bottom: 100%;\n left: 6px;\n margin-bottom: 4px;\n font-size: var(--ty-font-lg);\n line-height: var(--ty-leading-lg);\n letter-spacing: var(--ty-tracking-lg);\n font-weight: 700;\n color: var(--ty-color-neutral);\n pointer-events: none;\n}\n\n/* Close button - circular with border (matches dropdown.ts) */\n.dropdown-mode-mobile .mobile-close-button {\n flex-shrink: 0;\n width: 36px;\n height: 36px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--ty-surface-floating);\n border: 2px solid var(--mobile-border-color);\n border-radius: 50%;\n color: var(--ty-text-strong);\n cursor: pointer;\n transition: var(--ty-transition-all);\n padding: 0;\n}\n\n.dropdown-mode-mobile .mobile-close-button:hover {\n background: var(--ty-bg-neutral);\n border-color: var(--ty-border);\n color: var(--ty-text-strong);\n}\n\n.dropdown-mode-mobile .mobile-close-button:active {\n transform: scale(0.9);\n}\n\n.dropdown-mode-mobile .mobile-close-button svg {\n width: 24px;\n height: 24px;\n}\n\n/* Mobile search input (matches dropdown.ts) */\n.dropdown-mode-mobile .mobile-search-input {\n flex: 1;\n min-width: 0;\n box-sizing: border-box;\n background: var(--ty-surface-floating);\n color: var(--ty-text);\n border: 2px solid;\n border-color: var(--mobile-border-color);\n border-radius: var(--ty-radius-md);\n font-family: var(--ty-font-sans);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-weight: var(--ty-font-normal);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n height: 40px;\n transition: var(--ty-transition-all);\n outline: none;\n}\n\n.dropdown-mode-mobile .mobile-search-input::placeholder {\n color: var(--ty-text-faint);\n}\n\n.dropdown-mode-mobile .mobile-search-input:focus {\n border-color: var(--ty-border);\n}\n\n/* ============================================================================\n MOBILE BODY & SECTIONS - UPDATED STRUCTURE\n ============================================================================ */\n\n/* Mobile body - contains both sections */\n.dropdown-mode-mobile .mobile-body {\n position: relative;\n display: flex;\n flex-direction: column;\n height: var(--body-height, 350px);\n max-height: 350px;\n overflow: hidden;\n background: var(--ty-surface-floating);\n border-radius: var(--ty-radius-lg);\n box-shadow: \n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n border: 2px solid;\n border-color: var(--mobile-border-color);\n}\n\n/* ===== SECTION HEADERS - Fixed 48px height ===== */\n\n.dropdown-mode-mobile .section-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 48px;\n flex-shrink: 0;\n padding: 0 16px;\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: var(--ty-text);\n background: var(--ty-bg-neutral-soft);\n border-bottom: 1px solid var(--ty-border-faint);\n cursor: pointer;\n user-select: none;\n transition: all 0.3s ease;\n}\n\n/* Expanded section is mild (already viewing it), collapsed is normal (draws attention) */\n.dropdown-mode-mobile [data-expanded="false"] .section-header {\n color: var(--ty-text);\n}\n\n.dropdown-mode-mobile [data-expanded="true"] .section-header {\n color: var(--ty-text-mild);\n}\n\n.dropdown-mode-mobile .section-header:hover {\n background: var(--ty-bg-neutral);\n}\n\n.dropdown-mode-mobile .section-header:active {\n background: var(--ty-bg-neutral-mild);\n}\n\n.dropdown-mode-mobile .section-header .section-title {\n flex: 1;\n}\n\n.dropdown-mode-mobile .section-header .section-count {\n font-weight: 400;\n opacity: 0.7;\n margin-left: 0.25rem;\n}\n\n/* Chevron indicator (only for selected section) */\n.dropdown-mode-mobile .section-header .section-chevron {\n width: 16px;\n height: 16px;\n color: var(--ty-text-faint);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.dropdown-mode-mobile .section-header .section-chevron svg {\n width: 100%;\n height: 100%;\n}\n\n/* Rotate chevron when expanded */\n.dropdown-mode-mobile .mobile-selected-section[data-expanded="true"] .section-chevron {\n transform: rotate(180deg);\n}\n\n/* Available section header - not clickable */\n.dropdown-mode-mobile .mobile-available-section .section-header {\n cursor: default;\n}\n\n.dropdown-mode-mobile .mobile-available-section .section-header:hover {\n background: var(--ty-bg-neutral-soft);\n}\n\n/* ===== SELECTED SECTION - Expandable with smooth transition ===== */\n\n.dropdown-mode-mobile .mobile-selected-section {\n display: flex;\n flex-direction: column;\n background: var(--ty-surface-elevated);\n border-bottom: 2px solid var(--ty-border);\n overflow: hidden;\n transition: max-height 300ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n/* Collapsed state - just header (48px) */\n.dropdown-mode-mobile .mobile-selected-section[data-expanded="false"] {\n max-height: 48px;\n flex: 0 0 48px;\n}\n\n/* Expanded state - takes remaining space */\n.dropdown-mode-mobile .mobile-selected-section[data-expanded="true"] {\n max-height: 1000px; /* Large enough for content */\n flex: 1;\n}\n\n.dropdown-mode-mobile .mobile-selected-section .section-content {\n flex: 1;\n overflow-y: auto;\n padding: 0.75rem 1rem;\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n align-content: flex-start;\n}\n\n/* ===== AVAILABLE SECTION ===== */\n\n.dropdown-mode-mobile .mobile-available-section {\n display: flex;\n flex-direction: column;\n background: var(--ty-surface-floating);\n overflow: hidden;\n transition: max-height 300ms cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n/* Collapsed state - just header (48px) */\n.dropdown-mode-mobile .mobile-available-section[data-expanded="false"] {\n max-height: 48px;\n flex: 0 0 48px;\n}\n\n/* Expanded state - takes remaining space */\n.dropdown-mode-mobile .mobile-available-section[data-expanded="true"] {\n max-height: 1000px; /* Large enough for content */\n flex: 1;\n}\n\n.dropdown-mode-mobile .mobile-available-section .section-content {\n flex: 1;\n overflow-y: auto;\n padding: 0.75rem 1rem;\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n align-content: flex-start;\n}\n\n/* ===== EMPTY STATES ===== */\n\n.dropdown-mode-mobile .empty-state {\n display: none;\n width: 100%;\n padding: 2rem 1rem;\n text-align: center;\n color: var(--ty-text-faint);\n font-size: var(--ty-font-sm);\n line-height: var(--ty-leading-sm);\n letter-spacing: var(--ty-tracking-sm);\n font-style: italic;\n}\n\n/* Show empty state when no tags present */\n.dropdown-mode-mobile .mobile-selected-section[data-empty="true"] .empty-state,\n.dropdown-mode-mobile .mobile-available-section[data-empty="true"] .empty-state {\n display: block;\n}\n\n/* Hide slot content when empty */\n.dropdown-mode-mobile .mobile-selected-section[data-empty="true"] slot,\n.dropdown-mode-mobile .mobile-available-section[data-empty="true"] slot {\n display: none;\n}\n\n/* ===== TAG STYLING IN MOBILE ===== */\n\n.dropdown-mode-mobile .section-content ::slotted(ty-tag) {\n cursor: pointer;\n user-select: none;\n transition: transform 0.1s ease;\n margin: 2px 0; /* Vertical spacing like dropdown options */\n}\n\n.dropdown-mode-mobile .section-content ::slotted(ty-tag:hover) {\n transform: scale(1.02);\n}\n\n.dropdown-mode-mobile .section-content ::slotted(ty-tag:active) {\n transform: scale(0.98);\n}\n\n/* Dimmed appearance for hidden filtered tags */\n.dropdown-mode-mobile .section-content ::slotted(ty-tag[hidden]) {\n display: none !important;\n}\n\n/* ==================== LOADING STATE ====================\n Spinner overlay shown inside the options area while the parent\n (external-search mode) is fetching. Search input stays usable.\n\n Carries its own surface so it stays visible even when the host\n has restyled the popup with a transparent or unusual background.\n Override with --ty-loader-bg / --ty-loader-radius / --ty-loader-border.\n*/\n.dropdown-loading {\n display: none;\n align-items: center;\n justify-content: center;\n gap: var(--ty-spacing-2);\n padding: var(--ty-spacing-4) var(--ty-spacing-3);\n color: var(--ty-text-);\n font-size: var(--ty-font-sm);\n min-height: 4rem;\n background: var(--ty-loader-bg, var(--ty-surface-floating));\n border: 1px solid var(--ty-loader-border, var(--ty-border-soft));\n border-radius: var(--ty-loader-radius, var(--ty-radius-base));\n box-sizing: border-box;\n}\n\n.dropdown-options-wrapper.loading .dropdown-loading {\n display: flex;\n}\n\n.dropdown-options-wrapper.loading .dropdown-options,\n.dropdown-options-wrapper.loading > slot#options-slot,\n.dropdown-options-wrapper.loading .empty-state {\n display: none;\n}\n\n.dropdown-loading-spinner {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 1.125rem;\n height: 1.125rem;\n flex-shrink: 0;\n animation: ty-multiselect-spin 0.7s linear infinite;\n color: var(--ty-color-primary);\n}\n\n.dropdown-loading-spinner svg {\n width: 100%;\n height: 100%;\n}\n\n.dropdown-loading-text {\n color: var(--ty-text-);\n}\n\n@keyframes ty-multiselect-spin {\n to { transform: rotate(360deg); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .dropdown-loading-spinner {\n animation-duration: 1.6s;\n }\n}\n\n/* Custom scrollbar styles */\n${yn}\n`;let It=0;const Ot=new WeakMap;function Lt(n){let t=Ot.get(n);return void 0===t&&(t=++It,Ot.set(n,t)),t}const Nt='<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-asterisk"><path d="M12 6v12"/><path d="M17.196 9 6.804 15"/><path d="m6.804 9 10.392 6"/></svg>',qt='<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>',Rt=class extends o{constructor(){super(),this.St="",this.nt="Select options...",this.tt="",this.R=!1,this.et=!1,this.ot=!1,this.it=!1,this.st=!1,this.ct=null,this.lt="md",this.Et="Selected",this.Tt="Available",this.Mt="No items selected",this.Dt="No options available",this.dt={open:!1,search:"",highlightedIndex:-1,filteredTags:[],selectedValues:[],mode:"desktop",expandedSection:"selected"},this.ht=null,this.$t=null,this.At=null,this.bt=null,this.vt=null,this.yt=null,this.wt=0,this.xt=null,this.kt=null,r(this.shadowRoot,{css:At,id:"ty-multiselect"})}set expandedSection(n){this.dt.expandedSection=n}get expandedSection(){return this.dt.expandedSection}onConnect(){this.shadowRoot.querySelectorAll("dialog").forEach(n=>{n.open&&n.close()}),this.render(),requestAnimationFrame(()=>{this.initializeState()})}onDisconnect(){this.shadowRoot.querySelectorAll("dialog").forEach(n=>{n.open&&n.close()}),this.yt&&(document.removeEventListener("keydown",this.yt),this.yt=null),null!==this.xt&&(clearTimeout(this.xt),this.xt=null),this.zt()}onPropertiesChanged(n){for(const{name:t,newValue:e}of n)switch(t){case"value":const n=this.parseValue(e);this.dt.selectedValues=n,this.isConnected&&this.shadowRoot&&(this.syncSelectedTags(n),this.updateSelectionDisplay(),this.updateMobileSelectedState());break;case"name":this.St=e||"";break;case"placeholder":this.nt=e||"Select options...";break;case"label":this.tt=e||"";break;case"disabled":this.R=e;break;case"readonly":this.et=e;break;case"required":this.ot=e;break;case"externalSearch":this.it=e;break;case"size":this.lt=e;break;case"debounce":this.wt=e;break;case"selected-label":this.Et=e||"Selected";break;case"available-label":this.Tt=e||"Available";break;case"no-selection-message":this.Mt=e||"No items selected";break;case"no-options-message":this.Dt=e||"No options available";break;case"loading":this.st=e,this.applyLoadingState()}}applyLoadingState(){const n=this.shadowRoot;if(!n)return;const t=this.st?l():null;n.querySelectorAll(".dropdown-options-wrapper").forEach(n=>{if(n.classList.toggle("loading",this.st),this.st){n.setAttribute("aria-busy","true");const e=n.querySelector(".dropdown-loading-spinner");e&&t&&(e.innerHTML=t)}else n.removeAttribute("aria-busy")})}getFormValue(){const n=this.dt.selectedValues;if(this.St&&n.length>0){const t=new FormData;return n.forEach(n=>{t.append(this.St,n)}),t}return null}parseValue(n){return n&&"string"==typeof n&&""!==n.trim()?n.split(",").map(n=>n.trim()).filter(n=>""!==n):[]}initializeState(){const n=this.getProperty("value")||"";if(n){const t=this.parseValue(n);this.dt.selectedValues=t,this.syncSelectedTags(t),this.updateSelectionDisplay(),this.updateMobileSelectedState()}else{const n=this.getTagElements().filter(n=>n.hasAttribute("selected")).map(n=>this.getTagData(n).value);n.length>0&&this.updateComponentValue(n,!1)}}getTagElements(){return Array.from(this.querySelectorAll("ty-tag"))}getTagData(n){return{value:n.value||n.getAttribute("value")||n.textContent||"",text:n.textContent||"",element:n}}selectTag(n){this.getTagData(n),n.setAttribute("selected",""),n.setAttribute("slot","selected"),n.setAttribute("dismissible","true");const t=n.parentNode;t&&(t.removeChild(n),t.appendChild(n))}deselectTag(n){n.removeAttribute("selected"),n.removeAttribute("slot"),n.removeAttribute("dismissible");const t=n.parentNode;t&&(t.removeChild(n),t.appendChild(n))}getSelectedValues(){return this.getTagElements().filter(n=>n.hasAttribute("selected")).map(n=>this.getTagData(n).value).filter(n=>""!==n)}allTagsSelected(){const n=this.getTagElements();return 0!==n.length&&n.filter(n=>n.hasAttribute("selected")).length===n.length}syncSelectedTags(n){const t=new Set(n);this.getTagElements().forEach(n=>{const e=this.getTagData(n).value,o=t.has(e),i=n.hasAttribute("selected");o&&!i?this.selectTag(n):!o&&i&&this.deselectTag(n)})}updateComponentValue(n,t=!1,e="set",o=null){const i=this.getSelectedValues(),r=n.join(",");JSON.stringify(n.sort())!==JSON.stringify(i.sort())&&(this.setProperty("value",r),t&&this.dispatchChangeEvent({values:n,action:e,item:o}))}calculatePosition(){const n=this.shadowRoot,t=n.querySelector(".multiselect-stub"),e=n.querySelector(".dropdown-dialog");if(!t||!e)return;const o=t.getBoundingClientRect(),i=window.innerHeight,r=window.innerWidth,s=e.getBoundingClientRect(),a=i-o.bottom>=(s.height||200)+8,l=a?o.top-20:i-o.bottom-20,d=o.width+20+20;this.style.setProperty("--dropdown-x",(o.width>r-o.left?Math.max(8,r-o.width-8):o.left-20)+"px"),this.style.setProperty("--dropdown-y",l+"px"),this.style.setProperty("--dropdown-width",d+"px"),this.style.setProperty("--dropdown-offset-x","0px"),this.style.setProperty("--dropdown-offset-y","0px"),this.style.setProperty("--dropdown-padding","20px"),a?(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",a?"below":"above")}Ct(){if(!vn())return;const n=this.shadowRoot,t=n.querySelector(".dropdown-options"),e=n.querySelector(".dropdown-options-wrapper");t&&e&&(this.zt(),t.classList.add("ty-custom-scroll"),this.kt=new mn(t,{vertical:!0}),this.kt.trackY&&e.appendChild(this.kt.trackY))}zt(){this.kt&&(this.kt.trackY?.remove(),this.kt.destroy(),this.kt=null)}openDropdown(){const n=this.shadowRoot,t=n.querySelector(".dropdown-dialog");if(!t)return;const e=`multiselect-${this.id||"anon"}-${Lt(this)}`;this.ct=e,Un(e),t.showModal(),t.classList.add("open"),this.calculatePosition(),this.dt.open=!0;const o=n.querySelector(".dropdown-chevron");o&&o.classList.add("open");const i=n.querySelector(".dropdown-search-chevron");i&&i.classList.add("open");const r=this.getTagElements().map(n=>this.getTagData(n));this.dt.filteredTags=r,this.dt.highlightedIndex=-1,this.updateOptionsVisibility(!0),this.Ct();const s=n.querySelector(".dropdown-search-input");s&&setTimeout(()=>s.focus(),100)}closeDropdown(){const n=this.shadowRoot,t=n.querySelector(".dropdown-dialog");if(!t)return;this.zt(),t.classList.remove("open"),t.classList.remove("position-above"),t.classList.remove("position-below"),t.close(),this.ct&&(Gn(this.ct),this.ct=null),this.dt.open=!1,this.dt.highlightedIndex=-1;const e=n.querySelector(".dropdown-chevron");e&&e.classList.remove("open");const o=n.querySelector(".dropdown-search-chevron");o&&o.classList.remove("open");const i=""!==this.dt.search;this.dt.search="";const r=n.querySelector(".dropdown-search-input");if(r&&(r.value=""),this.it)i&&(null!==this.xt&&(clearTimeout(this.xt),this.xt=null),this.fireSearchEvent(""));else{const n=this.getTagElements().map(n=>this.getTagData(n));this.dt.filteredTags=n,this.updateTagVisibility(n,n),this.clearHighlights(n)}}openMobileModal(){const n=this.shadowRoot,t=n.querySelector(".mobile-dialog");if(!t)return;const e=`multiselect-${this.id||"anon"}-${Lt(this)}`;this.ct=e,Un(e),t.showModal(),t.classList.add("open");const o=n.querySelector("#stub-slot"),i=n.querySelector("#mobile-slot");o.name="selected-blocked",i.name="selected",this.dt.open=!0;const r=this.getTagElements().map(n=>this.getTagData(n));this.dt.filteredTags=r;const s=n.querySelector(".mobile-search-input");s&&setTimeout(()=>s.focus(),100),this.dt.expandedSection="available",this.syncSectionStates(),requestAnimationFrame(()=>{this.updateMobileSelectedState()})}closeMobileModal(){const n=this.shadowRoot,t=n.querySelector(".mobile-dialog");if(!t)return;t.classList.remove("open"),t.close(),this.ct&&(Gn(this.ct),this.ct=null);const e=n.querySelector("#stub-slot"),o=n.querySelector("#mobile-slot");e.name="selected",o.name="selected-blocked",this.dt.open=!1,this.dt.highlightedIndex=-1;const i=""!==this.dt.search;this.dt.search="";const r=n.querySelector(".mobile-search-input");r&&(r.value=""),this.it?i&&(null!==this.xt&&(clearTimeout(this.xt),this.xt=null),this.fireSearchEvent("")):this.getTagElements().forEach(n=>n.removeAttribute("hidden"))}handleStubClick(n){n.preventDefault(),n.stopPropagation(),this.R||this.et||this.allTagsSelected()||this.openDropdown()}handleTagClick(n){const t=n.target,e="TY-TAG"===t.tagName?t:t.closest("ty-tag");if(!e||e.hasAttribute("disabled"))return;if(e.hasAttribute("selected"))return;n.preventDefault(),n.stopPropagation();const o=this.getTagData(e).value,i=[...this.getSelectedValues(),o];this.updateComponentValue(i,!0,"add",o),this.allTagsSelected()&&("desktop"===this.dt.mode?this.closeDropdown():this.closeMobileModal())}handleTagDismiss(n){n.preventDefault(),n.stopPropagation();const t=n,e=t.detail?.target;if(!e)return;const o=this.getTagData(e).value,i=this.getSelectedValues().filter(n=>n!==o);this.updateComponentValue(i,!0,"remove",o)}blockSearchClick(n){n.stopPropagation(),n.preventDefault()}handleSearchInput(n){const t=n.target.value;if(this.dt.search=t,this.it)return void this.dispatchSearchEvent(t);const e=this.getTagElements().map(n=>this.getTagData(n)),o=e.filter(n=>!n.element.hasAttribute("selected")),i=this.filterTags(o,t);this.dt.filteredTags=i,this.dt.highlightedIndex=-1,this.updateTagVisibility(i,e),this.updateOptionsVisibility(i.length>0),this.clearHighlights(e)}handleKeyboard(n){if(!this.dt.open)return;const t=this.shadowRoot.querySelector(".dropdown-search-input");if(n.target!==t&&document.activeElement===t)return;const e=this.dt.filteredTags,o=e.length,i=this.dt.highlightedIndex;switch(n.key){case"Escape":n.preventDefault(),n.stopPropagation(),this.closeDropdown();break;case"Enter":n.preventDefault(),n.stopPropagation(),i>=0&&o>i&&this.handleTagClick({target:e[i].element});break;case"ArrowUp":let t;n.preventDefault(),n.stopPropagation(),t=0===o?-1:-1===i||0===i?o-1:i-1,this.dt.highlightedIndex=t,this.highlightTag(e,t);break;case"ArrowDown":let r;n.preventDefault(),n.stopPropagation(),r=0===o?-1:-1===i||i===o-1?0:i+1,this.dt.highlightedIndex=r,this.highlightTag(e,r)}}filterTags(n,t){if(!t||""===t.trim())return n;const e=t.toLowerCase();return n.filter(({text:n})=>n.toLowerCase().includes(e))}updateTagVisibility(n,t){const e=new Set(n.map(n=>n.value));t.forEach(({value:n,element:t})=>{e.has(n)?t.removeAttribute("hidden"):t.setAttribute("hidden","")})}updateOptionsVisibility(n){const t=this.shadowRoot.querySelector(".dropdown-options");t&&(t.style.display=n?"":"none")}clearHighlights(n){n.forEach(({element:n})=>{n.removeAttribute("highlighted")})}highlightTag(n,t){if(this.clearHighlights(n),t>=0&&n.length>t){const{element:e}=n[t];e.setAttribute("highlighted",""),e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}dispatchSearchEvent(n){null!==this.xt&&(clearTimeout(this.xt),this.xt=null),this.wt>0?this.xt=window.setTimeout(()=>{this.fireSearchEvent(n),this.xt=null},this.wt):this.fireSearchEvent(n)}fireSearchEvent(n){this.dispatchEvent(new CustomEvent("search",{detail:{query:n,element:this},bubbles:!0,composed:!0}))}dispatchChangeEvent(n){this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,cancelable:!0}))}render(){this.dt.mode=B()?"mobile":"desktop","mobile"===this.dt.mode?this.renderMobile():this.renderDesktop(),this.applyLoadingState()}setupEventListeners(){const n=this.shadowRoot,t=n.querySelector(".multiselect-stub"),e=n.querySelector("#options-slot"),o=n.querySelector(".dropdown-search-input");t&&(this.ht=this.handleStubClick.bind(this),t.addEventListener("click",this.ht)),e&&(this.$t=this.handleTagClick.bind(this),e.addEventListener("click",this.$t)),o&&(this.bt=this.handleSearchInput.bind(this),this.vt=this.blockSearchClick.bind(this),o.addEventListener("input",this.bt),o.addEventListener("click",this.vt));const i=n.querySelector(".dropdown-dialog");i&&i.addEventListener("click",n=>{n.target===i&&this.closeDropdown()}),this.yt=this.handleKeyboard.bind(this),document.addEventListener("keydown",this.yt),this.At=this.handleTagDismiss.bind(this),this.addEventListener("dismiss",this.At)}buildStubClasses(){const n=[this.lt];return this.R&&n.push("disabled"),n.join(" ")}renderDesktop(){const n=this.shadowRoot;if(!n.querySelector(".multiselect-container")){const t=this.buildStubClasses();n.innerHTML=`\n <div class="multiselect-container dropdown-mode-mobile">\n ${this.tt?`\n <label class="dropdown-label">\n ${this.tt}\n ${this.ot?`<span class="required-icon">${Nt}</span>`:""}\n </label>\n `:""}\n <div class="dropdown-wrapper">\n <div class="dropdown-stub multiselect-stub ${t}"\n ${this.R?"disabled":""}>\n <slot name="start"></slot>\n <div class="multiselect-chips">\n <slot name="selected"></slot>\n </div>\n <span class="dropdown-placeholder">${this.nt}</span>\n <div class="dropdown-chevron">\n ${qt}\n </div>\n </div>\n <dialog class="dropdown-dialog">\n <div class="dropdown-header">\n <input \n class="dropdown-search-input ${this.lt}" \n type="text"\n placeholder="Search..."\n ${this.R?"disabled":""}\n />\n <div class="dropdown-search-chevron">\n ${qt}\n </div>\n </div>\n <div class="dropdown-options-wrapper">\n <div class="dropdown-options">\n <slot id="options-slot"></slot>\n </div>\n <div class="dropdown-loading" aria-hidden="true">\n <span class="dropdown-loading-spinner"></span>\n <span class="dropdown-loading-text">Searching…</span>\n </div>\n </div>\n </dialog>\n </div>\n </div>\n `,this.setupEventListeners()}this.updateSelectionDisplay()}renderMobile(){const n=this.shadowRoot;if(!n.querySelector(".multiselect-container")){const t=this.buildStubClasses();n.innerHTML=`\n <div class="multiselect-container dropdown-mode-mobile">\n ${this.tt?`\n <label class="dropdown-label">\n ${this.tt}\n ${this.ot?`<span class="required-icon">${Nt}</span>`:""}\n </label>\n `:""}\n <div class="dropdown-wrapper">\n <div class="dropdown-stub multiselect-stub ${t}"\n ${this.R?"disabled":""}>\n <slot name="start"></slot>\n <div class="multiselect-chips">\n <slot id="stub-slot" name="selected"></slot>\n </div>\n <span class="dropdown-placeholder">${this.nt}</span>\n <div class="dropdown-chevron">\n ${qt}\n </div>\n </div>\n\n <dialog class="mobile-dialog">\n <div class="mobile-dialog-content">\n \n \x3c!-- HEADER (matches dropdown.ts) --\x3e\n \n <div class="mobile-search-header">\n ${this.tt?`<span class="mobile-header-label">${this.tt}</span>`:""}\n <div class="mobile-header-content">\n <input\n class="mobile-search-input ${this.lt}"\n type="text"\n placeholder="${this.tt?`Search ${this.tt}...`:"Search..."}"\n ${this.R?"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 \n \x3c!-- BODY (two sections for multiselect) --\x3e\n <div class="mobile-body">\n \n \x3c!-- SELECTED SECTION (collapsed by default) --\x3e\n <div class="mobile-selected-section" data-expanded="false" data-empty="true">\n <div class="section-header">\n <span class="section-title">${this.Et} <span class="section-count">(0)</span></span>\n <span class="section-chevron">${qt}</span>\n </div>\n <div class="section-content">\n <slot id="mobile-slot" name="selected"></slot>\n <div class="empty-state">${this.Mt}</div>\n </div>\n </div>\n \n \x3c!-- AVAILABLE SECTION (expanded by default) --\x3e\n <div class="mobile-available-section" data-expanded="true" data-empty="false">\n <div class="section-header">\n <span class="section-title">${this.Tt}</span>\n </div>\n <div class="section-content dropdown-options-wrapper">\n <slot id="options-slot"></slot>\n <div class="empty-state">${this.Dt}</div>\n <div class="dropdown-loading" aria-hidden="true">\n <span class="dropdown-loading-spinner"></span>\n <span class="dropdown-loading-text">Searching…</span>\n </div>\n </div>\n </div>\n \n </div>\n </div>\n </dialog>\n </div>\n </div>\n `,this.setupMobileEventListeners()}this.updateSelectionDisplay()}setupMobileEventListeners(){const n=this.shadowRoot,t=n.querySelector(".multiselect-stub"),e=n.querySelector("#options-slot"),o=n.querySelector(".mobile-search-input"),i=n.querySelector(".mobile-close-button"),r=n.querySelector(".mobile-dialog"),s=n.querySelector(".mobile-selected-section .section-header"),a=n.querySelector(".mobile-available-section .section-header");t&&t.addEventListener("click",n=>this.handleMobileStubClick(n)),e&&e.addEventListener("click",n=>this.handleMobileTagClick(n)),o&&o.addEventListener("input",n=>this.handleSearchInput(n)),s&&s.addEventListener("click",()=>this.toggleSection("selected")),a&&a.addEventListener("click",()=>this.toggleSection("available")),i&&i.addEventListener("click",()=>this.closeMobileModal()),this.At=this.handleTagDismiss.bind(this),this.addEventListener("dismiss",this.At),r&&(r.addEventListener("click",n=>{n.target===r&&this.closeMobileModal()}),r.addEventListener("cancel",n=>{n.preventDefault(),this.closeMobileModal()}))}handleMobileStubClick(n){n.preventDefault(),n.stopPropagation(),this.R||this.et||this.allTagsSelected()||this.openMobileModal()}handleMobileTagClick(n){this.handleTagClick(n)}toggleSection(n){const t=this.shadowRoot,e=t.querySelector(".mobile-selected-section"),o=t.querySelector(".mobile-available-section");e&&o&&(this.dt.expandedSection=this.dt.expandedSection===n?"selected"===n?"available":"selected":n,e.setAttribute("data-expanded",("selected"===this.dt.expandedSection)+""),o.setAttribute("data-expanded",("available"===this.dt.expandedSection)+""))}syncSectionStates(){const n=this.shadowRoot,t=n.querySelector(".mobile-selected-section"),e=n.querySelector(".mobile-available-section");t&&e&&(t.setAttribute("data-expanded",("selected"===this.dt.expandedSection)+""),e.setAttribute("data-expanded",("available"===this.dt.expandedSection)+""))}updateMobileSelectedState(){if("mobile"!==this.dt.mode)return;const n=this.shadowRoot,t=n.querySelector(".mobile-selected-section"),e=n.querySelector(".mobile-available-section"),o=n.querySelector(".section-count");if(t){const n=this.dt.selectedValues.length;t.setAttribute("data-empty",!(n>0)+""),o&&(o.textContent=`(${n})`)}if(e){const t=this.getTagElements().filter(n=>!n.hasAttribute("selected")).length;e.setAttribute("data-empty",!(t>0)+"");const o=n.querySelector(".mobile-available-section .section-title");o&&(o.textContent=`${this.Tt} (${t})`)}}updateSelectionDisplay(){const n=this.shadowRoot.querySelector(".multiselect-stub");n&&(this.getTagElements().filter(n=>n.hasAttribute("selected")).length>0?n.classList.add("has-selection"):n.classList.remove("has-selection"))}get value(){return this.getSelectedValues().join(",")}set value(n){this.setProperty("value",n)}get name(){return this.getProperty("name")}set name(n){this.setProperty("name",n)}get placeholder(){return this.getProperty("placeholder")}set placeholder(n){this.setProperty("placeholder",n)}get label(){return this.getProperty("label")}set label(n){this.setProperty("label",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}get loading(){return this.getProperty("loading")}set loading(n){this.setProperty("loading",n)}get readonly(){return this.getProperty("readonly")}set readonly(n){this.setProperty("readonly",n)}get required(){return this.getProperty("required")}set required(n){this.setProperty("required",n)}get externalSearch(){return this.getProperty("externalSearch")}set externalSearch(n){this.setProperty("externalSearch",n)}get debounce(){return this.getProperty("debounce")}set debounce(n){this.setProperty("debounce","string"==typeof n?parseInt(n,10):n)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get flavor(){return this.getProperty("flavor")}set flavor(n){this.setProperty("flavor",n)}get form(){return this.m.form}};Rt.properties={value:{type:"string",visual:!0,formValue:!0,emitChange:!1,default:"",coerce:n=>Array.isArray(n)?n.join(","):null==n?"":n+""},name:{type:"string",default:""},placeholder:{type:"string",visual:!0,default:"Select options..."},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},externalSearch:{type:"boolean",visual:!0,default:!1,aliases:{"external-search":!0}},size:{type:"string",visual:!0,default:"md",validate:n=>["sm","md","lg"].includes(n),coerce:n=>["sm","md","lg"].includes(n)?n:"md"},flavor:{type:"string",visual:!0,default:"neutral",validate:n=>["primary","secondary","success","danger","warning","neutral"].includes(n),coerce:n=>["primary","secondary","success","danger","warning","neutral"].includes(n)?n:"neutral"},debounce:{type:"number",default:0,validate:n=>n>=0&&5e3>=n,coerce:n=>{const t=+n;return isNaN(t)?0:Math.max(0,Math.min(5e3,t))}},"selected-label":{type:"string",visual:!0,default:"Selected"},"available-label":{type:"string",visual:!0,default:"Available"},"no-selection-message":{type:"string",visual:!0,default:"No items selected"},"no-options-message":{type:"string",visual:!0,default:"No options available"},loading:{type:"boolean",visual:!0,default:!1}};let Pt=Rt;customElements.get("ty-multiselect")||customElements.define("ty-multiselect",Pt);const Vt=new WeakMap,Bt=new WeakMap;function Ft(n){return{width:n.getAttribute("width")||"100%",height:n.getAttribute("height")||"400px",active:n.getAttribute("active"),placement:n.getAttribute("placement")||"top"}}function Ht(n){return Array.from(n.querySelectorAll("ty-tab"))}function jt(n){return n.getAttribute("id")}function Wt(n,t){const e=jt(t);return e&&function(n,t){return null!==n.querySelector(`[slot='label-${t}']`)}(n,e)?"slot":"text"}function Yt(n){return n.hasAttribute("disabled")}function _t(n,t){const e=n.findIndex(n=>jt(n)===t);return 0>e?void 0:e}function Ut(n,t){const e=n.getAttribute("active");return e&&void 0!==_t(t,e)?e:t.length>0?jt(t[0]):null}function Gt(n){const t=Vt.get(n);if(!t)return;const e=n.shadowRoot;e&&(t.tabClickHandlers.forEach((n,t)=>{const o=e.querySelector(`[data-tab-id='${t}']`);o&&o.removeEventListener("pointerdown",n)}),t.tabClickHandlers.clear())}function Xt(n,t,e){Gt(n);const o={tabClickHandlers:new Map};e.forEach(e=>{const i=jt(e);if(!i)return;const r=t.querySelector(`[data-tab-id='${i}']`);if(r){const t=t=>function(n,t,e){e.preventDefault(),e.stopPropagation(),function(n,t){n.setAttribute("active",t)}(n,t)}(n,i,t);r.addEventListener("pointerdown",t),o.tabClickHandlers.set(i,t)}}),Vt.set(n,o)}function Kt(n,t){const e=n.shadowRoot;if(!e)return;const o=e.querySelector(".panels-wrapper");o&&(o.style.transform=`translateX(-${t*n.offsetWidth}px)`)}function Zt(n,t,e){Ht(n).forEach(o=>{const i=jt(o);if(!i)return;const r=t.querySelector(`[data-tab-id='${i}']`),s=i===e;if(r){r.setAttribute("aria-selected",s+""),r.setAttribute("tabindex",s?"0":"-1"),r.setAttribute("data-active",s+"");const t=n.querySelector(`[slot='label-${i}']`);t&&t.setAttribute("data-active",s+"")}})}function Jt(n,t){Ht(n).forEach(n=>{const e=jt(n);if(!e)return;const o=e===t;n.setAttribute("data-active",o+""),o?(n.style.pointerEvents="auto",n.style.opacity="1"):(n.style.pointerEvents="none",n.style.opacity="0")})}function Qt(n,t){const e=n.shadowRoot;if(!e)return;const o=e.querySelector(".marker-wrapper");if(!o)return;const i=function(n,t,e){const o=t.querySelector(`[data-tab-id='${e}']`),i=t.querySelector(".tab-buttons");if(!o||!i)return null;const r=o.getBoundingClientRect();return{left:o.offsetLeft,top:o.offsetTop,width:r.width,height:r.height}}(0,e,t);i&&(o.style.left=i.left+"px",o.style.top=i.top+"px",o.style.width=i.width+"px",o.style.height=i.height+"px")}function ne(n){const t=n.shadowRoot;if(!t)return;const{width:e,height:o,placement:i}=Ft(n),s=Ht(n),a=Ut(n,s),l=a?_t(s,a)??0:0,d=t.querySelector(".tabs-container"),c=t.querySelector(".tab-buttons"),h=t.querySelector(".panels-viewport");if(r(t,{css:'\n:host {\n display: block;\n width: var(--tabs-width, 100%);\n height: var(--tabs-height, 400px);\n box-sizing: border-box;\n}\n\n.tabs-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n box-sizing: border-box;\n}\n\n/* Bottom placement reverses the order */\n.tabs-container[data-placement="bottom"] {\n flex-direction: column-reverse;\n}\n\n/* ===================================== */\n/* Tab Buttons Container */\n/* Expose as CSS Part for full styling control */\n/* ===================================== */\n\n.tab-buttons {\n display: flex;\n gap: 0;\n flex-shrink: 0;\n position: relative;\n /* For absolute positioned marker */\n \n /* Default minimal styling - customize via ::part(buttons-container) */\n border-bottom: 1px solid var(--ty-border);\n background: transparent;\n}\n\n/* Bottom placement moves border to top */\n.tabs-container[data-placement="bottom"] .tab-buttons {\n border-bottom: none;\n border-top: 1px solid var(--ty-border);\n}\n\n/* ===================================== */\n/* Marker Wrapper */\n/* Expose as CSS Part for custom marker styling */\n/* ===================================== */\n\n.marker-wrapper {\n position: absolute;\n z-index: 0;\n /* Behind buttons */\n pointer-events: none;\n /* Don\'t block clicks */\n transition: left var(--transition-duration, 300ms) var(--transition-easing, ease-in-out),\n width var(--transition-duration, 300ms) var(--transition-easing, ease-in-out),\n height var(--transition-duration, 300ms) var(--transition-easing, ease-in-out),\n top var(--transition-duration, 300ms) var(--transition-easing, ease-in-out);\n}\n\n/* Default marker - simple underline */\n.default-marker {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 2px;\n width: 100%;\n background: var(--ty-color-primary);\n pointer-events: none;\n}\n\n/* Hide default marker when custom marker is slotted */\n.marker-wrapper:has(::slotted([slot="marker"])) .default-marker {\n display: none;\n}\n\n/* User\'s marker element fills the wrapper */\n::slotted([slot="marker"]) {\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n}\n\n/* ===================================== */\n/* Tab Buttons */\n/* ===================================== */\n\n.tab-button {\n min-width: 120px;\n padding: 6px 12px;\n border: none;\n background: transparent;\n cursor: pointer;\n font: inherit;\n color: var(--ty-text-soft);\n transition: color 200ms, background-color 200ms;\n white-space: nowrap;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n font-weight: var(--ty-font-bold);\n font-size: var(--ty-font-sm);\n position: relative;\n /* Establish stacking context */\n z-index: 10;\n /* Above marker */\n}\n\n.tab-button[aria-selected=true] {\n color: var(--ty-text-strong);\n}\n\n.tab-button[disabled] {\n opacity: 0.5;\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.tab-button:focus-visible {\n outline: 2px solid var(--ty-color-primary);\n outline-offset: -2px;\n}\n\n/* ===================================== */\n/* Panels Viewport */\n/* Expose as CSS Part for panels container styling */\n/* ===================================== */\n\n.panels-viewport {\n position: relative;\n flex: 1;\n overflow: hidden;\n /* Critical: hides off-screen panels */\n min-height: 0;\n /* Allows flex child to shrink */\n}\n\n/* ===================================== */\n/* Panels Wrapper (slides horizontally) */\n/* ===================================== */\n\n.panels-wrapper {\n display: flex;\n height: 100%;\n transition: transform var(--transition-duration, 300ms) var(--transition-easing, ease-in-out);\n}\n\n/* Respect user\'s motion preferences */\n@media (prefers-reduced-motion: reduce) {\n .panels-wrapper {\n transition-duration: 0ms !important;\n }\n\n .marker-wrapper {\n transition-duration: 0ms !important;\n }\n}\n\n/* ===================================== */\n/* Slotted Tab Panels */\n/* ===================================== */\n\n::slotted(ty-tab) {\n width: var(--tabs-width, 100%);\n height: 100%;\n flex-shrink: 0;\n}\n',id:"ty-tabs"}),n.style.setProperty("--tabs-width",e.includes("%")?"100%":e),n.style.setProperty("--tabs-height",o),n.style.setProperty("--active-index",l+""),d&&c&&h){d.setAttribute("data-placement",i),c.querySelectorAll(".tab-button").forEach(n=>n.remove());const e=function(n,t,e){return t.map(t=>{const o=jt(t);if(!o)return"";const i=Wt(n,t),r="text"===i?t.getAttribute("label")||"Tab":"",s=Yt(t),a=o===e;return`<button\n class="tab-button"\n role="tab"\n data-tab-id="${o}"\n id="tab-${o}"\n aria-controls="panel-${o}"\n aria-selected="${a}"\n tabindex="${a?"0":"-1"}"\n data-active="${a}"\n ${s?'disabled aria-disabled="true"':""}\n >\n ${"slot"===i?`<slot name="label-${o}"></slot>`:r}\n </button>`}).join("")}(n,s,a),o=document.createElement("div");o.innerHTML=e,Array.from(o.children).forEach(n=>{c.appendChild(n)}),Xt(n,t,s),Zt(n,t,a||""),requestAnimationFrame(()=>{const e=t.querySelector(".tab-buttons");e&&n.style.setProperty("--buttons-height",e.offsetHeight+"px"),Kt(n,l),a&&Qt(n,a)}),a&&Jt(n,a)}else{t.innerHTML=`\n <div class="tabs-container" data-placement="${i}">\n ${function(n,t,e){const o=t.map(t=>{const o=jt(t);if(!o)return"";const i=Wt(n,t),r="text"===i?t.getAttribute("label")||"Tab":"",s=Yt(t),a=o===e;return`<button\n class="tab-button"\n role="tab"\n data-tab-id="${o}"\n id="tab-${o}"\n aria-controls="panel-${o}"\n aria-selected="${a}"\n tabindex="${a?"0":"-1"}"\n data-active="${a}"\n ${s?'disabled aria-disabled="true"':""}\n >\n ${"slot"===i?`<slot name="label-${o}"></slot>`:r}\n </button>`}).join("");return`\n <div class="tab-buttons" role="tablist" part="buttons-container">\n <div class="marker-wrapper" part="marker-wrapper">\n ${i=n,null===i.querySelector('[slot="marker"]')?'<div class="default-marker"></div>':""}\n <slot name="marker"></slot>\n </div>\n ${o}\n </div>\n `;var i}(n,s,a)}\n <div class="panels-viewport" part="panels-container">\n <div class="panels-wrapper">\n <slot></slot>\n </div>\n </div>\n </div>\n `,requestAnimationFrame(()=>{const e=t.querySelector(".tab-buttons");e&&n.style.setProperty("--buttons-height",e.offsetHeight+"px"),Kt(n,l),a&&Qt(n,a)}),Xt(n,t,s),Zt(n,t,a||""),function(n){const t=Bt.get(n);t&&t.disconnect();const{width:e}=Ft(n);if(e.includes("%")){const t=new ResizeObserver(t=>{const e=t[0].contentRect.width,o=Ht(n),i=Ut(n,o),r=i?_t(o,i):0;n.style.setProperty("--tabs-width",e+"px"),void 0!==r&&Kt(n,r),i&&Qt(n,i)});t.observe(n),Bt.set(n,t)}}(n),a&&Jt(n,a);const e=t.querySelector('slot[name="marker"]');if(e){const n=()=>{const n=t.querySelector(".default-marker");if(n){const t=e.assignedElements().length>0;n.style.display=t?"none":""}};e.addEventListener("slotchange",n),n()}}}class TyTabs extends HTMLElement{static get observedAttributes(){return["width","height","active","placement"]}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){ne(this)}disconnectedCallback(){Gt(this),function(n){const t=Bt.get(n);t&&(t.disconnect(),Bt.delete(n))}(this)}attributeChangedCallback(n,t,e){"active"===n?(e&&function(n,t,e){const o=Ht(n),i=n.shadowRoot;if(!i)return;const r=e?_t(o,e):void 0,s=_t(o,t);if(e===t||void 0===s)return;n.style.setProperty("--active-index",s+""),Kt(n,s),Zt(n,i,t),Jt(n,t),Qt(n,t);const a=o[s];a?.resetScroll&&a.resetScroll(),function(n,t,e,o,i){const r=new CustomEvent("ty-tab-change",{detail:{activeId:t,activeIndex:e,previousId:o,previousIndex:i},bubbles:!0,cancelable:!1});n.dispatchEvent(r)}(n,t,s,e,r??null)}(this,e,t),ne(this)):ne(this)}}customElements.get("ty-tabs")||customElements.define("ty-tabs",TyTabs);const te=`\n:host {\n width: var(--tabs-width, 100%);\n height: calc(var(--tabs-height, 400px) - var(--buttons-height, 48px));\n display: block;\n box-sizing: border-box;\n flex-shrink: 0;\n transition: opacity var(--transition-duration, 400ms) var(--transition-easing, ease-in-out);\n}\n\n@media (prefers-reduced-motion: reduce) {\n :host {\n transition-duration: 0ms !important;\n }\n}\n\n.tab-wrapper {\n width: 100%;\n height: 100%;\n position: relative;\n overflow: hidden;\n}\n\n.tab-panel {\n width: 100%;\n height: 100%;\n overflow: auto;\n box-sizing: border-box;\n}\n\n.tab-panel.ty-custom-scroll {\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n.tab-panel.ty-custom-scroll::-webkit-scrollbar {\n display: none;\n}\n\n/* Show scrollbar on hover */\n.tab-wrapper:hover .ty-scrollbar-track-y.has-overflow {\n opacity: 1;\n}\n\n${yn}\n`;class TyTab extends HTMLElement{constructor(){super(),this.Kn=null,this.attachShadow({mode:"open"})}static get observedAttributes(){return["id","label","disabled"]}connectedCallback(){this.It()}disconnectedCallback(){this.Zn()}attributeChangedCallback(n,t,e){this.It()}It(){const n=this.shadowRoot;if(!n)return;const t=this.getAttribute("id");n.querySelector(".tab-wrapper")||(r(n,{css:te,id:"ty-tab"}),n.innerHTML=`\n <div class="tab-wrapper"\n role="tabpanel"\n ${t?`id="panel-${t}"`:""}\n ${t?`aria-labelledby="tab-${t}"`:""}\n >\n <div class="tab-panel">\n <slot></slot>\n </div>\n </div>\n `,this.Jn())}Jn(){const n=this.shadowRoot?.querySelector(".tab-panel"),t=this.shadowRoot?.querySelector(".tab-wrapper");n&&t&&vn()&&(n.classList.add("ty-custom-scroll"),this.Kn=new mn(n,{vertical:!0}),this.Kn.trackY&&t.appendChild(this.Kn.trackY))}Zn(){this.Kn&&(this.Kn.trackY?.remove(),this.Kn.destroy(),this.Kn=null)}resetScroll(){this.Kn?.scrollToTop(!1)}}customElements.get("ty-tab")||customElements.define("ty-tab",TyTab);const ee=new WeakMap,oe=new WeakMap;function ie(n){return{width:n.getAttribute("width")||"100%",height:n.getAttribute("height")||"700px",active:n.getAttribute("active"),completed:n.getAttribute("completed")||"",orientation:n.getAttribute("orientation")||"horizontal"}}function re(n){return Array.from(n.querySelectorAll("ty-step"))}function se(n){return n.getAttribute("id")}function ae(n){const t=n.getAttribute("completed")||"";return t.trim()?new Set(t.split(",").map(n=>n.trim()).filter(Boolean)):new Set}function le(n,t){const e=n.findIndex(n=>se(n)===t);return 0>e?void 0:e}function de(n,t){const e=n.getAttribute("active");return e&&void 0!==le(t,e)?e:t.length>0?se(t[0]):null}function ce(n,t){return n.length>1&&t?n.findIndex(n=>se(n)===t)/(n.length-1)*100:0}function he(n){const t=ee.get(n);if(!t)return;const e=n.shadowRoot;e&&(t.stepClickHandlers.forEach((n,t)=>{const o=e.querySelector(`[data-step-id='${t}']`);o&&o.removeEventListener("pointerdown",n)}),t.stepClickHandlers.clear())}function pe(n,t,e){he(n);const o={stepClickHandlers:new Map};e.forEach(e=>{const i=se(e);if(!i)return;const r=t.querySelector(`[data-step-id='${i}']`);if(r){const t=t=>function(n,t,e){e.preventDefault(),e.stopPropagation();const o=re(n),i=o.findIndex(n=>se(n)===t);if(0>i)return;const r=de(n,o),s=r?le(o,r)??null:null,a=new CustomEvent("ty-wizard-step-change",{detail:{activeId:t,activeIndex:i,previousId:r,previousIndex:s,direction:null===s?"none":i>s?"forward":s>i?"backward":"none"},bubbles:!0,cancelable:!1});n.dispatchEvent(a)}(n,i,t);r.addEventListener("pointerdown",t),o.stepClickHandlers.set(i,t)}}),ee.set(n,o)}function ue(n,t){const e=n.shadowRoot;if(!e)return;const o=e.querySelector(".panels-wrapper");o&&(o.style.transform=`translateX(-${t*n.offsetWidth}px)`)}function ge(n){const t=n.shadowRoot;if(!t)return;const e=t.querySelector(".progress-overlay");if(!e)return;const o=re(n),i=de(n,o);ae(n);const r=ce(o,i);e.style.width=r+"%"}function be(n,t,e){const o=re(n),i=ae(n);e&&o.findIndex(n=>se(n)===e),o.forEach(o=>{const r=se(o);if(!r)return;const s=t.querySelector(`[data-step-id='${r}']`),a=t.querySelector(`[data-step-id='${r}'] .step-circle`),l=r===e;if(s&&(s.setAttribute("aria-selected",l+""),s.setAttribute("tabindex",l?"0":"-1"),s.setAttribute("data-active",l+"")),a){const n=me(o,r,e,i);a.setAttribute("data-state",n)}const d=n.querySelector(`[slot='indicator-${r}']`);d&&d.setAttribute("data-active",l+"")})}function ve(n,t){re(n).forEach(n=>{const e=se(n);if(!e)return;const o=e===t;n.setAttribute("data-active",o+""),o?(n.style.pointerEvents="auto",n.style.opacity="1"):(n.style.pointerEvents="none",n.style.opacity="0")})}function me(n,t,e,o){const i=n.getAttribute("status");if(i&&["completed","active","pending","error"].includes(i))return i;const r=t===e;return o.has(t)?"completed":r?"active":"pending"}function ye(n,t,e,o){e&&t.findIndex(n=>se(n)===e);const i=t.map((t,i)=>{const r=se(t);if(!r)return"";const s=t.getAttribute("label")||"Step "+(i+1),a=t.getAttribute("description")||"",l=function(n){return n.hasAttribute("disabled")}(t),d=r===e,c=function(n,t){return null!==n.querySelector(`[slot='indicator-${t}']`)}(n,r),h=me(t,r,e,o);let p="";return p=c?`<slot name="indicator-${r}"></slot>`:"completed"===h?'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>':"error"===h?'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>':`<span style="font-size: 12px; font-weight: 700;">${i+1}</span>`,`<button\n class="step-indicator"\n role="tab"\n data-step-id="${r}"\n id="step-${r}"\n aria-controls="panel-${r}"\n aria-selected="${d}"\n tabindex="${d?"0":"-1"}"\n data-active="${d}"\n ${l?'disabled aria-disabled="true"':""}\n >\n <div class="step-circle" data-state="${h}" part="step-circle">\n ${p}\n </div>\n <div class="step-text">\n <span class="step-label">${s}</span>\n ${a?`<span class="step-description">${a}</span>`:""}\n </div>\n </button>`}).join(""),r=ce(t,e);return`\n <div class="step-indicators-wrapper" part="indicators-wrapper">\n <div class="step-indicators" style="--step-count: ${t.length}">\n <div class="progress-line" part="progress-line" role="progressbar" aria-valuenow="${Math.round(r)}" aria-valuemin="0" aria-valuemax="100">\n <div class="progress-overlay" style="width: ${r}%"></div>\n </div>\n ${i}\n </div>\n </div>\n `}function fe(n){const t=n.shadowRoot;if(!t)return;const{width:e,height:o}=ie(n),i=re(n),s=de(n,i),a=s?le(i,s)??0:0,l=ae(n),d=t.querySelector(".wizard-container"),c=t.querySelector(".step-indicators-wrapper"),h=t.querySelector(".panels-viewport");if(r(t,{css:'\n:host {\n display: block;\n width: var(--wizard-width, 100%);\n height: var(--wizard-height, 700px);\n box-sizing: border-box;\n /* Note: --step-circle-size is NOT set here to allow inheritance from light DOM.\n Use fallbacks in var() calls instead. Set on ty-wizard element to customize. */\n}\n\n.wizard-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n position: relative;\n box-sizing: border-box;\n border-radius: 12px;\n border: 1px solid var(--ty-border);\n background: var(--ty-surface-floating);\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n overflow: hidden;\n}\n\n/* ===================================== */\n/* Step Indicators Wrapper */\n/* Expose as CSS Part for full styling control */\n/* ===================================== */\n\n.step-indicators-wrapper {\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n position: relative;\n padding: 24px 24px 16px;\n border-bottom: 1px solid var(--ty-border-soft, var(--ty-border));\n background: var(--ty-surface-content);\n}\n\n/* ===================================== */\n/* Progress Line (behind step circles) */\n/* Expose as CSS Part for custom styling */\n/* ===================================== */\n\n.progress-line {\n position: absolute;\n /*\n * With equal-width indicators (flex: 1), each takes 100%/N of the width.\n * Circle centers are at: 50%/N, 150%/N, 250%/N, ... from left.\n * Line spans from first center (50%/N) to last center (100% - 50%/N).\n * Inset = 50% / step-count from each side.\n */\n left: calc(50% / var(--step-count, 4));\n right: calc(50% / var(--step-count, 4));\n /* Vertically center with step circles - uses circle size variable */\n top: calc(var(--step-circle-size, 32px) / 2 - 1px);\n height: 2px;\n background: var(--ty-border);\n z-index: 0;\n pointer-events: none;\n transition: opacity var(--transition-duration, 300ms) var(--transition-easing, ease-in-out);\n}\n\n.progress-overlay {\n position: absolute;\n left: 0;\n top: 0;\n height: 100%;\n background: var(--ty-color-success);\n transition: width var(--transition-duration, 500ms) var(--transition-easing, ease-in-out);\n will-change: width;\n}\n\n/* ===================================== */\n/* Step Indicators Container */\n/* ===================================== */\n\n.step-indicators {\n display: flex;\n align-items: flex-start;\n position: relative;\n /* No padding - let equal-width indicators fill the space */\n}\n\n/* ===================================== */\n/* Individual Step Indicator */\n/* Expose as CSS Part for step styling */\n/* ===================================== */\n\n.step-indicator {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n cursor: pointer;\n background: transparent;\n border: none;\n padding: 0;\n font: inherit;\n transition: opacity 200ms;\n /* Equal width for all indicators - makes progress line alignment predictable */\n flex: 1;\n min-width: 0;\n}\n\n.step-indicator[aria-disabled="true"] {\n opacity: 0.4;\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.step-indicator:focus-visible {\n outline: 2px solid var(--ty-color-primary);\n outline-offset: 4px;\n border-radius: 50%;\n}\n\n/* ===================================== */\n/* Step Circle - Smaller, cleaner */\n/* Expose as CSS Part for circle styling */\n/* ===================================== */\n\n.step-circle {\n /* Circle size - set --step-circle-size on ty-wizard element to customize */\n width: var(--step-circle-size, 32px);\n height: var(--step-circle-size, 32px);\n border-radius: 50%;\n border: 2px solid;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n z-index: 10;\n transition: all var(--transition-duration, 300ms) var(--transition-easing, ease-in-out);\n box-sizing: border-box;\n flex-shrink: 0;\n}\n\n/* Completed state - green with success glow */\n.step-circle[data-state="completed"] {\n background: var(--ty-color-success);\n border-color: var(--ty-color-success-600, var(--ty-color-success));\n color: white;\n box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);\n}\n\n/* Active state - primary with primary glow */\n.step-circle[data-state="active"] {\n background: var(--ty-color-primary);\n border-color: var(--ty-color-primary-600, var(--ty-color-primary));\n color: white;\n box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);\n}\n\n/* Pending state - neutral gray */\n.step-circle[data-state="pending"] {\n background: var(--ty-surface-elevated, #f3f4f6);\n border-color: var(--ty-border, #d1d5db);\n color: var(--ty-text-soft, #6b7280);\n}\n\n/* Error state - red with danger glow */\n.step-circle[data-state="error"] {\n background: var(--ty-color-danger, #ef4444);\n border-color: var(--ty-color-danger-600, #dc2626);\n color: white;\n box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);\n}\n\n/* ===================================== */\n/* Step Text Container */\n/* Wraps label and description */\n/* ===================================== */\n\n.step-text {\n display: flex;\n flex-direction: column;\n gap: 2px;\n align-items: center;\n}\n\n/* ===================================== */\n/* Step Label - Main title */\n/* ===================================== */\n\n.step-label {\n font-size: var(--ty-font-sm, 14px);\n font-weight: var(--ty-font-semibold, 600);\n color: var(--ty-text, inherit);\n transition: color 200ms;\n}\n\n.step-indicator[aria-selected="true"] .step-label {\n color: var(--ty-text-strong, inherit);\n}\n\n.step-indicator[aria-selected="false"] .step-label {\n color: var(--ty-text-soft, inherit);\n}\n\n/* ===================================== */\n/* Step Description - Subtitle */\n/* ===================================== */\n\n.step-description {\n font-size: var(--ty-font-xs, 12px);\n font-weight: var(--ty-font-normal, 400);\n color: var(--ty-text-soft, #9ca3af);\n transition: color 200ms;\n text-align: center;\n max-width: 120px;\n}\n\n.step-indicator[aria-selected="true"] .step-description {\n color: var(--ty-text, inherit);\n}\n\n/* ===================================== */\n/* Custom Indicator Content via Slots */\n/* ===================================== */\n\n::slotted([slot^="indicator-"]) {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n}\n\n/* ===================================== */\n/* Panels Viewport */\n/* Expose as CSS Part for panels container styling */\n/* ===================================== */\n\n.panels-viewport {\n position: relative;\n flex: 1;\n overflow: hidden;\n /* Critical: hides off-screen panels */\n min-height: 0;\n /* Allows flex child to shrink */\n background: var(--ty-surface-elevated);\n}\n\n/* ===================================== */\n/* Panels Wrapper (slides horizontally) */\n/* ===================================== */\n\n.panels-wrapper {\n display: flex;\n height: 100%;\n transition: transform var(--transition-duration, 300ms) var(--transition-easing, ease-in-out);\n will-change: transform;\n}\n\n/* ===================================== */\n/* Slotted Step Panels */\n/* ===================================== */\n\n::slotted(ty-step) {\n width: var(--wizard-width, 100%);\n height: 100%;\n flex-shrink: 0;\n}\n\n/* ===================================== */\n/* Accessibility & Motion Preferences */\n/* ===================================== */\n\n/* Respect user\'s motion preferences */\n@media (prefers-reduced-motion: reduce) {\n .panels-wrapper {\n transition-duration: 0ms !important;\n }\n\n .progress-overlay {\n transition-duration: 0ms !important;\n }\n\n .step-circle {\n transition-duration: 0ms !important;\n }\n\n .progress-line {\n transition-duration: 0ms !important;\n }\n}\n\n/* Screen reader only content */\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n',id:"ty-wizard"}),n.style.setProperty("--wizard-width",e.includes("%")?"100%":e),n.style.setProperty("--wizard-height",o),n.style.setProperty("--active-index",a+""),n.style.setProperty("--step-count",i.length+""),d&&c&&h){c.remove();const e=ye(n,i,s,l),o=document.createElement("div");o.innerHTML=e,d.insertBefore(o.firstElementChild,h),pe(n,t,i),be(n,t,s||""),requestAnimationFrame(()=>{const e=t.querySelector(".step-indicators-wrapper");e&&n.style.setProperty("--indicators-height",e.offsetHeight+"px"),ue(n,a),ge(n)}),s&&ve(n,s)}else t.innerHTML=`\n <div class="wizard-container">\n ${ye(n,i,s,l)}\n <div class="panels-viewport" part="panels-container">\n <div class="panels-wrapper">\n <slot></slot>\n </div>\n </div>\n </div>\n `,requestAnimationFrame(()=>{const e=t.querySelector(".step-indicators-wrapper");e&&n.style.setProperty("--indicators-height",e.offsetHeight+"px"),ue(n,a),ge(n)}),pe(n,t,i),be(n,t,s||""),function(n){const t=oe.get(n);t&&t.disconnect();const{width:e}=ie(n);if(e.includes("%")){const t=new ResizeObserver(t=>{const e=t[0].contentRect.width,o=re(n),i=de(n,o),r=i?le(o,i):0;n.style.setProperty("--wizard-width",e+"px"),void 0!==r&&ue(n,r)});t.observe(n),oe.set(n,t)}}(n),s&&ve(n,s)}class TyWizard extends HTMLElement{static get observedAttributes(){return["width","height","active","completed","orientation"]}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){fe(this)}disconnectedCallback(){he(this),function(n){const t=oe.get(n);t&&(t.disconnect(),oe.delete(n))}(this)}attributeChangedCallback(n,t,e){"active"===n?(e&&function(n,t){const e=re(n),o=n.shadowRoot;if(!o)return;const i=de(n,e),r=i?le(e,i):void 0,s=le(e,t);if(i===t||void 0===s)return;n.style.setProperty("--active-index",s+""),ue(n,s),be(n,o,t),ge(n),ve(n,t);const a=e[s];a?.resetScroll&&a.resetScroll(),function(n,t,e,o,i){const r=new CustomEvent("ty-wizard-step-change",{detail:{activeId:t,activeIndex:e,previousId:o,previousIndex:i,direction:null===i?"none":e>i?"forward":i>e?"backward":"none"},bubbles:!0,cancelable:!1});n.dispatchEvent(r)}(n,t,s,i,r??null)}(this,e),fe(this)):fe(this)}}customElements.get("ty-wizard")||customElements.define("ty-wizard",TyWizard);const we=`\n:host {\n width: var(--wizard-width, 100%);\n height: calc(var(--wizard-height, 700px) - var(--indicators-height, 120px));\n display: block;\n box-sizing: border-box;\n flex-shrink: 0;\n transition: opacity var(--transition-duration, 400ms) var(--transition-easing, ease-in-out);\n}\n\n@media (prefers-reduced-motion: reduce) {\n :host {\n transition-duration: 0ms !important;\n }\n}\n\n.step-wrapper {\n width: 100%;\n height: 100%;\n position: relative;\n overflow: hidden;\n}\n\n.step-panel {\n width: 100%;\n height: 100%;\n overflow: auto;\n box-sizing: border-box;\n}\n\n.step-panel.ty-custom-scroll {\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n.step-panel.ty-custom-scroll::-webkit-scrollbar {\n display: none;\n}\n\n.step-wrapper:hover .ty-scrollbar-track-y.has-overflow {\n opacity: 1;\n}\n\n${yn}\n`;class TyStep extends HTMLElement{constructor(){super(),this.Kn=null,this.attachShadow({mode:"open"})}static get observedAttributes(){return["id","label","description","disabled","status"]}connectedCallback(){this.It()}disconnectedCallback(){this.Zn()}attributeChangedCallback(n,t,e){this.It()}It(){const n=this.shadowRoot;if(!n)return;const t=this.getAttribute("id");n.querySelector(".step-wrapper")||(r(n,{css:we,id:"ty-step"}),n.innerHTML=`\n <div class="step-wrapper"\n role="tabpanel"\n ${t?`id="panel-${t}"`:""}\n ${t?`aria-labelledby="step-${t}"`:""}\n >\n <div class="step-panel">\n <slot></slot>\n </div>\n </div>\n `,this.Jn())}Jn(){const n=this.shadowRoot?.querySelector(".step-panel"),t=this.shadowRoot?.querySelector(".step-wrapper");n&&t&&vn()&&(n.classList.add("ty-custom-scroll"),this.Kn=new mn(n,{vertical:!0}),this.Kn.trackY&&t.appendChild(this.Kn.trackY))}Zn(){this.Kn&&(this.Kn.trackY?.remove(),this.Kn.destroy(),this.Kn=null)}resetScroll(){this.Kn?.scrollToTop(!1)}}function xe(n){if(!Number.isInteger(n)||1>n||n>12)throw new RangeError(`Invalid month: ${n}. Must be an integer between 1 and 12.`)}function ke(n,t,e,o){const i=n.getFullYear(),r=n.getMonth()+1,s=n.getDate(),a=n.getDay(),l=i!==t||r!==e;let d=!1,c=!1;l&&(t>i||i===t&&e>r?d=!0:c=!0);const h=(u=function(){const n=new Date;return new Date(n.getFullYear(),n.getMonth(),n.getDate(),0,0,0,0)}(),(p=n).getFullYear()===u.getFullYear()&&p.getMonth()===u.getMonth()&&p.getDate()===u.getDate());var p,u;const g=o?.year===i&&o?.month===r&&o?.day===s;return{value:Date.UTC(i,r-1,s,0,0,0,0),localValue:n.getTime(),year:i,month:r,dayInMonth:s,weekend:0===a||6===a,otherMonth:l,prevMonth:d,nextMonth:c,today:h,isSelected:g,selectedYear:o?.year,selectedMonth:o?.month,selectedDay:o?.day}}function ze(n,t){const e=new Date(n);return e.setDate(e.getDate()+t),e}function Ce(n){return n instanceof HTMLElement}function Se(n){if(!n||""===n)return null;const t=n+"";return/^\d+(\.\d+)?$/.test(t)?t+"px":t}customElements.get("ty-step")||customElements.define("ty-step",TyStep);class TyCalendarMonth extends HTMLElement{constructor(){super(),this.Ot="en-US",this.lt="md";const n=new Date;this.Lt=n.getFullYear(),this.Nt=n.getMonth()+1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["locale","size"]}connectedCallback(){this.Nt||(this.Nt=(new Date).getMonth()+1),this.Lt||(this.Lt=(new Date).getFullYear()),this.Ot||(this.Ot=this.getAttribute("locale")||"en-US");const n=this.getAttribute("size");!n||"sm"!==n&&"md"!==n&&"lg"!==n||(this.lt=n);const t=this.dayContentFn;t&&!this.qt&&(this.qt=t,delete this.dayContentFn);const e=this.customCSS;e&&!this.Rt&&(this.Rt=e,delete this.customCSS),this.Z=W(this,()=>{this.render()}),this.render()}disconnectedCallback(){this.Z&&(this.Z(),this.Z=void 0)}attributeChangedCallback(n,t,e){"locale"===n?(this.Ot=e||"en-US",this.render()):"size"===n&&("sm"!==e&&"md"!==e&&"lg"!==e||(this.lt=e,this.render()))}get displayYear(){return this.Lt}set displayYear(n){this.Lt!==n&&(this.Lt=n,this.render())}get displayMonth(){return this.Nt}set displayMonth(n){this.Nt!==n&&(this.Nt=n,this.render())}get locale(){return j(this,this.getAttribute("locale"))}set locale(n){this.Ot!==n&&(this.Ot=n,this.render())}get size(){return this.lt}set size(n){this.lt!==n&&(this.lt=n,this.render())}get width(){return this.Pt}set width(n){this.Pt!==n&&(this.Pt=n,this.applyWidthProperties())}get minWidth(){return this.Vt}set minWidth(n){this.Vt!==n&&(this.Vt=n,this.applyWidthProperties())}get maxWidth(){return this.Bt}set maxWidth(n){this.Bt!==n&&(this.Bt=n,this.applyWidthProperties())}get dayContentFn(){return this.qt}set dayContentFn(n){this.qt!==n&&(this.qt=n,this.render())}get customCSS(){return this.Rt}set customCSS(n){this.Rt!==n&&(this.Rt=n,this.applyCustomCSS())}get value(){return this.N}set value(n){const t=n??void 0;this.N!==t&&(this.N=t,this.render())}applyWidthProperties(){const n=Se(this.Pt),t=Se(this.Vt),e=Se(this.Bt);n?this.style.setProperty("--calendar-width",n):this.style.removeProperty("--calendar-width"),t?this.style.setProperty("--calendar-min-width",t):this.style.removeProperty("--calendar-min-width"),e?this.style.setProperty("--calendar-max-width",e):this.style.removeProperty("--calendar-max-width")}applyCustomCSS(){if(!this.Rt||!this.shadowRoot)return;const n=this.shadowRoot.adoptedStyleSheets;n.includes(this.Rt)||(this.shadowRoot.adoptedStyleSheets=[...n,this.Rt])}refresh(){this.render()}dispatchDayClick(n,t){const e={dayContext:n,value:n.value,year:n.year,month:n.month,day:n.dayInMonth,isHoliday:n.holiday,isToday:n.today,isWeekend:n.weekend,isOtherMonth:n.otherMonth};for(const o of["day-click","day-select"]){const n=new CustomEvent(o,{detail:e,bubbles:!0,cancelable:!0});this.dispatchEvent(n)}}renderDayCell(n){const t=document.createElement("div"),e=this.qt?this.qt(n):function(n){return""+n.dayInMonth}(n);if(this.qt&&e&&!Ce(e)&&"string"!=typeof e)throw Error(`Custom dayContentFn must return a DOM element or string, got: ${typeof e}. Use document.createElement() to create DOM elements.`);const o=function(n){const t=["calendar-day"];return n.today&&t.push("today"),n.weekend&&t.push("weekend"),n.otherMonth&&t.push("other-month"),n.isSelected&&t.push("selected"),t}(n);return t.className=o.join(" "),"string"==typeof e?t.textContent=e:Ce(e)&&t.appendChild(e),t.addEventListener("pointerdown",t=>{t.preventDefault(),this.dispatchDayClick(n,t)}),t}render(){const n=this.shadowRoot;if(!n)return;let t;if(r(n,{css:"\n/* ============================================================================\n Theming Tokens\n Override these to retheme the calendar without touching the global palette.\n Defaults chain back to the global --ty-color-* / --ty-bg-* / --ty-border tokens.\n ============================================================================ */\n\n:host {\n /* Accent aliases — override these three for thin retheming */\n --ty-calendar-accent: var(--ty-color-primary);\n --ty-calendar-today-accent: var(--ty-color-secondary);\n --ty-calendar-muted: var(--ty-color-neutral);\n\n /* Header (weekday names) */\n --ty-calendar-header-color: var(--ty-color-neutral-strong);\n\n /* Day cell — base */\n --ty-calendar-day-color: var(--ty-calendar-muted);\n --ty-calendar-day-bg: transparent;\n --ty-calendar-day-border: var(--ty-border);\n --ty-calendar-day-radius: 0.375rem;\n\n /* Day cell — hover */\n --ty-calendar-day-hover-color: var(--ty-color-neutral-strong);\n --ty-calendar-day-hover-bg: var(--ty-bg-neutral-soft);\n --ty-calendar-day-hover-border: var(--ty-border-mild);\n\n /* Today */\n --ty-calendar-today-color: var(--ty-color-secondary-strong);\n --ty-calendar-today-bg: var(--ty-bg-secondary-soft);\n --ty-calendar-today-border: var(--ty-calendar-today-accent);\n\n /* Selected */\n --ty-calendar-selected-color: var(--ty-color-primary-strong);\n --ty-calendar-selected-bg: var(--ty-bg-primary);\n --ty-calendar-selected-border: var(--ty-calendar-accent);\n --ty-calendar-selected-hover-bg: var(--ty-bg-primary-mild);\n --ty-calendar-selected-hover-border: var(--ty-color-primary-mild);\n\n /* Modifier states */\n --ty-calendar-weekend-color: var(--ty-color-danger-soft);\n --ty-calendar-other-month-color: var(--ty-color-neutral-faint);\n --ty-calendar-other-month-opacity: 0.5;\n}\n\n/* ============================================================================\n Base Calendar Container\n ============================================================================ */\n\n.calendar-flex-container {\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n gap: 0;\n padding: 0.75rem;\n border-radius: 0.5rem;\n font-family: system-ui, sans-serif;\n user-select: none;\n width: var(--calendar-width, fit-content);\n min-width: 280px;\n max-width: var(--calendar-max-width, none);\n}\n\n/* ============================================================================\n Rows (Header + 6 Day Rows)\n ============================================================================ */\n\n.calendar-row {\n display: flex;\n flex: 1;\n min-height: 0;\n}\n\n.calendar-header-row {\n flex: 0 0 auto;\n color: var(--ty-calendar-header-color);\n}\n\n.calendar-day-row {\n flex: 1;\n min-height: 2rem;\n margin-bottom: 0.125rem;\n}\n\n/* ============================================================================\n Base Cell Styles\n ============================================================================ */\n\n.calendar-cell {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 0;\n position: relative;\n box-sizing: border-box;\n}\n\n/* ============================================================================\n Header Cells\n ============================================================================ */\n\n.calendar-header-cell {\n text-align: center;\n font-weight: 600;\n text-transform: uppercase;\n padding: 0.25rem;\n letter-spacing: 0.05em;\n}\n\n/* ============================================================================\n Day Cells - Square with Better Visual Hierarchy\n ============================================================================ */\n\n.calendar-day-cell {\n /* Square cells */\n aspect-ratio: 1;\n\n /* Layout */\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n\n /* Spacing */\n margin: 0.125rem;\n\n /* Visual */\n border-radius: var(--ty-calendar-day-radius);\n border: 1px solid var(--ty-calendar-day-border);\n background-color: var(--ty-calendar-day-bg);\n color: var(--ty-calendar-day-color);\n cursor: pointer;\n transition: all 0.15s ease;\n\n /* Typography */\n font-weight: 400;\n}\n\n/* Hover State - Stronger Feedback */\n.calendar-day-cell:hover {\n color: var(--ty-calendar-day-hover-color);\n background-color: var(--ty-calendar-day-hover-bg);\n border-color: var(--ty-calendar-day-hover-border);\n}\n\n/* ============================================================================\n Day States\n ============================================================================ */\n\n/* Today - Strong Visual Indicator */\n.calendar-day-cell.today {\n background-color: var(--ty-calendar-today-bg);\n color: var(--ty-calendar-today-color);\n border-color: var(--ty-calendar-today-border);\n font-weight: 600;\n}\n\n/* Weekend - Subtle Color Shift */\n.calendar-day-cell.weekend {\n color: var(--ty-calendar-weekend-color);\n}\n\n/* Other Month - Muted */\n.calendar-day-cell.other-month {\n color: var(--ty-calendar-other-month-color);\n opacity: var(--ty-calendar-other-month-opacity);\n}\n\n.calendar-day-cell.other-month:hover { \n color: var(--ty-calendar-day-hover-color);\n background-color: var(--ty-calendar-day-hover-bg);\n opacity: 0.7;\n}\n\n/* Selected State (for custom usage) */\n.calendar-day-cell.selected {\n background-color: var(--ty-calendar-selected-bg);\n color: var(--ty-calendar-selected-color);\n border-color: var(--ty-calendar-selected-border);\n font-weight: 600;\n}\n\n.calendar-day-cell.selected:hover {\n background-color: var(--ty-calendar-selected-hover-bg);\n border-color: var(--ty-calendar-selected-hover-border);\n}\n\n.calendar-day-cell.selected.other-month {\n opacity: 0.7;\n}\n\n/* ============================================================================\n Size Variants\n ============================================================================ */\n\n/* Small - Compact (240px min-width) */\n.calendar-size-sm {\n padding: 0.5rem;\n min-width: 240px;\n}\n\n.calendar-size-sm .calendar-header-cell {\n font-size: 0.625rem;\n padding: 0.125rem;\n}\n\n.calendar-size-sm .calendar-day-cell {\n font-size: 0.75rem;\n margin: 0.0625rem;\n}\n\n.calendar-size-sm .calendar-day-row {\n min-height: 1.5rem;\n}\n\n/* Medium - Default (280px min-width) */\n.calendar-size-md {\n padding: 0.75rem;\n min-width: 280px;\n}\n\n.calendar-size-md .calendar-header-cell {\n font-size: 0.6875rem;\n padding: 0.25rem;\n}\n\n.calendar-size-md .calendar-day-cell {\n font-size: 0.8125rem;\n margin: 0.125rem;\n}\n\n.calendar-size-md .calendar-day-row {\n min-height: 2rem;\n}\n\n/* Large - Spacious (360px min-width) */\n.calendar-size-lg {\n padding: 1rem;\n min-width: 360px;\n}\n\n.calendar-size-lg .calendar-header-cell {\n font-size: 0.75rem;\n padding: 0.375rem;\n}\n\n.calendar-size-lg .calendar-day-cell {\n font-size: 0.875rem;\n margin: 0.1875rem;\n}\n\n.calendar-size-lg .calendar-day-row {\n min-height: 2.5rem;\n}\n\n/* ============================================================================\n Backwards Compatibility\n ============================================================================ */\n\n.calendar-day {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n}\n",id:"ty-calendar-month"}),this.applyCustomCSS(),this.applyWidthProperties(),this.N){const n=new Date(this.N);t={year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate()}}const e=function(n,t,e){return function(n){if(!Number.isInteger(n)||1>n||n>9999)throw new RangeError(`Invalid year: ${n}. Must be an integer between 1 and 9999.`)}(n),xe(t),function(n,t,e,o,i){const r=[];for(let s=0;42>s;s++){const t=ze(n,s);r.push(ke(t,e,o,i))}return r}(function(n,t){const e=function(n,t){return new Date(n,t-1,1,0,0,0,0)}(n,t);return function(n){const t=n.getDay(),e=0===t?6:t-1,o=new Date(n);return o.setDate(n.getDate()-e),o.setHours(0,0,0,0),o}(e)}(n,t),0,n,t,e)}(this.Lt,this.Nt,t),o=function(n,t="short"){const e=new Intl.DateTimeFormat(n,{weekday:t}),o=new Date(2024,0,7),i=Array.from({length:7},(n,t)=>{const i=ze(o,t);return e.format(i)}),[r,...s]=i;return[...s,r]}(this.Ot,"short");n.innerHTML="";const i=document.createElement("div");i.className="calendar-flex-container calendar-size-"+this.lt;const s=document.createElement("div");s.className="calendar-row calendar-header-row",o.forEach(n=>{const t=document.createElement("div");t.className="calendar-cell calendar-header-cell",t.textContent=n,s.appendChild(t)}),i.appendChild(s);const a=[];for(let r=0;42>r;r+=7)a.push(e.slice(r,r+7));a.forEach(n=>{const t=document.createElement("div");t.className="calendar-row calendar-day-row",n.forEach(n=>{const e=this.renderDayCell(n);e.className=e.className+" calendar-cell calendar-day-cell",t.appendChild(e)}),i.appendChild(t)}),n.appendChild(i)}}customElements.get("ty-calendar-month")||customElements.define("ty-calendar-month",TyCalendarMonth);const Ee='\n/* ============================================================================\n Size Variants (CSS Custom Properties)\n ============================================================================ */\n\n:host {\n /* Default (md) */\n --nav-btn-size: 2rem;\n --nav-btn-icon-size: 1.25rem;\n --nav-font-size: 1rem;\n --nav-padding: 0.5rem 0.75rem;\n --nav-default-width: 280px;\n\n /* ==========================================================================\n Theming Tokens\n Override these to retheme navigation without touching the global palette.\n ========================================================================== */\n\n /* Accent alias — drives focus outline, mirrors --ty-calendar-accent */\n --ty-calendar-accent: var(--ty-color-primary);\n\n /* Nav button (prev/next chevrons) */\n --ty-calendar-nav-color: var(--ty-color-neutral);\n --ty-calendar-nav-hover-color: var(--ty-color-neutral-strong);\n --ty-calendar-nav-hover-bg: var(--ty-bg-neutral-soft);\n --ty-calendar-nav-active-bg: var(--ty-bg-neutral);\n --ty-calendar-nav-focus-outline: var(--ty-calendar-accent);\n\n /* Title (month/year display) */\n --ty-calendar-nav-title-color: var(--ty-color-neutral-strong);\n}\n\n:host([data-size="sm"]) {\n --nav-btn-size: 1.5rem;\n --nav-btn-icon-size: 1rem;\n --nav-font-size: 0.875rem;\n --nav-padding: 0.375rem 0.5rem;\n --nav-default-width: 240px;\n}\n\n:host([data-size="lg"]) {\n --nav-btn-size: 2.5rem;\n --nav-btn-icon-size: 1.5rem;\n --nav-font-size: 1.125rem;\n --nav-padding: 0.625rem 1rem;\n --nav-default-width: 360px;\n}\n\n/* ============================================================================\n Main Navigation Header\n ============================================================================ */\n\n.calendar-navigation-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: var(--nav-padding);\n font-family: system-ui, sans-serif;\n user-select: none;\n width: var(--nav-width, var(--nav-default-width));\n box-sizing: border-box;\n}\n\n/* ============================================================================\n Navigation Groups (Left, Center, Right)\n ============================================================================ */\n\n.nav-group {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n}\n\n.nav-group-left,\n.nav-group-right {\n flex: 0 0 auto;\n}\n\n.nav-group-center {\n flex: 1;\n justify-content: center;\n}\n\n/* ============================================================================\n Navigation Buttons\n ============================================================================ */\n\n.nav-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--nav-btn-size);\n height: var(--nav-btn-size);\n padding: 0;\n border: none;\n border-radius: 0.375rem;\n background-color: transparent;\n color: var(--ty-calendar-nav-color);\n cursor: pointer;\n transition: all 0.15s ease;\n outline: none;\n}\n\n.nav-btn:hover {\n background-color: var(--ty-calendar-nav-hover-bg);\n color: var(--ty-calendar-nav-hover-color);\n}\n\n.nav-btn:active {\n background-color: var(--ty-calendar-nav-active-bg);\n transform: scale(0.95);\n}\n\n.nav-btn:focus-visible {\n outline: 2px solid var(--ty-calendar-nav-focus-outline);\n outline-offset: 2px;\n}\n\n/* SVG sizing */\n.nav-btn svg {\n width: var(--nav-btn-icon-size);\n height: var(--nav-btn-icon-size);\n display: block;\n}\n\n/* ============================================================================\n Month/Year Display (Center)\n ============================================================================ */\n\n.month-year-display {\n font-size: var(--nav-font-size);\n font-weight: 600;\n color: var(--ty-calendar-nav-title-color);\n text-align: center;\n white-space: nowrap;\n letter-spacing: -0.01em;\n}\n',Te=class extends o{constructor(){super();const n=new Date;this.dt={displayMonth:n.getMonth()+1,displayYear:n.getFullYear()},r(this.shadowRoot,{css:Ee,id:"ty-calendar-navigation"})}onConnect(){this.dt.displayMonth=this.displayMonth,this.dt.displayYear=this.displayYear,this.Z=W(this,()=>{this.render()}),this.render()}onDisconnect(){this.Z&&(this.Z(),this.Z=void 0)}onPropertiesChanged(n){for(const{name:t,newValue:e}of n)switch(t){case"display-month":this.dt.displayMonth=e;break;case"display-year":this.dt.displayYear=e}}get displayMonth(){return this.getProperty("display-month")}set displayMonth(n){this.setProperty("display-month",n)}get displayYear(){return this.getProperty("display-year")}set displayYear(n){this.setProperty("display-year",n)}get locale(){return j(this,this.getProperty("locale"))}set locale(n){this.setProperty("locale",n)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get width(){return this.getProperty("width")}set width(n){this.setProperty("width",n)}emitChangeEvent(n,t){const e=new CustomEvent("change",{detail:{month:n,year:t},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}navigateMonth(n){const t=this.dt.displayMonth+n;let e,o;1>t?(e=12,o=this.dt.displayYear-1):t>12?(e=1,o=this.dt.displayYear+1):(e=t,o=this.dt.displayYear),this.emitChangeEvent(e,o)}navigateYear(n){this.emitChangeEvent(this.dt.displayMonth,this.dt.displayYear+n)}createButton(n,t,e,o){const i=document.createElement("button");return i.className=n,i.title=t,i.innerHTML=e,i.addEventListener("click",o),i}render(){const n=this.shadowRoot;if(!n)return;r(n,{css:Ee,id:"ty-calendar-navigation"}),this.setAttribute("data-size",this.size);const t=this.width;t?this.style.setProperty("--nav-width",t):this.style.removeProperty("--nav-width");const e=function(n,t="en-US",e="long"){xe(n);const o=new Date(2024,n-1,1);return new Intl.DateTimeFormat(t,{month:e}).format(o)}(this.dt.displayMonth,this.locale,"long");n.innerHTML="";const o=document.createElement("div");o.className="calendar-navigation-header";const i=document.createElement("div");i.className="nav-group nav-group-left",i.appendChild(this.createButton("nav-btn nav-year-prev","Previous year","<?xml version='1.0' encoding='UTF-8'?>\n<svg width='24' viewBox='0 0 24 24' height='24' enable-background='new 0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke-width='0' stroke='currentColor' fill='currentColor'>\n<g>\n<rect width='24' height='24' fill='none'/>\n</g>\n<g>\n<g>\n<polygon points='17.59,18 19,16.59 14.42,12 19,7.41 17.59,6 11.59,12'/>\n<polygon points='11,18 12.41,16.59 7.83,12 12.41,7.41 11,6 5,12'/>\n</g>\n</g>\n</svg>",()=>this.navigateYear(-1))),i.appendChild(this.createButton("nav-btn nav-month-prev","Previous month","<?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.navigateMonth(-1)));const s=document.createElement("div");s.className="nav-group nav-group-center";const a=document.createElement("div");a.className="month-year-display",a.textContent=`${e} ${this.dt.displayYear}`,s.appendChild(a);const l=document.createElement("div");l.className="nav-group nav-group-right",l.appendChild(this.createButton("nav-btn nav-month-next","Next month","<?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.navigateMonth(1))),l.appendChild(this.createButton("nav-btn nav-year-next","Next year","<?xml version='1.0' encoding='UTF-8'?>\n<svg width='24' viewBox='0 0 24 24' height='24' enable-background='new 0 0 24 24' xmlns='http://www.w3.org/2000/svg' stroke-width='0' stroke='currentColor' fill='currentColor'>\n<g>\n<rect width='24' height='24' fill='none'/>\n</g>\n<g>\n<g>\n<polygon points='6.41,6 5,7.41 9.58,12 5,16.59 6.41,18 12.41,12'/>\n<polygon points='13,6 11.59,7.41 16.17,12 11.59,16.59 13,18 19,12'/>\n</g>\n</g>\n</svg>",()=>this.navigateYear(1))),o.appendChild(i),o.appendChild(s),o.appendChild(l),n.appendChild(o)}};Te.properties={"display-month":{type:"number",visual:!0,default:()=>(new Date).getMonth()+1,validate:n=>{const t=+n;return Number.isInteger(t)&&t>=1&&12>=t},coerce:n=>{const t=+n;return isNaN(t)||1>t||t>12?(new Date).getMonth()+1:t}},"display-year":{type:"number",visual:!0,default:()=>(new Date).getFullYear(),validate:n=>{const t=+n;return Number.isInteger(t)&&t>=1&&9999>=t},coerce:n=>{const t=+n;return isNaN(t)||1>t||t>9999?(new Date).getFullYear():t}},locale:{type:"string",visual:!0,default:"en-US"},size:{type:"string",visual:!0,default:"md",validate:n=>["sm","md","lg"].includes(n),coerce:n=>["sm","md","lg"].includes(n)?n:"md"},width:{type:"string",visual:!0,default:""}};let Me=Te;function De(n){return n&&/^\d{4}$/.test(n)?parseInt(n,10):null}function $e(n){if(!n||!/^\d{1,2}$/.test(n))return null;const t=parseInt(n,10);return 1>t||t>12?null:t}function Ae(n,t,e){if(!n||!/^\d{1,2}$/.test(n))return null;const o=parseInt(n,10),i=new Date(t,e,0).getDate();return 1>o||o>i?null:o}function Ie(n,t,e){return`${n}-${(""+t).padStart(2,"0")}-${(""+e).padStart(2,"0")}`}customElements.get("ty-calendar-navigation")||customElements.define("ty-calendar-navigation",Me);const Oe=class extends HTMLElement{constructor(){super(),this.Ot="en-US",this.Ft=!0,this.Ht=!1,this.lt="md";const n=function(){const n=new Date;return{year:n.getFullYear(),month:n.getMonth()+1,day:n.getDate()}}();this.dt={displayYear:n.year,displayMonth:n.month},this.attachShadow({mode:"open"}),"attachInternals"in this&&(this.m=this.attachInternals())}static get observedAttributes(){return["year","month","day","show-navigation","stateless","locale","name","size","width"]}connectedCallback(){this.initializeFromAttributes();const n=this.dayContentFn;n&&!this.qt&&(this.qt=n,delete this.dayContentFn);const t=this.customCSS;t&&!this.Rt&&(this.Rt=t,delete this.customCSS);const e=this.value;if(e&&"string"==typeof e&&e!==this.value){const n=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(n){const t=parseInt(n[1],10),e=parseInt(n[2],10),o=parseInt(n[3],10);this.dt.selectedYear=t,this.dt.selectedMonth=e,this.dt.selectedDay=o,this.dt.displayYear=t,this.dt.displayMonth=e,this.Ht||(this.setAttribute("year",""+t),this.setAttribute("month",""+e),this.setAttribute("day",""+o))}delete this.value}this.render(),this.updateFormValue(),this.Z=W(this,()=>{this.render()})}disconnectedCallback(){this.Z&&(this.Z(),this.Z=void 0),this.jt=void 0,this.Wt=void 0}attributeChangedCallback(n,t,e){if(t!==e)switch(n){case"year":case"month":case"day":this.syncStateFromAttributes(),this.syncChildComponents(),this.updateFormValue();break;case"show-navigation":this.Ft="false"!==e,this.render();break;case"stateless":this.Ht=null!==e&&"false"!==e;break;case"locale":this.Ot=e||"en-US",this.syncChildComponents();break;case"size":"sm"!==e&&"md"!==e&&"lg"!==e||(this.lt=e,this.Pt=void 0,this.removeAttribute("width"),this.syncChildComponents());break;case"width":this.Pt=e||void 0,e&&(this.lt="md",this.removeAttribute("size")),this.syncChildComponents();break;case"name":this.updateFormValue()}}get year(){return this.dt.selectedYear}set year(n){void 0!==n?this.Ht?(this.dt.displayYear=n,this.setAttribute("year",""+n)):(this.dt.selectedYear=n,this.dt.displayYear=n,this.setAttribute("year",""+n)):(this.Ht||delete this.dt.selectedYear,this.removeAttribute("year")),this.syncChildComponents(),this.Ht||this.updateFormValue()}get month(){return this.dt.selectedMonth}set month(n){void 0!==n?this.Ht?(this.dt.displayMonth=n,this.setAttribute("month",""+n)):(this.dt.selectedMonth=n,this.dt.displayMonth=n,this.setAttribute("month",""+n)):(this.Ht||delete this.dt.selectedMonth,this.removeAttribute("month")),this.syncChildComponents(),this.Ht||this.updateFormValue()}get day(){return this.dt.selectedDay}set day(n){void 0!==n?(this.dt.selectedDay=n,this.setAttribute("day",""+n)):(delete this.dt.selectedDay,this.removeAttribute("day")),this.syncChildComponents(),this.updateFormValue()}get locale(){return j(this,this.getAttribute("locale"))}set locale(n){this.Ot=n,this.setAttribute("locale",n)}get showNavigation(){return this.Ft}set showNavigation(n){this.Ft=n,this.setAttribute("show-navigation",""+n)}get stateless(){return this.Ht}set stateless(n){this.Ht=n,n?this.setAttribute("stateless",""):this.removeAttribute("stateless")}get size(){return this.lt}set size(n){this.lt!==n&&(this.lt=n,this.Pt=void 0,this.removeAttribute("width"),this.setAttribute("size",n),this.syncChildComponents())}get width(){return this.Pt}set width(n){this.Pt!==n&&(this.Pt=n,n?(this.lt="md",this.removeAttribute("size"),this.setAttribute("width",n)):this.removeAttribute("width"),this.syncChildComponents())}get dayContentFn(){return this.qt}set dayContentFn(n){this.qt=n,this.syncChildComponents()}get customCSS(){return this.Rt}set customCSS(n){this.Rt=n,this.syncChildComponents()}get value(){const{selectedYear:n,selectedMonth:t,selectedDay:e}=this.dt;return n&&t&&e?Ie(n,t,e):""}set value(n){if(n){const t=n.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(t){const n=parseInt(t[1],10),e=parseInt(t[2],10),o=parseInt(t[3],10);this.dt.selectedYear=n,this.dt.selectedMonth=e,this.dt.selectedDay=o,this.dt.displayYear=n,this.dt.displayMonth=e,this.Ht||(this.setAttribute("year",""+n),this.setAttribute("month",""+e),this.setAttribute("day",""+o))}}else delete this.dt.selectedYear,delete this.dt.selectedMonth,delete this.dt.selectedDay,this.Ht||(this.removeAttribute("year"),this.removeAttribute("month"),this.removeAttribute("day"));this.syncChildComponents(),this.Ht||this.updateFormValue()}initializeFromAttributes(){const n=this.getAttribute("year"),t=this.getAttribute("month"),e=this.getAttribute("day"),o=this.getAttribute("locale"),i=this.getAttribute("show-navigation"),r=this.getAttribute("stateless"),s=this.getAttribute("size"),a=this.getAttribute("width"),l=De(n);l&&(this.dt.displayYear=l);const d=$e(t);if(d&&(this.dt.displayMonth=d),l&&d){const n=Ae(e,l,d);n&&(this.dt.selectedYear=l,this.dt.selectedMonth=d,this.dt.selectedDay=n)}o&&(this.Ot=o),i&&(this.Ft="false"!==i),null!==r&&(this.Ht="false"!==r),!s||"sm"!==s&&"md"!==s&&"lg"!==s||(this.lt=s),a&&(this.Pt=a)}syncStateFromAttributes(){const n=this.getAttribute("year"),t=this.getAttribute("month"),e=this.getAttribute("day"),o=De(n),i=$e(t);if(o&&(this.dt.displayYear=o),i&&(this.dt.displayMonth=i),o&&i){const n=Ae(e,o,i);n?(this.dt.selectedYear=o,this.dt.selectedMonth=i,this.dt.selectedDay=n):(delete this.dt.selectedYear,delete this.dt.selectedMonth,delete this.dt.selectedDay)}else delete this.dt.selectedYear,delete this.dt.selectedMonth,delete this.dt.selectedDay}syncChildComponents(){if(this.jt&&(this.jt.displayMonth=this.dt.displayMonth,this.jt.displayYear=this.dt.displayYear,this.jt.locale=this.locale,this.jt.size=this.lt,this.jt.width=this.Pt),this.Wt){this.Wt.displayMonth=this.dt.displayMonth,this.Wt.displayYear=this.dt.displayYear,this.Wt.locale=this.locale,this.Wt.size=this.lt,this.Wt.width=this.Pt,this.qt&&(this.Wt.dayContentFn=this.qt),this.Rt&&(this.Wt.customCSS=this.Rt);const{selectedYear:n,selectedMonth:t,selectedDay:e}=this.dt;this.Wt.value=n&&t&&e?new Date(n,t-1,e).getTime():null}}updateFormValue(){if(this.Ht)return;if(!this.m)return;const n=this.getAttribute("name"),{selectedYear:t,selectedMonth:e,selectedDay:o}=this.dt;if(n&&t&&e&&o){const n=Ie(t,e,o);this.m.setFormValue(n)}else this.m.setFormValue("")}handleNavigationChange(n){n.preventDefault(),n.stopPropagation();const{month:t,year:e}=n.detail;this.dt.displayMonth=t,this.dt.displayYear=e,this.syncChildComponents(),this.dispatchEvent(new CustomEvent("navigate",{detail:{month:t,year:e,action:"navigate",source:"navigation"},bubbles:!0,composed:!0,cancelable:!1}))}handleDayClick(n){n.preventDefault(),n.stopPropagation();const{dayContext:t,year:e,month:o,day:i}=n.detail;this.Ht?this.dispatchEvent(new CustomEvent("day-click",{detail:n.detail,bubbles:!0,composed:!0,cancelable:!0})):(this.dt.selectedYear=e,this.dt.selectedMonth=o,this.dt.selectedDay=i,this.dt.displayYear=e,this.dt.displayMonth=o,this.setAttribute("year",""+e),this.setAttribute("month",""+o),this.setAttribute("day",""+i),this.updateFormValue(),this.syncChildComponents(),this.dispatchEvent(new CustomEvent("change",{detail:{year:e,month:o,day:i,action:"select",source:"day-click",dayContext:t},bubbles:!0,composed:!0,cancelable:!1})))}refresh(){this.syncChildComponents(),this.Wt&&"function"==typeof this.Wt.refresh&&this.Wt.refresh()}createNavigation(){const n=document.createElement("ty-calendar-navigation");return n.displayMonth=this.dt.displayMonth,n.displayYear=this.dt.displayYear,n.locale=this.locale,n.size=this.lt,this.Pt&&(n.width=this.Pt),n.addEventListener("change",n=>this.handleNavigationChange(n)),this.jt=n,n}createMonthDisplay(){const n=document.createElement("ty-calendar-month");n.displayMonth=this.dt.displayMonth,n.displayYear=this.dt.displayYear,n.locale=this.locale,n.size=this.lt,this.Pt&&(n.width=this.Pt);const{selectedYear:t,selectedMonth:e,selectedDay:o}=this.dt;return t&&e&&o&&(n.value=new Date(t,e-1,o).getTime()),this.qt&&(n.dayContentFn=this.qt),this.Rt&&(n.customCSS=this.Rt),n.addEventListener("day-click",n=>this.handleDayClick(n)),this.Wt=n,n}render(){const n=this.shadowRoot;if(!n)return;r(n,{css:"\n/* ============================================================================\n Calendar Container\n ============================================================================ */\n\n.calendar-container {\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n box-sizing: border-box;\n font-family: system-ui, sans-serif;\n}\n\n/* ============================================================================\n Responsive Adjustments\n ============================================================================ */\n\n@media (max-width: 320px) {\n .calendar-container {\n gap: 0.375rem;\n }\n}\n",id:"ty-calendar"}),n.innerHTML="";const t=document.createElement("div");if(t.className="calendar-container",this.Ft){const n=this.createNavigation();t.appendChild(n)}const e=this.createMonthDisplay();t.appendChild(e),n.appendChild(t)}};Oe.formAssociated=!0;let Le=Oe;customElements.get("ty-calendar")||customElements.define("ty-calendar",Le);const Ne='\n/* Date Picker Component Styles */\n:host {\n display: block;\n width: auto;\n min-width: 200px;\n\n /* ==========================================================================\n Theming Tokens — Date Picker Stub\n Thin shim over --ty-input-*. Override these to retheme just the date-picker\n trigger without affecting other inputs.\n ========================================================================== */\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\n /* ==========================================================================\n Theming Tokens — Calendar Popup Surface\n Shared with ty-calendar / ty-calendar-month theming.\n ========================================================================== */\n --ty-calendar-surface-bg: var(--ty-surface-floating);\n --ty-calendar-surface-border: var(--ty-input-border);\n --ty-calendar-surface-shadow: 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\n /* ==========================================================================\n Theming Tokens — Time Section\n ========================================================================== */\n --ty-calendar-time-bg: var(--ty-bg-neutral-faint);\n --ty-calendar-time-border: var(--ty-input-border);\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\n/* Container structure (reuses dropdown patterns) */\n.dropdown-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n box-sizing: border-box;\n}\n\n.dropdown-label {\n font-size: 14px;\n font-weight: 500;\n color: var(--ty-label-color);\n margin-bottom: 6px;\n line-height: 1.25;\n padding-left: 12px;\n}\n\n.required-icon {\n display: inline-flex;\n align-items: center;\n color: #ef4444;\n width: 12px;\n height: 12px;\n vertical-align: middle;\n margin-left: 4px;\n}\n\n.dropdown-wrapper {\n position: relative;\n display: block;\n width: 100%;\n}\n\n/* Start-slot icon (leading content inside the date-picker stub) */\n.date-picker-stub ::slotted([slot="start"]) {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n margin-right: 0.5rem;\n color: var(--ty-color-text-soft);\n}\n\n.date-picker-stub ::slotted(ty-icon[slot="start"]) {\n width: 1em;\n height: 1em;\n}\n\n/* Date picker stub (styled like dropdown) */\n.date-picker-stub {\n width: 100%;\n cursor: pointer;\n box-sizing: border-box;\n position: relative;\n display: flex;\n align-items: center;\n background: var(--ty-date-picker-bg);\n color: var(--ty-date-picker-color);\n border: 1px solid var(--ty-date-picker-border);\n border-radius: var(--ty-date-picker-radius);\n font-family: var(--ty-font-sans);\n font-size: var(--ty-font-sm);\n font-weight: var(--ty-font-normal);\n line-height: var(--ty-line-height-tight);\n min-height: var(--ty-size-md);\n padding: var(--ty-spacing-2) var(--ty-spacing-3);\n padding-right: calc(var(--ty-spacing-3) + 1rem + var(--ty-spacing-2));\n transition: var(--ty-transition-all), opacity 0.2s ease;\n outline: none;\n}\n\n.date-picker-stub:hover:not([disabled]):not(.open) {\n border-color: var(--ty-date-picker-border-hover);\n}\n\n.date-picker-stub[disabled] {\n background-color: var(--ty-date-picker-disabled-bg);\n color: var(--ty-date-picker-disabled-color);\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.date-picker-stub:focus,\n.date-picker-stub.open {\n border-color: var(--ty-date-picker-border-focus);\n box-shadow: 0 0 0 3px var(--ty-date-picker-shadow-focus);\n}\n\n/* Size variants */\n.date-picker-stub.xs {\n min-height: var(--ty-size-xs);\n font-size: var(--ty-font-xs);\n padding: var(--ty-spacing-1) var(--ty-spacing-2);\n padding-right: calc(var(--ty-spacing-2) + 0.875rem + var(--ty-spacing-1));\n}\n\n.date-picker-stub.sm {\n min-height: var(--ty-size-sm);\n font-size: var(--ty-font-xs);\n padding: var(--ty-spacing-1) var(--ty-spacing-2);\n padding-right: calc(var(--ty-spacing-2) + 0.875rem + var(--ty-spacing-1));\n}\n\n.date-picker-stub.lg {\n min-height: var(--ty-size-lg);\n font-size: var(--ty-font-base);\n padding: var(--ty-spacing-2) var(--ty-spacing-4);\n padding-right: calc(var(--ty-spacing-4) + 1.125rem + var(--ty-spacing-2));\n}\n\n.date-picker-stub.xl {\n min-height: var(--ty-size-xl);\n font-size: var(--ty-font-lg);\n padding: var(--ty-spacing-3) var(--ty-spacing-4);\n padding-right: calc(var(--ty-spacing-4) + 1.25rem + var(--ty-spacing-3));\n}\n\n/* Flavor variants */\n/* Primary - Main brand focus state */\n.date-picker-stub.primary {\n border-color: var(--ty-input-primary-border, var(--ty-color-primary));\n}\n\n.date-picker-stub.primary:hover:not([disabled]) {\n border-color: var(--ty-color-primary-mild);\n}\n\n.date-picker-stub.primary:focus,\n.date-picker-stub.primary.open {\n border-color: var(--ty-color-primary-mild);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n}\n\n/* Secondary - Supporting action focus state */\n.date-picker-stub.secondary {\n border-color: var(--ty-input-secondary-border, var(--ty-color-secondary));\n}\n\n.date-picker-stub.secondary:hover:not([disabled]) {\n border-color: var(--ty-color-secondary-mild);\n}\n\n.date-picker-stub.secondary:focus,\n.date-picker-stub.secondary.open {\n border-color: var(--ty-color-secondary-mild);\n box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);\n}\n\n/* Success - Valid/confirmed input state */\n.date-picker-stub.success {\n border-color: var(--ty-input-success-border, var(--ty-color-success));\n}\n\n.date-picker-stub.success:hover:not([disabled]) {\n border-color: var(--ty-color-success-mild);\n}\n\n.date-picker-stub.success:focus,\n.date-picker-stub.success.open {\n border-color: var(--ty-color-success-mild);\n box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);\n}\n\n/* Danger - Error/invalid input state */\n.date-picker-stub.danger {\n border-color: var(--ty-input-danger-border, var(--ty-color-danger));\n}\n\n.date-picker-stub.danger:hover:not([disabled]) {\n border-color: var(--ty-color-danger-mild);\n}\n\n.date-picker-stub.danger:focus,\n.date-picker-stub.danger.open {\n border-color: var(--ty-color-danger-mild);\n box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);\n}\n\n/* Warning - Caution/attention needed input state */\n.date-picker-stub.warning {\n border-color: var(--ty-input-warning-border, var(--ty-color-warning));\n}\n\n.date-picker-stub.warning:hover:not([disabled]) {\n border-color: var(--ty-color-warning-mild);\n}\n\n.date-picker-stub.warning:focus,\n.date-picker-stub.warning.open {\n border-color: var(--ty-color-warning-mild);\n box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);\n}\n\n/* Text content */\n.stub-text {\n flex: 1;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n user-select: none;\n color: inherit;\n pointer-events: none;\n}\n\n.stub-text.placeholder {\n color: var(--ty-date-picker-placeholder);\n}\n\n/* Icons */\n.stub-icons {\n display: flex;\n align-items: center;\n gap: var(--ty-spacing-1);\n position: absolute;\n right: var(--ty-spacing-3);\n top: 50%;\n transform: translateY(-50%);\n height: 1rem;\n pointer-events: none;\n z-index: 2;\n}\n\n.stub-clear {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 1rem;\n height: 1rem;\n padding: 0;\n border: none;\n background: none;\n color: var(--ty-color-neutral-soft);\n cursor: pointer;\n border-radius: var(--ty-radius-sm);\n transition: all 0.15s ease;\n pointer-events: auto;\n}\n\n.stub-clear:hover {\n color: var(--ty-color-negative);\n background-color: var(--ty-bg-negative-faint);\n}\n\n.stub-arrow {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 1rem;\n height: 1rem;\n color: var(--ty-color-neutral-soft);\n}\n\n.date-picker-stub:hover .stub-arrow {\n color: var(--ty-color-neutral);\n}\n\n.date-picker-stub:focus .stub-arrow,\n.date-picker-stub.open .stub-arrow {\n color: var(--ty-date-picker-border-focus);\n}\n\n/* Calendar dialog (showModal positioning system) */\n.calendar-dialog {\n position: fixed;\n flex-direction: column;\n max-width: 90vw;\n margin: 0;\n padding: 0;\n border: none;\n background: transparent;\n box-sizing: border-box;\n padding: var(--calendar-padding, 8px);\n\n /* Hidden by default */\n opacity: 0;\n transition: opacity 200ms ease;\n\n transform: translate(var(--calendar-offset-x, 0px), var(--calendar-offset-y, 0px));\n top: -1000px;\n left: -1000px;\n}\n\n/* Direction-based positioning with CSS classes */\n.calendar-dialog.position-below {\n left: var(--calendar-x);\n top: var(--calendar-y);\n}\n\n.calendar-dialog.position-above {\n left: var(--calendar-x);\n bottom: var(--calendar-y);\n top: auto;\n flex-direction: column-reverse;\n}\n\n.calendar-dialog.open {\n opacity: 1;\n}\n\n.calendar-dialog::backdrop {\n background: transparent\n}\n\n/* Calendar content container */\n.calendar-content {\n background-color: var(--ty-calendar-surface-bg);\n border: 1px solid var(--ty-calendar-surface-border);\n border-radius: var(--ty-calendar-surface-radius);\n box-shadow: var(--ty-calendar-surface-shadow);\n overflow: hidden;\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n/* Native date input for mobile */\n/* Native input is invisible — used only to trigger the OS picker */\n.native-date-input {\n position: absolute;\n inset: 0;\n opacity: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n border: none;\n cursor: pointer;\n z-index: 1;\n}\n\n.native-date-input::-webkit-calendar-picker-indicator {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n cursor: pointer;\n}\n\n/* Time input section */\n.time-section {\n display: flex;\n min-height: 2.5rem;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n padding: 0.5rem 1rem;\n border-top: 1px solid var(--ty-calendar-time-border);\n background-color: var(--ty-calendar-time-bg);\n width: 100%;\n box-sizing: border-box;\n position: relative;\n}\n\n.time-label {\n font-size: var(--ty-font-sm);\n font-weight: 500;\n color: var(--ty-calendar-time-label-color);\n flex-shrink: 0;\n}\n\n.time-input {\n width: 3.5rem;\n border: none;\n border-radius: var(--ty-radius-sm);\n background: transparent;\n color: var(--ty-calendar-time-input-color);\n font-family: var(--ty-font-sans);\n font-size: var(--ty-font-sm);\n text-align: center;\n outline: none;\n}\n\n.time-input::placeholder {\n color: var(--ty-calendar-time-placeholder-color);\n}\n\n.time-icon {\n display: flex;\n align-items: center;\n color: var(--ty-calendar-time-icon-color);\n width: 1rem;\n height: 1rem;\n flex-shrink: 0;\n}\n',qe="<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>",Re="<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>";function Pe(n,t){if(!n)return null;let e=null;if("string"==typeof n)if(/^\d{4}-\d{2}-\d{2}$/.test(n)){const[t,o,i]=n.split("-");e=new Date(parseInt(t,10),parseInt(o,10)-1,parseInt(i,10),0,0,0,0)}else e=new Date(n);else"number"==typeof n&&(e=new Date(n));return!e||isNaN(e.getTime())?null:{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:t?e.getHours():0,minute:t?e.getMinutes():0}}function Ve(n){const{year:t,month:e,day:o,hour:i,minute:r}=n;return t&&e&&o?new Date(t,e-1,o,i||0,r||0,0,0):null}function Be(n){if(!n.year||!n.month||!n.day)return null;const t=Ve(n);return t?t.toISOString():null}function Fe(n,t){if(!n.year||!n.month||!n.day)return null;const e=(""+n.year).padStart(4,"0"),o=(""+n.month).padStart(2,"0"),i=(""+n.day).padStart(2,"0");return t?`${e}-${o}-${i}T${(""+(n.hour||0)).padStart(2,"0")}:${(""+(n.minute||0)).padStart(2,"0")}`:`${e}-${o}-${i}`}function He(n,t){return`${(""+n).padStart(2,"0")}:${(""+t).padStart(2,"0")}`}function je(n){switch(n){case 0:return 1;case 1:return 3;case 3:return 4;case 4:case 5:return 5;default:return n}}class We{constructor(n,t,e=0,o=0){this.element=n,this.datePickerElement=t;const i=He(e,o);this.state={hour:e,minute:o,caretPosition:0,displayValue:i,rawDigits:(""+e).padStart(2,"0")+(""+o).padStart(2,"0")},this.element.value=i,this.setupEventListeners()}setupEventListeners(){this.element.addEventListener("keydown",n=>this.handleKeyDown(n)),this.element.addEventListener("input",n=>this.handleInput(n)),this.element.addEventListener("click",n=>this.handleClick(n)),this.element.addEventListener("focus",n=>this.handleFocus(n))}handleKeyDown(n){const t=n.key;switch(t){case"ArrowRight":this.handleArrowRight(n);break;case"ArrowLeft":this.handleArrowLeft(n);break;case"Backspace":this.handleBackspace(n);break;case"Delete":this.handleDelete(n);break;case"Home":n.preventDefault(),this.updateState({caretPosition:0});break;case"End":n.preventDefault(),this.updateState({caretPosition:5});break;case"Tab":break;default:/^\d$/.test(t)&&this.handleDigitInput(n,parseInt(t,10))}}handleInput(n){n.preventDefault()}handleClick(n){this.updateState({caretPosition:0})}handleFocus(n){this.updateState({caretPosition:0})}handleArrowRight(n){n.preventDefault();const t=je(this.state.caretPosition);this.updateState({caretPosition:t})}handleArrowLeft(n){n.preventDefault();const t=function(n){switch(n){case 5:return 4;case 4:return 3;case 3:return 1;case 1:case 0:return 0;default:return n}}(this.state.caretPosition);this.updateState({caretPosition:t})}handleDigitInput(n,t){n.preventDefault();const e=this.state.caretPosition;if(![0,1,3,4].includes(e))return;if(!function(n,t,e){switch(t){case 0:return 2>=n;case 1:return 2!==parseInt(e[0],10)||3>=n;case 3:return 5>=n;case 4:return!0;default:return!1}}(t,e,this.state.rawDigits))return;const o=this.replaceDigitAtPosition(e,t);if(!o)return;const i=je(e);this.updateState({...o,caretPosition:i}),this.notifyTimeChange()}handleBackspace(n){n.preventDefault();const t=this.state.caretPosition;if(0===t)return;const e=1===t?0:3===t?1:4===t?3:5===t?4:0,o=this.zeroDigitAtPosition(e);o&&(this.updateState({...o,caretPosition:e}),this.notifyTimeChange())}handleDelete(n){n.preventDefault();const t=this.state.caretPosition;if(![0,1,3,4].includes(t))return;const e=this.zeroDigitAtPosition(t);e&&(this.updateState({...e,caretPosition:t}),this.notifyTimeChange())}replaceDigitAtPosition(n,t){const e=function(n){switch(n){case 0:default:return 0;case 1:return 1;case 3:return 2;case 4:return 3}}(n),o=this.state.rawDigits.split("");o[e]=""+t;const i=o.join(""),r=function(n){if(!n||4!==n.length)return null;const t=n.substring(0,2),e=n.substring(2,4),o=parseInt(t,10),i=parseInt(e,10);return 0>o||o>23||0>i||i>59?null:{hour:o,minute:i}}(i);return r?{rawDigits:i,hour:r.hour,minute:r.minute,displayValue:He(r.hour,r.minute)}:null}zeroDigitAtPosition(n){return this.replaceDigitAtPosition(n,0)}updateState(n){this.state={...this.state,...n},this.element.value=this.state.displayValue;const t=this.state.caretPosition,e=0===t?0:1===t?1:2===t||3===t?3:4===t?4:5===t?5:t;this.element.setSelectionRange(e,e)}notifyTimeChange(){this.datePickerElement.handleTimeInputChange(this.state.hour,this.state.minute)}getTime(){return{hour:this.state.hour,minute:this.state.minute}}setTime(n,t){const e=He(n,t);this.state={...this.state,hour:n,minute:t,displayValue:e,rawDigits:(""+n).padStart(2,"0")+(""+t).padStart(2,"0")},this.element.value=e}}const Ye=class extends o{constructor(){super(),this.dt={withTime:!1,open:!1},this.Yt=0,r(this.shadowRoot,{css:Ne,id:"ty-date-picker"})}onConnect(){this.initializeState(),this.render(),this.Z=W(this,()=>{this.render()})}onDisconnect(){this.Z&&(this.Z(),this.Z=void 0),this.cleanup()}onPropertiesChanged(n){for(const{name:t,newValue:e}of n)switch(t){case"size":case"flavor":case"label":case"placeholder":case"required":case"disabled":case"clearable":case"format":case"locale":break;case"value":{const n=Pe(e,this.dt.withTime);if(null===n){(void 0!==this.dt.year||void 0!==this.dt.month||void 0!==this.dt.day)&&(this.dt={withTime:this.dt.withTime,open:this.dt.open});break}const t={year:this.dt.year,month:this.dt.month,day:this.dt.day,hour:this.dt.hour,minute:this.dt.minute};(n?.year!==t.year||n?.month!==t.month||n?.day!==t.day||n?.hour!==t.hour||n?.minute!==t.minute)&&(this.dt={...this.dt,...n});break}case"with-time":e!==this.dt.withTime&&(this.dt.withTime=e,void 0!==this.dt.year&&void 0!==this.dt.month&&void 0!==this.dt.day&&this.syncFormValue())}}getFormValue(){return Be(this.getComponents())}getComponents(){return{year:this.dt.year,month:this.dt.month,day:this.dt.day,hour:this.dt.hour,minute:this.dt.minute}}hasDate(){return!!(this.dt.year&&this.dt.month&&this.dt.day)}getFormattedValue(n){const t=n||this.getComponents();return t.year&&t.month&&t.day?function(n,t,e,o){if(!n.year||!n.month||!n.day)return null;const i=Ve(n);if(!i)return null;const r={dateStyle:t};return o&&(r.timeStyle="short"),new Intl.DateTimeFormat(e,r).format(i)}(t,this.getProperty("format")||"long",j(this,this.getProperty("locale")),this.dt.withTime):null}initializeState(){const n=this.getProperty("value"),t=this.getProperty("with-time"),e=Pe(n,t);this.dt=null===e?{withTime:t,open:!1}:{...e,withTime:t,open:!1},this.syncFormValue()}updateState(n,t=!1){this.dt={...this.dt,...n},(t||!this.dt.open||!this.dt.withTime)&&this.syncFormValue()}syncFormValue(){const n=this.getFormValue();n!==this.getProperty("value")&&this.setProperty("value",n||null)}handleTimeInputChange(n,t){if(!this.hasDate())return;const e={...this.getComponents(),hour:n,minute:t};this.updateState(e,!0),this.emitChangeEvent(e,"time-change")}emitChangeEvent(n,t){const e=n?Be(n):null,o=n?Fe(n,this.dt.withTime):null,i=n?Ve(n)?.getTime()??null:null,r=n?this.getFormattedValue(n):null,s=new CustomEvent("change",{detail:{value:e,localValue:o,milliseconds:i,formatted:r,source:t},bubbles:!0,cancelable:!0});this.dispatchEvent(s)}get size(){return this.getProperty("size")}set size(n){this.setProperty("size",n)}get flavor(){return this.getProperty("flavor")}set flavor(n){this.setProperty("flavor",n)}get label(){return this.getProperty("label")}set label(n){this.setProperty("label",n)}get placeholder(){return this.getProperty("placeholder")}set placeholder(n){this.setProperty("placeholder",n)}get name(){return this.getProperty("name")}set name(n){this.setProperty("name",n)}get format(){return this.getProperty("format")}set format(n){this.setProperty("format",n)}get locale(){return this.getProperty("locale")}set locale(n){this.setProperty("locale",n)}get required(){return this.getProperty("required")}set required(n){this.setProperty("required",n)}get disabled(){return this.getProperty("disabled")}set disabled(n){this.setProperty("disabled",n)}get clearable(){return this.getProperty("clearable")}set clearable(n){this.setProperty("clearable",n)}get withTime(){return this.getProperty("with-time")}set withTime(n){this.setProperty("with-time",n)}get value(){return this.getProperty("value")||null}set value(n){if(null==n||""===n)this.setProperty("value",null);else{const t=n instanceof Date?n.toISOString():n;this.setProperty("value",t)}}buildStubClasses(){const n=["date-picker-stub"],t=this.getProperty("size")||"md",e=this.getProperty("flavor");return n.push(t),e&&"default"!==e&&n.push(e),this.getProperty("disabled")&&n.push("disabled"),this.getProperty("required")&&n.push("required"),this.dt.open&&n.push("open"),n.join(" ")}renderStub(){const n=document.createElement("div");n.className=this.buildStubClasses();const t=this.getProperty("disabled");t&&n.setAttribute("disabled","true");const e=document.createElement("slot");e.name="start";const o=document.createElement("span");o.className="stub-text";const i=this.getFormattedValue(),r=this.getProperty("placeholder")||"Select date...";o.textContent=i||r,i||o.classList.add("placeholder");const s=document.createElement("div");if(s.className="stub-icons",this.getProperty("clearable")&&i&&!t){const n=document.createElement("button");n.className="stub-clear",n.type="button",n.innerHTML=Re,n.addEventListener("click",n=>this.handleClearClick(n)),s.appendChild(n)}const a=document.createElement("span");return a.className="stub-arrow",a.innerHTML=qe,s.appendChild(a),n.addEventListener("click",n=>this.handleStubClick(n)),n.appendChild(e),n.appendChild(o),n.appendChild(s),n}createTimeInputElement(){const n=document.createElement("input");return n.type="text",n.className="time-input",n.placeholder="HH:mm",n.autocomplete="off",n.maxLength=5,n}renderTimeSection(){const n=document.createElement("div");n.className="time-section";const t=document.createElement("label");t.className="time-label",t.textContent="Time:";const e=this.createTimeInputElement();this._t=new We(e,this,this.dt.hour||0,this.dt.minute||0);const o=document.createElement("span");return o.className="time-icon",o.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>",n.appendChild(t),n.appendChild(e),n.appendChild(o),n}renderCalendarDropdown(){const n=document.createElement("dialog");n.className="calendar-dialog";const t=document.createElement("div");t.className="calendar-content";const e=document.createElement("ty-calendar");this.dt.year&&this.dt.month&&this.dt.day&&(e.setAttribute("year",""+this.dt.year),e.setAttribute("month",""+this.dt.month),e.setAttribute("day",""+this.dt.day));const o=j(this,this.getProperty("locale"));return o&&e.setAttribute("locale",o),e.addEventListener("change",n=>this.handleCalendarChange(n)),t.appendChild(e),this.dt.withTime&&t.appendChild(this.renderTimeSection()),n.appendChild(t),n.addEventListener("close",()=>{this.updateState({open:!1})}),n}renderNativeInput(){const n=document.createElement("div");n.className="dropdown-wrapper";const t=document.createElement("div");t.className=this.buildStubClasses();const e=this.getProperty("disabled");e&&t.setAttribute("disabled","true");const o=document.createElement("input");o.className="native-date-input",o.type=this.dt.withTime?"datetime-local":"date",e&&(o.disabled=!0),this.getProperty("required")&&(o.required=!0);const i=Fe(this.getComponents(),this.dt.withTime);i&&(o.value=i);const r=this.getProperty("placeholder")||"Select date...",s=this.getFormattedValue(),a=document.createElement("span");a.className="stub-text"+(s?"":" placeholder"),a.textContent=s||r,o.addEventListener("change",()=>{if(!o.value)return void this.clearValue();const n=Pe(o.value,this.dt.withTime);n&&(this.updateState(n,!0),this.emitChangeEvent(n,"selection"))});const l=document.createElement("slot");l.name="start",t.appendChild(l),t.appendChild(o),t.appendChild(a);const d=document.createElement("div");if(d.className="stub-icons",this.getProperty("clearable")&&i&&!e){const n=document.createElement("button");n.className="stub-clear",n.type="button",n.innerHTML=Re,n.addEventListener("click",n=>this.handleClearClick(n)),d.appendChild(n)}const c=document.createElement("span");return c.className="stub-arrow",c.innerHTML=qe,d.appendChild(c),t.appendChild(d),n.appendChild(t),n}calculateCalendarPosition(){if(!this.shadowRoot)return;if(B())return;const n=this.shadowRoot.querySelector(".date-picker-stub"),t=this.shadowRoot.querySelector(".calendar-dialog");if(!n||!t)return;const e=n.getBoundingClientRect(),o=window.innerHeight,i=window.innerWidth,r=e.top,s=o-e.bottom>=400,a=e.width>i-e.left?Math.max(0,i-e.width-0):e.left-8,l=s?e.bottom:400>r?Math.max(0,Math.min(e.bottom,o-400-0)):o-e.top;this.style.setProperty("--calendar-x",a+"px"),this.style.setProperty("--calendar-y",l+"px"),this.style.setProperty("--calendar-offset-x","0px"),this.style.setProperty("--calendar-offset-y","0px"),s?(t.classList.add("position-below"),t.classList.remove("position-above")):(t.classList.add("position-above"),t.classList.remove("position-below"))}renderContainer(){const n=document.createElement("div");n.className="dropdown-container";const t=this.getProperty("label");if(t){const e=document.createElement("label");e.className="dropdown-label",e.innerHTML=t+(this.getProperty("required")?'<span class="required-icon">*</span>':""),n.appendChild(e)}return n}render(){if(!this.shadowRoot)return;if(r(this.shadowRoot,{css:Ne,id:"ty-date-picker"}),B()){if(this.shadowRoot.querySelector(".native-date-input"))return void this.updateDisplay();this.shadowRoot.innerHTML="";const n=this.renderContainer();return n.appendChild(this.renderNativeInput()),void this.shadowRoot.appendChild(n)}const n=this.shadowRoot.querySelector(".calendar-dialog");if(n&&n.open&&this.dt.open)return this.updateDisplay(),void this.calculateCalendarPosition();this.shadowRoot.innerHTML="";const t=this.renderContainer(),e=document.createElement("div");e.className="dropdown-wrapper",e.appendChild(this.renderStub()),e.appendChild(this.renderCalendarDropdown()),t.appendChild(e),this.shadowRoot.appendChild(t),this.setupEventListeners()}updateDisplay(){if(!this.shadowRoot)return;const n=this.getFormattedValue(),t=this.getProperty("placeholder")||"Select date...",e=this.hasDate(),o=this.getProperty("clearable"),i=this.getProperty("disabled"),r=this.shadowRoot.querySelector(".stub-text");r&&(r.textContent=n||t,r.classList.toggle("placeholder",!n));const s=this.shadowRoot.querySelector(".stub-clear");if(s&&(s.style.display=o&&e&&!i?"":"none"),B()){const n=this.shadowRoot.querySelector(".native-date-input");if(n){const t=Fe(this.getComponents(),this.dt.withTime);n.value=t||""}return}const a=this.shadowRoot.querySelector("ty-calendar");a&&e&&(a.setAttribute("year",""+this.dt.year),a.setAttribute("month",""+this.dt.month),a.setAttribute("day",""+this.dt.day)),this._t&&void 0!==this.dt.hour&&void 0!==this.dt.minute&&this._t.setTime(this.dt.hour,this.dt.minute)}setupEventListeners(){this.Ut&&document.removeEventListener("click",this.Ut),this.Gt&&document.removeEventListener("keydown",this.Gt),this.Ut=n=>this.handleOutsideClick(n),this.Gt=n=>this.handleEscapeKey(n),document.addEventListener("click",this.Ut),document.addEventListener("keydown",this.Gt);const n=this.shadowRoot?.querySelector(".calendar-dialog");n&&(this.Xt=n=>this.handleDialogClick(n),n.addEventListener("click",this.Xt))}handleStubClick(n){n.preventDefault(),!this.getProperty("disabled")&&Date.now()-this.Yt>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(n){n.preventDefault(),n.stopPropagation(),this.clearValue()}handleCalendarChange(n){n.preventDefault(),n.stopPropagation();const t=n.detail.dayContext;if(!t)return;const e={year:t.year,month:t.month,day:t.dayInMonth,hour:this.dt.hour,minute:this.dt.minute};this.updateState(e,!0),this.emitChangeEvent(e,"selection"),this.dt.withTime?requestAnimationFrame(()=>{if(!this.shadowRoot)return;const n=this.shadowRoot.querySelector(".time-input");n&&n.focus()}):this.closeDropdown()}handleDialogClick(n){if(!this.shadowRoot)return;const t=this.shadowRoot.querySelector(".calendar-dialog"),e=this.shadowRoot.querySelector(".calendar-content");n.target===t&&this.dt.open&&e&&!e.contains(n.target)&&(n.preventDefault(),n.stopPropagation(),this.closeDropdown())}handleOutsideClick(n){if(!this.shadowRoot)return;const t=n.target,e=this.shadowRoot.querySelector(".calendar-dialog");this.dt.open&&e&&!this.contains(t)&&!e.contains(t)&&this.closeDropdown()}handleEscapeKey(n){"Escape"===n.key&&this.dt.open&&(n.preventDefault(),this.closeDropdown())}openDropdown(){this.dt.open||B()||(this.updateState({open:!0}),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.render(),requestAnimationFrame(()=>{if(!this.shadowRoot)return;const n=this.shadowRoot.querySelector(".calendar-dialog");if(n){Un("date-picker-"+(this.id||""+this)),n.showModal(),this.calculateCalendarPosition(),n.classList.add("open");const t=this.shadowRoot.activeElement;t&&t.blur()}}))}closeDropdown(){if(!this.dt.open)return;this.Yt=Date.now();const n="date-picker-"+(this.id||""+this);if(this.updateState({open:!1},!0),Gn(n),this.shadowRoot){const n=this.shadowRoot.querySelector(".calendar-dialog");n&&(n.classList.remove("position-above","position-below","open"),n.close())}this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})),this.render()}cleanup(){if(this.Ut&&document.removeEventListener("click",this.Ut),this.Gt&&document.removeEventListener("keydown",this.Gt),this.Xt&&this.shadowRoot){const n=this.shadowRoot.querySelector(".calendar-dialog");n&&n.removeEventListener("click",this.Xt)}this.dt.open&&Gn("date-picker-"+(this.id||""+this)),this.Ut=void 0,this.Gt=void 0,this.Xt=void 0,this._t=void 0}};Ye.properties={size:{type:"string",visual:!0,default:"md",validate:n=>["xs","sm","md","lg","xl"].includes(n),coerce:n=>["xs","sm","md","lg","xl"].includes(n)?n:"md"},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:""},required:{type:"boolean",visual:!0,default:!1},disabled:{type:"boolean",visual:!0,default:!1},clearable:{type:"boolean",visual:!0,default:!0,aliases:{"not-clearable":!1}},format:{type:"string",visual:!0,default:"long",validate:n=>["short","medium","long","full"].includes(n),coerce:n=>["short","medium","long","full"].includes(n)?n:"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}},Ye.formAssociated=!0;let _e=Ye;customElements.get("ty-date-picker")||customElements.define("ty-date-picker",_e);const Ue=new Map,Ge=new Map;function Xe(n){return Ue.get(n)}function Ke(n,t){Ge.has(n)||Ge.set(n,new Set),Ge.get(n).add(t);const e=Ue.get(n);return e&&t(e),()=>{Ge.get(n)?.delete(t),0===Ge.get(n)?.size&&Ge.delete(n)}}function Ze(){return Object.fromEntries(Ue)}class TyResizeObserver extends HTMLElement{constructor(){super(),this.xn=null,this.Kt=null;const n=this.attachShadow({mode:"open"});r(n,{css:"\n:host {\n /* Default to block display, user can override */\n display: block;\n /* Ensure the component can participate in layout */\n position: relative;\n}\n\n/* Slot content styling */\n::slotted(*) {\n /* No default styling - preserve natural layout */\n}\n",id:"ty-resize-observer"}),n.innerHTML="<slot></slot>"}static get observedAttributes(){return["id","debounce"]}get debounce(){return parseInt(this.getAttribute("debounce")||"0")}set debounce(n){this.setAttribute("debounce",n+"")}connectedCallback(){this.setupObserver()}disconnectedCallback(){this.cleanup()}setupObserver(){this.xn=new ResizeObserver(n=>{this.debounce>0?(this.Kt&&clearTimeout(this.Kt),this.Kt=window.setTimeout(()=>{this.handleResize(n)},this.debounce)):this.handleResize(n)}),this.xn.observe(this)}handleResize(n){const{width:t,height:e}=n[0].contentRect;this.id&&function(n,t,e){Ue.set(n,{width:t,height:e});const o=Ge.get(n);if(o){const n={width:t,height:e};o.forEach(t=>t(n))}}(this.id,t,e)}cleanup(){var n;this.xn&&(this.xn.disconnect(),this.xn=null),this.Kt&&(clearTimeout(this.Kt),this.Kt=null),this.id&&(Ue.delete(n=this.id),Ge.delete(n))}}customElements.define("ty-resize-observer",TyResizeObserver);const Je=`\n:host {\n display: block;\n position: relative;\n overflow: hidden;\n}\n\n.scroll-wrapper {\n width: 100%;\n height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n}\n\n/* Allow horizontal scrolling when enabled */\n:host([overflow-x]) .scroll-wrapper {\n overflow-x: auto;\n}\n\n:host([max-height]) .scroll-wrapper {\n max-height: var(--scroll-max-height);\n}\n\n/* ===================================== */\n/* hide-scrollbar: hides native, no custom */\n/* ===================================== */\n\n:host([hide-scrollbar]) .scroll-wrapper {\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n:host([hide-scrollbar]) .scroll-wrapper::-webkit-scrollbar {\n display: none;\n}\n\n/* ===================================== */\n/* custom-scrollbar: hides native */\n/* ===================================== */\n\n:host([custom-scrollbar]) .scroll-wrapper {\n scrollbar-width: none;\n -ms-overflow-style: none;\n}\n\n:host([custom-scrollbar]) .scroll-wrapper::-webkit-scrollbar {\n display: none;\n}\n\n/* Show scrollbar tracks on host hover */\n:host([custom-scrollbar]:hover) .ty-scrollbar-track-y.has-overflow,\n:host([custom-scrollbar]:hover) .ty-scrollbar-track-x.has-overflow {\n opacity: 1;\n}\n\n/* Corner gap when both axes are present */\n:host([custom-scrollbar][overflow-x]) .ty-scrollbar-track-y {\n bottom: var(--ty-scrollbar-width, 8px);\n}\n\n:host([custom-scrollbar]) .ty-scrollbar-track-x {\n right: var(--ty-scrollbar-width, 8px);\n}\n\n/* ===================================== */\n/* Shadow Indicators */\n/* ===================================== */\n\n.shadow-overlay {\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: 2;\n}\n\n.shadow-top,\n.shadow-bottom,\n.shadow-left,\n.shadow-right {\n position: absolute;\n opacity: 0;\n transition: var(--ty-scroll-shadow-transition, opacity 0.2s ease-out);\n pointer-events: none;\n}\n\n.shadow-top {\n top: -40px;\n left: 0;\n right: 0;\n height: 80px;\n background: var(--ty-scroll-shadow-top, radial-gradient(\n ellipse 100% 30% at center,\n rgba(0, 0, 0, 0.1),\n rgba(0, 0, 0, 0),\n transparent\n ));\n clip-path: inset(50% 0 0 0);\n}\n\n.shadow-bottom {\n bottom: -30px;\n left: 0;\n right: 0;\n height: 60px;\n background: var(--ty-scroll-shadow-bottom, radial-gradient(\n ellipse 100% 20% at center,\n rgba(0, 0, 0, 0.15),\n rgba(0, 0, 0, 0),\n transparent\n ));\n clip-path: inset(0 0 50% 0);\n}\n\n.shadow-left {\n left: -30px;\n top: 0;\n bottom: 0;\n width: 60px;\n background: var(--ty-scroll-shadow-left, radial-gradient(\n ellipse 30% 100% at center,\n rgba(0, 0, 0, 0.1),\n rgba(0, 0, 0, 0),\n transparent\n ));\n clip-path: inset(0 0 0 50%);\n}\n\n.shadow-right {\n right: -30px;\n top: 0;\n bottom: 0;\n width: 60px;\n background: var(--ty-scroll-shadow-right, radial-gradient(\n ellipse 30% 100% at center,\n rgba(0, 0, 0, 0.1),\n rgba(0, 0, 0, 0),\n transparent\n ));\n clip-path: inset(0 50% 0 0);\n}\n\n.shadow-left,\n.shadow-right {\n display: none;\n}\n\n:host([overflow-x]) .shadow-left,\n:host([overflow-x]) .shadow-right {\n display: block;\n}\n\n.shadow-top.visible,\n.shadow-bottom.visible,\n.shadow-left.visible,\n.shadow-right.visible {\n opacity: 1;\n}\n\n:host([shadow="false"]) .shadow-overlay {\n display: none;\n}\n\n/* Touch devices - restore native scrollbar */\n@media (pointer: coarse) and (hover: none) {\n :host([custom-scrollbar]) .scroll-wrapper {\n scrollbar-width: thin;\n scrollbar-color: var(--ty-border, rgba(0,0,0,0.2)) transparent;\n }\n :host([custom-scrollbar]) .scroll-wrapper::-webkit-scrollbar {\n display: block;\n width: 4px;\n height: 4px;\n }\n :host([custom-scrollbar]) .scroll-wrapper::-webkit-scrollbar-thumb {\n background: var(--ty-border, rgba(0,0,0,0.2));\n border-radius: 2px;\n }\n}\n\n/* Respect reduced motion */\n@media (prefers-reduced-motion: reduce) {\n .shadow-top,\n .shadow-bottom,\n .shadow-left,\n .shadow-right {\n transition-duration: 0ms !important;\n }\n}\n\n/* Shared scrollbar styles */\n${yn}\n`;class TyScrollContainer extends HTMLElement{constructor(){super(),this.Zt=null,this.Jt=null,this.Qt=null,this.ne=null,this.te=null,this.Kn=null,this.xn=null,this.fn=null,this.En=()=>{null===this.fn&&(this.fn=requestAnimationFrame(()=>{this.fn=null,this.ee()}))},this.oe=()=>{this.Kn?.update(),this.ee()};const n=this.attachShadow({mode:"open"});r(n,{css:Je,id:"ty-scroll-container"}),n.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.Zt=n.querySelector(".scroll-wrapper"),this.Jt=n.querySelector(".shadow-top"),this.Qt=n.querySelector(".shadow-bottom"),this.ne=n.querySelector(".shadow-left"),this.te=n.querySelector(".shadow-right")}static get observedAttributes(){return["shadow","max-height","hide-scrollbar","custom-scrollbar","overflow-x"]}get shadow(){return"false"!==this.getAttribute("shadow")}set shadow(n){n?this.removeAttribute("shadow"):this.setAttribute("shadow","false")}get maxHeight(){return this.getAttribute("max-height")}set maxHeight(n){n?this.setAttribute("max-height",n):this.removeAttribute("max-height"),this.ie()}get hideScrollbar(){return this.hasAttribute("hide-scrollbar")}set hideScrollbar(n){n?this.setAttribute("hide-scrollbar",""):this.removeAttribute("hide-scrollbar")}get customScrollbar(){return this.hasAttribute("custom-scrollbar")}set customScrollbar(n){n?this.setAttribute("custom-scrollbar",""):this.removeAttribute("custom-scrollbar")}get overflowX(){return this.hasAttribute("overflow-x")}set overflowX(n){n?this.setAttribute("overflow-x",""):this.removeAttribute("overflow-x")}connectedCallback(){if(this.Zt?.addEventListener("scroll",this.En,{passive:!0}),this.xn=new ResizeObserver(()=>{this.Kn?.update(),this.ee()}),this.Zt){this.xn.observe(this.Zt);const n=this.Zt.querySelector("slot");n&&n.addEventListener("slotchange",this.oe)}this.ie(),this.ee(),this.Jn()}disconnectedCallback(){this.Zt?.removeEventListener("scroll",this.En),this.Zn(),this.xn&&(this.xn.disconnect(),this.xn=null),null!==this.fn&&(cancelAnimationFrame(this.fn),this.fn=null)}attributeChangedCallback(n,t,e){t!==e&&("max-height"===n&&(this.ie(),this.ee(),this.Kn?.update()),"custom-scrollbar"!==n&&"overflow-x"!==n||(this.Zn(),this.Jn(),this.ee()))}Jn(){if(!this.Zt||!this.customScrollbar)return;this.Kn=new mn(this.Zt,{vertical:!0,horizontal:this.overflowX});const n=this.shadowRoot;this.Kn.trackY&&n.appendChild(this.Kn.trackY),this.Kn.trackX&&n.appendChild(this.Kn.trackX)}Zn(){this.Kn&&(this.Kn.trackY?.remove(),this.Kn.trackX?.remove(),this.Kn.destroy(),this.Kn=null)}ie(){if(this.Zt){const n=this.maxHeight;n?(this.Zt.style.setProperty("--scroll-max-height",n),this.Zt.style.maxHeight=n):(this.Zt.style.removeProperty("--scroll-max-height"),this.Zt.style.maxHeight="")}}ee(){if(!this.Zt)return;const{scrollTop:n,scrollLeft:t,scrollHeight:e,scrollWidth:o,clientHeight:i,clientWidth:r}=this.Zt;this.Jt&&this.Jt.classList.toggle("visible",n>2),this.Qt&&this.Qt.classList.toggle("visible",e-2>n+i),this.overflowX&&(this.ne&&this.ne.classList.toggle("visible",t>2),this.te&&this.te.classList.toggle("visible",o-2>t+r))}updateShadows(){this.ee(),this.Kn?.update()}scrollToTop(n=!0){this.Zt?.scrollTo({top:0,behavior:n?"smooth":"auto"})}scrollToBottom(n=!0){this.Zt&&this.Zt.scrollTo({top:this.Zt.scrollHeight,behavior:n?"smooth":"auto"})}scrollToLeft(n=!0){this.Zt?.scrollTo({left:0,behavior:n?"smooth":"auto"})}scrollToRight(n=!0){this.Zt&&this.Zt.scrollTo({left:this.Zt.scrollWidth,behavior:n?"smooth":"auto"})}get scrollElement(){return this.Zt}}customElements.define("ty-scroll-container",TyScrollContainer),"undefined"!=typeof window&&(window.tyVersion=p,window.tyIcons={register:n=>{C(n)},get:n=>S(n),has:n=>E(n),list:()=>A(),cacheInfo:()=>I(),clearCache:()=>T()},window.tyResizeObserver={getSize:n=>Xe(n),onResize:(n,t)=>Ke(n,t),get sizes(){return Ze()}},window.tyLoader={set:n=>a(n),get:()=>l(),reset:()=>d()}),n.IconRegistry=O,n.TyButton=h,n.TyCalendar=Le,n.TyCalendarMonth=TyCalendarMonth,n.TyCalendarNavigation=Me,n.TyCheckbox=J,n.TyCopy=pn,n.TyDatePicker=_e,n.TyDropdown=$t,n.TyFileUpload=bn,n.TyIcon=R,n.TyInput=U,n.TyModal=TyModal,n.TyMultiselect=Pt,n.TyOption=TyOption,n.TyPopup=TyPopup,n.TyRadio=sn,n.TyRadioGroup=ln,n.TyResizeObserver=TyResizeObserver,n.TyScrollContainer=TyScrollContainer,n.TyStep=TyStep,n.TySwitch=tn,n.TyTab=TyTab,n.TyTabs=TyTabs,n.TyTag=V,n.TyTextarea=xn,n.TyTooltip=TyTooltip,n.TyWizard=TyWizard,n.disableScrollLockDebug=function(){window.tyScrollDebug=!1},n.enableScrollLockDebug=function(){window.tyScrollDebug=!0},n.forceUnlockAll=function(){Wn.activeLocks.clear(),_n()},n.getActiveLocks=function(){return new Set(Wn.activeLocks)},n.getAllSizes=Ze,n.getLoaderSvg=l,n.getLockState=function(){return{locked:Wn.locked,scrollY:Wn.scrollY,activeLocks:Array.from(Wn.activeLocks)}},n.getSize=Xe,n.isLocked=function(){return Wn.locked},n.isLockedBy=function(n){return Wn.activeLocks.has(n)},n.lockScroll=Un,n.onResize=Ke,n.resetLoaderSvg=d,n.setLoaderSvg=a,n.unlockScroll=Gn,Object.defineProperty(n,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}}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())})}function u(t){const n=a;a=!0;try{return t()}finally{a=n}}const p=["requestSubmit","reportValidity"],b=new WeakMap,g=new WeakSet;function m(t){g.has(t)||(g.add(t),t.addEventListener("invalid",t=>{if(!a)return;const n=t.target,e=n.form?v(n.form):void 0;e&&e!==n&&y(e)&&t.preventDefault()},!0))}function v(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 f=new WeakSet;function y(t){return f.has(t)&&"error"in t}class w{constructor(t,n){this.host=t,this.internals=n,this.own={flags:{}},this.custom="",this.written=null,this.shown=[],this.form=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),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),m(document)}(),f.add(t),t.addEventListener("invalid",()=>{this.anchor&&!this.shown.includes(this.anchor)&&(this.shown=[...this.shown.slice(-1),this.anchor])}),t.addEventListener("invalid",n=>{if(!y(t))return;if(m(t.getRootNode()),n.preventDefault(),this.showError(),!a)return;const e=this.internals.form;e&&v(e)!==t||t.focus()})}track(){const t=y(this.host)?this.internals.form:null;if(t===this.form)return;const n=this.form&&b.get(this.form);if(n){n.fields.delete(this);for(const t of n.fields)t.internals.form!==this.form&&n.fields.delete(t);0===n.fields.size&&function(t,n){b.delete(t);for(const e of p){const i=n.ours[e];i&&Object.getOwnPropertyDescriptor(t,e)?.value===i.fn&&(i.replaced?Object.defineProperty(t,e,i.replaced):delete t[e])}}(this.form,n)}this.form=t,t&&function(t){let n=b.get(t);if(n)return n;n={fields:new Set,ours:{}},b.set(t,n);for(const e of p){if("function"!=typeof t[e])continue;const i=Object.getOwnPropertyDescriptor(t,e),o=i?t[e]:void 0,r=function(...n){const i=o??Object.getPrototypeOf(t)[e];return u(()=>i.apply(this,n))};Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0,enumerable:!1}),n.ours[e]={fn:r,replaced:i}}return n}(t).fields.add(this)}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;this.anchor=e;const 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 x={};function k(t,n,e=""){const i=x[t]??(x[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 z(t){if(null==t||""===(t+"").trim())return null;const n=+t;return Number.isInteger(n)&&n>=0?n:null}function $(t,n){return t.replace(/\{(\w+)\}/g,(t,e)=>null!=n[e]?n[e]+"":t)}function C(t,n,e){const i=t.length,o=z(n.minlength),r=z(n.maxlength),s={minlength:o,maxlength:r,length:i},a={};return null!==o&&o>i&&(a.tooShort=!n.tooShortMessage&&e?.validity.tooShort?e.validationMessage:$(n.tooShortMessage||"Use at least {minlength} characters (now {length})",s)),null!==r&&i>r&&(a.tooLong=$(n.tooLongMessage||"Use at most {maxlength} characters (now {length})",s)),a}const M=new WeakMap,E=new WeakMap;function S(t){const n=[];for(const e of function(t){let n=M.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],M.set(t,n)}return n}(t.constructor))({}).hasOwnProperty.call(t,e)&&(n.push([e,t[e]]),delete t[e]);return n}function T(t){const n=S(t);n.length&&E.set(t,n)}function L(t){const n=[...E.get(t)??[],...S(t)];E.delete(t);for(const[i,o]of n)if(void 0!==o)try{t[i]=o}catch(e){reportError(e)}}const _=new WeakSet,A=new WeakMap;let q=!1;const F=class extends HTMLElement{constructor(){super(),this.p=!1,this.m=!1,this.v=!1,this.k=!1,this.$=null;const t=this.constructor;this.props=new r(t.properties),this.C=this.attachInternals(),this.M=new w(this,this.C),this.shadowRoot||this.attachShadow({mode:"open",delegatesFocus:t.delegatesFocus,slotAssignment:t.slotAssignment}),t.labelClicks&&(_.add(this),q||(q=!0,window.addEventListener("click",t=>{const n=t.composedPath(),e=n.find(t=>_.has(t));if(!e)return;const i=`${t.clientX},${t.clientY}`;n[0]!==e?(A.set(e,i),setTimeout(()=>{A.get(e)===i&&A.delete(e)})):A.get(e)===i&&t.stopImmediatePropagation()},!0)))}static get observedAttributes(){const t=[];for(const n of Object.keys(this.properties))t.push(n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase());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.L(n);this.k=!0;try{this._(o,i.type,e)}finally{this.k=!1}}_(t,n,e){"boolean"===n?e?this.setAttribute(t,""):this.removeAttribute(t):null==e?this.removeAttribute(t):this.setAttribute(t,"object"==typeof e?JSON.stringify(e):e+"")}L(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}A(t){return t.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}attributeChangedCallback(t,n,e){if(n===e)return;const i=this.props.hasConfig(t)?t:this.A(t);if(!this.k&&this.$?.has(i)){const t=this.props.getConfig(i);this.$.set(i,e??("function"==typeof t.default?t.default():t.default)??null)}const o=this.props.updateProperty(i,e,"attribute");o&&this.T([o])}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.L(n));this.$.set(n,t??("function"==typeof e.default?e.default():e.default)??null)}}this.q(),this.p=!0,this.F&&this.M.track(),this.onConnect(),this.m||(this.render(),this.m=!0)}disconnectedCallback(){this.p=!1,this.F&&this.M.track(),this.onDisconnect()}formAssociatedCallback(){this.F&&this.M.track()}q(){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))}L(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 F(){return!0===this.constructor.formAssociated}applyValidity(t,n,e){this.M.set(t,n,e)}revealValidity(){this.F&&this.M.reveal()}get validity(){return this.F?this.C.validity:void 0}get validationMessage(){return this.F?this.C.validationMessage:""}get willValidate(){return!!this.F&&this.C.willValidate}checkValidity(){return!this.F||this.C.checkValidity()}reportValidity(){return!this.F||this.M.report()}setCustomValidity(t){this.F&&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")}formResetCallback(){this.v=!1,this.F&&this.M.reset();for(const[t,n]of this.$??[])this.setProperty(t,n);this.onFormReset()}onFormReset(){}};F.formAssociated=!0,F.properties={},F.delegatesFocus=!1,F.slotAssignment="named",F.labelClicks=!1;let D=F;const j=new Map;function H(t,n){const{css:e,id:i}=n;let o;i&&j.has(i)?o=j.get(i):(o=new CSSStyleSheet,o.replaceSync(e),i&&j.set(i,o));const r=t.adoptedStyleSheets||[];r.includes(o)||(t.adoptedStyleSheets=[...r,o])}const O=(t,n,e,i)=>i?`var(${t}-${n}${e}, var(${t}-${i}${e}))`:`var(${t}-${n}${e})`,V=(t,n)=>`oklch(from ${t} calc(l + var(--ty-${n})) c h)`,I=(t,n)=>`oklch(from ${t} calc(l + sign(0.5 - l) * abs(var(--ty-${n}))) c h)`,W=(t,n)=>{const e=e=>O("--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?I:V;return`\nbutton.solid.${t} { --_ring: ${O("--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, ${V(e("-soft"),"solid-hover-l")}); }\nbutton.solid.${t}.tone-minus:active:not(:disabled) { --_solid-bg: ${V(e("-soft"),"solid-active-l")}; }\n`},N=(t,n)=>{const e=e=>"neutral"===t&&"-strong"===e?`var(--ty-solid-neutral${e})`:(e=>O("--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, ${O("--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`},P=(t,n)=>{const e=e=>"neutral"===t&&"-strong"===e?`var(--ty-solid-neutral${e})`:(e=>O("--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, ${O("--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`},B=`\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;\nmax-height: var(--_rung);\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=>W(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=>N(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=>P(t)).join("")}`;function R(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 Y=null;function U(t){Y=t&&t.trim()?t:null}function X(){return Y??'<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 Z(){Y=null}const K=class extends D{constructor(){super(),this.j=!1,this.H=!1,this.O=null,this.V=null,H(this.shadowRoot,{css:B,id:"ty-button"}),this.addEventListener("click",t=>{const n=this.shadowRoot.querySelector("button");n&&t!==this.V&&(t.composedPath().includes(n)||(t.stopImmediatePropagation(),this.I(t)||n.click()))},!0)}I(t){if(!(t.isTrusted&&t instanceof MouseEvent))return!1;const n=this.getBoundingClientRect(),e=getComputedStyle(this),i=t=>parseFloat(e.getPropertyValue(t))||0,o=n.left+i("border-left-width")+i("padding-left"),r=n.right-i("border-right-width")-i("padding-right"),s=n.top+i("border-top-width")+i("padding-top"),a=n.bottom-i("border-bottom-width")-i("padding-bottom");return t.clientX>=o&&r>t.clientX&&t.clientY>=s&&a>t.clientY}onConnect(){this.W()}onDisconnect(){}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.W()}formDisabledCallback(t){this.H=t,this.j&&this.render()}get N(){return this.disabled||this.H}focus(t){const n=this.shadowRoot?.querySelector("button");n?n.focus(t):super.focus(t)}W(){const{base:t}=this.parseFlavor();this.O=R(this.shadowRoot,this.O,t,()=>(t=>W(t,"neutral")+N(t,"neutral")+P(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{u(()=>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.N,e.className=n,e.setAttribute("part","button");const i=document.createElement("span");i.className="loader-icon",i.setAttribute("aria-hidden","true"),i.innerHTML=X();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.N||this.loading)return;const i=new CustomEvent("click",{bubbles:!0,composed:!0,cancelable:!0,detail:{originalEvent:t}});this.V=i,this.dispatchEvent(i)&&this.handleFormAction()}),this.applyLoadingState(e),t.appendChild(e),this.j=!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=X())}else t.removeAttribute("aria-busy"),t.removeAttribute("aria-disabled")}render(){const t=this.shadowRoot;if(!this.j)return void this.initializeButtonStructure();const n=this.buildClasses(),e=t.querySelector("button");e&&(e.disabled=this.N,e.className=n,this.applyLoadingState(e))}};K.formAssociated=!0,K.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 G=K;customElements.get("ty-button")||customElements.define("ty-button",G);const J="1.0.0-rc.21",Q=new Map,tt=new Map,nt=new Map;let et=null,it=null;const ot="ty-icons-v"+J,rt="https://ty-icons.local/",st=new Map;let at=!1;function lt(t){const n=new Set;Object.entries(t).forEach(([t,e])=>{Q.set(t,e),n.add(t)}),n.size>0&&bt(n)}function ct(t){return Q.get(t)}function dt(t){return Q.has(t)}async function ht(){const t=new Set(Q.keys());if(Q.clear(),"caches"in window)try{await caches.delete(ot),at=!1}catch(n){}bt(t)}function ut(t,n,e){tt.set(t,e),n&&nt.set(t,n)}function pt(t){tt.delete(t),nt.delete(t)}function bt(t){et||(et=new Set),t.forEach(t=>et.add(t)),null!==it&&clearTimeout(it);const n="undefined"!=typeof requestIdleCallback?requestIdleCallback:t=>setTimeout(t,0);it=n(()=>{const t=et;et=null,it=null,t&&t.size>0&&function(t){tt.forEach((n,e)=>{const i=nt.get(e);i?t.has(i)&&n(new Set([i])):n(t)})}(t)})}function gt(){return Array.from(Q.keys())}async function mt(){const t={version:J,cacheName:ot,available:"caches"in window};if(!t.available)return t;try{const n=await caches.open(ot),e=(await n.keys()).filter(t=>t.url.startsWith(rt));return{...t,iconCount:e.length}}catch(n){return t}}const vt=Object.freeze(Object.defineProperty({__proto__:null,addWatcher:ut,clearIcons:ht,getCacheInfo:mt,getCachedIcon:async function(t){const n=st.get(t);if(n)return n;const e=(async()=>{try{await async function(){if(!at&&"caches"in window){at=!0;try{const t=(await caches.keys()).filter(t=>t.startsWith("ty-icons-v")&&t!==ot);await Promise.all(t.map(t=>caches.delete(t)))}catch(t){}}}();const n=await caches.open(ot),e=await n.match(`${rt}${t}`);if(e)return await e.text()}catch(n){}return null})();return st.set(t,e),e.finally(()=>{st.delete(t)}),e},getIcon:ct,getIconNames:gt,hasIcon:dt,registerIcons:lt,removeWatcher:pt},Symbol.toStringTag,{value:"Module"}));let ft=0;const yt='<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>',wt=class extends D{constructor(){super(),this.P=null,this.B="",this.R=null,H(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.R=document.createElement("slot"),this.R.innerHTML=yt,this.B=yt,this.shadowRoot.appendChild(this.R)}onConnect(){this.P="ty-icon-"+ ++ft,this.name&&ut(this.P,this.name,t=>{this.name&&t.has(this.name)&&this.render()}),this.updateClasses()}onDisconnect(){this.P&&(pt(this.P),this.P=null)}onPropertiesChanged(t){for(const n of t)if("name"===n.name){this.P&&pt(this.P);const t=n.newValue||"";t&&this.isConnected&&(this.P="ty-icon-"+ ++ft,ut(this.P,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(yt);const n=ct(t);this.renderSvg(n||yt)}renderSvg(t){this.B!==t&&this.R&&(this.R.innerHTML=t,this.B=t)}};wt.formAssociated=!1,wt.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 xt=wt;customElements.get("ty-icon")||customElements.define("ty-icon",xt);const kt=`\n:host {\ndisplay: inline-flex;\nwidth: fit-content;\nmax-width: 100%;\n}\n:host([hidden]),\n:host([filtered-out]) {\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 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;\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]) .tag-container:not([aria-disabled="true"]) {\ncursor: pointer;\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-3);\nheight: var(--ty-spacing-3);\nmargin-left: var(--ty-spacing-2);\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="md"]) .tag-container {\npadding: 0 0.625rem; \nmin-height: 28px;\n}\n:host([size="md"]) .tag-dismiss {\nwidth: var(--ty-spacing-4);\nheight: var(--ty-spacing-4);\nmargin-left: 0;\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`,zt=class extends D{constructor(){super(),this.Y=null,this.O=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}))}},H(this.shadowRoot,{css:kt,id:"ty-tag"})}onConnect(){this.W(),queueMicrotask(()=>{this.setupEventListeners()})}W(){this.O=R(this.shadowRoot,this.O,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.W()}dispatchTagEvent(t,n){this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}cleanupEventListeners(){this.Y&&(this.Y(),this.Y=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.Y=()=>{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 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)}};zt.formAssociated=!0,zt.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:""},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 $t=zt;customElements.get("ty-tag")||customElements.define("ty-tag",$t);class TyOption extends HTMLElement{constructor(){super(),this.U=void 0,this.X=!1,this.Z=!1,this.K=!1,this.G=!1,this.J=!1,this.tt=!1,H(this.attachShadow({mode:"open"}),{css:"\n:host([hidden]),\n:host([filtered-out]) {\ndisplay: var(--ty-option-hidden-display, none) !important;\n}\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.option-content.in-trigger {\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.option-content.in-trigger .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.C=this.attachInternals(),this.C.ariaSelected="false",this.render()}static get observedAttributes(){return["value","disabled","selected","highlighted","hidden","role"]}connectedCallback(){L(this),this.hasAttribute("role")||this.setAttribute("role","option"),this.render()}attributeChangedCallback(t,n,e){if(n!==e){switch(t){case"value":this.U=e||void 0;break;case"selected":this.X=null!==e&&!/^(false|0)$/i.test(e.trim());break;case"disabled":this.G=null!==e;break;case"highlighted":this.J=null!==e;break;case"hidden":this.tt=null!==e;break;case"role":return void(null===e&&this.isConnected&&this.setAttribute("role","option"))}this.render()}}getOptionValue(){if(void 0!==this.U)return this.U;const t=this.getAttribute("value");return null!==t?t:this.textContent?.trim()||""}get value(){return this.getOptionValue()}set value(t){this.U!==t&&(this.U=t,void 0!==t?this.setAttribute("value",t):this.removeAttribute("value"),this.render())}get selected(){return this.X}set selected(t){t=i(t),this.X!==t&&(this.X=t,t?this.setAttribute("selected",""):this.removeAttribute("selected"))}get checked(){return this.Z}set checked(t){t=i(t),this.Z!==t&&(this.Z=t,this.C.ariaSelected=t+"",this.render())}get inTrigger(){return this.K}set inTrigger(t){t=i(t),this.K!==t&&(this.K=t,this.render())}get disabled(){return this.G}set disabled(t){t=i(t),this.G!==t&&(this.G=t,t?this.setAttribute("disabled",""):this.removeAttribute("disabled"),this.render())}get highlighted(){return this.J}set highlighted(t){t=i(t),this.J!==t&&(this.J=t,t?this.setAttribute("highlighted",""):this.removeAttribute("highlighted"),this.render())}get hidden(){return this.tt}set hidden(t){t=i(t),this.tt!==t&&(this.tt=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>'),this.C.ariaDisabled=this.G?"true":null;const n=t.querySelector(".option-content");n&&(n.toggleAttribute("disabled",this.G),n.toggleAttribute("selected",this.Z),n.toggleAttribute("highlighted",this.J),n.toggleAttribute("hidden",this.tt),n.classList.toggle("in-trigger",this.K))}}customElements.get("ty-option")||customElements.define("ty-option",TyOption);const Ct='\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',Mt=(t,n,e="")=>{const i=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}"])${e} {\n--input-accent: var(--ty-input-${t}-border, ${i("-soft")});\n--input-accent-bold: ${i("")};\n--input-ring: color-mix(in oklab, ${i("")} 15%, transparent);\n}\n:host([flavor="${t}+"]) {\n--input-accent: ${i("")};\n--input-accent-bold: ${i("-strong")};\n--input-ring: color-mix(in oklab, ${i("-strong")} 15%, transparent);\n}\n:host([flavor="${t}-"]) {\n--input-accent: ${i("-faint")};\n--input-accent-bold: ${i("-soft")};\n--input-ring: color-mix(in oklab, ${i("-soft")} 15%, transparent);\n}\n`},Et=`\n${Ct}\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:not(.disabled) {\nbackground: var(--ty-bg-danger-soft);\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=>Mt(t,void 0,"danger"===t?',\n:host([error]:not([error=""]))':"")).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 St(t){return["number","currency","percent","compact"].includes(t)}function Tt(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 Lt(t,n){let e=Tt(t);const i=new MutationObserver(i=>{for(const o of i)if("attributes"===o.type&&"lang"===o.attributeName){const i=Tt(t);i!==e&&(e=i,n(i))}});return i.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}),()=>i.disconnect()}const _t='<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>',At='<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>',qt=class extends D{constructor(){super(),this.nt=null,this.et=!1,this.it=!1,this.O=null,this.ot=null,this.rt=null,this.st=null,this.lt=null,this.ct=null,this.dt=null,this.ht=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())},H(this.shadowRoot,{css:Et,id:"ty-input"})}onConnect(){this.m||this.initializeShadowValue(),this.ut=Lt(this,()=>{this.render()}),this.W(),this.m&&(this.render(),this.setupEventListeners())}W(){this.O=R(this.shadowRoot,this.O,this.flavor,({base:t})=>(t=>Mt(t,"neutral"))(t))}onDisconnect(){this.removeEventListeners(),this.ut&&(this.ut(),this.ut=void 0),null!==this.ct&&(clearTimeout(this.ct),this.ct=null),null!==this.dt&&(clearTimeout(this.dt),this.dt=null)}onPropertiesChanged(t){for(const{name:n,newValue:e}of t)switch(n){case"flavor":this.W();break;case"value":this.nt=this.parseShadowValue(e||"");break;case"type":const t=this.getProperty("value")||"";this.nt=this.parseShadowValue(t)}}onFormReset(){this.nt=null,this.initializeShadowValue(),this.et=!1,null!==this.ct&&(clearTimeout(this.ct),this.ct=null),null!==this.dt&&(clearTimeout(this.dt),this.dt=null),this.render()}getFormValue(){return null!==this.nt?this.nt+"":""}initializeShadowValue(){const t=this.getProperty("value");t?(this.nt=this.parseShadowValue(t),this.C.setFormValue(null!==this.nt?this.nt+"":"")):this.C.setFormValue("")}parseShadowValue(t){if(!t||"string"!=typeof t||""===t.trim())return null;if(St(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 St(this.type)&&!this.et&&null!==this.nt&&"number"==typeof this.nt}getFormatConfig(){return{type:this.type,locale:this.locale,currency:this.currency,precision:this.precision}}getDisplayValue(){if(this.shouldFormat()){let t=this.nt;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.nt?this.nt+"":""}get type(){return this.getProperty("type")}set type(t){this.setProperty("type",t)}get value(){return null!==this.nt?this.nt+"":""}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 z(this.getProperty("minlength"))??-1}set minLength(t){this.setProperty("minlength",null==t||0>t?"":t+"")}get maxLength(){return z(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 Tt(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.nt,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.nt,formattedValue:this.shouldFormat()?this.getDisplayValue():null,rawValue:t,originalEvent:n},bubbles:!0,composed:!0}))}removeEventListeners(){if(!this.it)return;const t=this.shadowRoot;if(!t)return;const n=t.querySelector("input");n&&(this.ot&&(n.removeEventListener("input",this.ot),this.ot=null),this.rt&&(n.removeEventListener("change",this.rt),this.rt=null),this.st&&(n.removeEventListener("focus",this.st),this.st=null),this.lt&&(n.removeEventListener("blur",this.lt),this.lt=null),n.removeEventListener("keydown",this.ht),this.it=!1)}setupEventListeners(){if(this.it)return;const t=this.shadowRoot,n=t.querySelector("input"),e=t.querySelector(".input-wrapper");n&&e&&(this.ot=t=>{this.v=!0,t.stopPropagation(),t.stopImmediatePropagation();const e=t.target.value;this.nt=this.parseShadowValue(e),this.C.setFormValue(null!==this.nt?this.nt+"":""),this.updateValidity(),null!==this.ct&&clearTimeout(this.ct),this.debounce>0?this.ct=window.setTimeout(()=>{this.dispatchInputEvent(n.value,t),this.ct=null},this.debounce):this.dispatchInputEvent(e,t)},this.rt=t=>{t.stopPropagation(),t.stopImmediatePropagation();const e=t.target.value;this.nt=this.parseShadowValue(e),this.C.setFormValue(null!==this.nt?this.nt+"":""),this.updateValidity(),null!==this.dt&&clearTimeout(this.dt),this.debounce>0?this.dt=window.setTimeout(()=>{this.dispatchChangeEvent(n.value,t),this.dt=null},this.debounce):this.dispatchChangeEvent(e,t)},this.st=t=>{this.et=!0,e.classList.add("focused"),St(this.type)&&null!==this.nt&&(n.value=this.nt+""),this.dispatchEvent(new CustomEvent("focus",{detail:{originalEvent:t},bubbles:!0,composed:!0}))},this.lt=t=>{const i=t.target.value;null!==this.ct&&(clearTimeout(this.ct),this.ct=null,this.dispatchInputEvent(i,t)),null!==this.dt&&(clearTimeout(this.dt),this.dt=null,this.dispatchChangeEvent(i,t)),this.et=!1,e.classList.remove("focused"),this.v&&this.revealValidity(),this.shouldFormat()&&(n.value=this.getDisplayValue()),this.dispatchEvent(new CustomEvent("blur",{detail:{originalEvent:t},bubbles:!0,composed:!0}))},n.addEventListener("input",this.ot),n.addEventListener("change",this.rt),n.addEventListener("focus",this.st),n.addEventListener("blur",this.lt),n.addEventListener("keydown",this.ht),this.it=!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=!!n&&t.activeElement===n;s||(this.et=!1);const a=["password","email","tel","url"].includes(this.type)?this.type:"text",l=St(this.type)?"decimal":"email"===this.type?"email":"tel"===this.type?"tel":"url"===this.type?"url":void 0,c=this.getDisplayValue();if(n&&e){const d="password"===a&&"true"===t.querySelector(".password-toggle")?.getAttribute("aria-pressed");if(n.type=d?"text":a,n.value!==c&&(n.value=c),n.placeholder=this.placeholder,n.name=this.name,l?n.inputMode=l:n.removeAttribute("inputmode"),e.className="input-wrapper "+r,e.classList.toggle("focused",s),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">${_t}</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">${_t}</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">${_t}</span>`:""}\n</label>\n`:""}\n<div class="input-wrapper ${r}">\n<slot name="start"></slot>\n<input\ntype="${a}"\nvalue="${c}"\nplaceholder="${this.placeholder}"\nname="${this.name}"\n${l?`inputmode="${l}"`:""}\n/>\n<slot name="end"></slot>\n${"password"===a?`\n<button class="password-toggle" type="button"\naria-label="Show password" aria-pressed="false">\n${At}\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 i="password"===e.type,{selectionStart:o,selectionEnd:r,selectionDirection:s}=e;e.type=i?"text":"password",null!==o&&t.activeElement===e&&(e.getBoundingClientRect(),e.setSelectionRange(o,r,s??void 0)),n.innerHTML=i?'<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>':At,n.setAttribute("aria-label",i?"Hide password":"Show password"),n.setAttribute("aria-pressed",i+"")}))}syncConstraintAttributes(t){const n=!St(this.type),e=(e,i)=>n&&""!==i?t.setAttribute(e,i):t.removeAttribute(e);e("pattern",this.pattern),e("minlength",null!=z(this.getProperty("minlength"))?this.minLength+"":""),e("maxlength",null!=z(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},k("input",{type:"text",required:!0}),t??void 0):this.applyValidity({}));const e={},i=[],o=(t,n)=>{e[t]=!0,i.push(n)};if(St(this.type)){const t="number"==typeof this.nt?this.nt:null;if(null!==t&&(this.min||this.max)){const{validity:n,message:e}=function(t,n,e=""){const i=k(t,n,e);return{validity:x[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}=C(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)}};qt.formAssociated=!0,qt.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 Ft=qt;customElements.get("ty-input")||customElements.define("ty-input",Ft);const Dt=(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`},jt=`\n:host {\ndisplay: inline-flex;\nwidth: auto;\nheight: 1.25em;\nheight: 1lh;\nalign-items: center;\nvertical-align: baseline;\noverflow: visible;\n}\n:host::before {\ncontent: "\\200b";\nwidth: 0;\n}\n.checkbox-container {\ndisplay: inline-flex;\nflex-shrink: 0;\nalign-items: center;\njustify-content: center;\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 {\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=>Dt(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`,Ht=class extends D{constructor(){super(),this.O=null,this.it=!1,this.bt=null,this.gt=null,this.st=null,this.lt=null,H(this.shadowRoot,{css:jt,id:"ty-checkbox"})}onConnect(){this.setupEventListeners(),this.W();const t=this.shadowRoot.querySelector(".checkbox-container");t&&this.shadowRoot.activeElement!==t&&t.classList.remove("focused")}W(){this.O=R(this.shadowRoot,this.O,this.flavor,({base:t})=>(t=>Dt(t,"neutral"))(t))}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.W()}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;this.showFocusRing(t instanceof KeyboardEvent);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)}showFocusRing(t){this.shadowRoot?.querySelector(".checkbox-container")?.classList.toggle("focused",t)}handleCheckboxKeydown(t){this.disabled||["Space"," ","Enter"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this.handleCheckboxClick(t))}removeEventListeners(){if(!this.it)return;this.bt&&(this.removeEventListener("click",this.bt),this.bt=null);const t=this.shadowRoot;if(!t)return;const n=t.querySelector(".checkbox-container");n?(this.gt&&(n.removeEventListener("keydown",this.gt),this.gt=null),this.st&&(n.removeEventListener("focus",this.st),this.st=null),this.lt&&(n.removeEventListener("blur",this.lt),this.lt=null),this.it=!1):this.it=!1}setupEventListeners(){if(this.it)return;const t=this.shadowRoot.querySelector(".checkbox-container");t&&(this.bt=t=>{this.handleCheckboxClick(t)},this.gt=t=>{this.handleCheckboxKeydown(t)},this.st=()=>{t.classList.toggle("focused",t.matches(":focus-visible"))},this.lt=()=>{t.classList.remove("focused")},this.addEventListener("click",this.bt),t.addEventListener("keydown",this.gt),t.addEventListener("focus",this.st),t.addEventListener("blur",this.lt),this.it=!0)}render(){const t=this.shadowRoot;let n=t.querySelector(".checkbox-container");const e=this.buildClassList(),i=this.indeterminate?"mixed":this.checked+"";if(n){const o=n.classList.contains("focused")&&t.activeElement===n;n.className="checkbox-container "+e,n.classList.toggle("focused",o&&!this.disabled),this.disabled?n.removeAttribute("tabindex"):n.tabIndex=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,this.disabled||(n.tabIndex=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},k("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}};Ht.formAssociated=!0,Ht.delegatesFocus=!0,Ht.labelClicks=!0,Ht.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 Ot=Ht;customElements.get("ty-checkbox")||customElements.define("ty-checkbox",Ot);const Vt=(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`},It=`\n${Et}\n:host {\ndisplay: inline-flex;\nwidth: auto;\nheight: 1.25em;\nheight: 1lh;\nalign-items: center;\nvertical-align: baseline;\noverflow: visible;\n}\n:host::before {\ncontent: "\\200b";\nwidth: 0;\n}\n.switch-container {\ndisplay: inline-flex;\nflex-shrink: 0;\nalign-items: center;\ncursor: pointer;\nuser-select: none;\noutline: none;\n}\n.switch-container.disabled {\ncursor: not-allowed;\nopacity: 0.55;\n}\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=>Vt(t)).join("")}\n`,Wt=class extends D{constructor(){super(),this.O=null,this.it=!1,this.bt=null,this.gt=null,this.st=null,this.lt=null,H(this.shadowRoot,{css:It,id:"ty-switch"})}onConnect(){this.setupEventListeners(),this.W();const t=this.shadowRoot.querySelector(".switch-container");t&&this.shadowRoot.activeElement!==t&&t.classList.remove("focused")}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.W()}W(){this.O=R(this.shadowRoot,this.O,this.flavor,({base:t})=>(t=>Vt(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;this.showFocusRing(t instanceof KeyboardEvent);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)}showFocusRing(t){this.shadowRoot?.querySelector(".switch-container")?.classList.toggle("focused",t)}handleSwitchKeydown(t){this.disabled||["Space"," ","Enter"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this.handleSwitchClick(t))}removeEventListeners(){if(!this.it)return;this.bt&&(this.removeEventListener("click",this.bt),this.bt=null);const t=this.shadowRoot;if(!t)return;const n=t.querySelector(".switch-container");n?(this.gt&&(n.removeEventListener("keydown",this.gt),this.gt=null),this.st&&(n.removeEventListener("focus",this.st),this.st=null),this.lt&&(n.removeEventListener("blur",this.lt),this.lt=null),this.it=!1):this.it=!1}setupEventListeners(){if(this.it)return;const t=this.shadowRoot.querySelector(".switch-container");t&&(this.bt=t=>this.handleSwitchClick(t),this.gt=t=>this.handleSwitchKeydown(t),this.st=()=>t.classList.toggle("focused",t.matches(":focus-visible")),this.lt=()=>t.classList.remove("focused"),this.addEventListener("click",this.bt),t.addEventListener("keydown",this.gt),t.addEventListener("focus",this.st),t.addEventListener("blur",this.lt),this.it=!0)}render(){const t=this.shadowRoot;let n=t.querySelector(".switch-container");const e=this.buildClassList();if(n){const i=n.classList.contains("focused")&&t.activeElement===n;n.className="switch-container "+e,n.classList.toggle("focused",i&&!this.disabled),this.disabled?n.removeAttribute("tabindex"):n.tabIndex=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,this.disabled||(n.tabIndex=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},k("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}};Wt.formAssociated=!0,Wt.delegatesFocus=!0,Wt.labelClicks=!0,Wt.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 Nt=Wt;customElements.get("ty-switch")||customElements.define("ty-switch",Nt);const Pt=(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`},Bt=`\n${Et}\n:host(ty-radio) {\ndisplay: inline-flex;\nwidth: auto;\nheight: 1.25em;\nheight: 1lh;\nalign-items: center;\nvertical-align: baseline;\noverflow: visible;\n}\n:host(ty-radio)::before {\ncontent: "\\200b";\nwidth: 0;\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;\nflex-shrink: 0;\nalign-items: center;\ncursor: pointer;\nuser-select: none;\noutline: none;\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=>Pt(t)).join("")}\n`,Rt=class extends D{constructor(){super(),this.O=null,this.it=!1,this.bt=null,this.st=null,this.lt=null,this.vt=!0,H(this.shadowRoot,{css:Bt,id:"ty-radio"})}setTabStop(t){this.vt=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.W()}onDisconnect(){this.removeEventListeners()}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.W()}W(){this.O=R(this.shadowRoot,this.O,this.flavor,({base:t})=>(t=>Pt(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.it)return;this.bt&&(this.removeEventListener("click",this.bt),this.bt=null);const t=this.shadowRoot?.querySelector(".radio-container");t?(this.st&&(t.removeEventListener("focus",this.st),this.st=null),this.lt&&(t.removeEventListener("blur",this.lt),this.lt=null),this.it=!1):this.it=!1}setupEventListeners(){if(this.it)return;const t=this.shadowRoot.querySelector(".radio-container");t&&(this.bt=t=>this.handleClick(t),this.st=()=>t.classList.add("focused"),this.lt=()=>t.classList.remove("focused"),this.addEventListener("click",this.bt),t.addEventListener("focus",this.st),t.addEventListener("blur",this.lt),this.it=!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.vt?-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.vt?-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)}};Rt.labelClicks=!0,Rt.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 Yt=Rt;customElements.get("ty-radio")||customElements.define("ty-radio",Yt);const Ut=class extends D{constructor(){super(),this.it=!1,this.ft=null,this.gt=null,this.yt=null,H(this.shadowRoot,{css:Bt,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},k("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.select(e,t)}select(t,n){if(t===this.value)return;this.value=t,this.syncChildren();const e={value:t,formValue:t,originalEvent:n};setTimeout(()=>{this.dispatchEvent(new CustomEvent("input",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:e,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))return["Space"," ","Enter"].includes(t.key)?void(i&&(t.preventDefault(),this.select(i.value,t))):void 0;t.preventDefault(),o=i?(n.indexOf(i)-1+n.length)%n.length:n.length-1}const r=n[o];r&&(r.focus(),this.select(r.value,t))}removeEventListeners(){this.it&&(this.ft&&(this.removeEventListener("ty-radio-select",this.ft),this.ft=null),this.gt&&(this.removeEventListener("keydown",this.gt),this.gt=null),this.yt&&(this.removeEventListener("ty-radio-connected",this.yt),this.yt=null),this.it=!1)}setupEventListeners(){this.it||(this.ft=t=>this.handleRadioSelect(t),this.gt=t=>this.handleKeydown(t),this.yt=()=>this.syncChildren(),this.addEventListener("ty-radio-select",this.ft),this.addEventListener("keydown",this.gt),this.addEventListener("ty-radio-connected",this.yt),this.it=!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=_t,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=_t,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}};Ut.formAssociated=!0,Ut.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 Xt=Ut;customElements.get("ty-radio-group")||customElements.define("ty-radio-group",Xt);const Zt=(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`},Kt=`\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=>Zt(t)).join("")}\n`,Gt='<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>',Jt='<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>',Qt=class extends D{constructor(){super(),this.wt=null,this.xt=!1,this.O=null,H(this.shadowRoot,{css:Et,id:"ty-input"}),H(this.shadowRoot,{css:Kt,id:"ty-copy"})}onConnect(){this.W()}W(){this.O=R(this.shadowRoot,this.O,this.flavor,({base:t})=>(t=>Zt(t,"neutral"))(t))}onDisconnect(){null!==this.wt&&(clearTimeout(this.wt),this.resetCopyButton())}onPropertiesChanged(t){t.some(t=>"flavor"===t.name)&&this.W()}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){const i=this.shadowRoot.activeElement,o=document.createElement("textarea");try{o.value=t,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select(),document.execCommand("copy"),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()}finally{o.remove(),i?.focus()}}this.showCopySuccess()}showCopySuccess(){null!==this.wt&&clearTimeout(this.wt),this.xt=!0;const t=this.shadowRoot.querySelector(".copy-button");t&&(t.classList.add("success"),t.innerHTML=Jt,t.setAttribute("aria-label","Copied!")),this.wt=window.setTimeout(()=>this.resetCopyButton(),2e3)}resetCopyButton(){this.xt=!1;const t=this.shadowRoot.querySelector(".copy-button");t&&(t.classList.remove("success","error"),t.innerHTML=Gt,t.setAttribute("aria-label","Copy to clipboard")),this.wt=null}showCopyError(){null!==this.wt&&clearTimeout(this.wt),this.xt=!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.wt=window.setTimeout(()=>this.resetCopyButton(),2e3)}setupEventListeners(){const t=this.shadowRoot.querySelector(".input-wrapper");t&&!this.disabled&&(t.addEventListener("click",()=>this.copyToClipboard()),t.style.cursor="pointer")}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">${_t}</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.xt?" success":""}" type="button" aria-label="${this.xt?"Copied!":"Copy to clipboard"}" ${this.disabled?"disabled":""}>\n${this.xt?Jt:Gt}\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)}};Qt.formAssociated=!0,Qt.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 tn=Qt;customElements.get("ty-copy")||customElements.define("ty-copy",tn),customElements.get("ty-copy-field")||customElements.define("ty-copy-field",class extends tn{});const nn="Drop files here or click to browse";function en(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"}const on=class extends D{constructor(){super(),this.kt=[],this.zt=!1,this.it=!1,this.$t=null,this.Ct=null,this.Mt=null,this.Et=null,this.St=null,this.Tt=null,this.Lt=null,this._t=null,H(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.kt=[],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.kt.length){const t=this.shadowRoot?.querySelector(".drop-zone");this.applyValidity({valueMissing:!0},k("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.kt.length&&t.append(this.name,new File([],"",{type:"application/octet-stream"}));for(const n of this.kt)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.kt]}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.kt=this.multiple?t:t.slice(0,1),this.updateFormValue(),this.render();const n={value:this.kt,files:this.kt,names:this.kt.map(t=>t.name)};setTimeout(()=>{this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0})),this.revealValidity()},0)}removeFile(t){const n=[...this.kt];n.splice(t,1),this.setFiles(n);const e=this.shadowRoot?.querySelector(".file-input");e&&(e.value="")}setupEventListeners(){if(this.it)return;const t=this.shadowRoot,n=t.querySelector(".drop-zone"),e=t.querySelector(".file-input");this.$t=t=>{this.disabled||t.target.closest(".file-remove")||e.click()},this.Ct=t=>{this.disabled||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())},this.Mt=()=>{n.classList.add("focused")},this.Et=()=>{n.classList.remove("focused")},this.St=t=>{this.disabled||(t.preventDefault(),t.stopPropagation(),this.zt||(this.zt=!0,n.classList.add("drag-active")))},this.Tt=t=>{n.contains(t.relatedTarget)||(this.zt=!1,n.classList.remove("drag-active"))},this.Lt=t=>{if(this.disabled)return;t.preventDefault(),t.stopPropagation(),this.zt=!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._t=t=>{const n=t.target;n.files&&n.files.length>0&&this.setFiles(Array.from(n.files))},n.addEventListener("click",this.$t),n.addEventListener("keydown",this.Ct),n.addEventListener("focus",this.Mt),n.addEventListener("blur",this.Et),n.addEventListener("dragover",this.St),n.addEventListener("dragleave",this.Tt),n.addEventListener("drop",this.Lt),e.addEventListener("change",this._t),this.it=!0}removeEventListeners(){if(!this.it)return;const t=this.shadowRoot;if(!t)return;const n=t.querySelector(".drop-zone"),e=t.querySelector(".file-input");n&&e&&(this.$t&&n.removeEventListener("click",this.$t),this.Ct&&n.removeEventListener("keydown",this.Ct),this.Mt&&n.removeEventListener("focus",this.Mt),this.Et&&n.removeEventListener("blur",this.Et),this.St&&n.removeEventListener("dragover",this.St),this.Tt&&n.removeEventListener("dragleave",this.Tt),this.Lt&&n.removeEventListener("drop",this.Lt),this._t&&e.removeEventListener("change",this._t),this.it=!1)}buildDropZoneClasses(){const t=["drop-zone"];return this.zt&&t.push("drag-active"),this.kt.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.kt.length>n;n++){const e=this.kt[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=en(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.kt.length>0?"none":"";const r=n.querySelector(".upload-hint");this.kt.length>0?r.innerHTML=`<strong>${this.kt.length} file${1!==this.kt.length?"s":""} selected</strong>`:this.placeholder&&this.placeholder!==nn?r.textContent=this.placeholder:r.innerHTML='Drop files here or <span class="browse-link">click to browse</span>';const s=n.querySelector(".upload-sub-hint");this.accept&&0===this.kt.length?(s.textContent="Accepted: "+this.accept,s.style.display=""):s.style.display="none";const a=n.querySelector(".file-list");this.renderFileList(a);const l=n.querySelector(".error-message");l.textContent=this.error,l.style.display=this.error?"":"none",this.updateValidity()}};on.formAssociated=!0,on.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:nn},error:{type:"string",visual:!0,default:""}};let rn=on;customElements.get("ty-file-upload")||customElements.define("ty-file-upload",rn);const sn=`\n${Ct}\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 an(){return"native"!==document.documentElement.getAttribute("data-ty-scrollbar")}class ln{constructor(t,n={}){this.trackY=null,this.thumbY=null,this.trackX=null,this.thumbX=null,this.zt=!1,this.At="y",this.qt=0,this.Ft=0,this.Dt=null,this.jt=null,this.Ht=null,this.Ot=t,this.Vt=!1!==n.vertical,this.It=n.horizontal??!1,this.Wt=n.autoHideDelay??1e3,this.Nt=this.Pt.bind(this),this.Bt=this.Rt.bind(this),this.Yt=this.Ut.bind(this),this.Xt=this.Zt.bind(this),this.Kt=this.Gt.bind(this),this.Jt=this.Qt.bind(this),this.tn=this.nn.bind(this),this.Vt&&(this.trackY=this.en("y"),this.thumbY=this.rn("y"),this.trackY.appendChild(this.thumbY)),this.It&&(this.trackX=this.en("x"),this.thumbX=this.rn("x"),this.trackX.appendChild(this.thumbX)),this.Ot.addEventListener("scroll",this.Nt,{passive:!0}),this.thumbY&&this.thumbY.addEventListener("pointerdown",this.Bt),this.trackY&&this.trackY.addEventListener("pointerdown",this.Xt),this.thumbX&&this.thumbX.addEventListener("pointerdown",this.Yt),this.trackX&&this.trackX.addEventListener("pointerdown",this.Kt),this.Ht=new ResizeObserver(()=>this.update()),this.Ht.observe(this.Ot),this.update()}en(t){const n=document.createElement("div");return n.className="ty-scrollbar-track-"+t,n}rn(t){const n=document.createElement("div");return n.className="ty-scrollbar-thumb-"+t,n}update(){this.sn(),this.an()}scrollToTop(t=!1){this.Ot.scrollTo({top:0,behavior:t?"smooth":"auto"})}scrollToBottom(t=!1){this.Ot.scrollTo({top:this.Ot.scrollHeight,behavior:t?"smooth":"auto"})}scrollToLeft(t=!1){this.Ot.scrollTo({left:0,behavior:t?"smooth":"auto"})}scrollToRight(t=!1){this.Ot.scrollTo({left:this.Ot.scrollWidth,behavior:t?"smooth":"auto"})}destroy(){this.Ot.removeEventListener("scroll",this.Nt),this.thumbY&&this.thumbY.removeEventListener("pointerdown",this.Bt),this.trackY&&this.trackY.removeEventListener("pointerdown",this.Xt),this.thumbX&&this.thumbX.removeEventListener("pointerdown",this.Yt),this.trackX&&this.trackX.removeEventListener("pointerdown",this.Kt),this.Ht&&(this.Ht.disconnect(),this.Ht=null),null!==this.Dt&&(cancelAnimationFrame(this.Dt),this.Dt=null),null!==this.jt&&(clearTimeout(this.jt),this.jt=null)}Pt(){null===this.Dt&&(this.Dt=requestAnimationFrame(()=>{this.Dt=null,this.ln(),this.cn()}))}sn(){if(!this.trackY||!this.thumbY)return;const{scrollHeight:t,clientHeight:n}=this.Ot,e=t>n+2;this.trackY.classList.toggle("has-overflow",e),e&&(this.thumbY.style.height=Math.max(n/t*100,0)+"%"),this.dn()}an(){if(!this.trackX||!this.thumbX)return;const{scrollWidth:t,clientWidth:n}=this.Ot,e=t>n+2;this.trackX.classList.toggle("has-overflow",e),e&&(this.thumbX.style.width=Math.max(n/t*100,0)+"%"),this.hn()}ln(){this.dn(),this.hn()}dn(){if(!this.trackY||!this.thumbY)return;const{scrollTop:t,scrollHeight:n,clientHeight:e}=this.Ot,i=n-e;i>0&&(this.thumbY.style.top=t/i*(this.trackY.clientHeight-this.thumbY.offsetHeight)+"px")}hn(){if(!this.trackX||!this.thumbX)return;const{scrollLeft:t,scrollWidth:n,clientWidth:e}=this.Ot,i=n-e;i>0&&(this.thumbX.style.left=t/i*(this.trackX.clientWidth-this.thumbX.offsetWidth)+"px")}cn(){this.zt||(this.trackY?.classList.add("scrolling"),this.trackX?.classList.add("scrolling"),null!==this.jt&&clearTimeout(this.jt),this.jt=setTimeout(()=>{this.trackY?.classList.remove("scrolling"),this.trackX?.classList.remove("scrolling"),this.jt=null},this.Wt))}Rt(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this.zt=!0,this.At="y",this.qt=t.clientY,this.Ft=this.Ot.scrollTop,this.thumbY.setPointerCapture(t.pointerId),this.trackY?.classList.add("dragging"),this.thumbY.addEventListener("pointermove",this.Jt),this.thumbY.addEventListener("pointerup",this.tn),this.thumbY.addEventListener("pointercancel",this.tn))}Ut(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this.zt=!0,this.At="x",this.qt=t.clientX,this.Ft=this.Ot.scrollLeft,this.thumbX.setPointerCapture(t.pointerId),this.trackX?.classList.add("dragging"),this.thumbX.addEventListener("pointermove",this.Jt),this.thumbX.addEventListener("pointerup",this.tn),this.thumbX.addEventListener("pointercancel",this.tn))}Qt(t){if(this.zt)if("y"===this.At){const n=t.clientY-this.qt,{scrollHeight:e,clientHeight:i}=this.Ot,o=this.trackY.clientHeight-this.thumbY.offsetHeight;if(0>=o)return;this.Ot.scrollTop=this.Ft+n*((e-i)/o)}else{const n=t.clientX-this.qt,{scrollWidth:e,clientWidth:i}=this.Ot,o=this.trackX.clientWidth-this.thumbX.offsetWidth;if(0>=o)return;this.Ot.scrollLeft=this.Ft+n*((e-i)/o)}}nn(t){const n="y"===this.At?this.thumbY:this.thumbX,e="y"===this.At?this.trackY:this.trackX;this.zt=!1,n.releasePointerCapture(t.pointerId),e?.classList.remove("dragging"),n.removeEventListener("pointermove",this.Jt),n.removeEventListener("pointerup",this.tn),n.removeEventListener("pointercancel",this.tn),this.cn()}Zt(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.Ot;this.Ot.scrollTo({top:e*(i-o),behavior:"smooth"})}Gt(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.Ot;this.Ot.scrollTo({left:e*(i-o),behavior:"smooth"})}}const cn="\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",dn=class extends D{constructor(){super(),this.un=null,this.pn=null,this.bn=null,this.et=!1,this.handleInputEvent=t=>{this.v=!0,t.stopPropagation(),t.stopImmediatePropagation(),this.value=t.target.value,this.un&&this.pn&&this.resizeTextarea(this.un,this.pn),this.C.setFormValue(this.value||""),this.updateValidity(),this.emitValueEvent("input",t)},this.gn=null,this.handleFocusEvent=()=>{this.et=!0,this.gn=this.value},this.handleBlurEvent=t=>{this.et=!1,this.v&&this.revealValidity(),null!==this.gn&&this.value!==this.gn&&this.emitValueEvent("change",t),this.gn=null};const t=this.shadowRoot;H(t,{css:sn,id:"ty-textarea"}),an()&&H(t,{css:cn,id:"ty-custom-scrollbar"})}onConnect(){this.updateFormValue(),this.m&&(this.render(),this.un&&this.setupTextareaEvents(this.un))}onDisconnect(){this.mn(),this.un&&this.removeTextareaEvents(this.un)}onPropertiesChanged(t){}getFormValue(){return this.getProperty("value")||""}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 z(this.getProperty("minlength"))??-1}set minLength(t){this.setProperty("minlength",null==t||0>t?"":t+"")}get maxLength(){return z(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.pn=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.mn()):(t.style.overflowY="auto",this.vn(t))):null===a||a>r||this.bn||(t.style.overflowY="auto",this.vn(t)),this.bn?.update()}vn(t){if(this.bn||!an())return;t.style.scrollbarWidth="none",this.setAttribute("data-custom-scroll",""),this.bn=new ln(t,{vertical:!0,horizontal:!1});const n=this.shadowRoot.querySelector(".textarea-scroll");n&&this.bn.trackY&&n.appendChild(this.bn.trackY)}mn(){this.bn&&(this.bn.trackY?.remove(),this.bn.destroy(),this.bn=null,this.removeAttribute("data-custom-scroll"),this.un&&(this.un.style.scrollbarWidth=""))}emitValueEvent(t,n){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:{value:this.value,originalEvent:n}}))}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)}removeTextareaEvents(t){t.removeEventListener("input",this.handleInputEvent),t.removeEventListener("focus",this.handleFocusEvent),t.removeEventListener("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">${_t}</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.un=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">${_t}</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.un=i}this.updateValidity()}syncConstraintAttributes(t){const n=(n,e)=>null!==e?t.setAttribute(n,e+""):t.removeAttribute(n);n("minlength",z(this.getProperty("minlength"))),n("maxlength",z(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},k("textarea",{required:!0}),t??void 0):this.applyValidity({}));const{tooShort:e,tooLong:i}=C(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)}};dn.formAssociated=!0,dn.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 hn=dn;customElements.get("ty-textarea")||customElements.define("ty-textarea",hn);const un={"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"}},pn={default:["bottom-start","bottom-end","top-start","top-end","bottom","top","left","right"]},bn={top:"bottom",bottom:"top",left:"right",right:"left"};function gn(t){const[n,e]=t.split("-");return{side:n,align:e}}function mn(t){const{side:n,align:e}=gn(t),i=bn[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 vn(t){if(!t)return{side:"auto",align:"start"};const{side:n,align:e}=gn(t);return{side:"top"===n||"bottom"===n?n:"auto",align:e??"start"}}function fn(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 yn(t){const{targetEl:n,floatingEl:e,preferences:i=pn.default,offset:o=8,padding:r=8,containerPadding:s=0}=t,a=fn(n),l=fn(e),c=i.map(t=>function(t){const{targetRect:n,floatingRect:e,placement:i,offset:o,padding:r,scrollbarWidth:s,containerPadding:a}=t,l=un[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 m={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))},v=Object.values(m).reduce((t,n)=>t+Math.abs(n),0);return{x:Math.round(b),y:Math.round(g),placement:i,overflow:m,overflowAmount:v,fits:0===v}}({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 wn(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 xn={id:"ty-tooltip",css:"\n:host {\ndisplay: contents;\n}\n"},kn=new WeakMap,zn=new WeakMap,$n=new WeakMap,Cn=new WeakMap,Mn=new WeakMap;function En(t){const n=t||"neutral",e=n.replace(/[+-]$/,"");return/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?n:"neutral"}function Sn(t){let n=$n.get(t);return n||(n={showTimeout:null,hideTimeout:null},$n.set(t,n)),n}function Tn(t,n){return t.hasAttribute(n)}function Ln(t,n,e){const i=t.getAttribute(n);if(null===i)return e;const o=parseInt(i,10);return isNaN(o)?e:o}function _n(t){return{placement:t.getAttribute("placement")||"top",offset:Ln(t,"offset",8),delay:Ln(t,"delay",600),disabled:Tn(t,"disabled"),flavor:En(t.getAttribute("flavor"))}}function An(t){return t.parentElement}function qn(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=Cn.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),Cn.set(t,n);const e=Mn.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}=_n(t);return n.setAttribute("data-flavor",e),n.innerHTML=t.innerHTML,Fn(n,e),n}function Fn(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 Dn(t){const{placement:n,offset:e}=_n(t),i=An(t),o=Cn.get(t);if(!i||!o)return;const r=yn({targetEl:i,floatingEl:o,preferences:mn(n),offset:e});o.style.left=r.x+"px",o.style.top=r.y+"px",o.dataset.side=r.placement.split("-")[0]}function jn(t){const n=kn.get(t);n&&(n(),kn.delete(t))}function Hn(t){const n=Sn(t);null!==n.showTimeout&&(clearTimeout(n.showTimeout),n.showTimeout=null),null!==n.hideTimeout&&(clearTimeout(n.hideTimeout),n.hideTimeout=null)}const On=new WeakMap;function Vn(t){const n=On.get(t);n&&(document.removeEventListener("keydown",n,!0),On.delete(t))}function In(t){Vn(t);const n=Cn.get(t);if(n)try{n.hidePopover(),t.yn=!1,jn(t)}catch(e){}}function Wn(t){const n=Sn(t),{delay:e}=_n(t);Hn(t),n.showTimeout=window.setTimeout(()=>function(t){const{disabled:n}=_n(t);if(n)return;const e=qn(t);try{e.showPopover(),t.yn=!0,Dn(t),function(t){const n=An(t),e=Cn.get(t);if(!n||!e)return;let i=null;const o=()=>{null!==i&&clearTimeout(i),i=window.setTimeout(()=>{i=null,Dn(t)},10)},r=new ResizeObserver(o);r.observe(n),r.observe(e);let s=null;const a=()=>{null===s&&(s=requestAnimationFrame(()=>{s=null,Dn(t)}))};window.addEventListener("scroll",a,!0),window.addEventListener("resize",o),kn.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(On.has(t))return;const n=n=>{"Escape"===n.key&&(Hn(t),In(t))};On.set(t,n),document.addEventListener("keydown",n,!0)}(t)}catch(i){}}(t),e)}function Nn(t){const n=Sn(t);Hn(t),n.hideTimeout=window.setTimeout(()=>In(t),200)}class TyTooltip extends HTMLElement{constructor(){super(),this.yn=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["placement","offset","delay","disabled","flavor"]}connectedCallback(){this.yn=!1,H(this.shadowRoot,xn),function(t){const n=An(t);if(!n)return;Mn.set(t,n);const e=()=>Wn(t),i=()=>Nn(t),o=()=>Wn(t),r=()=>Nn(t);n.addEventListener("mouseenter",e),n.addEventListener("mouseleave",i),n.addEventListener("focusin",o),n.addEventListener("focusout",r),zn.set(t,()=>{n.removeEventListener("mouseenter",e),n.removeEventListener("mouseleave",i),n.removeEventListener("focusin",o),n.removeEventListener("focusout",r)})}(this),qn(this)}disconnectedCallback(){!function(t){Hn(t),jn(t),Vn(t);const n=zn.get(t);n&&(n(),zn.delete(t));const e=Cn.get(t),i=Mn.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(),Cn.delete(t)),Mn.delete(t),$n.delete(t)}(this)}attributeChangedCallback(t,n,e){if("flavor"===t){const t=Cn.get(this);t&&Fn(t,En(e))}"disabled"===t&&null!==e&&In(this)}}customElements.get("ty-tooltip")||customElements.define("ty-tooltip",TyTooltip);const Pn={locked:!1,scrollY:0,activeLocks:new Set};let Bn={overflow:"",paddingRight:""};function Rn(){return document.documentElement}const Yn={ArrowDown:["y",1],ArrowUp:["y",-1],PageDown:["y",1],PageUp:["y",-1],End:["y",1],Home:["y",-1]," ":["y",1],ArrowRight:["x",1],ArrowLeft:["x",-1]},Un=/^(?:text|search|email|url|tel|password|number|date|datetime-local|month|week|time|range|color)$/,Xn="undefined"!=typeof HTMLElement&&"popover"in HTMLElement.prototype;function Zn(t,n,e){if(!e)return!0;const i=t.composedPath().filter(t=>t instanceof Element),o=i.findIndex(t=>{return t instanceof HTMLDialogElement&&t.open||(n=t,Xn&&n.hasAttribute("popover")&&n.matches(":popover-open"));var n});return o>=0&&i.slice(0,o+1).some(t=>function(t,n,e){const i=getComputedStyle(t);if(!(/^(?:auto|scroll|overlay)$/.test("y"===n?i.overflowY:i.overflowX)||t instanceof HTMLTextAreaElement))return!1;const o="y"===n?t.scrollTop:Math.abs(t.scrollLeft),r="y"===n?t.scrollHeight-t.clientHeight:t.scrollWidth-t.clientWidth;return r>=1&&(e>0?r-1>o:o>0)}(t,n,e))}function Kn(t){if(t.ctrlKey)return;const n=Math.abs(t.deltaX)>Math.abs(t.deltaY)||t.shiftKey?"x":"y";t.cancelable&&!Zn(t,n,Math.sign(("y"!==n||t.shiftKey)&&t.deltaX||t.deltaY))&&t.preventDefault()}let Gn=0,Jn=0;function Qn(t){1===t.touches.length&&(Gn=t.touches[0].clientX,Jn=t.touches[0].clientY)}function te(t){if(1!==t.touches.length||!t.cancelable)return;const{clientX:n,clientY:e}=t.touches[0],i=Gn-n,o=Jn-e;Gn=n,Jn=e;const r=Math.abs(i)>Math.abs(o)?"x":"y";Zn(t,r,Math.sign("y"===r?o:i))||t.preventDefault()}function ne(t){const n=Yn[t.key];if(!n||t.defaultPrevented||t.altKey||t.ctrlKey||t.metaKey)return;const e=t.composedPath()[0];if(e instanceof Element&&function(t,n){if(t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)return!0;if(t instanceof HTMLElement&&t.isContentEditable)return!0;if(t instanceof HTMLInputElement){if(Un.test(t.type))return!0;if("radio"===t.type&&n.startsWith("Arrow"))return!0}return!(" "!==n||!t.matches("button, input, summary, a[href], [role]"))||!(" "===n||!t.matches("[role]:not([role=dialog]):not([role=document]):not([role=presentation]):not([role=none])"))}(e,t.key))return;const[i,o]=n;Zn(t,i," "===t.key&&t.shiftKey?-o:o)||t.preventDefault()}const ee={capture:!0,passive:!1};function ie(){if(!Pn.locked)return;const t=Rn();window,window.removeEventListener("wheel",Kn,ee),window.removeEventListener("touchstart",Qn,{capture:!0}),window.removeEventListener("touchmove",te,ee),window.removeEventListener("keydown",ne,!0),t.classList.remove("ty-scroll-locked"),t.style.overflow=Bn.overflow,t.style.paddingRight=Bn.paddingRight,Pn.locked=!1}function oe(t){Pn.activeLocks.has(t)||(Pn.activeLocks.add(t),1===Pn.activeLocks.size&&function(){if(Pn.locked)return;const t=window.innerWidth-Rn().clientWidth,n=Rn();window,Pn.scrollY=window.scrollY||Rn().scrollTop||0,Pn.locked=!0,Bn={overflow:n.style.overflow,paddingRight:n.style.paddingRight},n.style.overflow="hidden",t>0&&(n.style.paddingRight=t+"px"),n.classList.add("ty-scroll-locked"),window.addEventListener("wheel",Kn,ee),window.addEventListener("touchstart",Qn,{capture:!0,passive:!0}),window.addEventListener("touchmove",te,ee),window.addEventListener("keydown",ne,!0)}())}function re(t){Pn.activeLocks.has(t)&&(Pn.activeLocks.delete(t),0===Pn.activeLocks.size&&ie())}const se=new WeakMap,ae=new WeakMap,le=new WeakMap,ce=new WeakMap,de=new WeakMap,he=new WeakMap,ue=new WeakMap,pe=new WeakMap,be=new WeakMap,ge=new WeakSet;function me(t,n){return t.hasAttribute(n)}function ve(t,n,e){const i=t.getAttribute(n);if(null===i)return e;const o=parseInt(i,10);return isNaN(o)?e:o}function fe(t){return{manual:me(t,"manual"),disableClose:me(t,"disable-close"),placement:t.getAttribute("placement")||"bottom",offset:ve(t,"offset",8)}}function ye(t){return t.parentElement}function we(t){return t.querySelector(".popup-dialog")}function xe(t){let n=ue.get(t);return n||(n="popup-"+(t.id||Math.random().toString(36).substr(2,9)),ue.set(t,n)),n}function ke(t,n=!1){const{disableClose:e}=fe(t);if(!n&&e)return;const i=t.shadowRoot,o=i?we(i):null;if(!o)return;o.classList.remove("open"),o.classList.remove("preparing-animation");const r=ye(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(ce.get(t)),ce.set(t,setTimeout(()=>{ce.delete(t),o.classList.remove("position-calculated"),o.close()},s+20))}function ze(t){const n=t.shadowRoot,e=n?we(n):null;if(!e||!t.isConnected)return;const i=ye(t);if(e.open){const n=ce.get(t);return void(void 0!==n&&(clearTimeout(n),ce.delete(t),e.classList.add("open"),i?.hasAttribute("aria-haspopup")&&i.setAttribute("aria-expanded","true")))}oe(xe(t)),e.showModal(),function(t){if(be.has(t))return;const n=n=>{"Escape"===n.key&&fe(t).disableClose&&!Me(t,n)&&n.preventDefault()};be.set(t,n),document.addEventListener("keydown",n,!0)}(t),i?.hasAttribute("aria-haspopup")&&i.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>{!function(t){const{placement:n,offset:e}=fe(t),i=t.shadowRoot,o=ye(t),r=i?we(i):null;if(!o||!r)return;const s=yn({targetEl:o,floatingEl:r,preferences:mn(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"),e.getBoundingClientRect(),requestAnimationFrame(()=>{if(e.classList.add("open"),!t.matches(":focus-within")){const i=t.querySelector("[autofocus]");i?.focus({preventScroll:!0}),t.matches(":focus-within")||(e.focus({preventScroll:!0}),i&&requestAnimationFrame(()=>requestAnimationFrame(()=>{e.open&&n.activeElement===e&&i.focus({preventScroll:!0})})))}t.dispatchEvent(new CustomEvent("open"))})})}function $e(t){const n=t.shadowRoot,e=n?we(n):null;e&&(e.classList.contains("open")?ke(t):ze(t))}function Ce(t,n){n.preventDefault(),n.stopPropagation(),$e(t)}function Me(t,n){const e=t.shadowRoot?we(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}function Ee(t){const n=be.get(t);n&&(document.removeEventListener("keydown",n,!0),be.delete(t))}function Se(t){const{manual:n}=fe(t),e=ye(t);if(!e||n)return;e.setAttribute("aria-haspopup","dialog"),e.hasAttribute("aria-expanded")||e.setAttribute("aria-expanded","false");const i=pe.get(t)??e,o=se.get(t);o&&i.removeEventListener("pointerdown",o);const r=ae.get(t);r&&i.removeEventListener("click",r),pe.set(t,e);const s=n=>{ge.add(t),Ce(t,n)};se.set(t,s),e.addEventListener("pointerdown",s);const a=n=>{if(ge.delete(t))return;const e=n.detail,i="number"==typeof e?n:e?.originalEvent??n;0===i.detail&&(i.composedPath().includes(t)||Ce(t,n))};ae.set(t,a),e.addEventListener("click",a)}function Te(t){const n=pe.get(t);pe.delete(t);const e=se.get(t);n&&e&&(n.removeEventListener("pointerdown",e),se.delete(t));const i=ae.get(t);n&&i&&(n.removeEventListener("click",i),ae.delete(t)),n?.removeAttribute("aria-haspopup"),n?.removeAttribute("aria-expanded")}function Le(t){const n=t.shadowRoot;if(!n)return;const e=we(n);if(H(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;\noutline: 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;\ntransition-duration: var(--ty-popup-duration, 180ms), 0s, var(--ty-popup-duration, 180ms);\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",e.tabIndex=-1,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?we(e):null;i&&n.target===i&&(n.preventDefault(),ke(t))}(t,n);le.set(t,r),e.addEventListener("pointerdown",r);const s=n=>function(t,n){if(!Me(t,n)&&(n.stopPropagation(),"Escape"===n.key)){const{disableClose:e}=fe(t);e?n.preventDefault():ke(t)}}(t,n);de.set(t,s),t.addEventListener("keydown",s);const a=t=>{"Enter"!==t.key&&" "!==t.key||t.composedPath()[0]!==e||t.preventDefault()};for(const t of["keydown","keypress","keyup"])e.addEventListener(t,a);e.addEventListener("cancel",n=>{fe(t).disableClose&&n.preventDefault()}),new MutationObserver(()=>{if(e.open)return;clearTimeout(ce.get(t)),ce.delete(t),ge.delete(t),Ee(t),re(xe(t)),e.classList.remove("open"),e.classList.remove("preparing-animation");const n=ye(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=()=>ke(t,!0),t.openPopup=()=>ze(t),t.togglePopup=()=>$e(t);const i=he.get(t);i&&t.removeEventListener("ty:close-popup",i);const o=n=>function(t,n){n.stopPropagation(),ke(t,!0)}(t,n);he.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=ue.get(t);n&&(re(n),ue.delete(t)),Te(t);const e=t.shadowRoot,i=e?we(e):null;if(i){const n=le.get(t);n&&(i.removeEventListener("pointerdown",n),le.delete(t)),i.open&&i.close()}const o=de.get(t);o&&(t.removeEventListener("keydown",o),de.delete(t)),Ee(t);const r=he.get(t);r&&(t.removeEventListener("ty:close-popup",r),he.delete(t))}(this)}attributeChangedCallback(t,n,e){switch(Le(this),t){case"placement":case"offset":Le(this);break;case"manual":case"disable-close":Te(this),Se(this)}}}customElements.get("ty-popup")||customElements.define("ty-popup",TyPopup);const _e=new WeakMap,Ae=new WeakMap,qe=new WeakMap,Fe=new WeakMap,De=new WeakMap,je=new WeakMap,He=new WeakMap,Oe=new WeakSet,Ve=[];function Ie(t){const n=Ve.indexOf(t);0>n||Ve.splice(n,1)}function We(t,n){if(!t.hasAttribute(n))return!1;const e=t.getAttribute(n);return null===e||"false"!==e.toLowerCase()}function Ne(t){return{open:We(t,"open"),backdrop:!We(t,"no-backdrop"),closeOnOutsideClick:!We(t,"prevent-outside-click"),closeOnEscape:!We(t,"prevent-escape")}}function Pe(t){return t.querySelector(".ty-modal-dialog")}function Be(t,n,e){const i=new CustomEvent(n,{detail:e,cancelable:!0});t.dispatchEvent(i)}function Re(t,n="programmatic",e){const i=t.shadowRoot,o=i?Pe(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}He.set(t,n),t.removeAttribute("open")}}function Ye(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 Ue(t){Xe(t,t=>(t instanceof TyModal&&t.open&&t.removeAttribute("open"),t instanceof HTMLDialogElement&&t.matches(":modal")&&t.close(),!1))}function Xe(t,n,e=new WeakSet){const i=t=>{if(e.has(t))return!1;if(e.add(t),n(t))return!0;if(t.shadowRoot&&Xe(t.shadowRoot,n,e))return!0;if(t instanceof HTMLSlotElement)for(const o of t.assignedElements({flatten:!0}))if(i(o)||Xe(o,n,e))return!0;return!1};return Array.from(t.querySelectorAll("*")).some(i)}function Ze(t){const n=t.shadowRoot;if(!n)return;const e=Ne(t),i=function(t){let n=Pe(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",n.setAttribute("part","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=je.get(t);return n||(n="modal-"+(t.id||Math.random().toString(36).slice(2,11)),je.set(t,n)),n}(t);H(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@media (max-width: 768px) {\n.ty-modal-dialog[data-sheet] {\ninset: 0;\ntransform: none;\nwidth: 100%;\nheight: 100dvh;\nmax-width: none;\nmax-height: none;\npadding: env(safe-area-inset-top) env(safe-area-inset-right)\nenv(safe-area-inset-bottom) env(safe-area-inset-left);\nbackground: var(--ty-surface-floating);\nbox-sizing: border-box;\n}\n.ty-modal-dialog[data-sheet][open] {\nanimation-name: ty-modal-sheet-enter;\n}\n.ty-modal-dialog[data-sheet] .modal-content {\nheight: 100%;\noverflow-y: auto;\noverscroll-behavior: contain;\n}\n.ty-modal-dialog[data-sheet] ::slotted(*) {\nbox-sizing: border-box !important;\nwidth: 100% !important;\nmax-width: none !important;\nmin-height: 100% !important;\nmargin: 0 !important;\nborder: none !important;\nborder-radius: 0 !important;\n}\n.ty-modal-dialog[data-sheet] .close-button {\ntop: calc(env(safe-area-inset-top) + 8px);\nright: calc(env(safe-area-inset-right) + 8px);\ncolor: var(--ty-text-soft);\n}\n.ty-modal-dialog[data-sheet] .close-button:hover,\n.ty-modal-dialog[data-sheet] .close-button:focus:hover,\n.ty-modal-dialog[data-sheet] .close-button:active:hover {\ncolor: var(--ty-text);\n}\n}\n@keyframes ty-modal-sheet-enter {\nfrom {\ntransform: translateY(100%);\n}\nto {\ntransform: none;\n}\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@media (prefers-reduced-motion: reduce) {\n.ty-modal-dialog[open],\n.ty-modal-dialog[data-sheet][open],\n.ty-modal-dialog::backdrop {\nanimation: none;\n}\n}\n",id:"ty-modal"}),i.className="ty-modal-dialog",e.backdrop?i.setAttribute("data-backdrop","true"):i.removeAttribute("data-backdrop"),i.toggleAttribute("data-sheet",We(t,"sheet"));const r=t.getAttribute("label");if(r?i.setAttribute("aria-label",r):i.removeAttribute("aria-label"),function(t,n,e){const i=_e.get(t);if(i&&(n.removeEventListener("click",i),_e.delete(t)),e){const e=n=>function(t,n){n.stopPropagation();const e=t.shadowRoot,i=e?Pe(e):null;i&&n.target===i&&(n.preventDefault(),Re(t,"backdrop"))}(t,n);_e.set(t,e),n.addEventListener("click",e)}}(t,i,e.closeOnOutsideClick),function(t,n,e){const i=Ae.get(t);if(i&&(n.removeEventListener("keydown",i),Ae.delete(t)),e){const e=n=>function(t,n){Ye(n.currentTarget,n)||(n.stopPropagation(),"Escape"===n.key&&(n.preventDefault(),Re(t,"escape")))}(t,n);Ae.set(t,e),n.addEventListener("keydown",e)}else{const e=t=>{"Escape"!==t.key||Ye(n,t)||t.preventDefault()};Ae.set(t,e),n.addEventListener("keydown",e)}}(t,i,e.closeOnEscape),i.oncancel=n=>{n.preventDefault(),Ne(t).closeOnEscape&&Re(t,"escape")},function(t,n,e){const i=n.querySelector(".close-button");if(!i)return;i.style.display=e?"":"none";const o=qe.get(t);if(o&&(i.removeEventListener("click",o),qe.delete(t)),e){const n=n=>function(t,n){n.preventDefault(),n.stopPropagation(),Re(t,"close-button")}(t,n);qe.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=Fe.get(t),o=De.get(t);if(i&&(e.removeEventListener("mouseenter",i),Fe.delete(t)),o&&(e.removeEventListener("mouseleave",o),De.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);Fe.set(t,n),De.set(t,i),e.addEventListener("mouseenter",n),e.addEventListener("mouseleave",i)}}(t,i),e.open)i.open||(oe(o),i.showModal(),Ie(t),Ve.push(t),Ke(),Oe.delete(t)||Be(t,"open",{}));else if(Oe.delete(t),Ie(t),i.open){re(o),Ue(t),i.close(),Ke();const n=He.get(t)??"programmatic";He.delete(t),Be(t,"close",{reason:n})}Ke(),i.onclose=n=>{n.target===i&&!i.open&&t.isConnected&&(re(o),Ie(t),Ue(t),t.hasAttribute("open")&&(t.removeAttribute("open"),Be(t,"close",{reason:"native",returnValue:i.returnValue||void 0})),Ke())}}function Ke(){const t=Array.from(document.querySelectorAll("ty-modal[open], ty-dialog[open]")).some(t=>We(t,"open")&&!We(t,"no-backdrop")&&!We(t,"no-zoom"));document.documentElement.classList.toggle("ty-modal-zoom",t)}"undefined"!=typeof document&&document.addEventListener("keydown",function(t){if("Escape"!==t.key||t.defaultPrevented)return;const n=Ve[Ve.length-1];n&&(t.composedPath().some(t=>t instanceof HTMLDialogElement&&t.open)||Xe(n,t=>t instanceof HTMLDialogElement&&t.matches(":modal"))||(t.preventDefault(),Ne(n).closeOnEscape&&Re(n,"escape")))});class TyModal extends HTMLElement{static get observedAttributes(){return["open","no-backdrop","no-zoom","sheet","prevent-outside-click","prevent-escape","label"]}get open(){return We(this,"open")}set open(t){i(t)?this.setAttribute("open","true"):this.removeAttribute("open")}get noBackdrop(){return We(this,"no-backdrop")}set noBackdrop(t){i(t)?this.setAttribute("no-backdrop",""):this.removeAttribute("no-backdrop")}get sheet(){return We(this,"sheet")}set sheet(t){i(t)?this.setAttribute("sheet",""):this.removeAttribute("sheet")}get noZoom(){return We(this,"no-zoom")}set noZoom(t){i(t)?this.setAttribute("no-zoom",""):this.removeAttribute("no-zoom")}get preventOutsideClick(){return We(this,"prevent-outside-click")}set preventOutsideClick(t){i(t)?this.setAttribute("prevent-outside-click",""):this.removeAttribute("prevent-outside-click")}get preventEscape(){return We(this,"prevent-escape")}set preventEscape(t){i(t)?this.setAttribute("prevent-escape",""):this.removeAttribute("prevent-escape")}constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){L(this),Ze(this),this.show=()=>{this.setAttribute("open","true")},this.hide=t=>Re(this,"programmatic",t)}disconnectedCallback(){!function(t){const n=je.get(t),e=t.shadowRoot,i=e?Pe(e):null;if(Ie(t),n&&(re(n),je.delete(t)),Ke(),!i)return;i.open&&(i.close(),Oe.add(t));const o=_e.get(t);o&&(i.removeEventListener("click",o),_e.delete(t));const r=Ae.get(t);r&&(i.removeEventListener("keydown",r),Ae.delete(t));const s=i.querySelector(".close-button");if(s){const n=qe.get(t);n&&(s.removeEventListener("click",n),qe.delete(t))}const a=i.querySelector(".modal-content");if(a){const n=Fe.get(t),e=De.get(t);n&&(a.removeEventListener("mouseenter",n),Fe.delete(t)),e&&(a.removeEventListener("mouseleave",e),De.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 Ge=(t,n,e="")=>{const i=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}"])${e} {\n--select-accent: var(--ty-input-${t}-border, ${i("-soft")});\n--select-accent-bold: ${i("")};\n--select-ring: color-mix(in oklab, ${i("")} 15%, transparent);\n}\n:host([flavor="${t}+"]) {\n--select-accent: ${i("")};\n--select-accent-bold: ${i("-strong")};\n--select-ring: color-mix(in oklab, ${i("-strong")} 15%, transparent);\n}\n:host([flavor="${t}-"]) {\n--select-accent: ${i("-faint")};\n--select-accent-bold: ${i("-soft")};\n--select-ring: color-mix(in oklab, ${i("-soft")} 15%, transparent);\n}\n`},Je=`\n${Ct}\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));\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):not([disabled]) {\nbackground: var(--ty-bg-danger-soft);\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.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.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@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 .mobile-selected-chip {\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${cn}\n${n.filter(t=>"neutral"!==t).map(t=>Ge(t,void 0,"danger"===t?',\n:host([error]:not([error=""]))':"")).join("")}\n`;function Qe(t=768){return window.matchMedia(`(pointer: coarse) and (max-width: ${t}px)`).matches}let ti=0;const ni='<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>',ei='<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>',ii='<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>';function oi(t,n){if(!t)return;const e=t.assignedNodes();e.length===n.length&&n.every((t,n)=>e[n]===t)||t.assign(...n)}const ri=["trigger","start","end","loading"];function si(t){const n=t.getAttribute("selected");return null!==n&&!/^(false|0)$/i.test(n.trim())}const ai=class extends D{constructor(){super(),this.wn=++ti,this.xn={open:!1,search:"",highlightedIndex:-1,filteredTags:[],mode:"desktop"},this.kn=null,this.zn=null,this.$n=null,this.Cn=null,this.Mn=null,this.O=null,this.En=null,this.Sn=null;const t=this.shadowRoot;H(t,{css:Je,id:"ty-select-base"}),H(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-option slot[name="selected"] {\ndisplay: block;\nflex: 1 1 0%;\nmin-width: 0;\noverflow: hidden;\n}\n.select-stub.compact.has-option slot[name="selected"] {\nflex: 0 1 auto;\n}\n.select-stub ::slotted(ty-option) {\ndisplay: block;\nmin-width: 0;\noverflow: hidden;\n--ty-option-hidden-display: block;\npointer-events: none;\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#options-slot::slotted([hidden]),\n#options-slot::slotted([filtered-out]) {\ndisplay: none !important;\n}\n',id:"ty-select"})}onConnect(){this.Mn=new MutationObserver(t=>{t.some(t=>t.target!==this||"attributes"!==t.type||"has-trigger"===t.attributeName)&&this.render()}),this.Mn.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","selected","hidden","filtered-out","has-trigger"]}),this.W(),this.zn||(this.zn=this.handleKeyboard.bind(this),document.addEventListener("keydown",this.zn,!0)),this.m&&this.render()}W(){this.O=R(this.shadowRoot,this.O,this.getProperty("flavor"),({base:t})=>(t=>Ge(t,"neutral"))(t))}onDisconnect(){this.xn.open&&this.close(),this.zn&&(document.removeEventListener("keydown",this.zn,!0),this.zn=null),null!==this.$n&&(clearTimeout(this.$n),this.$n=null),this.Tn(),this.Mn?.disconnect(),this.Mn=null}onPropertiesChanged(t){for(const{name:n,newValue:e}of t)switch(n){case"flavor":this.W();break;case"multiple":{const t=this.getSelectedValues();!e&&t.length>1&&this.updateComponentValue([t[0]]);break}}}applyLoadingState(){const t=this.getProperty("loading"),n=t?X():null;this.shadowRoot.querySelectorAll(".dropdown-options-wrapper").forEach(e=>{if(e.classList.toggle("loading",t),t){e.setAttribute("aria-busy","true");const t=e.querySelector(".dropdown-loading-spinner");t&&n&&(t.innerHTML=n)}else e.removeAttribute("aria-busy")})}getFormValue(){const t=this.name;if(!t||this.externalSelection)return null;const n=this.getSelectedValues();if(!this.multiple)return n[0]??"";if(0===n.length)return null;const e=new FormData;return n.forEach(n=>e.append(t,n)),e}focus(t){if(this.disabled)return;const n=this.querySelector(':scope > [slot="trigger"]');if(n){n.focus(t);const e=n.getRootNode().activeElement;if(e&&n.contains(e))return}const e=this.shadowRoot?.querySelector(".select-stub");e?e.focus(t):super.focus(t)}parseValue(t){return t?t.split(",").map(t=>t.trim()).filter(t=>""!==t):[]}getSelectedValues(){return this.externalSelection?[]:this.parseValue(this.getProperty("value"))}getTagElements(){return Array.from(this.querySelectorAll("ty-option"))}getOfferedTags(){return this.getTagElements().filter(t=>!t.hasAttribute("hidden")).map(t=>this.getTagData(t))}getTagData(t){const n=t.value;return{value:"string"==typeof n?n:t.getAttribute("value")??(t.textContent||"").trim(),text:t.getAttribute("label")||t.textContent||"",element:t}}findOption(t){return this.getTagElements().find(n=>this.getTagData(n).value===t)}paintOptions(t){const n=this.externalSelection,e=new Set(this.getSelectedValues());for(const i of this.getTagElements())i.checked=n?si(i):e.has(this.getTagData(i).value),i.inTrigger=i===t}shownOption(){if(this.multiple||this.xn.open)return null;const t=this.getSelectedValues()[0],n=void 0===t?void 0:this.findOption(t);return n&&n.parentElement===this?n:null}assignSlots(t){const n=this.shadowRoot,e=new Map(ri.map(t=>[t,[]])),i=[];for(const o of Array.from(this.childNodes))o!==t&&(o instanceof Element&&e.has(o.slot)?e.get(o.slot).push(o):(o instanceof Element||o instanceof Text)&&i.push(o));for(const[o,r]of e)oi(n.querySelector(`slot[name="${o}"]`),r);oi(n.querySelector('slot[name="selected"]'),t?[t]:[]),oi(n.querySelector("#options-slot"),i)}syncTrigger(){const t=this.shownOption();this.assignSlots(t),this.paintOptions(t),this.updateSelectionDisplay(t)}updateComponentValue(t,n=!1,e="set",i=null,o=n){const r=this.getSelectedValues();[...t].sort().join("\0")===[...r].sort().join("\0")||(this.setProperty("value",t.join(",")),n&&(this.dispatchChangeEvent({value:this.multiple?[...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=vn(this.getProperty("placement")),c=wn({anchorRect:i,popupWidth:a,popupHeight:r,align:l.align,side:l.side,gap:8}),d=c.below,h=(d?c.topY:c.bottomY)-20,u=a+20+20;e.style.setProperty("--dropdown-x",c.x-20+"px"),e.style.setProperty("--dropdown-y",h+"px"),e.style.setProperty("--dropdown-width",u+"px"),e.style.setProperty("--dropdown-padding","20px"),e.classList.toggle("position-below",d),e.classList.toggle("position-above",!d)}Ln(){if(!an())return;const t=this.shadowRoot,n=t.querySelector(".dropdown-options"),e=t.querySelector(".dropdown-options-wrapper");n&&e&&(this.Tn(),n.classList.add("ty-custom-scroll"),this.Cn=new ln(n,{vertical:!0}),this.Cn.trackY&&e.appendChild(this.Cn.trackY))}Tn(){this.Cn&&(this.Cn.trackY?.remove(),this.Cn.destroy(),this.Cn=null)}open(){this.disabled||this.readonly||this.xn.open||("mobile"===this.xn.mode?this.openMobileModal():this.openDropdown())}close(){"mobile"===this.xn.mode?this.closeMobileModal():this.closeDropdown()}lockPageScroll(){this.kn=`select-${this.id||"anon"}-${this.wn}`,oe(this.kn)}unlockPageScroll(){this.kn&&(re(this.kn),this.kn=null)}setExpanded(t){this.shadowRoot.querySelector(".select-stub")?.setAttribute("aria-expanded",t+"")}openDropdown(){const t=this.shadowRoot,n=t.querySelector(".dropdown-dialog");if(!n)return;this.setExpanded(!0),this.lockPageScroll(),this.xn.open=!0,this.syncTrigger(),n.showModal(),this.calculatePosition(),n.classList.add("open"),t.querySelector(".dropdown-chevron")?.classList.add("open"),t.querySelector(".dropdown-search-chevron")?.classList.add("open"),this.xn.filteredTags=this.getOfferedTags(),this.xn.highlightedIndex=-1,this.updateOptionsVisibility(!0),this.Ln();const e=t.querySelector(".dropdown-search-input");e&&this.shouldShowSearch()&&setTimeout(()=>e.focus(),100),this.fireOpenEvent()}closeDropdown(){const t=this.shadowRoot,n=t.querySelector(".dropdown-dialog");n&&(this.setExpanded(!1),this.Tn(),n.classList.remove("open","position-above","position-below"),n.close(),this.unlockPageScroll(),this.xn.open=!1,this.xn.highlightedIndex=-1,this.syncTrigger(),t.querySelector(".dropdown-chevron")?.classList.remove("open"),t.querySelector(".dropdown-search-chevron")?.classList.remove("open"),this.resetSearch(".dropdown-search-input"),this.fireCloseEvent())}openMobileModal(){const t=this.shadowRoot.querySelector(".mobile-dialog");if(!t)return;this.setExpanded(!0),this.lockPageScroll(),this.xn.open=!0,this.syncTrigger(),t.showModal(),t.getBoundingClientRect(),t.classList.add("open");const n=this.getTagElements().map(t=>this.getTagData(t));this.xn.filteredTags=this.getOfferedTags(),this.updateTagVisibility(n,n),requestAnimationFrame(()=>this.updateMobileSelectedState()),this.fireOpenEvent()}closeMobileModal(){const t=this.shadowRoot.querySelector(".mobile-dialog");t&&(this.setExpanded(!1),t.classList.remove("open"),t.close(),this.unlockPageScroll(),this.xn.open=!1,this.xn.highlightedIndex=-1,this.syncTrigger(),this.resetSearch(".mobile-search-input"),this.fireCloseEvent())}resetSearch(t){const n=""!==this.xn.search;this.xn.search="";const e=this.shadowRoot.querySelector(t);if(e&&(e.value=""),this.externalSearch)return void(n&&(null!==this.$n&&(clearTimeout(this.$n),this.$n=null),this.fireSearchEvent("")));const i=this.getTagElements().map(t=>this.getTagData(t));this.xn.filteredTags=this.getOfferedTags(),this.updateTagVisibility(i,i),this.clearHighlights(i)}handleStubClick(t){t.preventDefault(),t.stopPropagation(),this.open()}handleClearClick(t){t.preventDefault(),t.stopPropagation(),this.disabled||this.readonly||(this.clear(),this.revealValidity())}handleStubKeydown(t){this.disabled||this.readonly||this.xn.open||"Enter"!==t.key&&" "!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.open())}handleTagClick(t){const n=t.target.closest("ty-option");n&&!n.hasAttribute("disabled")&&(t.preventDefault(),t.stopPropagation(),this.selectByTag(n))}selectByTag(t){const n=this.getTagData(t).value;if(this.externalSelection){const e=!this.multiple||!si(t);return this.dispatchChangeEvent({value:n,values:[],items:[],action:this.multiple?e?"add":"remove":"set",item:n,selected:e}),void(this.multiple||this.close())}if(!this.multiple)return this.updateComponentValue([n],!0,"set",n),void this.close();const e=this.getSelectedValues();e.includes(n)?this.updateComponentValue(e.filter(t=>t!==n),!0,"remove",n):this.updateComponentValue([...e,n],!0,"add",n)}tryCreateFromSearch(){if(!this.allowCreate)return!1;const t=(this.xn.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.createTransform?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");return l.setAttribute("value",a),l.textContent=i,this.appendChild(l),this.externalSelection?(this.selectByTag(l),this.multiple&&this.clearSearchAfterCreate(),!0):this.multiple?(this.updateComponentValue([...this.getSelectedValues(),a],!0,"create",a),this.clearSearchAfterCreate(),!0):(this.updateComponentValue([a],!0,"create",a),this.close(),!0)}clearSearchAfterCreate(){this.xn.search="",this.xn.highlightedIndex=-1;const t=this.searchInput();t&&(t.value="");const n=this.getTagElements().map(t=>this.getTagData(t));this.xn.filteredTags=this.getOfferedTags(),this.updateTagVisibility(n,n),this.updateOptionsVisibility(!0),this.clearHighlights(n),this.updateMobileSelectedState(),t?.focus()}searchInput(){return this.shadowRoot.querySelector(".dropdown-search-input, .mobile-search-input")}handleSearchInput(t){"mobile"===this.xn.mode&&this.expandMobileSection("available");const n=t.target.value;if(this.xn.search=n,this.externalSearch)return void this.dispatchSearchEvent(n);const e=this.getOfferedTags(),i=this.filterTags(e,n);this.xn.filteredTags=i,this.xn.highlightedIndex=-1,this.updateTagVisibility(i,e),this.updateOptionsVisibility(i.length>0),this.updateMobileSelectedState(),this.clearHighlights(e)}handleKeyboard(t){if(!this.xn.open)return;const n=this.xn.filteredTags,e=this.xn.highlightedIndex;switch(t.key){case"Escape":t.preventDefault(),t.stopPropagation(),this.close(),this.focus();break;case"Enter":t.preventDefault(),t.stopPropagation(),e>=0&&n.length>e?this.selectByTag(n[e].element):this.tryCreateFromSearch();break;case"ArrowUp":case"ArrowDown":{t.preventDefault(),t.stopPropagation();const i=this.nextEnabledTagIndex(n,e,"ArrowDown"===t.key?1:-1);this.xn.highlightedIndex=i,this.highlightTag(n,i);break}}}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++){const n=t[o].element;if(!n.hasAttribute("disabled")&&!n.hasAttribute("hidden")&&!n.hasAttribute("filtered-out"))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})=>{n.toggleAttribute("filtered-out",!e.has(t))})}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.$n&&(clearTimeout(this.$n),this.$n=null);const n=this.getProperty("debounce");n>0?this.$n=window.setTimeout(()=>{this.fireSearchEvent(t),this.$n=null},n):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.xn.mode,element:this}})),this.externalSearch&&this.fireSearchEvent("")}fireCloseEvent(){this.dispatchEvent(new CustomEvent("close",{detail:{mode:this.xn.mode,element:this}}))}dispatchChangeEvent(t){this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,cancelable:!0}))}render(){this.shadowRoot.querySelector(".select-container")||this.build(),this.syncTrigger(),this.xn.open&&this.refreshOpenList(),this.updateSearchVisibility(),this.applyLoadingState(),this.syncFieldChrome(),this.syncTriggerSlot(),this.updateMobileSelectedState(),this.updateFormValue(),this.updateValidity()}refreshOpenList(){const t=this.getOfferedTags(),n=this.externalSearch?t:this.filterTags(t,this.xn.search);this.externalSearch||this.updateTagVisibility(n,this.getTagElements().map(t=>this.getTagData(t)));const e=this.xn.filteredTags[this.xn.highlightedIndex]?.element;this.xn.filteredTags=n,this.xn.highlightedIndex=n.findIndex(t=>t.element===e)}syncFieldChrome(){const t=this.shadowRoot,n=t.querySelector(".select-container"),e=this.label,i=this.required,o=this.disabled,r="select-label-"+this.wn;let s=n.querySelector(":scope > .ty-field-label");e?(s||(s=document.createElement("label"),s.className="ty-field-label",s.id=r,n.prepend(s)),s.innerHTML=`${e}${i?`<span class="required-icon">${_t}</span>`:""}`):s?.remove();const a=this.error||"",l="select-error-"+this.wn;let c=n.querySelector(":scope > .error-message");a?(c||(c=document.createElement("div"),c.className="error-message",c.id=l,n.append(c)),c.textContent=a):c?.remove();const d=t.querySelector(".select-stub");d.classList.toggle("disabled",o),d.classList.toggle("compact",this.compact),d.classList.toggle("error",!!a),d.tabIndex=o?-1:0,d.toggleAttribute("disabled",o),o?d.setAttribute("aria-disabled","true"):d.removeAttribute("aria-disabled"),e?d.setAttribute("aria-labelledby",r):d.removeAttribute("aria-labelledby"),a?(d.setAttribute("aria-invalid","true"),d.setAttribute("aria-describedby",l)):(d.removeAttribute("aria-invalid"),d.removeAttribute("aria-describedby")),this.syncTriggerAria(),t.querySelectorAll(".dropdown-search-input, .mobile-search-input").forEach(t=>t.disabled=o)}syncTriggerAria(){const t=this.error||"",n=t?this.querySelector(':scope > [slot="trigger"]'):null;this.En&&this.En!==n&&(this.En.removeAttribute("aria-invalid"),this.En.removeAttribute("aria-description")),n&&("true"!==n.getAttribute("aria-invalid")&&n.setAttribute("aria-invalid","true"),n.getAttribute("aria-description")!==t&&n.setAttribute("aria-description",t)),this.En=n,this.Sn??(this.Sn=new MutationObserver(()=>this.syncTriggerAria())),this.Sn.disconnect(),n&&this.Sn.observe(n,{attributes:!0,attributeFilter:["aria-invalid","aria-description"]})}updateValidity(){if(this.disabled||this.externalSelection)this.applyValidity({});else if(this.required&&0===this.getSelectedValues().length){const t=this.shadowRoot?.querySelector(".select-stub");this.applyValidity({valueMissing:!0},k("select",{required:!0,multiple:this.multiple}),t??void 0)}else this.applyValidity({})}syncTriggerSlot(){const t=this.shadowRoot,n=t.querySelector('slot[name="trigger"]').assignedElements().length>0;t.querySelector(".select-stub").classList.toggle("custom-trigger",n),this.hasAttribute("has-trigger")!==n&&this.toggleAttribute("has-trigger",n)}build(){const t=this.shadowRoot,n=Qe();this.xn.mode=n?"mobile":"desktop";const e="select-listbox-"+this.wn,i=this.multiple?'aria-multiselectable="true"':"",o='\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>',r=`\n<dialog class="dropdown-dialog">\n<div class="dropdown-header">\n<div class="dropdown-search-icon" aria-hidden="true">${ei}</div>\n<input class="dropdown-search-input" type="text" placeholder="Search..." />\n<div class="dropdown-search-chevron">${ni}</div>\n</div>\n<div class="dropdown-options-wrapper">\n<div class="dropdown-options" id="${e}" role="listbox" ${i}>\n<slot id="options-slot"></slot>\n</div>\n${o}\n</div>\n</dialog>`,s=this.label,a=`\n<dialog class="mobile-dialog">\n<div class="mobile-dialog-content">\n<div class="mobile-search-header">\n${s?`<span class="mobile-header-label">${s}</span>`:""}\n<div class="mobile-header-content">\n<div class="dropdown-search-icon" aria-hidden="true">${ei}</div>\n<input class="mobile-search-input" type="text"\nplaceholder="${s?`Search ${s}...`:"Search..."}" autofocus />\n<button class="mobile-close-button" type="button" aria-label="Close">${ii}</button>\n</div>\n</div>\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"></span>\n${ni}\n</button>\n<div class="section-content mobile-selected-chips"></div>\n</div>\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"></span>\n${ni}\n</button>\n<div class="section-content dropdown-options-wrapper" id="${e}" role="listbox" ${i}>\n<slot id="options-slot"></slot>\n<div class="empty-state">${this.getProperty("no-options-message")}</div>\n${o}\n</div>\n</div>\n</div>\n</div>\n</dialog>`;t.innerHTML=`\n<div class="select-container dropdown-mode-${this.xn.mode}">\n<div class="dropdown-wrapper">\n<div class="dropdown-stub select-stub"\nrole="combobox"\naria-haspopup="listbox"\naria-expanded="false"\naria-controls="${e}"\ntabindex="0">\n<slot name="trigger">\n<slot name="start"></slot>\n<slot name="selected"></slot>\n<span class="dropdown-placeholder"></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${ii}\n</button>\n<div class="dropdown-chevron">${ni}</div>\n</slot>\n</div>\n${n?a:r}\n</div>\n</div>\n`;const l=t.querySelector(".select-stub");l.addEventListener("click",t=>this.handleStubClick(t)),l.addEventListener("keydown",t=>this.handleStubKeydown(t)),t.querySelector(".select-clear").addEventListener("click",t=>this.handleClearClick(t)),t.querySelector('slot[name="trigger"]').addEventListener("slotchange",()=>{this.syncTriggerSlot(),this.syncFieldChrome()}),t.querySelector("#options-slot").addEventListener("click",t=>this.handleTagClick(t));const c=this.searchInput();c.addEventListener("input",t=>this.handleSearchInput(t));const d=t.querySelector("dialog");d.addEventListener("click",t=>{t.target===d&&this.close()}),d.addEventListener("cancel",t=>{t.preventDefault(),this.close(),this.focus()}),this.syncOnOutsideClose(d),n?(t.querySelectorAll(".mobile-body .section-header").forEach(t=>{t.addEventListener("click",()=>this.expandMobileSection("selected"===t.dataset.section?"selected":"available"))}),t.querySelector(".mobile-close-button").addEventListener("click",()=>this.close())):c.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault()})}syncOnOutsideClose(t){new MutationObserver(()=>{this.xn.open&&!t.open&&this.close()}).observe(t,{attributes:!0,attributeFilter:["open"]})}updateMobileSelectedState(){if("mobile"!==this.xn.mode)return;const t=this.shadowRoot;this.renderMobileSelectedChips();const n=t.querySelector(".mobile-available-section");if(n){const t=new Set(this.getSelectedValues()),e=this.getOfferedTags().filter(({element:t})=>!t.hasAttribute("filtered-out")),i=e.filter(({value:n})=>!t.has(n)).length;n.setAttribute("data-empty",(0===e.length)+""),this.setMobileSectionTitle(n,this.getProperty("available-label"),i)}}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.getSelectedValues().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.getSelectedValues();n.setAttribute("data-empty",(0===i.length)+""),this.setMobileSectionTitle(n,this.getProperty("selected-label"),i.length),0===i.length&&this.expandMobileSection("available"),e.textContent="";for(const{value:o,label:r}of this.getSelectedItems(i)){const t=document.createElement("button");t.type="button",t.className="mobile-selected-chip",t.dataset.value=o,t.setAttribute("aria-label","Remove "+r),t.innerHTML='<span class="chip-label"></span>'+ii,t.querySelector(".chip-label").textContent=r,t.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.deselectValue(o)}),e.appendChild(t)}}shouldShowSearch(){return!(!this.externalSearch&&!this.allowCreate)||!this.notSearchable&&this.getTagElements().length>7}updateSearchVisibility(){const t=this.shadowRoot,n=this.shouldShowSearch(),e=t.querySelector(".dropdown-header");e&&(e.hidden=!n),t.querySelectorAll(".mobile-search-input, .mobile-header-content .dropdown-search-icon").forEach(t=>t.hidden=!n)}updateSelectionDisplay(t){const n=this.shadowRoot.querySelector(".select-stub"),e=this.getSelectedValues(),i=e.length;n.classList.toggle("has-selection",i>0),n.classList.toggle("has-option",null!==t);const o=n.querySelector(".select-count");o.textContent=i+"",o.hidden=0===i||!this.multiple||!this.compact,n.querySelector(".select-clear").hidden=!(i>0&&!this.noClear&&!this.disabled&&!this.readonly);const r=n.querySelector(".dropdown-placeholder");r.hidden=null!==t;const s=this.xn.open||0===i||this.multiple&&this.compact?null:this.getSelectedItems(e).map(t=>t.label).join(", ");r.textContent=s??this.placeholder,r.classList.toggle("placeholder-shown",null===s)}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 externalSelection(){return this.getProperty("externalSelection")}set externalSelection(t){this.setProperty("externalSelection",t)}get allowCreate(){return this.getProperty("allowCreate")}set allowCreate(t){this.setProperty("allowCreate",t)}get createTransform(){return this.getProperty("createTransform")}set createTransform(t){this.setProperty("createTransform",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 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.C.form}};ai.slotAssignment="manual",ai.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},externalSelection:{type:"boolean",visual:!0,default:!1},allowCreate:{type:"boolean",visual:!0,default:!1},createTransform:{type:"string",visual:!1,default:"none",coerce:t=>"slug"===t?"slug":"none"},notSearchable:{type:"boolean",visual:!0,default:!1},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 li=ai;function ci(t,n){return t.replace(/\{([\w-]+)\}/g,(t,e)=>n[e]??t)}customElements.get("ty-select")||customElements.define("ty-select",li);class TySelectedOptions extends HTMLElement{constructor(){super(...arguments),this._n=null,this.An=()=>this.renderChips(),this.Mn=null,this.qn=null,this.Fn=null,this.m=[],this.Dn=!1,this.jn=()=>{this.Dn=!0},this.Hn=()=>{this.Dn=!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.bind(),this.renderChips())},{once:!0}),this.Mn=new MutationObserver(()=>{this.style.display||(this.style.display="contents"),this.template()===this.Fn&&this.intact()||this.renderChips()}),this.Mn.observe(this,{childList:!0,attributes:!0,attributeFilter:["style"]})}disconnectedCallback(){this.unbind(),this.Mn?.disconnect(),this.Mn=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();if(t!==this._n&&(this.unbind(),this._n=t,this._n?.addEventListener("change",this.An),this._n?.addEventListener("open",this.jn),this._n?.addEventListener("close",this.Hn),this._n)){const t=this._n.localName;t.includes("-")&&!customElements.get(t)&&customElements.whenDefined(t).then(()=>{this.isConnected&&this.renderChips()}),this.qn=new MutationObserver(()=>this.renderChips()),this.qn.observe(this._n,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","flavor"]})}}unbind(){this._n?.removeEventListener("change",this.An),this._n?.removeEventListener("open",this.jn),this._n?.removeEventListener("close",this.Hn),this.qn?.disconnect(),this.qn=null,this._n=null,this.Dn=!1}values(){return(this._n?.value??"").split(",").map(t=>t.trim()).filter(Boolean)}intact(){const t=this.childNodes;return t.length===this.m.length&&this.m.every((n,e)=>t[e]===n)}template(){return this.querySelector(":scope > template")}option(t){return this._n?.querySelector(`[value="${CSS.escape(t)}"]`)}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=ci(r.textContent,e));else{const t=r;for(const n of Array.from(t.attributes)){if(!n.value.includes("{"))continue;const i=ci(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.Dn)return;const t=this.template();if(this.Fn=t,!this._n)return this.m=t?[t]:[],void this.replaceChildren(...this.m);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.m=Array.from(n.childNodes),this.replaceChildren(n)}deselect(t){if(!this._n)return;const n=this._n;"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 di=new WeakMap,hi=new WeakMap,ui=new WeakMap,pi=new WeakMap,bi=new WeakMap;let gi=0;const mi=()=>{gi++};addEventListener("pointerdown",mi,{capture:!0,passive:!0}),addEventListener("keydown",mi,{capture:!0,passive:!0});const vi=new WeakMap;let fi=0;function yi(t){return{placement:t.getAttribute("placement")||"top",fixed:t.hasAttribute("fixed")}}function wi(t){return Array.from(t.querySelectorAll(":scope > ty-tab"))}function xi(t){return t.getAttribute("id")}function ki(t,n){return t.querySelector(`:scope > [slot='label-${n}']`)}function zi(t,n){const e=xi(n);return e&&function(t,n){return null!==ki(t,n)}(t,e)?"slot":"text"}function $i(t){return t.hasAttribute("disabled")}function Ci(t,n){const e=t.findIndex(t=>xi(t)===n);return 0>e?void 0:e}function Mi(t){return ui.get(t)??null}function Ei(t,n){const e=n.map(xi).filter(t=>!!t),i=t.getAttribute("active");if(i&&e.includes(i))return i;const o=ui.get(t);return o&&e.includes(o)?o:e[0]??null}function Si(t,n){t.setAttribute("active",n),Oi(t,!0)}function Ti(t,n,e){e.preventDefault(),e.stopPropagation(),Si(t,n)}function Li(t){const n=di.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 _i(t,n,e){Li(t);const i={tabClickHandlers:new Map,tabKeydownHandlers:new Map};e.forEach(e=>{const o=xi(e);if(!o)return;const r=n.querySelector(`[data-tab-id='${o}']`);if(r){const e=n=>Ti(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&&(Ti(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)}}),di.set(t,i)}function Ai(t){return`translateX(${-100*t}%)`}function qi(t){if(!t)return;const n=++fi+"";t.setAttribute("data-snap",n),requestAnimationFrame(()=>requestAnimationFrame(()=>{t.getAttribute("data-snap")===n&&t.removeAttribute("data-snap")}))}function Fi(t,n,e){t.getAttribute(n)!==e&&t.setAttribute(n,e)}function Di(t,n,e){wi(t).forEach(i=>{const o=xi(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=ki(t,o);n&&Fi(n,"data-active",s+"")}})}function ji(t,n){!function(t,n){const e=t.shadowRoot;if(!e)return;let i=pi.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],pi.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),wi(t).forEach(t=>{const e=xi(t);t.setShown?.(!!e&&e===n),e&&Fi(t,"data-active",(e===n)+"")})}function Hi(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.getBoundingClientRect(),o.style.transition="")}function Oi(t,n=!1){const e=t.shadowRoot;if(!e)return;const i=wi(t),o=ui.get(t)??null,r=Ei(t,i),s=(r?Ci(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!==Ai(s)&&(qi(a),t.style.transform=Ai(s)))}ui.set(t,r);const l=null===o,c=!n&&null!==r&&vi.get(t)===r;vi.delete(t);const d=t.getAttribute("active");l&&d&&d!==r&&vi.set(t,d);const h=!n&&(l||c||bi.get(t)===gi);if(l?bi.set(t,gi):c||bi.delete(t),h&&qi(a),function(t,n){const e=t.shadowRoot?.querySelector(".panels-wrapper");e&&(e.style.transform=Ai(n))}(t,s),Di(t,e,r||""),ji(t,r),!r||l)return;if(Hi(t,r,h),Pi(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=Ci(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]?.On?.(s)}function Vi(t,n){const e=xi(n);if(e&&"slot"===zi(t,n)){const n=ki(t,e);return n?.textContent?.trim()||e}return n.getAttribute("label")||"Tab"}function Ii(t){t.querySelector(".tab-overflow-trigger")?.remove()}function Wi(t){const n=t.shadowRoot;if(!n)return;const e=n.querySelector(".tab-buttons"),i=n.querySelector(".tab-strip");if(!e||!i)return;if(yi(t).fixed)return Ii(n),i.classList.add("unclipped"),i.style.removeProperty("--fade-left"),void i.style.removeProperty("--fade-right");const o=i.scrollLeft;if(Ii(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 Ni(i);!function(t,n,e){const i=Ei(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=xi(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=Vi(t,n),$i(n)?o.disabled=!0:o.addEventListener("click",()=>{Si(t,e),r.closePopup?.()}),s.appendChild(o)}),r.appendChild(s),o.appendChild(r),n.appendChild(o)}(t,e,wi(t)),a>e.clientWidth-i.clientWidth||Ii(n),i.scrollLeft=o,Ni(i)}function Ni(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 Pi(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 Bi(t){const n=t.shadowRoot;if(!n)return;const{placement:e,fixed:i}=yi(t),o=wi(t),r=Ei(t,o),s=r?Ci(o,r)??0:0;o.forEach(n=>n.setPanelLabel?.(Vi(t,n)));const a=n.querySelector(".tabs-container"),l=n.querySelector(".tab-buttons"),c=n.querySelector(".tab-strip"),d=n.querySelector(".panels-viewport");if(H(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=xi(n);if(!i)return"";const o=zi(t,n),r="text"===o?n.getAttribute("label")||"Tab":"",s=$i(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,_i(t,n,o),Di(t,n,r||"");const u=!ui.get(t);requestAnimationFrame(()=>{const n=Mi(t);Wi(t),n&&(Hi(t,n,u),Pi(t,n,!u))}),ji(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=xi(n);if(!i)return"";const o=zi(t,n),r="text"===o?n.getAttribute("label")||"Tab":"",s=$i(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: ${Ai(s)}">\n<slot></slot>\n</div>\n</div>\n</div>\n`,requestAnimationFrame(()=>{const n=Mi(t);Wi(t),n&&(Hi(t,n),Pi(t,n,!1))}),_i(t,n,o),Di(t,n,r||"");const a=n.querySelector(".tab-strip");a?.addEventListener("scroll",()=>Ni(a),{passive:!0}),ji(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.Mn=null,this.Vn=!1,this.In=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["width","height","active","placement","fixed"]}get activeTab(){return ui.get(this)??null}connectedCallback(){Bi(this),Oi(this),function(t){const n=hi.get(t);n&&n.disconnect();const e=new ResizeObserver(()=>{const n=Mi(t);Wi(t),n&&(Hi(t,n),Pi(t,n,!1))});e.observe(t),hi.set(t,e)}(this),this.Mn=new MutationObserver(()=>this.Wn(!0)),this.Mn.observe(this,{childList:!0})}disconnectedCallback(){this.Mn?.disconnect(),this.Mn=null,Li(this),function(t){const n=hi.get(t);n&&(n.disconnect(),hi.delete(t))}(this)}Wn(t){this.In||(this.In=t),this.Vn||(this.Vn=!0,queueMicrotask(()=>{this.Vn=!1,this.isConnected&&(this.Mn?.takeRecords().length&&(this.In=!0),this.In&&(this.In=!1,Bi(this)),Oi(this))}))}attributeChangedCallback(t,n,e){this.isConnected&&("active"===t?(n!==e&&vi.delete(this),this.Wn(!1)):Bi(this))}}customElements.get("ty-tabs")||customElements.define("ty-tabs",TyTabs);const Ri=`\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${cn}\n`,Yi=new Set(["loading","error"]),Ui=new Set(["template","script","style"]);class TyTab extends HTMLElement{constructor(){super(),this.bn=null,this.Nn=null,this.Pn=!0,this.Bn="idle",this.Rn=null,this.Yn=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["id","label","disabled","lazy"]}connectedCallback(){this.Un(),this.bn||this.vn(),this.Xn()}setPanelLabel(t){this.Nn=t,this.Zn()}setShown(t){this.Pn=t,this.Zn()}disconnectedCallback(){this.mn(),this.Yn=!!this.Rn?.takeRecords().length,this.Rn?.disconnect(),this.Rn=null}On(t){this.Rn?.takeRecords().length&&this.Kn(!1),"empty"!==this.Bn&&"failed"!==this.Bn||this.Gn(t)}loadFailed(){"loading"!==this.Bn&&"empty"!==this.Bn||this.Jn("failed")}attributeChangedCallback(t,n,e){if(this.Un(),"lazy"===t)return void(this.isConnected&&this.Xn());const i=this.parentElement;n!==e&&this.isConnected&&"ty-tabs"===i?.localName&&i.Wn?.(!0)}Un(){const t=this.shadowRoot;t&&(t.querySelector(".tab-wrapper")||(H(t,{css:Ri,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.Zn())}Xn(){const t=this.hasAttribute("lazy");t&&!this.Rn?(this.Rn=new MutationObserver(()=>this.Kn(!0)),this.Rn.observe(this,{childList:!0,characterData:!0,subtree:!0})):!t&&this.Rn&&(this.Rn.disconnect(),this.Rn=null);const n=this.Yn;this.Yn=!1,this.Kn(n)}Qn(){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(!Yi.has(n.getAttribute("slot")??"")&&!Ui.has(n.localName))return!0}return!1}Kn(t){this.hasAttribute("lazy")&&!this.Qn()?"idle"===this.Bn&&(this.Jn("empty"),t&&queueMicrotask(()=>{"empty"===this.Bn&&this.Pn&&"ty-tabs"===this.parentElement?.localName&&this.Gn()})):this.Jn("idle")}Gn(t){const n=this.parentElement;void 0===t&&(t="ty-tabs"===n?.localName?Array.from(n.querySelectorAll(":scope > ty-tab")).indexOf(this):0),this.Jn("loading"),this.dispatchEvent(new CustomEvent("ty-tab-load",{detail:{id:this.id,index:t}}))}te(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.Gn()}))}Jn(t){if(t===this.Bn)return;this.Bn=t;const n=this.shadowRoot?.querySelector(".tab-panel");n&&("loading"===t||"failed"===t?(this.te(n),n.dataset.load=t):delete n.dataset.load,"loading"===t?(n.setAttribute("aria-busy","true"),n.querySelector(".tab-spinner").innerHTML=X()):n.removeAttribute("aria-busy"))}Zn(){const t=this.shadowRoot?.querySelector(".tab-panel");if(!t)return;const n=this.parentElement,e=!this.Nn&&this.id&&"ty-tabs"===n?.localName?n.querySelector(`:scope > [slot="label-${CSS.escape(this.id)}"]`):null,i=this.Nn||e?.textContent?.trim()||this.getAttribute("label");i?t.setAttribute("aria-label",i):t.removeAttribute("aria-label"),t.parentElement.inert=!this.Pn}vn(){const t=this.shadowRoot?.querySelector(".tab-panel"),n=this.shadowRoot?.querySelector(".tab-wrapper");t&&n&&an()&&(t.classList.add("ty-custom-scroll"),this.bn=new ln(t,{vertical:!0}),this.bn.trackY&&n.appendChild(this.bn.trackY))}mn(){this.bn&&(this.bn.trackY?.remove(),this.bn.destroy(),this.bn=null)}resetScroll(){this.bn?.scrollToTop(!1)}}customElements.get("ty-tab")||customElements.define("ty-tab",TyTab);const Xi=new WeakMap;function Zi(t){return Array.from(t.querySelectorAll("ty-step"))}function Ki(t){return t.getAttribute("id")}function Gi(t){const n=t.getAttribute("completed")||"";return n.trim()?new Set(n.split(",").map(t=>t.trim()).filter(Boolean)):new Set}function Ji(t,n){const e=t.findIndex(t=>Ki(t)===n);return 0>e?void 0:e}function Qi(t,n){const e=t.getAttribute("active");return e&&void 0!==Ji(n,e)?e:n.length>0?Ki(n[0]):null}function to(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 no(t,n,e){const i=Zi(t),o=Gi(t);i.forEach(i=>{const r=Ki(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=io(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 eo(t,n){Zi(t).forEach(t=>{const e=Ki(t);e&&t.setAttribute("data-active",(e===n)+"")})}function io(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 oo={completed:"completed",active:"current",pending:"not started",error:"has an error"};function ro(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=Zi(t),r=Qi(t,o),s=Gi(t);o.forEach(t=>{const n=Ki(t);n&&(t.setAttribute("role","tabpanel"),t.setAttribute("aria-labelledby","step-"+n),t.setAttribute("tabindex","0"))}),H(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=>Ki(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=>Ki(t)===e):0),s=n.map((n,r)=>{const s=Ki(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=io(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}, ${oo[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="${io(t,Ki(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){to(t);const i={stepClickHandlers:new Map};e.forEach(e=>{const o=Ki(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=Zi(t),o=i.findIndex(t=>Ki(t)===n);if(0>o)return;const r=Qi(t,i),s=r?Ji(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),no(t,n,r||""),r&&eo(t,r),!ao.has(t)){const n=new ResizeObserver(()=>so(t));n.observe(t),ao.set(t,n),document.fonts?.ready.then(()=>t.isConnected&&so(t))}so(t)}function so(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 ao=new WeakMap;class TyWizard extends HTMLElement{constructor(){super(),this.Mn=null,this.ne=!1,this.attachShadow({mode:"open"})}static get observedAttributes(){return["width","height","active","completed","orientation"]}connectedCallback(){ro(this),this.Mn=new MutationObserver(t=>{t.some(t=>"childList"===t.type&&t.target===this||"TY-STEP"===t.target.tagName&&t.target.parentElement===this)&&!this.ne&&(this.ne=!0,queueMicrotask(()=>{this.ne=!1,this.isConnected&&ro(this)}))}),this.Mn.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["status","label","description","disabled"]})}disconnectedCallback(){this.Mn?.disconnect(),this.Mn=null,to(this),ao.get(this)?.disconnect(),ao.delete(this)}attributeChangedCallback(t,n,e){"active"===t?(e&&function(t,n){const e=Zi(t),i=t.shadowRoot;if(!i)return;const o=Qi(t,e),r=o?Ji(e,o):void 0,s=Ji(e,n);if(o===n||void 0===s)return;t.style.setProperty("--ty-wizard-active-index",s+""),no(t,i,n),eo(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),ro(this)):ro(this)}}customElements.get("ty-wizard")||customElements.define("ty-wizard",TyWizard);const lo=`\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${cn}\n`;class TyStep extends HTMLElement{constructor(){super(),this.bn=null,this.attachShadow({mode:"open"})}static get observedAttributes(){return["id","label","description","disabled","status"]}connectedCallback(){this.Un()}disconnectedCallback(){this.mn()}attributeChangedCallback(t,n,e){this.Un()}Un(){const t=this.shadowRoot;if(!t)return;const n=this.getAttribute("id");t.querySelector(".step-wrapper")||(H(t,{css:lo,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.vn())}vn(){const t=this.shadowRoot?.querySelector(".step-panel"),n=this.shadowRoot?.querySelector(".step-wrapper");t&&n&&an()&&(t.classList.add("ty-custom-scroll"),this.bn=new ln(t,{vertical:!0}),this.bn.trackY&&n.appendChild(this.bn.trackY))}mn(){this.bn&&(this.bn.trackY?.remove(),this.bn.destroy(),this.bn=null)}resetScroll(){this.bn?.scrollToTop(!1)}}customElements.get("ty-step")||customElements.define("ty-step",TyStep);const co=(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`},ho=n.map(t=>co(t)).join(""),uo=`\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));\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${ho}\n`;function po(t){if(!Number.isInteger(t)||1>t||t>12)throw new RangeError(`Invalid month: ${t}. Must be an integer between 1 and 12.`)}function bo(t,n,e){const i=new Date(2e3,0,1,12);return i.setFullYear(t,n-1,e),i.setHours(0,0,0,0),i}function go(t,n,e){const i=new Date(0);return i.setUTCFullYear(t,n-1,e),i.getTime()}function mo(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:go(o,r,s),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 vo(t,n){const e=new Date(t);return e.setDate(e.getDate()+n),e}function fo(t,n="en-US",e="long"){po(t);const i=new Date(2024,t-1,1);return new Intl.DateTimeFormat(n,{month:e}).format(i)}const yo=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?)?$/;function wo(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 xo(t){if(null==t||""===t)return null;if("string"==typeof t){const n=yo.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=wo(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 ko(t){const n=xo(t instanceof Date?t.getTime():t);return!n||1>n.year||n.year>9999?null:{year:n.year,month:n.month,day:n.day}}function zo(t,n,e){const i=(t,n)=>(""+t).padStart(n,"0");return`${i(t,4)}-${i(n,2)}-${i(e,2)}`}function $o(t){const n=ko(t);return n&&zo(n.year,n.month,n.day)}function Co(t){return t instanceof HTMLElement}function Mo(t){if(!t)return null;const n=ko(t);return n?go(n.year,n.month,n.day):null}function Eo(t){if(!t||""===t)return null;const n=t+"";return/^\d+(\.\d+)?$/.test(n)?n+"px":n}class TyCalendarMonth extends HTMLElement{constructor(){super(),this.ee="md",this.O=null,this.ie=null,this.oe=[];const t=new Date;this.re=t.getFullYear(),this.se=t.getMonth()+1,this.attachShadow({mode:"open"}),T(this)}static get observedAttributes(){return["display-year","display-month","locale","size","min","max","flavor"]}connectedCallback(){this.se||(this.se=(new Date).getMonth()+1),this.re||(this.re=(new Date).getFullYear()),this.ae||(this.ae=this.getAttribute("locale")||void 0);const t=this.getAttribute("size");!t||"sm"!==t&&"md"!==t&&"lg"!==t||(this.ee=t),L(this),this.ut=Lt(this,()=>{this.ae||this.render()}),this.W(),this.render()}disconnectedCallback(){this.ut&&(this.ut(),this.ut=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.ae=e||void 0,this.render()):"size"===t?"sm"!==e&&"md"!==e&&"lg"!==e||(this.ee=e,this.render()):"min"===t||"max"===t?(this["min"===t?"le":"ce"]=e??void 0,this.render()):"flavor"===t&&this.W()}W(){this.O=R(this.shadowRoot,this.O,this.getAttribute("flavor"),({base:t})=>(t=>co(t,"neutral"))(t))}get displayYear(){return this.re}set displayYear(t){this.re!==t&&(this.re=t,this.ie=null,this.render())}get displayMonth(){return this.se}set displayMonth(t){this.se!==t&&(this.se=t,this.ie=null,this.render())}get locale(){return Tt(this,this.ae)}set locale(t){this.ae!==t&&(this.ae=t||void 0,this.render())}get size(){return this.ee}set size(t){this.ee!==t&&(this.ee=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.de}set width(t){this.de!==t&&(this.de=t,this.applyWidthProperties())}get minWidth(){return this.he}set minWidth(t){this.he!==t&&(this.he=t,this.applyWidthProperties())}get maxWidth(){return this.ue}set maxWidth(t){this.ue!==t&&(this.ue=t,this.applyWidthProperties())}get dayContentFn(){return this.pe}set dayContentFn(t){this.pe!==t&&(this.pe=t,this.render())}get customCSS(){return this.be}set customCSS(t){this.be!==t&&(this.be=t,this.applyCustomCSS())}get min(){return this.le}set min(t){this.le!==t&&(this.le=t,this.render())}get max(){return this.ce}set max(t){this.ce!==t&&(this.ce=t,this.render())}get value(){return this.U}set value(t){const n=t??void 0;this.U!==n&&(this.U=n,this.ie=null,this.render())}applyWidthProperties(){const t=Eo(this.de),n=Eo(this.he),e=Eo(this.ue);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.be||!this.shadowRoot)return;const t=this.shadowRoot.adoptedStyleSheets;t.includes(this.be)||(this.shadowRoot.adoptedStyleSheets=[...t,this.be])}refresh(){this.render()}pickDay(t,n,e){const i=this.oe.indexOf(t);-1!==i&&(this.oe.forEach(n=>n.setAttribute("tabindex",n===t?"0":"-1")),this.ie=i,t.focus({preventScroll:!0})),this.dispatchDayClick(n,e)}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,i){const o=document.createElement("div"),r=this.pe?this.pe(t):function(t){return""+t.dayInMonth}(t);if(this.pe&&r&&!Co(r)&&"string"!=typeof r)throw Error(`Custom dayContentFn must return a DOM element or string, got: ${typeof r}. Use document.createElement() to create DOM elements.`);const s=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&&s.push("disabled"),this.pe||s.push("default-content"),o.className=s.join(" "),"string"==typeof r?o.textContent=r:Co(r)&&o.appendChild(r),o.setAttribute("role","gridcell"),o.setAttribute("aria-label",i.format(new Date(t.localValue))),o.setAttribute("aria-selected",!!t.isSelected+""),t.today&&o.setAttribute("aria-current","date"),n?(o.setAttribute("aria-disabled","true"),o.setAttribute("tabindex","-1")):(o.setAttribute("tabindex",e?"0":"-1"),o.addEventListener("click",n=>{this.pickDay(o,t,n)}),o.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.pickDay(o,t,n))})),o}render(){const t=this.shadowRoot;if(!t)return;let n;if(H(t,{css:uo,id:"ty-calendar-month"}),this.applyCustomCSS(),this.applyWidthProperties(),void 0!==this.U){const t=new Date(this.U);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),po(n),function(t,n,e,i,o){const r=[];for(let s=0;42>s;s++){const n=vo(t,s);r.push(mo(n,e,i,o))}return r}(function(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}(bo(t,n,1))}(t,n),0,t,n,e)}(this.re,this.se,n),i=this.locale,o=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=vo(i,n);return e.format(o)}),[r,...s]=o;return[...s,r]}(i,"short"),r=new Intl.DateTimeFormat(i,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),s=!!t.activeElement;t.innerHTML="";const a=document.createElement("div");a.className="calendar-flex-container calendar-size-"+this.ee,a.setAttribute("role","grid"),a.setAttribute("aria-label",new Intl.DateTimeFormat(i,{month:"long",year:"numeric"}).format(bo(this.re,this.se,1)));const l=document.createElement("div");l.className="calendar-row calendar-header-row",l.setAttribute("role","row"),o.forEach(t=>{const n=document.createElement("div");n.className="calendar-cell calendar-header-cell",n.setAttribute("role","columnheader"),n.textContent=t,l.appendChild(n)}),a.appendChild(l);const c=[];for(let f=0;42>f;f+=7)c.push(e.slice(f,f+7));const d=Mo(this.le),h=Mo(this.ce),u=t=>{const n=e[t].value;return null!==d&&d>n||null!==h&&n>h},p=t=>{for(let n=0;42>n;n++)if(t(n)&&!u(n))return n;return-1};let b=p(t=>!!e[t].isSelected),g=!1;-1===b&&(b=p(t=>!!e[t].today)),-1===b&&(b=p(()=>!0),g=!0),-1===b&&(b=0),(null===this.ie||0>this.ie||this.ie>41||u(this.ie))&&(this.ie=g?null:b);const m=this.ie??b;this.oe=[];let v=0;c.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!==d&&d>t.value||null!==h&&t.value>h,v===m,r);e.className=e.className+" calendar-cell calendar-day-cell",n.appendChild(e),this.oe[v]=e,v++}),a.appendChild(n)}),a.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.ie??b,o=i+e;if(0>o||o>41||u(o))return;n.preventDefault(),this.oe[i]?.setAttribute("tabindex","-1"),this.ie=o;const r=this.oe[o];r&&(r.setAttribute("tabindex","0"),r.focus())}),t.appendChild(a),s&&this.oe[m]?.focus({preventScroll:!0})}}customElements.get("ty-calendar-month")||customElements.define("ty-calendar-month",TyCalendarMonth);const So='\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',To=class t extends D{constructor(){super();const t=new Date;this.xn={displayMonth:t.getMonth()+1,displayYear:t.getFullYear()},H(this.shadowRoot,{css:So,id:"ty-calendar-navigation"})}onConnect(){this.xn.displayMonth=this.displayMonth,this.xn.displayYear=this.displayYear,this.ut=Lt(this,()=>{this.getProperty("locale")||this.render()}),this.render()}onDisconnect(){this.ut&&(this.ut(),this.ut=void 0)}onPropertiesChanged(t){for(const{name:n,newValue:e}of t)switch(n){case"display-month":this.xn.displayMonth=e;break;case"display-year":this.xn.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 Tt(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=ko(this.min),e=ko(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.xn.displayYear,this.xn.displayMonth),i=this.clampIndex(e+n);i!==e&&this.emitChangeEvent(i%12+1,Math.floor(i/12))}isNavDisabled(n){const e=t.monthIndex(this.xn.displayYear,this.xn.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;H(t,{css:So,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=fo(this.xn.displayMonth,this.locale,"long"),o=t.activeElement,r=o?o.classList.contains("nav-title")?"title":o.className.includes("-prev")?"prev":o.className.includes("-next")?"next":null:null;t.innerHTML="";const s=document.createElement("div");s.className="calendar-navigation-header";const a=document.createElement("button");if(a.type="button",a.className="nav-title",a.setAttribute("aria-expanded",e+""),a.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,a.appendChild(t)}const l=document.createElement("span");l.className=e?"nav-title-month":"nav-title-year",l.textContent=this.xn.displayYear+"",a.appendChild(l);const c=document.createElement("span");c.className="nav-caret",c.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>",a.appendChild(c),a.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("view-toggle",{detail:{view:e?"days":"months"}}))});const d=e?12:1,h=e?"year":"month",u=document.createElement("div");u.className="nav-group nav-arrows";const p=this.createButton(`nav-btn nav-${h}-prev`,"Previous "+h,"<?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(-d),this.isNavDisabled(-d)),b=this.createButton(`nav-btn nav-${h}-next`,"Next "+h,"<?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(d),this.isNavDisabled(d));if(u.appendChild(p),u.appendChild(b),s.appendChild(a),s.appendChild(u),t.appendChild(s),r){const t="prev"===r?p:"next"===r?b:a;(t.disabled?a:t).focus({preventScroll:!0})}}};To.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:""},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 Lo=To;customElements.get("ty-calendar-navigation")||customElements.define("ty-calendar-navigation",Lo);const _o="var(--ty-calendar-selected-bg, var(--ty-calendar-accent, var(--calendar-month-selected-bg, var(--ty-solid-primary, var(--ty-color-primary)))))",Ao="var(--ty-calendar-selected-color, var(--calendar-month-selected-color, var(--ty-solid-primary-fg, white)))",qo=`\n.calendar-container {\ndisplay: flex;\nflex-direction: column;\ngap: 0.125rem;\nbox-sizing: border-box;\nfont-family: inherit;\nalign-items: center;\n}\n.calendar-container:focus {\noutline: none;\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: ${_o};\ncolor: ${Ao};\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, ${_o} 85%, ${Ao})));\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${ho}\n`;function Fo(){const t=new Date;return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}}function Do(t){return t&&/^\d{4}$/.test(t)?parseInt(t,10):null}function jo(t){if(!t||!/^\d{1,2}$/.test(t))return null;const n=parseInt(t,10);return 1>n||n>12?null:n}function Ho(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 Oo(t){return(""+t).padStart(4,"0")}const Vo=class t extends HTMLElement{constructor(){super(),this.ge=!1,this.me=!1,this.ee="md",this.ve="primary",this.fe="days",this.ye=0,this.we="",this.xe=!1,this.ke=0,this.ze=!1;const t=Fo();this.xn={displayYear:t.year,displayMonth:t.month},this.attachShadow({mode:"open",delegatesFocus:!0}),T(this),"attachInternals"in this&&(this.C=this.attachInternals(),this.M=new w(this,this.C))}static get observedAttributes(){return["value","year","month","day","hide-navigation","stateless","locale","name","size","width","min","max","flavor","required"]}connectedCallback(){this.xe||(this.initializeFromAttributes(),this.xe=!0),L(this),this.render(),this.updateFormValue(),this.ut=Lt(this,()=>{this.render()})}disconnectedCallback(){this.ut&&(this.ut(),this.ut=void 0),this.$e=void 0,this.Ce=void 0,this.Me=void 0,this.Ee=void 0,this.fe="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.ge=null!==e,this.render();break;case"stateless":this.me=null!==e&&"false"!==e;break;case"locale":this.syncChildComponents();break;case"size":"sm"!==e&&"md"!==e&&"lg"!==e||(this.ee=e,this.de=void 0,this.removeAttribute("width"),this.syncChildComponents());break;case"width":this.de=e||void 0,e&&(this.ee="md",this.removeAttribute("size")),this.syncChildComponents();break;case"name":this.updateFormValue();break;case"min":case"max":this["min"===t?"le":"ce"]=e||void 0,this.syncChildComponents(),this.updateValidity();break;case"required":this.updateValidity();break;case"flavor":this.ve=e||"primary",this.syncChildComponents()}}get min(){return this.le}set min(t){t?this.setAttribute("min",t):this.removeAttribute("min")}get max(){return this.ce}set max(t){t?this.setAttribute("max",t):this.removeAttribute("max")}get flavor(){return this.ve}set flavor(t){t?this.setAttribute("flavor",t):this.removeAttribute("flavor")}get required(){return this.hasAttribute("required")}set required(t){this.toggleAttribute("required",!!t)}get year(){return this.xn.selectedYear}set year(t){void 0!==t?this.me?(this.xn.displayYear=t,this.setAttribute("year",Oo(t))):(this.xn.selectedYear=t,this.xn.displayYear=t,this.setAttribute("year",Oo(t))):(this.me||delete this.xn.selectedYear,this.removeAttribute("year")),this.syncChildComponents(),this.me||this.updateFormValue()}get month(){return this.xn.selectedMonth}set month(t){void 0!==t?this.me?(this.xn.displayMonth=t,this.setAttribute("month",""+t)):(this.xn.selectedMonth=t,this.xn.displayMonth=t,this.setAttribute("month",""+t)):(this.me||delete this.xn.selectedMonth,this.removeAttribute("month")),this.syncChildComponents(),this.me||this.updateFormValue()}get day(){return this.xn.selectedDay}set day(t){void 0!==t?(this.xn.selectedDay=t,this.setAttribute("day",""+t)):(delete this.xn.selectedDay,this.removeAttribute("day")),this.syncChildComponents(),this.updateFormValue()}get locale(){return Tt(this,this.getAttribute("locale"))}set locale(t){this.setAttribute("locale",t)}get hideNavigation(){return this.ge}set hideNavigation(t){this.ge=t,t?this.setAttribute("hide-navigation",""):this.removeAttribute("hide-navigation")}get stateless(){return this.me}set stateless(t){this.me=t,t?this.setAttribute("stateless",""):this.removeAttribute("stateless")}get size(){return this.ee}set size(t){this.ee!==t&&(this.ee=t,this.de=void 0,this.removeAttribute("width"),this.setAttribute("size",t),this.syncChildComponents())}get width(){return this.de}set width(t){this.de!==t&&(this.de=t,t?(this.ee="md",this.removeAttribute("size"),this.setAttribute("width",t)):this.removeAttribute("width"),this.syncChildComponents())}get dayContentFn(){return this.pe}set dayContentFn(t){this.pe=t,this.syncChildComponents()}get customCSS(){return this.be}set customCSS(t){this.be=t,this.syncChildComponents()}get value(){const{selectedYear:t,selectedMonth:n,selectedDay:e}=this.xn;return t&&n&&e?zo(t,n,e):""}set value(t){const n=++this.ke,e=()=>n!==this.ke;if(null==t||""===t){if(delete this.xn.selectedYear,delete this.xn.selectedMonth,delete this.xn.selectedDay,!this.me){if(this.removeAttribute("year"),e())return;if(this.removeAttribute("month"),e())return;this.removeAttribute("day")}}else{const n=ko(t);if(n){const{year:t,month:i,day:o}=n;if(this.xn.selectedYear=t,this.xn.selectedMonth=i,this.xn.selectedDay=o,this.xn.displayYear=t,this.xn.displayMonth=i,!this.me){if(this.setAttribute("year",Oo(t)),e())return;if(this.setAttribute("month",""+i),e())return;this.setAttribute("day",""+o)}}}this.syncChildComponents(),this.me||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.le=this.getAttribute("min")||void 0,this.ce=this.getAttribute("max")||void 0;const a=Do(t);a&&(this.xn.displayYear=a);const l=jo(n);if(l&&(this.xn.displayMonth=l),a&&l){const t=Ho(e,a,l);t&&(this.xn.selectedYear=a,this.xn.selectedMonth=l,this.xn.selectedDay=t)}this.ge=i,null!==o&&(this.me="false"!==o),!r||"sm"!==r&&"md"!==r&&"lg"!==r||(this.ee=r),s&&(this.de=s),this.we=this.value}formResetCallback(){this.value=this.we}syncStateFromAttributes(){const t=this.getAttribute("year"),n=this.getAttribute("month"),e=this.getAttribute("day"),i=Do(t),o=jo(n);if(i&&(this.xn.displayYear=i),o&&(this.xn.displayMonth=o),i&&o){const t=Ho(e,i,o);t?(this.xn.selectedYear=i,this.xn.selectedMonth=o,this.xn.selectedDay=t):(delete this.xn.selectedYear,delete this.xn.selectedMonth,delete this.xn.selectedDay)}else delete this.xn.selectedYear,delete this.xn.selectedMonth,delete this.xn.selectedDay}syncChildComponents(){if(this.$e&&(this.$e.displayMonth=this.xn.displayMonth,this.$e.displayYear=this.xn.displayYear,this.$e.locale=this.locale,this.$e.size=this.ee,this.$e.min=this.le??"",this.$e.max=this.ce??"",this.$e.width=this.de,this.$e.view=this.fe),this.Me&&this.showBody(),this.Ce){this.Ce.displayMonth=this.xn.displayMonth,this.Ce.displayYear=this.xn.displayYear,this.Ce.locale=this.locale,this.Ce.size=this.ee,this.Ce.min=this.le,this.Ce.max=this.ce,this.Ce.flavor=this.ve,this.Ce.width=this.de,this.pe&&(this.Ce.dayContentFn=this.pe),this.be&&(this.Ce.customCSS=this.be);const{selectedYear:t,selectedMonth:n,selectedDay:e}=this.xn;this.Ce.value=t&&n&&e?bo(t,n,e).getTime():null}this.updateValidity()}updateFormValue(){if(this.me)return;if(!this.C)return;const t=this.getAttribute("name"),{selectedYear:n,selectedMonth:e,selectedDay:i}=this.xn;if(t&&n&&e&&i){const t=zo(n,e,i);this.C.setFormValue(t)}else this.C.setFormValue("");this.updateValidity()}updateValidity(){if(!this.C)return;const t=this.gridCell()??void 0,{selectedYear:n,selectedMonth:e,selectedDay:i}=this.xn;if(n&&e&&i){const o=go(n,e,i),r=this.le?ko(this.le):null,s=this.ce?ko(this.ce):null,a=()=>k("input",{type:"date",min:$o(this.le)??void 0,max:$o(this.ce)??void 0},zo(n,e,i));if(r&&o<go(r.year,r.month,r.day))return void this.M.set({rangeUnderflow:!0},a(),t);if(s&&o>go(s.year,s.month,s.day))return void this.M.set({rangeOverflow:!0},a(),t)}else if(this.required)return void this.M.set({valueMissing:!0},k("input",{type:"date",required:!0}),t);this.M.set({},void 0,t)}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.xn.displayMonth=t,this.xn.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.me?this.dispatchEvent(new CustomEvent("day-click",{detail:t.detail,bubbles:!0,composed:!0,cancelable:!0})):(this.xn.selectedYear=e,this.xn.selectedMonth=i,this.xn.selectedDay=o,this.xn.displayYear=e,this.xn.displayMonth=i,this.setAttribute("year",Oo(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.Ce&&"function"==typeof this.Ce.refresh&&this.Ce.refresh(),this.updateValidity()}createNavigation(){const t=document.createElement("ty-calendar-navigation");return t.displayMonth=this.xn.displayMonth,t.displayYear=this.xn.displayYear,t.locale=this.locale,t.size=this.ee,t.min=this.le??"",t.max=this.ce??"",this.de&&(t.width=this.de),t.view=this.fe,t.addEventListener("change",t=>this.handleNavigationChange(t)),t.addEventListener("view-toggle",t=>{this.setView(t.detail.view),this.focusNavTitle()}),this.$e=t,t}createMonthDisplay(){const t=document.createElement("ty-calendar-month");t.displayMonth=this.xn.displayMonth,t.displayYear=this.xn.displayYear,t.locale=this.locale,t.size=this.ee,t.min=this.le,t.max=this.ce,t.flavor=this.ve,this.de&&(t.width=this.de);const{selectedYear:n,selectedMonth:e,selectedDay:i}=this.xn;return n&&e&&i&&(t.value=bo(n,e,i).getTime()),this.pe&&(t.dayContentFn=this.pe),this.be&&(t.customCSS=this.be),t.addEventListener("day-click",t=>this.handleDayClick(t)),t.shadowRoot?.addEventListener("focusin",()=>this.updateValidity()),this.Ce=t,t}render(){const t=this.shadowRoot;if(!t)return;H(t,{css:qo,id:"ty-calendar"}),t.innerHTML="",this.Me=void 0;const n=document.createElement("div");n.className="calendar-container",n.tabIndex=-1;const e=()=>{this.ze=!0,setTimeout(()=>{this.ze=!1})};if(n.addEventListener("pointerdown",e),n.addEventListener("mousedown",e),n.addEventListener("focus",()=>{this.ze||queueMicrotask(()=>{this.shadowRoot?.activeElement===n&&this.gridCell()?.focus()})}),n.addEventListener("keydown",t=>this.handleKeydown(t)),n.addEventListener("focusin",()=>this.updateValidity()),this.Ee=n,!this.ge){const t=this.createNavigation();n.appendChild(t)}const i=this.createMonthDisplay();n.appendChild(i),t.appendChild(n),"months"===this.fe&&this.showBody(),this.updateValidity()}setView(t){t!==this.fe&&("months"===t&&this.Ce&&(this.ye=this.Ce.getBoundingClientRect().height),this.fe=t,this.$e&&(this.$e.view=t),this.showBody(),this.updateValidity())}showBody(){const t=this.Ee;if(!t||!this.Ce)return;if("days"===this.fe)return this.Me?.remove(),this.Me=void 0,void(this.Ce.isConnected||t.appendChild(this.Ce));const n=this.buildMonthGrid();this.Me?this.Me.replaceWith(n):(this.Ce.remove(),t.appendChild(n)),this.Me=n}static monthIndex(t,n){return 12*t+(n-1)}boundIndices(){const n=this.le?ko(this.le):null,e=this.ce?ko(this.ce):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.xn,r=Fo(),{minIdx:s,maxIdx:a}=this.boundIndices(),l=document.createElement("div");l.className="month-grid size-"+this.ee,l.setAttribute("role","grid"),l.setAttribute("aria-label",n+""),this.ye&&(l.style.minHeight=this.ye+"px"),this.de&&l.style.setProperty("--calendar-width",this.de);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",`${fo(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=fo(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.xn.displayYear),this.focusDayGrid()}handleKeydown(n){if(n.target===this.Ee&&n.key.startsWith("Arrow"))return n.preventDefault(),void this.gridCell()?.focus();if("Escape"===n.key&&"months"===this.fe)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.fe?12:1,o=t.monthIndex(this.xn.displayYear,this.xn.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.fe){const t=this.Me?.querySelector('.month-cell[tabindex="0"]');t?.focus()}else this.focusDayGrid()}focusNavTitle(){requestAnimationFrame(()=>{this.$e?.shadowRoot?.querySelector(".nav-title")?.focus()})}gridCell(){if("months"===this.fe)return this.Me?.querySelector('.month-cell[tabindex="0"]:not(:disabled)')??this.Me?.querySelector(".month-cell:not(:disabled)")??this.$e?.shadowRoot?.querySelector(".nav-title")??null;const t=this.Ce?.shadowRoot;return t?.querySelector('.calendar-day-cell[tabindex="0"]')??t?.querySelector(".calendar-day-cell.selected")??t?.querySelector(".calendar-day-cell")??null}focus(t){const n=this.gridCell();n?n.focus(t):super.focus(t)}focusDayGrid(){requestAnimationFrame(()=>{const t=this.Ce?.shadowRoot?.querySelector('.calendar-day-cell[tabindex="0"]');t?.focus()})}};Vo.formAssociated=!0;let Io=Vo;customElements.get("ty-calendar")||customElements.define("ty-calendar",Io);const Wo=(t,n,e="")=>{const i=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}"])${e} {\n--date-picker-accent: var(--ty-input-${t}-border, ${i("-soft")});\n--date-picker-accent-bold: ${i("")};\n--date-picker-ring: color-mix(in oklab, ${i("")} 15%, transparent);\n}\n:host([flavor="${t}+"]) {\n--date-picker-accent: ${i("")};\n--date-picker-accent-bold: ${i("-strong")};\n--date-picker-ring: color-mix(in oklab, ${i("-strong")} 15%, transparent);\n}\n:host([flavor="${t}-"]) {\n--date-picker-accent: ${i("-faint")};\n--date-picker-accent-bold: ${i("-soft")};\n--date-picker-ring: color-mix(in oklab, ${i("-soft")} 15%, transparent);\n}\n`},No=`\n${Ct}\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=>Wo(t,void 0,"danger"===t?',\n:host([error]:not([error=""]))':"")).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:not([disabled]) {\nbackground: var(--ty-bg-danger-soft);\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`,Po="<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>",Bo="<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>",Ro=new WeakMap;let Yo=0;function Uo(t){let n=Ro.get(t);return void 0===n&&(n=++Yo,Ro.set(t,n)),n}function Xo(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 Zo(t,n){return n?t:{...t,hour:0,minute:0,second:0,epoch:void 0}}function Ko(t,n,e){if(!t.year||!t.month||!t.day)return null;const i=Zo(t,n);if(e)return Go(i,n);if(void 0!==i.epoch)return new Date(i.epoch).toISOString();const o=Xo(i);return o?o.toISOString():null}function Go(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 Jo(t,n){return n?{date:wo(t),timeZone:"UTC"}:{date:Xo(t)}}class Qo{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=Qo.pad(this.hour),this.minuteEl.value=Qo.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 tr=class extends D{constructor(){super(),this.xn={withTime:!1,open:!1},this.Se=0,this.xe=!1,this.Te=!1,this.O=null,H(this.shadowRoot,{css:No,id:"ty-date-picker"})}onConnect(){this.xe?this.xn.open=!1:this.initializeState(),this.render(),this.updateFormValue(),this.ut=Lt(this,()=>{this.render()}),this.W()}W(){this.O=R(this.shadowRoot,this.O,"default"===this.flavor?"neutral":this.flavor,({base:t})=>(t=>Wo(t,"neutral"))(t))}onDisconnect(){this.ut&&(this.ut(),this.ut=void 0),this.cleanup()}onPropertiesChanged(t){for(const{name:n,newValue:e}of t)switch(n){case"flavor":this.W();break;case"size":case"label":case"placeholder":case"required":case"disabled":this.updateValidity();break;case"noClear":case"format":case"locale":case"error":break;case"value":if(!this.xe||this.Te)break;this.xn={withTime:this.xn.withTime,open:this.xn.open,...xo(e)},this.syncFormValue();break;case"with-time":if(!this.xe)break;e!==this.xn.withTime&&(this.xn.withTime=e,this.syncFormValue(),this.updateValidity());break;case"native":this.xe&&this.syncFormValue()}}getFormValue(){return this.outputValue(this.getComponents())}outputValue(t){return Ko(t,this.xn.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},k("input",{type:this.xn.withTime?"datetime-local":"date",required:!0}),this.focusTarget()??void 0)}getComponents(){return{year:this.xn.year,month:this.xn.month,day:this.xn.day,hour:this.xn.hour,minute:this.xn.minute,second:this.xn.second,epoch:this.xn.epoch}}hasDate(){return!!(this.xn.year&&this.xn.month&&this.xn.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}=Jo(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",Tt(this,this.getProperty("locale")),this.xn.withTime,!!this.getProperty("native")):null}initializeState(){this.xn={...xo(this.getProperty("value")),withTime:this.getProperty("with-time"),open:!1},this.xe=!0,this.syncFormValue()}updateState(t,n=!1){this.xn={...this.xn,...t},(n||!this.xn.open||!this.xn.withTime)&&this.syncFormValue()}syncFormValue(){const t=this.getFormValue();if(t!==this.getProperty("value")){this.Te=!0;try{this.setProperty("value",t||null)}finally{this.Te=!1}}}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=Tt(this,this.getProperty("locale"))||void 0,{date:r,timeZone:s}=Jo(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=Go(n,!0)??""}emitChangeEvent(t,n){const e=t?this.outputValue(t):null,i=t?Go(t,this.xn.withTime):null,o=t&&Zo(t,this.xn.withTime),r=o?o.epoch??Xo(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.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 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.xe)return this.getProperty("value")||null;const t=xo(this.getProperty("value"));return t&&Ko(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.xn.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.xn.open+""),t.setAttribute("tabindex",n?"-1":"0"),n&&t.setAttribute("aria-disabled","true"),this.getProperty("label")&&t.setAttribute("aria-labelledby","date-picker-label-"+Uo(this)),t.addEventListener("keydown",n=>{this.xn.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=Bo,t.addEventListener("click",t=>this.handleClearClick(t)),s.appendChild(t)}const a=document.createElement("span");return a.className="stub-arrow",a.innerHTML=Po,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.Le=new Qo(r,s,(t,n)=>this.handleTimeInputChange(t,n),this.xn.hour||0,this.xn.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.xn.year&&this.xn.month&&this.xn.day&&(e.setAttribute("year",(this.xn.year+"").padStart(4,"0")),e.setAttribute("month",""+this.xn.month),e.setAttribute("day",""+this.xn.day));const i=Tt(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.xn.withTime&&n.appendChild(this.renderTimeSection()),t.appendChild(n),new MutationObserver(()=>{this.xn.open&&!t.open&&t.isConnected&&this.isConnected&&this.closeDropdown()}).observe(t,{attributes:!0,attributeFilter:["open"]}),t}calendarFlavor(){if(this.getProperty("error"))return"danger";const t=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=xo(i.value);if(t){const{hour:n,minute:e,second:i}=this.xn.withTime?t:this.xn,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=Bo,t.addEventListener("click",t=>this.handleClearClick(t)),c.appendChild(t)}const d=document.createElement("span");return d.className="stub-arrow",d.innerHTML=Po,c.appendChild(d),n.appendChild(c),t.appendChild(n),t}syncNativeInput(t){const n=this.xn.withTime;t.type=n?"datetime-local":"date",t.disabled=!!this.getProperty("disabled"),t.required=!!this.getProperty("required");const e=$o(this.getProperty("min")),i=$o(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=Go(this.getComponents(),n)??""}calculateCalendarPosition(){if(!this.shadowRoot)return;if(Qe())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=vn(this.getProperty("placement")),a=wn({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-"+Uo(this),e.innerHTML=n+(this.getProperty("required")?'<span class="required-icon">*</span>':""),t.appendChild(e)}return t}render(){if(!this.shadowRoot)return;if(H(this.shadowRoot,{css:No,id:"ty-date-picker"}),Qe()){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.xn.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-"+Uo(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(),Qe()){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.xn.year+"").padStart(4,"0")),l.setAttribute("month",""+this.xn.month),l.setAttribute("day",""+this.xn.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.Le&&void 0!==this.xn.hour&&void 0!==this.xn.minute&&this.Le.setTime(this.xn.hour,this.xn.minute),this.updateTimeSummary()}setupEventListeners(){this._e&&document.removeEventListener("click",this._e),this.Ae&&document.removeEventListener("keydown",this.Ae),this._e=t=>this.handleOutsideClick(t),this.Ae=t=>this.handleEscapeKey(t),document.addEventListener("click",this._e),document.addEventListener("keydown",this.Ae);const t=this.shadowRoot?.querySelector(".calendar-dialog");t&&(this.qe=t=>this.handleDialogClick(t),t.addEventListener("click",this.qe))}handleStubClick(t){t.preventDefault();const n=this.shadowRoot?.querySelector(".calendar-dialog");!this.xn.open||n&&n.open||(this.updateState({open:!1},!0),re("date-picker-"+Uo(this))),!this.getProperty("disabled")&&Date.now()-this.Se>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.xn.hour,minute:this.xn.minute,second:this.xn.second,epoch:void 0};this.updateState(e,!0),this.emitChangeEvent(e,"selection"),this.revealValidity(),this.xn.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.xn.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.xn.open&&e&&!this.contains(n)&&!e.contains(n)&&this.closeDropdown()}handleEscapeKey(t){"Escape"===t.key&&this.xn.open&&(t.preventDefault(),this.closeDropdown())}openDropdown(){this.xn.open||Qe()||(this.updateState({open:!0}),this.dispatchEvent(new CustomEvent("open")),this.render(),requestAnimationFrame(()=>{if(!this.shadowRoot)return;if(!this.xn.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){oe("date-picker-"+Uo(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.xn.open)return;this.Se=Date.now();const t="date-picker-"+Uo(this);if(this.updateState({open:!1},!0),re(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._e&&document.removeEventListener("click",this._e),this.Ae&&document.removeEventListener("keydown",this.Ae),this.qe&&this.shadowRoot){const t=this.shadowRoot.querySelector(".calendar-dialog");t&&t.removeEventListener("click",this.qe)}this.xn.open&&re("date-picker-"+Uo(this)),this._e=void 0,this.Ae=void 0,this.qe=void 0,this.Le=void 0}};tr.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}},tr.formAssociated=!0;let nr=tr;customElements.get("ty-date-picker")||customElements.define("ty-date-picker",nr);const er=new Map,ir=new Map;function or(t){return er.get(t)}function rr(t,n){ir.has(t)||ir.set(t,new Set),ir.get(t).add(n);const e=er.get(t);return e&&n(e),()=>{ir.get(t)?.delete(n),0===ir.get(t)?.size&&ir.delete(t)}}function sr(){return Object.fromEntries(er)}function ar(t,n,e){er.set(t,{width:n,height:e});const i=ir.get(t);if(i){const t={width:n,height:e};i.forEach(n=>n(t))}}function lr(t){er.delete(t),ir.delete(t)}class TyResizeObserver extends HTMLElement{constructor(){super(),this.Ht=null,this.Fe=null;const t=this.attachShadow({mode:"open"});H(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(){L(this),this.setupObserver()}attributeChangedCallback(t,n,e){if("id"===t&&n&&n!==e&&(lr(n),e&&this.isConnected)){const{width:t,height:n}=this.getBoundingClientRect();ar(e,t,n)}}disconnectedCallback(){this.cleanup()}setupObserver(){this.Ht=new ResizeObserver(t=>{this.debounce>0?(this.Fe&&clearTimeout(this.Fe),this.Fe=window.setTimeout(()=>{this.handleResize(t)},this.debounce)):this.handleResize(t)}),this.Ht.observe(this)}handleResize(t){const{width:n,height:e}=t[0].contentRect;this.id&&ar(this.id,n,e)}cleanup(){this.Ht&&(this.Ht.disconnect(),this.Ht=null),this.Fe&&(clearTimeout(this.Fe),this.Fe=null),this.id&&lr(this.id)}}customElements.get("ty-resize-observer")||customElements.define("ty-resize-observer",TyResizeObserver);const cr=`\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${cn}\n`;class TyScrollContainer extends HTMLElement{constructor(){super(),this.De=null,this.je=null,this.He=null,this.Oe=null,this.Ve=null,this.bn=null,this.Ht=null,this.Rn=null,this.Dt=null,this.Ie=!1,this.We=!1,this.Nt=()=>{null===this.Dt&&(this.Dt=requestAnimationFrame(()=>{this.Dt=null,this.Ne()}))},this.Pe=()=>{this.bn?.update(),this.Ne()};const t=this.attachShadow({mode:"open"});H(t,{css:cr,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.De=t.querySelector(".scroll-wrapper"),this.je=t.querySelector(".shadow-top"),this.He=t.querySelector(".shadow-bottom"),this.Oe=t.querySelector(".shadow-left"),this.Ve=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.Be()}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(L(this),this.De?.addEventListener("scroll",this.Nt,{passive:!0}),this.Ht=new ResizeObserver(()=>{this.bn?.update(),this.Ne()}),this.De){this.Ht.observe(this.De);const t=this.De.querySelector("slot");t&&t.addEventListener("slotchange",this.Pe)}this.Be(),this.Ne(),this.vn(),this.Re()}disconnectedCallback(){this.De?.removeEventListener("scroll",this.Nt),this.mn(),this.Ye(),this.Ht&&(this.Ht.disconnect(),this.Ht=null),null!==this.Dt&&(cancelAnimationFrame(this.Dt),this.Dt=null)}attributeChangedCallback(t,n,e){n!==e&&("max-height"===t&&(this.Be(),this.Ne(),this.bn?.update()),"custom-scrollbar"!==t&&"overflow-x"!==t||(this.mn(),this.vn(),this.Ne()),"scroll-anchoring"===t&&(this.Ye(),this.Re()))}Re(){!this.Rn&&this.scrollAnchoring&&(this.Rn=new MutationObserver(t=>{const n=this.De;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.bn?.update())}),this.Rn.observe(this,{childList:!0}))}Ye(){this.Rn?.disconnect(),this.Rn=null}vn(){if(this.bn)return;if(!this.De||!this.customScrollbar)return;this.bn=new ln(this.De,{vertical:!0,horizontal:this.overflowX});const t=this.shadowRoot;this.bn.trackY&&t.appendChild(this.bn.trackY),this.bn.trackX&&t.appendChild(this.bn.trackX)}mn(){this.bn&&(this.bn.trackY?.remove(),this.bn.trackX?.remove(),this.bn.destroy(),this.bn=null)}Be(){if(this.De){const t=this.maxHeight;t?(this.De.style.setProperty("--scroll-max-height",t),this.De.style.maxHeight=t):(this.De.style.removeProperty("--scroll-max-height"),this.De.style.maxHeight="")}}Ne(){if(!this.De)return;const{scrollTop:t,scrollLeft:n,scrollHeight:e,scrollWidth:i,clientHeight:o,clientWidth:r}=this.De;this.je&&this.je.classList.toggle("visible",t>2),this.He&&this.He.classList.toggle("visible",e-2>t+o),this.overflowX&&(this.Oe&&this.Oe.classList.toggle("visible",n>2),this.Ve&&this.Ve.classList.toggle("visible",i-2>n+r));const s=e-o;if(s>0){const n=this.nearEdgeThreshold,i=s-t;this.We=this.Ue("nearend",i,n,this.We,{distance:i,scrollTop:t,scrollHeight:e,clientHeight:o}),this.Ie=this.Ue("nearstart",t,n,this.Ie,{distance:t,scrollTop:t,scrollHeight:e,clientHeight:o})}else this.Ie=!1,this.We=!1}Ue(t,n,e,i,o){return e>=n&&(i||this.dispatchEvent(new CustomEvent(t,{detail:o,bubbles:!0,composed:!0})),!0)}updateShadows(){this.Ne(),this.bn?.update()}scrollToTop(t=!0){this.De?.scrollTo({top:0,behavior:t?"smooth":"auto"})}scrollToBottom(t=!0){this.De&&this.De.scrollTo({top:this.De.scrollHeight,behavior:t?"smooth":"auto"})}scrollToLeft(t=!0){this.De?.scrollTo({left:0,behavior:t?"smooth":"auto"})}scrollToRight(t=!0){this.De&&this.De.scrollTo({left:this.De.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.De}}customElements.define("ty-scroll-container",TyScrollContainer);const dr={pickedUp:"Picked up {item}. Position {position} of {total} in {list}. Arrow keys move, Space drops, Escape cancels.",moved:"{item}: position {position} of {total} in {list}.",blocked:"{list} does not accept {item}.",dropped:"{item} moved to position {position} of {total} in {list}.",rejected:"Move not saved. {item} is back at position {position} in {list}.",reconciled:"{item} is now at position {position} of {total} in {list}.",removed:"{item} was removed.",unknown:"The move of {item} may not have been saved.",cancelled:"Move cancelled. {item} is back at position {position} in {list}.",pending:"Saving, please wait."},hr=new Set;let ur=null,pr=0,br=null,gr=-1/0;document.addEventListener("scroll",()=>{gr=performance.now()},{capture:!0,passive:!0});const mr=new WeakSet,vr=(()=>{let t=null;return()=>(t||(t=new CSSStyleSheet,t.replaceSync("\nty-sortable [data-handle] {\ntouch-action: none;\ncursor: grab;\n-webkit-touch-callout: none;\n-webkit-user-select: none;\nuser-select: none;\n}\nty-sortable img,\nty-sortable a {\n-webkit-user-drag: none;\n}\n@media (any-pointer: coarse) {\nty-sortable:not(:state(handles)) > * {\ntouch-action: manipulation;\n-webkit-touch-callout: none;\n-webkit-user-select: none;\nuser-select: none;\n}\n}\nty-sortable input,\nty-sortable textarea,\nty-sortable [contenteditable] {\n-webkit-user-select: text;\nuser-select: text;\n}\n[data-ty-sortable-ghost] {\nbox-shadow: var(--ty-sortable-ghost-shadow, 0 10px 20px rgba(0, 0, 0, 0.15));\nopacity: 0.95;\n}\n")),t)})(),fr=new Set(["[data-handle]"]);function yr(t){const n=t.getRootNode();if(!("adoptedStyleSheets"in n))return;mr.has(n)||(mr.add(n),n.adoptedStyleSheets=[...n.adoptedStyleSheets,vr()]);const e=t.handleSelector;if(!fr.has(e)){fr.add(e);try{vr().insertRule(`ty-sortable ${e} { touch-action: none; cursor: grab; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }`)}catch{}}}function wr(){return matchMedia("(prefers-reduced-motion: reduce)").matches}function xr(t){if(wr())return 0;const n=getComputedStyle(t).getPropertyValue("--ty-sortable-duration").trim(),e=parseFloat(n);return Number.isFinite(e)?n.endsWith("ms")?e:1e3*e:200}function kr(t,n,e){return getComputedStyle(t).getPropertyValue(n).trim()||e}function zr(t,n,e){const i=t.Xe;if(i)try{e?i.add(n):i.delete(n)}catch{}}function $r(t){return t.assignedSlot??t.parentElement??t.getRootNode().host??null}function Cr(t){for(let n=t;n;n=$r(n))if(n instanceof HTMLDialogElement&&n.open)return n;return null}function Mr(t,n){return t?[...hr].filter(n=>n.isConnected&&n.group===t):[n]}function Er(t,n,e){if(t.isConnected)return t;if(!n)return null;const i=[...hr].find(t=>t.isConnected&&t.id===n&&t.group===e)??null;return i&&(i.canDrop??(i.canDrop=t.canDrop),Object.keys(i.labels).length||(i.labels=t.labels)),i}function Sr(t,n){try{return n.querySelector(t.handleSelector)}catch{return null}}function Tr(t,n){return t.nodeType===Node.TEXT_NODE?t.textContent??"":t instanceof Element?t===n||t.matches('[aria-hidden="true"], button, input, select, textarea, style, script, template')?"":Array.from(t.childNodes).map(t=>Tr(t,n)).join(" "):""}function Lr(t,n){const e=Sr(t,n),i=e?.getAttribute("aria-label")?.replace(/^move\s+/i,""),o=(n.getAttribute("aria-label")||n.getAttribute("data-label")||i||Tr(n,e)).replace(/\s+/g," ").trim();return o.length>60?o.slice(0,57)+"…":o||"item"}function _r(t){return t.getAttribute("label")||t.getAttribute("aria-label")||t.id||"list"}function Ar(t,n){return t.length===n.length&&t.every((t,e)=>t===n[e])}function qr(t){return"auto"===t||"scroll"===t||"overlay"===t}function Fr(t){const n=[];for(let i=t;i;i=$r(i)){if(i instanceof HTMLDialogElement&&i.open)return n;if(i===document.documentElement||i===document.body)break;const t=getComputedStyle(i);(qr(t.overflowY)&&i.scrollHeight>i.clientHeight||qr(t.overflowX)&&i.scrollWidth>i.clientWidth)&&n.push(i)}const e=document.scrollingElement;return e&&n.push(e),n}function Dr(){return{top:0,left:0,bottom:innerHeight,right:innerWidth,width:innerWidth,height:innerHeight}}let jr=0;addEventListener("click",t=>{performance.now()<jr&&(jr=0,t.preventDefault(),t.stopImmediatePropagation())},!0),addEventListener("pointerdown",()=>{jr=0},!0);class TySortable extends HTMLElement{constructor(){super(),this.Xe=null,this.Ze=null,this.Ke=null,this.Ge={},this.Mn=null,this.Je=t=>{const n=this.Ze;if(!n||t.pointerId!==n.pointerId)return;const e=Math.hypot(t.clientX-n.startX,t.clientY-n.startY);"mouse"===n.pointerType?5>e||this.Qe(n,t.clientX,t.clientY):n.onHandle?3>e||this.Qe(n,t.clientX,t.clientY):e>8&&this.ti()},this.ni=t=>{this.Ze&&t.pointerId===this.Ze.pointerId&&this.ti()};try{this.Xe=this.attachInternals().states}catch{this.Xe=null}const t=this.attachShadow({mode:"open"});H(t,{css:"\n:host {\ndisplay: block;\nposition: relative;\nbox-sizing: border-box;\n--ty-sortable-indicator-color: var(--ty-color-primary, #3b82f6);\n--ty-sortable-blocked-color: var(--ty-color-danger, #ef4444);\n--ty-sortable-indicator-size: 2px;\n--ty-sortable-source-opacity: 0.4;\n--ty-sortable-source-outline: none;\n--ty-sortable-ghost-scale: 1.02;\n--ty-sortable-ghost-rotate: 0deg;\n--ty-sortable-ghost-shadow: var(--ty-shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1));\n--ty-sortable-duration: 200ms;\n}\n:host([hidden]) {\ndisplay: none;\n}\n@media (any-pointer: coarse) {\n:host {\n--ty-sortable-indicator-size: 3px;\n}\n}\n:host(:state(over):state(empty)) {\noutline: 2px dashed var(--ty-sortable-indicator-color);\noutline-offset: -2px;\n}\n:host(:state(blocked)) {\noutline: 2px dashed var(--ty-sortable-blocked-color);\noutline-offset: -2px;\ncursor: not-allowed;\n}\n.live {\nposition: absolute;\nwidth: 1px;\nheight: 1px;\nmargin: -1px;\npadding: 0;\noverflow: hidden;\nclip: rect(0 0 0 0);\nwhite-space: nowrap;\nborder: 0;\n}\n",id:"ty-sortable"}),t.innerHTML='<slot></slot><div class="live" part="live" aria-live="assertive" aria-atomic="true"></div>',this.ei=t.querySelector(".live"),this.addEventListener("pointerdown",t=>this.ii(t)),this.addEventListener("keydown",t=>this.oi(t)),this.addEventListener("keyup",t=>this.ri(t)),this.addEventListener("click",t=>this.si(t)),this.addEventListener("focusout",t=>this.ai(t)),this.addEventListener("dragstart",t=>{this.li(t)&&t.preventDefault()}),this.addEventListener("touchmove",Ir,{passive:!1}),this.addEventListener("touchstart",t=>{const n=t.target;n.addEventListener("touchmove",Ir,{passive:!1});const e=()=>{n.removeEventListener("touchmove",Ir),n.removeEventListener("touchend",e),n.removeEventListener("touchcancel",e)};n.addEventListener("touchend",e),n.addEventListener("touchcancel",e)},{passive:!0})}static get observedAttributes(){return["handle","disabled"]}get group(){return this.getAttribute("group")}set group(t){null==t?this.removeAttribute("group"):this.setAttribute("group",t)}get axis(){return"horizontal"===this.getAttribute("axis")?"horizontal":"vertical"}set axis(t){this.setAttribute("axis",t)}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.toggleAttribute("disabled",!!t&&t+""!="false")}get dropLine(){return this.hasAttribute("drop-line")}set dropLine(t){this.toggleAttribute("drop-line",!!t&&t+""!="false")}get flash(){return this.hasAttribute("flash")}set flash(t){this.toggleAttribute("flash",!!t&&t+""!="false")}get handleSelector(){return this.getAttribute("handle")||"[data-handle]"}get accepts(){return this.getAttribute("accepts")}set accepts(t){null==t?this.removeAttribute("accepts"):this.setAttribute("accepts",t)}get holdTimeout(){const t=parseInt(this.getAttribute("hold-timeout")??"",10);return Number.isFinite(t)&&t>=0?t:5e3}get canDrop(){return this.Ke}set canDrop(t){this.Ke="function"==typeof t?t:null}get labels(){return this.Ge}set labels(t){this.Ge=t&&"object"==typeof t?t:{}}get items(){return Array.from(this.children).filter(t=>t instanceof HTMLElement&&!(t instanceof HTMLTemplateElement)&&!t.hasAttribute("data-sortable-ignore"))}keyOf(t){const n=this.getAttribute("key-attr");return n&&t.getAttribute(n)||t.getAttribute("data-key")||t.id||null}connectedCallback(){L(this),hr.add(this),yr(this),this.ci(),this.Mn=new MutationObserver(()=>this.di()),this.Mn.observe(this,{childList:!0});const t=ur;"holding"!==t?.phase||this.group!==t.group||!t.group&&this.id!==t.sourceId&&this.id!==t.targetId||(Vs(t,this),queueMicrotask(()=>Ns("mutation")))}disconnectedCallback(){hr.delete(this),this.Mn?.disconnect(),this.Mn=null,this.ti(),"keyboard"===ur?.mode&&"dragging"===ur.phase&&queueMicrotask(_s)}connectedMoveCallback(){}attributeChangedCallback(t,n,e){n!==e&&this.isConnected&&("handle"===t?(yr(this),this.ci()):"disabled"===t&&null!==e&&"dragging"===ur?.phase&&ur.source===this&&Es("disabled"))}di(){this.ci(),"keyboard"===ur?.mode&&"dragging"===ur.phase&&_s()}ci(){const t=this.items;zr(this,"empty",0===t.length),zr(this,"handles",t.some(t=>Sr(this,t)))}move(t,n={}){if(ur)return Promise.reject(Error("ty-sortable: a move is still pending"));const e="string"==typeof t?this.items.find(n=>this.keyOf(n)===t):t;if(!e||e.parentElement!==this)return Promise.reject(Error("ty-sortable: no such item"));const i="string"==typeof n.to?Mr(this.group,this).find(t=>t.id===n.to):n.to??this;if(!i||i!==this&&(!this.group||i.group!==this.group))return Promise.reject(Error("ty-sortable: no such list in this group"));const o=Hr("api",this,e),r=i.items.filter(t=>t!==e);let s=r.length;if(null!=n.before)s=r.findIndex(t=>i.keyOf(t)===n.before);else if(null!=n.after){const t=r.findIndex(t=>i.keyOf(t)===n.after);s=0>t?-1:t+1}else null!=n.index&&(s=Math.max(0,Math.min(n.index,r.length)));return 0>s?Promise.reject(Error("ty-sortable: no such neighbour")):(Or(o,i),o.slot=Ur(i,e,s),o.legal=Xr(o,i,o.slot),"ok"!==o.legal?Promise.reject(Error("ty-sortable: drop not allowed")):(ur=o,new Promise(t=>{o.resolve=t,Is()||t("accepted")})))}settle(t){"holding"===ur?.phase&&(t?Rs(t):Ns("settle"))}hi(t,n={}){const e=(this.Ge[t]??dr[t]).replace(/\{(\w+)\}/g,(t,e)=>(n[e]??"")+"");this.ei.textContent="",requestAnimationFrame(()=>{this.ei.textContent=e})}li(t){for(const n of t.composedPath()){if(n===this)return null;if(n instanceof HTMLElement&&n.parentElement===this)return this.items.includes(n)?n:null}return null}ui(t){if(this.disabled)return null;const n=this.li(t);if(!n||n.hasAttribute("data-locked"))return null;const e=t.composedPath()[0];if(!(e instanceof Element))return null;const i=!!Sr(this,n);let o=null;try{o=e.closest(this.handleSelector)}catch{o=null}if(o&&!n.contains(o)&&(o=null),i)return o?{item:n,onHandle:!0,handle:o}:null;const r=e.closest('button, a[href], input, select, textarea, label, summary, [contenteditable]:not([contenteditable="false"]), [data-no-drag]');return r&&n.contains(r)&&r!==n?null:{item:n,onHandle:!1,handle:null}}ii(t){if(ur||!t.isPrimary||"mouse"===t.pointerType&&0!==t.button||this.Ze)return;const n=this.ui(t);if(!n)return;const e="mouse"!==t.pointerType;if(e&&!n.onHandle&&100>performance.now()-gr)return;const i={pointerId:t.pointerId,pointerType:t.pointerType,item:n.item,onHandle:n.onHandle,startX:t.clientX,startY:t.clientY,timer:0};this.Ze=i,!e&&n.onHandle&&t.preventDefault(),e&&!n.onHandle&&(i.timer=window.setTimeout(()=>{this.Ze===i&&this.Qe(i,i.startX,i.startY)},250)),addEventListener("pointermove",this.Je,!0),addEventListener("pointerup",this.ni,!0),addEventListener("pointercancel",this.ni,!0),e&&addEventListener("contextmenu",Vr,!0)}ti(){const t=this.Ze;t&&(clearTimeout(t.timer),this.Ze=null,removeEventListener("pointermove",this.Je,!0),removeEventListener("pointerup",this.ni,!0),removeEventListener("pointercancel",this.ni,!0),"pointer"!==ur?.mode&&removeEventListener("contextmenu",Vr,!0))}Qe(t,n,e){const i=t.item,o="mouse"!==t.pointerType;if(this.ti(),ur||!i.isConnected||i.parentElement!==this)return;const r=Hr("pointer",this,i),s=i.getBoundingClientRect();r.pointerId=t.pointerId,r.x=n,r.y=e,r.startX=n,r.startY=e,r.offsetX=t.startX-s.left,r.offsetY=t.startY-s.top,ur=r;const a=document.activeElement;a&&i.contains(a)&&a.matches("input, textarea, select, [contenteditable]")&&a.blur(),getSelection()?.removeAllRanges(),os(r,s),cs(r,"dim"),zr(this,"dragging",!0),addEventListener("pointermove",Kr,!0),addEventListener("pointerup",Gr,!0),addEventListener("pointercancel",Jr,!0),addEventListener("pointerdown",Nr,!0),addEventListener("selectstart",Vr,!0),addEventListener("keydown",Qr,!0),addEventListener("blur",Wr),document.addEventListener("visibilitychange",Wr),screen.orientation?.addEventListener("change",Wr),o&&addEventListener("contextmenu",Vr,!0),r.cleanup.push(()=>{removeEventListener("pointermove",Kr,!0),removeEventListener("pointerup",Gr,!0),removeEventListener("pointercancel",Jr,!0),removeEventListener("pointerdown",Nr,!0),removeEventListener("selectstart",Vr,!0),removeEventListener("keydown",Qr,!0),removeEventListener("blur",Wr),document.removeEventListener("visibilitychange",Wr),screen.orientation?.removeEventListener("change",Wr),removeEventListener("contextmenu",Vr,!0)}),Br(r),r.raf=requestAnimationFrame(ts)}oi(t){if("keyboard"===ur?.mode&&"dragging"===ur.phase)return;if(" "!==t.key&&"Enter"!==t.key)return;if(t.repeat||t===br)return;const n=this.ui(t);if(!n)return;const e=t.composedPath()[0];(n.onHandle||e===n.item)&&(t.preventDefault(),pr=performance.now(),ur?"holding"===ur.phase&&this.hi("pending"):Ss(this,n.item))}ri(t){" "===t.key&&1e3>performance.now()-pr&&t.preventDefault()}si(t){if(0!==t.detail||1e3>performance.now()-pr)return;const n=this.ui(t);if(!n?.onHandle)return;t.preventDefault();const e=ur;"keyboard"===e?.mode&&"dragging"===e.phase&&e.item===n.item?As(e):e?"holding"===e.phase&&this.hi("pending"):(n.handle?.focus({preventScroll:!0}),Ss(this,n.item))}ai(t){const n=ur;if(!n||"keyboard"!==n.mode||"dragging"!==n.phase||n.source!==this)return;const e=t.relatedTarget;e&&n.item.contains(e)||(e?Es("blur"):queueMicrotask(()=>{ur===n&&"dragging"===n.phase&&(n.item.isConnected&&n.source.isConnected?Es("blur"):_s())}))}}function Hr(t,n,e){return{mode:t,phase:"dragging",source:n,sourceId:n.id||null,item:e,key:n.keyOf(e),group:n.group,fromIndex:n.items.indexOf(e),target:null,targetId:null,slot:-1,legal:"ok",pointerId:-1,x:0,y:0,offsetX:0,offsetY:0,startX:0,startY:0,armed:!1,raf:0,layer:null,ghost:null,indicator:null,shifts:new Map,cursorMarker:null,value:null,snapshot:null,observed:new WeakSet,observers:[],busy:!1,htmx:!1,holdStart:0,painted:new Map,timer:0,focus:null,resolve:null,cleanup:[]}}function Or(t,n){t.target=n,t.targetId=n?.id||null}function Vr(t){t.preventDefault()}function Ir(t){"pointer"===ur?.mode&&"dragging"===ur.phase&&t.cancelable&&t.preventDefault()}function Wr(){"dragging"===ur?.phase&&Es("pointercancel")}function Nr(t){"pointer"===ur?.mode&&"dragging"===ur.phase&&t.pointerId!==ur.pointerId&&Es("pointercancel")}function Pr(t){return{key:t.key,group:t.group,source:t.mode,from:Rr(t)}}function Br(t){t.source.dispatchEvent(new CustomEvent("ty-sortable-start",{detail:{value:Pr(t),item:t.item}}))}function Rr(t){const n=t.source.items,e=n.indexOf(t.item),i=0>e?t.fromIndex:e;return{list:t.sourceId,index:i,prev:n[i-1]?t.source.keyOf(n[i-1]):null,next:n[i+1]?t.source.keyOf(n[i+1]):null}}function Yr(t,n){return t.items.filter(t=>t!==n)}function Ur(t,n,e){const i=Yr(t,n);let o=0;for(;i.length>o&&i[o].hasAttribute("data-locked");)o++;let r=i.length;for(;r>o&&i[r-1].hasAttribute("data-locked");)r--;return Math.max(o,Math.min(e,r))}function Xr(t,n,e){if(n!==t.source){if(n.disabled)return"blocked";const e=n.accepts;if(e)try{if(!t.item.matches(e))return"blocked"}catch{return"blocked"}}const i=n.canDrop;return i&&!i({item:t.item,key:t.key,from:t.source,to:n,index:e})?"blocked":"ok"}function Zr(t){const n=Er(t.source,t.sourceId,t.group);if(!n)return!1;t.source=n;let e=!1;if(!t.item.isConnected||t.item.parentElement!==n){const i=t.key?n.items.find(e=>n.keyOf(e)===t.key):null;if(!i)return!1;t.item=i,e=!0}t.target&&!t.target.isConnected&&(Or(t,Er(t.target,t.targetId,t.group)),e=!0);for(const[i,o]of t.shifts)i.isConnected||(o.anim.cancel(),t.shifts.delete(i),e=!0);return t.layer&&!t.layer.isConnected&&(t.layer=null,os(t,t.ghost?t.ghost.getBoundingClientRect():t.item.getBoundingClientRect())),e&&"dragging"===t.phase&&(t.shifts.size||fs(t)?zs(t):cs(t,"dim")),!0}function Kr(t){const n=ur;n&&"dragging"===n.phase&&t.pointerId===n.pointerId&&(n.x=t.clientX,n.y=t.clientY,n.armed||16>Math.hypot(n.x-n.startX,n.y-n.startY)||(n.armed=!0))}function Gr(t){const n=ur;n&&"dragging"===n.phase&&t.pointerId===n.pointerId&&(n.x=t.clientX,n.y=t.clientY,ns(n),jr=performance.now()+300,n.target?"ok"!==n.legal?Es("blocked"):Is():Es("spill"))}function Jr(t){"dragging"===ur?.phase&&t.pointerId===ur.pointerId&&Es("pointercancel")}function Qr(t){"Escape"===t.key&&"dragging"===ur?.phase&&"pointer"===ur.mode&&(t.preventDefault(),t.stopPropagation(),Es("escape"))}function ts(){const t=ur;t&&"dragging"===t.phase&&"pointer"===t.mode&&(Zr(t)?(t.armed&&function(t,n,e){const i=document.scrollingElement;let o=!1;for(const r of["y","x"])for(const s of t){const t=s===i?Dr():s.getBoundingClientRect();if(s!==i&&(t.left>n||n>t.right||t.top>e||e>t.bottom))continue;const a="y"===r?t.height:t.width,l=Math.min(Math.max(40,Math.min(.15*a,100)),.25*a),c="y"===r?e:n,d="y"===r?t.top:t.left,h="y"===r?t.bottom:t.right,u="y"===r?s.scrollTop:s.scrollLeft;let p=0;if(d+l>c&&u>0?p=-20*((d+l-c)/l)**2:c>h-l&&("y"===r?s.scrollHeight-s.clientHeight:s.scrollWidth-s.clientWidth)-1>u&&(p=20*((c-(h-l))/l)**2),p){wr()&&(p=20*Math.sign(p)/2),"y"===r?s.scrollTop+=p:s.scrollLeft+=p,o=!0;break}}}(Fr(t.target??t.source),t.x,t.y),ns(t),t.ghost&&(t.ghost.style.translate=`${t.x-t.offsetX}px ${t.y-t.offsetY}px`),t.raf=requestAnimationFrame(ts)):Es("gone"))}function ns(t){let n=null;const e=Mr(t.group,t.source),i=function(t,n){let e=document.elementFromPoint(t,n);const i=new Set;for(;e?.shadowRoot&&!i.has(e);){i.add(e);const o=e.shadowRoot.elementFromPoint(t,n);if(!o||i.has(o)||!e.shadowRoot.contains(o))break;e=o}return e}(t.x,t.y);for(let a=i;a;a=$r(a))if(a instanceof TySortable&&e.includes(a)){n=a;break}if(!n){const o=i?Cr(i):null;n=e.find(n=>{if(o&&Cr(n)!==o)return!1;const e=function(t){const n=t.getBoundingClientRect();let e=n.top,i=n.left,o=n.bottom,r=n.right;const s=document.scrollingElement;for(const a of Fr(t)){const t=a===s?Dr():a.getBoundingClientRect();e=Math.max(e,t.top),i=Math.max(i,t.left),o=Math.min(o,t.bottom),r=Math.min(r,t.right)}return o>e&&r>i?{top:e,left:i,bottom:o,right:r}:null}(n);return!(!e||e.left-12>t.x||t.x>e.right+12||e.top-12>t.y||t.y>e.bottom+12)})??null}if(!n)return void es(t,null,-1,"ok");const o=Yr(n,t.item),r="vertical"===n.axis;let s=o.length;for(let a=0;o.length>a;a++){const n=us(o[a]);if(r?n.top+n.height/2>t.y:n.left+n.width/2>t.x){s=a;break}}s=Ur(n,t.item,s),es(t,n,s,Xr(t,n,s))}function es(t,n,e,i){const o=n!==t.target||e!==t.slot||i!==t.legal;if(t.target&&t.target!==n&&(zr(t.target,"over",!1),zr(t.target,"blocked",!1)),Or(t,n),t.slot=e,t.legal=i,n&&(zr(n,"over","ok"===i),zr(n,"blocked","blocked"===i)),o&&zs(t),"pointer"===t.mode&&rs(t,"blocked"===i?"blocked":"grabbing"),ys(t),o&&"keyboard"===t.mode&&n){const o=Yr(n,t.item).length+1,r={item:Lr(t.source,t.item),position:e+1,total:o,list:_r(n)};t.source.hi("ok"===i?"moved":"blocked",r)}}const is=["--ty-sortable-indicator-color","--ty-sortable-blocked-color","--ty-sortable-ghost-shadow","--ty-sortable-ghost-scale","--ty-sortable-ghost-rotate","--ty-sortable-duration"];function os(t,n){const e=document.createElement("div");e.setAttribute("popover","manual"),e.setAttribute("data-ty-sortable-layer",""),e.style.cssText="position:fixed;inset:0;margin:0;padding:0;border:0;background:transparent;overflow:visible;pointer-events:none;width:auto;height:auto;max-width:none;max-height:none;color:inherit";const i=getComputedStyle(t.source);for(const s of is){const t=i.getPropertyValue(s).trim();t&&e.style.setProperty(s,t)}const o=t.item.getRootNode();(o instanceof ShadowRoot?o:document.body).appendChild(e);try{e.showPopover()}catch{e.style.zIndex="2147483647"}const r=document.createElement("div");r.style.cssText="position:absolute;left:0;top:0;display:none;border-radius:999px;pointer-events:none",e.appendChild(r),t.layer=e,t.indicator=r,"pointer"===t.mode&&rs(t,"grabbing"),"pointer"===t.mode&&(as(t,n),function(t){const n=t.ghost;if(!n)return;const e=kr(t.source,"--ty-sortable-ghost-scale","1.02"),i=kr(t.source,"--ty-sortable-ghost-rotate","0deg");n.animate([{scale:"1",rotate:"0deg"},{scale:e,rotate:i}],{duration:wr()?0:150,easing:"cubic-bezier(.2, 0, 0, 1)",fill:"forwards"})}(t))}function rs(t,n){ss||(ss=new CSSStyleSheet,ss.replaceSync('\nbody:has(> [data-ty-sortable-layer][data-cursor="grabbing"]),\nbody:has(> [data-ty-sortable-layer][data-cursor="grabbing"]) * {\ncursor: grabbing !important;\n}\nbody:has(> [data-ty-sortable-layer][data-cursor="blocked"]),\nbody:has(> [data-ty-sortable-layer][data-cursor="blocked"]) * {\ncursor: not-allowed !important;\n}\n'),document.adoptedStyleSheets=[...document.adoptedStyleSheets,ss]);let e=t.layer?.parentElement===document.body?t.layer:t.cursorMarker;!e&&n&&(e=document.createElement("div"),e.setAttribute("data-ty-sortable-layer",""),e.hidden=!0,document.body.appendChild(e),t.cursorMarker=e),e&&(n?e.setAttribute("data-cursor",n):e.removeAttribute("data-cursor"))}let ss=null;function as(t,n){const e=function(t,n){const e=t.cloneNode(!0);e.removeAttribute("id"),e.querySelectorAll("[id]").forEach(t=>t.removeAttribute("id")),e.inert=!0,e.setAttribute("aria-hidden","true"),e.setAttribute("data-ty-sortable-ghost","");const i=t.querySelectorAll("input, textarea, select");e.querySelectorAll("input, textarea, select").forEach((t,n)=>{const e=i[n];e&&(t.value=e.value)});const o=getComputedStyle(t);return e.style.cssText+=`;position:absolute;left:0;top:0;margin:0;box-sizing:border-box;width:${n.width}px;height:${n.height}px;pointer-events:none;will-change:translate;transform:none;transform-origin:${Math.min(n.width/2,40)}px 50%;color:${o.color};font:${o.font}`,e}(t.item,n);e.style.translate=`${n.left}px ${n.top}px`,t.layer.appendChild(e),t.ghost=e}function ls(t,n,e,i){for(const o of t.getAnimations())o.commitStyles?.(),o.cancel();t.style.transition=i?`translate ${i}ms ease, scale ${i}ms ease, rotate ${i}ms ease`:"",t.getBoundingClientRect(),t.style.translate=`${n}px ${e}px`,t.style.scale="1",t.style.rotate="0deg"}function cs(t,n){const e=t.source,i=e.shadowRoot;let o=ds.get(e);if(o||(o=new CSSStyleSheet,ds.set(e,o),i.adoptedStyleSheets=[...i.adoptedStyleSheets,o]),!n)return void o.replaceSync("");const r=e.getAttribute("key-attr");let s;s=t.key&&r&&t.item.getAttribute(r)===t.key?`[${CSS.escape(r)}="${CSS.escape(t.key)}"]`:t.key&&t.item.getAttribute("data-key")===t.key?`[data-key="${CSS.escape(t.key)}"]`:t.key&&t.item.id===t.key?"#"+CSS.escape(t.key):`:nth-child(${Array.from(e.children).indexOf(t.item)+1})`,o.replaceSync("hide"===n?`::slotted(${s}) { opacity: 0 !important; }`:`::slotted(${s}) { opacity: var(--ty-sortable-source-opacity) !important; outline: var(--ty-sortable-source-outline); outline-offset: -2px; }`)}const ds=new WeakMap;function hs(t){if(!t)return 0;const n=t.anim.effect?.getComputedTiming().progress;return null==n?t.to:t.from+(t.to-t.from)*n}function us(t,n=ur){const e=t.getBoundingClientRect(),i=n?.shifts.get(t),o=hs(i);if(!o)return e;const r=i.vertical?0:o,s=i.vertical?o:0;return{top:e.top-s,left:e.left-r,bottom:e.bottom-s,right:e.right-r,width:e.width,height:e.height}}function ps(t){const n=t.items;if(2>n.length)return 0;const e=us(n[0]),i=us(n[1]);return Math.max(0,"vertical"===t.axis?i.top-e.bottom:i.left-e.right)}function bs(t,n){if(n.items.length>1)return ps(n);if(t.source.items.length>1)return ps(t.source);const e="vertical"===n.axis,i=getComputedStyle(n),o=parseFloat(e?i.rowGap:i.columnGap);if(o>0)return o;const r=getComputedStyle(t.item);return Math.max(0,parseFloat(e?r.marginBottom:r.marginRight)||0,parseFloat(e?r.marginTop:r.marginLeft)||0)}function gs(t){return Array.from(t.children).filter(t=>t instanceof HTMLElement&&!(t instanceof HTMLTemplateElement))}function ms(t,n,e){const i=Yr(t,n),o="vertical"===t.axis,r=i[e-1]?us(i[e-1]):null,s=i[e]?us(i[e]):null;if(!r&&!s){const n=t.getBoundingClientRect(),e=getComputedStyle(t);return{x:n.left+parseFloat(e.paddingLeft),y:n.top+parseFloat(e.paddingTop),length:o?n.width:n.height,empty:!0}}const a=ps(t)||4,l=s??r;return o?{x:l.left,y:r&&s?(r.bottom+s.top)/2:s?s.top-a/2:r.bottom+a/2,length:l.width,empty:!1}:{x:r&&s?(r.right+s.left)/2:s?s.left-a/2:r.right+a/2,y:l.top,length:l.height,empty:!1}}function vs(t,n){const e=Yr(n,t.item),i=e[t.slot]?us(e[t.slot]):null,o=e[t.slot-1]?us(e[t.slot-1]):null,r=ms(n,t.item,t.slot);if(r.empty)return{x:r.x,y:r.y};const s=bs(t,n);return"vertical"===n.axis?{x:(i??o).left,y:i?i.top:o.bottom+s}:{x:i?i.left:o.right+s,y:(i??o).top}}function fs(t){return!(t.target??t.source).hasAttribute("drop-line")}function ys(t){const n=t.indicator;if(!n)return;const e=t.target;if(!e||0>t.slot||"dragging"!==t.phase)return void(n.style.display="none");if(fs(t)&&"ok"===t.legal)return void(n.style.display="none");const i=ms(e,t.item,t.slot);if(i.empty)return void(n.style.display="none");const o=parseFloat(kr(e,"--ty-sortable-indicator-size","2px"))||2,r="ok"===t.legal?kr(e,"--ty-sortable-indicator-color","#3b82f6"):kr(e,"--ty-sortable-blocked-color","#ef4444"),s="vertical"===e.axis;n.style.display="block",n.style.background=r,n.style.width=s?i.length+"px":o+"px",n.style.height=s?o+"px":i.length+"px",n.style.transform=s?`translate3d(${i.x}px, ${i.y-o/2}px, 0)`:`translate3d(${i.x-o/2}px, ${i.y}px, 0)`}function ws(t,n=!1){const e=new Map,i=t.target;if(!i||0>t.slot||"ok"!==t.legal)return e;const o=t.source,r=gs(o),s=r.indexOf(t.item);if(0>s)return e;const a=(t,n)=>"vertical"===t.axis?[n.top,n.bottom]:[n.left,n.right],l=us(t.item),[c,d]=a(o,l),h=d-c,u=Yr(o,t.item);if(i===o){const n=o.items.indexOf(t.item);if(t.slot===n)return e;const i=h+bs(t,o);if(t.slot>n){const n=u[t.slot-1];r.slice(s+1,r.indexOf(n)+1).forEach(t=>e.set(t,-i)),e.set(t.item,a(o,us(n))[1]-d)}else{const n=u[t.slot];r.slice(r.indexOf(n),s).forEach(t=>e.set(t,i)),e.set(t.item,a(o,us(n))[0]-c)}return e}if(!n){const n=-(h+bs(t,o));r.slice(s+1).forEach(t=>e.set(t,n))}const p=gs(i),b=Yr(i,t.item),g=b.length>t.slot?p.indexOf(b[t.slot]):b.length?p.indexOf(b[b.length-1])+1:p.length,m=("vertical"===i.axis?l.height:l.width)+bs(t,i);return p.slice(g).forEach(t=>e.set(t,m)),e}const xs="cubic-bezier(.2, 0, 0, 1)";function ks(t,n,e){for(const i of new Set([...t.shifts.keys(),...n.keys()])){const o=n.get(i)??0,r=t.shifts.get(i);if((r?.to??0)===o)continue;const s="vertical"===(i.parentElement instanceof TySortable?i.parentElement:t.source).axis,a=hs(r),l=t=>s?`0 ${t}px`:t+"px 0",c=i.animate([{translate:l(a)},{translate:l(o)}],{duration:e,easing:xs,fill:"forwards",composite:"add"});r?.anim.cancel(),t.shifts.set(i,{from:a,to:o,vertical:s,anim:c})}}function zs(t){if("dragging"!==t.phase)return;const n=Math.min(xr(t.source),200);if(!fs(t))return t.shifts.size&&ks(t,new Map,n),void cs(t,"dim");const e=!!t.target&&t.target!==t.source&&"ok"===t.legal,i="pointer"!==t.mode;if(cs(t,e&&!i?"hide":"dim"),ks(t,ws(t,i),n),i)if(e){!t.ghost&&t.layer&&as(t,t.item.getBoundingClientRect());const e=vs(t,t.target);t.ghost.style.display="",ls(t.ghost,e.x,e.y,n)}else t.ghost&&(t.ghost.style.display="none")}function $s(t){for(const n of new Set([t.source,t.target,...Mr(t.group,t.source)]))if(n)for(const t of["over","blocked","dragging","pending"])zr(n,t,!1)}function Cs(t){cancelAnimationFrame(t.raf),clearTimeout(t.timer),t.cleanup.forEach(t=>t()),t.cleanup=[],t.observers.forEach(t=>t.disconnect()),t.observers=[],function(t){t.shifts.forEach(({anim:t})=>t.cancel()),t.shifts.clear()}(t),t.layer?.remove(),t.cursorMarker?.remove(),t.cursorMarker=null,ur===t&&(ur=null),ur&&ur.source===t.source||cs(t,!1)}function Ms(t,n,e){const i=n?.isConnected?us(n,t):null,o=t.ghost,r=xr(t.source);t.indicator&&(t.indicator.style.display="none"),rs(t,null),t.shifts.size&&(ks(t,new Map,r),t.source.items.includes(t.item)&&cs(t,"dim")),o&&i&&r?(ls(o,i.left,i.top,r),window.setTimeout(e,r)):r&&t.shifts.size?window.setTimeout(e,r):e()}function Es(t){const n=ur;if(!n||"dragging"!==n.phase)return;cancelAnimationFrame(n.raf),ur=null,"pointer"!==n.mode||"escape"!==t&&"gone"!==t&&"disabled"!==t||function(t){const n=()=>{removeEventListener("pointerup",e,!0),removeEventListener("pointerdown",n,!0),clearTimeout(i)},e=e=>{e.pointerId===t&&(jr=performance.now()+300,n())},i=window.setTimeout(n,5e3);addEventListener("pointerup",e,!0),addEventListener("pointerdown",n,!0)}(n.pointerId);const e=n.source.isConnected?n.source:Er(n.source,n.sourceId,n.group)??n.source;e.dispatchEvent(new CustomEvent("ty-sortable-cancel",{detail:{value:Pr(n),item:n.item,reason:t}})),"keyboard"===n.mode&&"gone"!==t&&e.hi("cancelled",{item:Lr(e,n.item),position:Rr(n).index+1,list:_r(e)}),n.cleanup.forEach(t=>t()),n.cleanup=[],$s(n),Ms(n,n.item.isConnected?n.item:null,()=>Cs(n))}function Ss(t,n){const e=Hr("keyboard",t,n);ur=e,os(e,n.getBoundingClientRect()),cs(e,"dim"),zr(t,"dragging",!0),addEventListener("keydown",Ts,!0),addEventListener("pointerdown",Ls,!0),e.cleanup.push(()=>{removeEventListener("keydown",Ts,!0),removeEventListener("pointerdown",Ls,!0)}),Br(e),Or(e,t),e.slot=e.fromIndex,e.legal="ok",zr(t,"over",!0),ys(e),t.hi("pickedUp",{item:Lr(t,n),position:e.fromIndex+1,total:t.items.length,list:_r(t)})}function Ts(t){const n=ur;n&&"keyboard"===n.mode&&"dragging"===n.phase&&_s()&&function(t,n){const e=t.target??t.source,i="vertical"===e.axis,o=i?"ArrowUp":"ArrowLeft",r=i?"ArrowDown":"ArrowRight",s=i?"ArrowLeft":"ArrowUp",a=i?"ArrowRight":"ArrowDown",l=Yr(e,t.item).length;switch(n.key){case o:case r:case"Home":case"End":{n.preventDefault();const i=Ur(e,t.item,Math.max(0,Math.min(n.key===o?t.slot-1:n.key===r?t.slot+1:"Home"===n.key?0:l,l)));return es(t,e,i,Xr(t,e,i)),void qs(t)}case s:case a:{n.preventDefault();const o=Mr(t.group,t.source).filter(n=>!n.disabled||n===t.source).sort((t,n)=>{const e=t.getBoundingClientRect(),o=n.getBoundingClientRect();return i?e.left-o.left||e.top-o.top:e.top-o.top||e.left-o.left}),r=o.indexOf(e),s=n.key===a?1:-1;for(let n=r+s;n>=0&&o.length>n;n+=s){const e=o[n],i=Ur(e,t.item,Math.min(t.slot,Yr(e,t.item).length));if("ok"===Xr(t,e,i))return es(t,e,i,"ok"),void qs(t)}return}case" ":case"Enter":return n.preventDefault(),n.stopPropagation(),pr=performance.now(),br=n,void As(t);case"Escape":return n.preventDefault(),n.stopPropagation(),void Es("escape");case"Tab":Es("blur")}}(n,t)}function Ls(){"keyboard"===ur?.mode&&"dragging"===ur.phase&&Es("blur")}function _s(){const t=ur;if(!t||"keyboard"!==t.mode||"dragging"!==t.phase)return!1;const n=t.item,e=!document.activeElement||document.activeElement===document.body||n.contains(document.activeElement);return Zr(t)&&t.target?(t.item!==n&&e&&(Sr(t.source,t.item)??t.item).focus({preventScroll:!0}),t.slot=Ur(t.target,t.item,Math.min(t.slot,Yr(t.target,t.item).length)),ys(t),!0):(Es("gone"),!1)}function As(t){t.target&&"ok"===t.legal?Is():Es("blocked")}function qs(t){const n=t.target;if(!n)return;const e=Yr(n,t.item);(e[t.slot-1]??e[t.slot]??n).scrollIntoView({block:"nearest",inline:"nearest"}),requestAnimationFrame(()=>{ur===t&&ys(t)})}function Fs(t){return Er(t.source,t.sourceId,t.group)??t.source}function Ds(t){return(t.target&&Er(t.target,t.targetId,t.group))??t.target??Fs(t)}function js(t){return t.group?Mr(t.group,Fs(t)):[...new Set([Fs(t),Ds(t)])]}function Hs(t){const n=new Map;for(const e of js(t))n.set(e.id||e,e.items.map(t=>e.keyOf(t)??t));return n}function Os(t){const n=Hs(t),e=t.snapshot;if(n.size!==e.size)return!0;for(const[i,o]of e){const t=n.get(i);if(!t||!Ar(t,o))return!0}return!1}function Vs(t,n){if(t.observed.has(n))return;t.observed.add(n);const e=new MutationObserver(()=>Ns("mutation"));e.observe(n,{childList:!0});const i=new MutationObserver(()=>function(){const t=ur;if(!t||"holding"!==t.phase)return;const n=Ws(t);if(t.busy&&!n){t.busy=!1;const n=()=>{ur!==t||t.busy||(t.observers.forEach(t=>t.takeRecords()),Ns("idle"))};if(t.htmx){t.htmx=!1;const e=o=>{const r=o?.target;r instanceof Element&&r.isConnected&&!js(t).some(t=>r.contains(t)||t.contains(r))||(document.removeEventListener("htmx:afterSettle",e),clearTimeout(i),requestAnimationFrame(n))},i=window.setTimeout(e,3e3);return void document.addEventListener("htmx:afterSettle",e)}requestAnimationFrame(()=>requestAnimationFrame(()=>{window.setTimeout(n,250)}))}else n&&(t.busy=!0,t.htmx=js(t).some(t=>t.classList.contains("htmx-request")))}());i.observe(n,{attributes:!0,attributeFilter:["aria-busy","class"]}),t.observers.push(e,i)}function Is(){const t=ur,n=t.target;if(cancelAnimationFrame(t.raf),t.cleanup.forEach(t=>t()),t.cleanup=[],n===t.source&&t.slot===t.source.items.indexOf(t.item))return ur=null,$s(t),"keyboard"===t.mode&&t.source.hi("dropped",{item:Lr(t.source,t.item),position:t.slot+1,total:n.items.length,list:_r(n)}),Ms(t,t.item,()=>Cs(t)),!1;const e=function(t){const n=t.target,e=Rr(t),i=Yr(n,t.item),o={list:n.id||null,index:t.slot,prev:i[t.slot-1]?n.keyOf(i[t.slot-1]):null,next:i[t.slot]?n.keyOf(i[t.slot]):null},r={},s=(t,n)=>n.map(n=>t.keyOf(n));if(n!==t.source&&t.source.id&&(r[t.source.id]=s(t.source,Yr(t.source,t.item))),n.id){const e=s(n,i);e.splice(t.slot,0,t.key),r[n.id]=e}return{key:t.key,group:t.group,source:t.mode,from:e,to:o,order:r}}(t);t.value=e,t.snapshot=Hs(t),t.phase="holding",t.holdStart=performance.now(),t.focus=document.activeElement;for(const r of js(t))zr(r,"over",!1),zr(r,"blocked",!1),zr(r,"dragging",!1),zr(r,"pending",!0);!function(t){const n=t.target;t.layer||os(t,t.item.getBoundingClientRect()),!t.ghost&&t.layer&&(as(t,t.item.getBoundingClientRect()),t.ghost.getBoundingClientRect()),t.ghost.style.display="",rs(t,null),t.indicator&&(t.indicator.style.display="none");const e=xr(n),i="vertical"===n.axis,o="pointer"!==t.mode,r=ws(t,o);let s,a;if(n===t.source){const n=us(t.item),e=r.get(t.item)??0;s=n.left+(i?0:e),a=n.top+(i?e:0)}else({x:s,y:a}=vs(t,n)),cs(t,o?"dim":"hide");ks(t,r,e),ls(t.ghost,s,a,e)}(t),Ps(t);const i=()=>{ur===t&&"holding"===t.phase&&(Ps(t),requestAnimationFrame(i))};requestAnimationFrame(i);for(const r of js(t))Vs(t,r);t.busy=Ws(t);const o=new CustomEvent("ty-sortable-change",{detail:{value:e,item:t.item,fromContainer:t.source,toContainer:n},bubbles:!0,cancelable:!0});return n.dispatchEvent(o),ur!==t||"holding"!==t.phase||(o.defaultPrevented?(Rs("rejected"),!0):(t.busy=Ws(t),t.htmx=t.busy&&js(t).some(t=>t.classList.contains("htmx-request")),function(t){clearTimeout(t.timer),t.timer=window.setTimeout(function n(){ur===t&&"holding"===t.phase&&(t.busy&&3e4>performance.now()-t.holdStart?t.timer=window.setTimeout(n,250):Rs("unknown"))},t.source.holdTimeout)}(t),!0))}function Ws(t){return js(t).some(t=>"true"===t.getAttribute("aria-busy")||t.classList.contains("htmx-request"))}function Ns(t){const n=ur;if(!n||"holding"!==n.phase)return;const e="mutation"!==t;if(!Os(n))return void(e&&Rs("rejected"));const i=n.value,o=function(t){let n=null,e=0;for(const i of js(t)){const o=i.items;o.forEach((r,s)=>{(t.key?i.keyOf(r)===t.key:r===t.item)&&(e++,n&&i!==Ds(t)||(n={list:i,index:s,prev:o[s-1]?i.keyOf(o[s-1]):null,next:o[s+1]?i.keyOf(o[s+1]):null}))})}return n?{...n,count:e}:null}(n);if(!o)return void Rs("reconciled");const r=Ds(n),s=Fs(n);1!==o.count||o.list!==r||(o.prev!==i.to.prev||o.next!==i.to.next)&&o.index!==i.to.index?1===o.count&&o.list===s&&o.prev===i.from.prev&&o.next===i.from.next?e?Rs("rejected"):Bs(n):1>=o.count||e?Rs("reconciled"):Bs(n):Rs("accepted")}function Ps(t){t.painted.clear();for(const n of t.shifts.keys()){const e=n.parentElement instanceof TySortable?n.parentElement:null,i=e?.keyOf(n);i&&i!==t.key&&n.isConnected&&t.painted.set(i,n.getBoundingClientRect())}}function Bs(t){const n=t.snapshot;for(const e of js(t)){const i=n.get(e.id||e);if(!i||!Ar(i,e.items.map(t=>e.keyOf(t)??t)))for(const[n,o]of t.shifts){if(n.parentElement!==e)continue;o.anim.cancel(),t.shifts.delete(n);const i=e.keyOf(n);i&&t.painted.delete(i)}}}function Rs(t){const n=ur;if(!n||"holding"!==n.phase)return;ur=null,clearTimeout(n.timer),n.observers.forEach(t=>t.disconnect()),n.observers=[],$s(n);const e=n.value,i=Ds(n),o=Fs(n),r=t=>n.key?t.items.find(e=>t.keyOf(e)===n.key)??null:null,s=js(n),a="pointer"!==n.mode,l="unknown"===t&&!Os(n);if("rejected"===t||l){const i=r(o)??(n.item.isConnected?n.item:null);a&&("rejected"===t?o.hi("rejected",{item:Lr(o,n.item),position:e.from.index+1,list:_r(o)}):o.hi("unknown",{item:Lr(o,n.item)}),i&&Ys(n,o,i)),Ms(n,i,()=>Cs(n))}else{const l=n.ghost?.getBoundingClientRect()??null,c=n.painted;Cs(n);const d=(()=>{for(const t of[i,...s]){const e=r(t)??(n.key||n.item.parentElement!==t?null:n.item);if(e)return{list:t,el:e}}return null})(),h=xr(i),u=(t,n)=>{const e=t.getBoundingClientRect(),i=n.left-e.left,o=n.top-e.top;.5>Math.abs(i)&&.5>Math.abs(o)||t.animate([{translate:`${i}px ${o}px`},{translate:"0 0"}],{duration:h,easing:xs,composite:"add"})};if(h&&"unknown"!==t){d&&l&&"accepted"===t&&u(d.el,l);for(const t of s)for(const n of t.items){const e=t.keyOf(n),i=e?c.get(e):void 0;i&&u(n,i)}}if(d&&"unknown"!==t&&d.list.hasAttribute("flash")&&function(t,n){const e=kr(t,"--ty-sortable-flash-color",kr(t,"--ty-sortable-indicator-color","#3b82f6"));n.animate([{outline:"2px solid "+e,outlineOffset:"-2px"},{outline:"2px solid transparent",outlineOffset:"-2px"}],{duration:700,easing:"ease-out"})}(d.list,d.el),a){const i=Lr(o,d?.el??n.item);if(d){const e=d.list.items,o={item:i,position:e.indexOf(d.el)+1,total:e.length,list:_r(d.list)};d.list.hi("accepted"===t?"dropped":"unknown"===t?"unknown":"reconciled",o),Ys(n,d.list,d.el)}else{o.hi("unknown"===t?"unknown":"removed",{item:i});const r=o.items[Math.min(e.from.index,o.items.length-1)];r&&Ys(n,o,r)}}}i.dispatchEvent(new CustomEvent("ty-sortable-settle",{detail:{value:e,outcome:t}})),n.resolve?.(t)}function Ys(t,n,e){const i=document.activeElement;(!i||i===document.body||!t.focus||!t.focus.isConnected||i===t.focus)&&(i&&e.contains(i)||(Sr(n,e)??e).focus({preventScroll:!0}))}customElements.get("ty-sortable")||customElements.define("ty-sortable",TySortable),"undefined"!=typeof window&&(window.tyVersion=J,window.tyIcons={register:t=>{lt(t)},get:t=>ct(t),has:t=>dt(t),list:()=>gt(),cacheInfo:()=>mt(),clearCache:()=>ht()},window.tyResizeObserver={getSize:t=>or(t),onResize:(t,n)=>rr(t,n),getAllSizes:()=>sr(),get sizes(){return sr()}},window.tyLoader={set:t=>U(t),get:()=>X(),reset:()=>Z()}),t.IconRegistry=vt,t.TyButton=G,t.TyCalendar=Io,t.TyCalendarMonth=TyCalendarMonth,t.TyCalendarNavigation=Lo,t.TyCheckbox=Ot,t.TyCopy=tn,t.TyDatePicker=nr,t.TyFileUpload=rn,t.TyIcon=xt,t.TyInput=Ft,t.TyModal=TyModal,t.TyOption=TyOption,t.TyPopup=TyPopup,t.TyRadio=Yt,t.TyRadioGroup=Xt,t.TyResizeObserver=TyResizeObserver,t.TyScrollContainer=TyScrollContainer,t.TySelect=li,t.TySelectedOptions=TySelectedOptions,t.TySelectedTags=TySelectedOptions,t.TySortable=TySortable,t.TyStep=TyStep,t.TySwitch=Nt,t.TyTab=TyTab,t.TyTabs=TyTabs,t.TyTag=$t,t.TyTextarea=hn,t.TyTooltip=TyTooltip,t.TyWizard=TyWizard,t.disableScrollLockDebug=function(){window.tyScrollDebug=!1},t.enableScrollLockDebug=function(){window.tyScrollDebug=!0},t.forceUnlockAll=function(){Pn.activeLocks.clear(),ie()},t.getActiveLocks=function(){return new Set(Pn.activeLocks)},t.getAllSizes=sr,t.getLoaderSvg=X,t.getLockState=function(){return{locked:Pn.locked,scrollY:Pn.scrollY,activeLocks:Array.from(Pn.activeLocks)}},t.getSize=or,t.isLocked=function(){return Pn.locked},t.isLockedBy=function(t){return Pn.activeLocks.has(t)},t.lockScroll=oe,t.onResize=rr,t.resetLoaderSvg=Z,t.setLoaderSvg=U,t.unlockScroll=re,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|