var __awaiter=this&&this.__awaiter||function(t,e,i,a){function n(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,r){function o(t){try{c(a.next(t))}catch(t){r(t)}}function s(t){try{c(a["throw"](t))}catch(t){r(t)}}function c(t){t.done?i(t.value):n(t.value).then(o,s)}c((a=a.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},a,n,r,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(t){return function(e){return c([t,e])}}function c(o){if(a)throw new TypeError("Generator is already executing.");while(i)try{if(a=1,n&&(r=o[0]&2?n["return"]:o[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;if(n=0,r)o=[o[0]&2,r.value];switch(o[0]){case 0:case 1:r=o;break;case 4:i.label++;return{value:o[1],done:false};case 5:i.label++;n=o[1];o=[0];continue;case 7:o=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){i=0;continue}if(o[0]===3&&(!r||o[1]>r[0]&&o[1]0};t.prototype.setupTextContentObserver=function(){var t;(t=this.mutationObserver)===null||t===void 0?void 0:t.observe(this.el,{childList:true,subtree:true})};t.prototype.emitActiveTab=function(t){if(t===void 0){t=true}if(this.disabled){return}var e={tab:this.tab};this.calciteInternalTabsActivate.emit(e);if(t){this.calciteTabsActivate.emit(e)}};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{active:["activeTabChanged"]}},enumerable:false,configurable:true});return t}();TabTitle.style=tabTitleCss;var SLOTS={tabNav:"tab-nav"};var tabsCss="@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host([bordered]){-webkit-box-shadow:inset 0 1px 0 var(--calcite-ui-border-1);box-shadow:inset 0 1px 0 var(--calcite-ui-border-1);background-color:var(--calcite-ui-foreground-1)}:host([bordered]:not([position=below])) ::slotted(calcite-tab-nav){margin-bottom:-1px}:host([bordered][position=below]) ::slotted(calcite-tab-nav){margin-top:-1px}:host([bordered][position=below]){-webkit-box-shadow:inset 0 1px 0 var(--calcite-ui-border-1), inset 0 -1px 0 var(--calcite-ui-border-1);box-shadow:inset 0 1px 0 var(--calcite-ui-border-1), inset 0 -1px 0 var(--calcite-ui-border-1)}:host([bordered]) section{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1)}:host([bordered][scale=s]) section{padding:0.75rem}:host([bordered][scale=m]) section{padding:0.5rem}:host([bordered][scale=l]) section{padding:1rem}:host([position=below]){-ms-flex-direction:column-reverse;flex-direction:column-reverse}section{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;overflow:hidden;border-top-width:1px;border-top-color:var(--calcite-ui-border-1);border-top-style:solid}:host([position=below]) section{-ms-flex-direction:column-reverse;flex-direction:column-reverse;border-top-width:0px;border-bottom-width:1px;border-bottom-color:var(--calcite-ui-border-1)}:host([position=below]:not([bordered])) section{border-bottom-style:solid}";var Tabs=function(){function t(t){registerInstance(this,t);this.layout="inline";this.position="above";this.scale="m";this.bordered=false;this.titles=[];this.tabs=[]}t.prototype.connectedCallback=function(){if(this.layout==="center"){this.bordered=false}};t.prototype.render=function(){return h(Fragment,null,h("slot",{name:SLOTS.tabNav}),h("section",null,h("slot",null)))};t.prototype.calciteTabTitleRegister=function(t){this.titles=__spreadArray(__spreadArray([],this.titles,true),[t.target],false);this.registryHandler();t.stopPropagation()};t.prototype.calciteTabTitleUnregister=function(t){this.titles=this.titles.filter((function(e){return e!==t.detail}));this.registryHandler();t.stopPropagation()};t.prototype.calciteTabRegister=function(t){this.tabs=__spreadArray(__spreadArray([],this.tabs,true),[t.target],false);this.registryHandler();t.stopPropagation()};t.prototype.calciteTabUnregister=function(t){this.tabs=this.tabs.filter((function(e){return e!==t.detail}));this.registryHandler();t.stopPropagation()};t.prototype.registryHandler=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,i,a;var n=this;return __generator(this,(function(r){switch(r.label){case 0:if(!(this.tabs.some((function(t){return t.tab}))||this.titles.some((function(t){return t.tab}))))return[3,1];t=this.tabs.sort((function(t,e){return t.tab.localeCompare(e.tab)})).map((function(t){return t.id}));e=this.titles.sort((function(t,e){return t.tab.localeCompare(e.tab)})).map((function(t){return t.id}));return[3,4];case 1:return[4,Promise.all(this.tabs.map((function(t){return t.getTabIndex()})))];case 2:i=r.sent();return[4,Promise.all(this.titles.map((function(t){return t.getTabIndex()})))];case 3:a=r.sent();t=i.reduce((function(t,e,i){t[e]=n.tabs[i].id;return t}),[]);e=a.reduce((function(t,e,i){t[e]=n.titles[i].id;return t}),[]);r.label=4;case 4:this.tabs.forEach((function(i){return i.updateAriaInfo(t,e)}));this.titles.forEach((function(i){return i.updateAriaInfo(t,e)}));return[2]}}))}))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();Tabs.style=tabsCss;export{Tab as calcite_tab,TabNav as calcite_tab_nav,TabTitle as calcite_tab_title,Tabs as calcite_tabs};