// Marzipano - a 360° media viewer for the modern web (v0.9.1) // // Copyright 2016 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Marzipano=t()}}(function(){var t;return function(){function t(e,r,i){function n(s,a){if(!r[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var l=r[s]={exports:{}};e[s][0].call(l.exports,function(t){return n(e[s][1][t]||t)},l,l.exports,t,e,r,i)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s0&&r[1]||""},t.getSecondMatch=function(t,e){var r=e.match(t);return r&&r.length>1&&r[2]||""},t.matchAndReturnConst=function(t,e,r){if(t.test(e))return r},t.getWindowsVersionName=function(t){switch(t){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},t.getMacOSVersionName=function(t){var e=t.split(".").splice(0,2).map(function(t){return parseInt(t,10)||0});if(e.push(0),10===e[0])switch(e[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},t.getAndroidVersionName=function(t){var e=t.split(".").splice(0,2).map(function(t){return parseInt(t,10)||0});if(e.push(0),!(1===e[0]&&e[1]<5))return 1===e[0]&&e[1]<6?"Cupcake":1===e[0]&&e[1]>=6?"Donut":2===e[0]&&e[1]<2?"Eclair":2===e[0]&&2===e[1]?"Froyo":2===e[0]&&e[1]>2?"Gingerbread":3===e[0]?"Honeycomb":4===e[0]&&e[1]<1?"Ice Cream Sandwich":4===e[0]&&e[1]<4?"Jelly Bean":4===e[0]&&e[1]>=4?"KitKat":5===e[0]?"Lollipop":6===e[0]?"Marshmallow":7===e[0]?"Nougat":8===e[0]?"Oreo":9===e[0]?"Pie":void 0},t.getVersionPrecision=function(t){return t.split(".").length},t.compareVersions=function(e,r,i){void 0===i&&(i=!1);var n=t.getVersionPrecision(e),o=t.getVersionPrecision(r),s=Math.max(n,o),a=0,u=t.map([e,r],function(e){var r=s-t.getVersionPrecision(e),i=e+new Array(r+1).join(".0");return t.map(i.split("."),function(t){return new Array(20-t.length).join("0")+t}).reverse()});for(i&&(a=s-Math.min(n,o)),s-=1;s>=a;){if(u[0][s]>u[1][s])return 1;if(u[0][s]===u[1][s]){if(s===a)return 0;s-=1}else if(u[0][s]0){var s=Object.keys(r),a=s.find(function(t){return e.isOS(t)});if(a){var u=this.satisfies(r[a]);if(void 0!==u)return u}var h=s.find(function(t){return e.isPlatform(t)});if(h){var l=this.satisfies(r[h]);if(void 0!==l)return l}}if(o>0){var c=Object.keys(n).find(function(t){return e.isBrowser(t,!0)});if(void 0!==c)return this.compareVersion(n[c])}},e.isBrowser=function(t,e){void 0===e&&(e=!1);var r=this.getBrowserName().toLowerCase(),i=t.toLowerCase(),n=u["default"].getBrowserTypeByAlias(i);return e&&n&&(i=n.toLowerCase()),i===r},e.compareVersion=function(t){var e=[0],r=t,i=!1,n=this.getBrowserVersion();if("string"==typeof n)return">"===t[0]||"<"===t[0]?(r=t.substr(1),"="===t[1]?(i=!0,r=t.substr(2)):e=[],">"===t[0]?e.push(1):e.push(-1)):"="===t[0]?r=t.substr(1):"~"===t[0]&&(i=!0,r=t.substr(1)),e.indexOf(u["default"].compareVersions(n,r,i))>-1},e.isOS=function(t){return this.getOSName(!0)===String(t).toLowerCase()},e.isPlatform=function(t){return this.getPlatformType(!0)===String(t).toLowerCase()},e.isEngine=function(t){return this.getEngineName(!0)===String(t).toLowerCase()},e.is=function(t){return this.isBrowser(t)||this.isOS(t)||this.isPlatform(t)},e.some=function(t){var e=this;return void 0===t&&(t=[]),t.some(function(t){return e.is(t)})},t}();e["default"]=h,t.exports=e["default"]},92:function(t,e,r){"use strict";e.__esModule=!0,e["default"]=void 0;var i,n=(i=r(17))&&i.__esModule?i:{"default":i},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(t){var e={name:"Googlebot"},r=n["default"].getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/opera/i],describe:function(t){var e={name:"Opera"},r=n["default"].getFirstMatch(o,t)||n["default"].getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opr\/|opios/i],describe:function(t){var e={name:"Opera"},r=n["default"].getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/SamsungBrowser/i],describe:function(t){var e={name:"Samsung Internet for Android"},r=n["default"].getFirstMatch(o,t)||n["default"].getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Whale/i],describe:function(t){var e={name:"NAVER Whale Browser"},r=n["default"].getFirstMatch(o,t)||n["default"].getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MZBrowser/i],describe:function(t){var e={name:"MZ Browser"},r=n["default"].getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/focus/i],describe:function(t){var e={name:"Focus"},r=n["default"].getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/swing/i],describe:function(t){var e={name:"Swing"},r=n["default"].getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/coast/i],describe:function(t){var e={name:"Opera Coast"},r=n["default"].getFirstMatch(o,t)||n["default"].getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/yabrowser/i],describe:function(t){var e={name:"Yandex Browser"},r=n["default"].getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/ucbrowser/i],describe:function(t){var e={name:"UC Browser"},r=n["default"].getFirstMatch(o,t)||n["default"].getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Maxthon|mxios/i],describe:function(t){var e={name:"Maxthon"},r=n["default"].getFirstMatch(o,t)||n["default"].getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/epiphany/i],describe:function(t){var e={name:"Epiphany"},r=n["default"].getFirstMatch(o,t)||n["default"].getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/puffin/i],describe:function(t){var e={name:"Puffin"},r=n["default"].getFirstMatch(o,t)||n["default"].getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sleipnir/i],describe:function(t){var e={name:"Sleipnir"},r=n["default"].getFirstMatch(o,t)||n["default"].getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/k-meleon/i],describe:function(t){var e={name:"K-Meleon"},r=n["default"].getFirstMatch(o,t)||n["default"].getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/micromessenger/i],describe:function(t){var e={name:"WeChat"},r=n["default"].getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/qqbrowser/i],describe:function(t){var e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},r=n["default"].getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/msie|trident/i],describe:function(t){var e={name:"Internet Explorer"},r=n["default"].getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/\sedg\//i],describe:function(t){var e={name:"Microsoft Edge"},r=n["default"].getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/edg([ea]|ios)/i],describe:function(t){var e={name:"Microsoft Edge"},r=n["default"].getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/vivaldi/i],describe:function(t){var e={name:"Vivaldi"},r=n["default"].getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/seamonkey/i],describe:function(t){var e={name:"SeaMonkey"},r=n["default"].getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sailfish/i],describe:function(t){var e={name:"Sailfish"},r=n["default"].getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return r&&(e.version=r),e}},{test:[/silk/i],describe:function(t){var e={name:"Amazon Silk"},r=n["default"].getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/phantom/i],describe:function(t){var e={name:"PhantomJS"},r=n["default"].getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/slimerjs/i],describe:function(t){var e={name:"SlimerJS"},r=n["default"].getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e={name:"BlackBerry"},r=n["default"].getFirstMatch(o,t)||n["default"].getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e={name:"WebOS Browser"},r=n["default"].getFirstMatch(o,t)||n["default"].getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/bada/i],describe:function(t){var e={name:"Bada"},r=n["default"].getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/tizen/i],describe:function(t){var e={name:"Tizen"},r=n["default"].getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/qupzilla/i],describe:function(t){var e={name:"QupZilla"},r=n["default"].getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/firefox|iceweasel|fxios/i],describe:function(t){var e={name:"Firefox"},r=n["default"].getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/chromium/i],describe:function(t){var e={name:"Chromium"},r=n["default"].getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/chrome|crios|crmo/i],describe:function(t){var e={name:"Chrome"},r=n["default"].getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/GSA/i],describe:function(t){var e={name:"Google Search"},r=n["default"].getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:function(t){var e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe:function(t){var e={name:"Android Browser"},r=n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/playstation 4/i],describe:function(t){var e={name:"PlayStation 4"},r=n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/safari|applewebkit/i],describe:function(t){var e={name:"Safari"},r=n["default"].getFirstMatch(o,t);return r&&(e.version=r),e}},{test:[/.*/i],describe:function(t){var e=-1!==t.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:n["default"].getFirstMatch(e,t),version:n["default"].getSecondMatch(e,t)}}}];e["default"]=s,t.exports=e["default"]},93:function(t,e,r){"use strict";e.__esModule=!0,e["default"]=void 0;var i,n=(i=r(17))&&i.__esModule?i:{"default":i},o=r(18),s=[{test:[/Roku\/DVP/],describe:function(t){var e=n["default"].getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:o.OS_MAP.Roku,version:e}}},{test:[/windows phone/i],describe:function(t){var e=n["default"].getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.WindowsPhone,version:e}}},{test:[/windows/i],describe:function(t){var e=n["default"].getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),r=n["default"].getWindowsVersionName(e);return{name:o.OS_MAP.Windows,version:e,versionName:r}}},{test:[/macintosh/i],describe:function(t){var e=n["default"].getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),r=n["default"].getMacOSVersionName(e),i={name:o.OS_MAP.MacOS,version:e};return r&&(i.versionName=r),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(t){var e=n["default"].getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:e}}},{test:function(t){var e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe:function(t){var e=n["default"].getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),r=n["default"].getAndroidVersionName(e),i={name:o.OS_MAP.Android,version:e};return r&&(i.versionName=r),i}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e=n["default"].getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),r={name:o.OS_MAP.WebOS};return e&&e.length&&(r.version=e),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e=n["default"].getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||n["default"].getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||n["default"].getFirstMatch(/\bbb(\d+)/i,t);return{name:o.OS_MAP.BlackBerry,version:e}}},{test:[/bada/i],describe:function(t){var e=n["default"].getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.Bada,version:e}}},{test:[/tizen/i],describe:function(t){var e=n["default"].getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.Tizen,version:e}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(t){var e=n["default"].getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:o.OS_MAP.PlayStation4,version:e}}}];e["default"]=s,t.exports=e["default"]},94:function(t,e,r){"use strict";e.__esModule=!0,e["default"]=void 0;var i,n=(i=r(17))&&i.__esModule?i:{"default":i},o=r(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(t){var e=n["default"].getFirstMatch(/(can-l01)/i,t)&&"Nova",r={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return e&&(r.model=e),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(t){var e=t.test(/ipod|iphone/i),r=t.test(/like (ipod|iphone)/i);return e&&!r},describe:function(t){var e=n["default"].getFirstMatch(/(ipod|iphone)/i,t);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"blackberry"===t.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(t){return"bada"===t.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"windows phone"===t.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(t){var e=Number(String(t.getOSVersion()).split(".")[0]);return"android"===t.getOSName(!0)&&e>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(t){return"android"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(t){return"macos"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(t){return"windows"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(t){return"linux"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(t){return"playstation 4"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(t){return"roku"===t.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];e["default"]=s,t.exports=e["default"]},95:function(t,e,r){"use strict";e.__esModule=!0,e["default"]=void 0;var i,n=(i=r(17))&&i.__esModule?i:{"default":i},o=r(18),s=[{test:function(t){return"microsoft edge"===t.getBrowserName(!0)},describe:function(t){if(/\sedg\//i.test(t))return{name:o.ENGINE_MAP.Blink};var e=n["default"].getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:o.ENGINE_MAP.EdgeHTML,version:e}}},{test:[/trident/i],describe:function(t){var e={name:o.ENGINE_MAP.Trident},r=n["default"].getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:function(t){return t.test(/presto/i)},describe:function(t){var e={name:o.ENGINE_MAP.Presto},r=n["default"].getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:function(t){var e=t.test(/gecko/i),r=t.test(/like gecko/i);return e&&!r},describe:function(t){var e={name:o.ENGINE_MAP.Gecko},r=n["default"].getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(t){var e={name:o.ENGINE_MAP.WebKit},r=n["default"].getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}}];e["default"]=s,t.exports=e["default"]}})})},{}],2:[function(t,e,r){"use strict";function i(t){r.ARRAY_TYPE=a=t}function n(t){return t*h}function o(t,e){return Math.abs(t-e)<=s*Math.max(1,Math.abs(t),Math.abs(e))}Object.defineProperty(r,"__esModule",{value:!0}),r.setMatrixArrayType=i,r.toRadian=n,r.equals=o,r.RANDOM=r.ARRAY_TYPE=r.EPSILON=void 0;var s=1e-6;r.EPSILON=s;var a="undefined"!=typeof Float32Array?Float32Array:Array;r.ARRAY_TYPE=a;var u=Math.random;r.RANDOM=u;var h=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)})},{}],3:[function(t,e,r){"use strict";function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,r):{};i.get||i.set?Object.defineProperty(e,r,i):e[r]=t[r]}return e["default"]=t,e}Object.defineProperty(r,"__esModule",{value:!0}),r.vec4=r.vec3=r.vec2=r.quat2=r.quat=r.mat4=r.mat3=r.mat2d=r.mat2=r.glMatrix=void 0;var n=i(t("./common.js"));r.glMatrix=n;var o=i(t("./mat2.js"));r.mat2=o;var s=i(t("./mat2d.js"));r.mat2d=s;var a=i(t("./mat3.js"));r.mat3=a;var u=i(t("./mat4.js"));r.mat4=u;var h=i(t("./quat.js"));r.quat=h;var l=i(t("./quat2.js"));r.quat2=l;var c=i(t("./vec2.js"));r.vec2=c;var p=i(t("./vec3.js"));r.vec3=p;var f=i(t("./vec4.js"));r.vec4=f},{"./common.js":2,"./mat2.js":4,"./mat2d.js":5,"./mat3.js":6,"./mat4.js":7,"./quat.js":8,"./quat2.js":9,"./vec2.js":10,"./vec3.js":11,"./vec4.js":12}],4:[function(t,e,r){"use strict";function i(){var t=new L.ARRAY_TYPE(4);return L.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function n(t){var e=new L.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function o(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function s(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function a(t,e,r,i){var n=new L.ARRAY_TYPE(4);return n[0]=t,n[1]=e,n[2]=r,n[3]=i,n}function u(t,e,r,i,n){return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t}function h(t,e){if(t===e){var r=e[1];t[1]=e[2],t[2]=r}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function l(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],s=r*o-n*i;return s?(s=1/s,t[0]=o*s,t[1]=-i*s,t[2]=-n*s,t[3]=r*s,t):null}function c(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t}function p(t){return t[0]*t[3]-t[2]*t[1]}function f(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=r[0],u=r[1],h=r[2],l=r[3];return t[0]=i*a+o*u,t[1]=n*a+s*u,t[2]=i*h+o*l,t[3]=n*h+s*l,t}function d(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=Math.sin(r),u=Math.cos(r);return t[0]=i*u+o*a,t[1]=n*u+s*a,t[2]=i*-a+o*u,t[3]=n*-a+s*u,t}function m(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=r[0],u=r[1];return t[0]=i*a,t[1]=n*a,t[2]=o*u,t[3]=s*u,t}function v(t,e){var r=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=r,t[2]=-r,t[3]=i,t}function _(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function y(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function g(t){return Math.hypot(t[0],t[1],t[2],t[3])}function w(t,e,r,i){return t[2]=i[2]/i[0],r[0]=i[0],r[1]=i[1],r[3]=i[3]-t[2]*r[1],[t,e,r]}function M(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function b(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function x(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function E(t,e){var r=t[0],i=t[1],n=t[2],o=t[3],s=e[0],a=e[1],u=e[2],h=e[3];return Math.abs(r-s)<=L.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-a)<=L.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(n-u)<=L.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(o-h)<=L.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))}function T(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function P(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t[3]=e[3]+r[3]*i,t}Object.defineProperty(r,"__esModule",{value:!0}),r.create=i,r.clone=n,r.copy=o,r.identity=s,r.fromValues=a,r.set=u,r.transpose=h,r.invert=l,r.adjoint=c,r.determinant=p,r.multiply=f,r.rotate=d,r.scale=m,r.fromRotation=v,r.fromScaling=_,r.str=y,r.frob=g,r.LDU=w,r.add=M,r.subtract=b,r.exactEquals=x,r.equals=E,r.multiplyScalar=T,r.multiplyScalarAndAdd=P,r.sub=r.mul=void 0;var L=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,r):{};i.get||i.set?Object.defineProperty(e,r,i):e[r]=t[r]}return e["default"]=t,e}(t("./common.js")),S=f;r.mul=S;var A=b;r.sub=A},{"./common.js":2}],5:[function(t,e,r){"use strict";function i(){var t=new P.ARRAY_TYPE(6);return P.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function n(t){var e=new P.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function o(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function s(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function a(t,e,r,i,n,o){var s=new P.ARRAY_TYPE(6);return s[0]=t,s[1]=e,s[2]=r,s[3]=i,s[4]=n,s[5]=o,s}function u(t,e,r,i,n,o,s){return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t[4]=o,t[5]=s,t}function h(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],s=e[4],a=e[5],u=r*o-i*n;return u?(u=1/u,t[0]=o*u,t[1]=-i*u,t[2]=-n*u,t[3]=r*u,t[4]=(n*a-o*s)*u,t[5]=(i*s-r*a)*u,t):null}function l(t){return t[0]*t[3]-t[1]*t[2]}function c(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],u=e[5],h=r[0],l=r[1],c=r[2],p=r[3],f=r[4],d=r[5];return t[0]=i*h+o*l,t[1]=n*h+s*l,t[2]=i*c+o*p,t[3]=n*c+s*p,t[4]=i*f+o*d+a,t[5]=n*f+s*d+u,t}function p(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],u=e[5],h=Math.sin(r),l=Math.cos(r);return t[0]=i*l+o*h,t[1]=n*l+s*h,t[2]=i*-h+o*l,t[3]=n*-h+s*l,t[4]=a,t[5]=u,t}function f(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],u=e[5],h=r[0],l=r[1];return t[0]=i*h,t[1]=n*h,t[2]=o*l,t[3]=s*l,t[4]=a,t[5]=u,t}function d(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],u=e[5],h=r[0],l=r[1];return t[0]=i,t[1]=n,t[2]=o,t[3]=s,t[4]=i*h+o*l+a,t[5]=n*h+s*l+u,t}function m(t,e){var r=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=r,t[2]=-r,t[3]=i,t[4]=0,t[5]=0,t}function v(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t}function _(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t}function y(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}function g(t){ return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)}function w(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t}function M(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t}function b(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t}function x(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t[3]=e[3]+r[3]*i,t[4]=e[4]+r[4]*i,t[5]=e[5]+r[5]*i,t}function E(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]}function T(t,e){var r=t[0],i=t[1],n=t[2],o=t[3],s=t[4],a=t[5],u=e[0],h=e[1],l=e[2],c=e[3],p=e[4],f=e[5];return Math.abs(r-u)<=P.EPSILON*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(i-h)<=P.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(n-l)<=P.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-c)<=P.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))&&Math.abs(s-p)<=P.EPSILON*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(a-f)<=P.EPSILON*Math.max(1,Math.abs(a),Math.abs(f))}Object.defineProperty(r,"__esModule",{value:!0}),r.create=i,r.clone=n,r.copy=o,r.identity=s,r.fromValues=a,r.set=u,r.invert=h,r.determinant=l,r.multiply=c,r.rotate=p,r.scale=f,r.translate=d,r.fromRotation=m,r.fromScaling=v,r.fromTranslation=_,r.str=y,r.frob=g,r.add=w,r.subtract=M,r.multiplyScalar=b,r.multiplyScalarAndAdd=x,r.exactEquals=E,r.equals=T,r.sub=r.mul=void 0;var P=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,r):{};i.get||i.set?Object.defineProperty(e,r,i):e[r]=t[r]}return e["default"]=t,e}(t("./common.js")),L=c;r.mul=L;var S=M;r.sub=S},{"./common.js":2}],6:[function(t,e,r){"use strict";function i(){var t=new I.ARRAY_TYPE(9);return I.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function n(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function o(t){var e=new I.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function s(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function a(t,e,r,i,n,o,s,a,u){var h=new I.ARRAY_TYPE(9);return h[0]=t,h[1]=e,h[2]=r,h[3]=i,h[4]=n,h[5]=o,h[6]=s,h[7]=a,h[8]=u,h}function u(t,e,r,i,n,o,s,a,u,h){return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t[4]=o,t[5]=s,t[6]=a,t[7]=u,t[8]=h,t}function h(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function l(t,e){if(t===e){var r=e[1],i=e[2],n=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=i,t[7]=n}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function c(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],s=e[4],a=e[5],u=e[6],h=e[7],l=e[8],c=l*s-a*h,p=-l*o+a*u,f=h*o-s*u,d=r*c+i*p+n*f;return d?(d=1/d,t[0]=c*d,t[1]=(-l*i+n*h)*d,t[2]=(a*i-n*s)*d,t[3]=p*d,t[4]=(l*r-n*u)*d,t[5]=(-a*r+n*o)*d,t[6]=f*d,t[7]=(-h*r+i*u)*d,t[8]=(s*r-i*o)*d,t):null}function p(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],s=e[4],a=e[5],u=e[6],h=e[7],l=e[8];return t[0]=s*l-a*h,t[1]=n*h-i*l,t[2]=i*a-n*s,t[3]=a*u-o*l,t[4]=r*l-n*u,t[5]=n*o-r*a,t[6]=o*h-s*u,t[7]=i*u-r*h,t[8]=r*s-i*o,t}function f(t){var e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],s=t[5],a=t[6],u=t[7],h=t[8];return e*(h*o-s*u)+r*(-h*n+s*a)+i*(u*n-o*a)}function d(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],u=e[5],h=e[6],l=e[7],c=e[8],p=r[0],f=r[1],d=r[2],m=r[3],v=r[4],_=r[5],y=r[6],g=r[7],w=r[8];return t[0]=p*i+f*s+d*h,t[1]=p*n+f*a+d*l,t[2]=p*o+f*u+d*c,t[3]=m*i+v*s+_*h,t[4]=m*n+v*a+_*l,t[5]=m*o+v*u+_*c,t[6]=y*i+g*s+w*h,t[7]=y*n+g*a+w*l,t[8]=y*o+g*u+w*c,t}function m(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],u=e[5],h=e[6],l=e[7],c=e[8],p=r[0],f=r[1];return t[0]=i,t[1]=n,t[2]=o,t[3]=s,t[4]=a,t[5]=u,t[6]=p*i+f*s+h,t[7]=p*n+f*a+l,t[8]=p*o+f*u+c,t}function v(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],u=e[5],h=e[6],l=e[7],c=e[8],p=Math.sin(r),f=Math.cos(r);return t[0]=f*i+p*s,t[1]=f*n+p*a,t[2]=f*o+p*u,t[3]=f*s-p*i,t[4]=f*a-p*n,t[5]=f*u-p*o,t[6]=h,t[7]=l,t[8]=c,t}function _(t,e,r){var i=r[0],n=r[1];return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=n*e[3],t[4]=n*e[4],t[5]=n*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function y(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function g(t,e){var r=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=r,t[2]=0,t[3]=-r,t[4]=i,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function w(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function M(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function b(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],s=r+r,a=i+i,u=n+n,h=r*s,l=i*s,c=i*a,p=n*s,f=n*a,d=n*u,m=o*s,v=o*a,_=o*u;return t[0]=1-c-d,t[3]=l-_,t[6]=p+v,t[1]=l+_,t[4]=1-h-d,t[7]=f-m,t[2]=p-v,t[5]=f+m,t[8]=1-h-c,t}function x(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],s=e[4],a=e[5],u=e[6],h=e[7],l=e[8],c=e[9],p=e[10],f=e[11],d=e[12],m=e[13],v=e[14],_=e[15],y=r*a-i*s,g=r*u-n*s,w=r*h-o*s,M=i*u-n*a,b=i*h-o*a,x=n*h-o*u,E=l*m-c*d,T=l*v-p*d,P=l*_-f*d,L=c*v-p*m,S=c*_-f*m,A=p*_-f*v,R=y*A-g*S+w*L+M*P-b*T+x*E;return R?(R=1/R,t[0]=(a*A-u*S+h*L)*R,t[1]=(u*P-s*A-h*T)*R,t[2]=(s*S-a*P+h*E)*R,t[3]=(n*S-i*A-o*L)*R,t[4]=(r*A-n*P+o*T)*R,t[5]=(i*P-r*S-o*E)*R,t[6]=(m*x-v*b+_*M)*R,t[7]=(v*w-d*x-_*g)*R,t[8]=(d*b-m*w+_*y)*R,t):null}function E(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function T(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function P(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}function L(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t}function S(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t}function A(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t}function R(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t[3]=e[3]+r[3]*i,t[4]=e[4]+r[4]*i,t[5]=e[5]+r[5]*i,t[6]=e[6]+r[6]*i,t[7]=e[7]+r[7]*i,t[8]=e[8]+r[8]*i,t}function C(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]}function O(t,e){var r=t[0],i=t[1],n=t[2],o=t[3],s=t[4],a=t[5],u=t[6],h=t[7],l=t[8],c=e[0],p=e[1],f=e[2],d=e[3],m=e[4],v=e[5],_=e[6],y=e[7],g=e[8];return Math.abs(r-c)<=I.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(i-p)<=I.EPSILON*Math.max(1,Math.abs(i),Math.abs(p))&&Math.abs(n-f)<=I.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(o-d)<=I.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(s-m)<=I.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(a-v)<=I.EPSILON*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(u-_)<=I.EPSILON*Math.max(1,Math.abs(u),Math.abs(_))&&Math.abs(h-y)<=I.EPSILON*Math.max(1,Math.abs(h),Math.abs(y))&&Math.abs(l-g)<=I.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))}Object.defineProperty(r,"__esModule",{value:!0}),r.create=i,r.fromMat4=n,r.clone=o,r.copy=s,r.fromValues=a,r.set=u,r.identity=h,r.transpose=l,r.invert=c,r.adjoint=p,r.determinant=f,r.multiply=d,r.translate=m,r.rotate=v,r.scale=_,r.fromTranslation=y,r.fromRotation=g,r.fromScaling=w,r.fromMat2d=M,r.fromQuat=b,r.normalFromMat4=x,r.projection=E,r.str=T,r.frob=P,r.add=L,r.subtract=S,r.multiplyScalar=A,r.multiplyScalarAndAdd=R,r.exactEquals=C,r.equals=O,r.sub=r.mul=void 0;var I=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,r):{};i.get||i.set?Object.defineProperty(e,r,i):e[r]=t[r]}return e["default"]=t,e}(t("./common.js")),F=d;r.mul=F;var z=S;r.sub=z},{"./common.js":2}],7:[function(t,e,r){"use strict";function i(){var t=new U.ARRAY_TYPE(16);return U.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function n(t){var e=new U.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function o(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function s(t,e,r,i,n,o,s,a,u,h,l,c,p,f,d,m){var v=new U.ARRAY_TYPE(16);return v[0]=t,v[1]=e,v[2]=r,v[3]=i,v[4]=n,v[5]=o,v[6]=s,v[7]=a,v[8]=u,v[9]=h,v[10]=l,v[11]=c,v[12]=p,v[13]=f,v[14]=d,v[15]=m,v}function a(t,e,r,i,n,o,s,a,u,h,l,c,p,f,d,m,v){return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t[4]=o,t[5]=s,t[6]=a,t[7]=u,t[8]=h,t[9]=l,t[10]=c,t[11]=p,t[12]=f,t[13]=d,t[14]=m,t[15]=v,t}function u(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function h(t,e){if(t===e){var r=e[1],i=e[2],n=e[3],o=e[6],s=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=o,t[11]=e[14],t[12]=n,t[13]=s,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function l(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],s=e[4],a=e[5],u=e[6],h=e[7],l=e[8],c=e[9],p=e[10],f=e[11],d=e[12],m=e[13],v=e[14],_=e[15],y=r*a-i*s,g=r*u-n*s,w=r*h-o*s,M=i*u-n*a,b=i*h-o*a,x=n*h-o*u,E=l*m-c*d,T=l*v-p*d,P=l*_-f*d,L=c*v-p*m,S=c*_-f*m,A=p*_-f*v,R=y*A-g*S+w*L+M*P-b*T+x*E;return R?(R=1/R,t[0]=(a*A-u*S+h*L)*R,t[1]=(n*S-i*A-o*L)*R,t[2]=(m*x-v*b+_*M)*R,t[3]=(p*b-c*x-f*M)*R,t[4]=(u*P-s*A-h*T)*R,t[5]=(r*A-n*P+o*T)*R,t[6]=(v*w-d*x-_*g)*R,t[7]=(l*x-p*w+f*g)*R,t[8]=(s*S-a*P+h*E)*R,t[9]=(i*P-r*S-o*E)*R,t[10]=(d*b-m*w+_*y)*R,t[11]=(c*w-l*b-f*y)*R,t[12]=(a*T-s*L-u*E)*R,t[13]=(r*L-i*T+n*E)*R,t[14]=(m*g-d*M-v*y)*R,t[15]=(l*M-c*g+p*y)*R,t):null}function c(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],s=e[4],a=e[5],u=e[6],h=e[7],l=e[8],c=e[9],p=e[10],f=e[11],d=e[12],m=e[13],v=e[14],_=e[15];return t[0]=a*(p*_-f*v)-c*(u*_-h*v)+m*(u*f-h*p),t[1]=-(i*(p*_-f*v)-c*(n*_-o*v)+m*(n*f-o*p)),t[2]=i*(u*_-h*v)-a*(n*_-o*v)+m*(n*h-o*u),t[3]=-(i*(u*f-h*p)-a*(n*f-o*p)+c*(n*h-o*u)),t[4]=-(s*(p*_-f*v)-l*(u*_-h*v)+d*(u*f-h*p)),t[5]=r*(p*_-f*v)-l*(n*_-o*v)+d*(n*f-o*p),t[6]=-(r*(u*_-h*v)-s*(n*_-o*v)+d*(n*h-o*u)),t[7]=r*(u*f-h*p)-s*(n*f-o*p)+l*(n*h-o*u),t[8]=s*(c*_-f*m)-l*(a*_-h*m)+d*(a*f-h*c),t[9]=-(r*(c*_-f*m)-l*(i*_-o*m)+d*(i*f-o*c)),t[10]=r*(a*_-h*m)-s*(i*_-o*m)+d*(i*h-o*a),t[11]=-(r*(a*f-h*c)-s*(i*f-o*c)+l*(i*h-o*a)),t[12]=-(s*(c*v-p*m)-l*(a*v-u*m)+d*(a*p-u*c)),t[13]=r*(c*v-p*m)-l*(i*v-n*m)+d*(i*p-n*c),t[14]=-(r*(a*v-u*m)-s*(i*v-n*m)+d*(i*u-n*a)),t[15]=r*(a*p-u*c)-s*(i*p-n*c)+l*(i*u-n*a),t}function p(t){var e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],s=t[5],a=t[6],u=t[7],h=t[8],l=t[9],c=t[10],p=t[11],f=t[12],d=t[13],m=t[14],v=t[15];return(e*s-r*o)*(c*v-p*m)-(e*a-i*o)*(l*v-p*d)+(e*u-n*o)*(l*m-c*d)+(r*a-i*s)*(h*v-p*f)-(r*u-n*s)*(h*m-c*f)+(i*u-n*a)*(h*d-l*f)}function f(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],u=e[5],h=e[6],l=e[7],c=e[8],p=e[9],f=e[10],d=e[11],m=e[12],v=e[13],_=e[14],y=e[15],g=r[0],w=r[1],M=r[2],b=r[3];return t[0]=g*i+w*a+M*c+b*m,t[1]=g*n+w*u+M*p+b*v,t[2]=g*o+w*h+M*f+b*_,t[3]=g*s+w*l+M*d+b*y,g=r[4],w=r[5],M=r[6],b=r[7],t[4]=g*i+w*a+M*c+b*m,t[5]=g*n+w*u+M*p+b*v,t[6]=g*o+w*h+M*f+b*_,t[7]=g*s+w*l+M*d+b*y,g=r[8],w=r[9],M=r[10],b=r[11],t[8]=g*i+w*a+M*c+b*m,t[9]=g*n+w*u+M*p+b*v,t[10]=g*o+w*h+M*f+b*_,t[11]=g*s+w*l+M*d+b*y,g=r[12],w=r[13],M=r[14],b=r[15],t[12]=g*i+w*a+M*c+b*m,t[13]=g*n+w*u+M*p+b*v,t[14]=g*o+w*h+M*f+b*_,t[15]=g*s+w*l+M*d+b*y,t}function d(t,e,r){var i,n,o,s,a,u,h,l,c,p,f,d,m=r[0],v=r[1],_=r[2];return e===t?(t[12]=e[0]*m+e[4]*v+e[8]*_+e[12],t[13]=e[1]*m+e[5]*v+e[9]*_+e[13],t[14]=e[2]*m+e[6]*v+e[10]*_+e[14],t[15]=e[3]*m+e[7]*v+e[11]*_+e[15]):(i=e[0],n=e[1],o=e[2],s=e[3],a=e[4],u=e[5],h=e[6],l=e[7],c=e[8],p=e[9],f=e[10],d=e[11],t[0]=i,t[1]=n,t[2]=o,t[3]=s,t[4]=a,t[5]=u,t[6]=h,t[7]=l,t[8]=c,t[9]=p,t[10]=f,t[11]=d,t[12]=i*m+a*v+c*_+e[12],t[13]=n*m+u*v+p*_+e[13],t[14]=o*m+h*v+f*_+e[14],t[15]=s*m+l*v+d*_+e[15]),t}function m(t,e,r){var i=r[0],n=r[1],o=r[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function v(t,e,r,i){var n,o,s,a,u,h,l,c,p,f,d,m,v,_,y,g,w,M,b,x,E,T,P,L,S=i[0],A=i[1],R=i[2],C=Math.hypot(S,A,R);return C0?(r[0]=2*(a*s+l*i+u*o-h*n)/c,r[1]=2*(u*s+l*n+h*i-a*o)/c,r[2]=2*(h*s+l*o+a*n-u*i)/c):(r[0]=2*(a*s+l*i+u*o-h*n),r[1]=2*(u*s+l*n+h*i-a*o),r[2]=2*(h*s+l*o+a*n-u*i)),P(t,e,r),t}function S(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function A(t,e){var r=e[0],i=e[1],n=e[2],o=e[4],s=e[5],a=e[6],u=e[8],h=e[9],l=e[10];return t[0]=Math.hypot(r,i,n),t[1]=Math.hypot(o,s,a),t[2]=Math.hypot(u,h,l),t}function R(t,e){var r=new U.ARRAY_TYPE(3);A(r,e);var i=1/r[0],n=1/r[1],o=1/r[2],s=e[0]*i,a=e[1]*n,u=e[2]*o,h=e[4]*i,l=e[5]*n,c=e[6]*o,p=e[8]*i,f=e[9]*n,d=e[10]*o,m=s+l+d,v=0;return m>0?(v=2*Math.sqrt(m+1),t[3]=.25*v,t[0]=(c-f)/v,t[1]=(p-u)/v,t[2]=(a-h)/v):s>l&&s>d?(v=2*Math.sqrt(1+s-l-d),t[3]=(c-f)/v,t[0]=.25*v,t[1]=(a+h)/v,t[2]=(p+u)/v):l>d?(v=2*Math.sqrt(1+l-s-d),t[3]=(p-u)/v,t[0]=(a+h)/v,t[1]=.25*v,t[2]=(c+f)/v):(v=2*Math.sqrt(1+d-s-l),t[3]=(a-h)/v,t[0]=(p+u)/v,t[1]=(c+f)/v,t[2]=.25*v),t}function C(t,e,r,i){var n=e[0],o=e[1],s=e[2],a=e[3],u=n+n,h=o+o,l=s+s,c=n*u,p=n*h,f=n*l,d=o*h,m=o*l,v=s*l,_=a*u,y=a*h,g=a*l,w=i[0],M=i[1],b=i[2];return t[0]=(1-(d+v))*w,t[1]=(p+g)*w,t[2]=(f-y)*w,t[3]=0,t[4]=(p-g)*M,t[5]=(1-(c+v))*M,t[6]=(m+_)*M,t[7]=0,t[8]=(f+y)*b,t[9]=(m-_)*b,t[10]=(1-(c+d))*b,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function O(t,e,r,i,n){var o=e[0],s=e[1],a=e[2],u=e[3],h=o+o,l=s+s,c=a+a,p=o*h,f=o*l,d=o*c,m=s*l,v=s*c,_=a*c,y=u*h,g=u*l,w=u*c,M=i[0],b=i[1],x=i[2],E=n[0],T=n[1],P=n[2],L=(1-(m+_))*M,S=(f+w)*M,A=(d-g)*M,R=(f-w)*b,C=(1-(p+_))*b,O=(v+y)*b,I=(d+g)*x,F=(v-y)*x,z=(1-(p+m))*x;return t[0]=L,t[1]=S,t[2]=A,t[3]=0,t[4]=R,t[5]=C,t[6]=O,t[7]=0,t[8]=I,t[9]=F,t[10]=z,t[11]=0,t[12]=r[0]+E-(L*E+R*T+I*P),t[13]=r[1]+T-(S*E+C*T+F*P),t[14]=r[2]+P-(A*E+O*T+z*P),t[15]=1,t}function I(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],s=r+r,a=i+i,u=n+n,h=r*s,l=i*s,c=i*a,p=n*s,f=n*a,d=n*u,m=o*s,v=o*a,_=o*u;return t[0]=1-c-d,t[1]=l+_,t[2]=p-v,t[3]=0,t[4]=l-_,t[5]=1-h-d,t[6]=f+m,t[7]=0,t[8]=p+v,t[9]=f-m,t[10]=1-h-c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function F(t,e,r,i,n,o,s){var a=1/(r-e),u=1/(n-i),h=1/(o-s);return t[0]=2*o*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*u,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(n+i)*u,t[10]=(s+o)*h,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*o*2*h,t[15]=0,t}function z(t,e,r,i,n){var o,s=1/Math.tan(e/2);return t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=n&&n!==Infinity?(o=1/(i-n),t[10]=(n+i)*o,t[14]=2*n*i*o):(t[10]=-1,t[14]=-2*i),t}function D(t,e,r,i){var n=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),s=Math.tan(e.leftDegrees*Math.PI/180),a=Math.tan(e.rightDegrees*Math.PI/180),u=2/(s+a),h=2/(n+o);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=h,t[6]=0,t[7]=0,t[8]=-(s-a)*u*.5,t[9]=(n-o)*h*.5,t[10]=i/(r-i),t[11]=-1,t[12]=0,t[13]=0,t[14]=i*r/(r-i),t[15]=0,t}function k(t,e,r,i,n,o,s){var a=1/(e-r),u=1/(i-n),h=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*h,t[11]=0,t[12]=(e+r)*a,t[13]=(n+i)*u,t[14]=(s+o)*h,t[15]=1,t}function N(t,e,r,i){var n,o,s,a,h,l,c,p,f,d,m=e[0],v=e[1],_=e[2],y=i[0],g=i[1],w=i[2],M=r[0],b=r[1],x=r[2];return Math.abs(m-M)0&&(f=1/Math.sqrt(f),l*=f,c*=f,p*=f);var d=u*p-h*c,m=h*l-a*p,v=a*c-u*l;return f=d*d+m*m+v*v,f>0&&(f=1/Math.sqrt(f),d*=f,m*=f,v*=f),t[0]=d,t[1]=m,t[2]=v,t[3]=0,t[4]=c*v-p*m,t[5]=p*d-l*v,t[6]=l*m-c*d,t[7]=0,t[8]=l,t[9]=c,t[10]=p,t[11]=0,t[12]=n,t[13]=o,t[14]=s,t[15]=1,t}function H(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function B(t){return Math.hypot(t[0],t[1],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function Y(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function q(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function W(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function V(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t[2]=e[2]+r[2]*i,t[3]=e[3]+r[3]*i,t[4]=e[4]+r[4]*i,t[5]=e[5]+r[5]*i,t[6]=e[6]+r[6]*i,t[7]=e[7]+r[7]*i,t[8]=e[8]+r[8]*i,t[9]=e[9]+r[9]*i,t[10]=e[10]+r[10]*i,t[11]=e[11]+r[11]*i,t[12]=e[12]+r[12]*i,t[13]=e[13]+r[13]*i,t[14]=e[14]+r[14]*i,t[15]=e[15]+r[15]*i,t}function X(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function G(t,e){var r=t[0],i=t[1],n=t[2],o=t[3],s=t[4],a=t[5],u=t[6],h=t[7],l=t[8],c=t[9],p=t[10],f=t[11],d=t[12],m=t[13],v=t[14],_=t[15],y=e[0],g=e[1],w=e[2],M=e[3],b=e[4],x=e[5],E=e[6],T=e[7],P=e[8],L=e[9],S=e[10],A=e[11],R=e[12],C=e[13],O=e[14],I=e[15];return Math.abs(r-y)<=U.EPSILON*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(i-g)<=U.EPSILON*Math.max(1,Math.abs(i),Math.abs(g))&&Math.abs(n-w)<=U.EPSILON*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(o-M)<=U.EPSILON*Math.max(1,Math.abs(o),Math.abs(M))&&Math.abs(s-b)<=U.EPSILON*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(a-x)<=U.EPSILON*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(u-E)<=U.EPSILON*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(h-T)<=U.EPSILON*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(l-P)<=U.EPSILON*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(c-L)<=U.EPSILON*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(p-S)<=U.EPSILON*Math.max(1,Math.abs(p),Math.abs(S))&&Math.abs(f-A)<=U.EPSILON*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(d-R)<=U.EPSILON*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(m-C)<=U.EPSILON*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(v-O)<=U.EPSILON*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(_-I)<=U.EPSILON*Math.max(1,Math.abs(_),Math.abs(I))}Object.defineProperty(r,"__esModule",{value:!0}),r.create=i,r.clone=n,r.copy=o,r.fromValues=s,r.set=a,r.identity=u,r.transpose=h,r.invert=l,r.adjoint=c,r.determinant=p,r.multiply=f,r.translate=d,r.scale=m,r.rotate=v,r.rotateX=_,r.rotateY=y,r.rotateZ=g,r.fromTranslation=w,r.fromScaling=M,r.fromRotation=b,r.fromXRotation=x,r.fromYRotation=E,r.fromZRotation=T,r.fromRotationTranslation=P,r.fromQuat2=L,r.getTranslation=S,r.getScaling=A,r.getRotation=R,r.fromRotationTranslationScale=C,r.fromRotationTranslationScaleOrigin=O,r.fromQuat=I,r.frustum=F,r.perspective=z,r.perspectiveFromFieldOfView=D,r.ortho=k,r.lookAt=N,r.targetTo=j,r.str=H,r.frob=B,r.add=Y,r.subtract=q,r.multiplyScalar=W,r.multiplyScalarAndAdd=V,r.exactEquals=X,r.equals=G,r.sub=r.mul=void 0;var U=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,r):{};i.get||i.set?Object.defineProperty(e,r,i):e[r]=t[r]}return e["default"]=t,e}(t("./common.js")),Z=f;r.mul=Z;var K=q;r.sub=K},{"./common.js":2}],8:[function(t,e,r){"use strict";function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,r):{};i.get||i.set?Object.defineProperty(e,r,i):e[r]=t[r]}return e["default"]=t,e}function n(){var t=new E.ARRAY_TYPE(4);return E.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function o(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function s(t,e,r){r*=.5;var i=Math.sin(r);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(r),t}function a(t,e){var r=2*Math.acos(e[3]),i=Math.sin(r/2);return i>E.EPSILON?(t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i):(t[0]=1,t[1]=0,t[2]=0),r}function u(t,e){var r=z(t,e);return Math.acos(2*r*r-1)}function h(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=r[0],u=r[1],h=r[2],l=r[3];return t[0]=i*l+s*a+n*h-o*u,t[1]=n*l+s*u+o*a-i*h,t[2]=o*l+s*h+i*u-n*a,t[3]=s*l-i*a-n*u-o*h,t}function l(t,e,r){r*=.5;var i=e[0],n=e[1],o=e[2],s=e[3],a=Math.sin(r),u=Math.cos(r);return t[0]=i*u+s*a,t[1]=n*u+o*a,t[2]=o*u-n*a,t[3]=s*u-i*a,t}function c(t,e,r){r*=.5;var i=e[0],n=e[1],o=e[2],s=e[3],a=Math.sin(r),u=Math.cos(r);return t[0]=i*u-o*a,t[1]=n*u+s*a,t[2]=o*u+i*a,t[3]=s*u-n*a,t}function p(t,e,r){r*=.5;var i=e[0],n=e[1],o=e[2],s=e[3],a=Math.sin(r),u=Math.cos(r);return t[0]=i*u+n*a,t[1]=n*u-i*a,t[2]=o*u+s*a,t[3]=s*u-o*a,t}function f(t,e){var r=e[0],i=e[1],n=e[2];return t[0]=r,t[1]=i,t[2]=n,t[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),t}function d(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],s=Math.sqrt(r*r+i*i+n*n),a=Math.exp(o),u=s>0?a*Math.sin(s)/s:0;return t[0]=r*u,t[1]=i*u,t[2]=n*u,t[3]=a*Math.cos(s),t}function m(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],s=Math.sqrt(r*r+i*i+n*n),a=s>0?Math.atan2(s,o)/s:0;return t[0]=r*a,t[1]=i*a,t[2]=n*a,t[3]=.5*Math.log(r*r+i*i+n*n+o*o),t}function v(t,e,r){return m(t,e),F(t,t,r),d(t,t),t}function _(t,e,r,i){var n,o,s,a,u,h=e[0],l=e[1],c=e[2],p=e[3],f=r[0],d=r[1],m=r[2],v=r[3];return o=h*f+l*d+c*m+p*v,o<0&&(o=-o,f=-f,d=-d,m=-m,v=-v),1-o>E.EPSILON?(n=Math.acos(o),s=Math.sin(n),a=Math.sin((1-i)*n)/s,u=Math.sin(i*n)/s):(a=1-i,u=i),t[0]=a*h+u*f,t[1]=a*l+u*d,t[2]=a*c+u*m,t[3]=a*p+u*v,t}function y(t){var e=E.RANDOM(),r=E.RANDOM(),i=E.RANDOM(),n=Math.sqrt(1-e),o=Math.sqrt(e);return t[0]=n*Math.sin(2*Math.PI*r),t[1]=n*Math.cos(2*Math.PI*r),t[2]=o*Math.sin(2*Math.PI*i),t[3]=o*Math.cos(2*Math.PI*i),t}function g(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],s=r*r+i*i+n*n+o*o,a=s?1/s:0;return t[0]=-r*a,t[1]=-i*a,t[2]=-n*a,t[3]=o*a,t}function w(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function M(t,e){var r,i=e[0]+e[4]+e[8];if(i>0)r=Math.sqrt(i+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var n=0;e[4]>e[0]&&(n=1),e[8]>e[3*n+n]&&(n=2);var o=(n+1)%3,s=(n+2)%3;r=Math.sqrt(e[3*n+n]-e[3*o+o]-e[3*s+s]+1),t[n]=.5*r,r=.5/r,t[3]=(e[3*o+s]-e[3*s+o])*r,t[o]=(e[3*o+n]+e[3*n+o])*r,t[s]=(e[3*s+n]+e[3*n+s])*r}return t}function b(t,e,r,i){var n=.5*Math.PI/180;e*=n,r*=n,i*=n;var o=Math.sin(e),s=Math.cos(e),a=Math.sin(r),u=Math.cos(r),h=Math.sin(i),l=Math.cos(i);return t[0]=o*u*l-s*a*h,t[1]=s*a*l+o*u*h,t[2]=s*u*h-o*a*l,t[3]=s*u*l+o*a*h,t}function x(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}Object.defineProperty(r,"__esModule",{value:!0}),r.create=n,r.identity=o,r.setAxisAngle=s,r.getAxisAngle=a,r.getAngle=u,r.multiply=h,r.rotateX=l,r.rotateY=c,r.rotateZ=p,r.calculateW=f,r.exp=d,r.ln=m,r.pow=v,r.slerp=_,r.random=y,r.invert=g,r.conjugate=w,r.fromMat3=M,r.fromEuler=b,r.str=x,r.setAxes=r.sqlerp=r.rotationTo=r.equals=r.exactEquals=r.normalize=r.sqrLen=r.squaredLength=r.len=r.length=r.lerp=r.dot=r.scale=r.mul=r.add=r.set=r.copy=r.fromValues=r.clone=void 0;var E=i(t("./common.js")),T=i(t("./mat3.js")),P=i(t("./vec3.js")),L=i(t("./vec4.js")),S=L.clone;r.clone=S;var A=L.fromValues;r.fromValues=A;var R=L.copy;r.copy=R;var C=L.set;r.set=C;var O=L.add;r.add=O;var I=h;r.mul=I;var F=L.scale;r.scale=F;var z=L.dot;r.dot=z;var D=L.lerp;r.lerp=D;var k=L.length;r.length=k;var N=k;r.len=N;var j=L.squaredLength;r.squaredLength=j;var H=j;r.sqrLen=H;var B=L.normalize;r.normalize=B;var Y=L.exactEquals;r.exactEquals=Y;var q=L.equals;r.equals=q;var W=function(){var t=P.create(),e=P.fromValues(1,0,0),r=P.fromValues(0,1,0);return function(i,n,o){var a=P.dot(n,o);return a<-.999999?(P.cross(t,e,n),P.len(t)<1e-6&&P.cross(t,r,n),P.normalize(t,t),s(i,t,Math.PI),i):a>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(P.cross(t,n,o),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+a,B(i,i))}}();r.rotationTo=W;var V=function(){var t=n(),e=n();return function(r,i,n,o,s,a){return _(t,i,s,a),_(e,n,o,a),_(r,t,e,2*a*(1-a)),r}}();r.sqlerp=V;var X=function(){var t=T.create();return function(e,r,i,n){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=n[0],t[4]=n[1],t[7]=n[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],B(e,M(e,t))}}();r.setAxes=X},{"./common.js":2,"./mat3.js":6,"./vec3.js":11,"./vec4.js":12}],9:[function(t,e,r){"use strict";function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,r):{};i.get||i.set?Object.defineProperty(e,r,i):e[r]=t[r]}return e["default"]=t,e}function n(){var t=new z.ARRAY_TYPE(8);return z.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t}function o(t){var e=new z.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function s(t,e,r,i,n,o,s,a){var u=new z.ARRAY_TYPE(8);return u[0]=t,u[1]=e,u[2]=r,u[3]=i,u[4]=n,u[5]=o,u[6]=s,u[7]=a,u}function a(t,e,r,i,n,o,s){var a=new z.ARRAY_TYPE(8);a[0]=t,a[1]=e,a[2]=r,a[3]=i;var u=.5*n,h=.5*o,l=.5*s;return a[4]=u*i+h*r-l*e,a[5]=h*i+l*t-u*r,a[6]=l*i+u*e-h*t,a[7]=-u*t-h*e-l*r,a}function u(t,e,r){var i=.5*r[0],n=.5*r[1],o=.5*r[2],s=e[0],a=e[1],u=e[2],h=e[3];return t[0]=s,t[1]=a,t[2]=u,t[3]=h,t[4]=i*h+n*u-o*a,t[5]=n*h+o*s-i*u,t[6]=o*h+i*a-n*s,t[7]=-i*s-n*a-o*u,t}function h(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t}function l(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function c(t,e){var r=D.create();k.getRotation(r,e);var i=new z.ARRAY_TYPE(3);return k.getTranslation(i,e),u(t,r,i),t}function p(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function f(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function d(t,e,r,i,n,o,s,a,u){return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t[4]=o,t[5]=s,t[6]=a,t[7]=u,t}function m(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t}function v(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t}function _(t,e){var r=e[4],i=e[5],n=e[6],o=e[7],s=-e[0],a=-e[1],u=-e[2],h=e[3];return t[0]=2*(r*h+o*s+i*u-n*a),t[1]=2*(i*h+o*a+n*s-r*u),t[2]=2*(n*h+o*u+r*a-i*s),t}function y(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=.5*r[0],u=.5*r[1],h=.5*r[2],l=e[4],c=e[5],p=e[6],f=e[7];return t[0]=i,t[1]=n,t[2]=o,t[3]=s,t[4]=s*a+n*h-o*u+l,t[5]=s*u+o*a-i*h+c,t[6]=s*h+i*u-n*a+p,t[7]=-i*a-n*u-o*h+f,t}function g(t,e,r){var i=-e[0],n=-e[1],o=-e[2],s=e[3],a=e[4],u=e[5],h=e[6],l=e[7],c=a*s+l*i+u*o-h*n,p=u*s+l*n+h*i-a*o,f=h*s+l*o+a*n-u*i,d=l*s-a*i-u*n-h*o;return D.rotateX(t,e,r),i=t[0],n=t[1],o=t[2],s=t[3],t[4]=c*s+d*i+p*o-f*n,t[5]=p*s+d*n+f*i-c*o,t[6]=f*s+d*o+c*n-p*i,t[7]=d*s-c*i-p*n-f*o,t}function w(t,e,r){var i=-e[0],n=-e[1],o=-e[2],s=e[3],a=e[4],u=e[5],h=e[6],l=e[7],c=a*s+l*i+u*o-h*n,p=u*s+l*n+h*i-a*o,f=h*s+l*o+a*n-u*i,d=l*s-a*i-u*n-h*o;return D.rotateY(t,e,r),i=t[0],n=t[1],o=t[2],s=t[3],t[4]=c*s+d*i+p*o-f*n,t[5]=p*s+d*n+f*i-c*o,t[6]=f*s+d*o+c*n-p*i,t[7]=d*s-c*i-p*n-f*o,t}function M(t,e,r){var i=-e[0],n=-e[1],o=-e[2],s=e[3],a=e[4],u=e[5],h=e[6],l=e[7],c=a*s+l*i+u*o-h*n,p=u*s+l*n+h*i-a*o,f=h*s+l*o+a*n-u*i,d=l*s-a*i-u*n-h*o;return D.rotateZ(t,e,r),i=t[0],n=t[1],o=t[2],s=t[3],t[4]=c*s+d*i+p*o-f*n,t[5]=p*s+d*n+f*i-c*o,t[6]=f*s+d*o+c*n-p*i,t[7]=d*s-c*i-p*n-f*o,t}function b(t,e,r){ var i=r[0],n=r[1],o=r[2],s=r[3],a=e[0],u=e[1],h=e[2],l=e[3];return t[0]=a*s+l*i+u*o-h*n,t[1]=u*s+l*n+h*i-a*o,t[2]=h*s+l*o+a*n-u*i,t[3]=l*s-a*i-u*n-h*o,a=e[4],u=e[5],h=e[6],l=e[7],t[4]=a*s+l*i+u*o-h*n,t[5]=u*s+l*n+h*i-a*o,t[6]=h*s+l*o+a*n-u*i,t[7]=l*s-a*i-u*n-h*o,t}function x(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3],a=r[0],u=r[1],h=r[2],l=r[3];return t[0]=i*l+s*a+n*h-o*u,t[1]=n*l+s*u+o*a-i*h,t[2]=o*l+s*h+i*u-n*a,t[3]=s*l-i*a-n*u-o*h,a=r[4],u=r[5],h=r[6],l=r[7],t[4]=i*l+s*a+n*h-o*u,t[5]=n*l+s*u+o*a-i*h,t[6]=o*l+s*h+i*u-n*a,t[7]=s*l-i*a-n*u-o*h,t}function E(t,e,r,i){if(Math.abs(i)0){r=Math.sqrt(r);var i=e[0]/r,n=e[1]/r,o=e[2]/r,s=e[3]/r,a=e[4],u=e[5],h=e[6],l=e[7],c=i*a+n*u+o*h+s*l;t[0]=i,t[1]=n,t[2]=o,t[3]=s,t[4]=(a-i*c)/r,t[5]=(u-n*c)/r,t[6]=(h-o*c)/r,t[7]=(l-s*c)/r}return t}function O(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"}function I(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]}function F(t,e){var r=t[0],i=t[1],n=t[2],o=t[3],s=t[4],a=t[5],u=t[6],h=t[7],l=e[0],c=e[1],p=e[2],f=e[3],d=e[4],m=e[5],v=e[6],_=e[7];return Math.abs(r-l)<=z.EPSILON*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(i-c)<=z.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(n-p)<=z.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(o-f)<=z.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(s-d)<=z.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))&&Math.abs(a-m)<=z.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(u-v)<=z.EPSILON*Math.max(1,Math.abs(u),Math.abs(v))&&Math.abs(h-_)<=z.EPSILON*Math.max(1,Math.abs(h),Math.abs(_))}Object.defineProperty(r,"__esModule",{value:!0}),r.create=n,r.clone=o,r.fromValues=s,r.fromRotationTranslationValues=a,r.fromRotationTranslation=u,r.fromTranslation=h,r.fromRotation=l,r.fromMat4=c,r.copy=p,r.identity=f,r.set=d,r.getDual=m,r.setDual=v,r.getTranslation=_,r.translate=y,r.rotateX=g,r.rotateY=w,r.rotateZ=M,r.rotateByQuatAppend=b,r.rotateByQuatPrepend=x,r.rotateAroundAxis=E,r.add=T,r.multiply=P,r.scale=L,r.lerp=S,r.invert=A,r.conjugate=R,r.normalize=C,r.str=O,r.exactEquals=I,r.equals=F,r.sqrLen=r.squaredLength=r.len=r.length=r.dot=r.mul=r.setReal=r.getReal=void 0;var z=i(t("./common.js")),D=i(t("./quat.js")),k=i(t("./mat4.js")),N=D.copy;r.getReal=N;var j=D.copy;r.setReal=j;var H=P;r.mul=H;var B=D.dot;r.dot=B;var Y=D.length;r.length=Y;var q=Y;r.len=q;var W=D.squaredLength;r.squaredLength=W;var V=W;r.sqrLen=V},{"./common.js":2,"./mat4.js":7,"./quat.js":8}],10:[function(t,e,r){"use strict";function i(){var t=new H.ARRAY_TYPE(2);return H.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function n(t){var e=new H.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e}function o(t,e){var r=new H.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r}function s(t,e){return t[0]=e[0],t[1]=e[1],t}function a(t,e,r){return t[0]=e,t[1]=r,t}function u(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function h(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function l(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t}function c(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t}function p(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function f(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function d(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function m(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}function v(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function _(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function y(t,e,r,i){return t[0]=e[0]+r[0]*i,t[1]=e[1]+r[1]*i,t}function g(t,e){var r=e[0]-t[0],i=e[1]-t[1];return Math.hypot(r,i)}function w(t,e){var r=e[0]-t[0],i=e[1]-t[1];return r*r+i*i}function M(t){var e=t[0],r=t[1];return Math.hypot(e,r)}function b(t){var e=t[0],r=t[1];return e*e+r*r}function x(t,e){return t[0]=-e[0],t[1]=-e[1],t}function E(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function T(t,e){var r=e[0],i=e[1],n=r*r+i*i;return n>0&&(n=1/Math.sqrt(n)),t[0]=e[0]*n,t[1]=e[1]*n,t}function P(t,e){return t[0]*e[0]+t[1]*e[1]}function L(t,e,r){var i=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=i,t}function S(t,e,r,i){var n=e[0],o=e[1];return t[0]=n+i*(r[0]-n),t[1]=o+i*(r[1]-o),t}function A(t,e){e=e||1;var r=2*H.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t}function R(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[2]*n,t[1]=r[1]*i+r[3]*n,t}function C(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[2]*n+r[4],t[1]=r[1]*i+r[3]*n+r[5],t}function O(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[3]*n+r[6],t[1]=r[1]*i+r[4]*n+r[7],t}function I(t,e,r){var i=e[0],n=e[1];return t[0]=r[0]*i+r[4]*n+r[12],t[1]=r[1]*i+r[5]*n+r[13],t}function F(t,e,r,i){var n=e[0]-r[0],o=e[1]-r[1],s=Math.sin(i),a=Math.cos(i);return t[0]=n*a-o*s+r[0],t[1]=n*s+o*a+r[1],t}function z(t,e){var r=t[0],i=t[1],n=e[0],o=e[1],s=r*r+i*i;s>0&&(s=1/Math.sqrt(s));var a=n*n+o*o;a>0&&(a=1/Math.sqrt(a));var u=(r*n+i*o)*s*a;return u>1?0:u<-1?Math.PI:Math.acos(u)}function D(t){return t[0]=0,t[1]=0,t}function k(t){return"vec2("+t[0]+", "+t[1]+")"}function N(t,e){return t[0]===e[0]&&t[1]===e[1]}function j(t,e){var r=t[0],i=t[1],n=e[0],o=e[1];return Math.abs(r-n)<=H.EPSILON*Math.max(1,Math.abs(r),Math.abs(n))&&Math.abs(i-o)<=H.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))}Object.defineProperty(r,"__esModule",{value:!0}),r.create=i,r.clone=n,r.fromValues=o,r.copy=s,r.set=a,r.add=u,r.subtract=h,r.multiply=l,r.divide=c,r.ceil=p,r.floor=f,r.min=d,r.max=m,r.round=v,r.scale=_,r.scaleAndAdd=y,r.distance=g,r.squaredDistance=w,r.length=M,r.squaredLength=b,r.negate=x,r.inverse=E,r.normalize=T,r.dot=P,r.cross=L,r.lerp=S,r.random=A,r.transformMat2=R,r.transformMat2d=C,r.transformMat3=O,r.transformMat4=I,r.rotate=F,r.angle=z,r.zero=D,r.str=k,r.exactEquals=N,r.equals=j,r.forEach=r.sqrLen=r.sqrDist=r.dist=r.div=r.mul=r.sub=r.len=void 0;var H=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,r):{};i.get||i.set?Object.defineProperty(e,r,i):e[r]=t[r]}return e["default"]=t,e}(t("./common.js")),B=M;r.len=B;var Y=h;r.sub=Y;var q=l;r.mul=q;var W=c;r.div=W;var V=g;r.dist=V;var X=w;r.sqrDist=X;var G=b;r.sqrLen=G;var U=function(){var t=i();return function(e,r,i,n,o,s){var a,u;for(r||(r=2),i||(i=0),u=n?Math.min(n*r+i,e.length):e.length,a=i;a0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function P(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function L(t,e,r){var i=e[0],n=e[1],o=e[2],s=r[0],a=r[1],u=r[2];return t[0]=n*u-o*a,t[1]=o*s-i*u,t[2]=i*a-n*s,t}function S(t,e,r,i){var n=e[0],o=e[1],s=e[2];return t[0]=n+i*(r[0]-n),t[1]=o+i*(r[1]-o),t[2]=s+i*(r[2]-s),t}function A(t,e,r,i,n,o){var s=o*o,a=s*(2*o-3)+1,u=s*(o-2)+o,h=s*(o-1),l=s*(3-2*o);return t[0]=e[0]*a+r[0]*u+i[0]*h+n[0]*l,t[1]=e[1]*a+r[1]*u+i[1]*h+n[1]*l,t[2]=e[2]*a+r[2]*u+i[2]*h+n[2]*l,t}function R(t,e,r,i,n,o){var s=1-o,a=s*s,u=o*o,h=a*s,l=3*o*a,c=3*u*s,p=u*o;return t[0]=e[0]*h+r[0]*l+i[0]*c+n[0]*p,t[1]=e[1]*h+r[1]*l+i[1]*c+n[1]*p,t[2]=e[2]*h+r[2]*l+i[2]*c+n[2]*p,t}function C(t,e){e=e||1;var r=2*q.RANDOM()*Math.PI,i=2*q.RANDOM()-1,n=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*n,t[1]=Math.sin(r)*n,t[2]=i*e,t}function O(t,e,r){var i=e[0],n=e[1],o=e[2],s=r[3]*i+r[7]*n+r[11]*o+r[15];return s=s||1,t[0]=(r[0]*i+r[4]*n+r[8]*o+r[12])/s,t[1]=(r[1]*i+r[5]*n+r[9]*o+r[13])/s,t[2]=(r[2]*i+r[6]*n+r[10]*o+r[14])/s,t}function I(t,e,r){var i=e[0],n=e[1],o=e[2];return t[0]=i*r[0]+n*r[3]+o*r[6],t[1]=i*r[1]+n*r[4]+o*r[7],t[2]=i*r[2]+n*r[5]+o*r[8],t}function F(t,e,r){var i=r[0],n=r[1],o=r[2],s=r[3],a=e[0],u=e[1],h=e[2],l=n*h-o*u,c=o*a-i*h,p=i*u-n*a,f=n*p-o*c,d=o*l-i*p,m=i*c-n*l,v=2*s;return l*=v,c*=v,p*=v,f*=2,d*=2,m*=2,t[0]=a+l+f,t[1]=u+c+d,t[2]=h+p+m,t}function z(t,e,r,i){var n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[0],o[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),o[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function D(t,e,r,i){var n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),o[1]=n[1],o[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function k(t,e,r,i){var n=[],o=[];return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],o[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),o[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),o[2]=n[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function N(t,e){var r=s(t[0],t[1],t[2]),i=s(e[0],e[1],e[2]);T(r,r),T(i,i);var n=P(r,i);return n>1?0:n<-1?Math.PI:Math.acos(n)}function j(t){return t[0]=0,t[1]=0,t[2]=0,t}function H(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function B(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function Y(t,e){var r=t[0],i=t[1],n=t[2],o=e[0],s=e[1],a=e[2];return Math.abs(r-o)<=q.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=q.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-a)<=q.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))}Object.defineProperty(r,"__esModule",{value:!0}),r.create=i,r.clone=n,r.length=o,r.fromValues=s,r.copy=a,r.set=u,r.add=h,r.subtract=l,r.multiply=c,r.divide=p,r.ceil=f,r.floor=d,r.min=m,r.max=v,r.round=_,r.scale=y,r.scaleAndAdd=g,r.distance=w,r.squaredDistance=M,r.squaredLength=b,r.negate=x,r.inverse=E,r.normalize=T,r.dot=P,r.cross=L,r.lerp=S,r.hermite=A,r.bezier=R,r.random=C,r.transformMat4=O,r.transformMat3=I,r.transformQuat=F,r.rotateX=z,r.rotateY=D,r.rotateZ=k,r.angle=N,r.zero=j,r.str=H,r.exactEquals=B,r.equals=Y,r.forEach=r.sqrLen=r.len=r.sqrDist=r.dist=r.div=r.mul=r.sub=void 0;var q=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,r):{};i.get||i.set?Object.defineProperty(e,r,i):e[r]=t[r]}return e["default"]=t,e}(t("./common.js")),W=l;r.sub=W;var V=c;r.mul=V;var X=p;r.div=X;var G=w;r.dist=G;var U=M;r.sqrDist=U;var Z=o;r.len=Z;var K=b;r.sqrLen=K;var Q=function(){var t=i();return function(e,r,i,n,o,s){var a,u;for(r||(r=3),i||(i=0),u=n?Math.min(n*r+i,e.length):e.length,a=i;a0&&(s=1/Math.sqrt(s)),t[0]=r*s,t[1]=i*s,t[2]=n*s,t[3]=o*s,t}function P(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function L(t,e,r,i){var n=r[0]*i[1]-r[1]*i[0],o=r[0]*i[2]-r[2]*i[0],s=r[0]*i[3]-r[3]*i[0],a=r[1]*i[2]-r[2]*i[1],u=r[1]*i[3]-r[3]*i[1],h=r[2]*i[3]-r[3]*i[2],l=e[0],c=e[1],p=e[2],f=e[3];return t[0]=c*h-p*u+f*a,t[1]=-l*h+p*s-f*o,t[2]=l*u-c*s+f*n,t[3]=-l*a+c*o-p*n,t}function S(t,e,r,i){var n=e[0],o=e[1],s=e[2],a=e[3];return t[0]=n+i*(r[0]-n),t[1]=o+i*(r[1]-o),t[2]=s+i*(r[2]-s),t[3]=a+i*(r[3]-a),t}function A(t,e){e=e||1;var r,i,n,o,s,a;do{r=2*D.RANDOM()-1,i=2*D.RANDOM()-1,s=r*r+i*i}while(s>=1);do{n=2*D.RANDOM()-1,o=2*D.RANDOM()-1,a=n*n+o*o}while(a>=1);var u=Math.sqrt((1-s)/a);return t[0]=e*r,t[1]=e*i,t[2]=e*n*u,t[3]=e*o*u,t}function R(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*o+r[12]*s,t[1]=r[1]*i+r[5]*n+r[9]*o+r[13]*s,t[2]=r[2]*i+r[6]*n+r[10]*o+r[14]*s,t[3]=r[3]*i+r[7]*n+r[11]*o+r[15]*s,t}function C(t,e,r){var i=e[0],n=e[1],o=e[2],s=r[0],a=r[1],u=r[2],h=r[3],l=h*i+a*o-u*n,c=h*n+u*i-s*o,p=h*o+s*n-a*i,f=-s*i-a*n-u*o;return t[0]=l*h+f*-s+c*-u-p*-a,t[1]=c*h+f*-a+p*-s-l*-u,t[2]=p*h+f*-u+l*-a-c*-s,t[3]=e[3],t}function O(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function I(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function F(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function z(t,e){var r=t[0],i=t[1],n=t[2],o=t[3],s=e[0],a=e[1],u=e[2],h=e[3];return Math.abs(r-s)<=D.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-a)<=D.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(n-u)<=D.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(o-h)<=D.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))}Object.defineProperty(r,"__esModule",{value:!0}),r.create=i,r.clone=n,r.fromValues=o,r.copy=s,r.set=a,r.add=u,r.subtract=h,r.multiply=l,r.divide=c,r.ceil=p,r.floor=f,r.min=d,r.max=m,r.round=v,r.scale=_,r.scaleAndAdd=y,r.distance=g,r.squaredDistance=w,r.length=M,r.squaredLength=b,r.negate=x,r.inverse=E,r.normalize=T,r.dot=P,r.cross=L,r.lerp=S,r.random=A,r.transformMat4=R,r.transformQuat=C,r.zero=O,r.str=I,r.exactEquals=F,r.equals=z,r.forEach=r.sqrLen=r.len=r.sqrDist=r.dist=r.div=r.mul=r.sub=void 0;var D=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,r):{};i.get||i.set?Object.defineProperty(e,r,i):e[r]=t[r]}return e["default"]=t,e}(t("./common.js")),k=h;r.sub=k;var N=l;r.mul=N;var j=c;r.div=j;var H=g;r.dist=H;var B=w;r.sqrDist=B;var Y=M;r.len=Y;var q=b;r.sqrLen=q;var W=function(){var t=i();return function(e,r,i,n,o,s){var a,u;for(r||(r=4),i||(i=0),u=n?Math.min(n*r+i,e.length):e.length,a=i;a-1}function g(t){return t.trim().split(/\s+/g)}function w(t,e,r){if(t.indexOf&&!r)return t.indexOf(e);for(var i=0;ir[e]}):i.sort()),i}function x(t,e){for(var r,i,n=e[0].toUpperCase()+e.slice(1),s=0;s1&&!r.firstMultiple?r.firstMultiple=O(e):1===n&&(r.firstMultiple=!1);var o=r.firstInput,s=r.firstMultiple,a=s?s.center:o.center,u=e.center=I(i);e.timeStamp=mt(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=k(a,u),e.distance=D(a,u),R(r,e),e.offsetDirection=z(e.deltaX,e.deltaY),e.scale=s?j(s.pointers,i):1,e.rotation=s?N(s.pointers,i):0,C(r,e);var h=t.element;_(e.srcEvent.target,h)&&(h=e.srcEvent.target),e.target=h}function R(t,e){var r=e.center,i=t.offsetDelta||{},n=t.prevDelta||{},o=t.prevInput||{};e.eventType!==bt&&o.eventType!==Et||(n=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=t.offsetDelta={x:r.x,y:r.y}),e.deltaX=n.x+(r.x-i.x),e.deltaY=n.y+(r.y-i.y)}function C(t,e){var r,i,n,s,a=t.lastInterval||e,u=e.timeStamp-a.timeStamp;if(e.eventType!=Tt&&(u>Mt||a.velocity===o)){var h=a.deltaX-e.deltaX,l=a.deltaY-e.deltaY,c=F(u,h,l);i=c.x,n=c.y,r=dt(c.x)>dt(c.y)?c.x:c.y,s=z(h,l),t.lastInterval=e}else r=a.velocity,i=a.velocityX,n=a.velocityY,s=a.direction;e.velocity=r,e.velocityX=i,e.velocityY=n,e.direction=s}function O(t){for(var e=[],r=0;r=dt(e)?t>0?Lt:St:e>0?At:Rt}function D(t,e,r){r||(r=Ft);var i=e[r[0]]-t[r[0]],n=e[r[1]]-t[r[1]];return Math.sqrt(i*i+n*n)}function k(t,e,r){r||(r=Ft);var i=e[r[0]]-t[r[0]],n=e[r[1]]-t[r[1]];return 180*Math.atan2(n,i)/Math.PI}function N(t,e){return k(e[1],e[0],zt)-k(t[1],t[0],zt)}function j(t,e){return D(e[0],e[1],zt)/D(t[0],t[1],zt)}function H(){this.evEl=kt,this.evWin=Nt,this.allow=!0,this.pressed=!1,P.apply(this,arguments)}function B(){this.evEl=Bt,this.evWin=Yt,P.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function Y(){this.evTarget=Wt,this.evWin=Vt,this.started=!1,P.apply(this,arguments)}function q(t,e){var r=M(t.touches),i=M(t.changedTouches);return e&(Et|Tt)&&(r=b(r.concat(i),"identifier",!0)),[r,i]}function W(){this.evTarget=Gt,this.targetIds={},P.apply(this,arguments)}function V(t,e){var r=M(t.touches),i=this.targetIds;if(e&(bt|xt)&&1===r.length)return i[r[0].identifier]=!0,[r,r];var n,o,s=M(t.changedTouches),a=[],u=this.target;if(o=r.filter(function(t){return _(t.target,u)}),e===bt)for(n=0;n-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){r.manager.emit(r.options.event+(e?K(i):""),t)}var r=this,i=this.state;i=ne&&e(!0)},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=32},canEmit:function(){for(var t=0;te.threshold&&n&e.direction},attrTest:function(t){return J.prototype.attrTest.call(this,t)&&(this.state&re||!(this.state&re)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=Q(t.direction);e&&this.manager.emit(this.options.event+e,t),this._super.emit.call(this,t)}}),c(et,J,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[$t]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&re)},emit:function(t){if(this._super.emit.call(this,t),1!==t.scale){var e=t.scale<1?"in":"out";this.manager.emit(this.options.event+e,t)}}}),c(rt,Z,{defaults:{event:"press",pointers:1,time:500,threshold:5},getTouchAction:function(){return[Kt]},process:function(t){var e=this.options,r=t.pointers.length===e.pointers,i=t.distancee.time;if(this._input=t,!i||!r||t.eventType&(Et|Tt)&&!n)this.reset();else if(t.eventType&bt)this.reset(),this._timer=s(function(){ this.state=oe,this.tryEmit()},e.time,this);else if(t.eventType&Et)return oe;return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===oe&&(t&&t.eventType&Et?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=mt(),this.manager.emit(this.options.event,this._input)))}}),c(it,J,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[$t]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&re)}}),c(nt,J,{defaults:{event:"swipe",threshold:10,velocity:.65,direction:Ct|Ot,pointers:1},getTouchAction:function(){return tt.prototype.getTouchAction.call(this)},attrTest:function(t){var e,r=this.options.direction;return r&(Ct|Ot)?e=t.velocity:r&Ct?e=t.velocityX:r&Ot&&(e=t.velocityY),this._super.attrTest.call(this,t)&&r&t.direction&&t.distance>this.options.threshold&&dt(e)>this.options.velocity&&t.eventType&Et},emit:function(t){var e=Q(t.direction);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),c(ot,Z,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:2,posThreshold:10},getTouchAction:function(){return[Qt]},process:function(t){var e=this.options,r=t.pointers.length===e.pointers,i=t.distance=0&&i.splice(n,1)}},i.prototype.emit=function(t,e){var r=this.__events=this.__events||{},i=r[t],n=Array.prototype.slice.call(arguments,1);if(i)for(var o=0;o=0},i.prototype.listHotspots=function(){return[].concat(this._hotspots)},i.prototype.destroyHotspot=function(t){var e=this._hotspots.indexOf(t);if(e<0)throw new Error("No such hotspot");this._hotspots.splice(e,1),t.destroy(),this.emit("hotspotsChange")},i.prototype.hide=function(){this._visible&&(this._visible=!1,this._visibilityOrRectChanged=!0,this._update())},i.prototype.show=function(){this._visible||(this._visible=!0,this._visibilityOrRectChanged=!0,this._update())},i.prototype._update=function(){var t=this._hotspotContainerWrapper,e=this._stage.width(),r=this._stage.height(),i=this._tmpRect;if(this._visibilityOrRectChanged||this._rect&&(e!==this._stageWidth||r!==this._stageHeight)){var n=this._visible&&!(this._rect&&!a());t.style.display=n?"block":"none",n&&(this._rect?(s(e,r,this._rect,i),u(t,e*i.x,r*i.y),f(t,e*i.width,r*i.height),l(t)):(u(t,0,0),p(t),c(t))),this._stageWidth=e,this._stageHeight=r,this._visibilityOrRectChanged=!1}for(var o=0;o=this._geometry.levelList.length||t<0))throw new Error("Level index out of range: "+t);this._fixedLevelIndex=t,this.emit("fixedLevelChange",this._fixedLevelIndex)}},i.prototype._selectLevel=function(){return null!=this._fixedLevelIndex?this._geometry.levelList[this._fixedLevelIndex]:this._view.selectLevel(this._geometry.selectableLevelList)},i.prototype.visibleTiles=function(t){var e=this._selectLevel();return this._geometry.visibleTiles(this._view,e,t)},i.prototype.pinLevel=function(t){for(var e=this._geometry.levelList[t],r=this._geometry.levelTiles(e),i=0;i0;)this.destroyLayer(this._layers[0])},i.prototype.switchTo=function(t,e){return this._viewer.switchScene(this,t,e)},i.prototype.lookTo=function(t,e,r){if(e=e||{},r=r||h,"object"!==l(t))throw new Error("Target view parameters must be an object");var i=function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},n=null!=e.ease?e.ease:i,o=null!=e.controlsInterrupt&&e.controlsInterrupt,s=null!=e.transitionDuration?e.transitionDuration:1e3,a=null==e.shortest||e.shortest,u=this._view,p=u.parameters(),f={};c(f,t),c(f,p),a&&u.normalizeToClosest&&u.normalizeToClosest(f,f);var d=function(){var t=!1;return function(e,r){if(r>=s&&t)return null;var i=Math.min(r/s,1);for(var o in e){var a=p[o],u=f[o];e[o]=a+n(i)*(u-a)}return t=r>=s,e}},m=this._viewer.controls().enabled();o||this._viewer.controls().disable(),this.startMovement(d,function(){m&&this._viewer.controls().enable(),r()})},i.prototype.startMovement=function(t,e){var r=this._viewer.renderLoop();this._movement&&this.stopMovement();var i=t();if("function"!=typeof i)throw new Error("Bad movement");this._movement=t,this._movementStep=i,this._movementStartTime=u(),this._movementParams={},this._movementCallback=e,r.addEventListener("beforeRender",this._updateMovementHandler),r.renderOnNextFrame()},i.prototype.stopMovement=function(){var t=this._viewer.renderLoop();this._movement&&(this._movementCallback&&this._movementCallback(),t.removeEventListener("beforeRender",this._updateMovementHandler),this._movement=null,this._movementStep=null,this._movementStartTime=null,this._movementParams=null,this._movementCallback=null)},i.prototype.movement=function(){return this._movement},i.prototype._updateMovement=function(){if(!this._movement)throw new Error("Should not call update");var t=this._viewer.renderLoop(),e=this._view,r=u()-this._movementStartTime,i=this._movementStep,n=this._movementParams;n=e.parameters(n),n=i(n,r),null==n?this.stopMovement():(e.setParameters(n),t.renderOnNextFrame())},i.prototype._updateHotspotContainer=function(){this.visible()?this._hotspotContainer.show():this._hotspotContainer.hide()},e.exports=i},{"./HotspotContainer":16,"./Layer":17,"./TextureStore":21,"./util/clearOwnProperties":91,"./util/defaults":96,"./util/noop":107,"./util/now":108,"./util/type":116,"minimal-event-emitter":14}],21:[function(t,e,r){"use strict";function i(){}function n(t,e){var r=this,n=y++;r._id=n,r._store=t,r._tile=e,r._asset=null,r._texture=null,r._changeHandler=function(){t.emit("textureInvalid",e)};var o=t.source(),s=t.stage(),a=o.loadAsset.bind(o),u=s.createTexture.bind(s),h=p(c(a),u);t.emit("textureStartLoad",e),m&&console.log("loading",n,e),r._cancel=h(s,e,function(o,s,a,u){if(r._cancel=null,o)return a&&a.destroy(),u&&u.destroy(),void(o instanceof i?(t.emit("textureCancel",e),m&&console.log("cancel",n,e)):(t.emit("textureError",e,o),m&&console.log("error",n,e)));r._texture=u,a.isDynamic()?(r._asset=a,a.addEventListener("change",r._changeHandler)):a.destroy(),t.emit("textureLoad",e),m&&console.log("load",n,e)})}function o(t,e,r){r=l(r||{},_),this._source=t,this._stage=e,this._state=v.IDLE,this._delimCount=0,this._itemMap=new s,this._visible=new a,this._previouslyVisible=new u(r.previouslyVisibleCacheSize),this._pinMap=new s,this._newVisible=new a,this._noLongerVisible=[],this._visibleAgain=[],this._evicted=[]}var s=t("./collections/Map"),a=t("./collections/Set"),u=t("./collections/LruSet"),h=t("minimal-event-emitter"),l=t("./util/defaults"),c=t("./util/retry"),p=t("./util/chain"),f=t("./util/inherits"),d=t("./util/clearOwnProperties"),m="undefined"!=typeof MARZIPANODEBUG&&MARZIPANODEBUG.textureStore,v={IDLE:0,START:1,MARK:2,END:3},_={previouslyVisibleCacheSize:512},y=0;f(i,Error),n.prototype.asset=function(){return this._asset},n.prototype.texture=function(){return this._texture},n.prototype.destroy=function(){var t=this._id,e=this._store,r=this._tile,n=this._asset,o=this._texture,s=this._cancel;if(s)return void s(new i("Texture load cancelled"));n&&(n.removeEventListener("change",this._changeHandler),n.destroy()),o&&o.destroy(),e.emit("textureUnload",r),m&&console.log("unload",t,r),d(this)},h(n),h(o),o.prototype.destroy=function(){this.clear(),d(this)},o.prototype.stage=function(){return this._stage},o.prototype.source=function(){return this._source},o.prototype.clear=function(){var t=this;t._evicted.length=0,t._itemMap.forEach(function(e){t._evicted.push(e)}),t._evicted.forEach(function(e){t._unloadTile(e)}),t._itemMap.clear(),t._visible.clear(),t._previouslyVisible.clear(),t._pinMap.clear(),t._newVisible.clear(),t._noLongerVisible.length=0,t._visibleAgain.length=0,t._evicted.length=0},o.prototype.clearNotPinned=function(){var t=this;t._evicted.length=0,t._itemMap.forEach(function(e){t._pinMap.has(e)||t._evicted.push(e)}),t._evicted.forEach(function(e){t._unloadTile(e)}),t._visible.clear(),t._previouslyVisible.clear(),t._evicted.length=0},o.prototype.startFrame=function(){if(this._state!==v.IDLE&&this._state!==v.START)throw new Error("TextureStore: startFrame called out of sequence");this._state=v.START,this._delimCount++},o.prototype.markTile=function(t){if(this._state!==v.START&&this._state!==v.MARK)throw new Error("TextureStore: markTile called out of sequence");this._state=v.MARK;var e=this._itemMap.get(t),r=e&&e.texture(),i=e&&e.asset();r&&i&&r.refresh(t,i),this._newVisible.add(t)},o.prototype.endFrame=function(){if(this._state!==v.START&&this._state!==v.MARK&&this._state!==v.END)throw new Error("TextureStore: endFrame called out of sequence");this._state=v.END,--this._delimCount||(this._update(),this._state=v.IDLE)},o.prototype._update=function(){var t=this;t._noLongerVisible.length=0,t._visible.forEach(function(e){t._newVisible.has(e)||t._noLongerVisible.push(e)}),t._visibleAgain.length=0,t._newVisible.forEach(function(e){t._previouslyVisible.has(e)&&t._visibleAgain.push(e)}),t._visibleAgain.forEach(function(e){t._previouslyVisible.remove(e)}),t._evicted.length=0,t._noLongerVisible.forEach(function(e){var r=t._itemMap.get(e);if(r&&r.texture()){var i=t._previouslyVisible.add(e);null!=i&&t._evicted.push(i)}else r&&t._unloadTile(e)}),t._evicted.forEach(function(e){t._pinMap.has(e)||t._unloadTile(e)}),t._newVisible.forEach(function(e){t._itemMap.get(e)||t._loadTile(e)});var e=t._visible;t._visible=t._newVisible,t._newVisible=e,t._newVisible.clear(),t._noLongerVisible.length=0,t._visibleAgain.length=0,t._evicted.length=0},o.prototype._loadTile=function(t){if(this._itemMap.has(t))throw new Error("TextureStore: loading texture already in cache");var e=new n(this,t);this._itemMap.set(t,e)},o.prototype._unloadTile=function(t){var e=this._itemMap.del(t);if(!e)throw new Error("TextureStore: unloading texture not in cache");e.destroy()},o.prototype.asset=function(t){var e=this._itemMap.get(t);return e?e.asset():null},o.prototype.texture=function(t){var e=this._itemMap.get(t);return e?e.texture():null},o.prototype.pin=function(t){var e=(this._pinMap.get(t)||0)+1;return this._pinMap.set(t,e),this._itemMap.has(t)||this._loadTile(t),e},o.prototype.unpin=function(t){var e=this._pinMap.get(t);if(!e)throw new Error("TextureStore: unpin when not pinned");return e--,e>0?this._pinMap.set(t,e):(this._pinMap.del(t),this._visible.has(t)||this._previouslyVisible.has(t)||this._unloadTile(t)),e},o.prototype.query=function(t){var e=this._itemMap.get(t),r=this._pinMap.get(t)||0;return{visible:this._visible.has(t),previouslyVisible:this._previouslyVisible.has(t),hasAsset:null!=e&&null!=e.asset(),hasTexture:null!=e&&null!=e.texture(),pinned:0!==r,pinCount:r}},e.exports=o},{"./collections/LruSet":30,"./collections/Map":31,"./collections/Set":32,"./util/chain":89,"./util/clearOwnProperties":91,"./util/defaults":96,"./util/inherits":104,"./util/retry":114,"minimal-event-emitter":14}],22:[function(t,e,r){"use strict";function i(){this._stack=[],this._visited=new n,this._vertices=null}var n=t("./collections/Set");i.prototype.search=function(t,e,r){var i=this._stack,n=this._visited,o=this._vertices,s=0;for(this._clear(),i.push(e);i.length>0;){var a=i.pop();if(!n.has(a)&&t.intersects(a.vertices(o))){n.add(a);for(var u=a.neighbors(),h=0;ho.length)for(t=0;t0;)this.destroyScene(this._scenes[0])},i.prototype.hasScene=function(t){return this._scenes.indexOf(t)>=0},i.prototype.listScenes=function(){return[].concat(this._scenes)},i.prototype.scene=function(){return this._currentScene},i.prototype.view=function(){var t=this._currentScene;return t?t.view():null},i.prototype.lookTo=function(t,e,r){var i=this._currentScene;i&&i.lookTo(t,e,r)},i.prototype.startMovement=function(t,e){var r=this._currentScene;r&&r.startMovement(t,e)},i.prototype.stopMovement=function(){var t=this._currentScene;t&&t.stopMovement()},i.prototype.movement=function(){var t=this._currentScene;if(t)return t.movement()},i.prototype.setIdleMovement=function(t,e){this._idleTimer.setDuration(t),this._idleMovement=e},i.prototype.breakIdleMovement=function(){this.stopMovement(),this._resetIdleTimer()},i.prototype._resetIdleTimer=function(){this._idleTimer.start()},i.prototype._triggerIdleTimer=function(){var t=this._idleMovement;t&&this.startMovement(t)};i.prototype.switchScene=function(t,e,r){function i(e){f(e,t,u)}function o(){if(s._replacedScene){s._removeSceneEventListeners(s._replacedScene),h=s._replacedScene.listLayers();for(var t=0;t1&&c[0]!=h[0]))throw new Error("Stage not in sync with viewer");for(var p=null!=e.transitionDuration?e.transitionDuration:1e3,f=null!=e.transitionUpdate?e.transitionUpdate:n,d=0;dM?Math.min(d+t*a,r):Math.max(d-t*a,0),o=_*t,hg.pitch&&(g.pitch=Math.min(h,g.pitch+o))}if(null!=l&&g.fov!==h){var b=.5*m*m/u;y=Math.abs(l-g.fov)>b?Math.min(m+t*u,i):Math.max(m-t*u,0),c=y*t,lg.fov&&(g.fov=Math.min(l,g.fov+c))}return p=w,f=v,d=_,m=y,g}}}var n=t("./util/defaults"),o={yawSpeed:.1,pitchSpeed:.1,fovSpeed:.1,yawAccel:.01,pitchAccel:.01,fovAccel:.01,targetPitch:0,targetFov:null};e.exports=i},{"./util/defaults":96}],29:[function(t,e,r){"use strict";function i(t){if(!isFinite(t)||Math.floor(t)!==t||t<0)throw new Error("LruMap: invalid capacity");this._capacity=t,this._keys=new Array(this._capacity),this._values=new Array(this._capacity),this._start=0,this._size=0}var n=t("../util/mod");i.prototype._index=function(t){return n(this._start+t,this._capacity)},i.prototype.get=function(t){for(var e=0;e=0&&(this._queue.splice(r,1),t.cb.apply(null,e))}},n.prototype._next=function(){if(!this._paused&&this._queue.length&&!this._currentTask){if(null!=this._lastFinished){var t=o()-this._lastFinished,e=this._delay-t;if(e>0)return void setTimeout(this._next.bind(this),e)}var r=this._queue.shift();this._start(r)}},e.exports=n},{"../util/now":108}],35:[function(t,e,r){"use strict";function i(t){var e=t||{};return e.colorOffset=e.colorOffset||a.create(),e.colorMatrix=e.colorMatrix||u.create(),e}function n(t,e,r){o(r,t,e.colorMatrix),a.add(r,r,e.colorOffset)}function o(t,e,r){var i=e[0],n=e[1],o=e[2],s=e[3];return t[0]=r[0]*i+r[1]*n+r[2]*o+r[3]*s,t[1]=r[4]*i+r[5]*n+r[6]*o+r[7]*s,t[2]=r[8]*i+r[9]*n+r[10]*o+r[11]*s,t[3]=r[12]*i+r[13]*n+r[14]*o+r[15]*s,t}function s(t,e){for(var r=t.width,i=t.height,o=t.data,s=0;s=0){var r=this._methods.splice(e,1)[0];r.instance.removeEventListener("parameterDynamics",r.parameterDynamicsHandler)}},i.prototype.has=function(t){return this._indexOfInstance(t)>=0},i.prototype._indexOfInstance=function(t){for(var e=0;e0&&this.emit("active"),this.emit("enabled"),this._updateComposer())},i.prototype.disable=function(){this._enabled&&(this._enabled=!1,this._activeCount>0&&this.emit("inactive"),this.emit("disabled"),this._updateComposer())},i.prototype.attach=function(t){this._attachedRenderLoop&&this.detach(),this._attachedRenderLoop=t,this._beforeRenderHandler=this._updateViewsWithControls.bind(this),this._changeHandler=t.renderOnNextFrame.bind(t),this._attachedRenderLoop.addEventListener("beforeRender",this._beforeRenderHandler),this._composer.addEventListener("change",this._changeHandler)},i.prototype.detach=function(){this._attachedRenderLoop&&(this._attachedRenderLoop.removeEventListener("beforeRender",this._beforeRenderHandler),this._composer.removeEventListener("change",this._changeHandler),this._beforeRenderHandler=null,this._changeHandler=null,this._attachedRenderLoop=null)},i.prototype.attached=function(){return null!=this._attachedRenderLoop},i.prototype._listen=function(t){var e=this._methods[t];if(!e)throw new Error("Bad method id");e.instance.addEventListener("active",e.activeHandler),e.instance.addEventListener("inactive",e.inactiveHandler)},i.prototype._unlisten=function(t){var e=this._methods[t];if(!e)throw new Error("Bad method id");e.instance.removeEventListener("active",e.activeHandler),e.instance.removeEventListener("inactive",e.inactiveHandler)},i.prototype._handleActive=function(t){var e=this._methods[t];if(!e)throw new Error("Bad method id");if(!e.enabled)throw new Error("Should not receive event from disabled control method");e.active||(e.active=!0,this._incrementActiveCount())},i.prototype._handleInactive=function(t){var e=this._methods[t];if(!e)throw new Error("Bad method id");if(!e.enabled)throw new Error("Should not receive event from disabled control method");e.active&&(e.active=!1,this._decrementActiveCount())},i.prototype._incrementActiveCount=function(){this._activeCount++,a&&this._checkActiveCount(),this._enabled&&1===this._activeCount&&this.emit("active")},i.prototype._decrementActiveCount=function(){this._activeCount--,a&&this._checkActiveCount(),this._enabled&&0===this._activeCount&&this.emit("inactive")},i.prototype._checkActiveCount=function(){var t=0;for(var e in this._methods){var r=this._methods[e];r.enabled&&r.active&&t++}if(t!=this._activeCount)throw new Error("Bad control state")},i.prototype._updateComposer=function(){var t=this._composer;for(var e in this._methods){var r=this._methods[e],i=this._enabled&&r.enabled;i&&!t.has(r.instance)&&t.add(r.instance),!i&&t.has(r.instance)&&t.remove(r.instance)}},i.prototype._updateViewsWithControls=function(){var t=this._composer.offsets();t.changing&&this._attachedRenderLoop.renderOnNextFrame(),this.updatedViews_.length=0;for(var e=this._attachedRenderLoop.stage().listLayers(),r=0;r0?Math.max(0,t-e):0}i.equals=function(t,e){return t.velocity===e.velocity&&t.friction===e.friction&&t.offset===e.offset},i.prototype.equals=function(t){return i.equals(this,t)},i.prototype.update=function(t,e){t.offset&&(this.offset=this.offset||0,this.offset+=t.offset);var r=this.offsetFromVelocity(e);r&&(this.offset=this.offset||0,this.offset+=r),this.velocity=t.velocity,this.friction=t.friction},i.prototype.reset=function(){this.velocity=null,this.friction=null,this.offset=null},i.prototype.velocityAfter=function(t){return this.velocity?this.friction?n(this.velocity,this.friction*t):this.velocity:null},i.prototype.offsetFromVelocity=function(t){t=Math.min(t,this.nullVelocityTime());var e=this.velocityAfter(t);return(this.velocity+e)/2*t},i.prototype.nullVelocityTime=function(){return null==this.velocity?0:this.velocity&&!this.friction?Infinity:Math.abs(this.velocity/this.friction)},e.exports=i},{}],41:[function(t,e,r){"use strict";function i(t,e,r,i){if(!t)throw new Error("ElementPressControlMethod: element must be defined");if(!e)throw new Error("ElementPressControlMethod: parameter must be defined");if(!r)throw new Error("ElementPressControlMethod: velocity must be defined");if(!i)throw new Error("ElementPressControlMethod: friction must be defined");this._element=t,this._pressHandler=this._handlePress.bind(this),this._releaseHandler=this._handleRelease.bind(this),t.addEventListener("mousedown",this._pressHandler),t.addEventListener("mouseup",this._releaseHandler),t.addEventListener("mouseleave",this._releaseHandler),t.addEventListener("touchstart",this._pressHandler),t.addEventListener("touchmove",this._releaseHandler),t.addEventListener("touchend",this._releaseHandler),this._parameter=e,this._velocity=r,this._friction=i,this._dynamics=new o,this._pressing=!1}var n=t("minimal-event-emitter"),o=t("./Dynamics"),s=t("../util/clearOwnProperties");n(i),i.prototype.destroy=function(){this._element.removeEventListener("mousedown",this._pressHandler),this._element.removeEventListener("mouseup",this._releaseHandler),this._element.removeEventListener("mouseleave",this._releaseHandler),this._element.removeEventListener("touchstart",this._pressHandler),this._element.removeEventListener("touchmove",this._releaseHandler),this._element.removeEventListener("touchend",this._releaseHandler),s(this)},i.prototype._handlePress=function(){this._pressing=!0,this._dynamics.velocity=this._velocity,this._dynamics.friction=0,this.emit("parameterDynamics",this._parameter,this._dynamics),this.emit("active")},i.prototype._handleRelease=function(){this._pressing&&(this._dynamics.friction=this._friction,this.emit("parameterDynamics",this._parameter,this._dynamics),this.emit("inactive")),this._pressing=!1},e.exports=i},{"../util/clearOwnProperties":91,"./Dynamics":40,"minimal-event-emitter":14}],42:[function(t,e,r){"use strict";function i(t,e){return t[h]||(t[h]=u++),e+t[h]}function n(){this._managers={},this._refCount={}}function o(t,e,r,i){this._manager=e,this._element=r,this._type=i,this._hammerGestures=t,this._eventHandlers=[]}var s=t("hammerjs"),a=t("bowser"),u=1,h="MarzipanoHammerElementId";n.prototype.get=function(t,e){var r=i(t,e);return this._managers[r]||(this._managers[r]=this._createManager(t,e),this._refCount[r]=0),this._refCount[r]++,new o(this,this._managers[r],t,e)},n.prototype._createManager=function(t,e){var r=new s.Manager(t);return"mouse"===e?r.add(new s.Pan({direction:s.DIRECTION_ALL,threshold:0})):"touch"!==e&&"pen"!==e&&"kinect"!==e||(r.add(new s.Pan({direction:s.DIRECTION_ALL,threshold:20,pointers:1})),a.msie&&parseFloat(a.version)<10||r.add(new s.Pinch)),r},n.prototype._releaseHandle=function(t,e){var r=i(t,e);this._refCount[r]&&(--this._refCount[r]||(this._managers[r].destroy(),delete this._managers[r],delete this._refCount[r]))},o.prototype.on=function(t,e){var r=this._type,i=function(t){r===t.pointerType&&e(t)};this._eventHandlers.push({events:t,handler:i}),this._manager.on(t,i)},o.prototype.release=function(){for(var t=0;t=0&&t.enableMethod(f)}for(var m in c){var v=c[m];t.addMethodGroup(m,v)}return i}var n=t("../util/defaults"),o=t("./Drag"),s=t("./Qtvr"),a=t("./ScrollZoom"),u=t("./PinchZoom"),h=t("./Key"),l={mouseViewMode:"drag"};e.exports=i},{"../util/defaults":96,"./Drag":39,"./Key":43,"./PinchZoom":44,"./Qtvr":45,"./ScrollZoom":46}],50:[function(t,e,r){"use strict";function i(t,e,r,i,o){var s=Math.sqrt(Math.pow(e,2)+Math.pow(r,2));t=Math.max(t,s/i),n(e,r,t,o),o[0]=Math.abs(o[0]),o[1]=Math.abs(o[1])}function n(t,e,r,i){var n=Math.atan(e/t);i[0]=r*Math.cos(n),i[1]=r*Math.sin(n)}e.exports={maxFriction:i,changeVectorNorm:n}},{}],51:[function(t,e,r){"use strict";function i(t,e,r,i){e&&_.rotateZ(t,t,b,e),r&&_.rotateX(t,t,b,r),i&&_.rotateY(t,t,b,i)}function n(t,e,r,i,n){this.face=t,this.x=e,this.y=r,this.z=i,this._geometry=n,this._level=n.levelList[i]}function o(t){if(this.constructor.super_.call(this,t),this._size=t.size,this._tileSize=t.tileSize,this._size%this._tileSize!=0)throw new Error("Level size is not multiple of tile size: "+this._size+" "+this._tileSize)}function s(t){if("array"!==v(t))throw new Error("Level list must be an array");this.levelList=p(t,o),this.selectableLevelList=f(this.levelList);for(var e=1;e=c||w<0||w>=p){var E=this.centerX(),T=this.centerY();g<0?(_.set(o,-.5,T,-.5),x=S[s][0]):g>=c?(_.set(o,.5,T,-.5),x=S[s][1]):w<0?(_.set(o,E,.5,-.5),x=S[s][2]):w>=p&&(_.set(o,E,-.5,-.5),x=S[s][3]);var P;P=M[s],i(o,0,P.x,P.y),P=M[x],i(o,0,-P.x,-P.y),g=d(Math.floor((.5+o[0])*c),0,c-1),w=d(Math.floor((.5-o[1])*p),0,p-1)}f.push(new n(x,g,w,b,t))}return e.set(this,f),f},n.prototype.hash=function(){return u(w.indexOf(this.face),this.z,this.y,this.x)},n.prototype.equals=function(t){return this.geometry===t.geometry&&this.face===t.face&&this.z===t.z&&this.y===t.y&&this.x===t.x},n.prototype.cmp=function(t){return m(this.z,t.z)||m(w.indexOf(this.face),w.indexOf(t.face))||m(this.y,t.y)||m(this.x,t.x)},n.prototype.str=function(){return"CubeTile("+tile.face+", "+tile.x+", "+tile.y+", "+tile.z+")"},a(o,c),o.prototype.width=function(){return this._size},o.prototype.height=function(){return this._size},o.prototype.tileWidth=function(){return this._tileSize},o.prototype.tileHeight=function(){return this._tileSize},o.prototype._validateWithParentLevel=function(t){var e=this.width(),r=this.height(),i=this.tileWidth(),n=this.tileHeight(),o=this.numHorizontalTiles(),s=this.numVerticalTiles(),a=t.width(),u=t.height(),h=t.tileWidth(),l=t.tileHeight(),c=t.numHorizontalTiles(),p=t.numVerticalTiles();if(e%a!=0)throw new Error("Level width must be multiple of parent level: "+e+" vs. "+a);if(r%u!=0)throw new Error("Level height must be multiple of parent level: "+r+" vs. "+u);if(o%c!=0)throw new Error("Number of horizontal tiles must be multiple of parent level: "+o+" ("+e+"/"+i+") vs. "+c+" ("+a+"/"+h+")");if(s%p!=0)throw new Error("Number of vertical tiles must be multiple of parent level: "+s+" ("+r+"/"+n+") vs. "+p+" ("+u+"/"+l+")")},s.prototype.maxTileSize=function(){for(var t=0,e=0;e=0);)c=h.nextSibling,f.removeChild(h),h=c,o=d[++r];if(a=v.get(s),!(u=a?a._canvas:null))throw new Error("Rendering tile with missing texture");if(o&&0===o.cmp(s)){if(u!=h)throw new Error("DOM not in sync with tile list");h=h.nextSibling,o=d[++r]}else f.insertBefore(u,h);l(u,this.calculateTransform(s,a,_)),p&&u.setAttribute("data-tile",s.str())}for(;h;)c=h.nextSibling,f.removeChild(h),h=c;if(f.children.length!==m.length)throw new Error("DOM not in sync with tile list");var y=this._oldTileList ;this._oldTileList=this._newTileList,this._newTileList=y},e.exports=n},{"../collections/Map":31,"../util/clearOwnProperties":91,"../util/decimal":95,"../util/dom":100}],60:[function(t,e,r){"use strict";function i(t,e){this.constructor.super_.call(this,t,e,n)}var n=t("../geometries/Cube").Tile,o=t("./CssBase"),s=t("../util/decimal");t("../util/inherits")(i,o),i.prototype.calculateTransform=function(t,e,r){var i=this._browserQuirks.padSize,n=this._browserQuirks.reverseLevelDepth,o=this._browserQuirks.perspectiveNudge,a="",u=n?256-t.z:t.levelWidth(),h=r.size(),l=h.width,c=h.height;a+="translate3d("+s(l/2)+"px, "+s(c/2)+"px, 0px) ";var p=.5*c/Math.tan(r.fov()/2),f=p+o;a+="perspective("+s(p)+"px) translateZ("+s(f)+"px) ";var d=-r.roll(),m=-r.pitch(),v=r.yaw();a+="rotateZ("+s(d)+"rad) rotateX("+s(m)+"rad) rotateY("+s(v)+"rad) ";var _=-t.rotX(),y=t.rotY();a+="rotateX("+s(_)+"rad) rotateY("+s(y)+"rad) ";var g=t.centerX()-t.scaleX()/2,w=-(t.centerY()+t.scaleY()/2),M=g*u,b=w*u,x=-u/2;if(a+="translate3d("+s(M)+"px, "+s(b)+"px, "+s(x)+"px) ",n){var E=u*t.scaleX()/t.width(),T=u*t.scaleY()/t.height();a+="scale("+s(E)+", "+s(T)+") "}var P=t.padLeft()?i:0,L=t.padTop()?i:0;return 0===P&&0===L||(a+="translate3d("+s(-P)+"px, "+s(-L)+"px, 0) "),a},e.exports=i},{"../geometries/Cube":51,"../util/decimal":95,"../util/inherits":104,"./CssBase":59}],61:[function(t,e,r){"use strict";function i(t,e){this.constructor.super_.call(this,t,e,n)}var n=t("../geometries/Flat").Tile,o=t("./CssBase"),s=t("../util/decimal");t("../util/inherits")(i,o),i.prototype.calculateTransform=function(t,e,r){var i=this._browserQuirks.padSize,n="",o=r.width(),a=r.height();n+="translateX("+s(o/2)+"px) translateY("+s(a/2)+"px) ";var u=o/r._zoomX(),h=a/r._zoomY(),l=t.centerX()-t.scaleX()/2+.5,c=.5-t.centerY()-t.scaleY()/2,p=l*u,f=c*h;n+="translateX("+s(p)+"px) translateY("+s(f)+"px) ";var d=-r.x()*u,m=-r.y()*h;n+="translateX("+s(d)+"px) translateY("+s(m)+"px) ";var v=t.padLeft()?i:0,_=t.padTop()?i:0;0===v&&0===_||(n+="translateX("+s(-v)+"px) translateY("+s(-_)+"px) ");var y=u/t.levelWidth(),g=h/t.levelHeight();return n+="scale("+s(y)+", "+s(g)+") "},e.exports=i},{"../geometries/Flat":53,"../util/decimal":95,"../util/inherits":104,"./CssBase":59}],62:[function(t,e,r){"use strict";function i(t,e){return t.cmp(e)}function n(t,e,r,i){this._flashElement=t,this._layerId=e,this._quirks=r,this._tileList=[],this._textureMap=new o,this._layerCreated=!1}var o=t("../collections/Map"),s=t("../util/clearOwnProperties");n.prototype.destroy=function(){this._layerCreated&&this._flashElement.destroyLayer(this._layerId),s(this)},n.prototype.startLayer=function(t,e){this._flashElement.isReady&&this._flashElement.isReady()&&(this._layerCreated||(this._flashElement.createLayer(this._layerId),this._layerCreated=!0),this._tileList.length=0,this._textureMap.clear())},n.prototype.renderTile=function(t,e){this._tileList.push(t),this._textureMap.set(t,e)},n.prototype.endLayer=function(t,e){if(this._flashElement.isReady&&this._flashElement.isReady()){this._tileList.sort(i),this._renderOnFlash(t,e)}},e.exports=n},{"../collections/Map":31,"../util/clearOwnProperties":91}],63:[function(t,e,r){"use strict";function i(t,e,r){this.constructor.super_.call(this,t,e,r,o),this._flashTileList=[]}var n=t("./FlashBase"),o=t("../geometries/Cube").Tile,s=t("../util/inherits"),a=t("../util/radToDeg");s(i,n),i.prototype._renderOnFlash=function(t,e){var r=this._flashElement,i=this._layerId,n=this._quirks.padSize,o=this._tileList,s=this._textureMap,u=this._flashTileList;u.length=0;for(var h=0;h',s="";s+='',s+='',s+='',s+='',o+=s,o+="";var a=document.createElement("div");a.innerHTML=o;var u=a.firstChild;f(u),d(u),i.appendChild(u);var h=document.createElement("div");return f(h),d(h),m(h),i.appendChild(h),{root:i,flash:u,blocking:h}}function s(t,e,r){var i=r.element(),n=e.width(),o=e.height(),s=M.padSize,a=e.padTop()?s:0,u=e.padBottom()?s:0,h=e.padLeft()?s:0,l=e.padRight()?s:0,c=t._flashElement.createTexture(i,n,o,a,u,h,l);this._stage=t,this._textureId=c}var a=t("./Stage"),u=t("../loaders/FlashImage"),h=t("../support/Flash"),l=t("../collections/WorkQueue"),c=t("../util/inherits"),p=t("../util/defer"),f=t("../util/dom").setAbsolute,d=t("../util/dom").setFullSize,m=t("../util/dom").setBlocking,v=t("../util/clearOwnProperties"),_="transparent",y=function(){var t=document.currentScript;if(!t){var e=document.getElementsByTagName("script");t=e.length?e[e.length-1]:null}if(!t)return null;var r=t.src,i=r.lastIndexOf("/");return(r=i>=0?r.slice(0,i+1):"")+"marzipano.swf"}(),g="MarzipanoFlashCallbackMap";g in window||(window[g]={__next:0});var w=["imageLoaded"],M={padSize:3};c(n,a),n.prototype.destroy=function(){window[g][this._flashStageId]=null,null!=this._checkReadyTimer&&clearInterval(this._checkReadyTimer),this.constructor.super_.prototype.destroy.call(this)},n.supported=function(){return h()},n.prototype.domElement=function(){return this._domElement},n.prototype.flashElement=function(){return this._flashElement},n.prototype.setSizeForType=function(){},n.prototype.loadImage=function(t,e,r){var i=this._loader.loadImage.bind(this._loader,t,e);return this._loadImageQueue.push(i,r)},n.prototype.validateLayer=function(t){},n.prototype.addFlashCallbackListener=function(t,e){this._callbackListeners[t]=this._callbackListeners[t]||[],this._callbackListeners[t].push(e)},n.prototype.removeFlashCallbackListener=function(t,e){var r=this._callbackListeners[t]||[],i=r.indexOf(e);i>=0&&r.splice(i,1)},n.prototype._callListeners=function(t){var e=this;return function(){for(var r=e._callbackListeners[t]||[],i=0;i100)throw new Error("FlashStage: Snapshot quality needs to be a number between 0 and 100");return this._flashElement.takeSnapshot(e)},n.type=n.prototype.type="flash",s.prototype.refresh=function(t,e){},s.prototype.destroy=function(){this._stage._flashElement.destroyTexture(this._textureId),v(this)},n.TextureClass=n.prototype.TextureClass=s,e.exports=n},{"../collections/WorkQueue":34,"../loaders/FlashImage":57,"../support/Flash":83,"../util/clearOwnProperties":91,"../util/defer":97,"../util/dom":100,"../util/inherits":104,"./Stage":80}],79:[function(t,e,r){"use strict";function i(){this._renderers={}}i.prototype.set=function(t,e,r){this._renderers[t]||(this._renderers[t]={}),this._renderers[t][e]=r},i.prototype.get=function(t,e){return this._renderers[t]&&this._renderers[t][e]||null},e.exports=i},{}],80:[function(t,e,r){"use strict";function i(t,e){return t.cmp(e)}function n(t,e){return-t.cmp(e)}function o(t){this._progressive=!(!t||!t.progressive),this._layers=[],this._renderers=[],this._tilesToLoad=[],this._tilesToRender=[],this._tmpVisible=[],this._tmpChildren=[],this._width=0,this._height=0,this._tmpRect={},this._tmpSize={},this._createTextureWorkQueue=new a,this._emitRenderInvalid=this._emitRenderInvalid.bind(this),this._rendererRegistry=new p}var s=t("minimal-event-emitter"),a=t("../collections/WorkQueue"),u=t("../util/calcRect"),h=t("../util/async"),l=t("../util/cancelize"),c=t("../util/clearOwnProperties"),p=t("./RendererRegistry");s(o),o.prototype.destroy=function(){this.removeAllLayers(),c(this)},o.prototype.registerRenderer=function(t,e,r){return this._rendererRegistry.set(t,e,r)},o.prototype.domElement=function(){throw new Error("Stage implementation must override domElement")},o.prototype.width=function(){return this._width},o.prototype.height=function(){return this._height},o.prototype.size=function(t){return t=t||{},t.width=this._width,t.height=this._height,t},o.prototype.setSize=function(t){this._width=t.width,this._height=t.height,this.setSizeForType(),this.emit("resize"),this._emitRenderInvalid()},o.prototype.setSizeForType=function(t){throw new Error("Stage implementation must override setSizeForType")},o.prototype.loadImage=function(){throw new Error("Stage implementation must override loadImage")},o.prototype._emitRenderInvalid=function(){this.emit("renderInvalid")},o.prototype.validateLayer=function(t){throw new Error("Stage implementation must override validateLayer")},o.prototype.listLayers=function(){return[].concat(this._layers)},o.prototype.hasLayer=function(t){return this._layers.indexOf(t)>=0},o.prototype.addLayer=function(t,e){if(this._layers.indexOf(t)>=0)throw new Error("Layer already in stage");if(null==e&&(e=this._layers.length),e<0||e>this._layers.length)throw new Error("Invalid layer position");this.validateLayer(t);var r=t.geometry().type,i=t.view().type,n=this._rendererRegistry.get(r,i);if(!n)throw new Error("No "+this.type+" renderer avaiable for "+r+" geometry and "+i+" view");var o=this.createRenderer(n);this._layers.splice(e,0,t),this._renderers.splice(e,0,o),t.addEventListener("viewChange",this._emitRenderInvalid),t.addEventListener("effectsChange",this._emitRenderInvalid),t.addEventListener("fixedLevelChange",this._emitRenderInvalid),t.addEventListener("textureStoreChange",this._emitRenderInvalid),this._emitRenderInvalid()},o.prototype.moveLayer=function(t,e){var r=this._layers.indexOf(t);if(r<0)throw new Error("No such layer in stage");if(e<0||e>=this._layers.length)throw new Error("Invalid layer position");t=this._layers.splice(r,1)[0];var i=this._renderers.splice(r,1)[0];this._layers.splice(e,0,t),this._renderers.splice(e,0,i),this._emitRenderInvalid()},o.prototype.removeLayer=function(t){var e=this._layers.indexOf(t);if(e<0)throw new Error("No such layer in stage");var r=this._layers.splice(e,1)[0],i=this._renderers.splice(e,1)[0];this.destroyRenderer(i),r.removeEventListener("viewChange",this._emitRenderInvalid),r.removeEventListener("effectsChange",this._emitRenderInvalid),r.removeEventListener("fixedLevelChange",this._emitRenderInvalid),r.removeEventListener("textureStoreChange",this._emitRenderInvalid),this._emitRenderInvalid()},o.prototype.removeAllLayers=function(){for(;this._layers.length>0;)this.removeLayer(this._layers[0])},o.prototype.startFrame=function(){throw new Error("Stage implementation must override startFrame")},o.prototype.endFrame=function(){throw new Error("Stage implementation must override endFrame")},o.prototype.render=function(){var t,e,r,i=this._tilesToLoad,n=this._tilesToRender,o=!0,s=this._width,a=this._height,h=this._tmpRect,l=this._tmpSize;if(!(s<=0||a<=0)){for(this.startFrame(),t=0;tr)throw new Error("Layer has level with tile size larger than maximum texture size ("+e+" vs. "+r+")")},n.prototype.createRenderer=function(t){for(var e=this._rendererInstances,r=0;r=0&&e.splice(r,1)}},n.prototype.startFrame=function(){var t=this._gl;if(!t)throw new Error("Bad WebGL context - maybe context was lost?");t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),t.enable(t.DEPTH_TEST),t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA)},n.prototype.endFrame=function(){},n.prototype.takeSnapshot=function(t){"object"==typeof t&&null!=t||(t={});var e=t.quality;if(void 0===e&&(e=75),"number"!=typeof e||e<0||e>100)throw new Error("WebGLStage: Snapshot quality needs to be a number between 0 and 100");return this.render(),this._domElement.toDataURL("image/jpeg",e/100)},n.type=n.prototype.type="webgl",o.prototype.refresh=function(t,e){var r,i=this._gl,n=this._stage,o=e.timestamp();if(o!==this._timestamp){var s=e.element(),a=e.width(),u=e.height();if(a!==this._width||u!==this._height){var h=n.maxTextureSize();if(a>h)throw new Error("Texture width larger than max size ("+a+" vs. "+h+")");if(u>h)throw new Error("Texture height larger than max size ("+u+" vs. "+h+")");this._texture&&i.deleteTexture(r),r=this._texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,r),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,s)}else r=this._texture,i.bindTexture(i.TEXTURE_2D,r),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),s instanceof HTMLVideoElement&&_.videoUseTexImage2D?i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,s):i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,s);n._generateMipmaps&&p(a)&&p(u)?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR_MIPMAP_LINEAR),i.generateMipmap(i.TEXTURE_2D)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR)),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.bindTexture(i.TEXTURE_2D,null),this._timestamp=o,this._width=a,this._height=u}},o.prototype.destroy=function(){this._texture&&this._gl.deleteTexture(this._texture),m(this)},n.TextureClass=n.prototype.TextureClass=o,e.exports=n},{"../loaders/HtmlImage":58,"../support/WebGl":84,"../util/clearOwnProperties":91,"../util/dom":100,"../util/inherits":104,"../util/ispot":105,"../util/pixelRatio":110,"./Stage":80,bowser:1}],82:[function(t,e,r){"use strict";function i(){var t=s("perspective"),e=document.createElement("div"),r="undefined"!=typeof e.style[t];if(r&&"WebkitPerspective"===t){var i="__marzipano_test_css3d_support__",n=document.createElement("style");n.textContent="@media(-webkit-transform-3d){#"+i+"{height: 3px;})",document.getElementsByTagName("head")[0].appendChild(n),e.id=i,document.body.appendChild(e),r=e.offsetHeight>0,n.parentNode.removeChild(n),e.parentNode.removeChild(e)}return r}function n(){return o!==undefined?o:o=i()}var o,s=t("../util/dom").prefixProperty;e.exports=n},{"../util/dom":100}],83:[function(t,e,r){"use strict";function i(){var t=null,e=navigator.plugins,r=navigator.mimeTypes,i=null;if(e&&e["Shockwave Flash"]&&r&&r["application/x-shockwave-flash"]&&r["application/x-shockwave-flash"].enabledPlugin)i=e["Shockwave Flash"].description,i=i.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),t=[0,0,0],t[0]=parseInt(i.replace(/^(.*)\..*$/,"$1"),10),t[1]=parseInt(i.replace(/^.*\.(.*)\s.*$/,"$1"),10),t[2]=/[a-zA-Z]/.test(i)?parseInt(i.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0;else if(window.ActiveXObject)try{var n=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");n&&(i=n.GetVariable("$version"))&&(i=i.split(" ")[1].split(","),t=[parseInt(i[0],10),parseInt(i[1],10),parseInt(i[2],10)])}catch(o){}return t}function n(){var t=i();return t&&(t[0]>=11||10===t[0]&&t[1]>=1)}function o(){return s!==undefined?s:s=n()}var s;e.exports=o},{}],84:[function(t,e,r){"use strict";function i(){var t=document.createElement("canvas");return!(!t.getContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}function n(){return o!==undefined?o:o=i()}var o;e.exports=n},{}],85:[function(t,e,r){"use strict";function i(){var t=document.createElement("a").style;t.cssText="pointer-events:auto";var e="auto"===t.pointerEvents,r=s.msie&&parseFloat(s.version)<11;return e&&!r}function n(){return o!==undefined?o:o=i()}var o,s=t("bowser");e.exports=n},{bowser:1}],86:[function(t,e,r){"use strict";function i(t){return function(e){var r,i;try{i=t()}catch(n){r=n}finally{r?e(r):e(null,i)}}}e.exports=i},{}],87:[function(t,e,r){"use strict";function i(t,e,r,i){i=i||{};var n;n=null!=r&&null!=r.absoluteWidth?r.absoluteWidth/t:null!=r&&null!=r.relativeWidth?r.relativeWidth:1;var o;o=r&&null!=r.absoluteHeight?r.absoluteHeight/e:null!=r&&null!=r.relativeHeight?r.relativeHeight:1;var s;s=null!=r&&null!=r.absoluteX?r.absoluteX/t:null!=r&&null!=r.relativeX?r.relativeX:0;var a;return a=null!=r&&null!=r.absoluteY?r.absoluteY/e:null!=r&&null!=r.relativeY?r.relativeY:0,i.x=s,i.y=a,i.width=n,i.height=o,i}e.exports=i},{}],88:[function(t,e,r){"use strict";function i(t){return function(){function e(){i.apply(null,arguments)}if(!arguments.length)throw new Error("cancelized: expected at least one argument");var r=Array.prototype.slice.call(arguments,0),i=r[r.length-1]=n(r[r.length-1]);return t.apply(null,r),e}}var n=t("./once");e.exports=i},{"./once":109}],89:[function(t,e,r){"use strict";function i(){var t=Array.prototype.slice.call(arguments,0);return function(){function e(){if(arguments[0])return o=s=null,void u.apply(null,arguments);if(!i.length)return o=s=null,void u.apply(null,arguments);o=i.shift();var t=o,r=Array.prototype.slice.call(arguments,1);r.push(e);var n=o.apply(null,r);if(t===o){if("function"!=typeof n)throw new Error("chain: chaining on non-cancellable function");s=n}}function r(){s&&s.apply(null,arguments)}var i=t.slice(0),o=null,s=null,a=arguments.length?Array.prototype.slice.call(arguments,0,arguments.length-1):[],u=arguments.length?arguments[arguments.length-1]:n;return a.unshift(null),e.apply(null,a),r}}var n=t("./noop");e.exports=i},{"./noop":107}],90:[function(t,e,r){"use strict";function i(t,e,r){return Math.min(Math.max(t,e),r)}e.exports=i},{}],91:[function(t,e,r){"use strict";function i(t){for(var e in t)t.hasOwnProperty(e)&&(t[e]=undefined)}e.exports=i},{}],92:[function(t,e,r){"use strict";function i(t,e){return te?1:0}e.exports=i},{}],93:[function(t,e,r){"use strict";function i(){var t=arguments;return function(e){for(var r=e,i=0;i0?t.apply(null,e):t()}setTimeout(r,0)}e.exports=i},{}],98:[function(t,e,r){"use strict";function i(t){return t*Math.PI/180}e.exports=i},{}],99:[function(t,e,r){"use strict";function i(t,e){function r(){null!=n&&(n=null,e(null))}function i(){null!=n&&(clearTimeout(n),n=null,e.apply(null,arguments))}var n=null;return n=setTimeout(r,t),i}e.exports=i},{}],100:[function(t,e,r){"use strict";function i(t){for(var e=document.documentElement.style,r=["Moz","Webkit","Khtml","O","ms"],i=0;i>6}return t+=t<<3,t^=t>>11,t+=t<<15,t>=0?t:-t}e.exports=i},{}],104:[function(t,e,r){"use strict";function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}e.exports=i},{}],105:[function(t,e,r){"use strict";function i(t){return 0==(t&t-1)}e.exports=i},{}],106:[function(t,e,r){"use strict";function i(t,e){return(+t%(e=+e)+e)%e}e.exports=i},{}],107:[function(t,e,r){"use strict";function i(){}e.exports=i},{}],108:[function(t,e,r){"use strict";e.exports=function(){return"undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return Date.now()}}()},{}],109:[function(t,e,r){"use strict";function i(t){var e,r=!1;return function(){return r||(r=!0,e=t.apply(null,arguments)),e}}e.exports=i},{}],110:[function(t,e,r){"use strict";function i(){if("undefined"!=typeof window){if(window.devicePixelRatio)return window.devicePixelRatio;var t=window.screen;if(t&&t.deviceXDPI&&t.logicalXDPI)return t.deviceXDPI/t.logicalXDPI;if(t&&t.systemXDPI&&t.logicalXDPI)return t.systemXDPI/t.logicalXDPI}return n}var n=1;e.exports=i},{}],111:[function(t,e,r){"use strict";function i(t,e,r,i){if(i=i||"",n()){var u="translateX("+a(e)+"px) translateY("+a(r)+"px) translateZ(0) "+i;o(t,u)}else s(t,e,r)}var n=t("../support/Css"),o=t("./dom").setTransform,s=t("./dom").setPixelPosition,a=t("./decimal");e.exports=i},{"../support/Css":82,"./decimal":95,"./dom":100}],112:[function(t,e,r){"use strict";function i(t){return 180*t/Math.PI}e.exports=i},{}],113:[function(t,e,r){"use strict";function i(t){return"number"==typeof t&&isFinite(t)}e.exports=i},{}],114:[function(t,e,r){"use strict";function i(t){return function(){function e(){!arguments[0]||s?i.apply(null,arguments):o=t.apply(null,r)}var r=arguments.length?Array.prototype.slice.call(arguments,0,arguments.length-1):[],i=arguments.length?arguments[arguments.length-1]:n,o=null,s=!1;return r.push(e),e(!0),function(){s=!0,o.apply(null,arguments)}}}var n=t("./noop");e.exports=i},{"./noop":107}],115:[function(t,e,r){"use strict";function i(t,e,r){function i(){if(!o){var a=(n()-s)/t;a<1?(e(a),requestAnimationFrame(i)):(e(1),r())}}var o=!1,s=n();return e(0),requestAnimationFrame(i),function(){o=!0,r.apply(null,arguments)}}var n=t("./now");e.exports=i},{"./now":108}],116:[function(t,e,r){"use strict";function i(t){var e=typeof t;if("object"===e){if(null===t)return"null";if("[object Array]"===Object.prototype.toString.call(t))return"array";if("[object RegExp]"===Object.prototype.toString.call(t))return"regexp"}return e}e.exports=i},{}],117:[function(t,e,r){"use strict";function i(t,e){if(!t||null==t.mediaAspectRatio)throw new Error("mediaAspectRatio must be defined");this._x=t&&null!=t.x?t.x:f,this._y=t&&null!=t.y?t.y:d,this._zoom=t&&null!=t.zoom?t.zoom:m,this._mediaAspectRatio=t.mediaAspectRatio,this._width=t&&null!=t.width?t.width:c,this._height=t&&null!=t.height?t.height:p,this._limiter=e||null,this._projMatrix=o.create(),this._invProjMatrix=o.create(),this._frustum=[0,0,0,0],this._projectionChanged=!0,this._params={},this._vec=s.create(),this._update()}var n=t("minimal-event-emitter"),o=t("gl-matrix").mat4,s=t("gl-matrix").vec4,a=t("../util/pixelRatio"),u=t("../util/real"),h=t("../util/clamp"),l=t("../util/clearOwnProperties"),c=0,p=0,f=.5,d=.5,m=1,v=[1,0,1,0],_=[-1,-1,1,1];n(i),i.prototype.destroy=function(){l(this)},i.prototype.x=function(){return this._x},i.prototype.y=function(){return this._y},i.prototype.zoom=function(){return this._zoom},i.prototype.mediaAspectRatio=function(){return this._mediaAspectRatio},i.prototype.width=function(){return this._width},i.prototype.height=function(){return this._height},i.prototype.size=function(t){return t=t||{},t.width=this._width,t.height=this._height,t},i.prototype.parameters=function(t){return t=t||{},t.x=this._x,t.y=this._y,t.zoom=this._zoom,t.mediaAspectRatio=this._mediaAspectRatio,t},i.prototype.limiter=function(){return this._limiter},i.prototype.setX=function(t){this._resetParams(),this._params.x=t,this._update(this._params)},i.prototype.setY=function(t){this._resetParams(),this._params.y=t,this._update(this._params)},i.prototype.setZoom=function(t){this._resetParams(),this._params.zoom=t,this._update(this._params)},i.prototype.offsetX=function(t){this.setX(this._x+t)},i.prototype.offsetY=function(t){this.setY(this._y+t)},i.prototype.offsetZoom=function(t){this.setZoom(this._zoom+t)},i.prototype.setMediaAspectRatio=function(t){this._resetParams(),this._params.mediaAspectRatio=t,this._update(this._params)},i.prototype.setSize=function(t){this._resetParams(),this._params.width=t.width,this._params.height=t.height,this._update(this._params)},i.prototype.setParameters=function(t){this._resetParams(),this._params.x=t.x,this._params.y=t.y,this._params.zoom=t.zoom,this._params.mediaAspectRatio=t.mediaAspectRatio,this._update(this._params)},i.prototype.setLimiter=function(t){this._limiter=t||null,this._update()},i.prototype._resetParams=function(){var t=this._params;t.x=null,t.y=null,t.zoom=null,t.mediaAspectRatio=null,t.width=null,t.height=null},i.prototype._update=function(t){null==t&&(this._resetParams(),t=this._params);var e=this._x,r=this._y,i=this._zoom,n=this._mediaAspectRatio,o=this._width,s=this._height;if(t.x=null!=t.x?t.x:e,t.y=null!=t.y?t.y:r,t.zoom=null!=t.zoom?t.zoom:i,t.mediaAspectRatio=null!=t.mediaAspectRatio?t.mediaAspectRatio:n,t.width=null!=t.width?t.width:o,t.height=null!=t.height?t.height:s,this._limiter&&!(t=this._limiter(t)))throw new Error("Bad view limiter");var a=t.x,l=t.y,c=t.zoom,p=t.mediaAspectRatio,f=t.width,d=t.height;if(!(u(a)&&u(l)&&u(c)&&u(p)&&u(f)&&u(d)))throw new Error("Bad view - suspect a broken limiter");c=h(c,1e-6,Infinity),this._x=a,this._y=l,this._zoom=c,this._mediaAspectRatio=p,this._width=f,this._height=d,a===e&&l===r&&c===i&&p===n&&f===o&&d===s||(this._projectionChanged=!0,this.emit("change")),f===o&&d===s||this.emit("resize")},i.prototype._zoomX=function(){return this._zoom},i.prototype._zoomY=function(){var t=this._mediaAspectRatio,e=this._width/this._height,r=this._zoom,i=r*t/e;return isNaN(i)&&(i=r),i},i.prototype.updateWithControlParameters=function(t){var e=this.zoom(),r=this._zoomX(),i=this._zoomY();this.offsetX(t.axisScaledX*r+t.x*e),this.offsetY(t.axisScaledY*i+t.y*e),this.offsetZoom(t.zoom*e)},i.prototype._updateProjection=function(){var t=this._projMatrix,e=this._invProjMatrix,r=this._frustum;if(this._projectionChanged){var i=this._x,n=this._y,s=this._zoomX(),a=this._zoomY(),u=r[0]=.5-n+.5*a,h=r[1]=i-.5+.5*s,l=r[2]=.5-n-.5*a,c=r[3]=i-.5-.5*s;o.ortho(t,c,h,l,u,-1,1),o.invert(e,t),this._projectionChanged=!1}},i.prototype.projection=function(){return this._updateProjection(),this._projMatrix},i.prototype.inverseProjection=function(){return this._updateProjection(),this._invProjMatrix},i.prototype.intersects=function(t){this._updateProjection();for(var e=this._frustum,r=0;r0&&u[n]>i){s=!0;break}}if(!s)return!1}return!0},i.prototype.selectLevel=function(t){for(var e=a()*this.width(),r=this._zoom,i=0;i=e)return n}return t[t.length-1]},i.prototype.coordinatesToScreen=function(t,e){var r=this._vec;e||(e={});var i=this._width,n=this._height;if(i<=0||n<=0)return e.x=null,e.y=null,null;var o=t&&null!=t.x?t.x:f,a=t&&null!=t.y?t.y:d;s.set(r,o-.5,.5-a,-1,1),s.transformMat4(r,r,this.projection());for(var u=0;u<3;u++)r[u]/=r[3];return e.x=i*(r[0]+1)/2,e.y=n*(1-r[1])/2,e},i.prototype.screenToCoordinates=function(t,e){var r=this._vec;e||(e={});var i=this._width,n=this._height,o=2*t.x/i-1,a=1-2*t.y/n;return s.set(r,o,a,1,1),s.transformMat4(r,r,this.inverseProjection()),e.x=.5+r[0],e.y=.5-r[1],e},i.limit={x:function(t,e){return function(r){return r.x=h(r.x,t,e),r}},y:function(t,e){return function(r){return r.y=h(r.y,t,e),r}},zoom:function(t,e){return function(r){return r.zoom=h(r.zoom,t,e),r}},resolution:function(t){return function(e){if(e.width<=0||e.height<=0)return e;var r=e.width,i=a()*r/t;return e.zoom=h(e.zoom,i,Infinity),e}},visibleX:function(t,e){return function(r){var i=e-t;r.zoom>i&&(r.zoom=i);var n=t+.5*r.zoom,o=e-.5*r.zoom;return r.x=h(r.x,n,o),r}},visibleY:function(t,e){return function(r){if(r.width<=0||r.height<=0)return r;var i=r.width/r.height,n=i/r.mediaAspectRatio,o=(e-t)*n;r.zoom>o&&(r.zoom=o);var s=t+.5*r.zoom/n,a=e-.5*r.zoom/n;return r.y=h(r.y,s,a),r}},letterbox:function(){return function(t){if(t.width<=0||t.height<=0)return t;var e=t.width/t.height,r=e/t.mediaAspectRatio;t.mediaAspectRatio>=e&&(t.zoom=Math.min(t.zoom,1)),t.mediaAspectRatio<=e&&(t.zoom=Math.min(t.zoom,r));var i,n;t.zoom>1?i=n=.5:(i=0+.5*t.zoom/1,n=1-.5*t.zoom/1);var o,s;return t.zoom>r?o=s=.5:(o=0+.5*t.zoom/r,s=1-.5*t.zoom/r),t.x=h(t.x,i,n),t.y=h(t.y,o,s),t}}},i.type=i.prototype.type="flat",e.exports=i},{"../util/clamp":90,"../util/clearOwnProperties":91,"../util/pixelRatio":110,"../util/real":113,"gl-matrix":3,"minimal-event-emitter":14}],118:[function(t,e,r){"use strict";function i(t,e){this._yaw=t&&null!=t.yaw?t.yaw:_,this._pitch=t&&null!=t.pitch?t.pitch:y,this._roll=t&&null!=t.roll?t.roll:g,this._fov=t&&null!=t.fov?t.fov:w,this._width=t&&null!=t.width?t.width:m,this._height=t&&null!=t.height?t.height:v,this._projectionCenterX=t&&null!=t.projectionCenterX?t.projectionCenterX:M,this._projectionCenterY=t&&null!=t.projectionCenterY?t.projectionCenterY:b,this._limiter=e||null,this._projMatrix=o.create(),this._invProjMatrix=o.create(),this._frustum=[s.create(),s.create(),s.create(),s.create(),s.create()],this._projectionChanged=!0,this._params={},this._fovs={},this._tmpVec=s.create(),this._update()}var n=t("minimal-event-emitter"),o=t("gl-matrix").mat4,s=t("gl-matrix").vec4,a=t("../util/pixelRatio"),u=t("../util/convertFov"),h=t("../util/mod"),l=t("../util/real"),c=t("../util/clamp"),p=t("../util/decimal"),f=t("../util/compose"),d=t("../util/clearOwnProperties"),m=0,v=0,_=0,y=0,g=0,w=Math.PI/4,M=0,b=0;n(i),i.prototype.destroy=function(){d(this)},i.prototype.yaw=function(){return this._yaw},i.prototype.pitch=function(){return this._pitch},i.prototype.roll=function(){return this._roll},i.prototype.projectionCenterX=function(){return this._projectionCenterX},i.prototype.projectionCenterY=function(){return this._projectionCenterY},i.prototype.fov=function(){return this._fov},i.prototype.width=function(){return this._width},i.prototype.height=function(){return this._height},i.prototype.size=function(t){return t=t||{},t.width=this._width,t.height=this._height,t},i.prototype.parameters=function(t){return t=t||{},t.yaw=this._yaw,t.pitch=this._pitch,t.roll=this._roll,t.fov=this._fov,t},i.prototype.limiter=function(){return this._limiter},i.prototype.setYaw=function(t){this._resetParams(),this._params.yaw=t,this._update(this._params)},i.prototype.setPitch=function(t){this._resetParams(),this._params.pitch=t,this._update(this._params)},i.prototype.setRoll=function(t){this._resetParams(),this._params.roll=t,this._update(this._params)},i.prototype.setFov=function(t){this._resetParams(),this._params.fov=t,this._update(this._params)},i.prototype.setProjectionCenterX=function(t){this._resetParams(),this._params.projectionCenterX=t,this._update(this._params)},i.prototype.setProjectionCenterY=function(t){this._resetParams(),this._params.projectionCenterY=t,this._update(this._params)},i.prototype.offsetYaw=function(t){this.setYaw(this._yaw+t)},i.prototype.offsetPitch=function(t){this.setPitch(this._pitch+t)},i.prototype.offsetRoll=function(t){this.setRoll(this._roll+t)},i.prototype.offsetFov=function(t){this.setFov(this._fov+t)},i.prototype.setSize=function(t){this._resetParams(),this._params.width=t.width,this._params.height=t.height,this._update(this._params)},i.prototype.setParameters=function(t){this._resetParams(),this._params.yaw=t.yaw,this._params.pitch=t.pitch,this._params.roll=t.roll,this._params.fov=t.fov,this._params.projectionCenterX=t.projectionCenterX,this._params.projectionCenterY=t.projectionCenterY,this._update(this._params)},i.prototype.setLimiter=function(t){this._limiter=t||null,this._update()},i.prototype._resetParams=function(){var t=this._params;t.yaw=null,t.pitch=null,t.roll=null,t.fov=null,t.width=null,t.height=null},i.prototype._update=function(t){null==t&&(this._resetParams(),t=this._params);var e=this._yaw,r=this._pitch,i=this._roll,n=this._fov,o=this._projectionCenterX,s=this._projectionCenterY,a=this._width,u=this._height;if(t.yaw=null!=t.yaw?t.yaw:e,t.pitch=null!=t.pitch?t.pitch:r,t.roll=null!=t.roll?t.roll:i,t.fov=null!=t.fov?t.fov:n,t.width=null!=t.width?t.width:a,t.height=null!=t.height?t.height:u,t.projectionCenterX=null!=t.projectionCenterX?t.projectionCenterX:o,t.projectionCenterY=null!=t.projectionCenterY?t.projectionCenterY:s,this._limiter&&!(t=this._limiter(t)))throw new Error("Bad view limiter");t=this._normalize(t);var h=t.yaw,c=t.pitch,p=t.roll,f=t.fov,d=t.width,m=t.height,v=t.projectionCenterX,_=t.projectionCenterY;if(!(l(h)&&l(c)&&l(p)&&l(f)&&l(d)&&l(m)&&l(v)&&l(_)))throw new Error("Bad view - suspect a broken limiter");this._yaw=h,this._pitch=c,this._roll=p,this._fov=f,this._width=d,this._height=m,this._projectionCenterX=v,this._projectionCenterY=_,h===e&&c===r&&p===i&&f===n&&d===a&&m===u&&v===o&&_===s||(this._projectionChanged=!0,this.emit("change")),d===a&&m===u||this.emit("resize")},i.prototype._normalize=function(t){this._normalizeCoordinates(t);var e=u.htov(Math.PI,t.width,t.height),r=isNaN(e)?Math.PI:Math.min(Math.PI,e);return t.fov=c(t.fov,1e-6,r-1e-6),t},i.prototype._normalizeCoordinates=function(t){return"yaw"in t&&(t.yaw=h(t.yaw-Math.PI,-2*Math.PI)+Math.PI),"pitch"in t&&(t.pitch=h(t.pitch-Math.PI,-2*Math.PI)+Math.PI),"roll"in t&&(t.roll=h(t.roll-Math.PI,-2*Math.PI)+Math.PI),t},i.prototype.normalizeToClosest=function(t,e){var r=this._yaw,i=this._pitch,n=t.yaw,o=t.pitch,s=n-2*Math.PI,a=n+2*Math.PI;Math.abs(s-r)=0&&(o=!0)}if(!o)return!1}return!0},i.prototype.selectLevel=function(t){for(var e=a()*this._height,r=Math.tan(.5*this._fov),i=0;i=e)return n}return t[t.length-1]},i.prototype.coordinatesToScreen=function(t,e){var r=this._tmpVec;e||(e={});var i=this._width,n=this._height;if(i<=0||n<=0)return e.x=null,e.y=null,null;var o=t.yaw,a=t.pitch,u=Math.sin(o)*Math.cos(a),h=-Math.sin(t.pitch),l=-Math.cos(o)*Math.cos(a);return s.set(r,u,h,l,1),s.transformMat4(r,r,this.projection()),r[3]>=0?(e.x=i*(r[0]/r[3]+1)/2,e.y=n*(1-r[1]/r[3])/2,e):(e.x=null,e.y=null,null)},i.prototype.screenToCoordinates=function(t,e){var r=this._tmpVec;e||(e={});var i=this._width,n=this._height,o=2*t.x/i-1,a=1-2*t.y/n;s.set(r,o,a,1,1),s.transformMat4(r,r,this.inverseProjection());var u=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);return e.yaw=Math.atan2(r[0],-r[2]),e.pitch=Math.acos(r[1]/u)-Math.PI/2,this._normalizeCoordinates(e),e},i.prototype.coordinatesToPerspectiveTransform=function(t,e,r){r=r||"";var i=this._height,n=this._width,o=this._fov,s=.5*i/Math.tan(o/2),a="";return a+="translateX("+p(n/2)+"px) ",a+="translateY("+p(i/2)+"px) ",a+="translateX(-50%) translateY(-50%) ",a+="perspective("+p(s)+"px) ",a+="translateZ("+p(s)+"px) ",a+="rotateZ("+p(-this._roll)+"rad) ",a+="rotateX("+p(-this._pitch)+"rad) ",a+="rotateY("+p(this._yaw)+"rad) ",a+="rotateY("+p(-t.yaw)+"rad) ",a+="rotateX("+p(t.pitch)+"rad) ",a+="translateZ("+p(-e)+"px) ",a+=r+" "},i.limit={yaw:function(t,e){return function(r){return r.yaw=c(r.yaw,t,e),r}},pitch:function(t,e){return function(r){return r.pitch=c(r.pitch,t,e),r}},roll:function(t,e){return function(r){return r.roll=c(r.roll,t,e),r}},hfov:function(t,e){return function(r){var i=r.width,n=r.height;if(i>0&&n>0){var o=u.htov(t,i,n),s=u.htov(e,i,n);r.fov=c(r.fov,o,s)}return r}},vfov:function(t,e){return function(r){return r.fov=c(r.fov,t,e),r}},resolution:function(t){return function(e){var r=e.height;if(r){var i=a()*r,n=2*Math.atan(i/t);e.fov=c(e.fov,n,Infinity)}return e}},traditional:function(t,e,r){return r=null!=r?r:e,f(i.limit.resolution(t),i.limit.vfov(0,e),i.limit.hfov(0,r),i.limit.pitch(-Math.PI/2,Math.PI/2))}},i.type=i.prototype.type="rectilinear",e.exports=i},{"../util/clamp":90,"../util/clearOwnProperties":91,"../util/compose":93,"../util/convertFov":94,"../util/decimal":95,"../util/mod":106,"../util/pixelRatio":110,"../util/real":113,"gl-matrix":3,"minimal-event-emitter":14}]},{},[56])(56)});