/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/seinjs-tabs-switch-viewer@0.8.5/lib/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function u(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}};Object.defineProperty(exports,"__esModule",{value:!0});var Bazier_1=require("./Bazier");exports.Bazier=Bazier_1.default;var game_1=require("./game"),utils_1=require("./utils"),TabSwitchViewer=function(){function e(){this._started=!1,this._currentTab=null}return Object.defineProperty(e.prototype,"game",{get:function(){return this._game},enumerable:!0,configurable:!0}),e.prototype.init=function(e,t){return void 0===t&&(t=function(){}),__awaiter(this,void 0,void 0,(function(){var r=this;return __generator(this,(function(n){return e.canvas.style.opacity=""+e.startAlpha,[2,new Promise((function(n,i){var o=r._game=game_1.main(e);!e.forceCompressTexture||utils_1.checkCompressTexture(o)?(o.event.addOnce("Ready",(function(){n()})),o.onError=function(e){i(e)},o.event.add("WebglContextRestored",(function(){window.location.reload()})),o.event.register("FirstShowModel"),o.event.register("SwitchModel"),o.event.register("SwitchModelDone"),o.event.register("Ready"),t(o),o.start()):i(new Error("Not support compress textures"))}))]}))}))},e.prototype.start=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(r){return this._game.event.trigger("FirstShowModel",e),[2,new Promise((function(r){t._game.event.addOnce("MainRendererIsFinished",(function(){t._currentTab=e,t._started=!0,t._game.canvas.style.opacity="1",r()}))}))]}))}))},e.prototype.switchTab=function(e,t){return __awaiter(this,void 0,void 0,(function(){var r,n,i,o,a=this;return __generator(this,(function(u){return this._started?(r=this._game.state.options.tabList,n=r.indexOf(this._currentTab),i=r.indexOf(e),this._currentTab=e,o=i<n?"next":"pre",[2,new Promise((function(r,n){a._game.event.addOnce("SwitchModelDone",(function(){return r()})),t&&t(o),a._game.event.trigger("SwitchModel",{tab:e,direction:o})}))]):[2]}))}))},e.prototype.pause=function(){this._game&&this._game.pause()},e.prototype.resume=function(){this._game&&this._game.resume()},e.prototype.destroy=function(){this._game&&this._game.destroy(),this._game=null},e}();exports.default=TabSwitchViewer;
//# sourceMappingURL=/sm/8f0006eb63641335af5049b805a6782a66224b3edcff4876304de314c545a7be.map