var __awaiter=this&&this.__awaiter||function(t,n,e,i){function r(t){return t instanceof e?t:new e((function(n){n(t)}))}return new(e||(e=Promise))((function(e,s){function u(t){try{o(i.next(t))}catch(t){s(t)}}function a(t){try{o(i["throw"](t))}catch(t){s(t)}}function o(t){t.done?e(t.value):r(t.value).then(u,a)}o((i=i.apply(t,n||[])).next())}))};var __generator=this&&this.__generator||function(t,n){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(t){return function(n){return o([t,n])}}function o(a){if(i)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(e=0)),e)try{if(i=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:e.label++;return{value:a[1],done:false};case 5:e.label++;r=a[1];a=[0];continue;case 7:a=e.ops.pop();e.trys.pop();continue;default:if(!(s=e.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){e=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]0))return[3,2];return[4,this.select(t[0])];case 1:n.sent();n.label=2;case 2:this.ionNavWillLoad.emit();return[2]}}))}))};t.prototype.componentWillRender=function(){var t=this.el.querySelector("ion-tab-bar");if(t){var n=this.selectedTab?this.selectedTab.tab:undefined;t.selectedTab=n}};t.prototype.select=function(t){return __awaiter(this,void 0,void 0,(function(){var n;return __generator(this,(function(e){switch(e.label){case 0:n=l(this.tabs,t);if(!this.shouldSwitch(n)){return[2,false]}return[4,this.setActive(n)];case 1:e.sent();return[4,this.notifyRouter()];case 2:e.sent();this.tabSwitch();return[2,true]}}))}))};t.prototype.getTab=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){return[2,l(this.tabs,t)]}))}))};t.prototype.getSelected=function(){return Promise.resolve(this.selectedTab?this.selectedTab.tab:undefined)};t.prototype.setRouteId=function(t){return __awaiter(this,void 0,void 0,(function(){var n;var e=this;return __generator(this,(function(i){switch(i.label){case 0:n=l(this.tabs,t);if(!this.shouldSwitch(n)){return[2,{changed:false,element:this.selectedTab}]}return[4,this.setActive(n)];case 1:i.sent();return[2,{changed:true,element:this.selectedTab,markVisible:function(){return e.tabSwitch()}}]}}))}))};t.prototype.getRouteId=function(){return __awaiter(this,void 0,void 0,(function(){var t,n;return __generator(this,(function(e){n=(t=this.selectedTab)===null||t===void 0?void 0:t.tab;return[2,n!==undefined?{id:n,element:this.selectedTab}:undefined]}))}))};t.prototype.setActive=function(t){if(this.transitioning){return Promise.reject("transitioning already happening")}this.transitioning=true;this.leavingTab=this.selectedTab;this.selectedTab=t;this.ionTabsWillChange.emit({tab:t.tab});t.active=true;return Promise.resolve()};t.prototype.tabSwitch=function(){var t=this.selectedTab;var n=this.leavingTab;this.leavingTab=undefined;this.transitioning=false;if(!t){return}if(n!==t){if(n){n.active=false}this.ionTabsDidChange.emit({tab:t.tab})}};t.prototype.notifyRouter=function(){if(this.useRouter){var t=document.querySelector("ion-router");if(t){return t.navChanged("forward")}}return Promise.resolve(false)};t.prototype.shouldSwitch=function(t){var n=this.selectedTab;return t!==undefined&&t!==n&&!this.transitioning};Object.defineProperty(t.prototype,"tabs",{get:function(){return Array.from(this.el.querySelectorAll("ion-tab"))},enumerable:false,configurable:true});t.prototype.render=function(){return e(i,{key:"05f1607d092d5bef9f1f42dd46d4bec6caa58f15",onIonTabButtonClick:this.onTabClicked},e("slot",{key:"8e175dbf3afeb76c0b3a794b3064a2191b1b5fbc",name:"top"}),e("div",{key:"d7120d2f0dc58cca23c0854e042a4d4b8fde4db6",class:"tabs-inner"},e("slot",{key:"a3651076ad9ab1c6cf56a7b82172ff59930d1963"})),e("slot",{key:"a719a23f813740dc2c03d21af0c2fe28f1b4f8bb",name:"bottom"}))};Object.defineProperty(t.prototype,"el",{get:function(){return r(this)},enumerable:false,configurable:true});return t}());var l=function(t,n){var e=typeof n==="string"?t.find((function(t){return t.tab===n})):n;if(!e){console.error('tab with id: "'.concat(e,'" does not exist'))}return e};d.style=h}}}));